summaryrefslogtreecommitdiffstats
path: root/arch/x86/include/asm/kvm-x86-ops.h
diff options
context:
space:
mode:
authorMichael Roth <michael.roth@amd.com>2021-12-16 18:13:54 +0100
committerPaolo Bonzini <pbonzini@redhat.com>2022-01-07 16:44:46 +0100
commit405329fc9aeef1e3e2eccaadf32b539ad6c7120f (patch)
treedd8be0f01d94130ad82ea54e3dd6b51808c796e8 /arch/x86/include/asm/kvm-x86-ops.h
parentKVM: VMX: Provide vmread version using asm-goto-with-outputs (diff)
downloadlinux-405329fc9aeef1e3e2eccaadf32b539ad6c7120f.tar.xz
linux-405329fc9aeef1e3e2eccaadf32b539ad6c7120f.zip
KVM: SVM: include CR3 in initial VMSA state for SEV-ES guests
Normally guests will set up CR3 themselves, but some guests, such as kselftests, and potentially CONFIG_PVH guests, rely on being booted with paging enabled and CR3 initialized to a pre-allocated page table. Currently CR3 updates via KVM_SET_SREGS* are not loaded into the guest VMCB until just prior to entering the guest. For SEV-ES/SEV-SNP, this is too late, since it will have switched over to using the VMSA page prior to that point, with the VMSA CR3 copied from the VMCB initial CR3 value: 0. Address this by sync'ing the CR3 value into the VMCB save area immediately when KVM_SET_SREGS* is issued so it will find it's way into the initial VMSA. Suggested-by: Tom Lendacky <thomas.lendacky@amd.com> Signed-off-by: Michael Roth <michael.roth@amd.com> Message-Id: <20211216171358.61140-10-michael.roth@amd.com> [Remove vmx_post_set_cr3; add a remark about kvm_set_cr3 not calling the new hook. - Paolo] Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'arch/x86/include/asm/kvm-x86-ops.h')
-rw-r--r--arch/x86/include/asm/kvm-x86-ops.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/arch/x86/include/asm/kvm-x86-ops.h b/arch/x86/include/asm/kvm-x86-ops.h
index 9e50da3ed01a..f658bb4dbb74 100644
--- a/arch/x86/include/asm/kvm-x86-ops.h
+++ b/arch/x86/include/asm/kvm-x86-ops.h
@@ -35,6 +35,7 @@ KVM_X86_OP(get_cpl)
KVM_X86_OP(set_segment)
KVM_X86_OP_NULL(get_cs_db_l_bits)
KVM_X86_OP(set_cr0)
+KVM_X86_OP_NULL(post_set_cr3)
KVM_X86_OP(is_valid_cr4)
KVM_X86_OP(set_cr4)
KVM_X86_OP(set_efer)