aboutsummaryrefslogtreecommitdiff
path: root/target/i386/sev.c
diff options
context:
space:
mode:
authorMichael Roth <michael.roth@amd.com>2024-05-30 06:16:43 -0500
committerPaolo Bonzini <pbonzini@redhat.com>2024-06-05 11:01:06 +0200
commite3cddff93c1f88fea3b26841e792dc0be6b6fae8 (patch)
treec5b5e17c4769a70147a7e75df06d86ce09837a56 /target/i386/sev.c
parent47e76d03b155e43beca550251a6eb7ea926c059f (diff)
downloadqemu-e3cddff93c1f88fea3b26841e792dc0be6b6fae8.zip
qemu-e3cddff93c1f88fea3b26841e792dc0be6b6fae8.tar.gz
qemu-e3cddff93c1f88fea3b26841e792dc0be6b6fae8.tar.bz2
i386/sev: Enable KVM_HC_MAP_GPA_RANGE hcall for SNP guests
KVM will forward GHCB page-state change requests to userspace in the form of KVM_HC_MAP_GPA_RANGE, so make sure the hypercall handling is enabled for SNP guests. Signed-off-by: Michael Roth <michael.roth@amd.com> Signed-off-by: Pankaj Gupta <pankaj.gupta@amd.com> Message-ID: <20240530111643.1091816-32-pankaj.gupta@amd.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'target/i386/sev.c')
-rw-r--r--target/i386/sev.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/target/i386/sev.c b/target/i386/sev.c
index eaf5fc6..abb6306 100644
--- a/target/i386/sev.c
+++ b/target/i386/sev.c
@@ -14,6 +14,7 @@
#include "qemu/osdep.h"
#include <linux/kvm.h>
+#include <linux/kvm_para.h>
#include <linux/psp-sev.h>
#include <sys/ioctl.h>
@@ -758,6 +759,10 @@ sev_snp_launch_start(SevCommonState *sev_common)
trace_kvm_sev_snp_launch_start(start->policy,
sev_snp_guest->guest_visible_workarounds);
+ if (!kvm_enable_hypercall(BIT_ULL(KVM_HC_MAP_GPA_RANGE))) {
+ return 1;
+ }
+
rc = sev_ioctl(sev_common->sev_fd, KVM_SEV_SNP_LAUNCH_START,
start, &fw_error);
if (rc < 0) {