提交 d38d512f 编写于 作者: T Thomas Huth 提交者: Michal Privoznik

tools/virt-host-validate: Fix IOMMU check on s390x

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: NThomas Huth <thuth@redhat.com>
Reviewed-by: NBjoern Walk <bwalk@linux.ibm.com>
Reviewed-by: NBoris Fiuczynski <fiuczy@linux.ibm.com>
Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
上级 21dd1529
......@@ -337,7 +337,12 @@ 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;
virArch arch = virArchFromHost();
struct dirent *dent;
DIR *dir;
int rc;
flags = virHostValidateGetCPUFlags();
if (flags && virBitmapIsBitSet(flags, VIR_HOST_VALIDATE_CPU_FLAG_VMX))
......@@ -347,8 +352,6 @@ int virHostValidateIOMMU(const char *hvname,
virBitmapFree(flags);
isPPC = ARCH_IS_PPC64(virArchFromHost());
if (isIntel) {
virHostMsgCheck(hvname, "%s", _("for device assignment IOMMU support"));
if (access("/sys/firmware/acpi/tables/DMAR", F_OK) == 0) {
......@@ -373,8 +376,19 @@ int virHostValidateIOMMU(const char *hvname,
"hardware platform");
return -1;
}
} else if (isPPC) {
} else if (ARCH_IS_PPC64(arch)) {
/* Empty Block */
} else if (ARCH_IS_S390(arch)) {
/* On s390x, we skip the IOMMU check if there are no PCI
* devices (which is quite usual on s390x). If there are
* no PCI devices the directory is still there but is
* empty. */
if (!virDirOpen(&dir, "/sys/bus/pci/devices"))
return 0;
rc = virDirRead(dir, &dent, NULL);
VIR_DIR_CLOSE(dir);
if (rc <= 0)
return 0;
} else {
virHostMsgFail(level,
"Unknown if this platform has IOMMU support");
......@@ -391,7 +405,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);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册