Running Jailhouse in QEMU with the upstream config is currently broken,
as qemu-vm.c provides a hardcoded description of the Intel IOMMU. As a
consequence, starting Jailhouse in QEMU on a AMD system fails.

Fix it by simply skipping non-AMD IOMMU types and drop a WARNING that
there's some oddity inside the config.

Signed-off-by: Ralf Ramsauer <[email protected]>
---

Side note: I know we don't do any config sanity checks in the
hypervisor, but in this case it's way easier than providing two
qemu-vm.c-variants for Intel and AMD.

 hypervisor/arch/x86/amd_iommu.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/hypervisor/arch/x86/amd_iommu.c b/hypervisor/arch/x86/amd_iommu.c
index 40ec4e20..4b563e9e 100644
--- a/hypervisor/arch/x86/amd_iommu.c
+++ b/hypervisor/arch/x86/amd_iommu.c
@@ -782,8 +782,11 @@ static int amd_iommu_init(void)
 
        iommu = &system_config->platform_info.iommu_units[0];
        for (n = 0; iommu->base && n < iommu_count_units(); iommu++, n++) {
-               if (iommu->type != JAILHOUSE_IOMMU_AMD)
-                       return trace_error(-EINVAL);
+               if (iommu->type != JAILHOUSE_IOMMU_AMD) {
+                       printk("WARNING: The config contains a"
+                              "non-AMD IOMMU type\n");
+                       continue;
+               }
 
                entry = &iommu_units[iommu_units_count];
 
-- 
2.34.1

-- 
You received this message because you are subscribed to the Google Groups 
"Jailhouse" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jailhouse-dev/20211206105449.129665-1-ralf.ramsauer%40oth-regensburg.de.

Reply via email to