All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ARM: vexpress: Fix SCU mapping leak in vexpress_smp_dt_prepare_cpus()
@ 2026-11-24 15:58 Yuho Choi
  2026-11-25  9:36 ` Sudeep Holla
  0 siblings, 1 reply; 2+ messages in thread
From: Yuho Choi @ 2026-11-24 15:58 UTC (permalink / raw)
  To: Sudeep Holla, Liviu Dudau, Lorenzo Pieralisi, Linus Walleij
  Cc: Russell King, linux-arm-kernel, linux-kernel, Yuho Choi

vexpress_smp_dt_prepare_cpus() maps the SCU with of_iomap() only to
pass it to scu_enable(), and never unmaps it. scu_enable() does not
keep the address, and nothing else in the vexpress SMP code uses the
SCU, so the mapping is leaked. The function runs once while bringing up
the secondary CPUs, so a single mapping is leaked at boot.

Unmap the SCU after enabling it, as hisi_enable_scu_a9() does. Also
skip scu_enable() when of_iomap() fails, instead of passing it a NULL
pointer.

Fixes: d2606f81d563 ("ARM: vexpress: Simplify SMP operations for DT-powered system")
Signed-off-by: Yuho Choi <oss.patchbox@gmail.com>
---
Tested on QEMU vexpress-a9 (-smp 4) with multi_v7_defconfig, on top of
8dac6df92a2e. Without this patch, /proc/vmallocinfo still lists the SCU
mapping after boot:

  8192 vexpress_smp_dt_prepare_cpus+0x28/0x54 phys=0x1e000000 ioremap

With it, that entry is gone, and all four CPUs still come online
("SMP: Total of 4 processors activated").

 arch/arm/mach-versatile/platsmp-vexpress.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/arch/arm/mach-versatile/platsmp-vexpress.c b/arch/arm/mach-versatile/platsmp-vexpress.c
index b810ad50b98c..e373d75653cf 100644
--- a/arch/arm/mach-versatile/platsmp-vexpress.c
+++ b/arch/arm/mach-versatile/platsmp-vexpress.c
@@ -64,8 +64,14 @@ static void __init vexpress_smp_dt_prepare_cpus(unsigned int max_cpus)
 	struct device_node *scu __free(device_node) =
 		of_find_matching_node(NULL, vexpress_smp_dt_scu_match);
 
-	if (scu)
-		scu_enable(of_iomap(scu, 0));
+	if (scu) {
+		void __iomem *scu_base = of_iomap(scu, 0);
+
+		if (scu_base) {
+			scu_enable(scu_base);
+			iounmap(scu_base);
+		}
+	}
 
 	/*
 	 * Write the address of secondary startup into the

base-commit: 8dac6df92a2e66e2098bbc69061964cfe7e8375b
-- 
2.56.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] ARM: vexpress: Fix SCU mapping leak in vexpress_smp_dt_prepare_cpus()
  2026-11-24 15:58 [PATCH] ARM: vexpress: Fix SCU mapping leak in vexpress_smp_dt_prepare_cpus() Yuho Choi
@ 2026-11-25  9:36 ` Sudeep Holla
  0 siblings, 0 replies; 2+ messages in thread
From: Sudeep Holla @ 2026-11-25  9:36 UTC (permalink / raw)
  To: Yuho Choi
  Cc: Liviu Dudau, Lorenzo Pieralisi, Linus Walleij, Russell King,
	linux-arm-kernel, linux-kernel

On Tue, Nov 24, 2026 at 03:58:35PM +0000, Yuho Choi wrote:
> vexpress_smp_dt_prepare_cpus() maps the SCU with of_iomap() only to
> pass it to scu_enable(), and never unmaps it. scu_enable() does not
> keep the address, and nothing else in the vexpress SMP code uses the
> SCU, so the mapping is leaked. The function runs once while bringing up
> the secondary CPUs, so a single mapping is leaked at boot.
> 
> Unmap the SCU after enabling it, as hisi_enable_scu_a9() does. Also
> skip scu_enable() when of_iomap() fails, instead of passing it a NULL
> pointer.
> 

https://patch.msgid.link/20261104145446.2767924-1-sudeep.holla@kernel.org

Already queued in -next.

-- 
Regards,
Sudeep

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-11-25  9:36 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-24 15:58 [PATCH] ARM: vexpress: Fix SCU mapping leak in vexpress_smp_dt_prepare_cpus() Yuho Choi
2026-11-25  9:36 ` Sudeep Holla

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.