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@xxxxxxxxxx> Cc: kvm@xxxxxxxxxxxxxxx Signed-off-by: Brijesh Singh <brijesh.singh@xxxxxxx> --- accel/kvm/sev.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/accel/kvm/sev.c b/accel/kvm/sev.c index 186834364eed..b149f4ae6441 100644 --- a/accel/kvm/sev.c +++ b/accel/kvm/sev.c @@ -418,6 +418,18 @@ 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; + + 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 -- 2.14.3