Add ARMv8 PSCI framework
v5 cover Add ARMv8 PSCI framework
v4-v5 changes:
- rebased to latest u-boot version to ease conflict.
- added mutually exclusive from FSL_PPA.
v3-v4 changes:
- Re-added the 1/6 from v2, and move the newly re-named macro into Kconfig
- Add "Reviewed-by: Tom Rini <[email protected]>" for patch 4/6 ~ 6/6.
v2-v3 changes:
- Drop the previous 1/6, since the previous CONFIG_ARMV8_PSCI in common parts
of codes also work for generic PSCI framework, so there are 5 patches in this iteration.
- Add "Reviewed-by: Tom Rini <[email protected]>" for patches 1/5 and 2/5,
which were 2/6 and 3/6.
- Move config values for ls1043 from armv8/Kconfig to s1043ardb_defconfig.
v1-v2 changes:
- The new config options are introduced in Kconfig when used for first time
- Introduce new config options in armv8/Kconfig instead of LS1043 platform
- Move previous patch 5/6 to current 2/6 place
v1 notes:
This patch set introduces ARMv8 PSCI framework, all the PSCI functions are implemented a default dummy one, it is up to each platform to implement their own specific ones.
The first 1/6 patch is a prepare clean up for adding ARMv8 PSCI. Patches 2/6 to 5/6 introduce new ARMv8 framework and set it up. The last 6/6 adds a most simple implementation on NXP LS1043 platform, to verify this framework.
This patch set mainly introduces ARMv8 PSCI framework, for easier review and merge, further PSCI implementation on LS1043 is coming later.
Hongbo Zhang (6):
ARMv8: LS1043A: change macro CONFIG_ARMV8_PSCI definition
ARMv8: Add secure sections for PSCI text and data
ARMv8: Enable SMC instruction
ARMv8: Add basic PSCI framework
ARMv8: Setup PSCI memory and device tree
ARMv8: LS1043A: Enable LS1043A default PSCI support
arch/arm/config.mk | 3 +- arch/arm/cpu/armv8/Kconfig | 41 ++++ arch/arm/cpu/armv8/Makefile | 1 + arch/arm/cpu/armv8/cpu-dt.c | 11 +- arch/arm/cpu/armv8/cpu.c | 22 ++ arch/arm/cpu/armv8/fsl-layerscape/Kconfig | 21 ++ arch/arm/cpu/armv8/fsl-layerscape/Makefile | 1 + arch/arm/cpu/armv8/fsl-layerscape/cpu.c | 3 +- arch/arm/cpu/armv8/fsl-layerscape/fdt.c | 3 +- arch/arm/cpu/armv8/fsl-layerscape/ls1043a_psci.S | 20 ++ arch/arm/cpu/armv8/psci.S | 286 +++++++++++++++++++++++ arch/arm/cpu/armv8/sec_firmware.c | 2 +- arch/arm/cpu/armv8/sec_firmware_asm.S | 2 +- arch/arm/cpu/armv8/u-boot.lds | 57 +++++ arch/arm/include/asm/armv8/sec_firmware.h | 2 +- arch/arm/include/asm/macro.h | 8 +- arch/arm/include/asm/psci.h | 15 ++ arch/arm/include/asm/secure.h | 2 +- arch/arm/include/asm/system.h | 11 + arch/arm/lib/bootm-fdt.c | 3 +- arch/arm/lib/bootm.c | 3 + arch/arm/lib/psci-dt.c | 5 +- board/freescale/ls1043ardb/Kconfig | 9 + include/configs/ls1043ardb.h | 1 - 24 files changed, 519 insertions(+), 13 deletions(-) create mode 100644 arch/arm/cpu/armv8/fsl-layerscape/ls1043a_psci.S create mode 100644 arch/arm/cpu/armv8/psci.S
Signature · 1 line
2.1.4
PATCH v5 1/6 ARMv8: LS1043A: change macro CONFIG_ARMV8_PSCI definition
NXP/Freescale uses macro CONFIG_ARMV8_PSCI to enable their private PSCI implementation in PPA firmware, but this macro naming too generic, so this patch replaces it with a specic one CONFIG_FSL_PPA_ARMV8_PSCI. And this macro CONFIG_ARMV8_PSCI will be used for a generic PSCI for ARMv8 which will be added in following patchs.
--- arch/arm/cpu/armv8/cpu-dt.c | 2 +- arch/arm/cpu/armv8/fsl-layerscape/Kconfig | 20 ++++++++++++++++++++ arch/arm/cpu/armv8/fsl-layerscape/cpu.c | 3 ++- arch/arm/cpu/armv8/fsl-layerscape/fdt.c | 3 ++- arch/arm/cpu/armv8/sec_firmware.c | 2 +- arch/arm/cpu/armv8/sec_firmware_asm.S | 2 +- arch/arm/include/asm/armv8/sec_firmware.h | 2 +- arch/arm/lib/bootm-fdt.c | 2 +- arch/arm/lib/psci-dt.c | 2 +- include/configs/ls1043ardb.h | 1 - 10 files changed, 30 insertions(+), 9 deletions(-)
arch/arm/cpu/armv8/cpu-dt.c +1 -1
@@ -13,7 +13,7 @@int psci_update_dt (void *fdt) {#ifdef CONFIG_MP -#if defined(CONFIG_ARMV8_PSCI ) +#if defined(CONFIG_FSL_PPA_ARMV8_PSCI )#ifdef CONFIG_ARMV8_SEC_FIRMWARE_SUPPORT /* * If the PSCI in SEC Firmware didn't work, avoid to update the
arch/arm/cpu/armv8/fsl-layerscape/Kconfig +20 -0
@@ -44,6 +44,26 @@ config FSL_LSCH3 menu "Layerscape architecture" depends on FSL_LSCH2 || FSL_LSCH3 +menu "Layerscape PPA" +config FSL_LS_PPA + bool "FSL Layerscape PPA firmware support" + depends on ARCH_LS1043A || ARCH_LS1046A + select FSL_PPA_ARMV8_PSCI + help + The FSL Primary Protected Application (PPA) is a software component + which is loaded during boot stage, and then remains resident in RAM + and runs in the TrustZone after boot. + Say y to enable it. + +config FSL_PPA_ARMV8_PSCI + bool "PSCI implementation in PPA firmware" + depends on FSL_LS_PPA + help + This config enables the ARMv8 PSCI implementation in PPA firmware. + This is a private PSCI implementation and different from those + implemented under the common ARMv8 PSCI framework. +endmenu + config SYS_FSL_MMDC bool
arch/arm/cpu/armv8/fsl-layerscape/cpu.c +2 -1
@@ -410,7 +410,8 @@ int arch_early_init_r(void)erratum_a009942_check_cpo ();#endif #ifdef CONFIG_MP -#if defined(CONFIG_ARMV8_SEC_FIRMWARE_SUPPORT ) && defined(CONFIG_ARMV8_PSCI ) +#if defined(CONFIG_ARMV8_SEC_FIRMWARE_SUPPORT ) && \ + defined(CONFIG_FSL_PPA_ARMV8_PSCI )/* Check the psci version to determine if the psci is supported */ psci_ver =sec_firmware_support_psci_version ();#endif
arch/arm/cpu/armv8/fsl-layerscape/fdt.c +2 -1
@@ -42,7 +42,8 @@ void ft_fixup_cpu(void *blob)int addr_cells;u64 val, core_id;size_t *boot_code_size = &(__secondary_boot_code_size); -#if defined(CONFIG_ARMV8_SEC_FIRMWARE_SUPPORT ) && defined(CONFIG_ARMV8_PSCI ) +#if defined(CONFIG_ARMV8_SEC_FIRMWARE_SUPPORT ) && \ + defined(CONFIG_FSL_PPA_ARMV8_PSCI )int node;u32 psci_ver;
arch/arm/cpu/armv8/sec_firmware.c +1 -1
@@ -209,7 +209,7 @@ __weak bool sec_firmware_is_valid(const void *sec_firmware_img)return true; } -#ifdef CONFIG_ARMV8_PSCI +#ifdef CONFIG_FSL_PPA_ARMV8_PSCI /* * The PSCI_VERSION function is added from PSCI v0.2. When the PSCI * v0.1 received this function, the NOT_SUPPORTED (0xffff_ffff) error
arch/arm/cpu/armv8/sec_firmware_asm.S +1 -1
@@ -41,7 +41,7 @@ WEAK(_sec_firmware_entry) ret ENDPROC(_sec_firmware_entry) -#ifdef CONFIG_ARMV8_PSCI +#ifdef CONFIG_FSL_PPA_ARMV8_PSCI ENTRY(_sec_firmware_support_psci_version) mov x0, 0x84000000 mov x1, 0x0
arch/arm/include/asm/armv8/sec_firmware.h +1 -1
@@ -14,7 +14,7 @@int sec_firmware_init (const void *,u32 *,u32 *);int _sec_firmware_entry (const void *,u32 *,u32 *);bool sec_firmware_is_valid (const void *); -#ifdef CONFIG_ARMV8_PSCI +#ifdef CONFIG_FSL_PPA_ARMV8_PSCI unsigned int sec_firmware_support_psci_version (void );unsigned int _sec_firmware_support_psci_version (void );#endif
arch/arm/lib/bootm-fdt.c +1 -1
@@ -52,7 +52,7 @@ int arch_fixup_fdt(void *blob)return ret;#endif -#if defined(CONFIG_ARMV7_NONSEC ) || defined(CONFIG_ARMV8_PSCI ) +#if defined(CONFIG_ARMV7_NONSEC ) || defined(CONFIG_FSL_PPA_ARMV8_PSCI ) ret =psci_update_dt (blob);if (ret)return ret;
arch/arm/lib/psci-dt.c +1 -1
@@ -16,7 +16,7 @@int fdt_psci (void *fdt) { -#if defined(CONFIG_ARMV8_PSCI ) || defined(CONFIG_ARMV7_PSCI ) +#if defined(CONFIG_FSL_PPA_ARMV8_PSCI ) || defined(CONFIG_ARMV7_PSCI )int nodeoff;unsigned int psci_ver =0 ;int tmp;
include/configs/ls1043ardb.h +0 -1
@@ -12,7 +12,6 @@#if defined(CONFIG_FSL_LS_PPA )#define CONFIG_ARMV8_SEC_FIRMWARE_SUPPORT #define SEC_FIRMWARE_ERET_ADDR_REVERT -#define CONFIG_ARMV8_PSCI #define CONFIG_SYS_LS_PPA_FW_IN_XIP #ifdef CONFIG_SYS_LS_PPA_FW_IN_XIP
Signature · 1 line
2.1.4
PATCH v5 1/6 ARMv8: LS1043A: change macro CONFIG_ARMV8_PSCI definition
Quoted 7 lines · Hongbo Zhang
NXP/Freescale uses macro
CONFIG_ARMV8_PSCIto enable their private PSCI implementation in PPA firmware, but this macro naming too generic, so this patch replaces it with a specic oneCONFIG_FSL_PPA_ARMV8_PSCI. And this macroCONFIG_ARMV8_PSCIwill be used for a generic PSCI for ARMv8 which will be added in following patchs.Signed-off-by Hongbo Zhang <[email protected]>
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20161208/550ad2c6/attachment.sig>
PATCH v5 2/6 ARMv8: Add secure sections for PSCI text and data
In reply to Hongbo ZhangThis patch adds secure_text, secure_data and secure_stack sections for ARMv8 to hold PSCI text and data, and it is based on the legacy implementation of ARMv7.
ARMV8_SECURE_BASE defines the address for PSCI secure sections, ARMV8_PSCI and ARMV8_PSCI_NR_CPUS are firstly used in this patch, so they are introduce here in Kconfig too.
--- arch/arm/config.mk | 3 +- arch/arm/cpu/armv8/Kconfig | 31 +++++++++++++++++ arch/arm/cpu/armv8/fsl-layerscape/Kconfig | 1 + arch/arm/cpu/armv8/u-boot.lds | 57 +++++++++++++++++++++++++++++++ 4 files changed, 91 insertions(+), 1 deletion(-)
arch/arm/config.mk +2 -1
@@ -121,7 +121,8 @@ endif # limit ourselves to the sections we want in the .bin. ifdef CONFIG_ARM64 -OBJCOPYFLAGS += -j .text -j .rodata -j .data -j .u_boot_list -j .rela.dyn +OBJCOPYFLAGS += -j .text -j .secure_text -j .secure_data -j .rodata -j .data \ + -j .u_boot_list -j .rela.dyn else OBJCOPYFLAGS += -j .text -j .secure_text -j .secure_data -j .rodata -j .hash \ -j .data -j .got -j .got.plt -j .u_boot_list -j .rel.dyn
arch/arm/cpu/armv8/Kconfig +31 -0
@@ -40,4 +40,35 @@ config PSCI_RESET Select Y here to make use of PSCI calls for system reset +config ARMV8_PSCI + bool "Enable PSCI support" if EXPERT + default n + help + PSCI is Power State Coordination Interface defined by ARM. + The PSCI in U-boot provides a general framework and each platform + can implement their own specific PSCI functions. + Say Y here to enable PSCI support on ARMv8 platform. + +config ARMV8_PSCI_NR_CPUS + int "Maximum supported CPUs for PSCI" + depends on ARMV8_PSCI + default 4 + help + The maximum number of CPUs supported in the PSCI firmware. + It is no problem to set a larger value than the number of CPUs in + the actual hardware implementation. + +if SYS_HAS_ARMV8_SECURE_BASE + +config ARMV8_SECURE_BASE + hex "Secure address for PSCI image" + depends on ARMV8_PSCI + help + Address for placing the PSCI text, data and stack sections. + If not defined, the PSCI sections are placed together with the u-boot + but platform can choose to place PSCI code image separately in other + places such as some secure RAM built-in SOC etc. + +endif + endif
arch/arm/cpu/armv8/fsl-layerscape/Kconfig +1 -0
@@ -47,6 +47,7 @@ menu "Layerscape architecture" menu "Layerscape PPA" config FSL_LS_PPA bool "FSL Layerscape PPA firmware support" + depends on !ARMV8_PSCI depends on ARCH_LS1043A || ARCH_LS1046A select FSL_PPA_ARMV8_PSCI help
arch/arm/cpu/armv8/u-boot.lds +57 -0
74 lines not on this page · raw message
Signature · 1 line
2.1.4
PATCH v5 2/6 ARMv8: Add secure sections for PSCI text and data
Quoted 9 lines · Hongbo Zhang
This patch adds
secure_text,secure_dataandsecure_stacksections for ARMv8 to hold PSCI text and data, and it is based on the legacy implementation of ARMv7.
ARMV8_SECURE_BASEdefines the address for PSCI secure sections,ARMV8_PSCIandARMV8_PSCI_NR_CPUSare firstly used in this patch, so they are introduce here inKconfigtoo.Signed-off-by Hongbo Zhang <[email protected]>Reviewed-by Tom Rini <[email protected]>
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20161208/23845688/attachment.sig>
PATCH v5 3/6 ARMv8: Enable SMC instruction
In reply to Hongbo ZhangPSCI implementation needs the SMC instruction to be enabled.
--- arch/arm/include/asm/macro.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
arch/arm/include/asm/macro.h +7 -1
@@ -182,11 +182,17 @@ lr .req x30/* * The next lower exception level is AArch64, 64bit EL2 | HCE | -* SMD | RES1 (Bits[5:4]) | Non-secure EL0/EL1. +* RES1 (Bits[5:4]) | Non-secure EL0/EL1. +* and the SMD depends on requirements. */ +#ifdef CONFIG_ARMV8_PSCI + ldr \tmp, =(SCR_EL3_RW_AARCH64 | SCR_EL3_HCE_EN |\ + SCR_EL3_RES1 | SCR_EL3_NS_EN) +#else ldr \tmp, =(SCR_EL3_RW_AARCH64 | SCR_EL3_HCE_EN |\SCR_EL3_SMD_DIS |SCR_EL3_RES1 |\ SCR_EL3_NS_EN) +#endif msr scr_el3, \tmp/* Return to the EL2_SP2 mode from EL3 */
Signature · 1 line
2.1.4
PATCH v5 4/6 ARMv8: Add basic PSCI framework
In reply to Hongbo ZhangThis patch introduces a generic ARMv8 PSCI framework, with all functions returning a dummy ARM_PSCI_RET_NI (Not Implemented), then it is up to each platform to implement their own functions based on this framework.
--- arch/arm/cpu/armv8/Kconfig | 10 ++ arch/arm/cpu/armv8/Makefile | 1 + arch/arm/cpu/armv8/psci.S | 286 ++++++++++++++++++++++++++++++++++++++++++++ arch/arm/include/asm/psci.h | 15 +++ 4 files changed, 312 insertions(+) create mode 100644 arch/arm/cpu/armv8/psci.S
arch/arm/cpu/armv8/Kconfig +10 -0
@@ -58,6 +58,16 @@ config ARMV8_PSCI_NR_CPUS It is no problem to set a larger value than the number of CPUs in the actual hardware implementation. +config ARMV8_PSCI_CPUS_PER_CLUSTER + int "Number of CPUs per cluster" + depends on ARMV8_PSCI + default 0 + help + The number of CPUs per cluster, suppose each cluster has same number + of CPU cores, platforms with asymmetric clusters don't apply here. + A value 0 or no definition of it works for single cluster system. + System with multi-cluster should difine their own exact value. + if SYS_HAS_ARMV8_SECURE_BASE config ARMV8_SECURE_BASE
arch/arm/cpu/armv8/Makefile +1 -0
@@ -25,3 +25,4 @@ obj-$(CONFIG_FSL_LAYERSCAPE) += fsl-layerscape/ obj-$(CONFIG_S32V234) += s32v234/ obj-$(CONFIG_ARCH_ZYNQMP) += zynqmp/ obj-$(CONFIG_TARGET_HIKEY) += hisilicon/ +obj-$(CONFIG_ARMV8_PSCI) += psci.o
arch/arm/cpu/armv8/psci.S new file +286 -0
286 lines not on this page · raw message
arch/arm/include/asm/psci.h +15 -0
@@ -45,6 +45,9 @@#define ARM_PSCI_0_2_FN_BASE 0x84000000#define ARM_PSCI_0_2_FN (n) (ARM_PSCI_0_2_FN_BASE + (n)) +#define ARM_PSCI_0_2_FN64_BASE 0xC4000000 +#define ARM_PSCI_0_2_FN64 (n) (ARM_PSCI_0_2_FN64_BASE + (n)) +#define ARM_PSCI_0_2_FN_PSCI_VERSION ARM_PSCI_0_2_FN(0)#define ARM_PSCI_0_2_FN_CPU_SUSPEND ARM_PSCI_0_2_FN(1)#define ARM_PSCI_0_2_FN_CPU_OFF ARM_PSCI_0_2_FN(2)
@@ -56,6 +59,12 @@#define ARM_PSCI_0_2_FN_SYSTEM_OFF ARM_PSCI_0_2_FN(8)#define ARM_PSCI_0_2_FN_SYSTEM_RESET ARM_PSCI_0_2_FN(9) +#define ARM_PSCI_0_2_FN64_CPU_SUSPEND ARM_PSCI_0_2_FN64(1) +#define ARM_PSCI_0_2_FN64_CPU_ON ARM_PSCI_0_2_FN64(3) +#define ARM_PSCI_0_2_FN64_AFFINITY_INFO ARM_PSCI_0_2_FN64(4) +#define ARM_PSCI_0_2_FN64_MIGRATE ARM_PSCI_0_2_FN64(5) +#define ARM_PSCI_0_2_FN64_MIGRATE_INFO_UP_CPU ARM_PSCI_0_2_FN64(7) +/* PSCI 1.0 interface */ #define ARM_PSCI_1_0_FN_PSCI_FEATURES ARM_PSCI_0_2_FN(10)#define ARM_PSCI_1_0_FN_CPU_FREEZE ARM_PSCI_0_2_FN(11)
@@ -66,6 +75,12 @@#define ARM_PSCI_1_0_FN_STAT_RESIDENCY ARM_PSCI_0_2_FN(16)#define ARM_PSCI_1_0_FN_STAT_COUNT ARM_PSCI_0_2_FN(17) +#define ARM_PSCI_1_0_FN64_CPU_DEFAULT_SUSPEND ARM_PSCI_0_2_FN64(12) +#define ARM_PSCI_1_0_FN64_NODE_HW_STATE ARM_PSCI_0_2_FN64(13) +#define ARM_PSCI_1_0_FN64_SYSTEM_SUSPEND ARM_PSCI_0_2_FN64(14) +#define ARM_PSCI_1_0_FN64_STAT_RESIDENCY ARM_PSCI_0_2_FN64(16) +#define ARM_PSCI_1_0_FN64_STAT_COUNT ARM_PSCI_0_2_FN64(17) +/* 1KB stack per core */ #define ARM_PSCI_STACK_SHIFT 10#define ARM_PSCI_STACK_SIZE (1 << ARM_PSCI_STACK_SHIFT)
Signature · 1 line
2.1.4
PATCH v5 5/6 ARMv8: Setup PSCI memory and device tree
In reply to Hongbo ZhangNewly add ARMv8 PSCI needs to be initialized, be copied or reserved in right place, this patch does all the setup steps.
--- arch/arm/cpu/armv8/cpu-dt.c | 11 ++++++++++- arch/arm/cpu/armv8/cpu.c | 22 ++++++++++++++++++++++ arch/arm/include/asm/secure.h | 2 +- arch/arm/include/asm/system.h | 11 +++++++++++ arch/arm/lib/bootm-fdt.c | 3 ++- arch/arm/lib/bootm.c | 3 +++ arch/arm/lib/psci-dt.c | 5 +++-- 7 files changed, 52 insertions(+), 5 deletions(-)
arch/arm/cpu/armv8/cpu-dt.c +10 -1
@@ -6,6 +6,7 @@#include <common.h> #include <asm/psci.h> +#include <asm/system.h> #ifdef CONFIG_ARMV8_SEC_FIRMWARE_SUPPORT #include <asm/armv8/sec_firmware.h> #endif
@@ -13,7 +14,8 @@int psci_update_dt (void *fdt) {#ifdef CONFIG_MP -#if defined(CONFIG_FSL_PPA_ARMV8_PSCI ) +#if defined(CONFIG_ARMV8_PSCI ) || defined(CONFIG_FSL_PPA_ARMV8_PSCI ) +#ifdef CONFIG_ARMV8_SEC_FIRMWARE_SUPPORT /* * If the PSCI in SEC Firmware didn't work, avoid to update the
@@ -25,6 +27,13 @@ int psci_update_dt(void *fdt)return 0 ;#endif fdt_psci (fdt); + +#if defined(CONFIG_ARMV8_PSCI ) && !defined(CONFIG_ARMV8_SECURE_BASE ) +/* secure code lives in RAM, keep it alive */ +fdt_add_mem_rsv (fdt, (unsigned long )__secure_start, + __secure_end - __secure_start); +#endif +#endif #endif return 0 ;
arch/arm/cpu/armv8/cpu.c +22 -0
@@ -14,6 +14,7 @@#include <common.h> #include <command.h> #include <asm/system.h> +#include <asm/secure.h> #include <linux/compiler.h> int cleanup_before_linux (void )
@@ -41,3 +42,24 @@ int cleanup_before_linux(void)return 0 ; } + +#ifdef CONFIG_ARMV8_PSCI +static void relocate_secure_section (void ) +{ +#ifdef CONFIG_ARMV8_SECURE_BASE +size_t sz = __secure_end - __secure_start; + +memcpy ((void *)CONFIG_ARMV8_SECURE_BASE , __secure_start, sz); +flush_dcache_range (CONFIG_ARMV8_SECURE_BASE , +CONFIG_ARMV8_SECURE_BASE + sz +1 ); +invalidate_icache_all (); +#endif +} + +void armv8_setup_psci (void ) +{ +relocate_secure_section (); +secure_ram_addr (psci_setup_vectors)(); +secure_ram_addr (psci_arch_init)(); +} +#endif
arch/arm/include/asm/secure.h +1 -1
@@ -6,7 +6,7 @@#define __secure __attribute__ ((section ("._secure.text")))#define __secure_data __attribute__ ((section ("._secure.data"))) -#ifdef CONFIG_ARMV7_SECURE_BASE +#if defined(CONFIG_ARMV7_SECURE_BASE ) || defined(CONFIG_ARMV8_SECURE_BASE )/* * Warning, horror ahead. *
arch/arm/include/asm/system.h +11 -0
@@ -237,6 +237,17 @@ void smc_call(struct pt_regs *args);void __noreturn psci_system_reset (void );void __noreturn psci_system_off (void ); +#ifdef CONFIG_ARMV8_PSCI +extern char __secure_start[]; +extern char __secure_end[]; +extern char __secure_stack_start[]; +extern char __secure_stack_end[]; + +void armv8_setup_psci (void ); +void psci_setup_vectors (void ); +void psci_arch_init (void ); +#endif +#endif /* __ASSEMBLY__ */ #else /* CONFIG_ARM64 */
arch/arm/lib/bootm-fdt.c +2 -1
@@ -52,7 +52,8 @@ int arch_fixup_fdt(void *blob)return ret;#endif -#if defined(CONFIG_ARMV7_NONSEC ) || defined(CONFIG_FSL_PPA_ARMV8_PSCI ) +#if defined(CONFIG_ARMV7_NONSEC ) || defined(CONFIG_ARMV8_PSCI ) || \ + defined(CONFIG_FSL_PPA_ARMV8_PSCI ) ret =psci_update_dt (blob);if (ret)return ret;
arch/arm/lib/bootm.c +3 -0
@@ -316,6 +316,9 @@ static void boot_jump_linux(bootm_headers_t *images, int flag)announce_and_cleanup (fake);if (!fake) { +#ifdef CONFIG_ARMV8_PSCI +armv8_setup_psci (); +#endif do_nonsec_virt_switch ();update_os_arch_secondary_cores (images->os.arch);
arch/arm/lib/psci-dt.c +3 -2
@@ -16,7 +16,8 @@int fdt_psci (void *fdt) { -#if defined(CONFIG_FSL_PPA_ARMV8_PSCI ) || defined(CONFIG_ARMV7_PSCI ) +#if defined(CONFIG_ARMV7_PSCI ) || defined(CONFIG_ARMV8_PSCI ) || \ + defined(CONFIG_FSL_PPA_ARMV8_PSCI )int nodeoff;unsigned int psci_ver =0 ;int tmp;
@@ -65,7 +66,7 @@ int fdt_psci(void *fdt) init_psci_node: #ifdef CONFIG_ARMV8_SEC_FIRMWARE_SUPPORT psci_ver =sec_firmware_support_psci_version (); -#elif defined(CONFIG_ARMV7_PSCI_1_0) +#elif defined(CONFIG_ARMV7_PSCI_1_0) || defined(CONFIG_ARMV8_PSCI) psci_ver =ARM_PSCI_VER_1_0 ;#endif switch (psci_ver) {
Signature · 1 line
2.1.4
PATCH v5 6/6 ARMv8: LS1043A: Enable LS1043A default PSCI support
In reply to Hongbo ZhangA most basic PSCI implementation with only one psci_version is added for LS1043A, this can verify the generic PSCI framework, and more platform specific implementation will be added later.
--- arch/arm/cpu/armv8/fsl-layerscape/Makefile | 1 + arch/arm/cpu/armv8/fsl-layerscape/ls1043a_psci.S | 20 ++++++++++++++++++++ board/freescale/ls1043ardb/Kconfig | 9 +++++++++ 3 files changed, 30 insertions(+) create mode 100644 arch/arm/cpu/armv8/fsl-layerscape/ls1043a_psci.S
arch/arm/cpu/armv8/fsl-layerscape/Makefile +1 -0
@@ -28,6 +28,7 @@ endif ifneq ($(CONFIG_LS1043A),) obj-$(CONFIG_SYS_HAS_SERDES) += ls1043a_serdes.o +obj-$(CONFIG_ARMV8_PSCI) += ls1043a_psci.o endif ifneq ($(CONFIG_ARCH_LS1012A),)
arch/arm/cpu/armv8/fsl-layerscape/ls1043a_psci.S new file +20 -0
@@ -0,0 +1,20 @@ +/* + * Copyright 2016 Freescale Semiconductor, Inc. + * Author: Hongbo Zhang <[email protected]> + * + * SPDX-License-Identifier: GPL-2.0+ + * This file implements LS102X platform PSCI SYSTEM-SUSPEND function + */ + +#include <config.h> +#include <linux/linkage.h> +#include <asm/psci.h> + + .pushsection ._secure.text, "ax" + +.globl psci_version +psci_version: + ldr w0, =0x00010000 /* PSCI v1.0 */ + ret + + .popsection
board/freescale/ls1043ardb/Kconfig +9 -0
@@ -13,4 +13,13 @@ config SYS_SOC config SYS_CONFIG_NAME default "ls1043ardb" +config SYS_HAS_ARMV8_SECURE_BASE + bool "Enable secure address for PSCI image" + depends on ARMV8_PSCI + default n + help + PSCI image can be re-located to secure RAM. + If enabled, please also define the value for ARMV8_SECURE_BASE, + for LS1043ARDB, it could be some address in OCRAM. + endif
Signature · 1 line
2.1.4
york sun
Appliedv5 cover Add ARMv8 PSCI framework
In reply to Hongbo ZhangQuoted 4 lines · Hongbo Zhang
v4-v5 changes:
- rebased to latest u-boot version to ease conflict.
- added mutually exclusive fromFSL_PPA.
Applied to fsl-qoriq master, awaiting upstream. Thanks.
York