mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-25 21:02:22 +00:00
virt-host-validate: Fix warning for IOMMU detection on PPC
Fix the warning generated on PPC by virt-host-validate for IOMMU. In case of PPC, IOMMU in the host kernel either has it or it's not compiled in. The /sys/kernel/iommu_groups check is good enough to verify if it was compiled with the kernel or not. Modify the error message when "if (sb.st_nlink <= 2)" to indicate what the problem would be since there would be no @bootarg. Signed-off-by: Nitesh Konkar <nitkon12@linux.vnet.ibm.com>
This commit is contained in:
parent
70f564d8f4
commit
941ec9b6a7
@ -35,6 +35,7 @@
|
|||||||
#include "virfile.h"
|
#include "virfile.h"
|
||||||
#include "virt-host-validate-common.h"
|
#include "virt-host-validate-common.h"
|
||||||
#include "virstring.h"
|
#include "virstring.h"
|
||||||
|
#include "virarch.h"
|
||||||
|
|
||||||
#define VIR_FROM_THIS VIR_FROM_NONE
|
#define VIR_FROM_THIS VIR_FROM_NONE
|
||||||
|
|
||||||
@ -442,8 +443,7 @@ int virHostValidateIOMMU(const char *hvname,
|
|||||||
virBitmapPtr flags;
|
virBitmapPtr flags;
|
||||||
struct stat sb;
|
struct stat sb;
|
||||||
const char *bootarg = NULL;
|
const char *bootarg = NULL;
|
||||||
bool isAMD = false, isIntel = false;
|
bool isAMD = false, isIntel = false, isPPC = false;
|
||||||
|
|
||||||
flags = virHostValidateGetCPUFlags();
|
flags = virHostValidateGetCPUFlags();
|
||||||
|
|
||||||
if (flags && virBitmapIsBitSet(flags, VIR_HOST_VALIDATE_CPU_FLAG_VMX))
|
if (flags && virBitmapIsBitSet(flags, VIR_HOST_VALIDATE_CPU_FLAG_VMX))
|
||||||
@ -453,9 +453,10 @@ int virHostValidateIOMMU(const char *hvname,
|
|||||||
|
|
||||||
virBitmapFree(flags);
|
virBitmapFree(flags);
|
||||||
|
|
||||||
virHostMsgCheck(hvname, "%s", _("for device assignment IOMMU support"));
|
isPPC = ARCH_IS_PPC64(virArchFromHost());
|
||||||
|
|
||||||
if (isIntel) {
|
if (isIntel) {
|
||||||
|
virHostMsgCheck(hvname, "%s", _("for device assignment IOMMU support"));
|
||||||
if (access("/sys/firmware/acpi/tables/DMAR", F_OK) == 0) {
|
if (access("/sys/firmware/acpi/tables/DMAR", F_OK) == 0) {
|
||||||
virHostMsgPass();
|
virHostMsgPass();
|
||||||
bootarg = "intel_iommu=on";
|
bootarg = "intel_iommu=on";
|
||||||
@ -467,6 +468,7 @@ int virHostValidateIOMMU(const char *hvname,
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
} else if (isAMD) {
|
} else if (isAMD) {
|
||||||
|
virHostMsgCheck(hvname, "%s", _("for device assignment IOMMU support"));
|
||||||
if (access("/sys/firmware/acpi/tables/IVRS", F_OK) == 0) {
|
if (access("/sys/firmware/acpi/tables/IVRS", F_OK) == 0) {
|
||||||
virHostMsgPass();
|
virHostMsgPass();
|
||||||
bootarg = "iommu=pt iommu=1";
|
bootarg = "iommu=pt iommu=1";
|
||||||
@ -477,6 +479,8 @@ int virHostValidateIOMMU(const char *hvname,
|
|||||||
"hardware platform");
|
"hardware platform");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
} else if (isPPC) {
|
||||||
|
/* Empty Block */
|
||||||
} else {
|
} else {
|
||||||
virHostMsgFail(level,
|
virHostMsgFail(level,
|
||||||
"Unknown if this platform has IOMMU support");
|
"Unknown if this platform has IOMMU support");
|
||||||
@ -493,9 +497,12 @@ int virHostValidateIOMMU(const char *hvname,
|
|||||||
|
|
||||||
virHostMsgCheck(hvname, "%s", _("if IOMMU is enabled by kernel"));
|
virHostMsgCheck(hvname, "%s", _("if IOMMU is enabled by kernel"));
|
||||||
if (sb.st_nlink <= 2) {
|
if (sb.st_nlink <= 2) {
|
||||||
|
if (!isPPC)
|
||||||
virHostMsgFail(level,
|
virHostMsgFail(level,
|
||||||
"IOMMU appears to be disabled in kernel. "
|
"IOMMU appears to be disabled in kernel. "
|
||||||
"Add %s to kernel cmdline arguments", bootarg);
|
"Add %s to kernel cmdline arguments", bootarg);
|
||||||
|
else
|
||||||
|
virHostMsgFail(level, "IOMMU capability not compiled into kernel.");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
virHostMsgPass();
|
virHostMsgPass();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user