summaryrefslogtreecommitdiffstats
path: root/arch/x86/kvm/svm/svm.c
diff options
context:
space:
mode:
authorBrijesh Singh <brijesh.singh@amd.com>2022-04-26 19:11:25 +0000
committerSuravee Suthikulpanit <suravee.suthikulpanit@amd.com>2022-07-13 17:27:29 -0500
commit20986a62aa60425ec5dc6c7a163e07217d6f11d0 (patch)
tree45aea09478e150471591c2b2eb774d11f242e07a /arch/x86/kvm/svm/svm.c
parent00914f4e4b99c449bf7bb15a28b27e99287c90ef (diff)
downloadcachepc-linux-20986a62aa60425ec5dc6c7a163e07217d6f11d0.tar.gz
cachepc-linux-20986a62aa60425ec5dc6c7a163e07217d6f11d0.zip
KVM: SVM: Introduce ops for the post gfn map and unmap
When SEV-SNP is enabled in the guest VM, the guest memory pages can either be a private or shared. A write from the hypervisor goes through the RMP checks. If hardware sees that hypervisor is attempting to write to a guest private page, then it triggers an RMP violation #PF. To avoid the RMP violation with GHCB pages, added new post_{map,unmap}_gfn functions to verify if its safe to map GHCB pages. Uses a spinlock to protect against the page state change for existing mapped pages. Need to add generic post_{map,unmap}_gfn() ops that can be used to verify that its safe to map a given guest page in the hypervisor. This patch will need to be revisited later after consensus is reached on how to manage guest private memory as probably UPM private memslots will be able to handle this page state change more gracefully. Signed-off-by: Brijesh Singh <brijesh.singh@amd.com> Signed-off by: Ashish Kalra <ashish.kalra@amd.com>
Diffstat (limited to 'arch/x86/kvm/svm/svm.c')
-rw-r--r--arch/x86/kvm/svm/svm.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/arch/x86/kvm/svm/svm.c b/arch/x86/kvm/svm/svm.c
index 4144704ad7d4..76f5bea17ea0 100644
--- a/arch/x86/kvm/svm/svm.c
+++ b/arch/x86/kvm/svm/svm.c
@@ -4738,7 +4738,10 @@ static struct kvm_x86_ops svm_x86_ops __initdata = {
.vcpu_get_apicv_inhibit_reasons = avic_vcpu_get_apicv_inhibit_reasons,
.alloc_apic_backing_page = svm_alloc_apic_backing_page,
+
.rmp_page_level_adjust = sev_rmp_page_level_adjust,
+
+ .update_protected_guest_state = sev_snp_update_protected_guest_state,
};
/*