* Re: [PATCH] iommu/exynos: Initialize lock before requesting IRQ
2026-09-01 13:05 ` [PATCH] iommu/exynos: Initialize lock before requesting IRQ Runyu Xiao
@ 2026-09-01 13:20 ` Robin Murphy
2026-09-01 14:37 ` Marek Szyprowski
1 sibling, 0 replies; 3+ messages in thread
From: Robin Murphy @ 2026-09-01 13:20 UTC (permalink / raw)
To: Runyu Xiao, Marek Szyprowski
Cc: Joerg Roedel, Will Deacon, Krzysztof Kozlowski, Alim Akhtar,
KyongHo Cho, Kukjin Kim, iommu, linux-arm-kernel,
linux-samsung-soc, linux-kernel, stable, Jianhao Xu
On 01/09/2026 2:05 pm, Runyu Xiao wrote:
> The SysMMU interrupt handler can run as soon as devm_request_irq() is
> called. Initialize the driver lock before registering the handler so an
> early interrupt cannot use an uninitialized lock.
And what about all the _other_ data the handler unconditionally
dereferences which is also still uninitialised at this point? If you
think this (clearly theoretical) race is worth fixing then at least
actually fix it...
Thanks,
Robin.
> Fixes: 2a96536e77b4 ("iommu/exynos: Add iommu driver for EXYNOS Platforms")
> Cc: stable@vger.kernel.org
> Signed-off-by: Runyu Xiao <runyu.xiao@seu.edu.cn>
> Assisted-by: Codex:GPT-5
> ---
> drivers/iommu/exynos-iommu.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/iommu/exynos-iommu.c b/drivers/iommu/exynos-iommu.c
> index 874d05f4b..e9feb83b3 100644
> --- a/drivers/iommu/exynos-iommu.c
> +++ b/drivers/iommu/exynos-iommu.c
> @@ -735,6 +735,8 @@ static int exynos_sysmmu_probe(struct platform_device *pdev)
> if (!data)
> return -ENOMEM;
>
> + spin_lock_init(&data->lock);
> +
> res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> data->sfrbase = devm_ioremap_resource(dev, res);
> if (IS_ERR(data->sfrbase))
> @@ -773,7 +775,6 @@ static int exynos_sysmmu_probe(struct platform_device *pdev)
> return PTR_ERR(data->clk_master);
>
> data->sysmmu = dev;
> - spin_lock_init(&data->lock);
>
> __sysmmu_get_version(data);
>
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] iommu/exynos: Initialize lock before requesting IRQ
2026-09-01 13:05 ` [PATCH] iommu/exynos: Initialize lock before requesting IRQ Runyu Xiao
2026-09-01 13:20 ` Robin Murphy
@ 2026-09-01 14:37 ` Marek Szyprowski
1 sibling, 0 replies; 3+ messages in thread
From: Marek Szyprowski @ 2026-09-01 14:37 UTC (permalink / raw)
To: Runyu Xiao
Cc: Joerg Roedel, Will Deacon, Robin Murphy, Krzysztof Kozlowski,
Alim Akhtar, KyongHo Cho, Kukjin Kim, iommu, linux-arm-kernel,
linux-samsung-soc, linux-kernel, stable, Jianhao Xu
On 01.09.2026 15:05, Runyu Xiao wrote:
> The SysMMU interrupt handler can run as soon as devm_request_irq() is
> called. Initialize the driver lock before registering the handler so an
> early interrupt cannot use an uninitialized lock.
>
> Fixes: 2a96536e77b4 ("iommu/exynos: Add iommu driver for EXYNOS Platforms")
> Cc: stable@vger.kernel.org
> Signed-off-by: Runyu Xiao <runyu.xiao@seu.edu.cn>
> Assisted-by: Codex:GPT-5
Sorry, but this patch doesn't make much sense. There are other things that have
to be properly initialized before the interrupts can be handled. To ensure that
interrupt doesn't fire before handler has been registered one should enable
clocks and reset the hw:
writel(CTRL_DISABLE, data->sfrbase + REG_MMU_CTRL);
writel(0, data->sfrbase + REG_MMU_CFG);
> ---
> drivers/iommu/exynos-iommu.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/iommu/exynos-iommu.c b/drivers/iommu/exynos-iommu.c
> index 874d05f4b..e9feb83b3 100644
> --- a/drivers/iommu/exynos-iommu.c
> +++ b/drivers/iommu/exynos-iommu.c
> @@ -735,6 +735,8 @@ static int exynos_sysmmu_probe(struct platform_device *pdev)
> if (!data)
> return -ENOMEM;
>
> + spin_lock_init(&data->lock);
> +
> res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> data->sfrbase = devm_ioremap_resource(dev, res);
> if (IS_ERR(data->sfrbase))
> @@ -773,7 +775,6 @@ static int exynos_sysmmu_probe(struct platform_device *pdev)
> return PTR_ERR(data->clk_master);
>
> data->sysmmu = dev;
> - spin_lock_init(&data->lock);
>
> __sysmmu_get_version(data);
>
Best regards
--
Marek Szyprowski, PhD
Samsung R&D Institute Poland
^ permalink raw reply [flat|nested] 3+ messages in thread