On 15.08.19 15:54, Julien Grall wrote:
Hi,
Hi Julien
I noticed there was already a panic() in iommu_setup() just in case the user
force the use of IOMMU but they were not initialized. I was half-tempted to set
iommu_force to true for Arm, but I think this is a different issue.
So here my take (not tested nor compiled).
Thank you. I will check it and come back with results.
diff --git a/xen/arch/arm/setup.c b/xen/arch/arm/setup.c
index 2c5d1372c0..8f94f618b0 100644
--- a/xen/arch/arm/setup.c
+++ b/xen/arch/arm/setup.c
@@ -755,6 +755,7 @@ void __init start_xen(unsigned long boot_phys_offset,
.max_grant_frames = gnttab_dom0_frames(),
.max_maptrack_frames = opt_max_maptrack_frames,
};
+ int rc;
dcache_line_bytes = read_dcache_line_bytes();
@@ -890,7 +891,9 @@ void __init start_xen(unsigned long boot_phys_offset,
setup_virt_paging();
- iommu_setup();
+ rc = iommu_setup();
+ if ( !iommu_enabled && rc != -ENODEV )
+ panic("Couldn't configure correctly all the IOMMUs.");
do_initcalls();
diff --git a/xen/drivers/passthrough/arm/iommu.c b/xen/drivers/passthrough/arm/iommu.c
index 2135233736..f219de9ac3 100644
--- a/xen/drivers/passthrough/arm/iommu.c
+++ b/xen/drivers/passthrough/arm/iommu.c
@@ -51,6 +51,14 @@ int __init iommu_hardware_setup(void)
rc = device_init(np, DEVICE_IOMMU, NULL);
if ( !rc )
num_iommus++;
+ /*
+ * Ignore the following error codes:
+ * - EBADF: Indicate the current not is not an IOMMU
+ * - ENODEV: The IOMMU is not present or cannot be used by
+ * Xen.
+ */
+ else if ( rc != -EBADF && rc != -ENODEV )
+ return rc;
}
return ( num_iommus > 0 ) ? 0 : -ENODEV;
Cheers,
--
Regards,
Oleksandr Tyshchenko
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel