[PATCH RFC v9 43/51] KVM: SEV: Configure MMU to check for private fault flags

From: Michael Roth
Date: Mon Jun 12 2023 - 00:52:51 EST


SEV-SNP uses a #NPF flag to indicate whether the guest expects a shared
or a private page, which in turn dictates whether the KVM MMU should
map a normal page or a gmem page. Set the appropriate mask to enable
this handling for SEV-SNP guests.

Signed-off-by: Michael Roth <michael.roth@xxxxxxx>
---
arch/x86/kvm/svm/sev.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/arch/x86/kvm/svm/sev.c b/arch/x86/kvm/svm/sev.c
index ec74ff5e09c7..909ecd90d199 100644
--- a/arch/x86/kvm/svm/sev.c
+++ b/arch/x86/kvm/svm/sev.c
@@ -2006,6 +2006,8 @@ static int snp_launch_start(struct kvm *kvm, struct kvm_sev_cmd *argp)
if (rc)
goto e_free_context;

+ kvm->arch.mmu_private_fault_mask = PFERR_GUEST_ENC_MASK;
+
return 0;

e_free_context:
--
2.25.1