Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Aaro Koskinen <aaro.koskinen@iki.fi>
To: Mark Rutland <mark.rutland@arm.com>
Cc: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>,
	linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	Aaro Koskinen <aaro.koskinen@nokia.com>
Subject: Re: [PATCH] drivers: firmware: psci: add support for warm reset
Date: Wed, 3 Apr 2019 21:12:06 +0300	[thread overview]
Message-ID: <20190403181206.GA17115@darkstar.musicnaut.iki.fi> (raw)
In-Reply-To: <20190403033314.k2wqxkm5c7imhtu5@blommer>

Hi,

On Wed, Apr 03, 2019 at 04:33:15AM +0100, Mark Rutland wrote:
> On Mon, Apr 01, 2019 at 09:14:43PM +0300, Aaro Koskinen wrote:
> > From: Aaro Koskinen <aaro.koskinen@nokia.com>
> > 
> > Add support for warm reset using SYSTEM_RESET2 introduced in PSCI
> > 1.1 specification.
> 
> For reference, how do you intend to use this?

The reboot mode is set using the kernel command line. One use case for warm
reset is pstore/ramoops.

> > @@ -256,6 +257,14 @@ static void psci_sys_reset(enum reboot_mode reboot_mode, const char *cmd)
> >  	invoke_psci_fn(PSCI_0_2_FN_SYSTEM_RESET, 0, 0, 0);
> >  }
> >  
> > +static void psci_sys_reset2(enum reboot_mode reboot_mode, const char *cmd)
> > +{
> > +	if (reboot_mode == REBOOT_WARM)
> > +		invoke_psci_fn(psci_function_id[PSCI_FN_SYSTEM_RESET2], 0, 0, 0);
> > +	else
> > +		psci_sys_reset(reboot_mode, cmd);
> > +}
> 
> What happens when RESET2 isn't available, but the user requests s REBOOT_WARM
> reset? It looks like we'd invoke a bogus SMC.

This function is only called through arm_pm_restart. If the feature is
not available, then arm_pm_restart points to the default psci_sys_reset.

> Could we please add a preprocessor definition for SYSTEM_RESET_WARM so that
> it's clear that we're passing a parameter here?

OK, will add.

> >  /*
> >   * Probe function for PSCI firmware versions >= 0.2
> >   */
> > @@ -588,6 +611,8 @@ static int __init psci_probe(void)
> >  		psci_init_smccc();
> >  		psci_init_cpu_suspend();
> >  		psci_init_system_suspend();
> > +		if (PSCI_VERSION_MINOR(ver) >= 1)
> > +			psci_1_1_set_functions();
> >  	}
> 
> If we're going to add more things to this chain, can we please refactor this as:
> 
> 	if (ver < PSCI_VERSION(1, 0))
> 		return;
> 
> 	/* PSCI 1.0 setup here */
> 
> 	if (ver < PSCI_VERSION(1,1))
> 		return;
> 
> 	/* PSCI 1.1 setup here */
> 
> ... as that saves on indentation and is easier to extend in future.

OK, makes sense, I will do that.

Thanks,

A.

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

      reply	other threads:[~2019-04-03 18:12 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-01 18:14 [PATCH] drivers: firmware: psci: add support for warm reset Aaro Koskinen
2019-04-03  3:33 ` Mark Rutland
2019-04-03 18:12   ` Aaro Koskinen [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190403181206.GA17115@darkstar.musicnaut.iki.fi \
    --to=aaro.koskinen@iki.fi \
    --cc=aaro.koskinen@nokia.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lorenzo.pieralisi@arm.com \
    --cc=mark.rutland@arm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox