From: Michal Privoznik Date: Fri, 21 Jun 2024 12:00:32 +0000 (+0200) Subject: qemu_capabilities: Probe SEV capabilities even for QEMU_CAPS_SEV_SNP_GUEST X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=d00816209ef1eccea9e01737fcee35bebc772c96;p=libvirt.git qemu_capabilities: Probe SEV capabilities even for QEMU_CAPS_SEV_SNP_GUEST While it's very unlikely to have QEMU that supports SEV-SNP but doesn't support plain SEV, for completeness sake we ought to query SEV capabilities if QEMU supports either. And similarly to QEMU_CAPS_SEV_GUEST we need to clear the capability if talking to QEMU proves SEV is not really supported. This in turn removes the 'sev-snp-guest' capability from one of our test cases as Peter's machine he uses to refresh capabilities is not SEV capable. But that's okay. It's consistent with 'sev-guest' capability. Signed-off-by: Michal Privoznik Reviewed-by: Jiri Denemark Reviewed-by: Daniel P. Berrangé --- diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index fe704d16dd..adaf5f9c26 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -3465,7 +3465,8 @@ virQEMUCapsProbeQMPSEVCapabilities(virQEMUCaps *qemuCaps, int rc = -1; virSEVCapability *caps = NULL; - if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_SEV_GUEST)) + if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_SEV_GUEST) && + !virQEMUCapsGet(qemuCaps, QEMU_CAPS_SEV_SNP_GUEST)) return 0; if ((rc = qemuMonitorGetSEVCapabilities(mon, &caps)) < 0) @@ -3474,6 +3475,7 @@ virQEMUCapsProbeQMPSEVCapabilities(virQEMUCaps *qemuCaps, /* SEV isn't actually supported */ if (rc == 0) { virQEMUCapsClear(qemuCaps, QEMU_CAPS_SEV_GUEST); + virQEMUCapsClear(qemuCaps, QEMU_CAPS_SEV_SNP_GUEST); return 0; } diff --git a/tests/qemucapabilitiesdata/caps_9.1.0_x86_64.xml b/tests/qemucapabilitiesdata/caps_9.1.0_x86_64.xml index a9973a0913..e0332ce1e8 100644 --- a/tests/qemucapabilitiesdata/caps_9.1.0_x86_64.xml +++ b/tests/qemucapabilitiesdata/caps_9.1.0_x86_64.xml @@ -203,7 +203,6 @@ - 9000050 43100246 v9.0.0-1388-g80e8f06021-dirty