[PATCH 3/3] virt-host-validate: Detect SMMU presence on ARMs by parsing IORT table

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



In my previous commit v9.2.0-rc1~3 I've made virt-host-validate
to report host IOMMU check pass if IORT table is present. This is
not sufficient though, because IORT describes much more than just
IOMMU (well, it's called SMMU in ARM world). In fact, this can be
seen in previous commit which adds test cases: there are tables
(IORT_virt_aarch64) which does not contain any SMMU records.

But after previous commits, we can parse the table so switch to
that.

Fixes: 2c13a2a7c9c368ea81eccd4ba12d9cf34bdd331b
Signed-off-by: Michal Privoznik <mprivozn@xxxxxxxxxx>
---
 tools/virt-host-validate-common.c | 18 +++++++++++++++---
 1 file changed, 15 insertions(+), 3 deletions(-)

diff --git a/tools/virt-host-validate-common.c b/tools/virt-host-validate-common.c
index e96986bb48..c8a23e2e99 100644
--- a/tools/virt-host-validate-common.c
+++ b/tools/virt-host-validate-common.c
@@ -26,6 +26,7 @@
 #include <sys/utsname.h>
 #include <sys/stat.h>
 
+#include "viracpi.h"
 #include "viralloc.h"
 #include "vircgroup.h"
 #include "virfile.h"
@@ -389,13 +390,24 @@ int virHostValidateIOMMU(const char *hvname,
         }
         virHostMsgPass();
     } else if (ARCH_IS_ARM(arch)) {
-        if (access("/sys/firmware/acpi/tables/IORT", F_OK) == 0) {
-            virHostMsgPass();
-        } else {
+        if (access("/sys/firmware/acpi/tables/IORT", F_OK) != 0) {
             virHostMsgFail(level,
                            "No ACPI IORT table found, IOMMU not "
                            "supported by this hardware platform");
             return VIR_HOST_VALIDATE_FAILURE(level);
+        } else {
+            rc = virAcpiHasSMMU();
+            if (rc < 0) {
+                virHostMsgFail(level,
+                               "Failed to parse ACPI IORT table");
+                return VIR_HOST_VALIDATE_FAILURE(level);
+            } else if (rc == 0) {
+                virHostMsgFail(level,
+                               "No SMMU found");
+                return VIR_HOST_VALIDATE_FAILURE(level);
+            } else {
+                virHostMsgPass();
+            }
         }
     } else {
         virHostMsgFail(level,
-- 
2.39.2




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux