[PATCH 5/5] tools: inform user which hardware virt was found during validation

Daniel P. Berrangé via Devel posted 5 patches 23 hours ago
[PATCH 5/5] tools: inform user which hardware virt was found during validation
Posted by Daniel P. Berrangé via Devel 23 hours ago
From: Daniel P. Berrangé <berrange@redhat.com>

On x86 we can indicate VMX or SVM, while s390x would be SIE.

There are several choices on ppc64 and virt-host-validate does
not try to detect any, so don't report a specific technology
on ppc64 arch.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
---
 tools/virt-host-validate-qemu.c | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/tools/virt-host-validate-qemu.c b/tools/virt-host-validate-qemu.c
index 833bb1b914..f04fc61cb3 100644
--- a/tools/virt-host-validate-qemu.c
+++ b/tools/virt-host-validate-qemu.c
@@ -34,6 +34,7 @@ int virHostValidateQEMU(void)
     bool hasHwVirt = false;
     bool hasVirtFlag = false;
     virArch arch = virArchFromHost();
+    const char *hwVirtName = NULL;
     const char *kvmhint = _("Check that CPU and firmware supports virtualization and kvm module is loaded");
 
     if (!(flags = virHostValidateGetCPUFlags()))
@@ -44,15 +45,22 @@ int virHostValidateQEMU(void)
     case VIR_ARCH_X86_64:
         hasVirtFlag = true;
         kvmhint = _("Check that the 'kvm-intel' or 'kvm-amd' modules are loaded & the BIOS has enabled virtualization");
-        if (virBitmapIsBitSet(flags, VIR_HOST_VALIDATE_CPU_FLAG_SVM) ||
-            virBitmapIsBitSet(flags, VIR_HOST_VALIDATE_CPU_FLAG_VMX))
+        if (virBitmapIsBitSet(flags, VIR_HOST_VALIDATE_CPU_FLAG_SVM)) {
+            hwVirtName = "SVM";
             hasHwVirt = true;
+        }
+        if (virBitmapIsBitSet(flags, VIR_HOST_VALIDATE_CPU_FLAG_VMX)) {
+            hwVirtName = "VMX";
+            hasHwVirt = true;
+        }
         break;
     case VIR_ARCH_S390:
     case VIR_ARCH_S390X:
         hasVirtFlag = true;
-        if (virBitmapIsBitSet(flags, VIR_HOST_VALIDATE_CPU_FLAG_SIE))
+        if (virBitmapIsBitSet(flags, VIR_HOST_VALIDATE_CPU_FLAG_SIE)) {
+            hwVirtName = "SIE";
             hasHwVirt = true;
+        }
         break;
     case VIR_ARCH_PPC64:
     case VIR_ARCH_PPC64LE:
@@ -66,7 +74,7 @@ int virHostValidateQEMU(void)
     if (hasVirtFlag) {
         virValidateCheck("QEMU", "%s", _("Checking for hardware virtualization"));
         if (hasHwVirt) {
-            virValidatePass();
+            virValidatePassDetails(hwVirtName);
         } else {
             virValidateFail(VIR_VALIDATE_FAIL,
                             _("Host not compatible with KVM; HW virtualization CPU features not found. Only emulated CPUs are available; performance will be significantly limited"));
-- 
2.51.1

Re: [PATCH 5/5] tools: inform user which hardware virt was found during validation
Posted by Daniel P. Berrangé via Devel 16 hours ago
On Thu, Nov 20, 2025 at 10:14:51AM +0000, Daniel P. Berrangé wrote:
> From: Daniel P. Berrangé <berrange@redhat.com>
> 
> On x86 we can indicate VMX or SVM, while s390x would be SIE.
> 
> There are several choices on ppc64 and virt-host-validate does
> not try to detect any, so don't report a specific technology
> on ppc64 arch.

After advice from some PowerPC experts, I'll add "LPCR" as the
annotation for ppc64 (Logical Parititoning Control Register).

> 
> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
> ---
>  tools/virt-host-validate-qemu.c | 16 ++++++++++++----
>  1 file changed, 12 insertions(+), 4 deletions(-)
> 
> diff --git a/tools/virt-host-validate-qemu.c b/tools/virt-host-validate-qemu.c
> index 833bb1b914..f04fc61cb3 100644
> --- a/tools/virt-host-validate-qemu.c
> +++ b/tools/virt-host-validate-qemu.c
> @@ -34,6 +34,7 @@ int virHostValidateQEMU(void)
>      bool hasHwVirt = false;
>      bool hasVirtFlag = false;
>      virArch arch = virArchFromHost();
> +    const char *hwVirtName = NULL;
>      const char *kvmhint = _("Check that CPU and firmware supports virtualization and kvm module is loaded");
>  
>      if (!(flags = virHostValidateGetCPUFlags()))
> @@ -44,15 +45,22 @@ int virHostValidateQEMU(void)
>      case VIR_ARCH_X86_64:
>          hasVirtFlag = true;
>          kvmhint = _("Check that the 'kvm-intel' or 'kvm-amd' modules are loaded & the BIOS has enabled virtualization");
> -        if (virBitmapIsBitSet(flags, VIR_HOST_VALIDATE_CPU_FLAG_SVM) ||
> -            virBitmapIsBitSet(flags, VIR_HOST_VALIDATE_CPU_FLAG_VMX))
> +        if (virBitmapIsBitSet(flags, VIR_HOST_VALIDATE_CPU_FLAG_SVM)) {
> +            hwVirtName = "SVM";
>              hasHwVirt = true;
> +        }
> +        if (virBitmapIsBitSet(flags, VIR_HOST_VALIDATE_CPU_FLAG_VMX)) {
> +            hwVirtName = "VMX";
> +            hasHwVirt = true;
> +        }
>          break;
>      case VIR_ARCH_S390:
>      case VIR_ARCH_S390X:
>          hasVirtFlag = true;
> -        if (virBitmapIsBitSet(flags, VIR_HOST_VALIDATE_CPU_FLAG_SIE))
> +        if (virBitmapIsBitSet(flags, VIR_HOST_VALIDATE_CPU_FLAG_SIE)) {
> +            hwVirtName = "SIE";
>              hasHwVirt = true;
> +        }
>          break;
>      case VIR_ARCH_PPC64:
>      case VIR_ARCH_PPC64LE:
> @@ -66,7 +74,7 @@ int virHostValidateQEMU(void)
>      if (hasVirtFlag) {
>          virValidateCheck("QEMU", "%s", _("Checking for hardware virtualization"));
>          if (hasHwVirt) {
> -            virValidatePass();
> +            virValidatePassDetails(hwVirtName);
>          } else {
>              virValidateFail(VIR_VALIDATE_FAIL,
>                              _("Host not compatible with KVM; HW virtualization CPU features not found. Only emulated CPUs are available; performance will be significantly limited"));
> -- 
> 2.51.1
> 

With regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|

Re: [PATCH 5/5] tools: inform user which hardware virt was found during validation
Posted by Peter Krempa via Devel 17 hours ago
On Thu, Nov 20, 2025 at 10:14:51 +0000, Daniel P. Berrangé via Devel wrote:
> From: Daniel P. Berrangé <berrange@redhat.com>
> 
> On x86 we can indicate VMX or SVM, while s390x would be SIE.
> 
> There are several choices on ppc64 and virt-host-validate does
> not try to detect any, so don't report a specific technology
> on ppc64 arch.
> 
> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
> ---
>  tools/virt-host-validate-qemu.c | 16 ++++++++++++----
>  1 file changed, 12 insertions(+), 4 deletions(-)

Reviewed-by: Peter Krempa <pkrempa@redhat.com>