[PATCH v2 2/2] ARM: l2c: honour status = "disabled" on the L2 cache node

From: Agustin Santiago Isasmendi

Date: Thu Nov 12 2026 - 02:52:59 EST


l2x0_of_init() looks the L2 cache node up by compatible and enables the
cache whatever its status property says, so a device tree cannot keep
the L2 cache off.

On the ZTE ZX279128S (dual Cortex-A9, L2C-310 r3p3) a PCIe read on one
CPU deadlocks against an L2C-310 line operation by physical address or a
Cache Sync on the other CPU, and the board hangs within seconds of WiFi
traffic. Running with the L2 cache off avoids the deadlock, so a board
needs a way to say so.

Honour the status property, as the newer cache controller drivers
already do (drivers/cache/ax45mp_cache.c, starfive_starlink_cache.c):
leave a disabled node alone. The firmware is responsible for leaving
the cache disabled in that case; the kernel does not check. No in-tree
L2 cache node is disabled, so nothing changes for existing device trees.

Tested on the ZTE ZXHN H3600: with the node disabled the cache stays
off and the system runs normally; with it enabled the cache comes up as
before.

Assisted-by: LLM
Reviewed-by: Arnd Bergmann <arnd@xxxxxxxx>
Signed-off-by: Agustin Santiago Isasmendi <isasmendi.agus@xxxxxxxxx>
---
arch/arm/mm/cache-l2x0.c | 5 +++++
1 file changed, 5 insertions(+)

diff --git a/arch/arm/mm/cache-l2x0.c b/arch/arm/mm/cache-l2x0.c
index 470867160076..5d6a4c040a50 100644
--- a/arch/arm/mm/cache-l2x0.c
+++ b/arch/arm/mm/cache-l2x0.c
@@ -1772,6 +1772,11 @@ int __init l2x0_of_init(u32 aux_val, u32 aux_mask)
if (!np)
return -ENODEV;

+ if (!of_device_is_available(np)) {
+ pr_info("L2C: disabled by the device tree\n");
+ return -ENODEV;
+ }
+
if (of_address_to_resource(np, 0, &res))
return -ENODEV;

--
2.30.2