[libvirt] [PATCH] tools/virt-host-validate: Fix IOMMU check on s390x
Boris Fiuczynski
fiuczy at linux.ibm.com
Wed Feb 27 08:07:25 UTC 2019
Besides the minor required change below
Reviewed-by: Boris Fiuczynski <fiuczy at linux.ibm.com>
Thanks for catching this
On 2/26/19 12:02 PM, Thomas Huth wrote:
> When running virt-host-validate on an s390x host, the tool currently
> warns that it is "Unknown if this platform has IOMMU support".
> We can use the common check for entries in sys/kernel/iommu_groups here,
> too, but it only makes sense to check it if there are also PCI devices
> available. It's also common on s390x that there are no PCI devices
> assigned to the LPAR, and in that case there is no need for the
> PCI-related IOMMU, so without PCI devices we should simply skip this
> test.
>
> Signed-off-by: Thomas Huth <thuth at redhat.com>
> ---
> tools/virt-host-validate-common.c | 11 +++++++++--
> 1 file changed, 9 insertions(+), 2 deletions(-)
>
> diff --git a/tools/virt-host-validate-common.c b/tools/virt-host-validate-common.c
> index 73e3bdb..75c7cfc 100644
> --- a/tools/virt-host-validate-common.c
> +++ b/tools/virt-host-validate-common.c
> @@ -337,7 +337,7 @@ int virHostValidateIOMMU(const char *hvname,
> virBitmapPtr flags;
> struct stat sb;
> const char *bootarg = NULL;
> - bool isAMD = false, isIntel = false, isPPC = false;
> + bool isAMD = false, isIntel = false, isPPC, isS390;
> flags = virHostValidateGetCPUFlags();
>
> if (flags && virBitmapIsBitSet(flags, VIR_HOST_VALIDATE_CPU_FLAG_VMX))
> @@ -348,6 +348,7 @@ int virHostValidateIOMMU(const char *hvname,
> virBitmapFree(flags);
>
> isPPC = ARCH_IS_PPC64(virArchFromHost());
> + isS390 = ARCH_IS_S390(virArchFromHost());
>
> if (isIntel) {
> virHostMsgCheck(hvname, "%s", _("for device assignment IOMMU support"));
> @@ -375,6 +376,12 @@ int virHostValidateIOMMU(const char *hvname,
> }
> } else if (isPPC) {
> /* Empty Block */
> + } else if (isS390) {
> + /* On s390x, we skip the IOMMU check if there are no PCI devices
> + * (which is quite usual on s390x) */
TAB_in_indentation
../tools/virt-host-validate-common.c:380: /* On s390x, we skip the
IOMMU check if there are no PCI devices
../tools/virt-host-validate-common.c:381: * (which is quite usual
on s390x) */
maint.mk: indent with space, not TAB, in C, sh, html, py, syms and RNG
schemas
make: *** [../cfg.mk:501: sc_TAB_in_indentation] Error 1
> + if (stat("/sys/bus/pci/devices", &sb) < 0 || !S_ISDIR(sb.st_mode) ||
> + sb.st_nlink <= 2)
> + return 0;
> } else {
> virHostMsgFail(level,
> "Unknown if this platform has IOMMU support");
> @@ -391,7 +398,7 @@ int virHostValidateIOMMU(const char *hvname,
>
> virHostMsgCheck(hvname, "%s", _("if IOMMU is enabled by kernel"));
> if (sb.st_nlink <= 2) {
> - if (!isPPC)
> + if (bootarg)
> virHostMsgFail(level,
> "IOMMU appears to be disabled in kernel. "
> "Add %s to kernel cmdline arguments", bootarg);
>
--
Mit freundlichen Grüßen/Kind regards
Boris Fiuczynski
IBM Deutschland Research & Development GmbH
Vorsitzender des Aufsichtsrats: Matthias Hartmann
Geschäftsführung: Dirk Wittkopp
Sitz der Gesellschaft: Böblingen
Registergericht: Amtsgericht Stuttgart, HRB 243294
More information about the libvir-list
mailing list