iommu/ipmmu-vmsa: Don't register as BUS IOMMU if machine doesn't have IPMMU-VMSA
Subsystems (2)
PATCH 1/1 iommu/ipmmu-vmsa: Don't register as BUS IOMMU if machine doesn't have IPMMU-VMSA
This fixes kernel crashing on NVIDIA Tegra if kernel is compiled in a multiplatform configuration and IPMMU-VMSA driver is enabled.
--- drivers/iommu/ipmmu-vmsa.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/iommu/ipmmu-vmsa.c +7 -0
@@ -1109,12 +1109,19 @@ static struct platform_driver ipmmu_driver = {static int __init ipmmu_init (void ) { +struct device_node *np;static bool setup_done;int ret;if (setup_done)return 0 ; + np =of_find_matching_node (NULL , ipmmu_of_ids); +if (!np) +return 0 ; + +of_node_put (np); + ret =platform_driver_register (&ipmmu_driver);if (ret <0 )return ret;
Signature · 1 line
2.18.0
Quoted 8 lines · Dmitry Osipenko
This fixes kernel crashing on NVIDIA Tegra if kernel is compiled in a multiplatform configuration and IPMMU-VMSA driver is enabled.
Cc <[email protected]> # v3.20+Signed-off-by Dmitry Osipenko <[email protected]>--- drivers/iommu/ipmmu-vmsa.c | 7 +++++++ 1 file changed, 7 insertions(+)
Applied, thanks.
Hi Dmitry,
(CC'ing Geert and Magnus)
Thank you for the patch.
Quoted 20 lines · On Friday, 27 July 2018 00:19:16 EEST Dmitry Osipenko wrote:
This fixes kernel crashing on NVIDIA Tegra if kernel is compiled in a multiplatform configuration and IPMMU-VMSA driver is enabled.
Cc <[email protected]> # v3.20+Signed-off-by Dmitry Osipenko <[email protected]>--- drivers/iommu/ipmmu-vmsa.c | 7 +++++++ 1 file changed, 7 insertions(+)drivers/iommu/ipmmu-vmsa.c +1
-0@@ -1109,12 +1109,19 @@ static struct platform_driver ipmmu_driver = {static int __init ipmmu_init (void ) { +struct device_node *np;static bool setup_done;int ret;
drivers/iommu/ipmmu-vmsa.c static struct platform_driver ipmmu_driver = { · line 1124
Quoted 10 lines
drivers/iommu/ipmmu-vmsa.c +6
-0if (setup_done)return 0 ; + np =of_find_matching_node (NULL , ipmmu_of_ids); +if (!np) +return 0 ; + +of_node_put (np); +
While functionally correct, this will add some unnecessary overhead when iommu_init() is called from IOMMU_OF_DECLARE(). I'm OK with this fix as a temporary measure to solve your problem, but we need to address the underlying issue properly.
Geert, Magnus, the ipmmu-vmsa driver is a bit of a mess. We should brush it up and start using IOMMU_OF_DECLARE() on all platforms (and eventually get rid of bus_set_iommu() completely...). Do you have plans to address this ? If not, could you please add it to your to-do list ?
Quoted 3 lines
drivers/iommu/ipmmu-vmsa.c +0
-0ret =platform_driver_register (&ipmmu_driver);if (ret <0 )return ret;
Signature · 3 lines
Regards, Laurent Pinchart
Hi Laurent,
Quoted 41 lines · Laurent Pinchart
(CC'ing Geert and Magnus)
Thank you for the patch.
Quoted 20 lines · On Friday, 27 July 2018 00:19:16 EEST Dmitry Osipenko wrote:
This fixes kernel crashing on NVIDIA Tegra if kernel is compiled in a multiplatform configuration and IPMMU-VMSA driver is enabled.
Cc <[email protected]> # v3.20+Signed-off-by Dmitry Osipenko <[email protected]>--- drivers/iommu/ipmmu-vmsa.c | 7 +++++++ 1 file changed, 7 insertions(+)drivers/iommu/ipmmu-vmsa.c +1
-0@@ -1109,12 +1109,19 @@ static struct platform_driver ipmmu_driver = {static int __init ipmmu_init (void ) { +struct device_node *np;static bool setup_done;int ret;drivers/iommu/ipmmu-vmsa.c static struct platform_driver ipmmu_driver = { · line 1124
Quoted 10 lines
drivers/iommu/ipmmu-vmsa.c +6
-0if (setup_done)return 0 ; + np =of_find_matching_node (NULL , ipmmu_of_ids); +if (!np) +return 0 ; + +of_node_put (np); +While functionally correct, this will add some unnecessary overhead when
iommu_init()is called fromIOMMU_OF_DECLARE(). I'm OK with this fix as a temporary measure to solve your problem, but we need to address the underlying issue properly.
Quoted 4 lines
Geert, Magnus, the ipmmu-vmsa driver is a bit of a mess. We should brush it up and start using
IOMMU_OF_DECLARE()on all platforms (and eventually get rid ofbus_set_iommu()completely...). Do you have plans to address this ? If not, could you please add it to your to-do list ?
On the contrary: IOMMU_OF_DECLARE() has been removed.
Quoted 4 lines
drivers/iommu/ipmmu-vmsa.c static struct platform_driver ipmmu_driver = { · line 1127
Quoted 4 lines
drivers/iommu/ipmmu-vmsa.c +0
-0ret =platform_driver_register (&ipmmu_driver);if (ret <0 )return ret;
Gr{oetje,eeting}s,
Geert
Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected] In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds