Re: [PATCH] soc: apple: apple-pmgr-pwrstate: Switch to IRQ-safe mode

From: Hector Martin
Date: Mon Jan 23 2023 - 09:11:16 EST


On 23/01/2023 20.22, Eric Curtin wrote:
> On Mon, 23 Jan 2023 at 07:01, Hector Martin <marcan@xxxxxxxxx> wrote:
>>
>> This requires changing the reset path locking primitives to the spinlock
>> path in genpd, instead of the mutex path.
>>
>> Signed-off-by: Hector Martin <marcan@xxxxxxxxx>
>> ---
>
> It seems we need this to avoid a race from reading #asahi-dev IRC,
> commit message could be more detailed here.
>
> Reviewed-by: Eric Curtin <ecurtin@xxxxxxxxxx>

Not exactly, that was unrelated. We just need this to be able to switch
power states from IRQ/atomic context, which came up when adding runtime
PM to the DART driver (IIRC, this was a few weeks back and I threw
runtime PM into like 3 drivers that day so I might be misremembering,
but we definitely need it for one of them :-)).

The power state part of the driver itself is trivially IRQ-safe already,
so there is no reason not to do it. We just have to switch the locking
primitive the reset code uses (genpd already supports both), which is
only used to provide the reset functionality safely since it involves
the same register as the power state control.

- Hector