[libvirt] [PATCH] virt-host-validate: Fix warning for IOMMU detection on PPC

Nitesh Konkar posted 1 patch 6 years, 8 months ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/20170817071902.14601-1-niteshkonkar.libvirt@gmail.com
There is a newer version of this series
tools/virt-host-validate-common.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
[libvirt] [PATCH] virt-host-validate: Fix warning for IOMMU detection on PPC
Posted by Nitesh Konkar 6 years, 8 months ago
Fix the warning generated on PPC by virt-host-validate
for IOMMU

Signed-off-by: Nitesh Konkar <nitkon12@linux.vnet.ibm.com>
---
 tools/virt-host-validate-common.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/tools/virt-host-validate-common.c b/tools/virt-host-validate-common.c
index 6faed04..e0ca1dd 100644
--- a/tools/virt-host-validate-common.c
+++ b/tools/virt-host-validate-common.c
@@ -35,6 +35,7 @@
 #include "virfile.h"
 #include "virt-host-validate-common.h"
 #include "virstring.h"
+#include "virarch.h"
 
 #define VIR_FROM_THIS VIR_FROM_NONE
 
@@ -443,7 +444,7 @@ int virHostValidateIOMMU(const char *hvname,
     struct stat sb;
     const char *bootarg = NULL;
     bool isAMD = false, isIntel = false;
-
+    virArch hostarch;
     flags = virHostValidateGetCPUFlags();
 
     if (flags && virBitmapIsBitSet(flags, VIR_HOST_VALIDATE_CPU_FLAG_VMX))
@@ -454,6 +455,7 @@ int virHostValidateIOMMU(const char *hvname,
     virBitmapFree(flags);
 
     virHostMsgCheck(hvname, "%s", _("for device assignment IOMMU support"));
+    hostarch = virArchFromHost();
 
     if (isIntel) {
         if (access("/sys/firmware/acpi/tables/DMAR", F_OK) == 0) {
@@ -477,7 +479,7 @@ int virHostValidateIOMMU(const char *hvname,
                            "hardware platform");
             return -1;
         }
-    } else {
+    } else if (!ARCH_IS_PPC64(hostarch)) {
         virHostMsgFail(level,
                        "Unknown if this platform has IOMMU support");
         return -1;
@@ -491,6 +493,9 @@ int virHostValidateIOMMU(const char *hvname,
     if (!S_ISDIR(sb.st_mode))
         return 0;
 
+    if (S_ISDIR(sb.st_mode) && ARCH_IS_PPC64(hostarch))
+        virHostMsgPass();
+
     virHostMsgCheck(hvname, "%s", _("if IOMMU is enabled by kernel"));
     if (sb.st_nlink <= 2) {
         virHostMsgFail(level,
-- 
2.7.4

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] virt-host-validate: Fix warning for IOMMU detection on PPC
Posted by Peter Krempa 6 years, 8 months ago
On Thu, Aug 17, 2017 at 12:49:02 +0530, Nitesh Konkar wrote:
> Fix the warning generated on PPC by virt-host-validate
> for IOMMU
> 
> Signed-off-by: Nitesh Konkar <nitkon12@linux.vnet.ibm.com>
> ---
>  tools/virt-host-validate-common.c | 9 +++++++--
>  1 file changed, 7 insertions(+), 2 deletions(-)
> 
> diff --git a/tools/virt-host-validate-common.c b/tools/virt-host-validate-common.c
> index 6faed04..e0ca1dd 100644
> --- a/tools/virt-host-validate-common.c
> +++ b/tools/virt-host-validate-common.c

[...]


> @@ -477,7 +479,7 @@ int virHostValidateIOMMU(const char *hvname,
>                             "hardware platform");
>              return -1;
>          }
> -    } else {
> +    } else if (!ARCH_IS_PPC64(hostarch)) {

Add PPC64 as a section above, even with an empty body if necessary so
that the catch-all case stays as-is.

>          virHostMsgFail(level,
>                         "Unknown if this platform has IOMMU support");
>          return -1;
> @@ -491,6 +493,9 @@ int virHostValidateIOMMU(const char *hvname,
>      if (!S_ISDIR(sb.st_mode))
>          return 0;
>  
> +    if (S_ISDIR(sb.st_mode) && ARCH_IS_PPC64(hostarch))
> +        virHostMsgPass();
> +
>      virHostMsgCheck(hvname, "%s", _("if IOMMU is enabled by kernel"));

So this writes:

PASS
qemu: checking if IOMMU is enabled by kernel: PASS


The extra call to virHostMsgPass is wrong.
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list