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 on 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 <mprivozn(a)redhat.com>
---
src/qemu/qemu_capabilities.c | 4 +++-
tests/qemucapabilitiesdata/caps_9.1.0_x86_64.xml | 1 -
2 files changed, 3 insertions(+), 2 deletions(-)
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 @@
<flag name='display-reload'/>
<flag name='usb-mtp'/>
<flag name='virtio-sound'/>
- <flag name='sev-snp-guest'/>
<version>9000050</version>
<microcodeVersion>43100246</microcodeVersion>
<package>v9.0.0-1388-g80e8f06021-dirty</package>
--
2.44.2