]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
tools: inform user which CVM is found during validation
authorDaniel P. Berrangé <berrange@redhat.com>
Thu, 20 Nov 2025 09:36:58 +0000 (04:36 -0500)
committerDaniel P. Berrangé <berrange@redhat.com>
Thu, 20 Nov 2025 17:26:13 +0000 (17:26 +0000)
For AMD, the virt-host-validate 'secure guest' check reports
support for SEV, and there are then further check results
printed for SEV-ES/SEV-SNP which are overly verbose and the
long lines break output alignment.

This uses the new ability to report details with PASS results
to concisely tell the user which out of SEV/SEV-ES/SEV-SNP
are found. Only a single answer is neede, as SEV-SNP implies
SEV & SEV-ES, and SEV-ES implies SEV.

The TDX s390x PROT-VIRT checks also identify themselves.

Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
tools/virt-host-validate-common.c

index 6516d96484bf60b173bb97445fc0ed378c06c448..344f9656e5cf1170dbc4606712f2a903be7ad82b 100644 (file)
@@ -378,8 +378,7 @@ bool virHostKernelModuleIsLoaded(const char *module)
 
 
 static int
-virHostValidateAMDSev(const char *hvname,
-                      virValidateLevel level)
+virHostValidateAMDSev(virValidateLevel level)
 {
     g_autofree char *mod_value = NULL;
     uint32_t eax, ebx;
@@ -405,31 +404,14 @@ virHostValidateAMDSev(const char *hvname,
         return VIR_VALIDATE_FAILURE(level);
     }
 
-    virValidatePass();
-
-    virValidateCheck(hvname, "%s",
-                     _("Checking for AMD Secure Encrypted Virtualization-Encrypted State (SEV-ES)"));
-
     virHostCPUX86GetCPUID(0x8000001F, 0, &eax, &ebx, NULL, NULL);
 
-    if (eax & (1U << 3)) {
-        virValidatePass();
-    } else {
-        virValidateFail(level,
-                        "AMD SEV-ES is not supported");
-        return VIR_VALIDATE_FAILURE(level);
-    }
-
-    virValidateCheck(hvname, "%s",
-                     _("Checking for AMD Secure Encrypted Virtualization-Secure Nested Paging (SEV-SNP)"));
-
-    if (eax & (1U << 4)) {
-        virValidatePass();
-    } else {
-        virValidateFail(level,
-                        "AMD SEV-SNP is not supported");
-        return VIR_VALIDATE_FAILURE(level);
-    }
+    if (eax & (1U << 4))
+        virValidatePassDetails("SEV-SNP");
+    else if (eax & (1U << 3))
+        virValidatePassDetails("SEV-ES");
+    else
+        virValidatePassDetails("SEV");
 
     return 1;
 }
@@ -453,7 +435,7 @@ static int virHostValidateIntelTDX(virValidateLevel level)
         return VIR_VALIDATE_FAILURE(level);
     }
 
-    virValidatePass();
+    virValidatePassDetails("TDX");
     return 1;
 }
 
@@ -496,7 +478,7 @@ int virHostValidateSecureGuests(const char *hvname,
                                            G_N_ELEMENTS(kIBMValues),
                                            VIR_KERNEL_CMDLINE_FLAGS_SEARCH_FIRST |
                                            VIR_KERNEL_CMDLINE_FLAGS_CMP_PREFIX)) {
-                virValidatePass();
+                virValidatePassDetails("PROT-VIRT");
                 return 1;
             } else {
                 virValidateFail(level,