[U-Boot] [PATCH] arm: stm32mp1: add PSCI support
Mark Rutland
mark.rutland at arm.com
Wed Mar 28 15:08:11 UTC 2018
Hi,
On Tue, Mar 20, 2018 at 01:59:03PM +0100, Patrick Delaunay wrote:
> Add minimal PSCI support for Linux.
>
> Signed-off-by: Patrick Delaunay <patrick.delaunay at st.com>
> +int __secure psci_features(unsigned int psci_fid)
> +{
> + switch (psci_fid) {
> + case ARM_PSCI_0_2_FN_PSCI_VERSION:
> + case ARM_PSCI_0_2_FN_CPU_ON:
> + case ARM_PSCI_0_2_FN_CPU_OFF:
> + case ARM_PSCI_0_2_FN_SYSTEM_RESET:
> + return 0x0;
> + }
> + return ARM_PSCI_RET_NI;
> +}
>
> +unsigned int __secure psci_version(void)
> +{
> + return ARM_PSCI_VER_1_0;
> +}
I'm a bit worried, because while PSCI_VERSION reports PSCI 1.0, this
does not appear to be conformant with teh PSCI 1.0 spec, as some
mandatory functions are missing:
* AFFINITY_INFO -- Linux relies on this to ensure that CPUs have exited
the kernel when calling CPU_OFF (e.g. so that we don't free any data /
code that said CPU may be using on the path to calling CPU_OFF).
* SYSTEM_OFF -- Can you implement this similarly to SYSTEM_RESET?
> +int __secure psci_cpu_on(u32 __always_unused unused, u32 mpidr, u32 pc)
> +{
What about the context_id? PSCI 0.2+ mandates it, and some project rely
upon it (though Linux currently does not).
> + u32 cpu = (mpidr & 0x3);
> +
> + /* store target PC */
> + psci_save_target_pc(cpu, pc);
> +
> + /* write entrypoint in backup RAM register */
> + writel((u32)&psci_cpu_entry, TAMP_BACKUP_BRANCH_ADDRESS);
> +
> + /* write magic number in backup register */
> + writel(BOOT_API_A7_CORE1_MAGIC_NUMBER, TAMP_BACKUP_MAGIC_NUMBER);
> + stm32mp_smp_kick_all_cpus();
> +
> + return ARM_PSCI_RET_SUCCESS;
Does some other part of U-Boot do some state tracking? What happens if
this is called for a CPU that's already online?
Thanks,
Mark.
More information about the U-Boot
mailing list