pmdomain: renesas: rcar-sysc: publish the external request mask
Subsystems (2)
PATCH 1/1 pmdomain: renesas: rcar-sysc: publish the external request mask
rcar_sysc_pd_init() maps the SYSC registers and stores rcar_sysc_base, rcar_sysc_extmask_offs and rcar_sysc_extmask_val with plain stores, before it registers the power domains. rcar_sysc_power() tests rcar_sysc_extmask_val and then writes through rcar_sysc_base at that offset, from genpd on any CPU.
Publish the mask value last with smp_store_release() and read it once with smp_load_acquire() in rcar_sysc_power().
Found with MBCheck, a static herd7-based memory consistency checker.
--- drivers/pmdomain/renesas/rcar-sysc.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-)
drivers/pmdomain/renesas/rcar-sysc.c +13 -4
@@ -106,15 +106,19 @@ static int rcar_sysc_power(const struct rcar_sysc_pd *pd, bool on)unsigned int chan_mask =BIT (pd->chan_bit);unsigned int status, k;unsigned long flags; +u32 extmask_val;int ret;spin_lock_irqsave (&rcar_sysc_lock, flags); +/* Pairs with the smp_store_release() in rcar_sysc_pd_init(). */ + extmask_val =smp_load_acquire (&rcar_sysc_extmask_val); +/* * Mask external power requests for CPU or 3DG domains */ -if (rcar_sysc_extmask_val) { -iowrite32 (rcar_sysc_extmask_val, +if (extmask_val) { +iowrite32 (extmask_val, rcar_sysc_base + rcar_sysc_extmask_offs); }
@@ -157,7 +161,7 @@ static int rcar_sysc_power(const struct rcar_sysc_pd *pd, bool on)iowrite32 (isr_mask, rcar_sysc_base +SYSCISCR ); out: -if (rcar_sysc_extmask_val) +if (extmask_val)iowrite32 (0 , rcar_sysc_base + rcar_sysc_extmask_offs);spin_unlock_irqrestore (&rcar_sysc_lock, flags);
@@ -381,7 +385,12 @@ static int __init rcar_sysc_pd_init(void)/* Optional External Request Mask Register */ rcar_sysc_extmask_offs = info->extmask_offs; - rcar_sysc_extmask_val = info->extmask_val; +/* +* rcar_sysc_power() tests rcar_sysc_extmask_val and then uses +* rcar_sysc_base and the offset, so publish the value last, with +* release semantics. +*/ +smp_store_release (&rcar_sysc_extmask_val, info->extmask_val); domains =kzalloc_obj (*domains);if (!domains) {
---
base-commit: 93f51579e7df248780214094418f205253383cc5
change-id: 20260921-mb-rcar-sysc-6e76b8d94835
Best regards,
Signature · 1 line
Jaidev Shastri <[email protected]>
Hi Jaidev,
Quoted 8 lines · On Tue, 22 Sept 2026 at 03:18, Jaidev Shastri via B4 Relay…
From: Jaidev Shastri <[email protected]>
rcar_sysc_pd_init()maps the SYSC registers and storesrcar_sysc_base,rcar_sysc_extmask_offsandrcar_sysc_extmask_valwith plain stores, before it registers the power domains.rcar_sysc_power()testsrcar_sysc_extmask_valand then writes throughrcar_sysc_baseat that offset, from genpd on any CPU.
Quoted 6 lines
Publish the mask value last with
smp_store_release()and read it once withsmp_load_acquire()inrcar_sysc_power().Found with MBCheck, a static herd7-based memory consistency checker.
Signed-off-by Jaidev Shastri <[email protected]>
Thanks for your patch!
Have you tested it?
drivers/pmdomain/renesas/rcar-sysc.c static int rcar_sysc_power(const struct rcar_sysc_pd *pd, bool on) · line 112
Quoted 10 lines
drivers/pmdomain/renesas/rcar-sysc.c +1
-0@@ -106,15 +106,19 @@ static int rcar_sysc_power(const struct rcar_sysc_pd *pd, bool on)unsigned int chan_mask =BIT (pd->chan_bit);unsigned int status, k;unsigned long flags; +u32 extmask_val;int ret;spin_lock_irqsave (&rcar_sysc_lock, flags);
Isn't the spin_lock acquisition a sufficient barrier?
Quoted 4 lines
drivers/pmdomain/renesas/rcar-sysc.c +3
-0+/* Pairs with the smp_store_release() in rcar_sysc_pd_init(). */ + extmask_val =smp_load_acquire (&rcar_sysc_extmask_val); +
drivers/pmdomain/renesas/rcar-sysc.c static int rcar_sysc_power(const struct rcar_sysc_pd *pd, bool on) · line 124
Quoted 10 lines
drivers/pmdomain/renesas/rcar-sysc.c +2
-2/* * Mask external power requests for CPU or 3DG domains */ -if (rcar_sysc_extmask_val) { -iowrite32 (rcar_sysc_extmask_val, +if (extmask_val) { +iowrite32 (extmask_val, rcar_sysc_base + rcar_sysc_extmask_offs); }
Gr{oetje,eeting}s,
Geert
Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected] In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds