Hi Jan,
On Fri, Sep 30, 2016 at 09:21:03AM +0200, Jan Kiszka wrote:
> I just found this in the AArch64 patches:
>
> "On AArch64 PSCI calls can be issued via SVC64 hypercalls as well,
> contrary to AArch32 which uses SVC32 calls only."
I take it s/SVC32/SMC32/ ?
It's worth noting that this only applies to *some* PSCI calls; more details
below.
> What makes that arch different von 32-bit?
SMC32 calls can only take/return 32-bit quantities, and SMC64 calls can
take/return 64-bit quantities. Per the SMC Calling Convention, SMC64 calls are
*only* valid when taken from AArch64. SMC32 calls are valid from both AArch32
and AArch64.
Some PSCI calls (e.g. CPU_ON) have both SMC32/SMC64 variants because they must
take/return a 64-bit value on AArch64 (e.g. entry point address for CPU_ON).
Some PSCI calls (e.g. CPU_OFF) are *always* SMC32, as they deal entirely in
32-bit quantities (and/or take no arguments), and it doesn't make sense to have
another ID for the exact same function prototype and logic.
For more details, see ARM DEN 0028A ("SMC CALLING CONVENTION") and ARM DEN
0022C ("POWER STATE COORDINATION INTERFACE (PSCI)").
> In both cases, the root cell only has a primitive hypervisor stub installed
> prior to enabling Jailhouse, and that stub does not handle PSCI hypercalls.
>
> Looking at linux/drivers/firmware/psci.c seems to confirm this: it's
> shared by both archs.
The driver is common. SMC32-only calls are called directly, while for
SMC32/SMC64 functions, we figure out the ID and calling convention per the
architecture the driver is built for. The PSCI_FN_NATIVE() macro handles this
difference.
Does that help to clarify things?
Thanks,
Mark.