<div dir="ltr"><div><div><div><div>Hello John,<br><br></div>In case of PPC, IOMMU in the host kernel either has it or not compiled in.<br></div>The  /sys/kernel/iommu_groups check is good enough to verify if it was compiled with the kernel or not.<br><br></div>If not, then we can have a ppc specific message there:    <br></div><br><br><div>    virHostMsgCheck(hvname, "%s", _("if IOMMU is enabled by kernel"));<br>    if (sb.st_nlink <= 2) {<br>        if(!isPPC) {<br>            virHostMsgFail(level,<br>                           "IOMMU appears to be disabled in kernel. "<br>                           "Add %s to kernel cmdline arguments", bootarg);<br>        } else {<br>            virHostMsgFail(level,<br>                           "IOMMU capability not compiled into kernel. ");<br><br>        }<br>        return -1;<br>    }<br>    virHostMsgPass();<br>    return 0;<br><br></div><br></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Aug 23, 2017 at 7:06 PM, John Ferlan <span dir="ltr"><<a href="mailto:jferlan@redhat.com" target="_blank">jferlan@redhat.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5"><br>
<br>
On 08/17/2017 09:48 AM, Nitesh Konkar wrote:<br>
> Fix the warning generated on PPC by virt-host-validate<br>
> for IOMMU<br>
><br>
> Signed-off-by: Nitesh Konkar <<a href="mailto:nitkon12@linux.vnet.ibm.com">nitkon12@linux.vnet.ibm.com</a>><br>
> ---<br>
>  tools/virt-host-validate-<wbr>common.c | 10 +++++++---<br>
>  1 file changed, 7 insertions(+), 3 deletions(-)<br>
><br>
> diff --git a/tools/virt-host-validate-<wbr>common.c b/tools/virt-host-validate-<wbr>common.c<br>
> index 6faed04..51fa8c0 100644<br>
> --- a/tools/virt-host-validate-<wbr>common.c<br>
> +++ b/tools/virt-host-validate-<wbr>common.c<br>
> @@ -35,6 +35,7 @@<br>
>  #include "virfile.h"<br>
>  #include "virt-host-validate-common.h"<br>
>  #include "virstring.h"<br>
> +#include "virarch.h"<br>
><br>
>  #define VIR_FROM_THIS VIR_FROM_NONE<br>
><br>
> @@ -442,8 +443,7 @@ int virHostValidateIOMMU(const char *hvname,<br>
>      virBitmapPtr flags;<br>
>      struct stat sb;<br>
>      const char *bootarg = NULL;<br>
> -    bool isAMD = false, isIntel = false;<br>
> -<br>
> +    bool isAMD = false, isIntel = false, isPPC = false;<br>
>      flags = virHostValidateGetCPUFlags();<br>
><br>
>      if (flags && virBitmapIsBitSet(flags, VIR_HOST_VALIDATE_CPU_FLAG_<wbr>VMX))<br>
> @@ -453,9 +453,10 @@ int virHostValidateIOMMU(const char *hvname,<br>
><br>
>      virBitmapFree(flags);<br>
><br>
> -    virHostMsgCheck(hvname, "%s", _("for device assignment IOMMU support"));<br>
> +    isPPC = ARCH_IS_PPC64(virArchFromHost(<wbr>));<br>
><br>
>      if (isIntel) {<br>
> +        virHostMsgCheck(hvname, "%s", _("for device assignment IOMMU support"));<br>
>          if (access("/sys/firmware/acpi/<wbr>tables/DMAR", F_OK) == 0) {<br>
>              virHostMsgPass();<br>
>              bootarg = "intel_iommu=on";<br>
> @@ -467,6 +468,7 @@ int virHostValidateIOMMU(const char *hvname,<br>
>              return -1;<br>
>          }<br>
>      } else if (isAMD) {<br>
> +        virHostMsgCheck(hvname, "%s", _("for device assignment IOMMU support"));<br>
>          if (access("/sys/firmware/acpi/<wbr>tables/IVRS", F_OK) == 0) {<br>
>              virHostMsgPass();<br>
>              bootarg = "iommu=pt iommu=1";<br>
> @@ -477,6 +479,8 @@ int virHostValidateIOMMU(const char *hvname,<br>
>                             "hardware platform");<br>
>              return -1;<br>
>          }<br>
> +    } else if (isPPC) {<br>
> +        /* Empty Block */<br>
<br>
</div></div>So there's nothing to check at all? Perhaps elaborate in the commit<br>
message...<br>
<br>
<br>
Still what happens when @bootarg isn't populated and by chance we fall<br>
into the:<br>
<br>
if (sb.st_nlink <= 2) {<br>
}<br>
<br>
condition below here?  You'll get "Add <nil>..."<br>
<br>
Or can we not get to that code?  I'm not PPC and IOMMU aware, so I'm<br>
asking...<br>
<br>
Tks,<br>
<br>
John<br>
<div class="HOEnZb"><div class="h5"><br>
>      } else {<br>
>          virHostMsgFail(level,<br>
>                         "Unknown if this platform has IOMMU support");<br>
><br>
</div></div></blockquote></div><br></div>