Message ID | 20221104115511.28256-1-m.szyprowski@samsung.com (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | iommu/exynos: Fix driver initialization sequence | expand |
On Fri, 4 Nov 2022 at 12:55, Marek Szyprowski <m.szyprowski@samsung.com> wrote: > > Registering SYSMMU platform driver might directly trigger initializing > IOMMU domains and performing initial mappings. That time all common > resources for the SYSMMU driver must be already allocated, so move > platform driver registration to the end of exynos_iommu_init() function. > > Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com> > --- Reviewed-by: Sam Protsenko <semen.protsenko@linaro.org> Please let me know if you want me to rebase my patches on top of this one. > drivers/iommu/exynos-iommu.c | 16 ++++++++-------- > 1 file changed, 8 insertions(+), 8 deletions(-) > > diff --git a/drivers/iommu/exynos-iommu.c b/drivers/iommu/exynos-iommu.c > index 45fd4850bacb..85a6a775aea5 100644 > --- a/drivers/iommu/exynos-iommu.c > +++ b/drivers/iommu/exynos-iommu.c > @@ -1432,12 +1432,6 @@ static int __init exynos_iommu_init(void) > return -ENOMEM; > } > > - ret = platform_driver_register(&exynos_sysmmu_driver); > - if (ret) { > - pr_err("%s: Failed to register driver\n", __func__); > - goto err_reg_driver; > - } > - > zero_lv2_table = kmem_cache_zalloc(lv2table_kmem_cache, GFP_KERNEL); > if (zero_lv2_table == NULL) { > pr_err("%s: Failed to allocate zero level2 page table\n", > @@ -1446,10 +1440,16 @@ static int __init exynos_iommu_init(void) > goto err_zero_lv2; > } > > + ret = platform_driver_register(&exynos_sysmmu_driver); > + if (ret) { > + pr_err("%s: Failed to register driver\n", __func__); > + goto err_reg_driver; > + } > + > return 0; > -err_zero_lv2: > - platform_driver_unregister(&exynos_sysmmu_driver); > err_reg_driver: > + platform_driver_unregister(&exynos_sysmmu_driver); > +err_zero_lv2: > kmem_cache_destroy(lv2table_kmem_cache); > return ret; > } > -- > 2.17.1 >
On 04/11/2022 07:55, Marek Szyprowski wrote: > Registering SYSMMU platform driver might directly trigger initializing > IOMMU domains and performing initial mappings. That time all common > resources for the SYSMMU driver must be already allocated, so move > platform driver registration to the end of exynos_iommu_init() function. > > Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com> > --- How about: Fixes: 66a7ed84b345 ("iommu/exynos: Apply workaround of caching fault page table entries") ? Acked-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> Best regards, Krzysztof
On Fri, Nov 04, 2022 at 12:55:11PM +0100, Marek Szyprowski wrote: > Registering SYSMMU platform driver might directly trigger initializing > IOMMU domains and performing initial mappings. That time all common > resources for the SYSMMU driver must be already allocated, so move > platform driver registration to the end of exynos_iommu_init() function. > > Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com> > --- > drivers/iommu/exynos-iommu.c | 16 ++++++++-------- > 1 file changed, 8 insertions(+), 8 deletions(-) Applied, thanks.
diff --git a/drivers/iommu/exynos-iommu.c b/drivers/iommu/exynos-iommu.c index 45fd4850bacb..85a6a775aea5 100644 --- a/drivers/iommu/exynos-iommu.c +++ b/drivers/iommu/exynos-iommu.c @@ -1432,12 +1432,6 @@ static int __init exynos_iommu_init(void) return -ENOMEM; } - ret = platform_driver_register(&exynos_sysmmu_driver); - if (ret) { - pr_err("%s: Failed to register driver\n", __func__); - goto err_reg_driver; - } - zero_lv2_table = kmem_cache_zalloc(lv2table_kmem_cache, GFP_KERNEL); if (zero_lv2_table == NULL) { pr_err("%s: Failed to allocate zero level2 page table\n", @@ -1446,10 +1440,16 @@ static int __init exynos_iommu_init(void) goto err_zero_lv2; } + ret = platform_driver_register(&exynos_sysmmu_driver); + if (ret) { + pr_err("%s: Failed to register driver\n", __func__); + goto err_reg_driver; + } + return 0; -err_zero_lv2: - platform_driver_unregister(&exynos_sysmmu_driver); err_reg_driver: + platform_driver_unregister(&exynos_sysmmu_driver); +err_zero_lv2: kmem_cache_destroy(lv2table_kmem_cache); return ret; }
Registering SYSMMU platform driver might directly trigger initializing IOMMU domains and performing initial mappings. That time all common resources for the SYSMMU driver must be already allocated, so move platform driver registration to the end of exynos_iommu_init() function. Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com> --- drivers/iommu/exynos-iommu.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)