[PATCH] qemu: Fix the check of AMD secure guest support

Vasiliy Ulyanov posted 1 patch 2 years, 5 months ago
Test syntax-check failed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/20211119123738.25107-1-vulyanov@suse.de
src/qemu/qemu_capabilities.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[PATCH] qemu: Fix the check of AMD secure guest support
Posted by Vasiliy Ulyanov 2 years, 5 months ago
The content of /sys/module/kvm_amd/parameters/sev may vary depending on
the kernel version. Check also for 'Y' and 'y' in addition to '1' to
cover several possible variants. The fix is similar to the one
introduced in commit 3f9c1a4bb841.

Signed-off-by: Vasiliy Ulyanov <vulyanov@suse.de>
---
 src/qemu/qemu_capabilities.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index 67fae46a34..b864f4d7df 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -4681,7 +4681,7 @@ virQEMUCapsKVMSupportsSecureGuestAMD(void)
     if (virFileReadValueString(&modValue, "/sys/module/kvm_amd/parameters/sev") < 0)
         return false;
 
-    if (modValue[0] != '1')
+    if (modValue[0] != '1' && modValue[0] != 'Y' && modValue[0] != 'y')
         return false;
 
     if (virFileExists(QEMU_DEV_SEV))
-- 
2.33.1