Re: [PATCH v23 02/13] power: reset: reboot-mode: Support up to 3 magic values per mode

From: Pavan Kondeti

Date: Thu Jul 23 2026 - 06:17:54 EST


On Wed, Jul 22, 2026 at 07:03:22PM +0530, Shivendra Pratap wrote:
>
>
> On 22-07-2026 15:20, Pavan Kondeti wrote:
> > On Tue, Jul 14, 2026 at 10:46:30PM +0530, Shivendra Pratap wrote:
> > > ARM PSCI vendor-specific resets, require a 32-bit reset_type and a 64-bit
> > > cookie as arguments. This cannot be implemented via the reboot-mode
> > > framework, which supports a single 32-bit argument as magic value.
> > >
> > > Extend the reboot-mode framework to support up to three 32-bit arguments
> > > as magic, per reboot-mode.
> > >
> > > Signed-off-by: Shivendra Pratap <shivendra.pratap@xxxxxxxxxxxxxxxx>
> > > ---
> > > drivers/power/reset/nvmem-reboot-mode.c | 10 ++++----
> > > drivers/power/reset/qcom-pon.c | 8 ++++---
> > > drivers/power/reset/reboot-mode.c | 41 +++++++++++++++++++++-----------
> > > drivers/power/reset/syscon-reboot-mode.c | 8 ++++---
> > > include/linux/reboot-mode.h | 4 +++-
> > > 5 files changed, 46 insertions(+), 25 deletions(-)
> > >
> > > diff --git a/drivers/power/reset/nvmem-reboot-mode.c b/drivers/power/reset/nvmem-reboot-mode.c
> > > index d260715fccf6..ac69b5f39fb4 100644
> > > --- a/drivers/power/reset/nvmem-reboot-mode.c
> > > +++ b/drivers/power/reset/nvmem-reboot-mode.c
> > > @@ -17,14 +17,16 @@ struct nvmem_reboot_mode {
> > > struct nvmem_cell *cell;
> > > };
> > > -static int nvmem_reboot_mode_write(struct reboot_mode_driver *reboot,
> > > - unsigned int magic)
> > > +static int nvmem_reboot_mode_write(struct reboot_mode_driver *reboot, u32 *magic, int count)
> > > {
> > > struct nvmem_reboot_mode *nvmem_rbm;
> > > size_t buf_len;
> > > void *buf;
> > > int ret;
> > > + if (count != 1)
> > > + return -EINVAL;
> > > +
> >
> > The count can be different per mode. Because `struct mode_info` has
> > `count` member. This single `count` check across all modes may not be
> > useful.
> >
> > Either drivers need to use count passed to them or drivers needs to
> > receive `struct mode_info` in the callabck.
>
> will add a once more write function in reboot-mode to handle the multi-count
> support. If a driver implements it, the multi-count write function will be
> called. And no change in existing drivers.
> Does that address this concern?
>
sounds good. it is just that `count` is not fixed for a given driver but
it is fixed per mode which needs to be handled or provison must be be
there to handle it.

Thanks,
Pavan