linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* PSCI reset support - specification
@ 2017-03-03 12:09 Michal Simek
  2017-03-03 15:06 ` Mark Rutland
  0 siblings, 1 reply; 2+ messages in thread
From: Michal Simek @ 2017-03-03 12:09 UTC (permalink / raw)
  To: linux-arm-kernel

Hi,

I have read psci 1.0 specification available here.
http://infocenter.arm.com/help/topic/com.arm.doc.den0022c/DEN0022C_Power_State_Coordination_Interface.pdf

I have looked at SYSTEM_RESET where only the first parameter is setup
which is Function ID (0x8400 0009) and the rest of parameters are not
setup.

In Linux kernel we have psci_sys_reset

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);
}

where others parameters are zeros.
Is this done by purpose that these zeros are there?
Because based on spec these are not used and value is not specified.

For example u-boot is allocating regs on the stack and others parameters
have random values.

Thanks,
Michal
-- 
Michal Simek, Ing. (M.Eng), OpenPGP -> KeyID: FE3D1F91
w: www.monstr.eu p: +42-0-721842854
Maintainer of Linux kernel - Xilinx Microblaze
Maintainer of Linux kernel - Xilinx Zynq ARM and ZynqMP ARM64 SoCs
U-Boot custodian - Xilinx Microblaze/Zynq/ZynqMP SoCs


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: OpenPGP digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20170303/d9760dc8/attachment.sig>

^ permalink raw reply	[flat|nested] 2+ messages in thread

* PSCI reset support - specification
  2017-03-03 12:09 PSCI reset support - specification Michal Simek
@ 2017-03-03 15:06 ` Mark Rutland
  0 siblings, 0 replies; 2+ messages in thread
From: Mark Rutland @ 2017-03-03 15:06 UTC (permalink / raw)
  To: linux-arm-kernel

On Fri, Mar 03, 2017 at 01:09:51PM +0100, Michal Simek wrote:
> Hi,

Hi,

> I have read psci 1.0 specification available here.
> http://infocenter.arm.com/help/topic/com.arm.doc.den0022c/DEN0022C_Power_State_Coordination_Interface.pdf
> 
> I have looked at SYSTEM_RESET where only the first parameter is setup
> which is Function ID (0x8400 0009) and the rest of parameters are not
> setup.

The PSCI SYSTEM_RESET call only has the Function ID parameter, and no
other parameters.

It's not so much that they're not set up, but rather that they do not
exist.

> In Linux kernel we have psci_sys_reset
> 
> 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);
> }
> 
> where others parameters are zeros.
> Is this done by purpose that these zeros are there?

The zeroes are simply an implementation detail of the Linux-internal
invoke_psci_fn() API. As SYSTEM_RESET takes no parameters other than the
Function ID, a PSCI implementation must not treat the remaining
parameter passing register values as meaningful.

It is entirely valid for the above to be changed to:

static void psci_sys_reset(enum reboot_mode reboot_mode, const char *cmd)
{
	invoke_psci_fn(PSCI_0_2_FN_SYSTEM_RESET,
	               get_random_long(),
		       get_random_long(),
		       get_random_long());
}

No compliant PSCI implementation should be affected by this.

> Because based on spec these are not used and value is not specified.
> 
> For example u-boot is allocating regs on the stack and others parameters
> have random values.

This is correct. The remaining parameter-passing registers are unused,
and are permitted to contain any value whatsoever when the call is made.

Thanks,
Mark.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-03-03 15:06 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-03-03 12:09 PSCI reset support - specification Michal Simek
2017-03-03 15:06 ` Mark Rutland

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).