672f70aa3d
Update to 2.11.1, plus a few other fixes. OBS-URL: https://build.opensuse.org/request/show/579209 OBS-URL: https://build.opensuse.org/package/show/Virtualization/qemu?expand=0&rev=392
46 lines
1.4 KiB
Diff
46 lines
1.4 KiB
Diff
From b4998b726af3a1da2dc346cac8796ca8fd6b88cd Mon Sep 17 00:00:00 2001
|
|
From: Brijesh Singh <brijesh.singh@amd.com>
|
|
Date: Thu, 15 Feb 2018 09:03:24 -0600
|
|
Subject: [PATCH] sev/i386: add support to KVM_SEV_GUEST_STATUS
|
|
|
|
The command is used to query the current SEV guest status. We use this
|
|
command to query the guest policy for QMP query-sev command.
|
|
|
|
Cc: Paolo Bonzini <pbonzini@redhat.com>
|
|
Cc: Richard Henderson <rth@twiddle.net>
|
|
Cc: Eduardo Habkost <ehabkost@redhat.com>
|
|
Signed-off-by: Brijesh Singh <brijesh.singh@amd.com>
|
|
[BR: FATE#322124]
|
|
Signed-off-by: Bruce Rogers <brogers@suse.com>
|
|
---
|
|
target/i386/sev.c | 16 ++++++++++++++++
|
|
1 file changed, 16 insertions(+)
|
|
|
|
diff --git a/target/i386/sev.c b/target/i386/sev.c
|
|
index e3236f5bb7..559881084d 100644
|
|
--- a/target/i386/sev.c
|
|
+++ b/target/i386/sev.c
|
|
@@ -437,6 +437,22 @@ sev_get_fw_version(uint8_t *major, uint8_t *minor, uint8_t *build)
|
|
void
|
|
sev_get_policy(uint32_t *policy)
|
|
{
|
|
+ struct kvm_sev_guest_status status = {};
|
|
+ int r, err;
|
|
+
|
|
+ if (current_sev_guest_state == SEV_STATE_UNINIT) {
|
|
+ return;
|
|
+ }
|
|
+
|
|
+ r = sev_ioctl(KVM_SEV_GUEST_STATUS, &status, &err);
|
|
+ if (r) {
|
|
+ error_report("%s: failed to get platform status ret=%d "
|
|
+ "fw_error='%d: %s'", __func__, r, err,
|
|
+ fw_error_to_str(err));
|
|
+ return;
|
|
+ }
|
|
+
|
|
+ *policy = status.policy;
|
|
}
|
|
|
|
static int
|