[U-Boot] [PATCH 00/15] ARM: PSCI: Add secure stack and data sections

Chen-Yu Tsai wens at csie.org
Sun Jun 19 06:38:30 CEST 2016


Hi everyone,

This is ARM PSCI improvements part 2. This series cleans up PSCI stack
allocation and target PC storage by introducing a secure stack section
and a secure data section.

The series got larger than I planned. Some patches are just moving or
consolidating code, and a few are adding missing macros. It's based on
v3 of my "sunxi: PSCI implementation rewrite in C" series from earlier.


Patch 1 consolidates the stack setup code from all the PSCI-enabled
platforms (which likely originated from the initial sunxi version) into
a common function, and moves it into a seperate common function that
is called before psci_arch_init. A weak stub psci_arch_init is added
for platforms that no longer need a custom version.

Patch 2 converts the remaining sunxi PSCI assembly code into C.

Patch 3 adds the missing CONFIG_ARMV7_PSCI_NR_CPUS=2 for sun7i/A20.

Patch 4 makes the linker page align PSCI text only when it is directly
executed, i.e. not copied to CONFIG_ARMV7_SECURE_BASE.

Patch 5 adds a fallback value for CONFIG_ARMV7_PSCI_NR_CPUS. The value
is 4, which was the fixed maximum number of stacks allocated.

Patch 6 adds an empty stack section for the secure monitor.

Patch 7 has PSCI allocate its stack in the new secure stack section.

Patch 8 removes the now unused psci_text_end symbol. This was previously
used to find where to allocate the stack.

Patch 9 adds a config variable for specifying the maximum size of the
secure section (text, data, stack, etc.) and checks if the binary
exceeds it.

Patch 10 defines CONFIG_ARMV7_SECURE_MAX_SIZE for sun6i/sun7i (A31/A20),
Allwinner SoCs that have a block of secure SRAM.

Patch 11 moves the __secure macro to asm/secure.h. Previously sunxi and
i.MX7 were defining it themselves.

Patch 12 adds a secure data section, and a __secure_data macro.

Patch 13 adds helper functions to save and get per-CPU target PC addresses
for use in PSCI.

Patch 14 converts all PSCI-enabled platforms to the new helper functions
to save/get target PC addresses.

Patch 15 makes the psci_get_cpu_stack_top function local/static. This
function should only be used by the stack setup routine.


Regards
ChenYu


Chen-Yu Tsai (15):
  ARM: PSCI: Split out common stack setup code from psci_arch_init
  sunxi: Move remaining PSCI assembly code to C
  sunxi: Add missing CONFIG_ARMV7_PSCI_NR_CPUS for sun7i
  ARM: Page align secure section only when it is executed in situ
  ARM: PSCI: Add fallback value for CONFIG_ARMV7_PSCI_NR_CPUS
  ARM: Add an empty secure stack section
  ARM: PSCI: Allocate PSCI stack in secure stack section
  ARM: PSCI: Remove unused psci_text_end symbol
  ARM: Add CONFIG_ARMV7_SECURE_MAX_SIZE and check size of secure section
  sunxi: Define CONFIG_ARMV7_SECURE_MAX_SIZE for sun6i/sun7i
  ARM: Move __secure definition to common asm/secure.h
  ARM: Add secure section for initialized data
  ARM: PSCI: Add helper functions to access per-CPU target PC storage
  ARM: PSCI: Switch to per-CPU target PC storage in secure data section
  ARM: PSCI: Make psci_get_cpu_stack_top local to armv7/psci.S

 arch/arm/cpu/armv7/Makefile          |  1 +
 arch/arm/cpu/armv7/ls102xa/psci.S    | 26 ++++----------
 arch/arm/cpu/armv7/mx7/psci-mx7.c    |  2 +-
 arch/arm/cpu/armv7/mx7/psci.S        | 31 +++++------------
 arch/arm/cpu/armv7/nonsec_virt.S     |  7 +++-
 arch/arm/cpu/armv7/psci-common.c     | 39 +++++++++++++++++++++
 arch/arm/cpu/armv7/psci.S            | 55 ++++++++++++++++++++++--------
 arch/arm/cpu/armv7/sunxi/Makefile    |  1 -
 arch/arm/cpu/armv7/sunxi/psci.c      |  9 +++--
 arch/arm/cpu/armv7/sunxi/psci_head.S | 66 ------------------------------------
 arch/arm/cpu/u-boot.lds              | 60 +++++++++++++++++++++++++-------
 arch/arm/include/asm/armv7.h         |  2 ++
 arch/arm/include/asm/config.h        |  5 +++
 arch/arm/include/asm/psci.h          |  9 ++++-
 arch/arm/include/asm/secure.h        |  3 ++
 arch/arm/lib/sections.c              |  2 ++
 arch/arm/mach-tegra/psci.S           | 16 ++++-----
 include/configs/sun6i.h              |  1 +
 include/configs/sun7i.h              |  2 ++
 19 files changed, 183 insertions(+), 154 deletions(-)
 create mode 100644 arch/arm/cpu/armv7/psci-common.c
 delete mode 100644 arch/arm/cpu/armv7/sunxi/psci_head.S

-- 
2.8.1



More information about the U-Boot mailing list