Re: [PATCH v2 0/4] Implement vendor resets for PSCI SYSTEM_RESET2

Elliot Berman
2024-04-19T23:31:36Z

On Fri, Apr 19, 2024 at 09:53:45AM +0100, Sudeep Holla wrote:
> On Wed, Apr 17, 2024 at 02:54:41PM -0700, Elliot Berman wrote:
> > On Tue, Apr 16, 2024 at 10:35:22AM +0100, Sudeep Holla wrote:
> > > On Sun, Apr 14, 2024 at 12:30:23PM -0700, Elliot Berman wrote:
> > > > The PSCI SYSTEM_RESET2 call allows vendor firmware to define additional
> > > > reset types which could be mapped to the reboot argument.
> > > >
> > > > Setting up reboot on Qualcomm devices can be inconsistent from chipset
> > > > to chipset.
> > >
> > > That doesn't sound good. Do you mean PSCI SYSTEM_RESET doesn't work as
> > > expected ? Does it mean it is not conformant to the specification ?
> > >
> >
> > I was motivating the reason for using SYSTEM_RESET2. How to set the PMIC
> > register and IMEM cookie can change between chipsets. Using
> > SYSTEM_RESET2 alows us to abstract how to perform the reset.
>
> Fair enough. But I assume you are not providing the details of PMIC register
> or IMEM cookie via DT.

Kernel doesn't need this info.

>
> Anyways you did confirm if PSCI SYSTEM_RESET works as expected or not. That
> is default and must work.
>

Yes, SYSTEM_RESET works on Quacomm firmware. The bindings disallow
trying to override the default reboot. (reboot command = NULL or "") The
PSCI parsing of the DT also doesn't have any of the special handling to
deal with "mode-normal".

> > > > Generally, there is a PMIC register that gets written to
> > > > decide the reboot type. There is also sometimes a cookie that can be
> > > > written to indicate that the bootloader should behave differently than a
> > > > regular boot. These knobs evolve over product generations and require
> > > > more drivers. Qualcomm firmwares are beginning to expose vendor
> > > > SYSTEM_RESET2 types to simplify driver requirements from Linux.
> > > >
> > >
> > > Why can't this be fully userspace driven ? What is the need to keep the
> > > cookie in the DT ?
> >
> > As Dmitry pointed out, this information isn't discoverable. I suppose
> > we could technically use bootconfig or kernel command-line to convey the
> > map although I think devicetree is the right spot for this mapping.
> >
>
> Yes and as usual DT has become dumping ground for firmware that don't
> make things discoverable. Make crap that Qcom puts in the DT are firmware
> related and can be make discoverable. Anyways it is sad that no efforts
> to make it so are done as DT is always there to provide shortcuts.
>
> > - Other vendor-specific bits for PSCI are described in the devicetree.
> > One example is the suspend param (e.g. the StateID) for cpu idle
> > states.
>
> You are right, but that is the only example I can see and it was done
> in very early days of PSCI. It shouldn't be example if there are better
> ways.
>
> > - Describing firmware bits in the DT isn't unprecedented, and putting
> > this information outside the DT means that other OSes (besides Linux)
> > need their own way to convey this information.
>
> Correct but it can be Qcom specific firmware interface. There are so many
> already. This splitting information between firmware and DT works well
> for vertically integrated things which probably is the case with most of
> Qcom SoCs but it is prone to issues if DT and firmware mismatch. Firmware
> discovery eliminates such issues.
>

I worry about designing interfaces both in Qualcomm firmware and in
the PSCI driver which doesn't really suit handling the discovery. We can
implement the dynamic discovery mechanims once there is a board which
needs it.

Thanks,
Elliot