Re: [PATCH] pmdomain: renesas: rcar-sysc: publish the external request mask

From: Geert Uytterhoeven

Date: Tue Sep 22 2026 - 05:57:05 EST


Hi Jaidev,

On Tue, 22 Sept 2026 at 03:18, Jaidev Shastri via B4 Relay
<devnull+jaidevshastri.vt.edu@xxxxxxxxxx> wrote:
> From: Jaidev Shastri <jaidevshastri@xxxxxx>
>
> 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.
>
> Signed-off-by: Jaidev Shastri <jaidevshastri@xxxxxx>

Thanks for your patch!

Have you tested it?

> --- a/drivers/pmdomain/renesas/rcar-sysc.c
> +++ b/drivers/pmdomain/renesas/rcar-sysc.c
> @@ -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?

>
> + /* 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);
> }
>

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@xxxxxxxxxxxxxx

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