Commit aa5b843f authored by danh-arm's avatar danh-arm Committed by GitHub
Browse files

Merge pull request #1007 from soby-mathew/sm/ccint

Enable integration of ARM TrustZone Cryptocell for TBB
parents 1979ee13 f143cafe
...@@ -17,6 +17,7 @@ BL2_SOURCES += plat/arm/board/common/drivers/norflash/norflash.c ...@@ -17,6 +17,7 @@ BL2_SOURCES += plat/arm/board/common/drivers/norflash/norflash.c
#BL31_SOURCES += #BL31_SOURCES +=
ifneq (${TRUSTED_BOARD_BOOT},0) ifneq (${TRUSTED_BOARD_BOOT},0)
ifneq (${ARM_CRYPTOCELL_INTEG}, 1)
# ROTPK hash location # ROTPK hash location
ifeq (${ARM_ROTPK_LOCATION}, regs) ifeq (${ARM_ROTPK_LOCATION}, regs)
ARM_ROTPK_LOCATION_ID = ARM_ROTPK_REGS_ID ARM_ROTPK_LOCATION_ID = ARM_ROTPK_REGS_ID
...@@ -31,7 +32,12 @@ ifneq (${TRUSTED_BOARD_BOOT},0) ...@@ -31,7 +32,12 @@ ifneq (${TRUSTED_BOARD_BOOT},0)
# ARM development platforms # ARM development platforms
TFW_NVCTR_VAL ?= 31 TFW_NVCTR_VAL ?= 31
NTFW_NVCTR_VAL ?= 223 NTFW_NVCTR_VAL ?= 223
else
# Certificate NV-Counters when CryptoCell is integrated. For development
# platforms we set the counter to first valid value.
TFW_NVCTR_VAL ?= 0
NTFW_NVCTR_VAL ?= 0
endif
BL1_SOURCES += plat/arm/board/common/board_arm_trusted_boot.c BL1_SOURCES += plat/arm/board/common/board_arm_trusted_boot.c
BL2_SOURCES += plat/arm/board/common/board_arm_trusted_boot.c BL2_SOURCES += plat/arm/board/common/board_arm_trusted_boot.c
endif endif
......
...@@ -26,6 +26,9 @@ ...@@ -26,6 +26,9 @@
#define PLATFORM_CORE_COUNT (JUNO_CLUSTER0_CORE_COUNT + \ #define PLATFORM_CORE_COUNT (JUNO_CLUSTER0_CORE_COUNT + \
JUNO_CLUSTER1_CORE_COUNT) JUNO_CLUSTER1_CORE_COUNT)
/* Cryptocell HW Base address */
#define PLAT_CRYPTOCELL_BASE 0x60050000
/* /*
* Other platform porting definitions are provided by included headers * Other platform porting definitions are provided by included headers
*/ */
......
...@@ -115,3 +115,51 @@ func arm_disable_spe ...@@ -115,3 +115,51 @@ func arm_disable_spe
ret ret
endfunc arm_disable_spe endfunc arm_disable_spe
#endif #endif
/*
* Need to use coherent stack when ARM Cryptocell is used to autheticate images
* since Cryptocell uses DMA to transfer data and it is not coherent with the
* AP CPU.
*/
#if ARM_CRYPTOCELL_INTEG
#if defined(IMAGE_BL1) || defined(IMAGE_BL2)
.globl plat_get_my_stack
.globl plat_set_my_stack
.local platform_coherent_stacks
/* -------------------------------------------------------
* uintptr_t plat_get_my_stack ()
*
* For cold-boot BL images, only the primary CPU needs a
* stack. This function returns the stack pointer for a
* stack allocated in coherent memory.
* -------------------------------------------------------
*/
func plat_get_my_stack
get_up_stack platform_coherent_stacks, PLATFORM_STACK_SIZE
ret
endfunc plat_get_my_stack
/* -------------------------------------------------------
* void plat_set_my_stack ()
*
* For cold-boot BL images, only the primary CPU needs a
* stack. This function sets the stack pointer to a stack
* allocated in coherent memory.
* -------------------------------------------------------
*/
func plat_set_my_stack
get_up_stack platform_coherent_stacks, PLATFORM_STACK_SIZE
mov sp, x0
ret
endfunc plat_set_my_stack
/* ----------------------------------------------------
* Single cpu stack in coherent memory.
* ----------------------------------------------------
*/
declare_stack platform_coherent_stacks, tzfw_coherent_mem, \
PLATFORM_STACK_SIZE, 1, CACHE_WRITEBACK_GRANULE
#endif /* defined(IMAGE_BL1) || defined(IMAGE_BL2) */
#endif /* ARM_CRYPTOCELL_INTEG */
...@@ -94,6 +94,11 @@ LOAD_IMAGE_V2 := 1 ...@@ -94,6 +94,11 @@ LOAD_IMAGE_V2 := 1
# Use generic OID definition (tbbr_oid.h) # Use generic OID definition (tbbr_oid.h)
USE_TBBR_DEFS := 1 USE_TBBR_DEFS := 1
# Disable ARM Cryptocell by default
ARM_CRYPTOCELL_INTEG := 0
$(eval $(call assert_boolean,ARM_CRYPTOCELL_INTEG))
$(eval $(call add_define,ARM_CRYPTOCELL_INTEG))
PLAT_INCLUDES += -Iinclude/common/tbbr \ PLAT_INCLUDES += -Iinclude/common/tbbr \
-Iinclude/plat/arm/common -Iinclude/plat/arm/common
...@@ -181,7 +186,11 @@ ifneq (${TRUSTED_BOARD_BOOT},0) ...@@ -181,7 +186,11 @@ ifneq (${TRUSTED_BOARD_BOOT},0)
TF_MBEDTLS_KEY_ALG := ${KEY_ALG} TF_MBEDTLS_KEY_ALG := ${KEY_ALG}
# We expect to locate the *.mk files under the directories specified below # We expect to locate the *.mk files under the directories specified below
ifeq (${ARM_CRYPTOCELL_INTEG},0)
CRYPTO_LIB_MK := drivers/auth/mbedtls/mbedtls_crypto.mk CRYPTO_LIB_MK := drivers/auth/mbedtls/mbedtls_crypto.mk
else
CRYPTO_LIB_MK := drivers/auth/cryptocell/cryptocell_crypto.mk
endif
IMG_PARSER_LIB_MK := drivers/auth/mbedtls/mbedtls_x509.mk IMG_PARSER_LIB_MK := drivers/auth/mbedtls/mbedtls_x509.mk
$(info Including ${CRYPTO_LIB_MK}) $(info Including ${CRYPTO_LIB_MK})
......
...@@ -34,6 +34,7 @@ void arm_tzc400_setup(void) ...@@ -34,6 +34,7 @@ void arm_tzc400_setup(void)
tzc400_disable_filters(); tzc400_disable_filters();
#ifndef EL3_PAYLOAD_BASE #ifndef EL3_PAYLOAD_BASE
/* Region 0 set to no access by default */ /* Region 0 set to no access by default */
tzc400_configure_region0(TZC_REGION_S_NONE, 0); tzc400_configure_region0(TZC_REGION_S_NONE, 0);
...@@ -47,13 +48,13 @@ void arm_tzc400_setup(void) ...@@ -47,13 +48,13 @@ void arm_tzc400_setup(void)
* Apply the same configuration to given filters in the TZC. */ * Apply the same configuration to given filters in the TZC. */
tzc400_configure_region(PLAT_ARM_TZC_FILTERS, 2, tzc400_configure_region(PLAT_ARM_TZC_FILTERS, 2,
ARM_NS_DRAM1_BASE, ARM_NS_DRAM1_END, ARM_NS_DRAM1_BASE, ARM_NS_DRAM1_END,
TZC_REGION_S_NONE, ARM_TZC_NS_DRAM_S_ACCESS,
PLAT_ARM_TZC_NS_DEV_ACCESS); PLAT_ARM_TZC_NS_DEV_ACCESS);
/* Region 3 set to cover Non-Secure access to 2nd DRAM address range */ /* Region 3 set to cover Non-Secure access to 2nd DRAM address range */
tzc400_configure_region(PLAT_ARM_TZC_FILTERS, 3, tzc400_configure_region(PLAT_ARM_TZC_FILTERS, 3,
ARM_DRAM2_BASE, ARM_DRAM2_END, ARM_DRAM2_BASE, ARM_DRAM2_END,
TZC_REGION_S_NONE, ARM_TZC_NS_DRAM_S_ACCESS,
PLAT_ARM_TZC_NS_DEV_ACCESS); PLAT_ARM_TZC_NS_DEV_ACCESS);
#else #else
/* Allow secure access only to DRAM for EL3 payloads. */ /* Allow secure access only to DRAM for EL3 payloads. */
......
...@@ -41,14 +41,14 @@ void arm_tzc_dmc500_setup(tzc_dmc500_driver_data_t *plat_driver_data) ...@@ -41,14 +41,14 @@ void arm_tzc_dmc500_setup(tzc_dmc500_driver_data_t *plat_driver_data)
tzc_dmc500_configure_region(2, tzc_dmc500_configure_region(2,
ARM_NS_DRAM1_BASE, ARM_NS_DRAM1_BASE,
ARM_NS_DRAM1_END, ARM_NS_DRAM1_END,
TZC_REGION_S_NONE, ARM_TZC_NS_DRAM_S_ACCESS,
PLAT_ARM_TZC_NS_DEV_ACCESS); PLAT_ARM_TZC_NS_DEV_ACCESS);
/* Region 3 set to cover Non-Secure access to 2nd DRAM address range */ /* Region 3 set to cover Non-Secure access to 2nd DRAM address range */
tzc_dmc500_configure_region(3, tzc_dmc500_configure_region(3,
ARM_DRAM2_BASE, ARM_DRAM2_BASE,
ARM_DRAM2_END, ARM_DRAM2_END,
TZC_REGION_S_NONE, ARM_TZC_NS_DRAM_S_ACCESS,
PLAT_ARM_TZC_NS_DEV_ACCESS); PLAT_ARM_TZC_NS_DEV_ACCESS);
#else #else
/* Allow secure access only to DRAM for EL3 payloads */ /* Allow secure access only to DRAM for EL3 payloads */
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment