AM43xx OP-TEE support
Subsystems (3)
cover AM43xx OP-TEE support
Hello all,
This series brings our firewall and OP-TEE support from DRA7xx/AM57xx family devices to the AM43xx class devices. We do this by factoring out code common code from omap5/ into common mach-omap2/ sources. Then add the hooks for the AM43xx boards.
Thanks,
Andrew
Andrew F. Davis (6):
arm: mach-omap2: Move omap5/sec-fxns.c into sec-common.c
arm: mach-omap2: Factor out common FDT fixup suport
arm: mach-omap2: fdt-common: Add OP-TEE node when firmware node is
defined
arm: mach-omap2: am33xx: Add FDT fixup suport for AM33xx/AM43xx boards
board: ti: am43xx: Add TEE loading and firewall setup
board: ti: am43xx: Add FDT fixup for HS devices
arch/arm/include/asm/omap_common.h | 5 +
arch/arm/include/asm/omap_sec_common.h | 6 +
arch/arm/mach-omap2/Kconfig | 26 ++++
arch/arm/mach-omap2/Makefile | 2 +
arch/arm/mach-omap2/am33xx/Makefile | 1 +
arch/arm/mach-omap2/am33xx/fdt.c | 43 ++++++
arch/arm/mach-omap2/fdt-common.c | 168 +++++++++++++++++++++
arch/arm/mach-omap2/omap5/Kconfig | 26 ----
arch/arm/mach-omap2/omap5/Makefile | 1 -
arch/arm/mach-omap2/omap5/fdt.c | 119 ---------------
.../mach-omap2/{omap5/sec-fxns.c => sec-common.c} | 157 ++++++++++++++++++-
board/ti/am43xx/board.c | 16 ++
configs/am43xx_hs_evm_defconfig | 4 +
13 files changed, 420 insertions(+), 154 deletions(-)
create mode 100644 arch/arm/mach-omap2/am33xx/fdt.c
create mode 100644 arch/arm/mach-omap2/fdt-common.c
rename arch/arm/mach-omap2/{omap5/sec-fxns.c => sec-common.c} (64%)Signature · 1 line
2.13.0
PATCH 1/6 arm: mach-omap2: Move omap5/sec-fxns.c into sec-common.c
TEE loading and firewall setup are common to all omap2 devices, move these function out of omap5 and into mach-omap2. This allows us to use these functions from other omap class devices.
---
arch/arm/mach-omap2/Kconfig | 26 ++++
arch/arm/mach-omap2/omap5/Kconfig | 26 ----
arch/arm/mach-omap2/omap5/Makefile | 1 -
.../mach-omap2/{omap5/sec-fxns.c => sec-common.c} | 155 ++++++++++++++++++++-
4 files changed, 174 insertions(+), 34 deletions(-)
rename arch/arm/mach-omap2/{omap5/sec-fxns.c => sec-common.c} (64%)arch/arm/mach-omap2/Kconfig +26 -0
@@ -119,6 +119,32 @@ config TI_SECURE_DEVICE authenticated) and the code. See the doc/README.ti-secure file for further details. +config TI_SECURE_EMIF_REGION_START + hex "Reserved EMIF region start address" + depends on TI_SECURE_DEVICE + default 0x0 + help + Reserved EMIF region start address. Set to "0" to auto-select + to be at the end of the external memory region. + +config TI_SECURE_EMIF_TOTAL_REGION_SIZE + hex "Reserved EMIF region size" + depends on TI_SECURE_DEVICE + default 0x0 + help + Total reserved EMIF region size. Default is 0, which means no reserved EMIF + region on secure devices. + +config TI_SECURE_EMIF_PROTECTED_REGION_SIZE + hex "Size of protected region within reserved EMIF region" + depends on TI_SECURE_DEVICE + default 0x0 + help + This config option is used to specify the size of the portion of the total + reserved EMIF region set aside for secure OS needs that will be protected + using hardware memory firewalls. This value must be smaller than the + TI_SECURE_EMIF_TOTAL_REGION_SIZE value. + source "arch/arm/mach-omap2/omap3/Kconfig" source "arch/arm/mach-omap2/omap4/Kconfig"
arch/arm/mach-omap2/omap5/Kconfig +0 -26
@@ -37,32 +37,6 @@ endchoice config SYS_SOC default "omap5" -config TI_SECURE_EMIF_REGION_START - hex "Reserved EMIF region start address" - depends on TI_SECURE_DEVICE - default 0x0 - help - Reserved EMIF region start address. Set to "0" to auto-select - to be at the end of the external memory region. - -config TI_SECURE_EMIF_TOTAL_REGION_SIZE - hex "Reserved EMIF region size" - depends on TI_SECURE_DEVICE - default 0x0 - help - Total reserved EMIF region size. Default is 0, which means no reserved EMIF - region on secure devices. - -config TI_SECURE_EMIF_PROTECTED_REGION_SIZE - hex "Size of protected region within reserved EMIF region" - depends on TI_SECURE_DEVICE - default 0x0 - help - This config option is used to specify the size of the portion of the total - reserved EMIF region set aside for secure OS needs that will be protected - using hardware memory firewalls. This value must be smaller than the - TI_SECURE_EMIF_TOTAL_REGION_SIZE value. - config OMAP_PLATFORM_RESET_TIME_MAX_USEC int "Something" range 0 31219
arch/arm/mach-omap2/omap5/Makefile +0 -1
@@ -14,5 +14,4 @@ obj-y += hw_data.o obj-y += abb.o obj-y += fdt.o obj-$(CONFIG_IODELAY_RECALIBRATION) += dra7xx_iodelay.o -obj-$(CONFIG_TI_SECURE_DEVICE) += sec-fxns.o obj-$(CONFIG_DRA7XX) += sec_entry_cpu1.o
arch/arm/mach-omap2/sec-common.c renamed from arch/arm/mach-omap2/omap5/sec-fxns.c +148 -7
208 lines not on this page · raw message
Signature · 1 line
2.13.0
PATCH 1/6 arm: mach-omap2: Move omap5/sec-fxns.c into sec-common.c
Quoted 5 lines · Andrew F. Davis
TEE loading and firewall setup are common to all omap2 devices, move these function out of omap5 and into mach-omap2. This allows us to use these functions from other omap class devices.
Signed-off-by Andrew F. Davis <[email protected]>
Thanks and regards,
Lokesh
PATCH 1/6 arm: mach-omap2: Move omap5/sec-fxns.c into sec-common.c
In reply to Andrew F. DavisQuoted 5 lines · Andrew F. Davis
TEE loading and firewall setup are common to all omap2 devices, move these function out of omap5 and into mach-omap2. This allows us to use these functions from other omap class devices.
Signed-off-by Andrew F. Davis <[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/20170619/e21a594e/attachment.sig>
PATCH 2/6 arm: mach-omap2: Factor out common FDT fixup suport
In reply to Andrew F. DavisSome of the fixups currently done for OMAP5 class boards are common to other OMAP family devices, move these to fdt-common.c.
--- arch/arm/include/asm/omap_common.h | 5 ++ arch/arm/include/asm/omap_sec_common.h | 6 ++ arch/arm/mach-omap2/Makefile | 2 + arch/arm/mach-omap2/fdt-common.c | 160 +++++++++++++++++++++++++++++++++ arch/arm/mach-omap2/omap5/fdt.c | 119 ------------------------ arch/arm/mach-omap2/sec-common.c | 2 +- 6 files changed, 174 insertions(+), 120 deletions(-) create mode 100644 arch/arm/mach-omap2/fdt-common.c
arch/arm/include/asm/omap_common.h +5 -0
@@ -680,6 +680,11 @@ void omap_die_id(unsigned int *die_id);/* Initialize general purpose I2C(0) on the SoC */ void gpi2c_init (void ); +/* Common FDT Fixups */ +int ft_hs_disable_rng (void *fdt,bd_t *bd); +int ft_hs_fixup_dram (void *fdt,bd_t *bd); +int ft_hs_add_tee (void *fdt,bd_t *bd); +/* ABB */ #define OMAP_ABB_NOMINAL_OPP 0#define OMAP_ABB_FAST_OPP 1
arch/arm/include/asm/omap_sec_common.h +6 -0
@@ -28,6 +28,12 @@ u32 secure_rom_call(u32 service, u32 proc_id, u32 flag, ...);int secure_boot_verify_image (void **p_image,size_t *p_size);/* +* Return the start of secure reserved RAM, if a default start address has +* not been configured then return a region at the end of the external DRAM. +*/ +u32 get_sec_mem_start (void ); + +/* * Invoke a secure HAL API that allows configuration of the external memory * firewall regions. */
arch/arm/mach-omap2/Makefile +2 -0
@@ -45,4 +45,6 @@ obj-y += lowlevel_init.o obj-y += mem-common.o +obj-y += fdt-common.o + obj-$(CONFIG_TI_SECURE_DEVICE) += sec-common.o
arch/arm/mach-omap2/fdt-common.c new file +160 -0
160 lines not on this page · raw message
arch/arm/mach-omap2/omap5/fdt.c +0 -119
131 lines not on this page · raw message
arch/arm/mach-omap2/sec-common.c +1 -1
@@ -176,7 +176,7 @@ auth_exit:return result; } -static u32 get_sec_mem_start (void ) +u32 get_sec_mem_start (void ) {u32 sec_mem_start =CONFIG_TI_SECURE_EMIF_REGION_START ;u32 sec_mem_size =CONFIG_TI_SECURE_EMIF_TOTAL_REGION_SIZE ;
Signature · 1 line
2.13.0
PATCH 2/6 arm: mach-omap2: Factor out common FDT fixup suport
Quoted 4 lines · Andrew F. Davis
Some of the fixups currently done for OMAP5 class boards are common to other OMAP family devices, move these to
fdt-common.c.Signed-off-by Andrew F. Davis <[email protected]>
Thanks and regards,
Lokesh
PATCH 2/6 arm: mach-omap2: Factor out common FDT fixup suport
In reply to Andrew F. DavisQuoted 4 lines · Andrew F. Davis
Some of the fixups currently done for OMAP5 class boards are common to other OMAP family devices, move these to
fdt-common.c.Signed-off-by Andrew F. Davis <[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/20170619/96e88a54/attachment.sig>
PATCH 3/6 arm: mach-omap2: fdt-common: Add OP-TEE node when firmware node is defined
In reply to Andrew F. DavisIf a firmware node is already present in the FDT we will fail to create one and so fail to add our OP-TEE node, make this fixup first check for a firmware node and then only try to add one if it is not found.
--- arch/arm/mach-omap2/fdt-common.c | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-)
arch/arm/mach-omap2/fdt-common.c +14 -6
@@ -134,14 +134,22 @@ int ft_hs_add_tee(void *fdt, bd_t *bd)if (!tee_loaded)return 0 ; - path ="/" ; + path ="/firmware" ; offs =fdt_path_offset (fdt, path); - - subpath ="firmware" ; - offs =fdt_add_subnode (fdt, offs, subpath);if (offs <0 ) { -printf ("Could not create %s node.\n" , subpath); -return 1 ; + path ="/" ; + offs =fdt_path_offset (fdt, path); +if (offs <0 ) { +printf ("Could not find root node.\n" ); +return 1 ; + } + + subpath ="firmware" ; + offs =fdt_add_subnode (fdt, offs, subpath); +if (offs <0 ) { +printf ("Could not create %s node.\n" , subpath); +return 1 ; + } } subpath ="optee" ;
Signature · 1 line
2.13.0
PATCH 3/6 arm: mach-omap2: fdt-common: Add OP-TEE node when firmware node is defined
Quoted 5 lines · Andrew F. Davis
If a firmware node is already present in the FDT we will fail to create one and so fail to add our OP-TEE node, make this fixup first check for a firmware node and then only try to add one if it is not found.
Signed-off-by Andrew F. Davis <[email protected]>
Thanks and regards,
Lokesh
PATCH 4/6 arm: mach-omap2: am33xx: Add FDT fixup suport for AM33xx/AM43xx boards
In reply to Andrew F. DavisSimilar to what is done with OMAP5 class boards we need to perform fixups common to this SoC class, add support for this here and add HS fixups.
--- arch/arm/mach-omap2/am33xx/Makefile | 1 + arch/arm/mach-omap2/am33xx/fdt.c | 43 +++++++++++++++++++++++++++++++++++++ 2 files changed, 44 insertions(+) create mode 100644 arch/arm/mach-omap2/am33xx/fdt.c
arch/arm/mach-omap2/am33xx/Makefile +1 -0
@@ -23,6 +23,7 @@ obj-y += board.o obj-y += mux.o obj-y += prcm-regs.o obj-y += hw_data.o +obj-y += fdt.o obj-$(CONFIG_CLOCK_SYNTHESIZER) += clk_synthesizer.o
arch/arm/mach-omap2/am33xx/fdt.c new file +43 -0
43 lines not on this page · raw message
Signature · 1 line
2.13.0
PATCH 4/6 arm: mach-omap2: am33xx: Add FDT fixup suport for AM33xx/AM43xx boards
Quoted 5 lines · Andrew F. Davis
Similar to what is done with OMAP5 class boards we need to perform fixups common to this SoC class, add support for this here and add HS fixups.
Signed-off-by Andrew F. Davis <[email protected]>
Thanks and regards,
Lokesh
PATCH 4/6 arm: mach-omap2: am33xx: Add FDT fixup suport for AM33xx/AM43xx boards
In reply to Andrew F. DavisQuoted 5 lines · Andrew F. Davis
Similar to what is done with OMAP5 class boards we need to perform fixups common to this SoC class, add support for this here and add HS fixups.
Signed-off-by Andrew F. Davis <[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/20170619/14ad4b8d/attachment.sig>
PATCH 5/6 board: ti: am43xx: Add TEE loading and firewall setup
In reply to Andrew F. DavisAdd support for loading a TEE and setting up firewalled regions to AM43xx HS boards.
--- board/ti/am43xx/board.c | 7 +++++++ configs/am43xx_hs_evm_defconfig | 3 +++ 2 files changed, 10 insertions(+)
board/ti/am43xx/board.c +7 -0
@@ -859,4 +859,11 @@ void board_fit_image_post_process(void **p_image, size_t *p_size) {secure_boot_verify_image (p_image, p_size); } + +void board_tee_image_process (ulong tee_image,size_t tee_size) +{ +secure_tee_install ((u32 )tee_image); +} + +U_BOOT_FIT_LOADABLE_HANDLER (IH_TYPE_TEE , board_tee_image_process);#endif
configs/am43xx_hs_evm_defconfig +3 -0
@@ -4,6 +4,9 @@ CONFIG_SYS_MALLOC_F_LEN=0x2000 CONFIG_AM43XX=y CONFIG_TI_COMMON_CMD_OPTIONS=y CONFIG_TI_SECURE_DEVICE=y +CONFIG_TI_SECURE_EMIF_REGION_START=0xbdb00000 +CONFIG_TI_SECURE_EMIF_TOTAL_REGION_SIZE=0x02000000 +CONFIG_TI_SECURE_EMIF_PROTECTED_REGION_SIZE=0x01c00000 CONFIG_TARGET_AM43XX_EVM=y CONFIG_ISW_ENTRY_ADDR=0x403018e0 CONFIG_SPL_STACK_R_ADDR=0x82000000
Signature · 1 line
2.13.0
PATCH 5/6 board: ti: am43xx: Add TEE loading and firewall setup
Quoted 30 lines · Andrew F. Davis
Add support for loading a TEE and setting up firewalled regions to AM43xx HS boards.
Signed-off-by Andrew F. Davis <[email protected]>--- board/ti/am43xx/board.c | 7 +++++++ configs/am43xx_hs_evm_defconfig | 3 +++ 2 files changed, 10 insertions(+)board/ti/am43xx/board.c +7
-0@@ -859,4 +859,11 @@ void board_fit_image_post_process(void **p_image, size_t *p_size) {secure_boot_verify_image (p_image, p_size); } + +void board_tee_image_process (ulong tee_image,size_t tee_size) +{ +secure_tee_install ((u32 )tee_image); +} + +U_BOOT_FIT_LOADABLE_HANDLER (IH_TYPE_TEE , board_tee_image_process);#endif configs/am43xx_hs_evm_defconfig +0
-0
configs/am43xx_hs_evm_defconfig CONFIG_SYS_MALLOC_F_LEN=0x2000 · line 7
Quoted 4 lines
configs/am43xx_hs_evm_defconfig +1
-0@@ -4,6 +4,9 @@ CONFIG_SYS_MALLOC_F_LEN=0x2000 CONFIG_AM43XX=y CONFIG_TI_COMMON_CMD_OPTIONS=y CONFIG_TI_SECURE_DEVICE=y +CONFIG_TI_SECURE_EMIF_REGION_START=0xbdb00000
You might want to include CONFIG_PRAM inorder to not overlap relocation with this region?
Thanks and regards,
Lokesh
Quoted 6 lines
configs/am43xx_hs_evm_defconfig +2
-0+CONFIG_TI_SECURE_EMIF_TOTAL_REGION_SIZE=0x02000000 +CONFIG_TI_SECURE_EMIF_PROTECTED_REGION_SIZE=0x01c00000 CONFIG_TARGET_AM43XX_EVM=y CONFIG_ISW_ENTRY_ADDR=0x403018e0 CONFIG_SPL_STACK_R_ADDR=0x82000000
PATCH 5/6 board: ti: am43xx: Add TEE loading and firewall setup
Quoted 32 lines · Lokesh Vutla
Quoted 29 lines · Andrew F. Davis
Add support for loading a TEE and setting up firewalled regions to AM43xx HS boards.
Signed-off-by Andrew F. Davis <[email protected]>--- board/ti/am43xx/board.c | 7 +++++++ configs/am43xx_hs_evm_defconfig | 3 +++ 2 files changed, 10 insertions(+)board/ti/am43xx/board.c +7
-0@@ -859,4 +859,11 @@ void board_fit_image_post_process(void **p_image, size_t *p_size) {secure_boot_verify_image (p_image, p_size); } + +void board_tee_image_process (ulong tee_image,size_t tee_size) +{ +secure_tee_install ((u32 )tee_image); +} + +U_BOOT_FIT_LOADABLE_HANDLER (IH_TYPE_TEE , board_tee_image_process);#endif configs/am43xx_hs_evm_defconfig +0
-0
Quoted 9 lines
configs/am43xx_hs_evm_defconfig CONFIG_SYS_MALLOC_F_LEN=0x2000 · line 7
Quoted 5 lines
configs/am43xx_hs_evm_defconfig +1
-0@@ -4,6 +4,9 @@ CONFIG_SYS_MALLOC_F_LEN=0x2000 CONFIG_AM43XX=y CONFIG_TI_COMMON_CMD_OPTIONS=y CONFIG_TI_SECURE_DEVICE=y +CONFIG_TI_SECURE_EMIF_REGION_START=0xbdb00000You might want to include
CONFIG_PRAMinorder to not overlap relocation with this region?
I think I'll add this in a separate patch, I'm still not sure that is the best solution to avoid relocation overlap just yet.
Thanks,
Andrew
Quoted 9 lines
Thanks and regards,
LokeshQuoted 6 lines
configs/am43xx_hs_evm_defconfig +2
-0+CONFIG_TI_SECURE_EMIF_TOTAL_REGION_SIZE=0x02000000 +CONFIG_TI_SECURE_EMIF_PROTECTED_REGION_SIZE=0x01c00000 CONFIG_TARGET_AM43XX_EVM=y CONFIG_ISW_ENTRY_ADDR=0x403018e0 CONFIG_SPL_STACK_R_ADDR=0x82000000
PATCH 6/6 board: ti: am43xx: Add FDT fixup for HS devices
In reply to Andrew F. DavisDisable RNG and add TEE to FDT used on HS devices.
--- board/ti/am43xx/board.c | 9 +++++++++ configs/am43xx_hs_evm_defconfig | 1 + 2 files changed, 10 insertions(+)
board/ti/am43xx/board.c +9 -0
@@ -838,6 +838,15 @@ int board_eth_init(bd_t *bis) }#endif +#if defined(CONFIG_OF_LIBFDT ) && defined(CONFIG_OF_BOARD_SETUP ) +int ft_board_setup (void *blob,bd_t *bd) +{ +ft_cpu_setup (blob, bd); + +return 0 ; +} +#endif +#ifdef CONFIG_SPL_LOAD_FIT int board_fit_config_name_match (const char *name) {
configs/am43xx_hs_evm_defconfig +1 -0
@@ -12,6 +12,7 @@ CONFIG_ISW_ENTRY_ADDR=0x403018e0 CONFIG_SPL_STACK_R_ADDR=0x82000000 CONFIG_DEFAULT_DEVICE_TREE="am437x-gp-evm" CONFIG_FIT_IMAGE_POST_PROCESS=y +CONFIG_OF_BOARD_SETUP=y CONFIG_SPL_LOAD_FIT=y CONFIG_SPL_FIT_IMAGE_POST_PROCESS=y CONFIG_SYS_EXTRA_OPTIONS="CONS_INDEX=1,NAND"
Signature · 1 line
2.13.0
PATCH 6/6 board: ti: am43xx: Add FDT fixup for HS devices
Quoted 3 lines · Andrew F. Davis
Disable RNG and add TEE to FDT used on HS devices.
Signed-off-by Andrew F. Davis <[email protected]>
Thanks and regards,
Lokesh
PATCH 6/6 board: ti: am43xx: Add FDT fixup for HS devices
In reply to Andrew F. DavisQuoted 3 lines · Andrew F. Davis
Disable RNG and add TEE to FDT used on HS devices.
Signed-off-by Andrew F. Davis <[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/20170619/d9f588a0/attachment.sig>