vmm: MTRR should be saved/restored

This fixes restoring a Linux VM if it was suspended while in the GRUB
menu.

Adding MTTR increases the kernel dump size by 256 bytes per vCPU.

Sponsored by:   vStack
Reviewed by:    markj, rew
Differential Revision:  https://reviews.freebsd.org/D43226
This commit is contained in:
Vitaliy Gusev 2023-12-29 09:03:20 -09:00 committed by Robert Wing
parent b831c7732c
commit 683ea4d22b
2 changed files with 5 additions and 0 deletions

View File

@ -2781,6 +2781,8 @@ svm_vcpu_snapshot(void *vcpui, struct vm_snapshot_meta *meta)
SNAPSHOT_VAR_OR_LEAVE(vcpu->asid.gen, meta, err, done);
SNAPSHOT_VAR_OR_LEAVE(vcpu->asid.num, meta, err, done);
SNAPSHOT_BUF_OR_LEAVE(&vcpu->mtrr, sizeof(vcpu->mtrr), meta, err, done);
/* Set all caches dirty */
if (meta->op == VM_SNAPSHOT_RESTORE)
svm_set_dirty(vcpu, 0xffffffff);

View File

@ -4200,6 +4200,9 @@ vmx_vcpu_snapshot(void *vcpui, struct vm_snapshot_meta *meta)
SNAPSHOT_BUF_OR_LEAVE(vcpu->pir_desc,
sizeof(*vcpu->pir_desc), meta, err, done);
SNAPSHOT_BUF_OR_LEAVE(&vcpu->mtrr,
sizeof(vcpu->mtrr), meta, err, done);
vmxctx = &vcpu->ctx;
SNAPSHOT_VAR_OR_LEAVE(vmxctx->guest_rdi, meta, err, done);
SNAPSHOT_VAR_OR_LEAVE(vmxctx->guest_rsi, meta, err, done);