On Mon, Jan 06, 2020 at 11:17:16AM +0000, Andre Przywara wrote: > On Mon, 6 Jan 2020 10:41:55 +0000 > Alexandru Elisei <alexandru.elisei@xxxxxxx> wrote: > > > Hi Andre, > > > > Thank you for reviewing the patches! > > > > On 1/2/20 6:11 PM, Andre Przywara wrote: > > >> +.global asm_cpu_psci_cpu_die > > >> +asm_cpu_psci_cpu_die: > > >> + ldr r0, =PSCI_0_2_FN_CPU_OFF > > >> + hvc #0 > > >> + b . > > > I am wondering if this implementation is actually too simple. Both > > > the current implementation and the kernel clear at least the first > > > three arguments to 0. I failed to find a requirement for doing > > > this (nothing in the SMCCC or the PSCI spec), but I guess it would > > > make sense when looking at forward compatibility. This is a Linux implementation detail, and is not intended to be an SMCCC contract detail. To be generic to all SMCCC calls, the invocation functions have to take the largest set of potential arguments, and callers have to pass /something/ for the unused values. It would be perfectly valid for callers to pass the result of get_random_long() instead. The SMCCC implementation should not derive any meaning from registers which are not arguments to the call in question. > > The SMC calling convention only specifies the values for the arguments that are > > used by a function, not the values for all possible arguments. kvm-unit-tests sets > > the other arguments to 0 because the function prototype that does the actual SMC > > call takes 4 arguments. The value 0 is a random value that was chosen for those > > unused parameters. For example, it could have been a random number on each call. > > > > Let me put it another way. Suggesting that unused arguments should be set to 0 is > > the same as suggesting that normal C function that adheres to procedure call > > standard for arm64 should always have 8 arguments, and for a particular function > > that doesn't use all of them, they should be set to 0 by the caller. > > I understand that, but was wondering if the SMCCC would mandate > stricter requirements. After all every PSCI call from Linux goes > through a function which clears all unused input parameters. Callers are not deliberately clearingh the unused parameters, but rather passing arbitrary values because they are forced to. Thanks, Mark.