xen/arm: iommu: Panic if not all IOMMUs are initialized
PATCH 1/1 xen/arm: iommu: Panic if not all IOMMUs are initialized
At the moment, the platform can come up with only part of the IOMMUs initialized. This could lead to a failure later on when building the hardware domain or even trying to assign a device to a guest.
To avoid unwanted behavior, Xen will not continue if one of the IOMMUs has not been initialized correctly.
---
Basically, this is similar to forcing the use of IOMMU (i.e iommu=force). Maybe we should drop the panic in setup.c and just set force_iommu. Any opinion?
--- xen/arch/arm/setup.c | 5 ++++- xen/drivers/passthrough/arm/iommu.c | 8 ++++++++ 2 files changed, 12 insertions(+), 1 deletion(-)
xen/arch/arm/setup.c +4 -1
@@ -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 ();
@@ -892,7 +893,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 ();
xen/drivers/passthrough/arm/iommu.c +8 -0
@@ -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 ;
Signature · 7 lines
2.11.0 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
On 20.08.19 15:22, Julien Grall wrote:
Hi, Julien
xen/arch/arm/setup.c void __init start_xen(unsigned long boot_phys_offset, · line 898
Quoted 6 lines
xen/arch/arm/setup.c +3
-1-iommu_setup (); + rc =iommu_setup (); +if ( !iommu_enabled && rc != -ENODEV ) +panic ("Couldn't configure correctly all the IOMMUs." );
Please add "\n"
You can add:
Signature · 9 lines
Regards, Oleksandr Tyshchenko _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
Stefano Stabellini
Reviewed-byQuoted 11 lines · Oleksandr
On 20.08.19 15:22, Julien Grall wrote:
Hi, Julien
xen/arch/arm/setup.c void __init start_xen(unsigned long boot_phys_offset, · line 898
Quoted 5 lines
-
iommu_setup();xen/arch/arm/setup.c +3
-0+ rc =iommu_setup (); +if ( !iommu_enabled && rc != -ENODEV ) +panic ("Couldn't configure correctly all the IOMMUs." );
Quoted 6 lines
Please add "\n"
You can add:
Tested-by Oleksandr Tyshchenko <[email protected]>
I added the "\n", fixed a typo in the commit message, and committed the patch.
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
On 20.09.19 03:31, Stefano Stabellini wrote:
Hi, Stefano.
Quoted 13 lines · Oleksandr
Quoted 12 lines · Julien Grall
Hi, Julien
xen/arch/arm/setup.c void __init start_xen(unsigned long boot_phys_offset, · line 898
Quoted 5 lines
-
iommu_setup();xen/arch/arm/setup.c +3
-0+ rc =iommu_setup (); +if ( !iommu_enabled && rc != -ENODEV ) +panic ("Couldn't configure correctly all the IOMMUs." );Please add "\n"
Quoted 7 lines
Quoted 3 lines
You can add:
Tested-by Oleksandr Tyshchenko <[email protected]>Reviewed-by Stefano Stabellini <[email protected]>I added the "\n", fixed a typo in the commit message, and committed the patch.
Thank you, I will re-base and drop dependency from the cover letter for the coming V5 (IPMMU+iommu_fwspec).
Signature · 9 lines
Regards, Oleksandr Tyshchenko _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel