* [PATCH] iommu/exynos: Initialize lock before requesting IRQ
@ 2026-09-01 13:05 ` Runyu Xiao
2026-09-01 13:20 ` Robin Murphy
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Runyu Xiao @ 2026-09-01 13:05 UTC (permalink / raw)
To: Marek Szyprowski
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, Runyu Xiao, Jianhao Xu
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
---
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);
--
2.34.1
^ permalink raw reply [flat|nested] 4+ 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
2026-09-21 12:07 ` Runyu Xiao
2 siblings, 0 replies; 4+ 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] 4+ 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
2026-09-21 12:07 ` Runyu Xiao
2 siblings, 0 replies; 4+ 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] 4+ 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
@ 2026-09-21 12:07 ` Runyu Xiao
2 siblings, 0 replies; 4+ messages in thread
From: Runyu Xiao @ 2026-09-21 12:07 UTC (permalink / raw)
To: Robin Murphy, Marek Szyprowski
Cc: Runyu Xiao, Joerg Roedel, Will Deacon, Krzysztof Kozlowski,
Alim Akhtar, KyongHo Cho, Kukjin Kim, iommu, linux-arm-kernel,
linux-samsung-soc, linux-kernel, stable, Jianhao Xu
Hello Robin and Marek,
Thanks for the reviews.
I agree that the current patch is incomplete. The interrupt handler does
not only access data->lock; it also depends on the clocks, variant data,
device pointers, and the SYSMMU hardware state, which are not fully
initialized at the current devm_request_irq() point.
Moving only spin_lock_init() before devm_request_irq() therefore does not
make the handler safe. I will withdraw this patch and will not send a v2
of the current change.
If this issue is pursued further, I will review the complete probe ordering
and the SYSMMU hardware disable/reset sequence before preparing a new patch.
Please disregard the submitted patch.
Regards,
Runyu
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-09-21 12:08 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <CGME20260901130537eucas1p274a55745ced68a1e157bd43cfd17448f@eucas1p2.samsung.com>
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
2026-09-21 12:07 ` Runyu Xiao
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®