Merge pull request #1863 from thloh85-intel/mmc_fixes
authorDimitris Papastamos <dimitris.papastamos@arm.com>
Fri, 8 Mar 2019 09:41:22 +0000 (09:41 +0000)
committerGitHub <noreply@github.com>
Fri, 8 Mar 2019 09:41:22 +0000 (09:41 +0000)
drivers: mmc: Fix some issues with MMC stack

214 files changed:
Makefile
bl1/aarch32/bl1_entrypoint.S
bl1/aarch64/bl1_entrypoint.S
bl1/bl1.mk
bl1/bl1_main.c
bl2/aarch32/bl2_el3_entrypoint.S
bl2/aarch32/bl2_entrypoint.S
bl2/aarch64/bl2_el3_entrypoint.S
bl2/aarch64/bl2_entrypoint.S
bl2/bl2.mk
bl2/bl2_main.c
bl31/aarch64/bl31_entrypoint.S
bl31/aarch64/ea_delegate.S
bl31/aarch64/runtime_exceptions.S
bl31/bl31.mk
bl31/bl31_main.c
bl31/ehf.c
bl32/tsp/aarch64/tsp_entrypoint.S
bl32/tsp/tsp.mk
bl32/tsp/tsp_main.c
common/bl_common.c
docs/arm-sip-service.rst
docs/cpu-specific-build-macros.rst
docs/exception-handling.rst
docs/firmware-design.rst
docs/frequently-asked-questions.rst [new file with mode: 0644]
docs/image-terminology.rst [new file with mode: 0644]
docs/interrupt-framework-design.rst
docs/plat/fvp_ve.rst [new file with mode: 0644]
docs/plat/nvidia-tegra.rst
docs/plat/stm32mp1.rst
docs/platform-interrupt-controller-API.rst
docs/porting-guide.rst
docs/psci-performance-juno.rst [new file with mode: 0644]
docs/ras.rst
docs/release-information.rst [new file with mode: 0644]
docs/sdei.rst
docs/security-center.rst [new file with mode: 0644]
docs/security-reporting.asc [new file with mode: 0644]
docs/security_advisories/security-advisory-tfv-1.rst [new file with mode: 0644]
docs/security_advisories/security-advisory-tfv-2.rst [new file with mode: 0644]
docs/security_advisories/security-advisory-tfv-3.rst [new file with mode: 0644]
docs/security_advisories/security-advisory-tfv-4.rst [new file with mode: 0644]
docs/security_advisories/security-advisory-tfv-5.rst [new file with mode: 0644]
docs/security_advisories/security-advisory-tfv-6.rst [new file with mode: 0644]
docs/security_advisories/security-advisory-tfv-7.rst [new file with mode: 0644]
docs/security_advisories/security-advisory-tfv-8.rst [new file with mode: 0644]
docs/user-guide.rst
drivers/arm/css/scpi/css_scpi.c
drivers/arm/gic/v2/gicv2_main.c
drivers/arm/pl011/aarch32/pl011_console.S
drivers/auth/mbedtls/mbedtls_common.c
drivers/renesas/rcar/pwrc/pwrc.c
drivers/rpi3/sdhost/rpi3_sdhost.c
drivers/st/clk/stm32mp1_clk.c
drivers/staging/renesas/rcar/ddr/ddr_b/boot_init_dram.c
drivers/staging/renesas/rcar/ddr/ddr_b/boot_init_dram_config.c
drivers/staging/renesas/rcar/ddr/ddr_b/boot_init_dram_regdef.h
drivers/staging/renesas/rcar/pfc/H3/pfc_init_h3_v1.c
drivers/staging/renesas/rcar/pfc/H3/pfc_init_h3_v2.c
drivers/staging/renesas/rcar/pfc/M3/pfc_init_m3.c
drivers/staging/renesas/rcar/pfc/M3N/pfc_init_m3n.c
drivers/staging/renesas/rcar/qos/M3/qos_init_m3_v30.c [new file with mode: 0644]
drivers/staging/renesas/rcar/qos/M3/qos_init_m3_v30.h [new file with mode: 0644]
drivers/staging/renesas/rcar/qos/qos.mk
drivers/staging/renesas/rcar/qos/qos_common.h
drivers/staging/renesas/rcar/qos/qos_init.c
fdts/fvp-ve-Cortex-A5x1.dts [new file with mode: 0644]
fdts/fvp-ve-Cortex-A7x1.dts [new file with mode: 0644]
fdts/stm32mp157a-dk1.dts
fdts/stm32mp157c-ed1.dts
include/arch/aarch32/arch.h
include/arch/aarch32/arch_helpers.h
include/arch/aarch32/asm_macros.S
include/arch/aarch32/el3_common_macros.S
include/arch/aarch64/arch.h
include/arch/aarch64/arch_features.h
include/arch/aarch64/arch_helpers.h
include/arch/aarch64/el3_common_macros.S
include/bl1/bl1.h
include/bl2/bl2.h
include/bl31/bl31.h
include/bl32/tsp/tsp.h
include/common/bl_common.h
include/drivers/rpi3/sdhost/rpi3_sdhost.h
include/drivers/st/stm32mp1_clk.h
include/drivers/st/stm32mp1_rcc.h
include/lib/cpus/aarch32/cortex_a57.h
include/lib/cpus/aarch64/cortex_a55.h
include/lib/cpus/aarch64/cortex_a57.h
include/lib/cpus/aarch64/cortex_a73.h
include/lib/cpus/aarch64/cortex_a76.h
include/lib/cpus/aarch64/cortex_ares.h [deleted file]
include/lib/cpus/aarch64/cortex_helios.h [deleted file]
include/lib/cpus/aarch64/neoverse_e1.h [new file with mode: 0644]
include/lib/cpus/aarch64/neoverse_n1.h [new file with mode: 0644]
include/lib/el3_runtime/aarch64/context.h
include/lib/el3_runtime/pubsub.h
include/lib/extensions/ras.h
include/lib/xlat_tables/xlat_tables_defs.h
include/plat/arm/board/common/board_css_def.h
include/plat/common/platform.h
lib/cpus/aarch32/cortex_a53.S
lib/cpus/aarch32/cortex_a57.S
lib/cpus/aarch32/cpu_helpers.S
lib/cpus/aarch64/cortex_a53.S
lib/cpus/aarch64/cortex_a55.S
lib/cpus/aarch64/cortex_a57.S
lib/cpus/aarch64/cortex_a73.S
lib/cpus/aarch64/cortex_a75.S
lib/cpus/aarch64/cortex_a76.S
lib/cpus/aarch64/cortex_ares.S [deleted file]
lib/cpus/aarch64/cortex_ares_pubsub.c [deleted file]
lib/cpus/aarch64/cortex_helios.S [deleted file]
lib/cpus/aarch64/cpu_helpers.S
lib/cpus/aarch64/neoverse_e1.S [new file with mode: 0644]
lib/cpus/aarch64/neoverse_n1.S [new file with mode: 0644]
lib/cpus/aarch64/neoverse_n1_pubsub.c [new file with mode: 0644]
lib/cpus/cpu-ops.mk
lib/el3_runtime/aarch64/context.S
lib/el3_runtime/aarch64/context_mgmt.c
lib/extensions/mpam/mpam.c
lib/xlat_tables/aarch32/nonlpae_tables.c [new file with mode: 0644]
lib/xlat_tables_v2/xlat_tables_core.c
maintainers.rst
make_helpers/armv7-a-cpus.mk
make_helpers/build_macros.mk
make_helpers/defaults.mk
plat/allwinner/common/include/sunxi_private.h
plat/allwinner/common/sunxi_bl31_setup.c
plat/allwinner/common/sunxi_common.c
plat/allwinner/common/sunxi_cpu_ops.c
plat/allwinner/common/sunxi_pm.c
plat/allwinner/common/sunxi_topology.c
plat/allwinner/sun50i_a64/sunxi_power.c
plat/arm/board/fvp/include/platform_def.h
plat/arm/board/fvp/platform.mk
plat/arm/board/fvp_ve/aarch32/fvp_ve_helpers.S [new file with mode: 0644]
plat/arm/board/fvp_ve/fdts/fvp_ve_tb_fw_config.dts [new file with mode: 0644]
plat/arm/board/fvp_ve/fvp_ve_bl1_setup.c [new file with mode: 0644]
plat/arm/board/fvp_ve/fvp_ve_bl2_setup.c [new file with mode: 0644]
plat/arm/board/fvp_ve/fvp_ve_common.c [new file with mode: 0644]
plat/arm/board/fvp_ve/fvp_ve_def.h [new file with mode: 0644]
plat/arm/board/fvp_ve/fvp_ve_pm.c [new file with mode: 0644]
plat/arm/board/fvp_ve/fvp_ve_private.h [new file with mode: 0644]
plat/arm/board/fvp_ve/fvp_ve_security.c [new file with mode: 0644]
plat/arm/board/fvp_ve/fvp_ve_topology.c [new file with mode: 0644]
plat/arm/board/fvp_ve/include/platform_def.h [new file with mode: 0644]
plat/arm/board/fvp_ve/platform.mk [new file with mode: 0644]
plat/arm/board/fvp_ve/sp_min/fvp_ve_sp_min_setup.c [new file with mode: 0644]
plat/arm/board/fvp_ve/sp_min/sp_min-fvp_ve.mk [new file with mode: 0644]
plat/arm/board/juno/platform.mk
plat/arm/board/n1sdp/aarch64/n1sdp_helper.S
plat/arm/board/n1sdp/include/platform_def.h
plat/arm/board/n1sdp/platform.mk
plat/arm/board/rde1edge/fdts/rde1edge_nt_fw_config.dts [new file with mode: 0644]
plat/arm/board/rde1edge/fdts/rde1edge_tb_fw_config.dts [new file with mode: 0644]
plat/arm/board/rde1edge/include/platform_def.h [new file with mode: 0644]
plat/arm/board/rde1edge/platform.mk [new file with mode: 0644]
plat/arm/board/rde1edge/rde1edge_plat.c [new file with mode: 0644]
plat/arm/board/rde1edge/rde1edge_security.c [new file with mode: 0644]
plat/arm/board/rdn1edge/fdts/rdn1edge_nt_fw_config.dts [new file with mode: 0644]
plat/arm/board/rdn1edge/fdts/rdn1edge_tb_fw_config.dts [new file with mode: 0644]
plat/arm/board/rdn1edge/include/platform_def.h [new file with mode: 0644]
plat/arm/board/rdn1edge/platform.mk [new file with mode: 0644]
plat/arm/board/rdn1edge/rdn1edge_plat.c [new file with mode: 0644]
plat/arm/board/rdn1edge/rdn1edge_security.c [new file with mode: 0644]
plat/arm/board/sgiclarka/fdts/sgiclarka_nt_fw_config.dts [deleted file]
plat/arm/board/sgiclarka/fdts/sgiclarka_tb_fw_config.dts [deleted file]
plat/arm/board/sgiclarka/include/platform_def.h [deleted file]
plat/arm/board/sgiclarka/platform.mk [deleted file]
plat/arm/board/sgiclarka/sgiclarka_plat.c [deleted file]
plat/arm/board/sgiclarka/sgiclarka_security.c [deleted file]
plat/arm/board/sgiclarkh/fdts/sgiclarkh_nt_fw_config.dts [deleted file]
plat/arm/board/sgiclarkh/fdts/sgiclarkh_tb_fw_config.dts [deleted file]
plat/arm/board/sgiclarkh/include/platform_def.h [deleted file]
plat/arm/board/sgiclarkh/platform.mk [deleted file]
plat/arm/board/sgiclarkh/sgiclarkh_plat.c [deleted file]
plat/arm/board/sgiclarkh/sgiclarkh_security.c [deleted file]
plat/arm/common/aarch64/arm_pauth.c [new file with mode: 0644]
plat/arm/common/arm_bl1_setup.c
plat/arm/common/arm_common.mk
plat/arm/common/arm_console.c
plat/arm/common/arm_dyn_cfg.c
plat/arm/common/sp_min/arm_sp_min_setup.c
plat/arm/css/sgi/aarch64/sgi_helper.S
plat/arm/css/sgi/include/sgi_variant.h
plat/arm/css/sgi/sgi_bl31_setup.c
plat/arm/css/sgi/sgi_topology.c
plat/common/aarch64/platform_mp_stack.S
plat/common/plat_bl_common.c
plat/imx/common/plat_imx8_gic.c
plat/imx/imx8m/imx8mq/imx8mq_bl31_setup.c
plat/imx/imx8m/imx8mq/include/platform_def.h
plat/intel/soc/stratix10/bl2_plat_setup.c
plat/intel/soc/stratix10/soc/s10_memory_controller.c
plat/nvidia/tegra/common/tegra_common.mk
plat/nvidia/tegra/common/tegra_io_storage.c [new file with mode: 0644]
plat/nvidia/tegra/include/platform_def.h
plat/nvidia/tegra/platform.mk
plat/nvidia/tegra/scat/bl31.scat [new file with mode: 0644]
plat/renesas/rcar/bl2_plat_setup.c
plat/renesas/rcar/include/rcar_def.h
plat/renesas/rcar/include/rcar_version.h
plat/renesas/rcar/platform.mk
plat/renesas/rcar/rcar_common.c [new file with mode: 0644]
plat/rpi3/rpi3_bl2_setup.c
plat/st/common/bl2_io_storage.c
plat/st/stm32mp1/bl2_plat_setup.c
plat/st/stm32mp1/stm32mp1_def.h
plat/st/stm32mp1/stm32mp1_security.c
readme.rst
services/arm_arch_svc/arm_arch_svc_setup.c
services/spd/trusty/generic-arm64-smcall.c

index 34f6890bba18c9164065a32cfcb4755f4d63277b..6386befd1aba3c252df493c1356501e2459ebd0f 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -184,6 +184,14 @@ TF_CFLAGS_aarch64  +=      -mgeneral-regs-only -mstrict-align
 ASFLAGS_aarch32                =       $(march32-directive)
 ASFLAGS_aarch64                =       -march=armv8-a
 
+# Set the compiler to ARMv8.3 mode so that it uses all the ARMv8.3-PAuth
+# instructions. Keeping it in 8.0 would make the compiler emit
+# backwards-compatible hint instructions, which needs more space.
+ifeq (${ENABLE_PAUTH},1)
+TF_CFLAGS_aarch64      +=      -march=armv8.3-a
+ASFLAGS_aarch64                +=      -march=armv8.3-a
+endif
+
 WARNING1 := -Wextra
 WARNING1 += -Wunused -Wno-unused-parameter
 WARNING1 += -Wmissing-declarations
@@ -237,8 +245,13 @@ TF_CFLAGS          +=      $(CPPFLAGS) $(TF_CFLAGS_$(ARCH))                \
 
 GCC_V_OUTPUT           :=      $(shell $(CC) -v 2>&1)
 
+ifneq ($(findstring armlink,$(notdir $(LD))),)
+TF_LDFLAGS             +=      --diag_error=warning --lto_level=O1
+TF_LDFLAGS             +=      --remove --info=unused,unusedsymbols
+else
 TF_LDFLAGS             +=      --fatal-warnings -O1
 TF_LDFLAGS             +=      --gc-sections
+endif
 TF_LDFLAGS             +=      $(TF_LDFLAGS_$(ARCH))
 
 DTC_FLAGS              +=      -I dts -O dtb
@@ -459,6 +472,15 @@ ifeq ($(DYN_DISABLE_AUTH), 1)
     endif
 endif
 
+# If pointer authentication is used in the firmware, make sure that all the
+# registers associated to it are also saved and restored. Not doing it would
+# leak the value of the key used by EL3 to EL1 and S-EL1.
+ifeq ($(ENABLE_PAUTH),1)
+    ifeq ($(CTX_INCLUDE_PAUTH_REGS),0)
+        $(error ENABLE_PAUTH=1 requires CTX_INCLUDE_PAUTH_REGS=1)
+    endif
+endif
+
 ################################################################################
 # Process platform overrideable behaviour
 ################################################################################
@@ -580,12 +602,14 @@ $(eval $(call assert_boolean,COLD_BOOT_SINGLE_CPU))
 $(eval $(call assert_boolean,CREATE_KEYS))
 $(eval $(call assert_boolean,CTX_INCLUDE_AARCH32_REGS))
 $(eval $(call assert_boolean,CTX_INCLUDE_FPREGS))
+$(eval $(call assert_boolean,CTX_INCLUDE_PAUTH_REGS))
 $(eval $(call assert_boolean,DEBUG))
 $(eval $(call assert_boolean,DYN_DISABLE_AUTH))
 $(eval $(call assert_boolean,EL3_EXCEPTION_HANDLING))
 $(eval $(call assert_boolean,ENABLE_AMU))
 $(eval $(call assert_boolean,ENABLE_ASSERTIONS))
 $(eval $(call assert_boolean,ENABLE_MPAM_FOR_LOWER_ELS))
+$(eval $(call assert_boolean,ENABLE_PAUTH))
 $(eval $(call assert_boolean,ENABLE_PIE))
 $(eval $(call assert_boolean,ENABLE_PMF))
 $(eval $(call assert_boolean,ENABLE_PSCI_STAT))
@@ -633,10 +657,12 @@ $(eval $(call add_define,ARM_ARCH_MINOR))
 $(eval $(call add_define,COLD_BOOT_SINGLE_CPU))
 $(eval $(call add_define,CTX_INCLUDE_AARCH32_REGS))
 $(eval $(call add_define,CTX_INCLUDE_FPREGS))
+$(eval $(call add_define,CTX_INCLUDE_PAUTH_REGS))
 $(eval $(call add_define,EL3_EXCEPTION_HANDLING))
 $(eval $(call add_define,ENABLE_AMU))
 $(eval $(call add_define,ENABLE_ASSERTIONS))
 $(eval $(call add_define,ENABLE_MPAM_FOR_LOWER_ELS))
+$(eval $(call add_define,ENABLE_PAUTH))
 $(eval $(call add_define,ENABLE_PIE))
 $(eval $(call add_define,ENABLE_PMF))
 $(eval $(call add_define,ENABLE_PSCI_STAT))
@@ -693,6 +719,10 @@ ifeq (${DYN_DISABLE_AUTH},1)
 $(eval $(call add_define,DYN_DISABLE_AUTH))
 endif
 
+ifneq ($(findstring armlink,$(notdir $(LD))),)
+$(eval $(call add_define,USE_ARM_LINK))
+endif
+
 ################################################################################
 # Build targets
 ################################################################################
@@ -707,8 +737,12 @@ msg_start:
 
 # Check if deprecated declarations and cpp warnings should be treated as error or not.
 ifeq (${ERROR_DEPRECATED},0)
+ifneq ($(findstring clang,$(notdir $(CC))),)
+    CPPFLAGS           +=      -Wno-error=deprecated-declarations
+else
     CPPFLAGS           +=      -Wno-error=deprecated-declarations -Wno-error=cpp
 endif
+endif
 
 $(eval $(call MAKE_LIB_DIRS))
 $(eval $(call MAKE_LIB,c))
index 3f0cbaf4be9f244a156b8fd382c040d4cfe7652f..6a155660b6b3c6e740539f3e4e2a38229f575a2c 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016-2018, ARM Limited and Contributors. All rights reserved.
+ * Copyright (c) 2016-2019, ARM Limited and Contributors. All rights reserved.
  *
  * SPDX-License-Identifier: BSD-3-Clause
  */
@@ -52,12 +52,10 @@ func bl1_entrypoint
                _exception_vectors=bl1_vector_table
 
        /* -----------------------------------------------------
-        * Perform early platform setup & platform
-        * specific early arch. setup e.g. mmu setup
+        * Perform BL1 setup
         * -----------------------------------------------------
         */
-       bl      bl1_early_platform_setup
-       bl      bl1_plat_arch_setup
+       bl      bl1_setup
 
        /* -----------------------------------------------------
         * Jump to main function.
index f7e02e974073400be00647d2cf369ea4fa5b6ea4..0f8d5aaca858a9f1ce250fc47d6a813171751fd5 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013-2017, ARM Limited and Contributors. All rights reserved.
+ * Copyright (c) 2013-2019, ARM Limited and Contributors. All rights reserved.
  *
  * SPDX-License-Identifier: BSD-3-Clause
  */
@@ -32,24 +32,42 @@ func bl1_entrypoint
                _init_c_runtime=1                               \
                _exception_vectors=bl1_exceptions
 
-       /* ---------------------------------------------
-        * Architectural init. can be generic e.g.
-        * enabling stack alignment and platform spec-
-        * ific e.g. MMU & page table setup as per the
-        * platform memory map. Perform the latter here
-        * and the former in bl1_main.
-        * ---------------------------------------------
+       /* --------------------------------------------------------------------
+        * Perform BL1 setup
+        * --------------------------------------------------------------------
         */
-       bl      bl1_early_platform_setup
-       bl      bl1_plat_arch_setup
+       bl      bl1_setup
 
-       /* --------------------------------------------------
+       /* --------------------------------------------------------------------
+        * Enable pointer authentication
+        * --------------------------------------------------------------------
+        */
+#if ENABLE_PAUTH
+       mrs     x0, sctlr_el3
+       orr     x0, x0, #SCTLR_EnIA_BIT
+       msr     sctlr_el3, x0
+       isb
+#endif /* ENABLE_PAUTH */
+
+       /* --------------------------------------------------------------------
         * Initialize platform and jump to our c-entry point
         * for this type of reset.
-        * --------------------------------------------------
+        * --------------------------------------------------------------------
         */
        bl      bl1_main
 
+       /* --------------------------------------------------------------------
+        * Disable pointer authentication before jumping to BL31 or that will
+        * cause an authentication failure during the early platform init.
+        * --------------------------------------------------------------------
+        */
+#if ENABLE_PAUTH
+       mrs     x0, sctlr_el3
+       bic     x0, x0, #SCTLR_EnIA_BIT
+       msr     sctlr_el3, x0
+       isb
+#endif /* ENABLE_PAUTH */
+
        /* --------------------------------------------------
         * Do the transition to next boot image.
         * --------------------------------------------------
index ec7d7280b798c3b230f1355e9757365fb22e1813..7f1a8230642af573e8f088d0eb976591cf8913ff 100644 (file)
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2013-2018, ARM Limited and Contributors. All rights reserved.
+# Copyright (c) 2013-2019, ARM Limited and Contributors. All rights reserved.
 #
 # SPDX-License-Identifier: BSD-3-Clause
 #
@@ -21,6 +21,10 @@ BL1_SOURCES          +=      lib/cpus/aarch64/dsu_helpers.S          \
                                lib/el3_runtime/aarch64/context.S
 endif
 
+ifeq (${ENABLE_PAUTH},1)
+BL1_CFLAGS             +=      -msign-return-address=non-leaf
+endif
+
 ifeq (${TRUSTED_BOARD_BOOT},1)
 BL1_SOURCES            +=      bl1/bl1_fwu.c
 endif
index d2c2b417358d26450bcf985ae3cadf810c613d2e..fce14f55f0f53d67392bf3c27ddfcb9f53c82dcf 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013-2018, ARM Limited and Contributors. All rights reserved.
+ * Copyright (c) 2013-2019, ARM Limited and Contributors. All rights reserved.
  *
  * SPDX-License-Identifier: BSD-3-Clause
  */
@@ -51,6 +51,28 @@ void bl1_calc_bl2_mem_layout(const meminfo_t *bl1_mem_layout,
        flush_dcache_range((unsigned long)bl2_mem_layout, sizeof(meminfo_t));
 }
 
+/*******************************************************************************
+ * Setup function for BL1.
+ ******************************************************************************/
+void bl1_setup(void)
+{
+       /* Perform early platform-specific setup */
+       bl1_early_platform_setup();
+
+#ifdef AARCH64
+       /*
+        * Update pointer authentication key before the MMU is enabled. It is
+        * saved in the rodata section, that can be writen before enabling the
+        * MMU. This function must be called after the console is initialized
+        * in the early platform setup.
+        */
+       bl_handle_pauth();
+#endif /* AARCH64 */
+
+       /* Perform late platform-specific setup */
+       bl1_plat_arch_setup();
+}
+
 /*******************************************************************************
  * Function to perform late architectural and platform specific initialization.
  * It also queries the platform to load and run next BL image. Only called
index cc846ddf12d0acd9f4d5f0925824630c31b2b6e6..35da133f7fe4a34dd17e1d634fb3ebe9f0d116b1 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017, ARM Limited and Contributors. All rights reserved.
+ * Copyright (c) 2017-2019, ARM Limited and Contributors. All rights reserved.
  *
  * SPDX-License-Identifier: BSD-3-Clause
  */
@@ -36,8 +36,11 @@ func bl2_entrypoint
        mov     r2, r11
        mov     r3, r12
 
-       bl      bl2_el3_early_platform_setup
-       bl      bl2_el3_plat_arch_setup
+       /* ---------------------------------------------
+        * Perform BL2 setup
+        * ---------------------------------------------
+        */
+       bl      bl2_el3_setup
 
        /* ---------------------------------------------
         * Jump to main function.
index e7b98af32fe77fef41fcbf7b6e5032711fc93032..23d151356512ef17ad2fba83cf923e7443dd1288 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016-2018, ARM Limited and Contributors. All rights reserved.
+ * Copyright (c) 2016-2019, ARM Limited and Contributors. All rights reserved.
  *
  * SPDX-License-Identifier: BSD-3-Clause
  */
@@ -108,16 +108,15 @@ func bl2_entrypoint
 #endif
 
        /* ---------------------------------------------
-        * Perform early platform setup & platform
-        * specific early arch. setup e.g. mmu setup
+        * Perform BL2 setup
         * ---------------------------------------------
         */
        mov     r0, r9
        mov     r1, r10
        mov     r2, r11
        mov     r3, r12
-       bl      bl2_early_platform_setup2
-       bl      bl2_plat_arch_setup
+
+       bl      bl2_setup
 
        /* ---------------------------------------------
         * Jump to main function.
index 16b7c0d5f1abce68389af3a745d74ce84b99a68d..d1e42471877be950d5a521a3979d257084fad1a2 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017, ARM Limited and Contributors. All rights reserved.
+ * Copyright (c) 2017-2019, ARM Limited and Contributors. All rights reserved.
  *
  * SPDX-License-Identifier: BSD-3-Clause
  */
@@ -29,16 +29,31 @@ func bl2_entrypoint
                _init_c_runtime=1                               \
                _exception_vectors=bl2_el3_exceptions
 
-       /*
+       /* ---------------------------------------------
         * Restore parameters of boot rom
+        * ---------------------------------------------
         */
        mov     x0, x20
        mov     x1, x21
        mov     x2, x22
        mov     x3, x23
 
-       bl      bl2_el3_early_platform_setup
-       bl      bl2_el3_plat_arch_setup
+       /* ---------------------------------------------
+        * Perform BL2 setup
+        * ---------------------------------------------
+        */
+       bl      bl2_el3_setup
+
+       /* ---------------------------------------------
+        * Enable pointer authentication
+        * ---------------------------------------------
+        */
+#if ENABLE_PAUTH
+       mrs     x0, sctlr_el3
+       orr     x0, x0, #SCTLR_EnIA_BIT
+       msr     sctlr_el3, x0
+       isb
+#endif /* ENABLE_PAUTH */
 
        /* ---------------------------------------------
         * Jump to main function.
@@ -55,16 +70,29 @@ endfunc bl2_entrypoint
 
 func bl2_run_next_image
        mov     x20,x0
-        /*
-         * MMU needs to be disabled because both BL2 and BL31 execute
-         * in EL3, and therefore share the same address space.
-         * BL31 will initialize the address space according to its
-         * own requirement.
-         */
+       /* ---------------------------------------------
+        * MMU needs to be disabled because both BL2 and BL31 execute
+        * in EL3, and therefore share the same address space.
+        * BL31 will initialize the address space according to its
+        * own requirement.
+        * ---------------------------------------------
+        */
        bl      disable_mmu_icache_el3
        tlbi    alle3
        bl      bl2_el3_plat_prepare_exit
 
+       /* ---------------------------------------------
+        * Disable pointer authentication before jumping to BL31 or that will
+        * cause an authentication failure during the early platform init.
+        * ---------------------------------------------
+        */
+#if ENABLE_PAUTH
+       mrs     x0, sctlr_el3
+       bic     x0, x0, #SCTLR_EnIA_BIT
+       msr     sctlr_el3, x0
+       isb
+#endif /* ENABLE_PAUTH */
+
        ldp     x0, x1, [x20, #ENTRY_POINT_INFO_PC_OFFSET]
        msr     elr_el3, x0
        msr     spsr_el3, x1
index d938947c1c55b0e8fc42a766cb012f4b4cb51137..611b8076df14764d1ec5e72090e05b5feb2badde 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013-2018, ARM Limited and Contributors. All rights reserved.
+ * Copyright (c) 2013-2019, ARM Limited and Contributors. All rights reserved.
  *
  * SPDX-License-Identifier: BSD-3-Clause
  */
@@ -106,17 +106,25 @@ func bl2_entrypoint
 #endif
 
        /* ---------------------------------------------
-        * Perform early platform setup & platform
-        * specific early arch. setup e.g. mmu setup
+        * Perform BL2 setup
         * ---------------------------------------------
         */
        mov     x0, x20
        mov     x1, x21
        mov     x2, x22
        mov     x3, x23
-       bl      bl2_early_platform_setup2
+       bl      bl2_setup
 
-       bl      bl2_plat_arch_setup
+       /* ---------------------------------------------
+        * Enable pointer authentication
+        * ---------------------------------------------
+        */
+#if ENABLE_PAUTH
+       mrs     x0, sctlr_el1
+       orr     x0, x0, #SCTLR_EnIA_BIT
+       msr     sctlr_el1, x0
+       isb
+#endif /* ENABLE_PAUTH */
 
        /* ---------------------------------------------
         * Jump to main function.
index f905bc2354da671b6991d870d571f41506c624de..9523918bccf3f8d84bfaac659e0871302fbca656 100644 (file)
@@ -1,10 +1,11 @@
 #
-# Copyright (c) 2013-2018, ARM Limited and Contributors. All rights reserved.
+# Copyright (c) 2013-2019, ARM Limited and Contributors. All rights reserved.
 #
 # SPDX-License-Identifier: BSD-3-Clause
 #
 
-BL2_SOURCES            +=      bl2/bl2_main.c                          \
+BL2_SOURCES            +=      bl2/bl2_image_load_v2.c                 \
+                               bl2/bl2_main.c                          \
                                bl2/${ARCH}/bl2_arch_setup.c            \
                                lib/locks/exclusive/${ARCH}/spinlock.S  \
                                plat/common/${ARCH}/platform_up_stack.S \
@@ -14,7 +15,9 @@ ifeq (${ARCH},aarch64)
 BL2_SOURCES            +=      common/aarch64/early_exceptions.S
 endif
 
-BL2_SOURCES            +=      bl2/bl2_image_load_v2.c
+ifeq (${ENABLE_PAUTH},1)
+BL2_CFLAGS             +=      -msign-return-address=non-leaf
+endif
 
 ifeq (${BL2_AT_EL3},0)
 BL2_SOURCES            +=      bl2/${ARCH}/bl2_entrypoint.S
index 019088dc128f2279e8ef655798cd748cdc932e11..7d8d60c1914fc549b9e303a3b189aa05ebbb4b89 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013-2018, ARM Limited and Contributors. All rights reserved.
+ * Copyright (c) 2013-2019, ARM Limited and Contributors. All rights reserved.
  *
  * SPDX-License-Identifier: BSD-3-Clause
  */
 #define NEXT_IMAGE     "BL31"
 #endif
 
+#if !BL2_AT_EL3
+/*******************************************************************************
+ * Setup function for BL2.
+ ******************************************************************************/
+void bl2_setup(u_register_t arg0, u_register_t arg1, u_register_t arg2,
+              u_register_t arg3)
+{
+       /* Perform early platform-specific setup */
+       bl2_early_platform_setup2(arg0, arg1, arg2, arg3);
+
+#ifdef AARCH64
+       /*
+        * Update pointer authentication key before the MMU is enabled. It is
+        * saved in the rodata section, that can be writen before enabling the
+        * MMU. This function must be called after the console is initialized
+        * in the early platform setup.
+        */
+       bl_handle_pauth();
+#endif /* AARCH64 */
+
+       /* Perform late platform-specific setup */
+       bl2_plat_arch_setup();
+}
+
+#else /* if BL2_AT_EL3 */
+/*******************************************************************************
+ * Setup function for BL2 when BL2_AT_EL3=1.
+ ******************************************************************************/
+void bl2_el3_setup(u_register_t arg0, u_register_t arg1, u_register_t arg2,
+                  u_register_t arg3)
+{
+       /* Perform early platform-specific setup */
+       bl2_el3_early_platform_setup(arg0, arg1, arg2, arg3);
+
+#ifdef AARCH64
+       /*
+        * Update pointer authentication key before the MMU is enabled. It is
+        * saved in the rodata section, that can be writen before enabling the
+        * MMU. This function must be called after the console is initialized
+        * in the early platform setup.
+        */
+       bl_handle_pauth();
+#endif /* AARCH64 */
+
+       /* Perform late platform-specific setup */
+       bl2_el3_plat_arch_setup();
+}
+#endif /* BL2_AT_EL3 */
+
 /*******************************************************************************
  * The only thing to do in BL2 is to load further images and pass control to
  * next BL. The memory occupied by BL2 will be reclaimed by BL3x stages. BL2
@@ -65,11 +114,11 @@ void bl2_main(void)
         * be passed to next BL image as an argument.
         */
        smc(BL1_SMC_RUN_IMAGE, (unsigned long)next_bl_ep_info, 0, 0, 0, 0, 0, 0);
-#else
+#else /* if BL2_AT_EL3 */
        NOTICE("BL2: Booting " NEXT_IMAGE "\n");
        print_entry_point_info(next_bl_ep_info);
        console_flush();
 
        bl2_run_next_image(next_bl_ep_info);
-#endif
+#endif /* BL2_AT_EL3 */
 }
index c41773b886eb02af643542cd672cf73ab8300f37..8e9528b47488ebca41281d8236d9c802a96a1e25 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013-2018, ARM Limited and Contributors. All rights reserved.
+ * Copyright (c) 2013-2019, ARM Limited and Contributors. All rights reserved.
  *
  * SPDX-License-Identifier: BSD-3-Clause
  */
@@ -87,29 +87,39 @@ func bl31_entrypoint
        bl      fixup_gdt_reloc
 #endif /* ENABLE_PIE */
 
-       /* ---------------------------------------------
-        * Perform platform specific early arch. setup
-        * ---------------------------------------------
+       /* --------------------------------------------------------------------
+        * Perform BL31 setup
+        * --------------------------------------------------------------------
         */
        mov     x0, x20
        mov     x1, x21
        mov     x2, x22
        mov     x3, x23
-       bl      bl31_early_platform_setup2
-       bl      bl31_plat_arch_setup
+       bl      bl31_setup
+
+       /* --------------------------------------------------------------------
+        * Enable pointer authentication
+        * --------------------------------------------------------------------
+        */
+#if ENABLE_PAUTH
+       mrs     x0, sctlr_el3
+       orr     x0, x0, #SCTLR_EnIA_BIT
+       msr     sctlr_el3, x0
+       isb
+#endif /* ENABLE_PAUTH */
 
-       /* ---------------------------------------------
+       /* --------------------------------------------------------------------
         * Jump to main function.
-        * ---------------------------------------------
+        * --------------------------------------------------------------------
         */
        bl      bl31_main
 
-       /* -------------------------------------------------------------
+       /* --------------------------------------------------------------------
         * Clean the .data & .bss sections to main memory. This ensures
         * that any global data which was initialised by the primary CPU
         * is visible to secondary CPUs before they enable their data
         * caches and participate in coherency.
-        * -------------------------------------------------------------
+        * --------------------------------------------------------------------
         */
        adr     x0, __DATA_START__
        adr     x1, __DATA_END__
index 0c8cfa8f92ae3c7f3b02bd491a6d02d69156ff89..40c3191ac5f719a3caf8aec1273ce1bd45f321e2 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018, ARM Limited and Contributors. All rights reserved.
+ * Copyright (c) 2018-2019, ARM Limited and Contributors. All rights reserved.
  *
  * SPDX-License-Identifier: BSD-3-Clause
  */
@@ -68,6 +68,14 @@ func enter_lower_el_sync_ea
        /* Save GP registers */
        bl      save_gp_registers
 
+       /* Save ARMv8.3-PAuth registers and load firmware key */
+#if CTX_INCLUDE_PAUTH_REGS
+       bl      pauth_context_save
+#endif
+#if ENABLE_PAUTH
+       bl      pauth_load_bl_apiakey
+#endif
+
        /* Setup exception class and syndrome arguments for platform handler */
        mov     x0, #ERROR_EA_SYNC
        mrs     x1, esr_el3
@@ -98,6 +106,14 @@ func enter_lower_el_async_ea
        /* Save GP registers */
        bl      save_gp_registers
 
+       /* Save ARMv8.3-PAuth registers and load firmware key */
+#if CTX_INCLUDE_PAUTH_REGS
+       bl      pauth_context_save
+#endif
+#if ENABLE_PAUTH
+       bl      pauth_load_bl_apiakey
+#endif
+
        /* Setup exception class and syndrome arguments for platform handler */
        mov     x0, #ERROR_EA_ASYNC
        mrs     x1, esr_el3
index 4f53b8e70de47941dd93b700317b8f322fc49913..aa9d0079bea99bd589ecc0f9198cef1604847de1 100644 (file)
         * ---------------------------------------------------------------------
         */
        .macro  handle_interrupt_exception label
+
        bl      save_gp_registers
+
+       /* Save ARMv8.3-PAuth registers and load firmware key */
+#if CTX_INCLUDE_PAUTH_REGS
+       bl      pauth_context_save
+#endif
+#if ENABLE_PAUTH
+       bl      pauth_load_bl_apiakey
+#endif
+
        /* Save the EL3 system registers needed to return from this exception */
        mrs     x0, spsr_el3
        mrs     x1, elr_el3
@@ -320,14 +330,25 @@ smc_handler32:
        tbnz    x0, #FUNCID_CC_SHIFT, smc_prohibited
 
 smc_handler64:
+       /* NOTE: The code below must preserve x0-x4 */
+
+       /* Save general purpose registers */
+       bl      save_gp_registers
+
+       /* Save ARMv8.3-PAuth registers and load firmware key */
+#if CTX_INCLUDE_PAUTH_REGS
+       bl      pauth_context_save
+#endif
+#if ENABLE_PAUTH
+       bl      pauth_load_bl_apiakey
+#endif
+
        /*
         * Populate the parameters for the SMC handler.
         * We already have x0-x4 in place. x5 will point to a cookie (not used
         * now). x6 will point to the context structure (SP_EL3) and x7 will
         * contain flags we need to pass to the handler.
         */
-       bl      save_gp_registers
-
        mov     x5, xzr
        mov     x6, sp
 
index c9ba926c591f2ae2645eaf9da6445827a4cf54f6..10feae161f06ea30701c01cd71ec80732144d490 100644 (file)
@@ -75,6 +75,10 @@ ifeq (${ENABLE_MPAM_FOR_LOWER_ELS},1)
 BL31_SOURCES           +=      lib/extensions/mpam/mpam.c
 endif
 
+ifeq (${ENABLE_PAUTH},1)
+BL31_CFLAGS            +=      -msign-return-address=non-leaf
+endif
+
 ifeq (${WORKAROUND_CVE_2017_5715},1)
 BL31_SOURCES           +=      lib/cpus/aarch64/wa_cve_2017_5715_bpiall.S      \
                                lib/cpus/aarch64/wa_cve_2017_5715_mmu.S
index da35f75edab72e0a84fd8ac23cfa90e81c82c161..856ea9f62bd48da2e39c60db8bfb5e690d95e61f 100644 (file)
@@ -63,13 +63,34 @@ void __init bl31_lib_init(void)
        cm_init();
 }
 
+/*******************************************************************************
+ * Setup function for BL31.
+ ******************************************************************************/
+void bl31_setup(u_register_t arg0, u_register_t arg1, u_register_t arg2,
+               u_register_t arg3)
+{
+       /* Perform early platform-specific setup */
+       bl31_early_platform_setup2(arg0, arg1, arg2, arg3);
+
+       /*
+        * Update pointer authentication key before the MMU is enabled. It is
+        * saved in the rodata section, that can be writen before enabling the
+        * MMU. This function must be called after the console is initialized
+        * in the early platform setup.
+        */
+       bl_handle_pauth();
+
+       /* Perform late platform-specific setup */
+       bl31_plat_arch_setup();
+}
+
 /*******************************************************************************
  * BL31 is responsible for setting up the runtime services for the primary cpu
  * before passing control to the bootloader or an Operating System. This
  * function calls runtime_svc_init() which initializes all registered runtime
  * services. The run time services would setup enough context for the core to
  * switch to the next exception level. When this function returns, the core will
- * switch to the programmed exception level via. an ERET.
+ * switch to the programmed exception level via an ERET.
  ******************************************************************************/
 void bl31_main(void)
 {
index 1bcebee530fd6dcc93f8d1f9f1cc7360b257ded0..745f165d4727dc48791fec90527ca70bc6bd2f0e 100644 (file)
@@ -314,9 +314,9 @@ static void *ehf_entering_normal_world(const void *arg)
 
 /*
  * Program Priority Mask to the original Non-secure priority such that
- * Non-secure interrupts may preempt Secure execution, viz. during Yielding SMC
- * calls. The 'preempt_ret_code' parameter indicates the Yielding SMC's return
- * value in case the call was preempted.
+ * Non-secure interrupts may preempt Secure execution (for example, during
+ * Yielding SMC calls). The 'preempt_ret_code' parameter indicates the Yielding
+ * SMC's return value in case the call was preempted.
  *
  * This API is expected to be invoked before delegating a yielding SMC to Secure
  * EL1. I.e. within the window of secure execution after Non-secure context is
@@ -360,7 +360,7 @@ void ehf_allow_ns_preemption(uint64_t preempt_ret_code)
 
 /*
  * Return whether Secure execution has explicitly allowed Non-secure interrupts
- * to preempt itself, viz. during Yielding SMC calls.
+ * to preempt itself (for example, during Yielding SMC calls).
  */
 unsigned int ehf_is_ns_preemption_allowed(void)
 {
index 48f6981bb2190d6ba9a4df230a77ebb0e38ebf01..710b4588487b2f4517d97ba44326c74ab2c839f2 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013-2018, ARM Limited and Contributors. All rights reserved.
+ * Copyright (c) 2013-2019, ARM Limited and Contributors. All rights reserved.
  *
  * SPDX-License-Identifier: BSD-3-Clause
  */
@@ -122,12 +122,21 @@ func tsp_entrypoint _align=3
 #endif
 
        /* ---------------------------------------------
-        * Perform early platform setup & platform
-        * specific early arch. setup e.g. mmu setup
+        * Perform TSP setup
         * ---------------------------------------------
         */
-       bl      tsp_early_platform_setup
-       bl      tsp_plat_arch_setup
+       bl      tsp_setup
+
+       /* ---------------------------------------------
+        * Enable pointer authentication
+        * ---------------------------------------------
+        */
+#if ENABLE_PAUTH
+       mrs     x0, sctlr_el1
+       orr     x0, x0, #SCTLR_EnIA_BIT
+       msr     sctlr_el1, x0
+       isb
+#endif /* ENABLE_PAUTH */
 
        /* ---------------------------------------------
         * Jump to main function.
index 4ea3dfb9f1699b695e5f0cdda9576a5c9cc5580d..b1fe7ff600e930f28360019f7a5ea477cd1ac4f3 100644 (file)
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2013-2016, ARM Limited and Contributors. All rights reserved.
+# Copyright (c) 2013-2019, ARM Limited and Contributors. All rights reserved.
 #
 # SPDX-License-Identifier: BSD-3-Clause
 #
@@ -17,6 +17,11 @@ BL32_SOURCES         +=      bl32/tsp/tsp_main.c                     \
 
 BL32_LINKERFILE                :=      bl32/tsp/tsp.ld.S
 
+# This flag determines whether pointer authentication is used in the TSP or not
+ifeq ($(ENABLE_PAUTH),1)
+BL32_CFLAGS            +=      -msign-return-address=non-leaf
+endif
+
 # This flag determines if the TSPD initializes BL32 in tspd_init() (synchronous
 # method) or configures BL31 to pass control to BL32 instead of BL33
 # (asynchronous method).
index 407ed47881fc49dee9d46e0f4fc01eb7d19c70aa..30bf6ffc8da66e7fca6d181fb9eb2fd4dd295944 100644 (file)
@@ -71,6 +71,26 @@ static tsp_args_t *set_smc_args(uint64_t arg0,
        return pcpu_smc_args;
 }
 
+/*******************************************************************************
+ * Setup function for TSP.
+ ******************************************************************************/
+void tsp_setup(void)
+{
+       /* Perform early platform-specific setup */
+       tsp_early_platform_setup();
+
+       /*
+        * Update pointer authentication key before the MMU is enabled. It is
+        * saved in the rodata section, that can be writen before enabling the
+        * MMU. This function must be called after the console is initialized
+        * in the early platform setup.
+        */
+       bl_handle_pauth();
+
+       /* Perform late platform-specific setup */
+       tsp_plat_arch_setup();
+}
+
 /*******************************************************************************
  * TSP main entry point where it gets the opportunity to initialize its secure
  * state/applications. Once the state is initialized, it must return to the
index 84ff99c8e653bea6478e1f0be091f726f22b7c0c..61f031bfd10143c39dfd3972dbb291ea3cddf730 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013-2018, ARM Limited and Contributors. All rights reserved.
+ * Copyright (c) 2013-2019, ARM Limited and Contributors. All rights reserved.
  *
  * SPDX-License-Identifier: BSD-3-Clause
  */
@@ -9,6 +9,7 @@
 #include <string.h>
 
 #include <arch.h>
+#include <arch_features.h>
 #include <arch_helpers.h>
 #include <common/bl_common.h>
 #include <common/debug.h>
@@ -243,3 +244,53 @@ void print_entry_point_info(const entry_point_info_t *ep_info)
 #endif
 #undef PRINT_IMAGE_ARG
 }
+
+#ifdef AARCH64
+/*******************************************************************************
+ * Handle all possible cases regarding ARMv8.3-PAuth.
+ ******************************************************************************/
+void bl_handle_pauth(void)
+{
+#if ENABLE_PAUTH
+       /*
+        * ENABLE_PAUTH = 1 && CTX_INCLUDE_PAUTH_REGS = 1
+        *
+        * Check that the system supports address authentication to avoid
+        * getting an access fault when accessing the registers. This is all
+        * that is needed to check. If any of the authentication mechanisms is
+        * supported, the system knows about ARMv8.3-PAuth, so all the registers
+        * are available and accessing them won't generate a fault.
+        *
+        * Obtain 128-bit instruction key A from the platform and save it to the
+        * system registers. Pointer authentication can't be enabled here or the
+        * authentication will fail when returning from this function.
+        */
+       assert(is_armv8_3_pauth_apa_api_present());
+
+       uint64_t *apiakey = plat_init_apiakey();
+
+       write_apiakeylo_el1(apiakey[0]);
+       write_apiakeyhi_el1(apiakey[1]);
+#else /* if !ENABLE_PAUTH */
+
+# if CTX_INCLUDE_PAUTH_REGS
+       /*
+        * ENABLE_PAUTH = 0 && CTX_INCLUDE_PAUTH_REGS = 1
+        *
+        * Assert that the ARMv8.3-PAuth registers are present or an access
+        * fault will be triggered when they are being saved or restored.
+        */
+       assert(is_armv8_3_pauth_present());
+# else
+       /*
+        * ENABLE_PAUTH = 0 && CTX_INCLUDE_PAUTH_REGS = 0
+        *
+        * Pointer authentication is allowed in the Non-secure world, but
+        * prohibited in the Secure world. The Trusted Firmware doesn't save the
+        * registers during a world switch. No check needed.
+        */
+# endif /* CTX_INCLUDE_PAUTH_REGS */
+
+#endif /* ENABLE_PAUTH */
+}
+#endif /* AARCH64 */
index 9f0e26615156a069b22f36aabf1eb417e7756496..6cdac83573def72c4279302ef6956c7eb8a661c3 100644 (file)
@@ -4,7 +4,7 @@ Arm SiP Service
 This document enumerates and describes the Arm SiP (Silicon Provider) services.
 
 SiP services are non-standard, platform-specific services offered by the silicon
-implementer or platform provider. They are accessed via. ``SMC`` ("SMC calls")
+implementer or platform provider. They are accessed via ``SMC`` ("SMC calls")
 instruction executed from Exception Levels below EL3. SMC calls for SiP
 services:
 
index 315457a19ff3ca8d076446d113f4b159dfc56687..95538d02b4ad22bc9ca7ecf5df2810966b2e14f2 100644 (file)
@@ -73,9 +73,18 @@ will enable it.
 
 For Cortex-A53, the following errata build flags are defined :
 
+-  ``ERRATA_A53_819472``: This applies errata 819472 workaround to all
+   CPUs. This needs to be enabled only for revision <= r0p1 of Cortex-A53.
+
+-  ``ERRATA_A53_824069``: This applies errata 824069 workaround to all
+   CPUs. This needs to be enabled only for revision <= r0p2 of Cortex-A53.
+
 -  ``ERRATA_A53_826319``: This applies errata 826319 workaround to Cortex-A53
    CPU. This needs to be enabled only for revision <= r0p2 of the CPU.
 
+-  ``ERRATA_A53_827319``: This applies errata 827319 workaround to all
+   CPUs. This needs to be enabled only for revision <= r0p2 of Cortex-A53.
+
 -  ``ERRATA_A53_835769``: This applies erratum 835769 workaround at compile and
    link time to Cortex-A53 CPU. This needs to be enabled for some variants of
    revision <= r0p4. This workaround can lead the linker to create ``*.stub``
@@ -97,6 +106,23 @@ For Cortex-A53, the following errata build flags are defined :
    Earlier revisions of the CPU have other errata which require the same
    workaround in software, so they should be covered anyway.
 
+For Cortex-A55, the following errata build flags are defined :
+
+-  ``ERRATA_A55_768277``: This applies errata 768277 workaround to Cortex-A55
+   CPU. This needs to be enabled only for revision r0p0 of the CPU.
+
+-  ``ERRATA_A55_778703``: This applies errata 778703 workaround to Cortex-A55
+   CPU. This needs to be enabled only for revision r0p0 of the CPU.
+
+-  ``ERRATA_A55_798797``: This applies errata 798797 workaround to Cortex-A55
+   CPU. This needs to be enabled only for revision r0p0 of the CPU.
+
+-  ``ERRATA_A55_846532``: This applies errata 846532 workaround to Cortex-A55
+   CPU. This needs to be enabled only for revision <= r0p1 of the CPU.
+
+-  ``ERRATA_A55_903758``: This applies errata 903758 workaround to Cortex-A55
+   CPU. This needs to be enabled only for revision <= r0p1 of the CPU.
+
 For Cortex-A57, the following errata build flags are defined :
 
 -  ``ERRATA_A57_806969``: This applies errata 806969 workaround to Cortex-A57
@@ -108,6 +134,12 @@ For Cortex-A57, the following errata build flags are defined :
 -  ``ERRATA_A57_813420``: This applies errata 813420 workaround to Cortex-A57
    CPU. This needs to be enabled only for revision r0p0 of the CPU.
 
+-  ``ERRATA_A57_814670``: This applies errata 814670 workaround to Cortex-A57
+   CPU. This needs to be enabled only for revision r0p0 of the CPU.
+
+-  ``ERRATA_A57_817169``: This applies errata 817169 workaround to Cortex-A57
+   CPU. This needs to be enabled only for revision <= r0p1 of the CPU.
+
 -  ``ERRATA_A57_826974``: This applies errata 826974 workaround to Cortex-A57
    CPU. This needs to be enabled only for revision <= r1p1 of the CPU.
 
@@ -132,6 +164,33 @@ For Cortex-A72, the following errata build flags are defined :
 -  ``ERRATA_A72_859971``: This applies errata 859971 workaround to Cortex-A72
    CPU. This needs to be enabled only for revision <= r0p3 of the CPU.
 
+For Cortex-A73, the following errata build flags are defined :
+
+-  ``ERRATA_A73_852427``: This applies errata 852427 workaround to Cortex-A73
+   CPU. This needs to be enabled only for revision r0p0 of the CPU.
+
+-  ``ERRATA_A73_855423``: This applies errata 855423 workaround to Cortex-A73
+   CPU. This needs to be enabled only for revision <= r0p1 of the CPU.
+
+For Cortex-A75, the following errata build flags are defined :
+
+-  ``ERRATA_A75_764081``: This applies errata 764081 workaround to Cortex-A75
+   CPU. This needs to be enabled only for revision r0p0 of the CPU.
+
+-  ``ERRATA_A75_790748``: This applies errata 790748 workaround to Cortex-A75
+    CPU. This needs to be enabled only for revision r0p0 of the CPU.
+
+For Cortex-A76, the following errata build flags are defined :
+
+-  ``ERRATA_A76_1073348``: This applies errata 1073348 workaround to Cortex-A76
+   CPU. This needs to be enabled only for revision <= r1p0 of the CPU.
+
+-  ``ERRATA_A76_1130799``: This applies errata 1130799 workaround to Cortex-A76
+   CPU. This needs to be enabled only for revision <= r2p0 of the CPU.
+
+-  ``ERRATA_A76_1220197``: This applies errata 1220197 workaround to Cortex-A76
+   CPU. This needs to be enabled only for revision <= r2p0 of the CPU.
+
 DSU Errata Workarounds
 ----------------------
 
index dbcd4bca8ab9a594cc4eacf4ac25fa78715cff63..b7cd69d4cb815fda51f5af7c4c488fcde4033a7c 100644 (file)
@@ -233,7 +233,7 @@ Note:
    The ``ARRAY_SIZE()`` macro therefore should be used to determine the size of
    array.
 
-Finally, this array of descriptors is exposed to |EHF| via. the
+Finally, this array of descriptors is exposed to |EHF| via the
 ``EHF_REGISTER_PRIORITIES()`` macro.
 
 Refer to the `Interrupt handling example`_ for usage. See also: `Interrupt
@@ -379,8 +379,8 @@ Activating and Deactivating priorities
 
 A priority level is said to be *active* when an exception of that priority is
 being handled: for interrupts, this is implied when the interrupt is
-acknowledged; for non-interrupt exceptions, viz. SErrors or `SDEI explicit
-dispatches`__, this has to be done via. calling ``ehf_activate_priority()``. See
+acknowledged; for non-interrupt exceptions, such as SErrors or `SDEI explicit
+dispatches`__, this has to be done via calling ``ehf_activate_priority()``. See
 `Run-time flow`_.
 
 .. __: sdei.rst#explicit-dispatch-of-events
@@ -388,7 +388,7 @@ dispatches`__, this has to be done via. calling ``ehf_activate_priority()``. See
 Conversely, when the dispatcher has reached a logical resolution for the cause
 of the exception, the corresponding priority level ought to be deactivated. As
 above, for interrupts, this is implied when the interrupt is EOId in the GIC;
-for other exceptions, this has to be done via. calling
+for other exceptions, this has to be done via calling
 ``ehf_deactivate_priority()``.
 
 Thanks to `different provisions`__ for exception delegation, there are
@@ -405,7 +405,7 @@ potentially more than one work flow for deactivation:
 
 -  The dispatcher has to delegate the execution to lower ELs, and the cause of
    the exception can be considered resolved only when the lower EL returns
-   signals complete (via. an ``SMC``) at a future point in time. The following
+   signals complete (via an ``SMC``) at a future point in time. The following
    sequence ensues:
 
    #. The dispatcher calls ``setjmp()`` to setup a jump point, and arranges to
@@ -414,7 +414,7 @@ potentially more than one work flow for deactivation:
    #. Through the ensuing ``ERET`` from runtime firmware, execution is delegated
       to a lower EL.
 
-   #. The lower EL completes its execution, and signals completion via. an
+   #. The lower EL completes its execution, and signals completion via an
       ``SMC``.
 
    #. The ``SMC`` is handled by the same dispatcher that handled the exception
@@ -597,7 +597,7 @@ world ones. The platform further assigns relative priorities amongst Secure
 dispatchers through |EHF|.
 
 As mentioned in `Partitioning priority levels`_, interrupts targeting distinct
-dispatchers fall in distinct priority levels. Because they're routed via. the
+dispatchers fall in distinct priority levels. Because they're routed via the
 GIC, interrupt delivery to the PE is subject to GIC prioritisation rules. In
 particular, when an interrupt is being handled by the PE (i.e., the interrupt is
 in *Active* state), only interrupts of higher priority are signalled to the PE,
index 299654fc26ec578ad43642f31731cff3c6635e24..9e206dc0f3ca212be9cdc38245271fe9b6e1c3db 100644 (file)
@@ -1282,9 +1282,9 @@ interrupt configuration during the driver initialisation.
 Secure interrupt configuration are specified in an array of secure interrupt
 properties. In this scheme, in both GICv2 and GICv3 driver data structures, the
 ``interrupt_props`` member points to an array of interrupt properties. Each
-element of the array specifies the interrupt number and its configuration, viz.
-priority, group, configuration. Each element of the array shall be populated by
-the macro ``INTR_PROP_DESC()``. The macro takes the following arguments:
+element of the array specifies the interrupt number and its attributes
+(priority, group, configuration). Each element of the array shall be populated
+by the macro ``INTR_PROP_DESC()``. The macro takes the following arguments:
 
 - 10-bit interrupt number,
 
@@ -1439,7 +1439,7 @@ C run time. Therefore it must follow AAPCS, and must not use stack.
 
 CPU drivers that apply errata workaround can optionally implement an assembly
 function that report the status of errata workarounds pertaining to that CPU.
-For a driver that registers the CPU, for example, ``cpux`` via. ``declare_cpu_ops``
+For a driver that registers the CPU, for example, ``cpux`` via ``declare_cpu_ops``
 macro, the errata reporting function, if it exists, must be named
 ``cpux_errata_report``. This function will always be called with MMU enabled; it
 must follow AAPCS and may use stack.
@@ -2031,7 +2031,6 @@ accessed by multiple CPUs, either with caches enabled or disabled.
 
         /*
          * Index of the parent power domain node.
-         * TODO: Figure out whether to whether using pointer is more efficient.
          */
         unsigned int parent_node;
 
@@ -2558,8 +2557,18 @@ Armv8.2-A
 Armv8.3-A
 ~~~~~~~~~
 
--  Pointer Authentication features of Armv8.3-A are unconditionally enabled so
-   that lower ELs are allowed to use them without causing a trap to EL3.
+-  Pointer authentication features of Armv8.3-A are unconditionally enabled in
+   the Non-secure world so that lower ELs are allowed to use them without
+   causing a trap to EL3.
+
+   In order to enable the Secure world to use it, ``CTX_INCLUDE_PAUTH_REGS``
+   must be set to 1. This will add all pointer authentication system registers
+   to the context that is saved when doing a world switch.
+
+   The Trusted Firmware itself has support for pointer authentication at runtime
+   that can be enabled by setting both options ``ENABLE_PAUTH`` and
+   ``CTX_INCLUDE_PAUTH_REGS`` to 1. This enables pointer authentication in BL1,
+   BL2, BL31, and the TSP if it is used.
 
 Armv7-A
 ~~~~~~~
diff --git a/docs/frequently-asked-questions.rst b/docs/frequently-asked-questions.rst
new file mode 100644 (file)
index 0000000..7a4ff0e
--- /dev/null
@@ -0,0 +1,91 @@
+Frequently-Asked Questions (FAQ)
+================================
+
+How do I update a Pull Request?
+-------------------------------
+
+Often it is necessary to update a Pull Request (PR) before it is merged.  When
+you push to the source topic branch of an open PR, the PR is automatically
+updated with the new commits.
+
+If you need to modify existing commits in the PR (for example following review
+comments), then use the ``--force`` option when pushing. Any comments that apply
+to previous versions of the PR are retained in the PR. Sometimes it may be
+confusing whether comments apply to the current or a previous version of the PR,
+especially if there are several rounds of rework. In this case, you may be asked
+to close the PR and create a new one with the latest commits. The new PR should
+have a version appended to the name (e.g. "My topic v2") and you should create a
+link to the old PR so that reviewers can easily find previous versions.
+
+When the PR is finally merged, you will be given the option of deleting your
+topic branch. It is recommended you delete this (and any previous topic branch
+versions) to avoid polluting your fork with obsolete branches.
+
+How long will my Pull Request take to merge?
+--------------------------------------------
+
+This can vary a lot, depending on:
+
+* How important the Pull Request (PR) is considered by the TF maintainers. Where
+  possible, you should indicate the required timescales for merging the PR and
+  the impact of any delay.
+
+* The quality of the PR. PRs are likely to be merged quicker if they follow the
+  coding guidelines, have already had some code review, and have been
+  appropriately tested. Note that PRs from Arm engineers go through an internal
+  review process before appearing on GitHub, therefore may appear to be merged
+  more quickly.
+
+* The impact of the PR. For example, a PR that changes a key generic API is
+  likely to receive much greater scrutiny than a local change to a specific
+  platform port.
+
+* How much opportunity for external review is required. For example, the TF
+  maintainers may not wait for external review comments to merge trivial
+  bug-fixes but may wait up to a week to merge major changes, or ones requiring
+  feedback from specific parties.
+
+* How many other topics need to be integrated and the risk of conflict between
+  the topics.
+
+* Is there a code freeze in place in preparation for the release. Please refer
+  the `release information`_ for more details.
+
+* The workload of the TF maintainers.
+
+Feel free to add a comment to your PR to get an estimate of when it will
+be merged.
+
+How long will it take for my merged Pull Request to go from ``integration`` to ``master``?
+------------------------------------------------------------------------------------------
+
+This depends on how many concurrent Pull Requests (PRs) are being processed at
+the same time. In simple cases where all potential regressions have already been
+tested, the delay will be less than 1 day.  If the TF maintainers are trying to
+merge several things over the course of a few days, it might take up to a week.
+Typically, it will be 1-2 days.
+
+The worst case is if the TF maintainers are trying to make a release while also
+receiving PRs that will not be merged into the release. In this case, the PRs
+will be merged onto ``integration``, which will temporarily diverge from the
+release branch. The ``integration`` branch will be rebased onto ``master`` after
+the release, and then ``master`` will be fast-forwarded to ``integration`` 1-2
+days later. This whole process could take up 4 weeks. Please refer the `release
+information`_ for code freeze dates. The TF maintainers will inform the PR owner
+if this is going to happen.
+
+It is OK to create a PR based on commits that are only available in
+``integration`` or another PR, rather than ``master``. There is a risk that the
+dependency commits will change (for example due to PR rework or integration
+problems). If this happens, the dependent PR will need reworking.
+
+What are these strange comments in my Pull Request?
+---------------------------------------------------
+
+For example, comments like "Can one of the admins verify this patch?" or "test
+this please". These are associated with Arm's Continuous Integration
+infrastructure and can be safely ignored. Those who are curious can see the
+documentation for `this Jenkins plugin`_ for more details.
+
+.. _release information: release-information.rst
+.. _this Jenkins plugin: https://wiki.jenkins-ci.org/display/JENKINS/GitHub+pull+request+builder+plugin
diff --git a/docs/image-terminology.rst b/docs/image-terminology.rst
new file mode 100644 (file)
index 0000000..4dc1d73
--- /dev/null
@@ -0,0 +1,180 @@
+Image Terminology
+=================
+
+.. section-numbering::
+    :suffix: .
+
+.. contents::
+
+This page contains the current name, abbreviated name and purpose of the various
+images referred to in the Trusted Firmware project.
+
+General Notes
+-------------
+
+- Some of the names and abbreviated names have changed to accomodate new
+  requirements. The changed names are as backward compatible as possible to
+  minimize confusion. Where applicable, the previous names are indicated. Some
+  code, documentation and build artefacts may still refer to the previous names;
+  these will inevitably take time to catch up.
+
+- The main name change is to prefix each image with the processor it corresponds
+  to (for example ``AP_``, ``SCP_``, ...). In situations where there is no
+  ambiguity (for example, within AP specific code/documentation), it is
+  permitted to omit the processor prefix (for example, just BL1 instead of
+  ``AP_BL1``).
+
+- Previously, the format for 3rd level images had 2 forms; ``BL3`` was either
+  suffixed with a dash ("-") followed by a number (for example, ``BL3-1``) or a
+  subscript number, depending on whether rich text formatting was available.
+  This was confusing and often the dash gets omitted in practice. Therefore the
+  new form is to just omit the dash and not use subscript formatting.
+
+- The names no longer contain dash ("-") characters at all. In some places (for
+  example, function names) it's not possible to use this character. All dashes
+  are either removed or replaced by underscores ("_").
+
+- The abbreviation BL stands for BootLoader. This is a historical anomaly.
+  Clearly, many of these images are not BootLoaders, they are simply firmware
+  images. However, the BL abbreviation is now widely used and is retained for
+  backwards compatibility.
+
+- The image names are not case sensitive. For example, ``bl1`` is
+  interchangeable with ``BL1``, although mixed case should be avoided.
+
+Trusted Firmware Images
+-----------------------
+
+AP Boot ROM: ``AP_BL1``
+~~~~~~~~~~~~~~~~~~~~~~~
+
+Typically, this is the first code to execute on the AP and cannot be modified.
+Its primary purpose is to perform the minimum intialization necessary to load
+and authenticate an updateable AP firmware image into an executable RAM
+location, then hand-off control to that image.
+
+AP RAM Firmware: ``AP_BL2``
+~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+This is the 2nd stage AP firmware. It is currently also known as the "Trusted
+Boot Firmware". Its primary purpose is to perform any additional initialization
+required to load and authenticate all 3rd level firmware images into their
+executable RAM locations, then hand-off control to the EL3 Runtime Firmware.
+
+EL3 Runtime Firmware: ``AP_BL31``
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Also known as "SoC AP firmware" or "EL3 monitor firmware". Its primary purpose
+is to handle transitions between the normal and secure world.
+
+Secure-EL1 Payload (SP): ``AP_BL32``
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Typically this is a TEE or Trusted OS, providing runtime secure services to the
+normal world. However, it may refer to a more abstract Secure-EL1 Payload (SP).
+Note that this abbreviation should only be used in systems where there is a
+single or primary image executing at Secure-EL1. In systems where there are
+potentially multiple SPs and there is no concept of a primary SP, this
+abbreviation should be avoided; use the recommended **Other AP 3rd level
+images** abbreviation instead.
+
+AP Normal World Firmware: ``AP_BL33``
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+For example, UEFI or uboot. Its primary purpose is to boot a normal world OS.
+
+Other AP 3rd level images: ``AP_BL3_XXX``
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+The abbreviated names of the existing 3rd level images imply a load/execution
+ordering (for example, ``AP_BL31 -> AP_BL32 -> AP_BL33``).  Some systems may
+have additional images and/or a different load/execution ordering. The
+abbreviated names of the existing images are retained for backward compatibility
+but new 3rd level images should be suffixed with an underscore followed by text
+identifier, not a number.
+
+In systems where 3rd level images are provided by different vendors, the
+abbreviated name should identify the vendor as well as the image
+function. For example, ``AP_BL3_ARM_RAS``.
+
+SCP Boot ROM: ``SCP_BL1`` (previously ``BL0``)
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Typically, this is the first code to execute on the SCP and cannot be modified.
+Its primary purpose is to perform the minimum intialization necessary to load
+and authenticate an updateable SCP firmware image into an executable RAM
+location, then hand-off control to that image. This may be performed in
+conjunction with other processor firmware (for example, ``AP_BL1`` and
+``AP_BL2``).
+
+This image was previously abbreviated as ``BL0`` but in some systems, the SCP
+may directly load/authenticate its own firmware. In these systems, it doesn't
+make sense to interleave the image terminology for AP and SCP; both AP and SCP
+Boot ROMs are ``BL1`` from their own point of view.
+
+SCP RAM Firmware: ``SCP_BL2`` (previously ``BL3-0``)
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+This is the 2nd stage SCP firmware. It is currently also known as the "SCP
+runtime firmware" but it could potentially be an intermediate firmware if the
+SCP needs to load/authenticate multiple 3rd level images in future.
+
+This image was previously abbreviated as BL3-0 but from the SCP's point of view,
+this has always been the 2nd stage firmware. The previous name is too
+AP-centric.
+
+Firmware Update (FWU) Images
+----------------------------
+
+The terminology for these images has not been widely adopted yet but they have
+to be considered in a production Trusted Board Boot solution.
+
+AP Firmware Update Boot ROM: ``AP_NS_BL1U``
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Typically, this is the first normal world code to execute on the AP during a
+firmware update operation, and cannot be modified. Its primary purpose is to
+load subequent firmware update images from an external interface and communicate
+with ``AP_BL1`` to authenticate those images.
+
+During firmware update, there are (potentially) multiple transitions between the
+secure and normal world. The "level" of the BL image is relative to the world
+it's in so it makes sense to encode "NS" in the normal world images. The absence
+of "NS" implies a secure world image.
+
+AP Firmware Update Config: ``AP_BL2U``
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+This image does the minimum necessary AP secure world configuration required to
+complete the firmware update operation. It is potentially a subset of ``AP_BL2``
+functionality.
+
+SCP Firmware Update Config: ``SCP_BL2U`` (previously ``BL2-U0``)
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+This image does the minimum necessary SCP secure world configuration required to
+complete the firmware update operation. It is potentially a subset of
+``SCP_BL2`` functionality.
+
+AP Firmware Updater: ``AP_NS_BL2U`` (previously ``BL3-U``)
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+This is the 2nd stage AP normal world firmware updater. Its primary purpose is
+to load a new set of firmware images from an external interface and write them
+into non-volatile storage.
+
+Other Processor Firmware Images
+-------------------------------
+
+Some systems may have additional processors to the AP and SCP. For example, a
+Management Control Processor (MCP). Images for these processors should follow
+the same terminology, with the processor abbreviation prefix, followed by
+underscore and the level of the firmware image.
+
+For example,
+
+MCP Boot ROM: ``MCP_BL1``
+~~~~~~~~~~~~~~~~~~~~~~~~~
+
+MCP RAM Firmware: ``MCP_BL2``
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
index 52d1ed41b951882fcf5e08b4c22cacb79de885b5..58130cde0e8feb7d758d32383c496ded9a677a0c 100644 (file)
@@ -89,8 +89,9 @@ incorrect as they conflict with the requirements mentioned in Section 1. The
 following sub-sections describe all the possible routing models and specify
 which ones are valid or invalid. EL3 interrupts are currently supported only
 for GIC version 3.0 (Arm GICv3) and only the Secure-EL1 and Non-secure interrupt
-types are supported for GIC version 2.0 (Arm GICv2) (See 1.2). The terminology
-used in the following sub-sections is explained below.
+types are supported for GIC version 2.0 (Arm GICv2) (see `Assumptions in
+Interrupt Management Framework`_). The terminology used in the following
+sub-sections is explained below.
 
 #. **CSS**. Current Security State. ``0`` when secure and ``1`` when non-secure
 
@@ -230,8 +231,8 @@ The framework makes the following assumptions to simplify its implementation.
 
 Both aspects of interrupt management involve various components in the secure
 software stack spanning from EL3 to Secure-EL1. These components are described
-in the section 2.1. The framework stores information associated with each type
-of interrupt in the following data structure.
+in the section `Software components`_. The framework stores information
+associated with each type of interrupt in the following data structure.
 
 .. code:: c
 
@@ -244,11 +245,11 @@ of interrupt in the following data structure.
 The ``flags`` field stores the routing model for the interrupt type in
 bits[1:0]. Bit[0] stores the routing model when execution is in the secure
 state. Bit[1] stores the routing model when execution is in the non-secure
-state. As mentioned in Section 1.2.2, a value of ``0`` implies that the interrupt
-should be targeted to the FEL. A value of ``1`` implies that it should be targeted
-to EL3. The remaining bits are reserved and SBZ. The helper macro
-``set_interrupt_rm_flag()`` should be used to set the bits in the ``flags``
-parameter.
+state. As mentioned in Section `Routing model`_, a value of ``0`` implies that
+the interrupt should be targeted to the FEL. A value of ``1`` implies that it
+should be targeted to EL3. The remaining bits are reserved and SBZ. The helper
+macro ``set_interrupt_rm_flag()`` should be used to set the bits in the
+``flags`` parameter.
 
 The ``scr_el3[2]`` field also stores the routing model but as a mapping of the
 model in the ``flags`` field to the corresponding bit in the ``SCR_EL3`` for each
@@ -302,8 +303,9 @@ briefly described below.
 Interrupt registration
 ----------------------
 
-This section describes in detail the role of each software component (see 2.1)
-during the registration of a handler for an interrupt type.
+This section describes in detail the role of each software component (see
+`Software components`_) during the registration of a handler for an interrupt
+type.
 
 EL3 runtime firmware
 ~~~~~~~~~~~~~~~~~~~~
@@ -395,6 +397,8 @@ runtime firmware is responsible for programming the routing model. The SPD is
 responsible for ensuring that the routing model has been adhered to upon
 receiving an interrupt.
 
+.. _spd-int-registration:
+
 Secure payload dispatcher
 ~~~~~~~~~~~~~~~~~~~~~~~~~
 
@@ -487,6 +491,8 @@ requirements mentioned earlier.
        if (rc)
            panic();
 
+.. _sp-int-registration:
+
 Secure payload
 ~~~~~~~~~~~~~~
 
@@ -512,10 +518,10 @@ The interrupt handling framework implemented by the SP should support one or
 both these interrupt handling models depending upon the chosen routing model.
 
 The following list briefly describes how the choice of a valid routing model
-(See 1.2.3) effects the implementation of the Secure-EL1 IHF. If the choice of
-the interrupt routing model is not known to the SPD service at compile time,
-then the SP should pass this information to the SPD service at runtime during
-its initialisation phase.
+(see `Valid routing models`_) effects the implementation of the Secure-EL1
+IHF. If the choice of the interrupt routing model is not known to the SPD
+service at compile time, then the SP should pass this information to the SPD
+service at runtime during its initialisation phase.
 
 As mentioned earlier, an Arm GICv2 system is considered and it is assumed that
 the FIQ signal is used to generate Secure-EL1 interrupts and the IRQ signal
@@ -584,7 +590,10 @@ Test secure payload behavior
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
 The routing model for Secure-EL1 and non-secure interrupts chosen by the TSP is
-described in Section 2.2.2. It is known to the TSPD service at build time.
+described in Section `Secure Payload Dispatcher`__. It is known to the TSPD
+service at build time.
+
+.. __: #spd-int-registration
 
 The TSP implements an entrypoint (``tsp_sel1_intr_entry()``) for handling Secure-EL1
 interrupts taken in non-secure state and routed through the TSPD service
@@ -599,13 +608,14 @@ VBAR_EL1. It caters for the asynchronous handling model.
 
 The TSP also programs the Secure Physical Timer in the Arm Generic Timer block
 to raise a periodic interrupt (every half a second) for the purpose of testing
-interrupt management across all the software components listed in 2.1
+interrupt management across all the software components listed in `Software
+components`_.
 
 Interrupt handling
 ------------------
 
 This section describes in detail the role of each software component (see
-Section 2.1) in handling an interrupt of a particular type.
+Section `Software components`_) in handling an interrupt of a particular type.
 
 EL3 runtime firmware
 ~~~~~~~~~~~~~~~~~~~~
@@ -769,7 +779,7 @@ invoked.
    will be trashed, which is the ``ELR_EL3`` and ``SPSR_EL3``, in order to be able
    to re-enter TSP for Secure-EL1 interrupt processing. It does not need to
    save any other secure context since the TSP is expected to preserve it
-   (see Section 2.2.2.1).
+   (see section `Test secure payload dispatcher behavior`_).
 
 #. It restores the system register context for the secure state by calling
    ``cm_el1_sysregs_context_restore(SECURE);``.
@@ -823,21 +833,21 @@ interrupt may preempt Secure execution.
 It should be noted that while TSP is preempted, the TSPD only allows entry into
 the TSP either for Secure-EL1 interrupt handling or for resuming the preempted
 ``yielding`` SMC in response to the ``TSP_FID_RESUME`` SMC from the normal world.
-(See Section 3).
-
-The non-secure interrupt triggered in Secure-EL1 during ``yielding`` SMC processing
-can be routed to either EL3 or Secure-EL1 and is controlled by build option
-``TSP_NS_INTR_ASYNC_PREEMPT`` (see Section 2.2.2.1). If the build option is set,
-the TSPD will set the routing model for the non-secure interrupt to be routed to
-EL3 from secure state i.e. **TEL3=1, CSS=0** and registers
-``tspd_ns_interrupt_handler()`` as the non-secure interrupt handler. The
-``tspd_ns_interrupt_handler()`` on being invoked ensures that the interrupt
-originated from the secure state and disables routing of non-secure interrupts
-from secure state to EL3. This is to prevent further preemption (by a non-secure
-interrupt) when TSP is reentered for handling Secure-EL1 interrupts that
-triggered while execution was in the normal world. The
-``tspd_ns_interrupt_handler()`` then invokes ``tspd_handle_sp_preemption()`` for
-further handling.
+(See Section `Implication of preempted SMC on Non-Secure Software`_).
+
+The non-secure interrupt triggered in Secure-EL1 during ``yielding`` SMC
+processing can be routed to either EL3 or Secure-EL1 and is controlled by build
+option ``TSP_NS_INTR_ASYNC_PREEMPT`` (see Section `Test secure payload
+dispatcher behavior`_). If the build option is set, the TSPD will set the
+routing model for the non-secure interrupt to be routed to EL3 from secure state
+i.e. **TEL3=1, CSS=0** and registers ``tspd_ns_interrupt_handler()`` as the
+non-secure interrupt handler. The ``tspd_ns_interrupt_handler()`` on being
+invoked ensures that the interrupt originated from the secure state and disables
+routing of non-secure interrupts from secure state to EL3. This is to prevent
+further preemption (by a non-secure interrupt) when TSP is reentered for
+handling Secure-EL1 interrupts that triggered while execution was in the normal
+world. The ``tspd_ns_interrupt_handler()`` then invokes
+``tspd_handle_sp_preemption()`` for further handling.
 
 If the ``TSP_NS_INTR_ASYNC_PREEMPT`` build option is zero (default), the default
 routing model for non-secure interrupt in secure state is in effect
@@ -866,10 +876,11 @@ invoked:
 #. ``SMC_PREEMPTED`` is set in x0 and return to non secure state after
    restoring non secure context.
 
-The Normal World is expected to resume the TSP after the ``yielding`` SMC preemption
-by issuing an SMC with ``TSP_FID_RESUME`` as the function identifier (see section 3).
-The TSPD service takes the following actions in ``tspd_smc_handler()`` function
-upon receiving this SMC:
+The Normal World is expected to resume the TSP after the ``yielding`` SMC
+preemption by issuing an SMC with ``TSP_FID_RESUME`` as the function identifier
+(see section `Implication of preempted SMC on Non-Secure Software`_).  The TSPD
+service takes the following actions in ``tspd_smc_handler()`` function upon
+receiving this SMC:
 
 #. It ensures that the call originated from the non secure state. An
    assertion is raised otherwise.
@@ -898,16 +909,18 @@ Secure payload
 
 The SP should implement one or both of the synchronous and asynchronous
 interrupt handling models depending upon the interrupt routing model it has
-chosen (as described in 2.2.3).
+chosen (as described in section `Secure Payload`__).
+
+.. __: #sp-int-registration
 
 In the synchronous model, it should begin handling a Secure-EL1 interrupt after
 receiving control from the SPD service at an entrypoint agreed upon during build
 time or during the registration phase. Before handling the interrupt, the SP
 should save any Secure-EL1 system register context which is needed for resuming
-normal execution in the SP later e.g. ``SPSR_EL1,``\ ELR_EL1\`. After handling the
-interrupt, the SP could return control back to the exception level and security
-state where the interrupt was originally taken from. The SP should use an SMC32
-or SMC64 to ask the SPD service to do this.
+normal execution in the SP later e.g. ``SPSR_EL1``, ``ELR_EL1``. After handling
+the interrupt, the SP could return control back to the exception level and
+security state where the interrupt was originally taken from. The SP should use
+an SMC32 or SMC64 to ask the SPD service to do this.
 
 In the asynchronous model, the Secure Payload is responsible for handling
 non-secure and Secure-EL1 interrupts at the IRQ and FIQ vectors in its exception
@@ -922,8 +935,9 @@ Test secure payload behavior
 
 The TSPD hands control of a Secure-EL1 interrupt to the TSP at the
 ``tsp_sel1_intr_entry()``. The TSP handles the interrupt while ensuring that the
-handover agreement described in Section 2.2.2.1 is maintained. It updates some
-statistics by calling ``tsp_update_sync_sel1_intr_stats()``. It then calls
+handover agreement described in Section `Test secure payload dispatcher
+behavior`_ is maintained. It updates some statistics by calling
+``tsp_update_sync_sel1_intr_stats()``. It then calls
 ``tsp_common_int_handler()`` which.
 
 #. Checks whether the interrupt is the secure physical timer interrupt. It
@@ -947,18 +961,19 @@ The TSP handles interrupts under the asynchronous model as follows.
 #. Secure-EL1 interrupts are handled by calling the ``tsp_common_int_handler()``
    function. The function has been described above.
 
-#. Non-secure interrupts are handled by by calling the ``tsp_common_int_handler()``
+#. Non-secure interrupts are handled by calling the ``tsp_common_int_handler()``
    function which ends up invoking ``tsp_handle_preemption()`` and issuing an
    SMC64 with ``TSP_PREEMPTED`` as the function identifier. Execution resumes at
-   the instruction that follows this SMC instruction when the TSPD hands
-   control to the TSP in response to an SMC with ``TSP_FID_RESUME`` as the
-   function identifier from the non-secure state (see section 2.3.2.4).
+   the instruction that follows this SMC instruction when the TSPD hands control
+   to the TSP in response to an SMC with ``TSP_FID_RESUME`` as the function
+   identifier from the non-secure state (see section `Test secure payload
+   dispatcher non-secure interrupt handling`_).
 
-#. .. rubric:: Other considerations
-      :name: other-considerations
+Other considerations
+--------------------
 
 Implication of preempted SMC on Non-Secure Software
----------------------------------------------------
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
 A ``yielding`` SMC call to Secure payload can be preempted by a non-secure
 interrupt and the execution can return to the non-secure world for handling
@@ -1001,7 +1016,7 @@ TSP by returning ``SMC_UNK`` error.
 
 --------------
 
-*Copyright (c) 2014-2018, Arm Limited and Contributors. All rights reserved.*
+*Copyright (c) 2014-2019, Arm Limited and Contributors. All rights reserved.*
 
 .. _Porting Guide: ./porting-guide.rst
 .. _SMC calling convention: http://infocenter.arm.com/help/topic/com.arm.doc.den0028a/index.html
diff --git a/docs/plat/fvp_ve.rst b/docs/plat/fvp_ve.rst
new file mode 100644 (file)
index 0000000..c6d67c0
--- /dev/null
@@ -0,0 +1,81 @@
+Description
+===========
+
+Versatile Express (VE) family development platform provides an
+ultra fast environment for prototyping arm-v7 System-on-Chip designs.
+VE Fixed Virtual Platforms (FVP) are simulations of Versatile Express boards.
+The platform in arm-trusted-firmware has been verified with Arm Cortex-A5
+and Cortex-A7 VE FVP's. This platform is tested on and only expected to work
+with single core models.
+
+Boot Sequence
+=============
+
+BL1 --> BL2 --> BL32(sp_min) --> BL33(u-boot) --> Linux kernel
+
+How to build
+============
+
+Code Locations
+---------------
+-  `U-boot <https://git.linaro.org/landing-teams/working/arm/u-boot.git>`__
+
+-  `arm-trusted-firmware <https://github.com/ARM-software/arm-trusted-firmware>`__
+
+Build Procedure
+---------------
+
+-  Obtain arm toolchain. The software stack has been verified with linaro 6.2
+   `arm-linux-gnueabihf <https://releases.linaro.org/components/toolchain/binaries/6.2-2016.11/arm-linux-gnueabihf/>`__.
+   Set the CROSS_COMPILE environment variable to point to the toolchain folder.
+
+-  Fetch and build u-boot.
+   Make the .config file using the command:
+
+   .. code:: shell
+
+      make ARCH=arm vexpress_aemv8a_aarch32_config
+
+   Make the u-boot binary for Cortex-A5 using the command:
+
+   .. code:: shell
+
+     make ARCH=arm SUPPORT_ARCH_TIMER=no
+
+   Make the u-boot binary for Cortex-A7 using the command:
+
+   .. code:: shell
+
+     make ARCH=arm
+
+
+-  Build TF-A:
+
+   The make command for Cortex-A5 is:
+
+   .. code:: shell
+
+       make PLAT=fvp_ve ARCH=aarch32 ARM_ARCH_MAJOR=7 ARM_CORTEX_A5=yes \
+       AARCH32_SP=sp_min FVP_HW_CONFIG_DTS=fdts/fvp-ve-Cortex-A5x1.dts \
+       ARM_XLAT_TABLES_LIB_V1=1 BL33=<path_to_u-boot.bin> all fip
+
+   The make command for Cortex-A7 is:
+
+   .. code:: shell
+
+      make PLAT=fvp_ve ARCH=aarch32 ARM_ARCH_MAJOR=7 ARM_CORTEX_A7=yes \
+      AARCH32_SP=sp_min FVP_HW_CONFIG_DTS=fdts/fvp-ve-Cortex-A7x1.dts  \
+      BL33=<path_to_u-boot.bin> all fip
+
+Run Procedure
+-------------
+
+The following model parameters should be used to boot Linux using the build of
+arm-trusted-firmware-a made using the above make commands:
+
+  .. code:: shell
+
+    ./<path_to_model> <path_to_bl1.elf> \
+          -C motherboard.flashloader1.fname=<path_to_fip.bin> \
+          --data cluster.cpu0=<path_to_zImage>@0x80080000  \
+          --data cluster.cpu0=<path_to_ramdisk>@0x84000000
index 7ed0f2c82b4eb8505ce3de385d30878a08c3b4a7..6a03b12834ac5d167b6c07ed44545b7e28c7ea63 100644 (file)
@@ -82,6 +82,16 @@ Tegra132: TLK
 Tegra210: TLK and Trusty
 Tegra186: Trusty
 
+Scatter files
+=============
+
+Tegra platforms currently support scatter files and ld.S scripts. The scatter
+files help support ARMLINK linker to generate BL31 binaries. For now, there
+exists a common scatter file, plat/nvidia/tegra/scat/bl31.scat, for all Tegra
+SoCs. The `LINKER` build variable needs to point to the ARMLINK binary for
+the scatter file to be used. Tegra platforms have verified BL31 image generation
+with ARMCLANG (compilation) and ARMLINK (linking) for the Tegra186 platforms.
+
 Preparing the BL31 image to run on Tegra SoCs
 =============================================
 
index f8379b4ebe0da01b1fc09c1b7d308ac68dcddc52..bfae9ccc80507bb084086f34b3b68ce9c27c2299 100644 (file)
@@ -4,6 +4,8 @@ Trusted Firmware-A for STM32MP1
 STM32MP1 is a microprocessor designed by STMicroelectronics
 based on a dual Arm Cortex-A7.
 It is an Armv7-A platform, using dedicated code from TF-A.
+The STM32MP1 chip also embeds a Cortex-M4.
+More information can be found on `STM32MP1 Series`_ page.
 
 
 Design
@@ -78,7 +80,7 @@ To build:
     make CROSS_COMPILE=arm-linux-gnueabihf- PLAT=stm32mp1 ARCH=aarch32 ARM_ARCH_MAJOR=7 AARCH32_SP=sp_min
     cd <u-boot_directory>
     make stm32mp15_basic_defconfig
-    make DEVICE_TREE=stm32mp157c_ev1 all
+    make DEVICE_TREE=stm32mp157c-ev1 all
     ./tools/mkimage -T stm32image -a 0xC0100000 -e 0xC0100000 -d u-boot.bin u-boot.stm32
 
 The following build options are supported:
@@ -96,3 +98,6 @@ It should contain at least those partitions:
 - ssbl: to copy the u-boot.stm32 binary
 
 Usually, two copies of fsbl are used (fsbl1 and fsbl2) instead of one partition fsbl.
+
+
+.. _STM32MP1 Series: https://www.st.com/en/microcontrollers-microprocessors/stm32mp1-series.html
index 230a99055f25d0eaa619f62f9e53e79197ce4f7d..ad68709a3e377ffd2fe65620aa188b7f396c9778 100644 (file)
@@ -22,7 +22,7 @@ Function: unsigned int plat_ic_get_running_priority(void); [optional]
 
 This API should return the priority of the interrupt the PE is currently
 servicing. This must be be called only after an interrupt has already been
-acknowledged via. ``plat_ic_acknowledge_interrupt``.
+acknowledged via ``plat_ic_acknowledge_interrupt``.
 
 In the case of Arm standard platforms using GIC, the *Running Priority Register*
 is read to determine the priority of the interrupt.
index 7a3963bda88c24b896d42cb91ac73d13cc7b5fc5..3ea86b04fe9d7a457666b3ee203ac8893fc5aa89 100644 (file)
@@ -1792,6 +1792,22 @@ defined by the translation library, and can be found in the file
 On DynamIQ systems, this function must not use stack while enabling MMU, which
 is how the function in xlat table library version 2 is implemented.
 
+Function : plat_init_apiakey [optional]
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+::
+
+    Argument : void
+    Return   : uint64_t *
+
+This function populates the ``plat_apiakey`` array that contains the values used
+to set the ``APIAKey{Hi,Lo}_EL1`` registers. It returns a pointer to this array.
+
+The value should be obtained from a reliable source of randomness.
+
+This function is only needed if ARMv8.3 pointer authentication is used in the
+Trusted Firmware by building with ``ENABLE_PAUTH=1``.
+
 Function : plat_get_syscnt_freq2() [mandatory]
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
@@ -1920,7 +1936,7 @@ handler (if present) is called for the CPU power domain.
 
 The ``power-state`` parameter of a PSCI ``CPU_SUSPEND`` call can be used to
 describe composite power states specific to a platform. The PSCI implementation
-defines a generic representation of the power-state parameter viz which is an
+defines a generic representation of the power-state parameter, which is an
 array of local power states where each index corresponds to a power domain
 level. Each entry contains the local power state the power domain at that power
 level could enter. It depends on the ``validate_power_state()`` handler to
diff --git a/docs/psci-performance-juno.rst b/docs/psci-performance-juno.rst
new file mode 100644 (file)
index 0000000..caed8bf
--- /dev/null
@@ -0,0 +1,288 @@
+PSCI Performance Measurements on Arm Juno Development Platform
+==============================================================
+
+This document summarises the findings of performance measurements of key
+operations in the ARM Trusted Firmware (TF) Power State Coordination Interface
+(PSCI) implementation, using the in-built Performance Measurement Framework
+(PMF) and runtime instrumentation timestamps.
+
+Method
+------
+
+We used the `Juno R1 platform`_ for these tests, which has 4 x Cortex-A53 and 2
+x Cortex-A57 clusters running at the following frequencies:
+
++-----------------+--------------------+
+| Domain          | Frequency (MHz)    |
++=================+====================+
+| Cortex-A57      | 900 (nominal)      |
++-----------------+--------------------+
+| Cortex-A53      | 650 (underdrive)   |
++-----------------+--------------------+
+| AXI subsystem   | 533                |
++-----------------+--------------------+
+
+Juno supports CPU, cluster and system power down states, corresponding to power
+levels 0, 1 and 2 respectively. It does not support any retention states.
+
+We used the upstream `TF master as of 31/01/2017`_, building the platform using
+the ``ENABLE_RUNTIME_INSTRUMENTATION`` option:
+
+::
+
+    make PLAT=juno ENABLE_RUNTIME_INSTRUMENTATION=1 \
+        SCP_BL2=<path/to/scp-fw.bin>                \
+        BL33=<path/to/test-fw.bin>                  \
+        all fip
+
+When using the debug build of TF, there was no noticeable difference in the
+results.
+
+The tests are based on an ARM-internal test framework. The release build of this
+framework was used because the results in the debug build became skewed; the
+console output prevented some of the tests from executing in parallel.
+
+The tests consist of both parallel and sequential tests, which are broadly
+described as follows:
+
+- **Parallel Tests** This type of test powers on all the non-lead CPUs and
+  brings them and the lead CPU to a common synchronization point.  The lead CPU
+  then initiates the test on all CPUs in parallel.
+
+- **Sequential Tests** This type of test powers on each non-lead CPU in
+  sequence. The lead CPU initiates the test on a non-lead CPU then waits for the
+  test to complete before proceeding to the next non-lead CPU. The lead CPU then
+  executes the test on itself.
+
+In the results below, CPUs 0-3 refer to CPUs in the little cluster (A53) and
+CPUs 4-5 refer to CPUs in the big cluster (A57). In all cases CPU 4 is the lead
+CPU.
+
+``PSCI_ENTRY`` refers to the time taken from entering the TF PSCI implementation
+to the point the hardware enters the low power state (WFI). Referring to the TF
+runtime instrumentation points, this corresponds to:
+``(RT_INSTR_ENTER_HW_LOW_PWR - RT_INSTR_ENTER_PSCI)``.
+
+``PSCI_EXIT`` refers to the time taken from the point the hardware exits the low
+power state to exiting the TF PSCI implementation. This corresponds to:
+``(RT_INSTR_EXIT_PSCI - RT_INSTR_EXIT_HW_LOW_PWR)``.
+
+``CFLUSH_OVERHEAD`` refers to the part of ``PSCI_ENTRY`` taken to flush the
+caches. This corresponds to: ``(RT_INSTR_EXIT_CFLUSH - RT_INSTR_ENTER_CFLUSH)``.
+
+Note there is very little variance observed in the values given (~1us), although
+the values for each CPU are sometimes interchanged, depending on the order in
+which locks are acquired. Also, there is very little variance observed between
+executing the tests sequentially in a single boot or rebooting between tests.
+
+Given that runtime instrumentation using PMF is invasive, there is a small
+(unquantified) overhead on the results. PMF uses the generic counter for
+timestamps, which runs at 50MHz on Juno.
+
+Results and Commentary
+----------------------
+
+``CPU_SUSPEND`` to deepest power level on all CPUs in parallel
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
++-------+---------------------+--------------------+--------------------------+
+| CPU   | ``PSCI_ENTRY`` (us) | ``PSCI_EXIT`` (us) | ``CFLUSH_OVERHEAD`` (us) |
++=======+=====================+====================+==========================+
+| 0     | 27                  | 20                 | 5                        |
++-------+---------------------+--------------------+--------------------------+
+| 1     | 114                 | 86                 | 5                        |
++-------+---------------------+--------------------+--------------------------+
+| 2     | 202                 | 58                 | 5                        |
++-------+---------------------+--------------------+--------------------------+
+| 3     | 375                 | 29                 | 94                       |
++-------+---------------------+--------------------+--------------------------+
+| 4     | 20                  | 22                 | 6                        |
++-------+---------------------+--------------------+--------------------------+
+| 5     | 290                 | 18                 | 206                      |
++-------+---------------------+--------------------+--------------------------+
+
+A large variance in ``PSCI_ENTRY`` and ``PSCI_EXIT`` times across CPUs is
+observed due to TF PSCI lock contention. In the worst case, CPU 3 has to wait
+for the 3 other CPUs in the cluster (0-2) to complete ``PSCI_ENTRY`` and release
+the lock before proceeding.
+
+The ``CFLUSH_OVERHEAD`` times for CPUs 3 and 5 are higher because they are the
+last CPUs in their respective clusters to power down, therefore both the L1 and
+L2 caches are flushed.
+
+The ``CFLUSH_OVERHEAD`` time for CPU 5 is a lot larger than that for CPU 3
+because the L2 cache size for the big cluster is lot larger (2MB) compared to
+the little cluster (1MB).
+
+``CPU_SUSPEND`` to power level 0 on all CPUs in parallel
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
++-------+---------------------+--------------------+--------------------------+
+| CPU   | ``PSCI_ENTRY`` (us) | ``PSCI_EXIT`` (us) | ``CFLUSH_OVERHEAD`` (us) |
++=======+=====================+====================+==========================+
+| 0     | 116                 | 14                 | 8                        |
++-------+---------------------+--------------------+--------------------------+
+| 1     | 204                 | 14                 | 8                        |
++-------+---------------------+--------------------+--------------------------+
+| 2     | 287                 | 13                 | 8                        |
++-------+---------------------+--------------------+--------------------------+
+| 3     | 376                 | 13                 | 9                        |
++-------+---------------------+--------------------+--------------------------+
+| 4     | 29                  | 15                 | 7                        |
++-------+---------------------+--------------------+--------------------------+
+| 5     | 21                  | 15                 | 8                        |
++-------+---------------------+--------------------+--------------------------+
+
+There is no lock contention in TF generic code at power level 0 but the large
+variance in ``PSCI_ENTRY`` times across CPUs is due to lock contention in Juno
+platform code. The platform lock is used to mediate access to a single SCP
+communication channel. This is compounded by the SCP firmware waiting for each
+AP CPU to enter WFI before making the channel available to other CPUs, which
+effectively serializes the SCP power down commands from all CPUs.
+
+On platforms with a more efficient CPU power down mechanism, it should be
+possible to make the ``PSCI_ENTRY`` times smaller and consistent.
+
+The ``PSCI_EXIT`` times are consistent across all CPUs because TF does not
+require locks at power level 0.
+
+The ``CFLUSH_OVERHEAD`` times for all CPUs are small and consistent since only
+the cache associated with power level 0 is flushed (L1).
+
+``CPU_SUSPEND`` to deepest power level on all CPUs in sequence
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
++-------+---------------------+--------------------+--------------------------+
+| CPU   | ``PSCI_ENTRY`` (us) | ``PSCI_EXIT`` (us) | ``CFLUSH_OVERHEAD`` (us) |
++=======+=====================+====================+==========================+
+| 0     | 114                 | 20                 | 94                       |
++-------+---------------------+--------------------+--------------------------+
+| 1     | 114                 | 20                 | 94                       |
++-------+---------------------+--------------------+--------------------------+
+| 2     | 114                 | 20                 | 94                       |
++-------+---------------------+--------------------+--------------------------+
+| 3     | 114                 | 20                 | 94                       |
++-------+---------------------+--------------------+--------------------------+
+| 4     | 195                 | 22                 | 180                      |
++-------+---------------------+--------------------+--------------------------+
+| 5     | 21                  | 17                 | 6                        |
++-------+---------------------+--------------------+--------------------------+
+
+The ``CLUSH_OVERHEAD`` times for lead CPU 4 and all CPUs in the non-lead cluster
+are large because all other CPUs in the cluster are powered down during the
+test. The ``CPU_SUSPEND`` call powers down to the cluster level, requiring a
+flush of both L1 and L2 caches.
+
+The ``CFLUSH_OVERHEAD`` time for CPU 4 is a lot larger than those for the little
+CPUs because the L2 cache size for the big cluster is lot larger (2MB) compared
+to the little cluster (1MB).
+
+The ``PSCI_ENTRY`` and ``CFLUSH_OVERHEAD`` times for CPU 5 are low because lead
+CPU 4 continues to run while CPU 5 is suspended. Hence CPU 5 only powers down to
+level 0, which only requires L1 cache flush.
+
+``CPU_SUSPEND`` to power level 0 on all CPUs in sequence
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
++-------+---------------------+--------------------+--------------------------+
+| CPU   | ``PSCI_ENTRY`` (us) | ``PSCI_EXIT`` (us) | ``CFLUSH_OVERHEAD`` (us) |
++=======+=====================+====================+==========================+
+| 0     | 22                  | 14                 | 5                        |
++-------+---------------------+--------------------+--------------------------+
+| 1     | 22                  | 14                 | 5                        |
++-------+---------------------+--------------------+--------------------------+
+| 2     | 21                  | 14                 | 5                        |
++-------+---------------------+--------------------+--------------------------+
+| 3     | 22                  | 14                 | 5                        |
++-------+---------------------+--------------------+--------------------------+
+| 4     | 17                  | 14                 | 6                        |
++-------+---------------------+--------------------+--------------------------+
+| 5     | 18                  | 15                 | 6                        |
++-------+---------------------+--------------------+--------------------------+
+
+Here the times are small and consistent since there is no contention and it is
+only necessary to flush the cache to power level 0 (L1). This is the best case
+scenario.
+
+The ``PSCI_ENTRY`` times for CPUs in the big cluster are slightly smaller than
+for the CPUs in little cluster due to greater CPU performance.
+
+The ``PSCI_EXIT`` times are generally lower than in the last test because the
+cluster remains powered on throughout the test and there is less code to execute
+on power on (for example, no need to enter CCI coherency)
+
+``CPU_OFF`` on all non-lead CPUs in sequence then ``CPU_SUSPEND`` on lead CPU to deepest power level
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+The test sequence here is as follows:
+
+1. Call ``CPU_ON`` and ``CPU_OFF`` on each non-lead CPU in sequence.
+
+2. Program wake up timer and suspend the lead CPU to the deepest power level.
+
+3. Call ``CPU_ON`` on non-lead CPU to get the timestamps from each CPU.
+
++-------+---------------------+--------------------+--------------------------+
+| CPU   | ``PSCI_ENTRY`` (us) | ``PSCI_EXIT`` (us) | ``CFLUSH_OVERHEAD`` (us) |
++=======+=====================+====================+==========================+
+| 0     | 110                 | 28                 | 93                       |
++-------+---------------------+--------------------+--------------------------+
+| 1     | 110                 | 28                 | 93                       |
++-------+---------------------+--------------------+--------------------------+
+| 2     | 110                 | 28                 | 93                       |
++-------+---------------------+--------------------+--------------------------+
+| 3     | 111                 | 28                 | 93                       |
++-------+---------------------+--------------------+--------------------------+
+| 4     | 195                 | 22                 | 181                      |
++-------+---------------------+--------------------+--------------------------+
+| 5     | 20                  | 23                 | 6                        |
++-------+---------------------+--------------------+--------------------------+
+
+The ``CFLUSH_OVERHEAD`` times for all little CPUs are large because all other
+CPUs in that cluster are powerered down during the test. The ``CPU_OFF`` call
+powers down to the cluster level, requiring a flush of both L1 and L2 caches.
+
+The ``PSCI_ENTRY`` and ``CFLUSH_OVERHEAD`` times for CPU 5 are small because
+lead CPU 4 is running and CPU 5 only powers down to level 0, which only requires
+an L1 cache flush.
+
+The ``CFLUSH_OVERHEAD`` time for CPU 4 is a lot larger than those for the little
+CPUs because the L2 cache size for the big cluster is lot larger (2MB) compared
+to the little cluster (1MB).
+
+The ``PSCI_EXIT`` times for CPUs in the big cluster are slightly smaller than
+for CPUs in the little cluster due to greater CPU performance.  These times
+generally are greater than the ``PSCI_EXIT`` times in the ``CPU_SUSPEND`` tests
+because there is more code to execute in the "on finisher" compared to the
+"suspend finisher" (for example, GIC redistributor register programming).
+
+``PSCI_VERSION`` on all CPUs in parallel
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Since very little code is associated with ``PSCI_VERSION``, this test
+approximates the round trip latency for handling a fast SMC at EL3 in TF.
+
++-------+-------------------+
+| CPU   | TOTAL TIME (ns)   |
++=======+===================+
+| 0     | 3020              |
++-------+-------------------+
+| 1     | 2940              |
++-------+-------------------+
+| 2     | 2980              |
++-------+-------------------+
+| 3     | 3060              |
++-------+-------------------+
+| 4     | 520               |
++-------+-------------------+
+| 5     | 720               |
++-------+-------------------+
+
+The times for the big CPUs are less than the little CPUs due to greater CPU
+performance.
+
+We suspect the time for lead CPU 4 is shorter than CPU 5 due to subtle cache
+effects, given that these measurements are at the nano-second level.
+
+.. _Juno R1 platform: https://www.arm.com/files/pdf/Juno_r1_ARM_Dev_datasheet.pdf
+.. _TF master as of 31/01/2017: https://git.trustedfirmware.org/TF-A/trusted-firmware-a.git/tree/?id=c38b36d
index cea74e9af3d443699fabd2606703e5d7febe52ef..ac4d019f1ef6392362d613352e02f75b3986a3ac 100644 (file)
@@ -15,10 +15,10 @@ Serviceability (RAS) extensions. RAS is a mandatory extension for Armv8.2 and
 later CPUs, and also an optional extension to the base Armv8.0 architecture.
 
 In conjunction with the |EHF|, support for RAS extension enables firmware-first
-paradigm for handling platform errors, in which exceptions resulting from
-errors—viz. Synchronous External Abort (SEA), Asynchronous External Abort
-(signalled as SErrors), Fault Handling and Error Recovery interrupts are routed
-to and handled in EL3. The |EHF| document mentions various `error handling
+paradigm for handling platform errors: exceptions resulting from errors are
+routed to and handled in EL3. Said errors are Synchronous External Abort (SEA),
+Asynchronous External Abort (signalled as SErrors), Fault Handling and Error
+Recovery interrupts.  The |EHF| document mentions various `error handling
 use-cases`__.
 
 .. __: exception-handling.rst#delegation-use-cases
@@ -66,7 +66,7 @@ through one one of the notification mechanisms—SEAs, SErrors, or interrupts. R
 nodes contain one or more error records, which are registers through which the
 nodes advertise various properties of the signalled error. Arm recommends that
 error records are implemented in the Standard Error Record format. The RAS
-architecture allows for error records to be accessible via. system or
+architecture allows for error records to be accessible via system or
 memory-mapped registers.
 
 The platform should enumerate the error records providing for each of them:
@@ -121,7 +121,7 @@ The error handler must have the following prototype:
                int probe_data, const struct err_handler_data *const data);
 
 The ``data`` constant parameter describes the various properties of the error,
-viz. the reason for the error, exception syndrome, and also ``flags``,
+including the reason for the error, exception syndrome, and also ``flags``,
 ``cookie``, and ``handle`` parameters from the `top-level exception handler`__.
 
 .. __: interrupt-framework-design.rst#el3-interrupts
diff --git a/docs/release-information.rst b/docs/release-information.rst
new file mode 100644 (file)
index 0000000..5531150
--- /dev/null
@@ -0,0 +1,89 @@
+TF-A Release Information
+========================
+
+.. section-numbering::
+    :suffix: .
+
+.. contents::
+
+--------------
+
+Project Release Cadence
+-----------------------
+
+The project currently aims to do a release once every 6 months which will be
+tagged on the master branch. There will be a code freeze (stop merging
+non-essential PRs) up to 4 weeks prior to the target release date. The release
+candidates will start appearing after this and only bug fixes or updates
+required for the release will be merged. The maintainers are free to use their
+judgement on what PRs are essential for the release. A release branch may be
+created after code freeze if there are significant PRs that need merging onto
+the integration branch during the merge window.
+
+The release testing will be performed on release candidates and depending on
+issues found, additional release candidates may be created to fix the issues.
+
+::
+
+                            |<----------6 months---------->|
+            |<---4 weeks--->|              |<---4 weeks--->|
+       +-----------------------------------------------------------> time
+            |               |              |               |
+         code freeze       ver w.x       code freeze     ver y.z
+
+
+Upcoming Releases
+~~~~~~~~~~~~~~~~~
+
+These are the estimated dates for the upcoming release. These may change
+depending on project requirement and partner feedback.
+
++-----------------+---------------------------+------------------------------+
+| Release Version |  Target Date              | Expected Code Freeze         |
++=================+===========================+==============================+
+| v2.0            | 1st week of Oct '18       | 1st week of Sep '18          |
++-----------------+---------------------------+------------------------------+
+| v2.1            | 5th week of Mar '19       | 1st week of Mar '19          |
++-----------------+---------------------------+------------------------------+
+
+Removal of Deprecated Interfaces
+--------------------------------
+
+As mentioned in the `Platform compatibility policy`_, this is a live document
+cataloging all the deprecated interfaces in TF-A project and the Release version
+after which it will be removed.
+
++--------------------------------+-------------+---------+---------------------------------------------------------+
+| Interface                      | Deprecation | Removed | Comments                                                |
+|                                | Date        | after   |                                                         |
+|                                |             | Release |                                                         |
++================================+=============+=========+=========================================================+
+| Legacy Console API             | Jan '18     | v2.1    | Deprecated in favour of ``MULTI_CONSOLE_API``           |
++--------------------------------+-------------+---------+---------------------------------------------------------+
+| Weak default                   | Oct '18     | v2.1    | The default implementations are defined in              |
+| ``plat_crash_console_*``       |             |         | `crash_console_helpers.S`_. The platforms have to       |
+| APIs                           |             |         | define ``plat_crash_console_*``.                        |
++--------------------------------+-------------+---------+---------------------------------------------------------+
+| ``finish_console_register``    | Oct '18     | v2.1    | The old version of the macro is deprecated. See commit  |
+| macro in                       |             |         | cc5859c_ for more details.                              |
+| ``MULTI_CONSOLE_API``          |             |         |                                                         |
++--------------------------------+-------------+---------+---------------------------------------------------------+
+| Types ``tzc_action_t`` and     | Oct '18     | v2.1    | Using logical operations such as OR in enumerations     |
+| ``tzc_region_attributes_t``    |             |         | goes against the MISRA guidelines.                      |
++--------------------------------+-------------+---------+---------------------------------------------------------+
+| Macro ``EL_IMPLEMENTED()``     | Oct '18     | v2.1    | Deprecated in favour of ``el_implemented()``.           |
++--------------------------------+-------------+---------+---------------------------------------------------------+
+| ``get_afflvl_shift()``,        | Dec '18     | v2.1    | Removed.                                                |
+| ``mpidr_mask_lower_afflvls()``,|             |         |                                                         |
+| and ``eret()``.                |             |         |                                                         |
++--------------------------------+-------------+---------+---------------------------------------------------------+
+| Extra include paths in the     | Jan '18     | v2.1    | Now it is needed to use the full path of the common     |
+| Makefile in ``INCLUDES``.      |             |         | header files. More information in commit 09d40e0e0828_. |
++--------------------------------+-------------+---------+---------------------------------------------------------+
+
+*Copyright (c) 2018-2019, Arm Limited and Contributors. All rights reserved.*
+
+.. _Platform compatibility policy: platform-compatibility-policy.rst
+.. _crash_console_helpers.S: https://git.trustedfirmware.org/TF-A/trusted-firmware-a.git/tree/plat/common/aarch64/crash_console_helpers.S
+.. _cc5859c: https://git.trustedfirmware.org/TF-A/trusted-firmware-a.git/commit/?id=cc5859ca19ff546c35eb0331000dae090b6eabcf
+.. _09d40e0e0828: https://git.trustedfirmware.org/TF-A/trusted-firmware-a.git/commit/?id=09d40e0e08283a249e7dce0e106c07c5141f9b7e
index 531145f87febcdd22f4bb17a1326c6586bee268c..c52481706a1a6dbf82bdaca92d6974824abdafd2 100644 (file)
@@ -142,7 +142,7 @@ Event flags describe the properties of the event. They are bit maps that can be
 .. __: `Defining events`_
 
 -  ``SDEI_MAPF_DYNAMIC``: Marks the event as dynamic. Dynamic events can be
-   bound to (or released from) any Non-secure interrupt at runtime via. the
+   bound to (or released from) any Non-secure interrupt at runtime via the
    ``SDEI_INTERRUPT_BIND`` and ``SDEI_INTERRUPT_RELEASE`` calls.
 
 -  ``SDEI_MAPF_BOUND``: Marks the event as statically bound to an interrupt.
@@ -226,7 +226,7 @@ Explicit dispatch of events
 Typically, an SDEI event dispatch is caused by the PE receiving interrupts that
 are bound to an SDEI event. However, there are cases where the Secure world
 requires dispatch of an SDEI event as a direct or indirect result of a past
-activity, viz. receiving a Secure interrupt or an exception.
+activity, such as receiving a Secure interrupt or an exception.
 
 The SDEI dispatcher implementation provides ``sdei_dispatch_event()`` API for
 this purpose. The API has the following signature:
diff --git a/docs/security-center.rst b/docs/security-center.rst
new file mode 100644 (file)
index 0000000..672c563
--- /dev/null
@@ -0,0 +1,103 @@
+Security Center
+===============
+
+Security Disclosures
+--------------------
+
+We disclose all security vulnerabilities we find or are advised about that are
+relevant for ARM Trusted Firmware (TF). We encourage responsible disclosure of
+vulnerabilities and inform users as best we can about all possible issues.
+
+We disclose TF vulnerabilities as Security Advisories. These are listed at the
+bottom of this page and announced as issues in the `GitHub issue tracker`_ with
+the "security-advisory" tag. You can receive notification emails for these by
+watching that project.
+
+Found a Security Issue?
+-----------------------
+
+Although we try to keep TF secure, we can only do so with the help of the
+community of developers and security researchers.
+
+If you think you have found a security vulnerability, please *do not* report it
+in the `GitHub issue tracker`_. Instead send an email to
+trusted-firmware-security@arm.com
+
+Please include:
+
+* Trusted Firmware version (or commit) affected
+
+* A description of the concern or vulnerability
+
+* Details on how to replicate the vulnerability, including:
+
+  - Configuration details
+
+  - Proof of concept exploit code
+
+  - Any additional software or tools required
+
+We recommend using `this PGP/GPG key`_ for encrypting the information. This key
+is also available at http://keyserver.pgp.com and LDAP port 389 of the same
+server. The fingerprint for this key is:
+
+::
+
+    1309 2C19 22B4 8E87 F17B FE5C 3AB7 EFCB 45A0 DFD0
+
+If you would like replies to be encrypted, please provide your public key.
+
+Please give us the time to respond to you and fix the vulnerability before going
+public. We do our best to respond and fix any issues quickly. We also need to
+ensure providers of products that use TF have a chance to consider the
+implications of the vulnerability and its remedy.
+
+Afterwards, we encourage you to write-up your findings about the TF source code.
+
+Attribution
+-----------
+
+We will name and thank you in the ``change-log.rst`` distributed with the source
+code and in any published security advisory.
+
+Security Advisories
+-------------------
+
++-----------+------------------------------------------------------------------+
+| ID        | Title                                                            |
++===========+==================================================================+
+| `TFV-1`_  | Malformed Firmware Update SMC can result in copy of unexpectedly |
+|           | large data into secure memory                                    |
++-----------+------------------------------------------------------------------+
+| `TFV-2`_  | Enabled secure self-hosted invasive debug interface can allow    |
+|           | normal world to panic secure world                               |
++-----------+------------------------------------------------------------------+
+| `TFV-3`_  | RO memory is always executable at AArch64 Secure EL1             |
++-----------+------------------------------------------------------------------+
+| `TFV-4`_  | Malformed Firmware Update SMC can result in copy or              |
+|           | authentication of unexpected data in secure memory in AArch32    |
+|           | state                                                            |
++-----------+------------------------------------------------------------------+
+| `TFV-5`_  | Not initializing or saving/restoring PMCR_EL0 can leak secure    |
+|           | world timing information                                         |
++-----------+------------------------------------------------------------------+
+| `TFV-6`_  | Arm Trusted Firmware exposure to speculative processor           |
+|           | vulnerabilities using cache timing side-channels                 |
++-----------+------------------------------------------------------------------+
+| `TFV-7`_  | Trusted Firmware-A exposure to cache speculation vulnerability   |
+|           | Variant 4                                                        |
++-----------+------------------------------------------------------------------+
+| `TFV-8`_  | Not saving x0 to x3 registers can leak information from one      |
+|           | Normal World SMC client to another                               |
++-----------+------------------------------------------------------------------+
+
+.. _GitHub issue tracker: https://github.com/ARM-software/tf-issues/issues
+.. _this PGP/GPG key: security-reporting.asc
+.. _TFV-1: ./security_advisories/security-advisory-tfv-1.rst
+.. _TFV-2: ./security_advisories/security-advisory-tfv-2.rst
+.. _TFV-3: ./security_advisories/security-advisory-tfv-3.rst
+.. _TFV-4: ./security_advisories/security-advisory-tfv-4.rst
+.. _TFV-5: ./security_advisories/security-advisory-tfv-5.rst
+.. _TFV-6: ./security_advisories/security-advisory-tfv-6.rst
+.. _TFV-7: ./security_advisories/security-advisory-tfv-7.rst
+.. _TFV-8: ./security_advisories/security-advisory-tfv-8.rst
diff --git a/docs/security-reporting.asc b/docs/security-reporting.asc
new file mode 100644 (file)
index 0000000..8c41f7b
--- /dev/null
@@ -0,0 +1,45 @@
+-----BEGIN PGP PUBLIC KEY BLOCK-----
+Version: PGP Desktop 10.2.0 (Build 2317)
+
+mQENBFey/QMBCACyxJaLsMYU794ZfzLdY172tHXRJfP0X3b34HU35G7kYl1zNiYc
+/NoygtQdtDv/aW1B2A/YTNhGge+gX4BWAREd5CYDbdPEoMWC395/qbnmMmez7YNY
+PEJ9Iq9e5AayAWwZTL1zgKwdvE+WTwWok/nMbsifJSEdhdrOIHNqRcZgplUUyZ2R
+sDqFtSbACO3xj4Psk8KJ23Ax7UZgULouZOJaHOnyq8F9V/U7zWvX4Odf96XaC1Em
+cUTsG0kQfa7Y4Hqqjzowq366I4k2o2LAtuLPWNCvq5jjEceLs2+qV4cNLgyL2dzO
+wtUL6EdkrGfkxsPHpsVKXig4wjeX9ehCSqRlABEBAAG0PVRydXN0ZWQgRmlybXdh
+cmUgU2VjdXJpdHkgPHRydXN0ZWQtZmlybXdhcmUtc2VjdXJpdHlAYXJtLmNvbT6J
+AYwEEAECAHYFAley/SEwFIAAAAAAIAAHcHJlZmVycmVkLWVtYWlsLWVuY29kaW5n
+QHBncC5jb21wZ3BtaW1lCAsJCAcDAgEKAhkBGRhsZGFwOi8va2V5c2VydmVyLnBn
+cC5jb20FGwMAAAAFFgADAgEFHgEAAAAGFQgJCgMCAAoJEDq378tFoN/QFJsH/0ly
+H91LYYzKIQrbolQw7Rp47lgzH88uN1rInYpW2GaTbjwPffAhYJ4VsN8RaiFskD9m
+DjMg4vY8p0jPTCUX1Acq20Wq0Ybv3HcrtjUp4ie0+rLUi3043yJyKFMWkJC2Kr+p
+SobnxSrAie4HDFUgSaPoh9Qf1zXEzOavdgcziMiyS5iVUf6NXYZ9z82OTZ6TdPKS
+u+L5zOHTdrV3+hD54w00Xa+EIE7u4v0to6Uwm977508hyGuvpOVq+u7+S3qJQvnY
++JheStbgLsm6CyoRjyrlTE01ujAD6hI6Ef9yMgEljOBEy4phKAJ67SCRLEOiCp5U
+YHFCULwhzIyg2y3WmZSJASIEEAECAAwFAlezAnwFAwASdQAACgkQlxC4m8pXrXzd
+GAf/T8YEICI9qQt2vnCtCbBvVaTc2sAphVZ51kZVDqCDPB7znDtJYRBpi/9IPELt
+mYwIElMx2mqmahVaeUghmbzmcLZe8QHUi8GanO1mh+ook6uyjRojSIq6VUVV5uUf
+tuscfhpilOvUclqMqYEIgXfl08YwS40Kmmj0qokwad0co0zGQ8GEhlgMi2yvJfiG
+fPS0Xcn1J0980E/VgJQCAKwZvukrbb32WVwuhgepqs/4/62PZNxglcErioFt6P0A
+ik4t9Hr0uErqCeEKiYtmEw5e9ioRdX7CV+tJgIk907Tpv6E0iDFRJHmJBvmsz82O
+stOazS3wZ5Xck7asTqkvoyo9Z7kBDQRXsv0DAQgAsmL1UUIWyoNmYJWixSPDmclP
+0ul3T1FCOsIlWTeVeshnHByYdgZOfce78ETCUoq8G7qvYm4GRrEDpqVbxqTxJioP
+4Li05WDdNCKzSoqWd8ADA48gYnnJEu2NhA7ZkEC6u3+Mdbmd3M0J6nsAWeE0BV1p
+F5zI600sJuoH2QNWB7Kv5N3GCFE4IgCIH8MwDo4Y4FTZtygx4GjEtSExiOIz+bpX
+2+GkFCQGpIyLHLP4FmQmrsNzsIdEyFuG0IdoVuQ2PtNLiw+Wkm7CXWgRmFx/dtPN
+eVnOFWdbTtjBWVv/Z6zbANos2knfc75KR4FCQ6pWRvVeJuMuMopUDkfFDMtR8QAR
+AQABiQJBBBgBAgErBQJXsv0EBRsMAAAAwF0gBBkBCAAGBQJXsv0DAAoJENaB8ph8
+s9hu/nsH/Rx696ZR+1vZi5qCTUwo6s0Qa15x4OuyJEM85VgMLVY7/MZpp1Y8If6u
+A5BynQpy4QIPxIRsRx6twduW9/gb8UVhpMRPyuJ+5sSv0/KeUqkPbKSUGro2zGlR
+sjqPrchi6uafWZqOR/y/DNkEvkgZZaP+f9xs2qWKuoF08yTioo76QoroA4DVuVAT
+MkDFe9d3natAmfmjO4kvxuthg3y7R+sdXrCHpYYJZdbiR6gyj7e8whlSLwHQT3lz
+7QBL/CvVvL/dmhu5pk8fsksbehepMQTkCJ6GGEamOPEhwh7IvlzhEt97U4uzjuMd
+BPjqOCes+4QTmn/+lMTySG0kXxnHOEUACgkQOrfvy0Wg39D8Jgf/Uf3epkMOJ9xm
+N1l5vW8tQQ6RR055YQxQ9P6JMyCQGEJmGOcvrasCho69wMQDy4AYVtJaZd25LH/3
+LX/lcyDOP4C9VYXM+IxlcaRmjBKqWx9UzQeeioIkfmjMpJFU846ZP1dacge0lPx8
+p6ocPbM0rkv0xuF/dwkDQd4BPSmv4/3/UM8FRoYo8Q7SHkDR98wJ8FCm6k9wRtWC
+K/jzmBswY2TewAHom3jLzTM0FZ/n5Sini3EGAI2EvnQrxWRpeE7ZOkHKqLHEOaHl
+zeST4U/cUgxhwgnhbGJ7zmrFsHpYnnZYM3mIKfQ3/EhksZ68TF9IB1tfUiQTij4r
+9jWa0ybRdQ==
+=nZZb
+-----END PGP PUBLIC KEY BLOCK-----
diff --git a/docs/security_advisories/security-advisory-tfv-1.rst b/docs/security_advisories/security-advisory-tfv-1.rst
new file mode 100644 (file)
index 0000000..e3d1984
--- /dev/null
@@ -0,0 +1,159 @@
++----------------+-------------------------------------------------------------+
+| Title          | Malformed Firmware Update SMC can result in copy of         |
+|                | unexpectedly large data into secure memory                  |
++================+=============================================================+
+| CVE ID         | `CVE-2016-10319`_                                           |
++----------------+-------------------------------------------------------------+
+| Date           | 18 Oct 2016                                                 |
++----------------+-------------------------------------------------------------+
+| Versions       | v1.2 and v1.3 (since commit `48bfb88`_)                     |
+| Affected       |                                                             |
++----------------+-------------------------------------------------------------+
+| Configurations | Platforms that use AArch64 BL1 plus untrusted normal world  |
+| Affected       | firmware update code executing before BL31                  |
++----------------+-------------------------------------------------------------+
+| Impact         | Copy of unexpectedly large data into the free secure memory |
+|                | reported by BL1 platform code                               |
++----------------+-------------------------------------------------------------+
+| Fix Version    | `Pull Request #783`_                                        |
++----------------+-------------------------------------------------------------+
+| Credit         | IOActive                                                    |
++----------------+-------------------------------------------------------------+
+
+Generic Trusted Firmware (TF) BL1 code contains an SMC interface that is briefly
+available after cold reset to support the Firmware Update (FWU) feature (also
+known as recovery mode). This allows most FWU functionality to be implemented in
+the normal world, while retaining the essential image authentication
+functionality in BL1. When cold boot reaches the EL3 Runtime Software (for
+example, BL31 on AArch64 systems), the FWU SMC interface is replaced by the EL3
+Runtime SMC interface. Platforms may choose how much of this FWU functionality
+to use, if any.
+
+The BL1 FWU SMC handling code, currently only supported on AArch64, contains
+several vulnerabilities that may be exploited when *all* the following
+conditions apply:
+
+1. Platform code uses TF BL1 with the ``TRUSTED_BOARD_BOOT`` build option
+   enabled.
+
+2. Platform code arranges for untrusted normal world FWU code to be executed in
+   the cold boot path, before BL31 starts. Untrusted in this sense means code
+   that is not in ROM or has not been authenticated or has otherwise been
+   executed by an attacker.
+
+3. Platform code copies the insecure pattern described below from the ARM
+   platform version of ``bl1_plat_mem_check()``.
+
+The vulnerabilities consist of potential integer overflows in the input
+validation checks while handling the ``FWU_SMC_IMAGE_COPY`` SMC. The SMC
+implementation is designed to copy an image into secure memory for subsequent
+authentication, but the vulnerabilities may allow an attacker to copy
+unexpectedly large data into secure memory. Note that a separate vulnerability
+is required to leverage these vulnerabilities; for example a way to get the
+system to change its behaviour based on the unexpected secure memory contents.
+
+Two of the vulnerabilities are in the function ``bl1_fwu_image_copy()`` in
+``bl1/bl1_fwu.c``. These are listed below, referring to the v1.3 tagged version
+of the code:
+
+- Line 155:
+
+  .. code:: c
+
+    /*
+     * If last block is more than expected then
+     * clip the block to the required image size.
+     */
+    if (image_desc->copied_size + block_size >
+         image_desc->image_info.image_size) {
+        block_size = image_desc->image_info.image_size -
+            image_desc->copied_size;
+        WARN("BL1-FWU: Copy argument block_size > remaining image size."
+            " Clipping block_size\n");
+    }
+
+    /* Make sure the image src/size is mapped. */
+    if (bl1_plat_mem_check(image_src, block_size, flags)) {
+        WARN("BL1-FWU: Copy arguments source/size not mapped\n");
+        return -ENOMEM;
+    }
+
+    INFO("BL1-FWU: Continuing image copy in blocks\n");
+
+    /* Copy image for given block size. */
+    base_addr += image_desc->copied_size;
+    image_desc->copied_size += block_size;
+    memcpy((void *)base_addr, (const void *)image_src, block_size);
+    ...
+
+  This code fragment is executed when the image copy operation is performed in
+  blocks over multiple SMCs. ``block_size`` is an SMC argument and therefore
+  potentially controllable by an attacker. A very large value may result in an
+  integer overflow in the 1st ``if`` statement, which would bypass the check,
+  allowing an unclipped ``block_size`` to be passed into
+  ``bl1_plat_mem_check()``. If ``bl1_plat_mem_check()`` also passes, this may
+  result in an unexpectedly large copy of data into secure memory.
+
+- Line 206:
+
+  .. code:: c
+
+    /* Make sure the image src/size is mapped. */
+    if (bl1_plat_mem_check(image_src, block_size, flags)) {
+        WARN("BL1-FWU: Copy arguments source/size not mapped\n");
+        return -ENOMEM;
+    }
+
+    /* Find out how much free trusted ram remains after BL1 load */
+    mem_layout = bl1_plat_sec_mem_layout();
+    if ((image_desc->image_info.image_base < mem_layout->free_base) ||
+         (image_desc->image_info.image_base + image_size >
+          mem_layout->free_base + mem_layout->free_size)) {
+        WARN("BL1-FWU: Memory not available to copy\n");
+        return -ENOMEM;
+    }
+
+    /* Update the image size. */
+    image_desc->image_info.image_size = image_size;
+
+    /* Copy image for given size. */
+    memcpy((void *)base_addr, (const void *)image_src, block_size);
+    ...
+
+  This code fragment is executed during the 1st invocation of the image copy
+  operation. Both ``block_size`` and ``image_size`` are SMC arguments. A very
+  large value of ``image_size`` may result in an integer overflow in the 2nd
+  ``if`` statement, which would bypass the check, allowing execution to proceed.
+  If ``bl1_plat_mem_check()`` also passes, this may result in an unexpectedly
+  large copy of data into secure memory.
+
+If the platform's implementation of ``bl1_plat_mem_check()`` is correct then it
+may help prevent the above 2 vulnerabilities from being exploited. However, the
+ARM platform version of this function contains a similar vulnerability:
+
+- Line 88 of ``plat/arm/common/arm_bl1_fwu.c`` in function of
+  ``bl1_plat_mem_check()``:
+
+  .. code:: c
+
+    while (mmap[index].mem_size) {
+        if ((mem_base >= mmap[index].mem_base) &&
+            ((mem_base + mem_size)
+            <= (mmap[index].mem_base +
+            mmap[index].mem_size)))
+            return 0;
+
+        index++;
+    }
+    ...
+
+  This function checks that the passed memory region is within one of the
+  regions mapped in by ARM platforms. Here, ``mem_size`` may be the
+  ``block_size`` passed from ``bl1_fwu_image_copy()``. A very large value of
+  ``mem_size`` may result in an integer overflow and the function to incorrectly
+  return success. Platforms that copy this insecure pattern will have the same
+  vulnerability.
+
+.. _CVE-2016-10319: http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2016-10319
+.. _48bfb88: https://github.com/ARM-software/arm-trusted-firmware/commit/48bfb88
+.. _Pull Request #783: https://github.com/ARM-software/arm-trusted-firmware/pull/783
diff --git a/docs/security_advisories/security-advisory-tfv-2.rst b/docs/security_advisories/security-advisory-tfv-2.rst
new file mode 100644 (file)
index 0000000..db47458
--- /dev/null
@@ -0,0 +1,58 @@
++----------------+-------------------------------------------------------------+
+| Title          | Enabled secure self-hosted invasive debug interface can     |
+|                | allow normal world to panic secure world                    |
++================+=============================================================+
+| CVE ID         | `CVE-2017-7564`_                                            |
++----------------+-------------------------------------------------------------+
+| Date           | 02 Feb 2017                                                 |
++----------------+-------------------------------------------------------------+
+| Versions       | All versions up to v1.3                                     |
+| Affected       |                                                             |
++----------------+-------------------------------------------------------------+
+| Configurations | All                                                         |
+| Affected       |                                                             |
++----------------+-------------------------------------------------------------+
+| Impact         | Denial of Service (secure world panic)                      |
++----------------+-------------------------------------------------------------+
+| Fix Version    | 15 Feb 2017 `Pull Request #841`_                            |
++----------------+-------------------------------------------------------------+
+| Credit         | ARM                                                         |
++----------------+-------------------------------------------------------------+
+
+The ``MDCR_EL3.SDD`` bit controls AArch64 secure self-hosted invasive debug
+enablement. By default, the BL1 and BL31 images of the current version of ARM
+Trusted Firmware (TF) unconditionally assign this bit to ``0`` in the early
+entrypoint code, which enables debug exceptions from the secure world. This can
+be seen in the implementation of the ``el3_arch_init_common`` `AArch64 macro`_ .
+Given that TF does not currently contain support for this feature (for example,
+by saving and restoring the appropriate debug registers), this may allow a
+normal world attacker to induce a panic in the secure world.
+
+The ``MDCR_EL3.SDD`` bit should be assigned to ``1`` to disable debug exceptions
+from the secure world.
+
+Earlier versions of TF (prior to `commit 495f3d3`_) did not assign this bit.
+Since the bit has an architecturally ``UNKNOWN`` reset value, earlier versions
+may or may not have the same problem, depending on the platform.
+
+A similar issue applies to the ``MDCR_EL3.SPD32`` bits, which control AArch32
+secure self-hosted invasive debug enablement. TF assigns these bits to ``00``
+meaning that debug exceptions from Secure EL1 are enabled by the authentication
+interface. Therefore this issue only exists for AArch32 Secure EL1 code when
+secure privileged invasive debug is enabled by the authentication interface, at
+which point the device is vulnerable to other, more serious attacks anyway.
+
+However, given that TF contains no support for handling debug exceptions, the
+``MDCR_EL3.SPD32`` bits should be assigned to ``10`` to disable debug exceptions
+from AArch32 Secure EL1.
+
+Finally, this also issue applies to AArch32 platforms that use the TF SP_MIN
+image or integrate the `AArch32 equivalent`_ of the ``el3_arch_init_common``
+macro. Here the affected bits are ``SDCR.SPD``, which should also be assigned to
+``10`` instead of ``00``
+
+.. _CVE-2017-7564: http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2017-7564
+.. _commit 495f3d3: https://github.com/ARM-software/arm-trusted-firmware/commit/495f3d3
+.. _AArch64 macro: https://github.com/ARM-software/arm-trusted-firmware/blob/bcc2bf0/include/common/aarch64/el3_common_macros.S#L85
+.. _AArch32 equivalent: https://github.com/ARM-software/arm-trusted-firmware/blob/bcc2bf0/include/common/aarch32/el3_common_macros.S#L41
+.. _Pull Request #841: https://github.com/ARM-software/arm-trusted-firmware/pull/841
diff --git a/docs/security_advisories/security-advisory-tfv-3.rst b/docs/security_advisories/security-advisory-tfv-3.rst
new file mode 100644 (file)
index 0000000..28e10bf
--- /dev/null
@@ -0,0 +1,83 @@
++----------------+-------------------------------------------------------------+
+| Title          | RO memory is always executable at AArch64 Secure EL1        |
++================+=============================================================+
+| CVE ID         | `CVE-2017-7563`_                                            |
++----------------+-------------------------------------------------------------+
+| Date           | 06 Apr 2017                                                 |
++----------------+-------------------------------------------------------------+
+| Versions       | v1.3 (since `Pull Request #662`_)                           |
+| Affected       |                                                             |
++----------------+-------------------------------------------------------------+
+| Configurations | AArch64 BL2, TSP or other users of xlat_tables library      |
+| Affected       | executing at AArch64 Secure EL1                             |
++----------------+-------------------------------------------------------------+
+| Impact         | Unexpected Privilege Escalation                             |
++----------------+-------------------------------------------------------------+
+| Fix Version    | `Pull Request #924`_                                        |
++----------------+-------------------------------------------------------------+
+| Credit         | ARM                                                         |
++----------------+-------------------------------------------------------------+
+
+The translation table library in ARM Trusted Firmware (TF) (under
+``lib/xlat_tables`` and ``lib/xlat_tables_v2``) provides APIs to help program
+translation tables in the MMU. The xlat\_tables client specifies its required
+memory mappings in the form of ``mmap_region`` structures.  Each ``mmap_region``
+has memory attributes represented by the ``mmap_attr_t`` enumeration type. This
+contains flags to control data access permissions (``MT_RO``/``MT_RW``) and
+instruction execution permissions (``MT_EXECUTE``/``MT_EXECUTE_NEVER``). Thus a
+mapping specifying both ``MT_RO`` and ``MT_EXECUTE_NEVER`` should result in a
+Read-Only (RO), non-executable memory region.
+
+This feature does not work correctly for AArch64 images executing at Secure EL1.
+Any memory region mapped as RO will always be executable, regardless of whether
+the client specified ``MT_EXECUTE`` or ``MT_EXECUTE_NEVER``.
+
+The vulnerability is known to affect the BL2 and Test Secure Payload (TSP)
+images on platforms that enable the ``SEPARATE_CODE_AND_RODATA`` build option,
+which includes all ARM standard platforms, and the upstream Xilinx and NVidia
+platforms. The RO data section for these images on these platforms is
+unexpectedly executable instead of non-executable. Other platforms or
+``xlat_tables`` clients may also be affected.
+
+The vulnerability primarily manifests itself after `Pull Request #662`_.  Before
+that, ``xlat_tables`` clients could not specify instruction execution
+permissions separately to data access permissions. All RO normal memory regions
+were implicitly executable. Before `Pull Request #662`_.  the vulnerability
+would only manifest itself for device memory mapped as RO; use of this mapping
+is considered rare, although the upstream QEMU platform uses this mapping when
+the ``DEVICE2_BASE`` build option is used.
+
+Note that one or more separate vulnerabilities are also required to exploit this
+vulnerability.
+
+The vulnerability is due to incorrect handling of the execute-never bits in the
+translation tables. The EL3 translation regime uses a single ``XN`` bit to
+determine whether a region is executable. The Secure EL1&0 translation regime
+handles 2 Virtual Address (VA) ranges and so uses 2 bits, ``UXN`` and ``PXN``.
+The ``xlat_tables`` library only handles the ``XN`` bit, which maps to ``UXN``
+in the Secure EL1&0 regime. As a result, this programs the Secure EL0 execution
+permissions but always leaves the memory as executable at Secure EL1.
+
+The vulnerability is mitigated by the following factors:
+
+- The xlat\_tables library ensures that all Read-Write (RW) memory regions are
+  non-executable by setting the ``SCTLR_ELx.WXN`` bit. This overrides any value
+  of the ``XN``, ``UXN`` or ``PXN`` bits in the translation tables. See the
+  ``enable_mmu()`` function:
+
+  .. code:: c
+
+      sctlr = read_sctlr_el##_el();               \
+      sctlr |= SCTLR_WXN_BIT | SCTLR_M_BIT;       \
+
+- AArch32 configurations are unaffected. Here the ``XN`` bit controls execution
+  privileges of the currently executing translation regime, which is the desired
+  behaviour.
+
+- ARM TF EL3 code (for example BL1 and BL31) ensures that all non-secure memory
+  mapped into the secure world is non-executable by setting the ``SCR_EL3.SIF``
+  bit. See the ``el3_arch_init_common`` macro in ``el3_common_macros.S``.
+
+.. _CVE-2017-7563: http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2017-7563
+.. _Pull Request #662: https://github.com/ARM-software/arm-trusted-firmware/pull/662
+.. _Pull Request #924: https://github.com/ARM-software/arm-trusted-firmware/pull/924
diff --git a/docs/security_advisories/security-advisory-tfv-4.rst b/docs/security_advisories/security-advisory-tfv-4.rst
new file mode 100644 (file)
index 0000000..386d0da
--- /dev/null
@@ -0,0 +1,121 @@
++----------------+-------------------------------------------------------------+
+| Title          | Malformed Firmware Update SMC can result in copy or         |
+|                | authentication of unexpected data in secure memory in       |
+|                | AArch32 state                                               |
++================+=============================================================+
+| CVE ID         | `CVE-2017-9607`_                                            |
++----------------+-------------------------------------------------------------+
+| Date           | 20 Jun 2017                                                 |
++----------------+-------------------------------------------------------------+
+| Versions       | None (only between 22 May 2017 and 14 June 2017)            |
+| Affected       |                                                             |
++----------------+-------------------------------------------------------------+
+| Configurations | Platforms that use AArch32 BL1 plus untrusted normal world  |
+| Affected       | firmware update code executing before BL31                  |
++----------------+-------------------------------------------------------------+
+| Impact         | Copy or authentication of unexpected data in the secure     |
+|                | memory                                                      |
++----------------+-------------------------------------------------------------+
+| Fix Version    | `Pull Request #979`_ (merged on 14 June 2017)               |
++----------------+-------------------------------------------------------------+
+| Credit         | ARM                                                         |
++----------------+-------------------------------------------------------------+
+
+The ``include/lib/utils_def.h`` header file provides the
+``check_uptr_overflow()`` macro, which aims at detecting arithmetic overflows
+that may occur when computing the sum of a base pointer and an offset. This
+macro evaluates to 1 if the sum of the given base pointer and offset would
+result in a value large enough to wrap around, which may lead to unpredictable
+behaviour.
+
+The macro code is at line 52, referring to the version of the code as of `commit
+c396b73`_:
+
+.. code:: c
+
+    /*
+     * Evaluates to 1 if (ptr + inc) overflows, 0 otherwise.
+     * Both arguments must be unsigned pointer values (i.e. uintptr_t).
+     */
+    #define check_uptr_overflow(ptr, inc)       \
+        (((ptr) > UINTPTR_MAX - (inc)) ? 1 : 0)
+
+This macro does not work correctly for AArch32 images. It fails to detect
+overflows when the sum of its two parameters fall into the ``[2^32, 2^64 - 1]``
+range. Therefore, any AArch32 code relying on this macro to detect such integer
+overflows is actually not protected.
+
+The buggy code has been present in ARM Trusted Firmware (TF) since `Pull Request
+#678`_ was merged (on 18 August 2016). However, the upstream code was not
+vulnerable until `Pull Request #939`_ was merged (on 22 May 2017), which
+introduced AArch32 support for the Trusted Board Boot (TBB) feature. Before
+then, the ``check_uptr_overflow()`` macro was not used in AArch32 code.
+
+The vulnerability resides in the BL1 FWU SMC handling code and it may be
+exploited when *all* the following conditions apply:
+
+- Platform code uses TF BL1 with the ``TRUSTED_BOARD_BOOT`` build option.
+
+- Platform code uses the Firmware Update (FWU) code provided in
+  ``bl1/bl1_fwu.c``, which is part of the TBB support.
+
+- TF BL1 is compiled with the ``ARCH=aarch32`` build option.
+
+In this context, the AArch32 BL1 image might fail to detect potential integer
+overflows in the input validation checks while handling the
+``FWU_SMC_IMAGE_COPY`` and ``FWU_SMC_IMAGE_AUTH`` SMCs.
+
+The ``FWU_SMC_IMAGE_COPY`` SMC handler is designed to copy an image into secure
+memory for subsequent authentication. This is implemented by the
+``bl1_fwu_image_copy()`` function, which has the following function prototype:
+
+.. code:: c
+
+     static int bl1_fwu_image_copy(unsigned int image_id,
+                        uintptr_t image_src,
+                        unsigned int block_size,
+                        unsigned int image_size,
+                        unsigned int flags)
+
+``image_src`` is an SMC argument and therefore potentially controllable by an
+attacker. A very large 32-bit value, for example ``2^32 -1``, may result in the
+sum of ``image_src`` and ``block_size`` overflowing a 32-bit type, which
+``check_uptr_overflow()`` will fail to detect.  Depending on its implementation,
+the platform-specific function ``bl1_plat_mem_check()`` might get defeated by
+these unsanitized values and allow the following memory copy operation, that
+would wrap around.  This may allow an attacker to copy unexpected data into
+secure memory if the memory is mapped in BL1's address space, or cause a fatal
+exception if it's not.
+
+The ``FWU_SMC_IMAGE_AUTH`` SMC handler is designed to authenticate an image
+resident in secure memory. This is implemented by the ``bl1_fwu_image_auth()``
+function, which has the following function prototype:
+
+.. code:: c
+
+    static int bl1_fwu_image_auth(unsigned int image_id,
+                        uintptr_t image_src,
+                        unsigned int image_size,
+                        unsigned int flags)
+
+Similarly, if an attacker has control over the ``image_src`` or ``image_size``
+arguments through the SMC interface and injects high values whose sum overflows,
+they might defeat the ``bl1_plat_mem_check()`` function and make the
+authentication module read data outside of what's normally allowed by the
+platform code or crash the platform.
+
+Note that in both cases, a separate vulnerability is required to leverage this
+vulnerability; for example a way to get the system to change its behaviour based
+on the unexpected secure memory accesses.  Moreover, the normal world FWU code
+would need to be compromised in order to send a malformed FWU SMC that triggers
+an integer overflow.
+
+The vulnerability is known to affect all ARM standard platforms when enabling
+the ``TRUSTED_BOARD_BOOT`` and ``ARCH=aarch32`` build options.  Other platforms
+may also be affected if they fulfil the above conditions.
+
+.. _CVE-2017-9607: http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2017-9607
+.. _commit c396b73: https://github.com/ARM-software/arm-trusted-firmware/commit/c396b73
+.. _Pull Request #678: https://github.com/ARM-software/arm-trusted-firmware/pull/678
+.. _Pull Request #939: https://github.com/ARM-software/arm-trusted-firmware/pull/939
+.. _Pull Request #979: https://github.com/ARM-software/arm-trusted-firmware/pull/979
diff --git a/docs/security_advisories/security-advisory-tfv-5.rst b/docs/security_advisories/security-advisory-tfv-5.rst
new file mode 100644 (file)
index 0000000..4479bf0
--- /dev/null
@@ -0,0 +1,43 @@
++----------------+-------------------------------------------------------------+
+| Title          | Not initializing or saving/restoring ``PMCR_EL0`` can leak  |
+|                | secure world timing information                             |
++================+=============================================================+
+| CVE ID         | `CVE-2017-15031`_                                           |
++----------------+-------------------------------------------------------------+
+| Date           | 02 Oct 2017                                                 |
++----------------+-------------------------------------------------------------+
+| Versions       | All, up to and including v1.4                               |
+| Affected       |                                                             |
++----------------+-------------------------------------------------------------+
+| Configurations | All                                                         |
+| Affected       |                                                             |
++----------------+-------------------------------------------------------------+
+| Impact         | Leakage of sensitive secure world timing information        |
++----------------+-------------------------------------------------------------+
+| Fix Version    | `Pull Request #1127`_ (merged on 18 October 2017)           |
++----------------+-------------------------------------------------------------+
+| Credit         | Arm                                                         |
++----------------+-------------------------------------------------------------+
+
+The ``PMCR_EL0`` (Performance Monitors Control Register) provides details of the
+Performance Monitors implementation, including the number of counters
+implemented, and configures and controls the counters. If the ``PMCR_EL0.DP``
+bit is set to zero, the cycle counter (when enabled) counts during secure world
+execution, even when prohibited by the debug signals.
+
+Since Arm TF does not save and restore ``PMCR_EL0`` when switching between the
+normal and secure worlds, normal world code can set ``PMCR_EL0.DP`` to zero to
+cause leakage of secure world timing information. This register should be added
+to the list of saved/restored registers.
+
+Furthermore, ``PMCR_EL0.DP`` has an architecturally ``UNKNOWN`` reset value.
+Since Arm TF does not initialize this register, it's possible that on at least
+some implementations, ``PMCR_EL0.DP`` is set to zero by default. This and other
+bits with an architecturally UNKNOWN reset value should be initialized to
+sensible default values in the secure context.
+
+The same issue exists for the equivalent AArch32 register, ``PMCR``, except that
+here ``PMCR_EL0.DP`` architecturally resets to zero.
+
+.. _CVE-2017-15031: http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2017-15031
+.. _Pull Request #1127: https://github.com/ARM-software/arm-trusted-firmware/pull/1127
diff --git a/docs/security_advisories/security-advisory-tfv-6.rst b/docs/security_advisories/security-advisory-tfv-6.rst
new file mode 100644 (file)
index 0000000..7b556d8
--- /dev/null
@@ -0,0 +1,145 @@
++----------------+-------------------------------------------------------------+
+| Title          | Arm Trusted Firmware exposure to speculative processor      |
+|                | vulnerabilities using cache timing side-channels            |
++================+=============================================================+
+| CVE ID         | `CVE-2017-5753`_ / `CVE-2017-5715`_ / `CVE-2017-5754`_      |
++----------------+-------------------------------------------------------------+
+| Date           | 03 Jan 2018 (Updated 11 Jan, 18 Jan, 26 Jan, 30 Jan and 07  |
+|                | June 2018)                                                  |
++----------------+-------------------------------------------------------------+
+| Versions       | All, up to and including v1.4                               |
+| Affected       |                                                             |
++----------------+-------------------------------------------------------------+
+| Configurations | All                                                         |
+| Affected       |                                                             |
++----------------+-------------------------------------------------------------+
+| Impact         | Leakage of secure world data to normal world                |
++----------------+-------------------------------------------------------------+
+| Fix Version    | `Pull Request #1214`_, `Pull Request #1228`_,               |
+|                | `Pull Request #1240`_ and `Pull Request #1405`_             |
++----------------+-------------------------------------------------------------+
+| Credit         | Google / Arm                                                |
++----------------+-------------------------------------------------------------+
+
+This security advisory describes the current understanding of the Arm Trusted
+Firmware (TF) exposure to the speculative processor vulnerabilities identified
+by `Google Project Zero`_.  To understand the background and wider impact of
+these vulnerabilities on Arm systems, please refer to the `Arm Processor
+Security Update`_.
+
+Variant 1 (`CVE-2017-5753`_)
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+At the time of writing, no vulnerable patterns have been observed in upstream TF
+code, therefore no workarounds have been applied or are planned.
+
+Variant 2 (`CVE-2017-5715`_)
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Where possible on vulnerable CPUs, Arm recommends invalidating the branch
+predictor as early as possible on entry into the secure world, before any branch
+instruction is executed. There are a number of implementation defined ways to
+achieve this.
+
+For Cortex-A57 and Cortex-A72 CPUs, the Pull Requests (PRs) in this advisory
+invalidate the branch predictor when entering EL3 by disabling and re-enabling
+the MMU.
+
+For Cortex-A73 and Cortex-A75 CPUs, the PRs in this advisory invalidate the
+branch predictor when entering EL3 by temporarily dropping into AArch32
+Secure-EL1 and executing the ``BPIALL`` instruction. This workaround is
+signifiantly more complex than the "MMU disable/enable" workaround. The latter
+is not effective at invalidating the branch predictor on Cortex-A73/Cortex-A75.
+
+Note that if other privileged software, for example a Rich OS kernel, implements
+its own branch predictor invalidation during context switch by issuing an SMC
+(to execute firmware branch predictor invalidation), then there is a dependency
+on the PRs in this advisory being deployed in order for those workarounds to
+work. If that other privileged software is able to workaround the vulnerability
+locally (for example by implementing "MMU disable/enable" itself), there is no
+such dependency.
+
+`Pull Request #1240`_ and `Pull Request #1405`_ optimise the earlier fixes by
+implementing a specified `CVE-2017-5715`_ workaround SMC
+(``SMCCC_ARCH_WORKAROUND_1``) for use by normal world privileged software. This
+is more efficient than calling an arbitrary SMC (for example ``PSCI_VERSION``).
+Details of ``SMCCC_ARCH_WORKAROUND_1`` can be found in the `CVE-2017-5715
+mitigation specification`_.  The specification and implementation also enable
+the normal world to discover the presence of this firmware service.
+
+On Juno R1 we measured the round trip latency for both the ``PSCI_VERSION`` and
+``SMCCC_ARCH_WORKAROUND_1`` SMCs on Cortex-A57, using both the "MMU
+disable/enable" and "BPIALL at AArch32 Secure-EL1" workarounds described above.
+This includes the time spent in test code conforming to the SMC Calling
+Convention (SMCCC) from AArch64. For the ``SMCCC_ARCH_WORKAROUND_1`` cases, the
+test code uses SMCCC v1.1, which reduces the number of general purpose registers
+it needs to save/restore. Although the ``BPIALL`` instruction is not effective
+at invalidating the branch predictor on Cortex-A57, the drop into Secure-EL1
+with MMU disabled that this workaround entails effectively does invalidate the
+branch predictor. Hence this is a reasonable comparison.
+
+The results were as follows:
+
++------------------------------------------------------------------+-----------+
+| Test                                                             | Time (ns) |
++==================================================================+===========+
+| ``PSCI_VERSION`` baseline (without PRs in this advisory)         | 515       |
++------------------------------------------------------------------+-----------+
+| ``PSCI_VERSION`` baseline (with PRs in this advisory)            | 527       |
++------------------------------------------------------------------+-----------+
+| ``PSCI_VERSION`` with "MMU disable/enable"                       | 930       |
++------------------------------------------------------------------+-----------+
+| ``SMCCC_ARCH_WORKAROUND_1`` with "MMU disable/enable"            | 386       |
++------------------------------------------------------------------+-----------+
+| ``PSCI_VERSION`` with "BPIALL at AArch32 Secure-EL1"             | 1276      |
++------------------------------------------------------------------+-----------+
+| ``SMCCC_ARCH_WORKAROUND_1`` with "BPIALL at AArch32 Secure-EL1"  | 770       |
++------------------------------------------------------------------+-----------+
+
+Due to the high severity and wide applicability of this issue, the above
+workarounds are enabled by default (on vulnerable CPUs only), despite some
+performance and code size overhead. Platforms can choose to disable them at
+compile time if they do not require them. `Pull Request #1240`_ disables the
+workarounds for unaffected upstream platforms.
+
+For vulnerable AArch32-only CPUs (for example Cortex-A8, Cortex-A9 and
+Cortex-A17), the ``BPIALL`` instruction should be used as early as possible on
+entry into the secure world. For Cortex-A8, also set ``ACTLR[6]`` to 1 during
+early processor initialization. Note that the ``BPIALL`` instruction is not
+effective at invalidating the branch predictor on Cortex-A15. For that CPU, set
+``ACTLR[0]`` to 1 during early processor initialization, and invalidate the
+branch predictor by performing an ``ICIALLU`` instruction.
+
+On AArch32 EL3 systems, the monitor and secure-SVC code is typically tightly
+integrated, for example as part of a Trusted OS. Therefore any Variant 2
+workaround should be provided by vendors of that software and is outside the
+scope of TF. However, an example implementation in the minimal AArch32 Secure
+Payload, ``SP_MIN`` is provided in `Pull Request #1228`_.
+
+Other Arm CPUs are not vulnerable to this or other variants. This includes
+Cortex-A76, Cortex-A53, Cortex-A55, Cortex-A32, Cortex-A7 and Cortex-A5.
+
+For more information about non-Arm CPUs, please contact the CPU vendor.
+
+Variant 3 (`CVE-2017-5754`_)
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+This variant is only exploitable between Exception Levels within the same
+translation regime, for example between EL0 and EL1, therefore this variant
+cannot be used to access secure memory from the non-secure world, and is not
+applicable for TF. However, Secure Payloads (for example, Trusted OS) should
+provide mitigations on vulnerable CPUs to protect themselves from exploited
+Secure-EL0 applications.
+
+The only Arm CPU vulnerable to this variant is Cortex-A75.
+
+.. _Google Project Zero: https://googleprojectzero.blogspot.co.uk/2018/01/reading-privileged-memory-with-side.html
+.. _Arm Processor Security Update: http://www.arm.com/security-update
+.. _CVE-2017-5753: http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2017-5753
+.. _CVE-2017-5715: http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2017-5715
+.. _CVE-2017-5754: http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2017-5754
+.. _Pull Request #1214: https://github.com/ARM-software/arm-trusted-firmware/pull/1214
+.. _Pull Request #1228: https://github.com/ARM-software/arm-trusted-firmware/pull/1228
+.. _Pull Request #1240: https://github.com/ARM-software/arm-trusted-firmware/pull/1240
+.. _Pull Request #1405: https://github.com/ARM-software/arm-trusted-firmware/pull/1405
+.. _CVE-2017-5715 mitigation specification: https://developer.arm.com/cache-speculation-vulnerability-firmware-specification
diff --git a/docs/security_advisories/security-advisory-tfv-7.rst b/docs/security_advisories/security-advisory-tfv-7.rst
new file mode 100644 (file)
index 0000000..572268a
--- /dev/null
@@ -0,0 +1,104 @@
++----------------+-------------------------------------------------------------+
+| Title          | Trusted Firmware-A exposure to cache speculation            |
+|                | vulnerability Variant 4                                     |
++================+=============================================================+
+| CVE ID         | `CVE-2018-3639`_                                            |
++----------------+-------------------------------------------------------------+
+| Date           | 21 May 2018 (Updated 7 June 2018)                           |
++----------------+-------------------------------------------------------------+
+| Versions       | All, up to and including v1.5                               |
+| Affected       |                                                             |
++----------------+-------------------------------------------------------------+
+| Configurations | All                                                         |
+| Affected       |                                                             |
++----------------+-------------------------------------------------------------+
+| Impact         | Leakage of secure world data to normal world                |
++----------------+-------------------------------------------------------------+
+| Fix Version    | `Pull Request #1392`_, `Pull Request #1397`_                |
++----------------+-------------------------------------------------------------+
+| Credit         | Google                                                      |
++----------------+-------------------------------------------------------------+
+
+This security advisory describes the current understanding of the Trusted
+Firmware-A (TF-A) exposure to Variant 4 of the cache speculation vulnerabilities
+identified by `Google Project Zero`_.  To understand the background and wider
+impact of these vulnerabilities on Arm systems, please refer to the `Arm
+Processor Security Update`_.
+
+At the time of writing, the TF-A project is not aware of a Variant 4 exploit
+that could be used against TF-A. It is likely to be very difficult to achieve an
+exploit against current standard configurations of TF-A, due to the limited
+interfaces into the secure world with attacker-controlled inputs. However, this
+is becoming increasingly difficult to guarantee with the introduction of complex
+new firmware interfaces, for example the `Software Delegated Exception Interface
+(SDEI)`_.  Also, the TF-A project does not have visibility of all
+vendor-supplied interfaces. Therefore, the TF-A project takes a conservative
+approach by mitigating Variant 4 in hardware wherever possible during secure
+world execution. The mitigation is enabled by setting an implementation defined
+control bit to prevent the re-ordering of stores and loads.
+
+For each affected CPU type, TF-A implements one of the two following mitigation
+approaches in `Pull Request #1392`_ and `Pull Request #1397`_.  Both approaches
+have a system performance impact, which varies for each CPU type and use-case.
+The mitigation code is enabled by default, but can be disabled at compile time
+for platforms that are unaffected or where the risk is deemed low enough.
+
+Arm CPUs not mentioned below are unaffected.
+
+Static mitigation
+~~~~~~~~~~~~~~~~~
+
+For affected CPUs, this approach enables the mitigation during EL3
+initialization, following every PE reset. No mechanism is provided to disable
+the mitigation at runtime.
+
+This approach permanently mitigates the entire software stack and no additional
+mitigation code is required in other software components.
+
+TF-A implements this approach for the following affected CPUs:
+
+- Cortex-A57 and Cortex-A72, by setting bit 55 (Disable load pass store) of
+  ``CPUACTLR_EL1`` (``S3_1_C15_C2_0``).
+
+- Cortex-A73, by setting bit 3 of ``S3_0_C15_C0_0`` (not documented in the
+  Technical Reference Manual (TRM)).
+
+- Cortex-A75, by setting bit 35 (reserved in TRM) of ``CPUACTLR_EL1``
+  (``S3_0_C15_C1_0``).
+
+Dynamic mitigation
+~~~~~~~~~~~~~~~~~~
+
+For affected CPUs, this approach also enables the mitigation during EL3
+initialization, following every PE reset. In addition, this approach implements
+``SMCCC_ARCH_WORKAROUND_2`` in the Arm architectural range to allow callers at
+lower exception levels to temporarily disable the mitigation in their execution
+context, where the risk is deemed low enough. This approach enables mitigation
+on entry to EL3, and restores the mitigation state of the lower exception level
+on exit from EL3. For more information on this approach, see `Firmware
+interfaces for mitigating cache speculation vulnerabilities`_.
+
+This approach may be complemented by additional mitigation code in other
+software components, for example code that calls ``SMCCC_ARCH_WORKAROUND_2``.
+However, even without any mitigation code in other software components, this
+approach will effectively permanently mitigate the entire software stack, since
+the default mitigation state for firmware-managed execution contexts is enabled.
+
+Since the expectation in this approach is that more software executes with the
+mitigation disabled, this may result in better system performance than the
+static approach for some systems or use-cases.  However, for other systems or
+use-cases, this performance saving may be outweighed by the additional overhead
+of ``SMCCC_ARCH_WORKAROUND_2`` calls and TF-A exception handling.
+
+TF-A implements this approach for the following affected CPU:
+
+- Cortex-A76, by setting and clearing bit 16 (reserved in TRM) of
+  ``CPUACTLR2_EL1`` (``S3_0_C15_C1_1``).
+
+.. _Google Project Zero: https://bugs.chromium.org/p/project-zero/issues/detail?id=1528
+.. _Arm Processor Security Update: http://www.arm.com/security-update
+.. _CVE-2018-3639: http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2018-3639
+.. _Software Delegated Exception Interface (SDEI): http://infocenter.arm.com/help/topic/com.arm.doc.den0054a/ARM_DEN0054A_Software_Delegated_Exception_Interface.pdf
+.. _Firmware interfaces for mitigating cache speculation vulnerabilities: https://developer.arm.com/cache-speculation-vulnerability-firmware-specification
+.. _Pull Request #1392: https://github.com/ARM-software/arm-trusted-firmware/pull/1392
+.. _Pull Request #1397: https://github.com/ARM-software/arm-trusted-firmware/pull/1397
diff --git a/docs/security_advisories/security-advisory-tfv-8.rst b/docs/security_advisories/security-advisory-tfv-8.rst
new file mode 100644 (file)
index 0000000..eacdc7b
--- /dev/null
@@ -0,0 +1,100 @@
++----------------+-------------------------------------------------------------+
+| Title          | Not saving x0 to x3 registers can leak information from one |
+|                | Normal World SMC client to another                          |
++================+=============================================================+
+| CVE ID         | `CVE-2018-19440`_                                           |
++----------------+-------------------------------------------------------------+
+| Date           | 27 Nov 2018                                                 |
++----------------+-------------------------------------------------------------+
+| Versions       | All                                                         |
+| Affected       |                                                             |
++----------------+-------------------------------------------------------------+
+| Configurations | Multiple normal world SMC clients calling into AArch64 BL31 |
+| Affected       |                                                             |
++----------------+-------------------------------------------------------------+
+| Impact         | Leakage of SMC return values from one normal world SMC      |
+|                | client to another                                           |
++----------------+-------------------------------------------------------------+
+| Fix Version    | `Pull Request #1710`_                                       |
++----------------+-------------------------------------------------------------+
+| Credit         | Secmation                                                   |
++----------------+-------------------------------------------------------------+
+
+When taking an exception to EL3, BL31 saves the CPU context. The aim is to
+restore it before returning into the lower exception level software that called
+into the firmware. However, for an SMC exception, the general purpose registers
+``x0`` to ``x3`` are not part of the CPU context saved on the stack.
+
+As per the `SMC Calling Convention`_, up to 4 values may be returned to the
+caller in registers ``x0`` to ``x3``. In TF-A, these return values are written
+into the CPU context, typically using one of the ``SMC_RETx()`` macros provided
+in the ``include/lib/aarch64/smccc_helpers.h`` header file.
+
+Before returning to the caller, the ``restore_gp_registers()`` function is
+called. It restores the values of all general purpose registers taken from the
+CPU context stored on the stack. This includes registers ``x0`` to ``x3``, as
+can be seen in the ``lib/el3_runtime/aarch64/context.S`` file at line 339
+(referring to the version of the code as of `commit c385955`_):
+
+.. code:: c
+
+    /*
+     * This function restores all general purpose registers except x30 from the
+     * CPU context. x30 register must be explicitly restored by the caller.
+     */
+    func restore_gp_registers
+        ldp x0, x1, [sp, #CTX_GPREGS_OFFSET + CTX_GPREG_X0]
+        ldp x2, x3, [sp, #CTX_GPREGS_OFFSET + CTX_GPREG_X2]
+
+In the case of an SMC handler that does not use all 4 return values, the
+remaining ones are left unchanged in the CPU context. As a result,
+``restore_gp_registers()`` restores the stale values saved by a previous SMC
+request (or asynchronous exception to EL3) that used these return values.
+
+In the presence of multiple normal world SMC clients, this behaviour might leak
+some of the return values from one client to another. For example, if a victim
+client first sends an SMC that returns 4 values, a malicious client may then
+send a second SMC expecting no return values (for example, a
+``SDEI_EVENT_COMPLETE`` SMC) to get the 4 return values of the victim client.
+
+In general, the responsibility for mitigating threats due to the presence of
+multiple normal world SMC clients lies with EL2 software.  When present, EL2
+software must trap SMC calls from EL1 software to ensure secure behaviour.
+
+For this reason, TF-A does not save ``x0`` to ``x3`` in the CPU context on an
+SMC synchronous exception. It has behaved this way since the first version.
+
+We can confirm that at least upstream KVM-based systems mitigate this threat,
+and are therefore unaffected by this issue. Other EL2 software should be audited
+to assess the impact of this threat.
+
+EL2 software might find mitigating this threat somewhat onerous, because for all
+SMCs it would need to be aware of which return registers contain valid data, so
+it can sanitise any unused return registers. On the other hand, mitigating this
+in EL3 is relatively easy and cheap. Therefore, TF-A will now ensure that no
+information is leaked through registers ``x0`` to ``x3``, by preserving the
+register state over the call.
+
+Note that AArch32 TF-A is not affected by this issue. The SMC handling code in
+``SP_MIN`` already saves all general purpose registers - including ``r0`` to
+``r3``, as can be seen in the ``include/lib/aarch32/smccc_macros.S`` file at
+line 19 (referring to the version of the code as of `commit c385955`_):
+
+.. code:: c
+
+    /*
+     * Macro to save the General purpose registers (r0 - r12), the banked
+     * spsr, lr, sp registers and the `scr` register to the SMC context on entry
+     * due a SMC call. The `lr` of the current mode (monitor) is expected to be
+     * already saved. The `sp` must point to the `smc_ctx_t` to save to.
+     * Additionally, also save the 'pmcr' register as this is updated whilst
+     * executing in the secure world.
+     */
+        .macro smccc_save_gp_mode_regs
+        /* Save r0 - r12 in the SMC context */
+        stm sp, {r0-r12}
+
+.. _CVE-2018-19440: http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2018-19440
+.. _commit c385955: https://github.com/ARM-software/arm-trusted-firmware/commit/c385955
+.. _SMC Calling Convention: http://arminfo.emea.arm.com/help/topic/com.arm.doc.den0028b/ARM_DEN0028B_SMC_Calling_Convention.pdf
+.. _Pull Request #1710: https://github.com/ARM-software/arm-trusted-firmware/pull/1710
index 4ff1c72707a74734d62f0940ca46917d0da6017c..d3c63c751d5fdf243dd1359ca098e9046cc9fc4b 100644 (file)
@@ -358,6 +358,12 @@ Common build options
    registers to be included when saving and restoring the CPU context. Default
    is 0.
 
+-  ``CTX_INCLUDE_PAUTH_REGS``: Boolean option that, when set to 1, will cause
+   the ARMv8.3-PAuth registers to be included when saving and restoring the CPU
+   context. Note that if the hardware supports this extension and this option is
+   set to 0 the value of the registers will be leaked between Secure and
+   Non-secure worlds if PAuth is used on both sides. The default is 0.
+
 -  ``DEBUG``: Chooses between a debug and release build. It can take either 0
    (release) or 1 (debug) as values. 0 is the default.
 
@@ -405,6 +411,13 @@ Common build options
    partitioning in EL3, however. Platform initialisation code should configure
    and use partitions in EL3 as required. This option defaults to ``0``.
 
+-  ``ENABLE_PAUTH``: Boolean option to enable ARMv8.3 Pointer Authentication
+   (``ARMv8.3-PAuth``) support in the Trusted Firmware itself. Note that this
+   option doesn't affect the saving of the registers introduced with this
+   extension, they are always saved if they are detected regardless of the value
+   of this option. If enabled, it is needed to use a compiler that supports the
+   option ``-msign-return-address``. It defaults to 0.
+
 -  ``ENABLE_PIE``: Boolean option to enable Position Independent Executable(PIE)
    support within generic code in TF-A. This option is currently only supported
    in BL31. Default is 0.
@@ -535,13 +548,13 @@ Common build options
 
 -  ``KEY_ALG``: This build flag enables the user to select the algorithm to be
    used for generating the PKCS keys and subsequent signing of the certificate.
-   It accepts 3 values viz. ``rsa``, ``rsa_1_5``, ``ecdsa``. The ``rsa_1_5`` is
-   the legacy PKCS#1 RSA 1.5 algorithm which is not TBBR compliant and is
-   retained only for compatibility. The default value of this flag is ``rsa``
-   which is the TBBR compliant PKCS#1 RSA 2.1 scheme.
+   It accepts 3 values: ``rsa``, ``rsa_1_5`` and ``ecdsa``. The option
+   ``rsa_1_5`` is the legacy PKCS#1 RSA 1.5 algorithm which is not TBBR
+   compliant and is retained only for compatibility. The default value of this
+   flag is ``rsa`` which is the TBBR compliant PKCS#1 RSA 2.1 scheme.
 
 -  ``HASH_ALG``: This build flag enables the user to select the secure hash
-   algorithm. It accepts 3 values viz. ``sha256``, ``sha384``, ``sha512``.
+   algorithm. It accepts 3 values: ``sha256``, ``sha384`` and ``sha512``.
    The default value of this flag is ``sha256``.
 
 -  ``LDFLAGS``: Extra user options appended to the linkers' command line in
@@ -606,14 +619,14 @@ Common build options
    does not need to be implemented in this case.
 
 -  ``PSCI_EXTENDED_STATE_ID``: As per PSCI1.0 Specification, there are 2 formats
-   possible for the PSCI power-state parameter viz original and extended
-   State-ID formats. This flag if set to 1, configures the generic PSCI layer
-   to use the extended format. The default value of this flag is 0, which
-   means by default the original power-state format is used by the PSCI
-   implementation. This flag should be specified by the platform makefile
-   and it governs the return value of PSCI_FEATURES API for CPU_SUSPEND
-   smc function id. When this option is enabled on Arm platforms, the
-   option ``ARM_RECOM_STATE_ID_ENC`` needs to be set to 1 as well.
+   possible for the PSCI power-state parameter: original and extended State-ID
+   formats. This flag if set to 1, configures the generic PSCI layer to use the
+   extended format. The default value of this flag is 0, which means by default
+   the original power-state format is used by the PSCI implementation. This flag
+   should be specified by the platform makefile and it governs the return value
+   of PSCI_FEATURES API for CPU_SUSPEND smc function id. When this option is
+   enabled on Arm platforms, the option ``ARM_RECOM_STATE_ID_ENC`` needs to be
+   set to 1 as well.
 
 -  ``RAS_EXTENSION``: When set to ``1``, enable Armv8.2 RAS features. RAS features
    are an optional extension for pre-Armv8.2 CPUs, but are mandatory for Armv8.2
@@ -716,6 +729,12 @@ Common build options
    Note: when ``EL3_EXCEPTION_HANDLING`` is ``1``, ``TSP_NS_INTR_ASYNC_PREEMPT``
    must also be set to ``1``.
 
+-  ``USE_ARM_LINK``: This flag determines whether to enable support for ARM
+   linker. When the ``LINKER`` build variable points to the armlink linker,
+   this flag is enabled automatically. To enable support for armlink, platforms
+   will have to provide a scatter file for the BL image. Currently, Tegra
+   platforms use the armlink support to compile BL3-1 images.
+
 -  ``USE_COHERENT_MEM``: This flag determines whether to include the coherent
    memory region in the BL memory map or not (see "Use of Coherent memory in
    TF-A" section in `Firmware Design`_). It can take the value 1
index 4b73265add495af5e9259015fd63d677cf6f2d50..c56b7c41bda2f0cd5270bceac04824be65acb6e7 100644 (file)
@@ -169,7 +169,7 @@ void scpi_set_css_power_state(unsigned int mpidr,
  * In response to the query, SCP returns power states of all CPUs in all
  * clusters of the system. The returned response is then filtered based on the
  * supplied MPIDR. Power states of requested cluster and CPUs within are updated
- * via. supplied non-NULL pointer arguments.
+ * via supplied non-NULL pointer arguments.
  *
  * Returns 0 on success, or -1 on errors.
  */
@@ -223,7 +223,7 @@ int scpi_get_css_power_state(unsigned int mpidr, unsigned int *cpu_state_p,
        if (CLUSTER_ID(power_state) != cluster)
                goto exit;
 
-       /* Update power state via. pointers */
+       /* Update power state via pointers */
        if (cluster_state_p)
                *cluster_state_p = CLUSTER_POWER_STATE(power_state);
        if (cpu_state_p)
index c5d4fe1c37e26b9b087fd1fc83d8fbe32bf773a2..c5bced00d8642668e4b9996edb4e73efc897e5a2 100644 (file)
@@ -279,8 +279,8 @@ unsigned int gicv2_get_running_priority(void)
 /*******************************************************************************
  * This function sets the GICv2 target mask pattern for the current PE. The PE
  * target mask is used to translate linear PE index (returned by platform core
- * position) to a bit mask used when targeting interrupts to a PE, viz. when
- * raising SGIs and routing SPIs.
+ * position) to a bit mask used when targeting interrupts to a PE (for example
+ * when raising SGIs and routing SPIs).
  ******************************************************************************/
 void gicv2_set_pe_target_mask(unsigned int proc_num)
 {
index ae613b1345bc3da2da79f970f4a1f56cab4a7633..e9f95f2899f5981350f4f7209216e3cba1ae9978 100644 (file)
@@ -63,7 +63,14 @@ func console_pl011_core_init
        /* Program the baudrate */
        /* Divisor =  (Uart clock * 4) / baudrate */
        lsl     r1, r1, #2
+#if (ARM_ARCH_MAJOR == 7) && !defined(ARMV7_SUPPORTS_VIRTUALIZATION)
+       push    {r0,r3}
+       softudiv        r0,r1,r2,r3
+       mov     r1, r0
+       pop     {r0,r3}
+#else
        udiv    r2, r1, r2
+#endif
        /* IBRD = Divisor >> 6 */
        lsr     r1, r2, #6
        /* Write the IBRD */
index b6d02fd108cb42be605dff876ab03f4345d9e252..cdb504295f40bff299f0d556b02f7a7fe93dde69 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015-2018, ARM Limited and Contributors. All rights reserved.
+ * Copyright (c) 2015-2019, ARM Limited and Contributors. All rights reserved.
  *
  * SPDX-License-Identifier: BSD-3-Clause
  */
@@ -16,6 +16,8 @@
 #include <drivers/auth/mbedtls/mbedtls_config.h>
 #include <plat/common/platform.h>
 
+#pragma weak plat_get_mbedtls_heap
+
 static void cleanup(void)
 {
        ERROR("EXIT from BL2\n");
@@ -54,3 +56,19 @@ void mbedtls_init(void)
                ready = 1;
        }
 }
+
+/*
+ * The following default implementation of the function simply returns the
+ * by default allocated heap.
+ */
+int plat_get_mbedtls_heap(void **heap_addr, size_t *heap_size)
+{
+       static unsigned char heap[TF_MBEDTLS_HEAP_SIZE];
+
+       assert(heap_addr != NULL);
+       assert(heap_size != NULL);
+
+       *heap_addr = heap;
+       *heap_size = sizeof(heap);
+       return 0;
+}
index d7f088094b884294efd77596dae1c1e9ad5002b3..d85e4a51b0c40e4be859ed92855db6b56091365e 100644 (file)
@@ -309,7 +309,7 @@ void rcar_pwrc_clusteroff(uint64_t mpidr)
        c = rcar_pwrc_get_mpidr_cluster(mpidr);
        dst = IS_CA53(c) ? RCAR_CA53CPUCMCR : RCAR_CA57CPUCMCR;
 
-       if (RCAR_PRODUCT_M3 == product && cut <= RCAR_M3_CUT_VER11)
+       if (RCAR_PRODUCT_M3 == product && cut < RCAR_CUT_VER30)
                goto done;
 
        if (RCAR_PRODUCT_H3 == product && cut <= RCAR_CUT_VER20)
@@ -383,7 +383,7 @@ static void __attribute__ ((section(".system_ram")))
        product = reg & RCAR_PRODUCT_MASK;
        cut = reg & RCAR_CUT_MASK;
 
-       if (product == RCAR_PRODUCT_M3)
+       if (product == RCAR_PRODUCT_M3 && cut < RCAR_CUT_VER30)
                goto self_refresh;
 
        if (product == RCAR_PRODUCT_H3 && cut < RCAR_CUT_VER20)
@@ -450,7 +450,7 @@ self_refresh:
        mmio_write_32(DBSC4_REG_DBRFEN, 0U);
        rcar_micro_delay(1U);
 
-       if (product == RCAR_PRODUCT_M3)
+       if (product == RCAR_PRODUCT_M3 && cut < RCAR_CUT_VER30)
                return;
 
        if (product == RCAR_PRODUCT_H3 && cut < RCAR_CUT_VER20)
index efcd6dbb0eb64328328e057aec77e5c085fc1817..c4b6fcafeca87093fe0a90eae335203f1ad3a9b1 100644 (file)
@@ -272,8 +272,6 @@ static int rpi3_sdhost_send_cmd(struct mmc_cmd *cmd)
        }
 
        cmd_idx = cmd->cmd_idx & HC_CMD_COMMAND_MASK;
-       if (cmd_idx == MMC_CMD(17))
-               cmd_idx = MMC_CMD(18);
 
        cmd_arg = cmd->cmd_arg;
        if (cmd_idx == MMC_ACMD(51)) {
@@ -364,8 +362,12 @@ static int rpi3_sdhost_send_cmd(struct mmc_cmd *cmd)
                mmio_write_32(reg_base + HC_HOSTSTATUS,
                              HC_HSTST_MASK_ERROR_ALL);
 
+               /*
+                * If the command SEND_OP_COND returns with CRC7 error,
+                * it can be considered as having completed successfully.
+                */
                if (!(sdhsts & HC_HSTST_ERROR_CRC7)
-                   || (cmd_idx != MMC_ACMD(51))) {
+                   || (cmd_idx != MMC_CMD(1))) {
                        if (sdhsts & HC_HSTST_TIMEOUT_CMD) {
                                ERROR("rpi3_sdhost: timeout status 0x%x\n",
                                      sdhsts);
@@ -533,21 +535,6 @@ static int rpi3_sdhost_read(int lba, uintptr_t buf, size_t size)
        if (rpi3_sdhost_params.current_cmd == MMC_CMD(18))
                send_command_decorated(MMC_CMD(12), 0);
 
-       if (err == -(EILSEQ)) {
-               const int max_retries = 20;
-               int r;
-
-               rpi3_sdhost_params.crc_err_retries++;
-               if (rpi3_sdhost_params.crc_err_retries < max_retries) {
-                       /* retries if there's an CRC error */
-                       r = rpi3_sdhost_prepare(lba, buf, size);
-                       send_command_decorated(MMC_CMD(18), lba);
-                       r = rpi3_sdhost_read(lba, buf, size);
-                       if (r == 0)
-                               err = 0;
-               }
-       }
-
        return err;
 }
 
@@ -617,16 +604,20 @@ void rpi3_sdhost_init(struct rpi3_sdhost_params *params,
        }
 
        /* setting pull resistors for 48 to 53.
-        * GPIO 48 (SD_CLK) to GPIO_PULL_UP
-        * GPIO 49 (SD_CMD) to GPIO_PULL_NONE
-        * GPIO 50 (SD_D0)  to GPIO_PULL_NONE
-        * GPIO 51 (SD_D1)  to GPIO_PULL_NONE
-        * GPIO 52 (SD_D2)  to GPIO_PULL_NONE
-        * GPIO 53 (SD_D3)  to GPIO_PULL_NONE
+        * It is debatable to set SD_CLK to UP or NONE. We massively
+        * tested different brands of SD Cards and found NONE works
+        * most stable.
+        *
+        * GPIO 48 (SD_CLK) to GPIO_PULL_NONE
+        * GPIO 49 (SD_CMD) to GPIO_PULL_UP
+        * GPIO 50 (SD_D0)  to GPIO_PULL_UP
+        * GPIO 51 (SD_D1)  to GPIO_PULL_UP
+        * GPIO 52 (SD_D2)  to GPIO_PULL_UP
+        * GPIO 53 (SD_D3)  to GPIO_PULL_UP
         */
-       gpio_set_pull(48, GPIO_PULL_UP);
+       gpio_set_pull(48, GPIO_PULL_NONE);
        for (int i = 49; i <= 53; i++)
-               gpio_set_pull(i, GPIO_PULL_NONE);
+               gpio_set_pull(i, GPIO_PULL_UP);
 
        /* Set pin 48-53 to alt-0. It means route SDHOST to card slot */
        for (int i = 48; i <= 53; i++)
@@ -675,15 +666,14 @@ void rpi3_sdhost_stop(void)
                                     rpi3_sdhost_params.gpio48_pinselect[i-48]);
        }
 
-       /* Must reset the pull resistors for u-boot to work.
-        * GPIO 48 (SD_CLK) to GPIO_PULL_NONE
+       /* Reset the pull resistors before entering BL33.
+        * GPIO 48 (SD_CLK) to GPIO_PULL_UP
         * GPIO 49 (SD_CMD) to GPIO_PULL_UP
         * GPIO 50 (SD_D0)  to GPIO_PULL_UP
         * GPIO 51 (SD_D1)  to GPIO_PULL_UP
         * GPIO 52 (SD_D2)  to GPIO_PULL_UP
         * GPIO 53 (SD_D3)  to GPIO_PULL_UP
         */
-       gpio_set_pull(48, GPIO_PULL_NONE);
-       for (int i = 49; i <= 53; i++)
+       for (int i = 48; i <= 53; i++)
                gpio_set_pull(i, GPIO_PULL_UP);
 }
index c9bb9ff2b642773fec936fec5b31a81093b91546..11fd6667de32466331c5fa7587ef76f234bd9558 100644 (file)
@@ -70,6 +70,7 @@ enum stm32mp1_parent_id {
        _HCLK2,
        _CK_PER,
        _CK_MPU,
+       _CK_MCU,
        _USB_PHY_48,
        _PARENT_NB,
        _UNKNOWN_ID = 0xff,
@@ -93,6 +94,7 @@ enum stm32mp1_parent_sel {
        _QSPI_SEL,
        _FMC_SEL,
        _ASS_SEL,
+       _MSS_SEL,
        _USBPHY_SEL,
        _USBO_SEL,
        _PARENT_SEL_NB,
@@ -117,6 +119,7 @@ enum stm32mp1_div_id {
 enum stm32mp1_clksrc_id {
        CLKSRC_MPU,
        CLKSRC_AXI,
+       CLKSRC_MCU,
        CLKSRC_PLL12,
        CLKSRC_PLL3,
        CLKSRC_PLL4,
@@ -129,6 +132,7 @@ enum stm32mp1_clksrc_id {
 enum stm32mp1_clkdiv_id {
        CLKDIV_MPU,
        CLKDIV_AXI,
+       CLKDIV_MCU,
        CLKDIV_APB1,
        CLKDIV_APB2,
        CLKDIV_APB3,
@@ -272,6 +276,7 @@ static const uint8_t stm32mp1_clks[][2] = {
        { CK_PER, _CK_PER },
        { CK_MPU, _CK_MPU },
        { CK_AXI, _ACLK },
+       { CK_MCU, _CK_MCU },
        { CK_HSE, _HSE },
        { CK_CSI, _CSI },
        { CK_LSI, _LSI },
@@ -412,6 +417,10 @@ static const uint8_t ass_parents[] = {
        _HSI, _HSE, _PLL2
 };
 
+static const uint8_t mss_parents[] = {
+       _HSI, _HSE, _CSI, _PLL3
+};
+
 static const uint8_t usbphy_parents[] = {
        _HSE_KER, _PLL4_R, _HSE_KER_DIV2
 };
@@ -437,6 +446,7 @@ static const struct stm32mp1_clk_sel stm32mp1_clk_sel[_PARENT_SEL_NB] = {
        _CLK_PARENT(_QSPI_SEL, RCC_QSPICKSELR, 0, 0xf, qspi_parents),
        _CLK_PARENT(_FMC_SEL, RCC_FMCCKSELR, 0, 0xf, fmc_parents),
        _CLK_PARENT(_ASS_SEL, RCC_ASSCKSELR, 0, 0x3, ass_parents),
+       _CLK_PARENT(_MSS_SEL, RCC_MSSCKSELR, 0, 0x3, mss_parents),
        _CLK_PARENT(_USBPHY_SEL, RCC_USBCKSELR, 0, 0x3, usbphy_parents),
        _CLK_PARENT(_USBO_SEL, RCC_USBCKSELR, 4, 0x1, usbo_parents),
 };
@@ -483,6 +493,10 @@ static const struct stm32mp1_clk_pll stm32mp1_clk_pll[_PLL_NB] = {
 };
 
 /* Prescaler table lookups for clock computation */
+/* div = /1 /2 /4 /8 / 16 /64 /128 /512 */
+static const uint8_t stm32mp1_mcu_div[16] = {
+       0, 1, 2, 3, 4, 6, 7, 8, 9, 9, 9, 9, 9, 9, 9, 9
+};
 
 /* div = /1 /2 /4 /8 /16 : same divider for PMU and APBX */
 #define stm32mp1_mpu_div stm32mp1_mpu_apbx_div
@@ -549,6 +563,13 @@ bool stm32mp1_rcc_is_secure(void)
        return (mmio_read_32(rcc_base + RCC_TZCR) & RCC_TZCR_TZEN) != 0;
 }
 
+bool stm32mp1_rcc_is_mckprot(void)
+{
+       uintptr_t rcc_base = stm32mp_rcc_base();
+
+       return (mmio_read_32(rcc_base + RCC_TZCR) & RCC_TZCR_MCKPROT) != 0;
+}
+
 void stm32mp1_clk_rcc_regs_lock(void)
 {
        stm32mp1_clk_lock(&reg_lock);
@@ -775,6 +796,51 @@ static unsigned long get_clock_rate(int p)
                        break;
                }
                break;
+       /* MCU sub system */
+       case _CK_MCU:
+       case _PCLK1:
+       case _PCLK2:
+       case _PCLK3:
+               reg = mmio_read_32(rcc_base + RCC_MSSCKSELR);
+               switch (reg & RCC_SELR_SRC_MASK) {
+               case RCC_MSSCKSELR_HSI:
+                       clock = stm32mp1_clk_get_fixed(_HSI);
+                       break;
+               case RCC_MSSCKSELR_HSE:
+                       clock = stm32mp1_clk_get_fixed(_HSE);
+                       break;
+               case RCC_MSSCKSELR_CSI:
+                       clock = stm32mp1_clk_get_fixed(_CSI);
+                       break;
+               case RCC_MSSCKSELR_PLL:
+                       clock = stm32mp1_read_pll_freq(_PLL3, _DIV_P);
+                       break;
+               default:
+                       break;
+               }
+
+               /* MCU clock divider */
+               reg = mmio_read_32(rcc_base + RCC_MCUDIVR);
+               clock >>= stm32mp1_mcu_div[reg & RCC_MCUDIV_MASK];
+
+               switch (p) {
+               case _PCLK1:
+                       reg = mmio_read_32(rcc_base + RCC_APB1DIVR);
+                       clock >>= stm32mp1_apbx_div[reg & RCC_APBXDIV_MASK];
+                       break;
+               case _PCLK2:
+                       reg = mmio_read_32(rcc_base + RCC_APB2DIVR);
+                       clock >>= stm32mp1_apbx_div[reg & RCC_APBXDIV_MASK];
+                       break;
+               case _PCLK3:
+                       reg = mmio_read_32(rcc_base + RCC_APB3DIVR);
+                       clock >>= stm32mp1_apbx_div[reg & RCC_APBXDIV_MASK];
+                       break;
+               case _CK_MCU:
+               default:
+                       break;
+               }
+               break;
        case _CK_PER:
                reg = mmio_read_32(rcc_base + RCC_CPERCKSELR);
                switch (reg & RCC_SELR_SRC_MASK) {
@@ -1609,6 +1675,10 @@ int stm32mp1_clk_init(void)
        if (ret != 0) {
                return ret;
        }
+       ret = stm32mp1_set_clksrc(CLK_MCU_HSI);
+       if (ret != 0) {
+               return ret;
+       }
 
        if ((mmio_read_32(rcc_base + RCC_MP_RSTSCLRR) &
             RCC_MP_RSTSCLRR_MPUP0RSTF) != 0) {
@@ -1659,6 +1729,10 @@ int stm32mp1_clk_init(void)
        if (ret != 0) {
                return ret;
        }
+       ret = stm32mp1_set_clkdiv(clkdiv[CLKDIV_MCU], rcc_base + RCC_MCUDIVR);
+       if (ret != 0) {
+               return ret;
+       }
        ret = stm32mp1_set_clkdiv(clkdiv[CLKDIV_APB1], rcc_base + RCC_APB1DIVR);
        if (ret != 0) {
                return ret;
@@ -1757,6 +1831,10 @@ int stm32mp1_clk_init(void)
        if (ret != 0) {
                return ret;
        }
+       ret = stm32mp1_set_clksrc(clksrc[CLKSRC_MCU]);
+       if (ret != 0) {
+               return ret;
+       }
        stm32mp1_set_rtcsrc(clksrc[CLKSRC_RTC], lse_css);
 
        /* Configure PKCK */
index f4bfdde1c4fe6ae35198cc4263b9ce059e9d5335..f88de8301b868e4c6191233b41c6668501412016 100644 (file)
@@ -2094,7 +2094,9 @@ static void dbsc_regset(void)
        /* DBTR16 */
        /* WDQL : tphy_wrlat + tphy_wrdata */
        tmp[0] = ddrtbl_getval(_cnf_DDR_PI_REGSET, _reg_PI_WRLAT_F1);
-       /* DQENLTNCY : tphy_wrlat = WL-2 */
+       /* DQENLTNCY : tphy_wrlat = WL-2 : PHY_WRITE_PATH_LAT_ADD == 0
+        *             tphy_wrlat = WL-3 : PHY_WRITE_PATH_LAT_ADD != 0
+        */
        tmp[1] = ddrtbl_getval(_cnf_DDR_PI_REGSET, _reg_PI_WRLAT_ADJ_F1);
        /* DQL : tphy_rdlat + trdata_en */
        /* it is not important for dbsc */
@@ -2417,7 +2419,7 @@ static void dbsc_regset_post(void)
        /* periodic dram zqcal and phy ctrl update enable */
        mmio_write_32(DBSC_DBCALCNF, 0x01000010);
        if (((Prr_Product == PRR_PRODUCT_H3) && (Prr_Cut <= PRR_PRODUCT_11))
-           || ((Prr_Product == PRR_PRODUCT_M3) && (Prr_Cut <= PRR_PRODUCT_20))) {
+           || ((Prr_Product == PRR_PRODUCT_M3) && (Prr_Cut < PRR_PRODUCT_30))) {
                /* non : H3 Ver.1.x/M3-W Ver.1.x not support */
        } else {
 #if RCAR_DRAM_SPLIT == 2
@@ -4216,7 +4218,7 @@ int32_t rcar_dram_init(void)
        }
 
        if (((Prr_Product == PRR_PRODUCT_H3) && (Prr_Cut <= PRR_PRODUCT_11))
-           || ((Prr_Product == PRR_PRODUCT_M3) && (Prr_Cut <= PRR_PRODUCT_20))) {
+           || ((Prr_Product == PRR_PRODUCT_M3) && (Prr_Cut < PRR_PRODUCT_30))) {
                /* non : H3 Ver.1.x/M3-W Ver.1.x not support */
        } else {
                mmio_write_32(DBSC_DBSYSCNT0, 0x00001234);
@@ -4351,7 +4353,7 @@ int32_t rcar_dram_init(void)
        foreach_vch(ch)
            mmio_write_32(DBSC_DBPDLK(ch), 0x00000000);
        if (((Prr_Product == PRR_PRODUCT_H3) && (Prr_Cut <= PRR_PRODUCT_11))
-           || ((Prr_Product == PRR_PRODUCT_M3) && (Prr_Cut <= PRR_PRODUCT_20))) {
+           || ((Prr_Product == PRR_PRODUCT_M3) && (Prr_Cut < PRR_PRODUCT_30))) {
                /* non : H3 Ver.1.x/M3-W Ver.1.x not support */
        } else {
                mmio_write_32(DBSC_DBSYSCNT0, 0x00000000);
index 8040d939b18aa00d519758db2e4f67bf69bddf4e..43978c26c973449f7f52f4129b95659170fe93a4 100644 (file)
@@ -4,7 +4,7 @@
  * SPDX-License-Identifier: BSD-3-Clause
  */
 
-#define BOARDNUM 18
+#define BOARDNUM 19
 #define BOARD_JUDGE_AUTO
 
 #ifdef BOARD_JUDGE_AUTO
@@ -1322,7 +1322,58 @@ static const struct _boardcnf boardcnfs[BOARDNUM] = {
            0, 0, 0, 0, 0, 0, 0, 0}
          }
         }
-       }
+       },
+/* boardcnf[18] RENESAS SALVATOR-X board with M3-W/SIP(16Gbit 2rank) */
+       {
+        0x03,
+        0x01,
+        0x02c0,
+        0,
+        0x0300,
+        0x00a0,
+        {
+         {
+          {0x04, 0x04},
+           0x00543210,
+           0x3201,
+          {0x70612543, 0x43251670, 0x45326170, 0x10672534},
+          {0x08, 0x08, 0x08, 0x08},
+          WDQLVL_PAT,
+          {0, 0, 0, 0, 0, 0, 0, 0,
+           0, 0},
+          {0, 0, 0, 0},
+          {0, 0, 0, 0, 0, 0, 0, 0,
+           0, 0, 0, 0, 0, 0, 0, 0,
+           0, 0, 0, 0, 0, 0, 0, 0,
+           0, 0, 0, 0, 0, 0, 0, 0},
+          {0, 0, 0, 0},
+          {0, 0, 0, 0, 0, 0, 0, 0,
+           0, 0, 0, 0, 0, 0, 0, 0,
+           0, 0, 0, 0, 0, 0, 0, 0,
+           0, 0, 0, 0, 0, 0, 0, 0}
+          },
+         {
+          {0x04, 0x04},
+           0x00543210,
+           0x2310,
+          {0x01327654, 0x34526107, 0x35421670, 0x70615324},
+          {0x08, 0x08, 0x08, 0x08},
+          WDQLVL_PAT,
+          {0, 0, 0, 0, 0, 0, 0, 0,
+           0, 0},
+          {0, 0, 0, 0},
+          {0, 0, 0, 0, 0, 0, 0, 0,
+           0, 0, 0, 0, 0, 0, 0, 0,
+           0, 0, 0, 0, 0, 0, 0, 0,
+           0, 0, 0, 0, 0, 0, 0, 0},
+          {0, 0, 0, 0},
+          {0, 0, 0, 0, 0, 0, 0, 0,
+           0, 0, 0, 0, 0, 0, 0, 0,
+           0, 0, 0, 0, 0, 0, 0, 0,
+           0, 0, 0, 0, 0, 0, 0, 0}
+         }
+        }
+       },
 };
 
 void boardcnf_get_brd_clk(uint32_t brd, uint32_t * clk, uint32_t * div)
@@ -1567,9 +1618,12 @@ static uint32_t _board_judge(void)
                } else if (Prr_Product == PRR_PRODUCT_M3N) {
                        /* RENESAS SALVATOR-X (M3-N/SIP) */
                        brd = 11;
-               } else if (Prr_Product == PRR_PRODUCT_M3) {
+               } else if ((Prr_Product == PRR_PRODUCT_M3) && (Prr_Cut < PRR_PRODUCT_30)) {
                        /* RENESAS SALVATOR-X (M3-W/SIP) */
                        brd = 0;
+               } else if ((Prr_Product == PRR_PRODUCT_M3) && (Prr_Cut >= PRR_PRODUCT_30)) {
+                       /* RENESAS SALVATOR-X (M3-W ver.3.0/SIP) */
+                       brd = 18;
                }
        }
 #endif
index d72959b32f18f8b4b0618e58b92a2e95e33dc3d4..6a3d1c07837c30857c647b8365aa0258021ae73f 100644 (file)
@@ -4,7 +4,7 @@
  * SPDX-License-Identifier: BSD-3-Clause
  */
 
-#define RCAR_DDR_VERSION        "rev.0.34"
+#define RCAR_DDR_VERSION        "rev.0.35rc01"
 #define DRAM_CH_CNT            (0x04)
 #define SLICE_CNT              (0x04)
 #define CS_CNT                 (0x02)
index 2f62bb2901d0b436bde0aa3f7ead0494cc2e8c0a..e33005f5ef39ad3b5706d28f18605d1b64704988 100644 (file)
@@ -1396,6 +1396,10 @@ void pfc_init_h3_v1(void)
        mmio_write_32(GPIO_INOUTSEL2, 0x00000400U);
        mmio_write_32(GPIO_INOUTSEL3, 0x0000C000U);
        mmio_write_32(GPIO_INOUTSEL4, 0x00000000U);
+#if (RCAR_GEN3_ULCB == 1)
+       mmio_write_32(GPIO_INOUTSEL5, 0x0000000EU);
+#else
        mmio_write_32(GPIO_INOUTSEL5, 0x0000020EU);
+#endif
        mmio_write_32(GPIO_INOUTSEL6, 0x00013880U);
 }
index 116fd82ca1fe61ac332c68d1f9dd065fc306e49d..fd9be5980e462fe07b092d1ccb1bd4408f9ac03a 100644 (file)
@@ -1444,6 +1444,10 @@ void pfc_init_h3_v2(void)
        mmio_write_32(GPIO_INOUTSEL2, 0x00000400U);
        mmio_write_32(GPIO_INOUTSEL3, 0x0000C000U);
        mmio_write_32(GPIO_INOUTSEL4, 0x00000000U);
+#if (RCAR_GEN3_ULCB == 1)
+       mmio_write_32(GPIO_INOUTSEL5, 0x0000000EU);
+#else
        mmio_write_32(GPIO_INOUTSEL5, 0x0000020EU);
+#endif
        mmio_write_32(GPIO_INOUTSEL6, 0x00013880U);
 }
index fc12cd6eddfb93ebda571093675902429865e901..3bb560ffa241501a0fc0263748995135e0b53c6f 100644 (file)
@@ -1526,6 +1526,10 @@ void pfc_init_m3(void)
        mmio_write_32(GPIO_INOUTSEL2, 0x00000400U);
        mmio_write_32(GPIO_INOUTSEL3, 0x0000C000U);
        mmio_write_32(GPIO_INOUTSEL4, 0x00000000U);
+#if (RCAR_GEN3_ULCB == 1)
+       mmio_write_32(GPIO_INOUTSEL5, 0x0000000EU);
+#else
        mmio_write_32(GPIO_INOUTSEL5, 0x0000020EU);
+#endif
        mmio_write_32(GPIO_INOUTSEL6, 0x00013880U);
 }
index 07f08fa0dda5e07193a782d433f6c592dc6d5d1d..408d8793f7f3d2eaf7c8157d25e2b01a469c3096 100644 (file)
@@ -1432,6 +1432,10 @@ void pfc_init_m3n(void)
        mmio_write_32(GPIO_INOUTSEL2, 0x00000400U);
        mmio_write_32(GPIO_INOUTSEL3, 0x0000C000U);
        mmio_write_32(GPIO_INOUTSEL4, 0x00000000U);
+#if (RCAR_GEN3_ULCB == 1)
+       mmio_write_32(GPIO_INOUTSEL5, 0x0000000EU);
+#else
        mmio_write_32(GPIO_INOUTSEL5, 0x0000020EU);
+#endif
        mmio_write_32(GPIO_INOUTSEL6, 0x00013880U);
 }
diff --git a/drivers/staging/renesas/rcar/qos/M3/qos_init_m3_v30.c b/drivers/staging/renesas/rcar/qos/M3/qos_init_m3_v30.c
new file mode 100644 (file)
index 0000000..319e393
--- /dev/null
@@ -0,0 +1,245 @@
+/*
+ * Copyright (c) 2019, Renesas Electronics Corporation. All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+#include <stdint.h>
+
+#include <common/debug.h>
+
+#include "../qos_common.h"
+#include "../qos_reg.h"
+#include "qos_init_m3_v30.h"
+
+#define        RCAR_QOS_VERSION                "rev.0.1"
+
+#define QOSCTRL_EARLYR                 (QOS_BASE1 + 0x0060U)
+#define QOSCTRL_FSS                    (QOS_BASE1 + 0x0048U)
+
+#define QOSWT_TIME_BANK0                               (20000000U)     //unit:ns
+
+#define        QOSWT_WTEN_ENABLE                               (0x1U)
+
+#define QOSCTRL_REF_ARS_ARBSTOPCYCLE_M3_30     (SL_INIT_SSLOTCLK_M3_30 - 0x5U)
+
+#define OSWT_WTREF_SLOT0_EN_REQ1_SLOT  (3U)
+#define OSWT_WTREF_SLOT0_EN_REQ2_SLOT  (9U)
+#define QOSWT_WTREF_SLOT0_EN                   ((0x1U << OSWT_WTREF_SLOT0_EN_REQ1_SLOT) | (0x1U << OSWT_WTREF_SLOT0_EN_REQ2_SLOT))
+#define QOSWT_WTREF_SLOT1_EN                   ((0x1U << OSWT_WTREF_SLOT0_EN_REQ1_SLOT) | (0x1U << OSWT_WTREF_SLOT0_EN_REQ2_SLOT))
+
+#define QOSWT_WTSET0_REQ_SSLOT0                        (5U)
+#define WT_BASE_SUB_SLOT_NUM0                  (12U)
+#define QOSWT_WTSET0_PERIOD0_M3_30             ((QOSWT_TIME_BANK0/QOSWT_WTSET0_CYCLE_M3_30)-1U)
+#define QOSWT_WTSET0_SSLOT0                            (QOSWT_WTSET0_REQ_SSLOT0 -1U)
+#define QOSWT_WTSET0_SLOTSLOT0                 (WT_BASE_SUB_SLOT_NUM0 -1U)
+
+#define QOSWT_WTSET1_PERIOD1_M3_30             ((QOSWT_TIME_BANK0/QOSWT_WTSET0_CYCLE_M3_30)-1U)
+#define QOSWT_WTSET1_SSLOT1                            (QOSWT_WTSET0_REQ_SSLOT0 -1U)
+#define QOSWT_WTSET1_SLOTSLOT1                 (WT_BASE_SUB_SLOT_NUM0 -1U)
+
+#if RCAR_QOS_TYPE  == RCAR_QOS_TYPE_DEFAULT
+
+/* Same as M3 Ver.1.1 default setting */
+#if RCAR_REF_INT == RCAR_REF_DEFAULT
+#include "qos_init_m3_v11_mstat195.h"
+#else
+#include "qos_init_m3_v11_mstat390.h"
+#endif
+
+#if RCAR_REWT_TRAINING != RCAR_REWT_TRAINING_DISABLE
+
+/* Same as M3 Ver.1.1 default setting */
+#if RCAR_REF_INT == RCAR_REF_DEFAULT
+#include "qos_init_m3_v11_qoswt195.h"
+#else
+#include "qos_init_m3_v11_qoswt390.h"
+#endif
+
+#endif /* RCAR_REWT_TRAINING != RCAR_REWT_TRAINING_DISABLE */
+#endif
+
+static void dbsc_setting(void)
+{
+       uint32_t md=0;
+
+       /* Register write enable */
+       io_write_32(DBSC_DBSYSCNT0, 0x00001234U);
+
+       /* BUFCAM settings */
+       io_write_32(DBSC_DBCAM0CNF1, 0x00043218);       //dbcam0cnf1
+       io_write_32(DBSC_DBCAM0CNF2, 0x000000F4);       //dbcam0cnf2
+       io_write_32(DBSC_DBCAM0CNF3, 0x00000000);       //dbcam0cnf3
+       io_write_32(DBSC_DBSCHCNT0,  0x000F0037);       //dbschcnt0
+       io_write_32(DBSC_DBSCHSZ0,   0x00000001);       //dbschsz0
+       io_write_32(DBSC_DBSCHRW0,   0x22421111);       //dbschrw0
+
+       md = (*((volatile uint32_t*)RST_MODEMR) & 0x000A0000) >> 17;
+
+       switch (md) {
+       case 0x0:
+               /* DDR3200 */
+               io_write_32(DBSC_SCFCTST2, 0x012F1123);
+               break;
+       case 0x1:       //MD19=0,MD17=1 : LPDDR4-3000, 4GByte(1GByte x4)
+               /* DDR2800 */
+               io_write_32(DBSC_SCFCTST2, 0x012F1123);
+               break;
+       case 0x4:       //MD19=1,MD17=0 : LPDDR4-2400, 4GByte(1GByte x4)
+               /* DDR2400 */
+               io_write_32(DBSC_SCFCTST2, 0x012F1123);
+               break;
+       default:        //MD19=1,MD17=1 : LPDDR4-1600, 4GByte(1GByte x4)
+               /* DDR1600 */
+               io_write_32(DBSC_SCFCTST2, 0x012F1123);
+               break;
+       }
+
+       /* QoS Settings */
+       io_write_32(DBSC_DBSCHQOS00,  0x00000F00);
+       io_write_32(DBSC_DBSCHQOS01,  0x00000B00);
+       io_write_32(DBSC_DBSCHQOS02,  0x00000000);
+       io_write_32(DBSC_DBSCHQOS03,  0x00000000);
+       io_write_32(DBSC_DBSCHQOS40,  0x00000300);
+       io_write_32(DBSC_DBSCHQOS41,  0x000002F0);
+       io_write_32(DBSC_DBSCHQOS42,  0x00000200);
+       io_write_32(DBSC_DBSCHQOS43,  0x00000100);
+       io_write_32(DBSC_DBSCHQOS90,  0x00000100);
+       io_write_32(DBSC_DBSCHQOS91,  0x000000F0);
+       io_write_32(DBSC_DBSCHQOS92,  0x000000A0);
+       io_write_32(DBSC_DBSCHQOS93,  0x00000040);
+       io_write_32(DBSC_DBSCHQOS120, 0x00000040);
+       io_write_32(DBSC_DBSCHQOS121, 0x00000030);
+       io_write_32(DBSC_DBSCHQOS122, 0x00000020);
+       io_write_32(DBSC_DBSCHQOS123, 0x00000010);
+       io_write_32(DBSC_DBSCHQOS130, 0x00000100);
+       io_write_32(DBSC_DBSCHQOS131, 0x000000F0);
+       io_write_32(DBSC_DBSCHQOS132, 0x000000A0);
+       io_write_32(DBSC_DBSCHQOS133, 0x00000040);
+       io_write_32(DBSC_DBSCHQOS140, 0x000000C0);
+       io_write_32(DBSC_DBSCHQOS141, 0x000000B0);
+       io_write_32(DBSC_DBSCHQOS142, 0x00000080);
+       io_write_32(DBSC_DBSCHQOS143, 0x00000040);
+       io_write_32(DBSC_DBSCHQOS150, 0x00000040);
+       io_write_32(DBSC_DBSCHQOS151, 0x00000030);
+       io_write_32(DBSC_DBSCHQOS152, 0x00000020);
+       io_write_32(DBSC_DBSCHQOS153, 0x00000010);
+
+       /* Register write protect */
+       io_write_32(DBSC_DBSYSCNT0, 0x00000000U);
+}
+
+void qos_init_m3_v30(void)
+{
+       dbsc_setting();
+
+       /* DRAM Split Address mapping */
+#if RCAR_DRAM_SPLIT == RCAR_DRAM_SPLIT_4CH
+ #if RCAR_LSI == RCAR_M3
+  #error "Don't set DRAM Split 4ch(M3)"
+ #else
+       ERROR("DRAM Split 4ch not supported.(M3)");
+       panic();
+ #endif
+#elif (RCAR_DRAM_SPLIT == RCAR_DRAM_SPLIT_2CH) || \
+      (RCAR_DRAM_SPLIT == RCAR_DRAM_SPLIT_AUTO)
+       NOTICE("BL2: DRAM Split is 2ch\n");
+       io_write_32(AXI_ADSPLCR0, 0x00000000U);
+       io_write_32(AXI_ADSPLCR1, ADSPLCR0_ADRMODE_DEFAULT
+                                 | ADSPLCR0_SPLITSEL(0xFFU)
+                                 | ADSPLCR0_AREA(0x1DU)
+                                 | ADSPLCR0_SWP);
+       io_write_32(AXI_ADSPLCR2, 0x00001004U);
+       io_write_32(AXI_ADSPLCR3, 0x00000000U);
+#else
+       NOTICE("BL2: DRAM Split is OFF\n");
+#endif
+
+#if !(RCAR_QOS_TYPE == RCAR_QOS_NONE)
+#if RCAR_QOS_TYPE  == RCAR_QOS_TYPE_DEFAULT
+       NOTICE("BL2: QoS is default setting(%s)\n", RCAR_QOS_VERSION);
+#endif
+
+#if RCAR_REF_INT == RCAR_REF_DEFAULT
+       NOTICE("BL2: DRAM refresh interval 1.95 usec\n");
+#else
+       NOTICE("BL2: DRAM refresh interval 3.9 usec\n");
+#endif
+
+#if RCAR_REWT_TRAINING != RCAR_REWT_TRAINING_DISABLE
+       NOTICE("BL2: Periodic Write DQ Training\n");
+#endif /* RCAR_REWT_TRAINING != RCAR_REWT_TRAINING_DISABLE */
+
+       io_write_32(QOSCTRL_RAS, 0x00000044U);
+       io_write_64(QOSCTRL_DANN, 0x0404020002020201UL);
+       io_write_32(QOSCTRL_DANT, 0x0020100AU);
+       io_write_32(QOSCTRL_FSS, 0x0000000AU);
+       io_write_32(QOSCTRL_INSFC, 0x06330001U);
+       io_write_32(QOSCTRL_EARLYR, 0x00000001U);
+       io_write_32(QOSCTRL_RACNT0, 0x02010003U);       /* GPU Boost Mode ON */
+
+       /* GPU Boost Mode */
+       io_write_32(QOSCTRL_STATGEN0, 0x00000001U);
+
+       io_write_32(QOSCTRL_SL_INIT, SL_INIT_REFFSSLOT | SL_INIT_SLOTSSLOT | SL_INIT_SSLOTCLK_M3_30);
+       io_write_32(QOSCTRL_REF_ARS, ((QOSCTRL_REF_ARS_ARBSTOPCYCLE_M3_30 << 16)));
+
+       {
+       uint32_t i;
+
+       for (i = 0U; i < ARRAY_SIZE(mstat_fix); i++) {
+               io_write_64(QOSBW_FIX_QOS_BANK0 + i*8,
+                               mstat_fix[i]);
+               io_write_64(QOSBW_FIX_QOS_BANK1 + i*8,
+                               mstat_fix[i]);
+       }
+       for (i = 0U; i < ARRAY_SIZE(mstat_be); i++) {
+               io_write_64(QOSBW_BE_QOS_BANK0 + i*8,
+                               mstat_be[i]);
+               io_write_64(QOSBW_BE_QOS_BANK1 + i*8,
+                               mstat_be[i]);
+       }
+#if RCAR_REWT_TRAINING != RCAR_REWT_TRAINING_DISABLE
+       for (i = 0U; i < ARRAY_SIZE(qoswt_fix); i++) {
+               io_write_64(QOSWT_FIX_WTQOS_BANK0 + i*8,
+                               qoswt_fix[i]);
+               io_write_64(QOSWT_FIX_WTQOS_BANK1 + i*8,
+                               qoswt_fix[i]);
+       }
+       for (i = 0U; i < ARRAY_SIZE(qoswt_be); i++) {
+               io_write_64(QOSWT_BE_WTQOS_BANK0 + i*8,
+                               qoswt_be[i]);
+               io_write_64(QOSWT_BE_WTQOS_BANK1 + i*8,
+                               qoswt_be[i]);
+       }
+#endif /* RCAR_REWT_TRAINING != RCAR_REWT_TRAINING_DISABLE */
+       }
+
+       /* RT bus Leaf setting */
+       io_write_32(RT_ACT0, 0x00000000U);
+       io_write_32(RT_ACT1, 0x00000000U);
+
+       /* CCI bus Leaf setting */
+       io_write_32(CPU_ACT0, 0x00000003U);
+       io_write_32(CPU_ACT1, 0x00000003U);
+       io_write_32(CPU_ACT2, 0x00000003U);
+       io_write_32(CPU_ACT3, 0x00000003U);
+
+       io_write_32(QOSCTRL_RAEN,  0x00000001U);
+
+#if RCAR_REWT_TRAINING != RCAR_REWT_TRAINING_DISABLE
+       /*  re-write training setting */
+       io_write_32(QOSWT_WTREF,  ((QOSWT_WTREF_SLOT1_EN << 16)       | QOSWT_WTREF_SLOT0_EN));
+       io_write_32(QOSWT_WTSET0, ((QOSWT_WTSET0_PERIOD0_M3_30 << 16) | (QOSWT_WTSET0_SSLOT0 << 8) | QOSWT_WTSET0_SLOTSLOT0));
+       io_write_32(QOSWT_WTSET1, ((QOSWT_WTSET1_PERIOD1_M3_30 << 16) | (QOSWT_WTSET1_SSLOT1 << 8) | QOSWT_WTSET1_SLOTSLOT1));
+
+       io_write_32(QOSWT_WTEN,   QOSWT_WTEN_ENABLE);
+#endif /* RCAR_REWT_TRAINING != RCAR_REWT_TRAINING_DISABLE */
+
+       io_write_32(QOSCTRL_STATQC, 0x00000001U);
+#else
+       NOTICE("BL2: QoS is None\n");
+
+       io_write_32(QOSCTRL_RAEN,  0x00000001U);
+#endif /* !(RCAR_QOS_TYPE == RCAR_QOS_NONE) */
+}
diff --git a/drivers/staging/renesas/rcar/qos/M3/qos_init_m3_v30.h b/drivers/staging/renesas/rcar/qos/M3/qos_init_m3_v30.h
new file mode 100644 (file)
index 0000000..a89d512
--- /dev/null
@@ -0,0 +1,12 @@
+/*
+ * Copyright (c) 2019, Renesas Electronics Corporation. All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+#ifndef QOS_INIT_H_M3_V30__
+#define QOS_INIT_H_M3_V30__
+
+void qos_init_m3_v30(void);
+
+#endif /* QOS_INIT_H_M3_V30__ */
index 153d1d817d9bc10169fb8ecf2f71dfc429e3687a..9fabc56f8169418874f5c6088a78b6728d23c7af 100644 (file)
@@ -12,6 +12,7 @@ ifeq (${RCAR_LSI},${RCAR_AUTO})
     BL2_SOURCES += drivers/staging/renesas/rcar/qos/H3/qos_init_h3_v30.c
     BL2_SOURCES += drivers/staging/renesas/rcar/qos/M3/qos_init_m3_v10.c
     BL2_SOURCES += drivers/staging/renesas/rcar/qos/M3/qos_init_m3_v11.c
+    BL2_SOURCES += drivers/staging/renesas/rcar/qos/M3/qos_init_m3_v30.c
     BL2_SOURCES += drivers/staging/renesas/rcar/qos/M3N/qos_init_m3n_v10.c
 else ifdef RCAR_LSI_CUT_COMPAT
   ifeq (${RCAR_LSI},${RCAR_H3})
@@ -26,6 +27,7 @@ else ifdef RCAR_LSI_CUT_COMPAT
   ifeq (${RCAR_LSI},${RCAR_M3})
     BL2_SOURCES += drivers/staging/renesas/rcar/qos/M3/qos_init_m3_v10.c
     BL2_SOURCES += drivers/staging/renesas/rcar/qos/M3/qos_init_m3_v11.c
+    BL2_SOURCES += drivers/staging/renesas/rcar/qos/M3/qos_init_m3_v30.c
   endif
   ifeq (${RCAR_LSI},${RCAR_M3N})
     BL2_SOURCES += drivers/staging/renesas/rcar/qos/M3N/qos_init_m3n_v10.c
@@ -61,9 +63,13 @@ else
      BL2_SOURCES += drivers/staging/renesas/rcar/qos/M3/qos_init_m3_v10.c
     else ifeq (${LSI_CUT},11)
      BL2_SOURCES += drivers/staging/renesas/rcar/qos/M3/qos_init_m3_v11.c
-    else
-#    LSI_CUT 11 or later
+    else ifeq (${LSI_CUT},13)
      BL2_SOURCES += drivers/staging/renesas/rcar/qos/M3/qos_init_m3_v11.c
+    else ifeq (${LSI_CUT},30)
+     BL2_SOURCES += drivers/staging/renesas/rcar/qos/M3/qos_init_m3_v30.c
+    else
+#    LSI_CUT 30 or later
+     BL2_SOURCES += drivers/staging/renesas/rcar/qos/M3/qos_init_m3_v30.c
     endif
   endif
   ifeq (${RCAR_LSI},${RCAR_M3N})
index 9bad424fb72de22292566f1f508dbce1560c18a6..89dcf06d68ccaad6ad884a99df46f9b5eb7456ac 100644 (file)
 /* define used for M3 */
 #if (RCAR_REF_INT == RCAR_REF_DEFAULT) /* REF 1.95usec */
 #define SUB_SLOT_CYCLE_M3_11           (0x84U) /* 132 */
+#define SUB_SLOT_CYCLE_M3_30           (0x84U) /* 132 */
 #else /* REF 3.9usec */
 #define SUB_SLOT_CYCLE_M3_11           (0x108U)        /* 264 */
+#define SUB_SLOT_CYCLE_M3_30           (0x108U)        /* 264 */
 #endif /* (RCAR_REF_INT == RCAR_REF_DEFAULT) */
 
 #define SL_INIT_SSLOTCLK_M3_11         (SUB_SLOT_CYCLE_M3_11 -1U)
+#define SL_INIT_SSLOTCLK_M3_30         (SUB_SLOT_CYCLE_M3_30 -1U)
 #define QOSWT_WTSET0_CYCLE_M3_11       ((SUB_SLOT_CYCLE_M3_11 * BASE_SUB_SLOT_NUM * 1000U)/OPERATING_FREQ)     /* unit:ns */
+#define QOSWT_WTSET0_CYCLE_M3_30       ((SUB_SLOT_CYCLE_M3_30 * BASE_SUB_SLOT_NUM * 1000U)/OPERATING_FREQ)     /* unit:ns */
 #endif
 
 #define OPERATING_FREQ                 (400U)  /* MHz */
index be4487aa3e93253eeaf6c487755736c1cef96281..affd42502ce683ab10ddf6a338821e165b360748 100644 (file)
@@ -18,6 +18,7 @@
 #include "H3/qos_init_h3_v30.h"
 #include "M3/qos_init_m3_v10.h"
 #include "M3/qos_init_m3_v11.h"
+#include "M3/qos_init_m3_v30.h"
 #include "M3N/qos_init_m3n_v10.h"
 #endif
 #if RCAR_LSI == RCAR_H3                /* H3 */
@@ -32,6 +33,7 @@
 #if RCAR_LSI == RCAR_M3                /* M3 */
 #include "M3/qos_init_m3_v10.h"
 #include "M3/qos_init_m3_v11.h"
+#include "M3/qos_init_m3_v30.h"
 #endif
 #if RCAR_LSI == RCAR_M3N       /* M3N */
 #include "M3N/qos_init_m3n_v10.h"
@@ -51,6 +53,7 @@
 #define PRR_PRODUCT_10         (0x00U)
 #define PRR_PRODUCT_11         (0x01U)
 #define PRR_PRODUCT_20         (0x10U)
+#define PRR_PRODUCT_21         (0x11U)
 #define PRR_PRODUCT_30         (0x20U)
 
 #if !(RCAR_LSI == RCAR_E3)
@@ -127,10 +130,13 @@ void rcar_qos_init(void)
                case PRR_PRODUCT_10:
                        qos_init_m3_v10();
                        break;
-               case PRR_PRODUCT_20:    /* M3 Cut 11 */
-               default:
+               case PRR_PRODUCT_21: /* M3 Cut 13 */
                        qos_init_m3_v11();
                        break;
+               case PRR_PRODUCT_30: /* M3 Cut 30 */
+               default:
+                       qos_init_m3_v30();
+                       break;
                }
 #else
                PRR_PRODUCT_ERR(reg);
@@ -210,13 +216,27 @@ void rcar_qos_init(void)
                PRR_PRODUCT_ERR(reg);
        }
        qos_init_m3_v10();
+#elif RCAR_LSI_CUT == RCAR_CUT_11
+       /* M3 Cut 11 */
+       if ((PRR_PRODUCT_M3 | PRR_PRODUCT_20)
+           != (reg & (PRR_PRODUCT_MASK | PRR_CUT_MASK))) {
+               PRR_PRODUCT_ERR(reg);
+       }
+       qos_init_m3_v11();
+#elif RCAR_LSI_CUT == RCAR_CUT_13
+       /* M3 Cut 13 */
+       if ((PRR_PRODUCT_M3 | PRR_PRODUCT_21)
+           != (reg & (PRR_PRODUCT_MASK | PRR_CUT_MASK))) {
+               PRR_PRODUCT_ERR(reg);
+       }
+       qos_init_m3_v11();
 #else
-       /* M3 Cut 11 or later */
+       /* M3 Cut 30 or later */
        if ((PRR_PRODUCT_M3)
            != (reg & (PRR_PRODUCT_MASK))) {
                PRR_PRODUCT_ERR(reg);
        }
-       qos_init_m3_v11();
+       qos_init_m3_v30();
 #endif
 #elif RCAR_LSI == RCAR_M3N     /* M3N */
        /* M3N Cut 10 or later */
@@ -277,6 +297,8 @@ uint32_t get_refperiod(void)
                case PRR_PRODUCT_10:
                        break;
                case PRR_PRODUCT_20: /* M3 Cut 11 */
+               case PRR_PRODUCT_21: /* M3 Cut 13 */
+               case PRR_PRODUCT_30: /* M3 Cut 30 */
                default:
                        refperiod = REFPERIOD_CYCLE;
                        break;
@@ -308,7 +330,9 @@ uint32_t get_refperiod(void)
 #if RCAR_LSI_CUT == RCAR_CUT_10
        /* M3 Cut 10 */
 #else
-       /* M3 Cut 11 or later */
+       /* M3 Cut 11 */
+       /* M3 Cut 13 */
+       /* M3 Cut 30 or later */
        refperiod = REFPERIOD_CYCLE;
 #endif
 #elif RCAR_LSI == RCAR_M3N     /* for M3N */
diff --git a/fdts/fvp-ve-Cortex-A5x1.dts b/fdts/fvp-ve-Cortex-A5x1.dts
new file mode 100644 (file)
index 0000000..0f76601
--- /dev/null
@@ -0,0 +1,144 @@
+/*
+ * Copyright (c) 2019, Arm Limited. All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+/dts-v1/;
+
+/ {
+       model = "V2P-CA5s";
+       compatible = "arm,vexpress,v2p-ca5s", "arm,vexpress";
+       interrupt-parent = <&gic>;
+       #address-cells = <1>;
+       #size-cells = <1>;
+
+       cpus {
+               #address-cells = <1>;
+               #size-cells = <0>;
+
+               cpu@0 {
+                       device_type = "cpu";
+                       compatible = "arm,cortex-a5";
+                       reg = <0>;
+               };
+
+       };
+
+       memory@80000000 {
+               device_type = "memory";
+               reg = <0x80000000 0x1000000>;
+       };
+
+       hdlcd@2a110000 {
+               compatible = "arm,hdlcd";
+               reg = <0x2a110000 0x1000>;
+               interrupts = <0 85 4>;
+               clocks = <&oscclk3>;
+               clock-names = "pxlclk";
+       };
+
+       scu@2c000000 {
+               compatible = "arm,cortex-a5-scu";
+               reg = <0x2c000000 0x58>;
+       };
+
+       watchdog@2c000620 {
+               compatible = "arm,cortex-a5-twd-wdt";
+               reg = <0x2c000620 0x20>;
+               interrupts = <1 14 0x304>;
+       };
+
+       gic: interrupt-controller@2c001000 {
+               compatible = "arm,cortex-a9-gic";
+               #interrupt-cells = <3>;
+               #address-cells = <0>;
+               interrupt-controller;
+               reg = <0x2c001000 0x1000>,
+                     <0x2c000100 0x100>;
+       };
+
+       dcc {
+               compatible = "arm,vexpress,config-bus";
+               arm,vexpress,config-bridge = <&v2m_sysreg>;
+
+               oscclk0: osc@0 {
+                       /* CPU and internal AXI reference clock */
+                       compatible = "arm,vexpress-osc";
+                       arm,vexpress-sysreg,func = <1 0>;
+                       freq-range = <50000000 100000000>;
+                       #clock-cells = <0>;
+                       clock-output-names = "oscclk0";
+               };
+
+               oscclk1: osc@1 {
+                       /* Multiplexed AXI master clock */
+                       compatible = "arm,vexpress-osc";
+                       arm,vexpress-sysreg,func = <1 1>;
+                       freq-range = <5000000 50000000>;
+                       #clock-cells = <0>;
+                       clock-output-names = "oscclk1";
+               };
+
+               osc@2 {
+                       /* DDR2 */
+                       compatible = "arm,vexpress-osc";
+                       arm,vexpress-sysreg,func = <1 2>;
+                       freq-range = <80000000 120000000>;
+                       #clock-cells = <0>;
+                       clock-output-names = "oscclk2";
+               };
+
+               oscclk3: osc@3 {
+                       /* HDLCD */
+                       compatible = "arm,vexpress-osc";
+                       arm,vexpress-sysreg,func = <1 3>;
+                       freq-range = <23750000 165000000>;
+                       #clock-cells = <0>;
+                       clock-output-names = "oscclk3";
+               };
+
+               osc@4 {
+                       /* Test chip gate configuration */
+                       compatible = "arm,vexpress-osc";
+                       arm,vexpress-sysreg,func = <1 4>;
+                       freq-range = <80000000 80000000>;
+                       #clock-cells = <0>;
+                       clock-output-names = "oscclk4";
+               };
+
+               smbclk: osc@5 {
+                       /* SMB clock */
+                       compatible = "arm,vexpress-osc";
+                       arm,vexpress-sysreg,func = <1 5>;
+                       freq-range = <25000000 60000000>;
+                       #clock-cells = <0>;
+                       clock-output-names = "oscclk5";
+               };
+       };
+
+       smb {
+               compatible = "simple-bus";
+
+               #address-cells = <2>;
+               #size-cells = <1>;
+               ranges = <0 0 0x08000000 0x04000000>,
+                        <1 0 0x14000000 0x04000000>,
+                        <2 0 0x18000000 0x04000000>,
+                        <3 0 0x1c000000 0x04000000>,
+                        <4 0 0x0c000000 0x04000000>,
+                        <5 0 0x10000000 0x04000000>;
+
+               #interrupt-cells = <1>;
+               interrupt-map-mask = <0 0 63>;
+               interrupt-map = <0 0  0 &gic 0  0 4>,
+                               <0 0  1 &gic 0  1 4>,
+                               <0 0  2 &gic 0  2 4>,
+                               <0 0  3 &gic 0  3 4>,
+                               <0 0  4 &gic 0  4 4>,
+                               <0 0  5 &gic 0  5 4>,
+                               <0 0 42 &gic 0 42 4>;
+
+               /include/ "rtsm_ve-motherboard-aarch32.dtsi"
+       };
+};
diff --git a/fdts/fvp-ve-Cortex-A7x1.dts b/fdts/fvp-ve-Cortex-A7x1.dts
new file mode 100644 (file)
index 0000000..fca3d90
--- /dev/null
@@ -0,0 +1,76 @@
+/*
+ * Copyright (c) 2019, Arm Limited. All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+/dts-v1/;
+
+/ {
+       model = "V2F-1XV7 Cortex-A7x1 SMM";
+       compatible = "arm,vexpress,v2f-1xv7", "arm,vexpress";
+       interrupt-parent = <&gic>;
+       #address-cells = <2>;
+       #size-cells = <2>;
+
+       cpus {
+               #address-cells = <2>;
+               #size-cells = <0>;
+
+               cpu@0 {
+                       device_type = "cpu";
+                       compatible = "arm,cortex-a7";
+                       reg = <0 0>;
+               };
+       };
+
+       memory@0,80000000 {
+               device_type = "memory";
+               reg = <0 0x80000000 0 0x80000000>; /* 2GB @ 2GB */
+       };
+
+       gic: interrupt-controller@2c001000 {
+               compatible = "arm,cortex-a15-gic";
+               #interrupt-cells = <3>;
+               #address-cells = <0>;
+               interrupt-controller;
+               reg = <0 0x2c001000 0 0x1000>,
+                     <0 0x2c002000 0 0x1000>,
+                     <0 0x2c004000 0 0x2000>,
+                     <0 0x2c006000 0 0x2000>;
+               interrupts = <1 9 0xf04>;
+       };
+
+       smbclk: refclk24mhzx2 {
+               /* Reference 24MHz clock x 2 */
+               compatible = "fixed-clock";
+               #clock-cells = <0>;
+               clock-frequency = <48000000>;
+               clock-output-names = "smclk";
+       };
+
+       smb {
+               compatible = "simple-bus";
+
+               #address-cells = <2>;
+               #size-cells = <1>;
+               ranges = <0 0 0 0x08000000 0x04000000>,
+                        <1 0 0 0x14000000 0x04000000>,
+                        <2 0 0 0x18000000 0x04000000>,
+                        <3 0 0 0x1c000000 0x04000000>,
+                        <4 0 0 0x0c000000 0x04000000>,
+                        <5 0 0 0x10000000 0x04000000>;
+
+               #interrupt-cells = <1>;
+               interrupt-map-mask = <0 0 63>;
+               interrupt-map = <0 0  0 &gic 0  0 4>,
+                               <0 0  1 &gic 0  1 4>,
+                               <0 0  2 &gic 0  2 4>,
+                               <0 0  3 &gic 0  3 4>,
+                               <0 0  4 &gic 0  4 4>,
+                               <0 0  5 &gic 0  5 4>,
+                               <0 0 42 &gic 0 42 4>;
+
+               /include/ "rtsm_ve-motherboard-aarch32.dtsi"
+       };
+};
index 0314171f542011a7121759012dcb025ff6493245..cf0fe2889200ec791e618f2b31ce6cceacfc95ab 100644 (file)
        st,clksrc = <
                CLK_MPU_PLL1P
                CLK_AXI_PLL2P
+               CLK_MCU_PLL3P
                CLK_PLL12_HSE
                CLK_PLL3_HSE
                CLK_PLL4_HSE
        st,clkdiv = <
                1 /*MPU*/
                0 /*AXI*/
+               0 /*MCU*/
                1 /*APB1*/
                1 /*APB2*/
                1 /*APB3*/
index 5d8817f696a0552fdfaa6ace0cd2e4cc4f22137e..0fadffbd6d494472afb72e57a6a0b176c7080e2c 100644 (file)
        st,clksrc = <
                CLK_MPU_PLL1P
                CLK_AXI_PLL2P
+               CLK_MCU_PLL3P
                CLK_PLL12_HSE
                CLK_PLL3_HSE
                CLK_PLL4_HSE
        st,clkdiv = <
                1 /*MPU*/
                0 /*AXI*/
+               0 /*MCU*/
                1 /*APB1*/
                1 /*APB2*/
                1 /*APB3*/
index 3421e042d817e10e4e26f60b08bd7b0767587b59..44044d40306bfef8db5e033e286dffc740a07b27 100644 (file)
 /* Data Cache set/way op type defines */
 #define DC_OP_ISW                      U(0x0)
 #define DC_OP_CISW                     U(0x1)
+#if ERRATA_A53_827319
+#define DC_OP_CSW                      DC_OP_CISW
+#else
 #define DC_OP_CSW                      U(0x2)
+#endif
 
 /*******************************************************************************
  * Generic timer memory mapped registers & offsets
 #define SDCR_SPD_LEGACY                U(0x0)
 #define SDCR_SPD_DISABLE       U(0x2)
 #define SDCR_SPD_ENABLE                U(0x3)
+#define SDCR_SCCD_BIT          (U(1) << 23)
 #define SDCR_RESET_VAL         U(0x0)
 
 /* HSCTLR definitions */
index 64ddc86fe1e721b90c7633343dafa4d1cf8931da..cbac84b93af659a150da326decf5aebbd49227af 100644 (file)
@@ -328,7 +328,11 @@ DEFINE_BPIOP_FUNC(allis, BPIALLIS)
  */
 DEFINE_DCOP_PARAM_FUNC(civac, DCCIMVAC)
 DEFINE_DCOP_PARAM_FUNC(ivac, DCIMVAC)
+#if ERRATA_A53_819472 || ERRATA_A53_824069 || ERRATA_A53_827319
+DEFINE_DCOP_PARAM_FUNC(cvac, DCCIMVAC)
+#else
 DEFINE_DCOP_PARAM_FUNC(cvac, DCCMVAC)
+#endif
 
 /* Previously defined accessor functions with incomplete register names  */
 #define dsb()                  dsbsy()
index 8408804fbd91df7622a8cf43ee2b6c8f824aae6b..8cfa21231a9fffb0de5b1a43e0ab126b8e06b9dd 100644 (file)
@@ -78,7 +78,7 @@
         * Clobber: r14, r1, r2
         */
        .macro get_my_mp_stack _name, _size
-       bl  plat_my_core_pos
+       bl      plat_my_core_pos
        ldr r2, =(\_name + \_size)
        mov r1, #\_size
        mla r0, r0, r1, r2
                .endif
        .endm
 
+       /*
+        * Helper macro for carrying out division in software when
+        * hardware division is not suported. \top holds the dividend
+        * in the function call and the remainder after
+        * the function is executed. \bot holds the divisor. \div holds
+        * the quotient and \temp is a temporary registed used in calcualtion.
+        * The division algorithm has been obtained from:
+        * http://www.keil.com/support/man/docs/armasm/armasm_dom1359731155623.htm
+        */
+       .macro  softudiv        div:req,top:req,bot:req,temp:req
+
+       mov     \temp, \bot
+       cmp     \temp, \top, lsr #1
+div1:
+       movls   \temp, \temp, lsl #1
+       cmp     \temp, \top, lsr #1
+       bls     div1
+       mov     \div, #0
+
+div2:
+       cmp     \top, \temp
+       subcs   \top, \top,\temp
+       ADC     \div, \div, \div
+       mov     \temp, \temp, lsr #1
+       cmp     \temp, \bot
+       bhs     div2
+       .endm
 #endif /* ASM_MACROS_S */
index 048f16103ed29ccba6f88cf8c0358ba60a1c9274..322aed5cdd4b56d4d5d8275e59f70749f2c61d1e 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016-2018, ARM Limited and Contributors. All rights reserved.
+ * Copyright (c) 2016-2019, ARM Limited and Contributors. All rights reserved.
  *
  * SPDX-License-Identifier: BSD-3-Clause
  */
         *  from all exception levels.
         * ---------------------------------------------------------------------
         */
+#if (ARM_ARCH_MAJOR > 7) || defined(ARMV7_SUPPORTS_VFP)
        ldr     r0, =(FPEXC_RESET_VAL | FPEXC_EN_BIT)
        vmsr    FPEXC, r0
        isb
+#endif
 
 #if (ARM_ARCH_MAJOR > 7)
        /* ---------------------------------------------------------------------
         * Initialise SDCR, setting all the fields rather than relying on hw.
         *
         * SDCR.SPD: Disable AArch32 privileged debug. Debug exceptions from
-        * Secure EL1 are disabled.
+        *  Secure EL1 are disabled.
+        *
+        * SDCR: Set to one so that cycle counting by PMCCNTR is prohibited in
+        *  Secure state. This bit is RES0 in versions of the architecture
+        *  earlier than ARMv8.5, setting it to 1 doesn't have any effect on
+        *  them.
         * ---------------------------------------------------------------------
         */
-       ldr     r0, =(SDCR_RESET_VAL | SDCR_SPD(SDCR_SPD_DISABLE))
+       ldr     r0, =(SDCR_RESET_VAL | SDCR_SPD(SDCR_SPD_DISABLE) | SDCR_SCCD_BIT)
        stcopr  r0, SDCR
 #endif
 
index 76c3e277bd095456e8bdb845883a28df20547336..debe8722cbe140505109fcc4db8191d844a4dd45 100644 (file)
 /* Data cache set/way op type defines */
 #define DCISW                  U(0x0)
 #define DCCISW                 U(0x1)
+#if ERRATA_A53_827319
+#define DCCSW                  DCCISW
+#else
 #define DCCSW                  U(0x2)
+#endif
 
 /* ID_AA64PFR0_EL1 definitions */
 #define ID_AA64PFR0_EL0_SHIFT  U(0)
 
 #define ID_AA64PFR0_GIC_SHIFT  U(24)
 #define ID_AA64PFR0_GIC_WIDTH  U(4)
-#define ID_AA64PFR0_GIC_MASK   ((ULL(1) << ID_AA64PFR0_GIC_WIDTH) - ULL(1))
+#define ID_AA64PFR0_GIC_MASK   ULL(0xf)
 
 /* ID_AA64ISAR1_EL1 definitions */
+#define ID_AA64ISAR1_EL1       S3_0_C0_C6_1
 #define ID_AA64ISAR1_GPI_SHIFT U(28)
 #define ID_AA64ISAR1_GPI_WIDTH U(4)
+#define ID_AA64ISAR1_GPI_MASK  ULL(0xf)
 #define ID_AA64ISAR1_GPA_SHIFT U(24)
 #define ID_AA64ISAR1_GPA_WIDTH U(4)
+#define ID_AA64ISAR1_GPA_MASK  ULL(0xf)
 #define ID_AA64ISAR1_API_SHIFT U(8)
 #define ID_AA64ISAR1_API_WIDTH U(4)
+#define ID_AA64ISAR1_API_MASK  ULL(0xf)
 #define ID_AA64ISAR1_APA_SHIFT U(4)
 #define ID_AA64ISAR1_APA_WIDTH U(4)
-
-#define ID_AA64ISAR1_GPI_MASK \
-       (((ULL(1) << ID_AA64ISAR1_GPI_WIDTH) - ULL(1)) << ID_AA64ISAR1_GPI_SHIFT)
-#define ID_AA64ISAR1_GPA_MASK \
-       (((ULL(1) << ID_AA64ISAR1_GPA_WIDTH) - ULL(1)) << ID_AA64ISAR1_GPA_SHIFT)
-#define ID_AA64ISAR1_API_MASK \
-       (((ULL(1) << ID_AA64ISAR1_API_WIDTH) - ULL(1)) << ID_AA64ISAR1_API_SHIFT)
-#define ID_AA64ISAR1_APA_MASK \
-       (((ULL(1) << ID_AA64ISAR1_APA_WIDTH) - ULL(1)) << ID_AA64ISAR1_APA_SHIFT)
+#define ID_AA64ISAR1_APA_MASK  ULL(0xf)
 
 /* ID_AA64MMFR0_EL1 definitions */
 #define ID_AA64MMFR0_EL1_PARANGE_SHIFT U(0)
 #define SCTLR_NTWE_BIT         (ULL(1) << 18)
 #define SCTLR_WXN_BIT          (ULL(1) << 19)
 #define SCTLR_UWXN_BIT         (ULL(1) << 20)
+#define SCTLR_IESB_BIT         (ULL(1) << 21)
 #define SCTLR_E0E_BIT          (ULL(1) << 24)
 #define SCTLR_EE_BIT           (ULL(1) << 25)
 #define SCTLR_UCI_BIT          (ULL(1) << 26)
-#define SCTLR_TRE_BIT          (ULL(1) << 28)
-#define SCTLR_AFE_BIT          (ULL(1) << 29)
-#define SCTLR_TE_BIT           (ULL(1) << 30)
+#define SCTLR_EnIA_BIT         (ULL(1) << 31)
 #define SCTLR_DSSBS_BIT                (ULL(1) << 44)
 #define SCTLR_RESET_VAL                SCTLR_EL3_RES1
 
 
 /* MDCR_EL3 definitions */
 #define MDCR_SPD32(x)          ((x) << 14)
-#define MDCR_SPD32_LEGACY      U(0x0)
-#define MDCR_SPD32_DISABLE     U(0x2)
-#define MDCR_SPD32_ENABLE      U(0x3)
-#define MDCR_SDD_BIT           (U(1) << 16)
+#define MDCR_SPD32_LEGACY      ULL(0x0)
+#define MDCR_SPD32_DISABLE     ULL(0x2)
+#define MDCR_SPD32_ENABLE      ULL(0x3)
+#define MDCR_SDD_BIT           (ULL(1) << 16)
 #define MDCR_NSPB(x)           ((x) << 12)
-#define MDCR_NSPB_EL1          U(0x3)
-#define MDCR_TDOSA_BIT         (U(1) << 10)
-#define MDCR_TDA_BIT           (U(1) << 9)
-#define MDCR_TPM_BIT           (U(1) << 6)
-#define MDCR_EL3_RESET_VAL     U(0x0)
+#define MDCR_NSPB_EL1          ULL(0x3)
+#define MDCR_TDOSA_BIT         (ULL(1) << 10)
+#define MDCR_TDA_BIT           (ULL(1) << 9)
+#define MDCR_TPM_BIT           (ULL(1) << 6)
+#define MDCR_SCCD_BIT          (ULL(1) << 23)
+#define MDCR_EL3_RESET_VAL     ULL(0x0)
 
 /* MDCR_EL2 definitions */
 #define MDCR_EL2_TPMS          (U(1) << 14)
 
 /* MPAM register definitions */
 #define MPAM3_EL3_MPAMEN_BIT           (ULL(1) << 63)
+#define MPAMHCR_EL2_TRAP_MPAMIDR_EL1   (ULL(1) << 31)
+
+#define MPAM2_EL2_TRAPMPAM0EL1         (ULL(1) << 49)
+#define MPAM2_EL2_TRAPMPAM1EL1         (ULL(1) << 48)
 
 #define MPAMIDR_HAS_HCR_BIT            (ULL(1) << 17)
 
 /*******************************************************************************
  * Armv8.3 Pointer Authentication Registers
  ******************************************************************************/
+#define APIAKeyLo_EL1          S3_0_C2_C1_0
+#define APIAKeyHi_EL1          S3_0_C2_C1_1
+#define APIBKeyLo_EL1          S3_0_C2_C1_2
+#define APIBKeyHi_EL1          S3_0_C2_C1_3
+#define APDAKeyLo_EL1          S3_0_C2_C2_0
+#define APDAKeyHi_EL1          S3_0_C2_C2_1
+#define APDBKeyLo_EL1          S3_0_C2_C2_2
+#define APDBKeyHi_EL1          S3_0_C2_C2_3
 #define APGAKeyLo_EL1          S3_0_C2_C3_0
+#define APGAKeyHi_EL1          S3_0_C2_C3_1
 
 /*******************************************************************************
  * Armv8.4 Data Independent Timing Registers
index da8b6e4f1cf4554c6f7f4f9558204bd1ac583e2c..6af1d039797691a68c6f9858c9d7428646dbf6c8 100644 (file)
@@ -23,6 +23,25 @@ static inline bool is_armv8_2_ttcnp_present(void)
                ID_AA64MMFR2_EL1_CNP_MASK) != 0U;
 }
 
+static inline bool is_armv8_3_pauth_present(void)
+{
+       uint64_t mask = (ID_AA64ISAR1_GPI_MASK << ID_AA64ISAR1_GPI_SHIFT) |
+                       (ID_AA64ISAR1_GPA_MASK << ID_AA64ISAR1_GPA_SHIFT) |
+                       (ID_AA64ISAR1_API_MASK << ID_AA64ISAR1_API_SHIFT) |
+                       (ID_AA64ISAR1_APA_MASK << ID_AA64ISAR1_APA_SHIFT);
+
+       /* If any of the fields is not zero, PAuth is present */
+       return (read_id_aa64isar1_el1() & mask) != 0U;
+}
+
+static inline bool is_armv8_3_pauth_apa_api_present(void)
+{
+       uint64_t mask = (ID_AA64ISAR1_API_MASK << ID_AA64ISAR1_API_SHIFT) |
+                       (ID_AA64ISAR1_APA_MASK << ID_AA64ISAR1_APA_SHIFT);
+
+       return (read_id_aa64isar1_el1() & mask) != 0U;
+}
+
 static inline bool is_armv8_4_ttst_present(void)
 {
        return ((read_id_aa64mmfr2_el1() >> ID_AA64MMFR2_EL1_ST_SHIFT) &
index 4e459bbb9adbd19d2fd67056b1cf25e93dfda0ec..2fce6686b1479d861ffb215796c6a35ffd27c1f2 100644 (file)
@@ -113,6 +113,18 @@ static inline void tlbi ## _type(uint64_t v)                       \
 }
 #endif /* ERRATA_A57_813419 */
 
+#if ERRATA_A53_819472 || ERRATA_A53_824069 || ERRATA_A53_827319
+/*
+ * Define function for DC instruction with register parameter that enables
+ * the workaround for errata 819472, 824069 and 827319 of Cortex-A53.
+ */
+#define DEFINE_DCOP_ERRATA_A53_TYPE_PARAM_FUNC(_name, _type)   \
+static inline void dc ## _name(uint64_t v)                     \
+{                                                              \
+       __asm__("dc " #_type ", %0" : : "r" (v));               \
+}
+#endif /* ERRATA_A53_819472 || ERRATA_A53_824069 || ERRATA_A53_827319 */
+
 DEFINE_SYSOP_TYPE_FUNC(tlbi, alle1)
 DEFINE_SYSOP_TYPE_FUNC(tlbi, alle1is)
 DEFINE_SYSOP_TYPE_FUNC(tlbi, alle2)
@@ -143,11 +155,23 @@ DEFINE_SYSOP_TYPE_PARAM_FUNC(tlbi, vale3is)
  ******************************************************************************/
 DEFINE_SYSOP_TYPE_PARAM_FUNC(dc, isw)
 DEFINE_SYSOP_TYPE_PARAM_FUNC(dc, cisw)
+#if ERRATA_A53_827319
+DEFINE_DCOP_ERRATA_A53_TYPE_PARAM_FUNC(csw, cisw)
+#else
 DEFINE_SYSOP_TYPE_PARAM_FUNC(dc, csw)
+#endif
+#if ERRATA_A53_819472 || ERRATA_A53_824069 || ERRATA_A53_827319
+DEFINE_DCOP_ERRATA_A53_TYPE_PARAM_FUNC(cvac, civac)
+#else
 DEFINE_SYSOP_TYPE_PARAM_FUNC(dc, cvac)
+#endif
 DEFINE_SYSOP_TYPE_PARAM_FUNC(dc, ivac)
 DEFINE_SYSOP_TYPE_PARAM_FUNC(dc, civac)
+#if ERRATA_A53_819472 || ERRATA_A53_824069 || ERRATA_A53_827319
+DEFINE_DCOP_ERRATA_A53_TYPE_PARAM_FUNC(cvau, civac)
+#else
 DEFINE_SYSOP_TYPE_PARAM_FUNC(dc, cvau)
+#endif
 DEFINE_SYSOP_TYPE_PARAM_FUNC(dc, zva)
 
 /*******************************************************************************
@@ -184,6 +208,7 @@ DEFINE_SYSREG_RW_FUNCS(par_el1)
 DEFINE_SYSREG_READ_FUNC(id_pfr1_el1)
 DEFINE_SYSREG_READ_FUNC(id_aa64isar1_el1)
 DEFINE_SYSREG_READ_FUNC(id_aa64pfr0_el1)
+DEFINE_SYSREG_READ_FUNC(id_aa64pfr1_el1)
 DEFINE_SYSREG_READ_FUNC(id_aa64dfr0_el1)
 DEFINE_SYSREG_READ_FUNC(id_afr0_el1)
 DEFINE_SYSREG_READ_FUNC(CurrentEl)
@@ -454,7 +479,8 @@ DEFINE_RENAME_SYSREG_READ_FUNC(erxmisc1_el1, ERXMISC1_EL1)
 DEFINE_RENAME_SYSREG_READ_FUNC(id_aa64mmfr2_el1, ID_AA64MMFR2_EL1)
 
 /* Armv8.3 Pointer Authentication Registers */
-DEFINE_RENAME_SYSREG_RW_FUNCS(apgakeylo_el1, APGAKeyLo_EL1)
+DEFINE_RENAME_SYSREG_RW_FUNCS(apiakeyhi_el1, APIAKeyHi_EL1)
+DEFINE_RENAME_SYSREG_RW_FUNCS(apiakeylo_el1, APIAKeyLo_EL1)
 
 #define IS_IN_EL(x) \
        (GET_EL(read_CurrentEl()) == MODE_EL##x)
index 410aeab75ab0e9dc9771c1087f66fa04e654b221..22b32b491c53df0b0b4c20dc88375e28065f1753 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015-2018, ARM Limited and Contributors. All rights reserved.
+ * Copyright (c) 2015-2019, ARM Limited and Contributors. All rights reserved.
  *
  * SPDX-License-Identifier: BSD-3-Clause
  */
         * authentication instructions from lower ELs.
         * ---------------------------------------------------------------------
         */
-       mov_imm x0, ((SCR_RESET_VAL | SCR_EA_BIT | SCR_SIF_BIT | \
-                               SCR_API_BIT | SCR_APK_BIT) \
+       mov_imm x0, ((SCR_RESET_VAL | SCR_EA_BIT | SCR_SIF_BIT) \
                        & ~(SCR_TWE_BIT | SCR_TWI_BIT | SCR_SMD_BIT))
+#if CTX_INCLUDE_PAUTH_REGS
+       /*
+        * If the pointer authentication registers are saved during world
+        * switches, enable pointer authentication everywhere, as it is safe to
+        * do so.
+        */
+       orr     x0, x0, #(SCR_API_BIT | SCR_APK_BIT)
+#endif
        msr     scr_el3, x0
 
        /* ---------------------------------------------------------------------
         *
         * MDCR_EL3.TPM: Set to zero so that EL0, EL1, and EL2 System register
         *  accesses to all Performance Monitors registers do not trap to EL3.
+        *
+        * MDCR_EL3.SCCD: Set to one so that cycle counting by PMCCNTR_EL0 is
+        *  prohibited in Secure state. This bit is RES0 in versions of the
+        *  architecture earlier than ARMv8.5, setting it to 1 doesn't have any
+        *  effect on them.
         * ---------------------------------------------------------------------
         */
-       mov_imm x0, ((MDCR_EL3_RESET_VAL | MDCR_SDD_BIT | MDCR_SPD32(MDCR_SPD32_DISABLE)) \
-                       & ~(MDCR_TDOSA_BIT | MDCR_TDA_BIT | MDCR_TPM_BIT))
+       mov_imm x0, ((MDCR_EL3_RESET_VAL | MDCR_SDD_BIT | \
+                     MDCR_SPD32(MDCR_SPD32_DISABLE) | MDCR_SCCD_BIT) \
+                   & ~(MDCR_TDOSA_BIT | MDCR_TDA_BIT | MDCR_TPM_BIT))
+
        msr     mdcr_el3, x0
 
        /* ---------------------------------------------------------------------
index 7b5d87572b3b7d81a1597bf64ce4b281cbce726a..937b8c7e8c12e0bde4b3bb991e22e9b5acc60500 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015-2018, ARM Limited and Contributors. All rights reserved.
+ * Copyright (c) 2015-2019, ARM Limited and Contributors. All rights reserved.
  *
  * SPDX-License-Identifier: BSD-3-Clause
  */
@@ -83,6 +83,7 @@ register_t bl1_smc_handler(unsigned int smc_fid,
 
 void bl1_print_next_bl_ep_info(const struct entry_point_info *bl_ep_info);
 
+void bl1_setup(void);
 void bl1_main(void);
 void bl1_plat_prepare_exit(entry_point_info_t *ep_info);
 
index 8ec080c0a5406fd6e368b9afd2e49f25a30d6131..73f5ac7a1948fc1a44d6707667bebcc771160375 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018, ARM Limited and Contributors. All rights reserved.
+ * Copyright (c) 2018-2019, ARM Limited and Contributors. All rights reserved.
  *
  * SPDX-License-Identifier: BSD-3-Clause
  */
@@ -7,6 +7,12 @@
 #ifndef BL2_H
 #define BL2_H
 
+#include <stdint.h>
+
+void bl2_setup(u_register_t arg0, u_register_t arg1, u_register_t arg2,
+              u_register_t arg3);
+void bl2_el3_setup(u_register_t arg0, u_register_t arg1, u_register_t arg2,
+                  u_register_t arg3);
 void bl2_main(void);
 
 #endif /* BL2_H */
index 08c555d902711d7fb9f2f550e53619de38cfb9d2..3deb0a51d22590cdd1b9cf6f256d47c671fd13a6 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013-2018, ARM Limited and Contributors. All rights reserved.
+ * Copyright (c) 2013-2019, ARM Limited and Contributors. All rights reserved.
  *
  * SPDX-License-Identifier: BSD-3-Clause
  */
@@ -12,6 +12,8 @@
 /*******************************************************************************
  * Function prototypes
  ******************************************************************************/
+void bl31_setup(u_register_t arg0, u_register_t arg1, u_register_t arg2,
+               u_register_t arg3);
 void bl31_next_el_arch_setup(uint32_t security_state);
 void bl31_set_next_image_type(uint32_t security_state);
 uint32_t bl31_get_next_image_type(void);
index ed4792e5806f3322796c41fab3ec6594c7c5ec9a..18d3079e2200c7242fb153bbc45254b4dc13d0d5 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013-2017, ARM Limited and Contributors. All rights reserved.
+ * Copyright (c) 2013-2019, ARM Limited and Contributors. All rights reserved.
  *
  * SPDX-License-Identifier: BSD-3-Clause
  */
@@ -104,6 +104,7 @@ typedef struct tsp_vectors {
        tsp_vector_isn_t abort_yield_smc_entry;
 } tsp_vectors_t;
 
+void tsp_setup(void);
 
 #endif /* __ASSEMBLY__ */
 
index fd7656eb5d5c820b5acc55f499a3cc23912d85b1..457dc2a1fc108b673a6c251b44b761c3b7f12a5a 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013-2018, ARM Limited and Contributors. All rights reserved.
+ * Copyright (c) 2013-2019, ARM Limited and Contributors. All rights reserved.
  *
  * SPDX-License-Identifier: BSD-3-Clause
  */
 #define FIQ_AARCH32                    U(0xe)
 #define SERROR_AARCH32                 U(0xf)
 
+/*
+ * Mapping to connect linker symbols from .ld.S with their counterparts
+ * from .scat for the BL31 image
+ */
+#if defined(USE_ARM_LINK)
+#define __BL31_END__                   Load$$LR$$LR_END$$Base
+#define __BSS_START__                  Load$$LR$$LR_BSS$$Base
+#define __BSS_END__                    Load$$LR$$LR_BSS$$Limit
+#define __BSS_SIZE__                   Load$$LR$$LR_BSS$$Length
+#define __COHERENT_RAM_START__         Load$$LR$$LR_COHERENT_RAM$$Base
+#define __COHERENT_RAM_END_UNALIGNED__ Load$$__COHERENT_RAM_EPILOGUE_UNALIGNED__$$Base
+#define __COHERENT_RAM_END__           Load$$LR$$LR_COHERENT_RAM$$Limit
+#define __COHERENT_RAM_UNALIGNED_SIZE__        Load$$__COHERENT_RAM__$$Length
+#define __CPU_OPS_START__              Load$$__CPU_OPS__$$Base
+#define __CPU_OPS_END__                        Load$$__CPU_OPS__$$Limit
+#define __DATA_START__                 Load$$__DATA__$$Base
+#define __DATA_END__                   Load$$__DATA__$$Limit
+#define __GOT_START__                  Load$$__GOT__$$Base
+#define __GOT_END__                    Load$$__GOT__$$Limit
+#define __PERCPU_BAKERY_LOCK_START__   Load$$__BAKERY_LOCKS__$$Base
+#define __PERCPU_BAKERY_LOCK_END__     Load$$__BAKERY_LOCKS_EPILOGUE__$$Base
+#define __PMF_SVC_DESCS_START__                Load$$__PMF_SVC_DESCS__$$Base
+#define __PMF_SVC_DESCS_END__          Load$$__PMF_SVC_DESCS__$$Limit
+#define __PMF_TIMESTAMP_START__                Load$$__PMF_TIMESTAMP__$$Base
+#define __PMF_TIMESTAMP_END__          Load$$__PER_CPU_TIMESTAMPS__$$Limit
+#define __PMF_PERCPU_TIMESTAMP_END__   Load$$__PMF_TIMESTAMP_EPILOGUE__$$Base
+#define __RELA_END__                   Load$$__RELA__$$Limit
+#define __RELA_START__                 Load$$__RELA__$$Base
+#define __RODATA_START__               Load$$__RODATA__$$Base
+#define __RODATA_END__                 Load$$__RODATA_EPILOGUE__$$Base
+#define __RT_SVC_DESCS_START__         Load$$__RT_SVC_DESCS__$$Base
+#define __RT_SVC_DESCS_END__           Load$$__RT_SVC_DESCS__$$Limit
+#define __RW_START__                   Load$$LR$$LR_RW_DATA$$Base
+#define __RW_END__                     Load$$LR$$LR_END$$Base
+#define __SPM_SHIM_EXCEPTIONS_START__  Load$$__SPM_SHIM_EXCEPTIONS__$$Base
+#define __SPM_SHIM_EXCEPTIONS_END__    Load$$__SPM_SHIM_EXCEPTIONS_EPILOGUE__$$Base
+#define __STACKS_START__               Load$$__STACKS__$$Base
+#define __STACKS_END__                 Load$$__STACKS__$$Limit
+#define __TEXT_START__                 Load$$__TEXT__$$Base
+#define __TEXT_END__                   Load$$__TEXT_EPILOGUE__$$Base
+#endif /* USE_ARM_LINK */
+
 #ifndef __ASSEMBLY__
 
 #include <stddef.h>
@@ -207,6 +249,8 @@ struct mmap_region;
 void setup_page_tables(const struct mmap_region *bl_regions,
                           const struct mmap_region *plat_regions);
 
+void bl_handle_pauth(void);
+
 #endif /*__ASSEMBLY__*/
 
 #endif /* BL_COMMON_H */
index bc906e3949fc7e49c6e26297133def94a7b64d3e..1653240c899709736a66fc4d8160fe1e14204a3d 100644 (file)
@@ -21,7 +21,6 @@ struct rpi3_sdhost_params {
        uint8_t         cmdbusy;
        uint8_t         mmc_app_cmd;
        uint32_t        ns_per_fifo_word;
-       uint32_t        crc_err_retries;
 
        uint32_t        sdcard_rca;
        uint32_t        gpio48_pinselect[6];
index 1e0d949ac5144003d04a40687edcd1c97d7895ea..7afa5ad84528309d98bd71c9ded6bb71ab28e898 100644 (file)
@@ -13,6 +13,7 @@ int stm32mp1_clk_probe(void);
 int stm32mp1_clk_init(void);
 
 bool stm32mp1_rcc_is_secure(void);
+bool stm32mp1_rcc_is_mckprot(void);
 
 void __stm32mp1_clk_enable(unsigned long id, bool caller_is_secure);
 void __stm32mp1_clk_disable(unsigned long id, bool caller_is_secure);
index 1922c48154666b68e65b0c3d8fbaafc99a470a89..eaa853da3401f7f41b3d29b6ad780090a2c4a859 100644 (file)
 #define RCC_RCK4SELR                   U(0x824)
 #define RCC_TIMG1PRER                  U(0x828)
 #define RCC_TIMG2PRER                  U(0x82C)
+#define RCC_MCUDIVR                    U(0x830)
 #define RCC_APB1DIVR                   U(0x834)
 #define RCC_APB2DIVR                   U(0x838)
 #define RCC_APB3DIVR                   U(0x83C)
 
 /* Values for RCC_TZCR register */
 #define RCC_TZCR_TZEN                  BIT(0)
+#define RCC_TZCR_MCKPROT               BIT(1)
 
 /* Used for most of RCC_<x>SELR registers */
 #define RCC_SELR_SRC_MASK              GENMASK(2, 0)
 #define RCC_APBXDIV_MASK               GENMASK(2, 0)
 #define RCC_MPUDIV_MASK                        GENMASK(2, 0)
 #define RCC_AXIDIV_MASK                        GENMASK(2, 0)
+#define RCC_MCUDIV_MASK                        GENMASK(3, 0)
 
 /* Used for TIMER Prescaler */
 #define RCC_TIMGXPRER_TIMGXPRE         BIT(0)
 
 /* Global Reset Register */
 #define RCC_MP_GRSTCSETR_MPSYSRST      BIT(0)
+#define RCC_MP_GRSTCSETR_MCURST                BIT(1)
 #define RCC_MP_GRSTCSETR_MPUP0RST      BIT(4)
 #define RCC_MP_GRSTCSETR_MPUP1RST      BIT(5)
 
index f7005da3eda3f66e40bde0885fe51e24b622ad59..ffabd61acdd2dfbed0f49a41aa6f169bbff24d27 100644 (file)
@@ -45,6 +45,7 @@
 #define CORTEX_A57_CPUACTLR                            p15, 0, c15
 
 #define CORTEX_A57_CPUACTLR_DIS_LOAD_PASS_DMB          (ULL(1) << 59)
+#define CORTEX_A57_CPUACTLR_DIS_DMB_NULLIFICATION      (ULL(1) << 58)
 #define CORTEX_A57_CPUACTLR_DIS_LOAD_PASS_STORE                (ULL(1) << 55)
 #define CORTEX_A57_CPUACTLR_GRE_NGRE_AS_NGNRE          (ULL(1) << 54)
 #define CORTEX_A57_CPUACTLR_DIS_OVERREAD               (ULL(1) << 52)
index 8b21e16a1deed863ca28e34aebaee0817119befd..feac1d2f0832edf24187354e00f7b849af24560c 100644 (file)
 #define CORTEX_A55_CPUPWRCTLR_EL1      S3_0_C15_C2_7
 #define CORTEX_A55_CPUECTLR_EL1                S3_0_C15_C1_4
 
+#define CORTEX_A55_CPUECTLR_EL1_L1WSCTL        (ULL(3) << 25)
+
+/*******************************************************************************
+ * CPU Auxiliary Control register specific definitions.
+ ******************************************************************************/
+#define CORTEX_A55_CPUACTLR_EL1                                S3_0_C15_C1_0
+
+#define CORTEX_A55_CPUACTLR_EL1_DISABLE_WRITE_STREAMING        (ULL(1) << 24)
+#define CORTEX_A55_CPUACTLR_EL1_DISABLE_DUAL_ISSUE     (ULL(1) << 31)
+#define CORTEX_A55_CPUACTLR_EL1_DISABLE_L1_PAGEWALKS   (ULL(1) << 49)
+
+/*******************************************************************************
+ * CPU Identification register specific definitions.
+ ******************************************************************************/
+#define CORTEX_A55_CLIDR_EL1                           S3_1_C0_C0_1
+
+#define CORTEX_A55_CLIDR_EL1_CTYPE3                    (ULL(7) << 6)
+
 /* Definitions of register field mask in CORTEX_A55_CPUPWRCTLR_EL1 */
 #define CORTEX_A55_CORE_PWRDN_EN_MASK  U(0x1)
 
index 1e68f21a4cc732187d6240f48757888e1d28827b..102ff60c3a1028773ac0b004bebd7ca85c027908 100644 (file)
@@ -45,6 +45,7 @@
 #define CORTEX_A57_CPUACTLR_EL1                                S3_1_C15_C2_0
 
 #define CORTEX_A57_CPUACTLR_EL1_DIS_LOAD_PASS_DMB      (ULL(1) << 59)
+#define CORTEX_A57_CPUACTLR_EL1_DIS_DMB_NULLIFICATION  (ULL(1) << 58)
 #define CORTEX_A57_CPUACTLR_EL1_DIS_LOAD_PASS_STORE    (ULL(1) << 55)
 #define CORTEX_A57_CPUACTLR_EL1_GRE_NGRE_AS_NGNRE      (ULL(1) << 54)
 #define CORTEX_A57_CPUACTLR_EL1_DIS_OVERREAD           (ULL(1) << 52)
index 3b401805a8228640ef4b308064f2720b98f8c9e7..1238c0ef4df5343643db4f717a1410cbe4f05189 100644 (file)
@@ -31,4 +31,8 @@
 
 #define CORTEX_A73_IMP_DEF_REG1_DISABLE_LOAD_PASS_STORE        (ULL(1) << 3)
 
+#define CORTEX_A73_DIAGNOSTIC_REGISTER S3_0_C15_C0_1
+
+#define CORTEX_A73_IMP_DEF_REG2                S3_0_C15_C0_2
+
 #endif /* CORTEX_A73_H */
index 5779d7babe9470d4ef4dcaa1fb130f8ace499076..c2af8cad9b6af6d551a96a2d839deddb31a9e8d5 100644 (file)
 #define CORTEX_A76_CPUPWRCTLR_EL1      S3_0_C15_C2_7
 #define CORTEX_A76_CPUECTLR_EL1                S3_0_C15_C1_4
 
+#define CORTEX_A76_CPUECTLR_EL1_WS_THR_L2      (ULL(3) << 24)
+
 /*******************************************************************************
  * CPU Auxiliary Control register specific definitions.
  ******************************************************************************/
+#define CORTEX_A76_CPUACTLR_EL1                S3_0_C15_C1_0
+
+#define CORTEX_A76_CPUACTLR_EL1_DISABLE_STATIC_PREDICTION      (ULL(1) << 6)
+
 #define CORTEX_A76_CPUACTLR2_EL1       S3_0_C15_C1_1
 
 #define CORTEX_A76_CPUACTLR2_EL1_DISABLE_LOAD_PASS_STORE       (ULL(1) << 16)
diff --git a/include/lib/cpus/aarch64/cortex_ares.h b/include/lib/cpus/aarch64/cortex_ares.h
deleted file mode 100644 (file)
index cfc36e4..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Copyright (c) 2017-2018, ARM Limited and Contributors. All rights reserved.
- *
- * SPDX-License-Identifier: BSD-3-Clause
- */
-
-#ifndef CORTEX_ARES_H
-#define CORTEX_ARES_H
-
-#include <lib/utils_def.h>
-
-/* Cortex-ARES MIDR for revision 0 */
-#define CORTEX_ARES_MIDR               U(0x410fd0c0)
-
-/*******************************************************************************
- * CPU Extended Control register specific definitions.
- ******************************************************************************/
-#define CORTEX_ARES_CPUPWRCTLR_EL1     S3_0_C15_C2_7
-#define CORTEX_ARES_CPUECTLR_EL1       S3_0_C15_C1_4
-
-/* Definitions of register field mask in CORTEX_ARES_CPUPWRCTLR_EL1 */
-#define CORTEX_ARES_CORE_PWRDN_EN_MASK U(0x1)
-
-#define CORTEX_ARES_ACTLR_AMEN_BIT     (U(1) << 4)
-
-#define CORTEX_ARES_AMU_NR_COUNTERS    U(5)
-#define CORTEX_ARES_AMU_GROUP0_MASK    U(0x1f)
-
-/* Instruction patching registers */
-#define CPUPSELR_EL3   S3_6_C15_C8_0
-#define CPUPCR_EL3     S3_6_C15_C8_1
-#define CPUPOR_EL3     S3_6_C15_C8_2
-#define CPUPMR_EL3     S3_6_C15_C8_3
-
-#endif /* CORTEX_ARES_H */
diff --git a/include/lib/cpus/aarch64/cortex_helios.h b/include/lib/cpus/aarch64/cortex_helios.h
deleted file mode 100644 (file)
index 0c11a9a..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Copyright (c) 2018-2019, ARM Limited and Contributors. All rights reserved.
- *
- * SPDX-License-Identifier: BSD-3-Clause
- */
-
-#ifndef CORTEX_HELIOS_H
-#define CORTEX_HELIOS_H
-
-#include <lib/utils_def.h>
-
-#define CORTEX_HELIOS_MIDR             U(0x410FD060)
-
-/*******************************************************************************
- * CPU Extended Control register specific definitions.
- ******************************************************************************/
-#define CORTEX_HELIOS_ECTLR_EL1                S3_0_C15_C1_4
-
-/*******************************************************************************
- * CPU Auxiliary Control register specific definitions.
- ******************************************************************************/
-#define CORTEX_HELIOS_CPUACTLR_EL1     S3_0_C15_C1_0
-
-/*******************************************************************************
- * CPU Power Control register specific definitions.
- ******************************************************************************/
-
-#define CORTEX_HELIOS_CPUPWRCTLR_EL1                           S3_0_C15_C2_7
-#define CORTEX_HELIOS_CPUPWRCTLR_EL1_CORE_PWRDN_BIT            (U(1) << 0)
-
-#endif /* CORTEX_HELIOS_H */
diff --git a/include/lib/cpus/aarch64/neoverse_e1.h b/include/lib/cpus/aarch64/neoverse_e1.h
new file mode 100644 (file)
index 0000000..7084604
--- /dev/null
@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 2018-2019, ARM Limited and Contributors. All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+#ifndef NEOVERSE_E1_H
+#define NEOVERSE_E1_H
+
+#include <lib/utils_def.h>
+
+#define NEOVERSE_E1_MIDR               U(0x410FD060)
+
+/*******************************************************************************
+ * CPU Extended Control register specific definitions.
+ ******************************************************************************/
+#define NEOVERSE_E1_ECTLR_EL1          S3_0_C15_C1_4
+
+/*******************************************************************************
+ * CPU Auxiliary Control register specific definitions.
+ ******************************************************************************/
+#define NEOVERSE_E1_CPUACTLR_EL1       S3_0_C15_C1_0
+
+/*******************************************************************************
+ * CPU Power Control register specific definitions.
+ ******************************************************************************/
+
+#define NEOVERSE_E1_CPUPWRCTLR_EL1                             S3_0_C15_C2_7
+#define NEOVERSE_E1_CPUPWRCTLR_EL1_CORE_PWRDN_BIT              (U(1) << 0)
+
+#endif /* NEOVERSE_E1_H */
diff --git a/include/lib/cpus/aarch64/neoverse_n1.h b/include/lib/cpus/aarch64/neoverse_n1.h
new file mode 100644 (file)
index 0000000..908993e
--- /dev/null
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 2017-2019, ARM Limited and Contributors. All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+#ifndef NEOVERSE_N1_H
+#define NEOVERSE_N1_H
+
+#include <lib/utils_def.h>
+
+/* Neoverse N1 MIDR for revision 0 */
+#define NEOVERSE_N1_MIDR               U(0x410fd0c0)
+
+/*******************************************************************************
+ * CPU Extended Control register specific definitions.
+ ******************************************************************************/
+#define NEOVERSE_N1_CPUPWRCTLR_EL1     S3_0_C15_C2_7
+#define NEOVERSE_N1_CPUECTLR_EL1       S3_0_C15_C1_4
+
+/* Definitions of register field mask in NEOVERSE_N1_CPUPWRCTLR_EL1 */
+#define NEOVERSE_N1_CORE_PWRDN_EN_MASK U(0x1)
+
+#define NEOVERSE_N1_ACTLR_AMEN_BIT     (U(1) << 4)
+
+#define NEOVERSE_N1_AMU_NR_COUNTERS    U(5)
+#define NEOVERSE_N1_AMU_GROUP0_MASK    U(0x1f)
+
+/* Instruction patching registers */
+#define CPUPSELR_EL3   S3_6_C15_C8_0
+#define CPUPCR_EL3     S3_6_C15_C8_1
+#define CPUPOR_EL3     S3_6_C15_C8_2
+#define CPUPMR_EL3     S3_6_C15_C8_3
+
+#endif /* NEOVERSE_N1_H */
index 70c50aae27e1850ae3bffb57a17f412b4cd508d9..5bd0de4249e3cf2fecc73ce3098567025745658a 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013-2018, ARM Limited and Contributors. All rights reserved.
+ * Copyright (c) 2013-2019, ARM Limited and Contributors. All rights reserved.
  *
  * SPDX-License-Identifier: BSD-3-Clause
  */
 #define CTX_SPSR_FIQ           U(0xd8)
 #define CTX_DACR32_EL2         U(0xe0)
 #define CTX_IFSR32_EL2         U(0xe8)
-#define CTX_TIMER_SYSREGS_OFF  U(0xf0) /* Align to the next 16 byte boundary */
+#define CTX_AARCH32_END                U(0xf0) /* Align to the next 16 byte boundary */
 #else
-#define CTX_TIMER_SYSREGS_OFF  U(0xc0)  /* Align to the next 16 byte boundary */
-#endif /* __CTX_INCLUDE_AARCH32_REGS__ */
+#define CTX_AARCH32_END                U(0xc0)  /* Align to the next 16 byte boundary */
+#endif /* CTX_INCLUDE_AARCH32_REGS */
 
 /*
  * If the timer registers aren't saved and restored, we don't have to reserve
  * space for them in the context
  */
 #if NS_TIMER_SWITCH
-#define CTX_CNTP_CTL_EL0       (CTX_TIMER_SYSREGS_OFF + U(0x0))
-#define CTX_CNTP_CVAL_EL0      (CTX_TIMER_SYSREGS_OFF + U(0x8))
-#define CTX_CNTV_CTL_EL0       (CTX_TIMER_SYSREGS_OFF + U(0x10))
-#define CTX_CNTV_CVAL_EL0      (CTX_TIMER_SYSREGS_OFF + U(0x18))
-#define CTX_CNTKCTL_EL1                (CTX_TIMER_SYSREGS_OFF + U(0x20))
-#define CTX_SYSREGS_END                (CTX_TIMER_SYSREGS_OFF + U(0x30)) /* Align to the next 16 byte boundary */
+#define CTX_CNTP_CTL_EL0       (CTX_AARCH32_END + U(0x0))
+#define CTX_CNTP_CVAL_EL0      (CTX_AARCH32_END + U(0x8))
+#define CTX_CNTV_CTL_EL0       (CTX_AARCH32_END + U(0x10))
+#define CTX_CNTV_CVAL_EL0      (CTX_AARCH32_END + U(0x18))
+#define CTX_CNTKCTL_EL1                (CTX_AARCH32_END + U(0x20))
+#define CTX_TIMER_SYSREGS_END  (CTX_AARCH32_END + U(0x30)) /* Align to the next 16 byte boundary */
 #else
-#define CTX_SYSREGS_END                CTX_TIMER_SYSREGS_OFF
-#endif /* __NS_TIMER_SWITCH__ */
+#define CTX_TIMER_SYSREGS_END  CTX_AARCH32_END
+#endif /* NS_TIMER_SWITCH */
+
+/*
+ * End of system registers.
+ */
+#define CTX_SYSREGS_END                CTX_TIMER_SYSREGS_END
 
 /*******************************************************************************
  * Constants that allow assembler code to access members of and the 'fp_regs'
 #define CTX_FPREGS_END         U(0)
 #endif
 
+/*******************************************************************************
+ * Registers related to CVE-2018-3639
+ ******************************************************************************/
 #define CTX_CVE_2018_3639_OFFSET       (CTX_FPREGS_OFFSET + CTX_FPREGS_END)
 #define CTX_CVE_2018_3639_DISABLE      U(0)
 #define CTX_CVE_2018_3639_END          U(0x10) /* Align to the next 16 byte boundary */
 
+/*******************************************************************************
+ * Registers related to ARMv8.3-PAuth.
+ ******************************************************************************/
+#define CTX_PAUTH_REGS_OFFSET  (CTX_CVE_2018_3639_OFFSET + CTX_CVE_2018_3639_END)
+#if CTX_INCLUDE_PAUTH_REGS
+#define CTX_PACIAKEY_LO                U(0x0)
+#define CTX_PACIAKEY_HI                U(0x8)
+#define CTX_PACIBKEY_LO                U(0x10)
+#define CTX_PACIBKEY_HI                U(0x18)
+#define CTX_PACDAKEY_LO                U(0x20)
+#define CTX_PACDAKEY_HI                U(0x28)
+#define CTX_PACDBKEY_LO                U(0x30)
+#define CTX_PACDBKEY_HI                U(0x38)
+#define CTX_PACGAKEY_LO                U(0x40)
+#define CTX_PACGAKEY_HI                U(0x48)
+#define CTX_PACGAKEY_END       U(0x50)
+#define CTX_PAUTH_REGS_END     U(0x60) /* Align to the next 16 byte boundary */
+#else
+#define CTX_PAUTH_REGS_END     U(0)
+#endif /* CTX_INCLUDE_PAUTH_REGS */
+
 #ifndef __ASSEMBLY__
 
 #include <stdint.h>
 
-#include <platform_def.h>      /* for CACHE_WRITEBACK_GRANULE */
-
 #include <lib/cassert.h>
 
 /*
 #define CTX_GPREG_ALL          (CTX_GPREGS_END >> DWORD_SHIFT)
 #define CTX_SYSREG_ALL         (CTX_SYSREGS_END >> DWORD_SHIFT)
 #if CTX_INCLUDE_FPREGS
-#define CTX_FPREG_ALL          (CTX_FPREGS_END >> DWORD_SHIFT)
+# define CTX_FPREG_ALL         (CTX_FPREGS_END >> DWORD_SHIFT)
 #endif
 #define CTX_EL3STATE_ALL       (CTX_EL3STATE_END >> DWORD_SHIFT)
 #define CTX_CVE_2018_3639_ALL  (CTX_CVE_2018_3639_END >> DWORD_SHIFT)
+#if CTX_INCLUDE_PAUTH_REGS
+# define CTX_PAUTH_REGS_ALL    (CTX_PAUTH_REGS_END >> DWORD_SHIFT)
+#endif
 
 /*
  * AArch64 general purpose register context structure. Usually x0-x18,
@@ -239,6 +269,11 @@ DEFINE_REG_STRUCT(el3_state, CTX_EL3STATE_ALL);
 /* Function pointer used by CVE-2018-3639 dynamic mitigation */
 DEFINE_REG_STRUCT(cve_2018_3639, CTX_CVE_2018_3639_ALL);
 
+/* Registers associated to ARMv8.3-PAuth */
+#if CTX_INCLUDE_PAUTH_REGS
+DEFINE_REG_STRUCT(pauth, CTX_PAUTH_REGS_ALL);
+#endif
+
 /*
  * Macros to access members of any of the above structures using their
  * offsets
@@ -264,16 +299,22 @@ typedef struct cpu_context {
        fp_regs_t fpregs_ctx;
 #endif
        cve_2018_3639_t cve_2018_3639_ctx;
+#if CTX_INCLUDE_PAUTH_REGS
+       pauth_t pauth_ctx;
+#endif
 } cpu_context_t;
 
 /* Macros to access members of the 'cpu_context_t' structure */
 #define get_el3state_ctx(h)    (&((cpu_context_t *) h)->el3state_ctx)
 #if CTX_INCLUDE_FPREGS
-#define get_fpregs_ctx(h)      (&((cpu_context_t *) h)->fpregs_ctx)
+# define get_fpregs_ctx(h)     (&((cpu_context_t *) h)->fpregs_ctx)
 #endif
 #define get_sysregs_ctx(h)     (&((cpu_context_t *) h)->sysregs_ctx)
 #define get_gpregs_ctx(h)      (&((cpu_context_t *) h)->gpregs_ctx)
 #define get_cve_2018_3639_ctx(h)       (&((cpu_context_t *) h)->cve_2018_3639_ctx)
+#if CTX_INCLUDE_PAUTH_REGS
+# define get_pauth_ctx(h)      (&((cpu_context_t *) h)->pauth_ctx)
+#endif
 
 /*
  * Compile time assertions related to the 'cpu_context' structure to
@@ -292,6 +333,10 @@ CASSERT(CTX_EL3STATE_OFFSET == __builtin_offsetof(cpu_context_t, el3state_ctx),
        assert_core_context_el3state_offset_mismatch);
 CASSERT(CTX_CVE_2018_3639_OFFSET == __builtin_offsetof(cpu_context_t, cve_2018_3639_ctx), \
        assert_core_context_cve_2018_3639_offset_mismatch);
+#if CTX_INCLUDE_PAUTH_REGS
+CASSERT(CTX_PAUTH_REGS_OFFSET == __builtin_offsetof(cpu_context_t, pauth_ctx), \
+       assert_core_context_pauth_offset_mismatch);
+#endif
 
 /*
  * Helper macro to set the general purpose registers that correspond to
@@ -339,14 +384,6 @@ void fpregs_context_save(fp_regs_t *regs);
 void fpregs_context_restore(fp_regs_t *regs);
 #endif
 
-
-#undef CTX_SYSREG_ALL
-#if CTX_INCLUDE_FPREGS
-#undef CTX_FPREG_ALL
-#endif
-#undef CTX_GPREG_ALL
-#undef CTX_EL3STATE_ALL
-
 #endif /* __ASSEMBLY__ */
 
 #endif /* CONTEXT_H */
index eb91286564c7c516de851fa9728d4a6b53c37e1a..64fe5ccb4dbaeea158cf0170e0375d504224526a 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017-2018, ARM Limited and Contributors. All rights reserved.
+ * Copyright (c) 2017-2019, ARM Limited and Contributors. All rights reserved.
  *
  * SPDX-License-Identifier: BSD-3-Clause
  */
@@ -7,13 +7,11 @@
 #ifndef PUBSUB_H
 #define PUBSUB_H
 
-#define __pubsub_start_sym(event)      __pubsub_##event##_start
-#define __pubsub_end_sym(event)                __pubsub_##event##_end
-
 #ifdef __LINKER__
 
 /* For the linker ... */
-
+#define __pubsub_start_sym(event)      __pubsub_##event##_start
+#define __pubsub_end_sym(event)                __pubsub_##event##_end
 #define __pubsub_section(event)                __pubsub_##event
 
 /*
  * contexts. In linker context, this collects pubsub sections for each event,
  * placing guard symbols around each.
  */
+#if defined(USE_ARM_LINK)
+#define REGISTER_PUBSUB_EVENT(event) \
+       __pubsub_start_sym(event) +0 FIXED \
+       { \
+               *(__pubsub_section(event)) \
+       } \
+       __pubsub_end_sym(event) +0 FIXED EMPTY 0 \
+       { \
+               /* placeholder */ \
+       }
+#else
 #define REGISTER_PUBSUB_EVENT(event) \
        __pubsub_start_sym(event) = .; \
        KEEP(*(__pubsub_section(event))); \
        __pubsub_end_sym(event) = .
+#endif
 
 #else /* __LINKER__ */
 
 
 #include <arch_helpers.h>
 
+#if defined(USE_ARM_LINK)
+#define __pubsub_start_sym(event)      Load$$__pubsub_##event##_start$$Base
+#define __pubsub_end_sym(event)                Load$$__pubsub_##event##_end$$Base
+#else
+#define __pubsub_start_sym(event)      __pubsub_##event##_start
+#define __pubsub_end_sym(event)                __pubsub_##event##_end
+#endif
+
 #define __pubsub_section(event)                __section("__pubsub_" #event)
 
 /*
@@ -49,7 +67,7 @@
 /*
  * Have the function func called back when the specified event happens. This
  * macro places the function address into the pubsub section, which is picked up
- * and invoked by the invoke_pubsubs() function via. the PUBLISH_EVENT* macros.
+ * and invoked by the invoke_pubsubs() function via the PUBLISH_EVENT* macros.
  *
  * The extern declaration is there to satisfy MISRA C-2012 rule 8.4.
  */
index 9f6b2905f1d443e993e222a312f23e9975fa5c59..98daab601dc2cf8c48d98507af6235e09e66847e 100644 (file)
@@ -106,7 +106,7 @@ struct err_handler_data {
         */
        uint32_t syndrome;
 
-       /* For errors signalled via. interrupt, the raw interrupt ID; otherwise, 0. */
+       /* For errors signalled via interrupt, the raw interrupt ID; otherwise, 0. */
        unsigned int interrupt;
 };
 
@@ -129,7 +129,7 @@ struct err_record_info {
        union {
                struct {
                        /*
-                        * For a group accessed via. memory-mapped register,
+                        * For a group accessed via memory-mapped register,
                         * base address of the page hosting error records, and
                         * the size of the record group.
                         */
@@ -141,7 +141,7 @@ struct err_record_info {
 
                struct {
                        /*
-                        * For error records accessed via. system register, index of
+                        * For error records accessed via system register, index of
                         * the error record.
                         */
                        unsigned int idx_start;
index 6d0fb7896f9f6bfbd39261a93f11ecc2793d6e32..f9bbe0f6076314caa1ca252991445e890039cd1f 100644 (file)
 #define PAGE_SIZE_MASK         (PAGE_SIZE - U(1))
 #define IS_PAGE_ALIGNED(addr)  (((addr) & PAGE_SIZE_MASK) == U(0))
 
-#define XLAT_ENTRY_SIZE_SHIFT  U(3) /* Each MMU table entry is 8 bytes (1 << 3) */
+#if (ARM_ARCH_MAJOR == 7) && !ARMV7_SUPPORTS_LARGE_PAGE_ADDRESSING
+#define XLAT_ENTRY_SIZE_SHIFT  U(2)    /* Each MMU table entry is 4 bytes */
+#else
+#define XLAT_ENTRY_SIZE_SHIFT  U(3)    /* Each MMU table entry is 8 bytes */
+#endif
 #define XLAT_ENTRY_SIZE                (U(1) << XLAT_ENTRY_SIZE_SHIFT)
 
 #define XLAT_TABLE_SIZE_SHIFT  PAGE_SIZE_SHIFT /* Size of one complete table */
index a77ea96ef391bd9a7d147103f5ece3efc5394c84..452afbcc8464d4d736a1a00a8bd78a3305f95bcb 100644 (file)
 #define PLAT_ARM_BOOT_UART_BASE                        SOC_CSS_UART0_BASE
 #define PLAT_ARM_BOOT_UART_CLK_IN_HZ           SOC_CSS_UART0_CLK_IN_HZ
 
-#define PLAT_ARM_BL31_RUN_UART_BASE            SOC_CSS_UART1_BASE
-#define PLAT_ARM_BL31_RUN_UART_CLK_IN_HZ       SOC_CSS_UART1_CLK_IN_HZ
+#define PLAT_ARM_RUN_UART_BASE         SOC_CSS_UART1_BASE
+#define PLAT_ARM_RUN_UART_CLK_IN_HZ    SOC_CSS_UART1_CLK_IN_HZ
 
 #define PLAT_ARM_SP_MIN_RUN_UART_BASE          SOC_CSS_UART1_BASE
 #define PLAT_ARM_SP_MIN_RUN_UART_CLK_IN_HZ     SOC_CSS_UART1_CLK_IN_HZ
 
-#define PLAT_ARM_CRASH_UART_BASE               PLAT_ARM_BL31_RUN_UART_BASE
-#define PLAT_ARM_CRASH_UART_CLK_IN_HZ          PLAT_ARM_BL31_RUN_UART_CLK_IN_HZ
+#define PLAT_ARM_CRASH_UART_BASE               PLAT_ARM_RUN_UART_BASE
+#define PLAT_ARM_CRASH_UART_CLK_IN_HZ          PLAT_ARM_RUN_UART_CLK_IN_HZ
 
 #define PLAT_ARM_TSP_UART_BASE                 V2M_IOFPGA_UART0_BASE
 #define PLAT_ARM_TSP_UART_CLK_IN_HZ            V2M_IOFPGA_UART0_CLK_IN_HZ
index 13767ff0a4b51c923d293b745555863e56875467..4832e491cd89ef7b4e3ea7a48374994db87b308a 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013-2018, ARM Limited and Contributors. All rights reserved.
+ * Copyright (c) 2013-2019, ARM Limited and Contributors. All rights reserved.
  *
  * SPDX-License-Identifier: BSD-3-Clause
  */
@@ -104,6 +104,7 @@ const char *plat_log_get_prefix(unsigned int log_level);
 void bl2_plat_preload_setup(void);
 int plat_try_next_boot_source(void);
 int plat_get_mbedtls_heap(void **heap_addr, size_t *heap_size);
+uint64_t *plat_init_apiakey(void);
 
 /*******************************************************************************
  * Mandatory BL1 functions
index 4975ec60dfb3e6c9ce32d559abe15508f616067f..6e3ff81798c8e5bea5f73499848ce5225fb05e06 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017, ARM Limited and Contributors. All rights reserved.
+ * Copyright (c) 2017-2019, ARM Limited and Contributors. All rights reserved.
  *
  * SPDX-License-Identifier: BSD-3-Clause
  */
@@ -29,6 +29,36 @@ func cortex_a53_disable_smp
        bx      lr
 endfunc cortex_a53_disable_smp
 
+       /* ---------------------------------------------------
+        * Errata Workaround for Cortex A53 Errata #819472.
+        * This applies only to revision <= r0p1 of Cortex A53.
+        * ---------------------------------------------------
+        */
+func check_errata_819472
+       /*
+        * Even though this is only needed for revision <= r0p1, it
+        * is always applied due to limitations of the current
+        * errata framework.
+        */
+       mov     r0, #ERRATA_APPLIES
+       bx      lr
+endfunc check_errata_819472
+
+       /* ---------------------------------------------------
+        * Errata Workaround for Cortex A53 Errata #824069.
+        * This applies only to revision <= r0p2 of Cortex A53.
+        * ---------------------------------------------------
+        */
+func check_errata_824069
+       /*
+        * Even though this is only needed for revision <= r0p2, it
+        * is always applied due to limitations of the current
+        * errata framework.
+        */
+       mov     r0, #ERRATA_APPLIES
+       bx      lr
+endfunc check_errata_824069
+
        /* --------------------------------------------------
         * Errata Workaround for Cortex A53 Errata #826319.
         * This applies only to revision <= r0p2 of Cortex A53.
@@ -59,6 +89,21 @@ func check_errata_826319
        b       cpu_rev_var_ls
 endfunc check_errata_826319
 
+       /* ---------------------------------------------------
+        * Errata Workaround for Cortex A53 Errata #827319.
+        * This applies only to revision <= r0p2 of Cortex A53.
+        * ---------------------------------------------------
+        */
+func check_errata_827319
+       /*
+        * Even though this is only needed for revision <= r0p2, it
+        * is always applied due to limitations of the current
+        * errata framework.
+        */
+       mov     r0, #ERRATA_APPLIES
+       bx      lr
+endfunc check_errata_827319
+
        /* ---------------------------------------------------------------------
         * Disable the cache non-temporal hint.
         *
@@ -253,7 +298,10 @@ func cortex_a53_errata_report
         * Report all errata. The revision-variant information is passed to
         * checking functions of each errata.
         */
+       report_errata ERRATA_A53_819472, cortex_a53, 819472
+       report_errata ERRATA_A53_824069, cortex_a53, 824069
        report_errata ERRATA_A53_826319, cortex_a53, 826319
+       report_errata ERRATA_A53_827319, cortex_a53, 827319
        report_errata ERRATA_A53_836870, cortex_a53, disable_non_temporal_hint
        report_errata ERRATA_A53_855873, cortex_a53, 855873
 
index 04942d3092f78024c84d60c5eed7d05daaa2d040..2e97abbe0e185ddd796039eedc34ffa3028eddb7 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017, ARM Limited and Contributors. All rights reserved.
+ * Copyright (c) 2017-2019, ARM Limited and Contributors. All rights reserved.
  *
  * SPDX-License-Identifier: BSD-3-Clause
  */
@@ -46,6 +46,13 @@ func cortex_a57_disable_ext_debug
        mov     r0, #1
        stcopr  r0, DBGOSDLR
        isb
+#if ERRATA_A57_817169
+       /*
+        * Invalidate any TLB address
+        */
+       mov     r0, #0
+       stcopr  r0, TLBIMVA
+#endif
        dsb     sy
        bx      lr
 endfunc cortex_a57_disable_ext_debug
@@ -123,6 +130,49 @@ func check_errata_813420
        b       cpu_rev_var_ls
 endfunc check_errata_813420
 
+       /* ---------------------------------------------------
+        * Errata Workaround for Cortex A57 Errata #814670.
+        * This applies only to revision r0p0 of Cortex A57.
+        * Inputs:
+        * r0: variant[4:7] and revision[0:3] of current cpu.
+        * Shall clobber: r0-r3
+        * ---------------------------------------------------
+        */
+func errata_a57_814670_wa
+       /*
+        * Compare r0 against revision r0p0
+        */
+       mov             r2, lr
+       bl              check_errata_814670
+       cmp             r0, #ERRATA_NOT_APPLIES
+       beq             1f
+       ldcopr16        r0, r1, CORTEX_A57_CPUACTLR
+       orr64_imm       r0, r1, CORTEX_A57_CPUACTLR_DIS_DMB_NULLIFICATION
+       stcopr16        r0, r1, CORTEX_A57_CPUACTLR
+       isb
+1:
+       bx              r2
+endfunc errata_a57_814670_wa
+
+func check_errata_814670
+       mov     r1, #0x00
+       b       cpu_rev_var_ls
+endfunc check_errata_814670
+
+       /* ----------------------------------------------------
+        * Errata Workaround for Cortex A57 Errata #817169.
+        * This applies only to revision <= r0p1 of Cortex A57.
+        * ----------------------------------------------------
+        */
+func check_errata_817169
+       /*
+        * Even though this is only needed for revision <= r0p1, it
+        * is always applied because of the low cost of the workaround.
+        */
+       mov     r0, #ERRATA_APPLIES
+       bx      lr
+endfunc check_errata_817169
+
        /* --------------------------------------------------------------------
         * Disable the over-read from the LDNP instruction.
         *
@@ -366,6 +416,11 @@ func cortex_a57_reset_func
        bl      errata_a57_813420_wa
 #endif
 
+#if ERRATA_A57_814670
+       mov     r0, r4
+       bl      errata_a57_814670_wa
+#endif
+
 #if A57_DISABLE_NON_TEMPORAL_HINT
        mov     r0, r4
        bl      a57_disable_ldnp_overread
@@ -533,6 +588,8 @@ func cortex_a57_errata_report
        report_errata ERRATA_A57_806969, cortex_a57, 806969
        report_errata ERRATA_A57_813419, cortex_a57, 813419
        report_errata ERRATA_A57_813420, cortex_a57, 813420
+       report_errata ERRATA_A57_814670, cortex_a57, 814670
+       report_errata ERRATA_A57_817169, cortex_a57, 817169
        report_errata A57_DISABLE_NON_TEMPORAL_HINT, cortex_a57, \
                disable_ldnp_overread
        report_errata ERRATA_A57_826974, cortex_a57, 826974
index f84cd0dfaccd03d14e8ea9509aaedf37f9594894..f37a33d0b57e65a9c3743e9e96b14d8f6b22f3e9 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016-2017, ARM Limited and Contributors. All rights reserved.
+ * Copyright (c) 2016-2019, ARM Limited and Contributors. All rights reserved.
  *
  * SPDX-License-Identifier: BSD-3-Clause
  */
@@ -8,6 +8,7 @@
 #include <asm_macros.S>
 #include <assert_macros.S>
 #include <cpu_macros.S>
+#include <common/bl_common.h>
 #include <lib/el3_runtime/cpu_data.h>
 
 #if defined(IMAGE_BL1) || defined(IMAGE_BL32) || (defined(IMAGE_BL2) && BL2_AT_EL3)
index 332bad75f3d880ec61f5777570825ffdbbb344cb..f20082d2d6167b14b17e13a20c3c1986bbc76804 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014-2018, ARM Limited and Contributors. All rights reserved.
+ * Copyright (c) 2014-2019, ARM Limited and Contributors. All rights reserved.
  *
  * SPDX-License-Identifier: BSD-3-Clause
  */
@@ -42,6 +42,36 @@ func cortex_a53_disable_smp
        ret
 endfunc cortex_a53_disable_smp
 
+       /* ---------------------------------------------------
+        * Errata Workaround for Cortex A53 Errata #819472.
+        * This applies only to revision <= r0p1 of Cortex A53.
+        * ---------------------------------------------------
+        */
+func check_errata_819472
+       /*
+        * Even though this is only needed for revision <= r0p1, it
+        * is always applied due to limitations of the current
+        * errata framework.
+        */
+       mov     x0, #ERRATA_APPLIES
+       ret
+endfunc check_errata_819472
+
+       /* ---------------------------------------------------
+        * Errata Workaround for Cortex A53 Errata #824069.
+        * This applies only to revision <= r0p2 of Cortex A53.
+        * ---------------------------------------------------
+        */
+func check_errata_824069
+       /*
+        * Even though this is only needed for revision <= r0p2, it
+        * is always applied due to limitations of the current
+        * errata framework.
+        */
+       mov     x0, #ERRATA_APPLIES
+       ret
+endfunc check_errata_824069
+
        /* --------------------------------------------------
         * Errata Workaround for Cortex A53 Errata #826319.
         * This applies only to revision <= r0p2 of Cortex A53.
@@ -70,6 +100,21 @@ func check_errata_826319
        b       cpu_rev_var_ls
 endfunc check_errata_826319
 
+       /* ---------------------------------------------------
+        * Errata Workaround for Cortex A53 Errata #827319.
+        * This applies only to revision <= r0p2 of Cortex A53.
+        * ---------------------------------------------------
+        */
+func check_errata_827319
+       /*
+        * Even though this is only needed for revision <= r0p2, it
+        * is always applied due to limitations of the current
+        * errata framework.
+        */
+       mov     x0, #ERRATA_APPLIES
+       ret
+endfunc check_errata_827319
+
        /* ---------------------------------------------------------------------
         * Disable the cache non-temporal hint.
         *
@@ -304,7 +349,10 @@ func cortex_a53_errata_report
         * Report all errata. The revision-variant information is passed to
         * checking functions of each errata.
         */
+       report_errata ERRATA_A53_819472, cortex_a53, 819472
+       report_errata ERRATA_A53_824069, cortex_a53, 824069
        report_errata ERRATA_A53_826319, cortex_a53, 826319
+       report_errata ERRATA_A53_827319, cortex_a53, 827319
        report_errata ERRATA_A53_835769, cortex_a53, 835769
        report_errata ERRATA_A53_836870, cortex_a53, disable_non_temporal_hint
        report_errata ERRATA_A53_843419, cortex_a53, 843419
index b347e299cbdf2db3e1f587627c44c301da08f1a8..1da80efa28d098168a13fc92c10fa7f0108c482a 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017-2018, ARM Limited and Contributors. All rights reserved.
+ * Copyright (c) 2017-2019, ARM Limited and Contributors. All rights reserved.
  *
  * SPDX-License-Identifier: BSD-3-Clause
  */
 #include <cpu_macros.S>
 #include <plat_macros.S>
 
+       /* --------------------------------------------------
+        * Errata Workaround for Cortex A55 Errata #768277.
+        * This applies only to revision r0p0 of Cortex A55.
+        * Inputs:
+        * x0: variant[4:7] and revision[0:3] of current cpu.
+        * Shall clobber: x0-x17
+        * --------------------------------------------------
+        */
+func errata_a55_768277_wa
+       /*
+        * Compare x0 against revision r0p0
+        */
+       mov     x17, x30
+       bl      check_errata_768277
+       cbz     x0, 1f
+       mrs     x1, CORTEX_A55_CPUACTLR_EL1
+       orr     x1, x1, #CORTEX_A55_CPUACTLR_EL1_DISABLE_DUAL_ISSUE
+       msr     CORTEX_A55_CPUACTLR_EL1, x1
+       isb
+1:
+       ret     x17
+endfunc errata_a55_768277_wa
+
+func check_errata_768277
+       mov     x1, #0x00
+       b       cpu_rev_var_ls
+endfunc check_errata_768277
+
+       /* ------------------------------------------------------------------
+        * Errata Workaround for Cortex A55 Errata #778703.
+        * This applies only to revision r0p0 of Cortex A55 where L2 cache is
+        * not configured.
+        * Inputs:
+        * x0: variant[4:7] and revision[0:3] of current cpu.
+        * Shall clobber: x0-x17
+        * ------------------------------------------------------------------
+        */
+func errata_a55_778703_wa
+       /*
+        * Compare x0 against revision r0p0 and check that no private L2 cache
+        * is configured
+        */
+       mov     x17, x30
+       bl      check_errata_778703
+       cbz     x0, 1f
+       mrs     x1, CORTEX_A55_CPUECTLR_EL1
+       orr     x1, x1, #CORTEX_A55_CPUECTLR_EL1_L1WSCTL
+       msr     CORTEX_A55_CPUECTLR_EL1, x1
+       mrs     x1, CORTEX_A55_CPUACTLR_EL1
+       orr     x1, x1, #CORTEX_A55_CPUACTLR_EL1_DISABLE_WRITE_STREAMING
+       msr     CORTEX_A55_CPUACTLR_EL1, x1
+       isb
+1:
+       ret     x17
+endfunc errata_a55_778703_wa
+
+func check_errata_778703
+       mov     x16, x30
+       mov     x1, #0x00
+       bl      cpu_rev_var_ls
+       /*
+        * Check that no private L2 cache is configured
+        */
+       mrs     x1, CORTEX_A55_CLIDR_EL1
+       and     x1, x1, CORTEX_A55_CLIDR_EL1_CTYPE3
+       cmp     x1, #0
+       mov     x2, #ERRATA_NOT_APPLIES
+       csel    x0, x0, x2, eq
+       ret     x16
+endfunc check_errata_778703
+
+       /* --------------------------------------------------
+        * Errata Workaround for Cortex A55 Errata #798797.
+        * This applies only to revision r0p0 of Cortex A55.
+        * Inputs:
+        * x0: variant[4:7] and revision[0:3] of current cpu.
+        * Shall clobber: x0-x17
+        * --------------------------------------------------
+        */
+func errata_a55_798797_wa
+       /*
+        * Compare x0 against revision r0p0
+        */
+       mov     x17, x30
+       bl      check_errata_798797
+       cbz     x0, 1f
+       mrs     x1, CORTEX_A55_CPUACTLR_EL1
+       orr     x1, x1, #CORTEX_A55_CPUACTLR_EL1_DISABLE_L1_PAGEWALKS
+       msr     CORTEX_A55_CPUACTLR_EL1, x1
+       isb
+1:
+       ret     x17
+endfunc errata_a55_798797_wa
+
+func check_errata_798797
+       mov     x1, #0x00
+       b       cpu_rev_var_ls
+endfunc check_errata_798797
+
+       /* --------------------------------------------------------------------
+        * Errata Workaround for Cortex A55 Errata #846532.
+        * This applies only to revisions <= r0p1 of Cortex A55.
+        * Disabling dual-issue has a small impact on performance. Disabling a
+        * power optimization feature is an alternate workaround with no impact
+        * on performance but with an increase in power consumption (see errata
+        * notice).
+        * Inputs:
+        * x0: variant[4:7] and revision[0:3] of current cpu.
+        * Shall clobber: x0-x17
+        * --------------------------------------------------------------------
+        */
+func errata_a55_846532_wa
+       /*
+        * Compare x0 against revision r0p1
+        */
+       mov     x17, x30
+       bl      check_errata_846532
+       cbz     x0, 1f
+       mrs     x1, CORTEX_A55_CPUACTLR_EL1
+       orr     x1, x1, #CORTEX_A55_CPUACTLR_EL1_DISABLE_DUAL_ISSUE
+       msr     CORTEX_A55_CPUACTLR_EL1, x1
+       isb
+1:
+       ret     x17
+endfunc errata_a55_846532_wa
+
+func check_errata_846532
+       mov     x1, #0x01
+       b       cpu_rev_var_ls
+endfunc check_errata_846532
+
+       /* -----------------------------------------------------
+        * Errata Workaround for Cortex A55 Errata #903758.
+        * This applies only to revisions <= r0p1 of Cortex A55.
+        * Inputs:
+        * x0: variant[4:7] and revision[0:3] of current cpu.
+        * Shall clobber: x0-x17
+        * -----------------------------------------------------
+        */
+func errata_a55_903758_wa
+       /*
+        * Compare x0 against revision r0p1
+        */
+       mov     x17, x30
+       bl      check_errata_903758
+       cbz     x0, 1f
+       mrs     x1, CORTEX_A55_CPUACTLR_EL1
+       orr     x1, x1, #CORTEX_A55_CPUACTLR_EL1_DISABLE_L1_PAGEWALKS
+       msr     CORTEX_A55_CPUACTLR_EL1, x1
+       isb
+1:
+       ret     x17
+endfunc errata_a55_903758_wa
+
+func check_errata_903758
+       mov     x1, #0x01
+       b       cpu_rev_var_ls
+endfunc check_errata_903758
+
 func cortex_a55_reset_func
        mov     x19, x30
+
 #if ERRATA_DSU_936184
        bl      errata_dsu_936184_wa
 #endif
+
+       bl      cpu_get_rev_var
+       mov     x18, x0
+
+#if ERRATA_A55_768277
+       mov     x0, x18
+       bl      errata_a55_768277_wa
+#endif
+
+#if ERRATA_A55_778703
+       mov     x0, x18
+       bl      errata_a55_778703_wa
+#endif
+
+#if ERRATA_A55_798797
+       mov     x0, x18
+       bl      errata_a55_798797_wa
+#endif
+
+#if ERRATA_A55_846532
+       mov     x0, x18
+       bl      errata_a55_846532_wa
+#endif
+
+#if ERRATA_A55_903758
+       mov     x0, x18
+       bl      errata_a55_903758_wa
+#endif
+
        ret     x19
 endfunc cortex_a55_reset_func
 
@@ -49,6 +238,11 @@ func cortex_a55_errata_report
         * "report_errata" is expecting it and it doesn't corrupt it.
         */
        report_errata ERRATA_DSU_936184, cortex_a55, dsu_936184
+       report_errata ERRATA_A55_768277, cortex_a55, 768277
+       report_errata ERRATA_A55_778703, cortex_a55, 778703
+       report_errata ERRATA_A55_798797, cortex_a55, 798797
+       report_errata ERRATA_A55_846532, cortex_a55, 846532
+       report_errata ERRATA_A55_903758, cortex_a55, 903758
 
        ldp     x8, x30, [sp], #16
        ret
index a862671660c715541f0915e87c04ed874c82a875..dd03c0f022bfbbc95e82317b5d798aaeecbb15fd 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014-2018, ARM Limited and Contributors. All rights reserved.
+ * Copyright (c) 2014-2019, ARM Limited and Contributors. All rights reserved.
  *
  * SPDX-License-Identifier: BSD-3-Clause
  */
@@ -59,6 +59,13 @@ func cortex_a57_disable_ext_debug
        mov     x0, #1
        msr     osdlr_el1, x0
        isb
+#if ERRATA_A57_817169
+       /*
+        * Invalidate any TLB address
+        */
+       mov     x0, #0
+       tlbi    vae3, x0
+#endif
        dsb     sy
        ret
 endfunc cortex_a57_disable_ext_debug
@@ -132,6 +139,48 @@ func check_errata_813420
        b       cpu_rev_var_ls
 endfunc check_errata_813420
 
+       /* ---------------------------------------------------
+        * Errata Workaround for Cortex A57 Errata #814670.
+        * This applies only to revision r0p0 of Cortex A57.
+        * Inputs:
+        * x0: variant[4:7] and revision[0:3] of current cpu.
+        * Shall clobber: x0-x17
+        * ---------------------------------------------------
+        */
+func errata_a57_814670_wa
+       /*
+        * Compare x0 against revision r0p0
+        */
+       mov     x17, x30
+       bl      check_errata_814670
+       cbz     x0, 1f
+       mrs     x1, CORTEX_A57_CPUACTLR_EL1
+       orr     x1, x1, #CORTEX_A57_CPUACTLR_EL1_DIS_DMB_NULLIFICATION
+       msr     CORTEX_A57_CPUACTLR_EL1, x1
+       isb
+1:
+       ret     x17
+endfunc errata_a57_814670_wa
+
+func check_errata_814670
+       mov     x1, #0x00
+       b       cpu_rev_var_ls
+endfunc check_errata_814670
+
+       /* ----------------------------------------------------
+        * Errata Workaround for Cortex A57 Errata #817169.
+        * This applies only to revision <= r0p1 of Cortex A57.
+        * ----------------------------------------------------
+        */
+func check_errata_817169
+       /*
+        * Even though this is only needed for revision <= r0p1, it
+        * is always applied because of the low cost of the workaround.
+        */
+       mov     x0, #ERRATA_APPLIES
+       ret
+endfunc check_errata_817169
+
        /* --------------------------------------------------------------------
         * Disable the over-read from the LDNP instruction.
         *
@@ -366,6 +415,11 @@ func cortex_a57_reset_func
        bl      errata_a57_813420_wa
 #endif
 
+#if ERRATA_A57_814670
+       mov     x0, x18
+       bl      errata_a57_814670_wa
+#endif
+
 #if A57_DISABLE_NON_TEMPORAL_HINT
        mov     x0, x18
        bl      a57_disable_ldnp_overread
@@ -537,6 +591,8 @@ func cortex_a57_errata_report
        report_errata ERRATA_A57_806969, cortex_a57, 806969
        report_errata ERRATA_A57_813419, cortex_a57, 813419
        report_errata ERRATA_A57_813420, cortex_a57, 813420
+       report_errata ERRATA_A57_814670, cortex_a57, 814670
+       report_errata ERRATA_A57_817169, cortex_a57, 817169
        report_errata A57_DISABLE_NON_TEMPORAL_HINT, cortex_a57, \
                disable_ldnp_overread
        report_errata ERRATA_A57_826974, cortex_a57, 826974
index 772b0be79d8708ebb811fac5563ac5b85e43b69c..5c8a8871d3f6d5f71d7dfe5f062a6b633d537795 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016-2018, ARM Limited and Contributors. All rights reserved.
+ * Copyright (c) 2016-2019, ARM Limited and Contributors. All rights reserved.
  *
  * SPDX-License-Identifier: BSD-3-Clause
  */
@@ -35,7 +35,82 @@ func cortex_a73_disable_smp
        ret
 endfunc cortex_a73_disable_smp
 
+       /* ---------------------------------------------------
+        * Errata Workaround for Cortex A73 Errata #852427.
+        * This applies only to revision r0p0 of Cortex A73.
+        * Inputs:
+        * x0: variant[4:7] and revision[0:3] of current cpu.
+        * Shall clobber: x0-x17
+        * ---------------------------------------------------
+        */
+func errata_a73_852427_wa
+       /*
+        * Compare x0 against revision r0p0
+        */
+       mov     x17, x30
+       bl      check_errata_852427
+       cbz     x0, 1f
+       mrs     x1, CORTEX_A73_DIAGNOSTIC_REGISTER
+       orr     x1, x1, #(1 << 12)
+       msr     CORTEX_A73_DIAGNOSTIC_REGISTER, x1
+       isb
+1:
+       ret     x17
+endfunc errata_a73_852427_wa
+
+func check_errata_852427
+       mov     x1, #0x00
+       b       cpu_rev_var_ls
+endfunc check_errata_852427
+
+       /* ---------------------------------------------------
+        * Errata Workaround for Cortex A73 Errata #855423.
+        * This applies only to revision <= r0p1 of Cortex A73.
+        * Inputs:
+        * x0: variant[4:7] and revision[0:3] of current cpu.
+        * Shall clobber: x0-x17
+        * ---------------------------------------------------
+        */
+func errata_a73_855423_wa
+       /*
+        * Compare x0 against revision r0p1
+        */
+       mov     x17, x30
+       bl      check_errata_855423
+       cbz     x0, 1f
+       mrs     x1, CORTEX_A73_IMP_DEF_REG2
+       orr     x1, x1, #(1 << 7)
+       msr     CORTEX_A73_IMP_DEF_REG2, x1
+       isb
+1:
+       ret     x17
+endfunc errata_a73_855423_wa
+
+func check_errata_855423
+       mov     x1, #0x01
+       b       cpu_rev_var_ls
+endfunc check_errata_855423
+
+       /* -------------------------------------------------
+        * The CPU Ops reset function for Cortex-A73.
+        * -------------------------------------------------
+        */
+
 func cortex_a73_reset_func
+       mov     x19, x30
+       bl      cpu_get_rev_var
+       mov     x18, x0
+
+#if ERRATA_A73_852427
+       mov     x0, x18
+       bl      errata_a73_852427_wa
+#endif
+
+#if ERRATA_A73_855423
+       mov     x0, x18
+       bl      errata_a73_855423_wa
+#endif
+
 #if IMAGE_BL31 && WORKAROUND_CVE_2017_5715
        cpu_check_csv2  x0, 1f
        adr     x0, wa_cve_2017_5715_bpiall_vbar
@@ -60,7 +135,7 @@ func cortex_a73_reset_func
        orr     x0, x0, #CORTEX_A73_CPUECTLR_SMP_BIT
        msr     CORTEX_A73_CPUECTLR_EL1, x0
        isb
-       ret
+       ret     x19
 endfunc cortex_a73_reset_func
 
 func cortex_a73_core_pwr_dwn
@@ -160,6 +235,8 @@ func cortex_a73_errata_report
         * Report all errata. The revision-variant information is passed to
         * checking functions of each errata.
         */
+       report_errata ERRATA_A73_852427, cortex_a73, 852427
+       report_errata ERRATA_A73_855423, cortex_a73, 855423
        report_errata WORKAROUND_CVE_2017_5715, cortex_a73, cve_2017_5715
        report_errata WORKAROUND_CVE_2018_3639, cortex_a73, cve_2018_3639
 
index e121b7da8036bb694400ac4006ab3497fd7506d8..20401889074b1a502428129bfd4c437c7a6788e8 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017-2018, ARM Limited and Contributors. All rights reserved.
+ * Copyright (c) 2017-2019, ARM Limited and Contributors. All rights reserved.
  *
  * SPDX-License-Identifier: BSD-3-Clause
  */
 #include <cpuamu.h>
 #include <cpu_macros.S>
 
+       /* --------------------------------------------------
+        * Errata Workaround for Cortex A75 Errata #764081.
+        * This applies only to revision r0p0 of Cortex A75.
+        * Inputs:
+        * x0: variant[4:7] and revision[0:3] of current cpu.
+        * Shall clobber: x0-x17
+        * --------------------------------------------------
+        */
+func errata_a75_764081_wa
+       /*
+        * Compare x0 against revision r0p0
+        */
+       mov     x17, x30
+       bl      check_errata_764081
+       cbz     x0, 1f
+       mrs     x1, sctlr_el3
+       orr     x1, x1 ,#SCTLR_IESB_BIT
+       msr     sctlr_el3, x1
+       isb
+1:
+       ret     x17
+endfunc errata_a75_764081_wa
+
+func check_errata_764081
+       mov     x1, #0x00
+       b       cpu_rev_var_ls
+endfunc check_errata_764081
+
+       /* --------------------------------------------------
+        * Errata Workaround for Cortex A75 Errata #790748.
+        * This applies only to revision r0p0 of Cortex A75.
+        * Inputs:
+        * x0: variant[4:7] and revision[0:3] of current cpu.
+        * Shall clobber: x0-x17
+        * --------------------------------------------------
+        */
+func errata_a75_790748_wa
+       /*
+        * Compare x0 against revision r0p0
+        */
+       mov     x17, x30
+       bl      check_errata_790748
+       cbz     x0, 1f
+       mrs     x1, CORTEX_A75_CPUACTLR_EL1
+       orr     x1, x1 ,#(1 << 13)
+       msr     CORTEX_A75_CPUACTLR_EL1, x1
+       isb
+1:
+       ret     x17
+endfunc errata_a75_790748_wa
+
+func check_errata_790748
+       mov     x1, #0x00
+       b       cpu_rev_var_ls
+endfunc check_errata_790748
+
+       /* -------------------------------------------------
+        * The CPU Ops reset function for Cortex-A75.
+        * -------------------------------------------------
+        */
 func cortex_a75_reset_func
        mov     x19, x30
+       bl      cpu_get_rev_var
+       mov     x18, x0
+
+#if ERRATA_A75_764081
+       mov     x0, x18
+       bl      errata_a75_764081_wa
+#endif
+
+#if ERRATA_A75_790748
+       mov     x0, x18
+       bl      errata_a75_790748_wa
+#endif
+
 #if IMAGE_BL31 && WORKAROUND_CVE_2017_5715
        cpu_check_csv2  x0, 1f
        adr     x0, wa_cve_2017_5715_bpiall_vbar
@@ -109,6 +182,8 @@ func cortex_a75_errata_report
         * Report all errata. The revision-variant information is passed to
         * checking functions of each errata.
         */
+       report_errata ERRATA_A75_764081, cortex_a75, 764081
+       report_errata ERRATA_A75_790748, cortex_a75, 790748
        report_errata WORKAROUND_CVE_2017_5715, cortex_a75, cve_2017_5715
        report_errata WORKAROUND_CVE_2018_3639, cortex_a75, cve_2018_3639
        report_errata ERRATA_DSU_936184, cortex_a75, dsu_936184
index 27db74e418d8f19741a961dab4afda02b4f69759..ac513432f76a043ffbbc6e68bec9784251ab4735 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017-2018, ARM Limited and Contributors. All rights reserved.
+ * Copyright (c) 2017-2019, ARM Limited and Contributors. All rights reserved.
  *
  * SPDX-License-Identifier: BSD-3-Clause
  */
@@ -189,6 +189,90 @@ vector_entry cortex_a76_serror_aarch32
        b       serror_aarch32
 end_vector_entry cortex_a76_serror_aarch32
 
+       /* --------------------------------------------------
+        * Errata Workaround for Cortex A76 Errata #1073348.
+        * This applies only to revision <= r1p0 of Cortex A76.
+        * Inputs:
+        * x0: variant[4:7] and revision[0:3] of current cpu.
+        * Shall clobber: x0-x17
+        * --------------------------------------------------
+        */
+func errata_a76_1073348_wa
+       /*
+        * Compare x0 against revision r1p0
+        */
+       mov     x17, x30
+       bl      check_errata_1073348
+       cbz     x0, 1f
+       mrs     x1, CORTEX_A76_CPUACTLR_EL1
+       orr     x1, x1 ,#CORTEX_A76_CPUACTLR_EL1_DISABLE_STATIC_PREDICTION
+       msr     CORTEX_A76_CPUACTLR_EL1, x1
+       isb
+1:
+       ret     x17
+       endfunc errata_a76_1073348_wa
+
+func check_errata_1073348
+       mov     x1, #0x10
+       b       cpu_rev_var_ls
+endfunc check_errata_1073348
+
+       /* --------------------------------------------------
+        * Errata Workaround for Cortex A76 Errata #1130799.
+        * This applies only to revision <= r2p0 of Cortex A76.
+        * Inputs:
+        * x0: variant[4:7] and revision[0:3] of current cpu.
+        * Shall clobber: x0-x17
+        * --------------------------------------------------
+        */
+func errata_a76_1130799_wa
+       /*
+        * Compare x0 against revision r2p0
+        */
+       mov     x17, x30
+       bl      check_errata_1130799
+       cbz     x0, 1f
+       mrs     x1, CORTEX_A76_CPUACTLR2_EL1
+       orr     x1, x1 ,#(1 << 59)
+       msr     CORTEX_A76_CPUACTLR2_EL1, x1
+       isb
+1:
+       ret     x17
+endfunc errata_a76_1130799_wa
+
+func check_errata_1130799
+       mov     x1, #0x20
+       b       cpu_rev_var_ls
+endfunc check_errata_1130799
+
+       /* --------------------------------------------------
+        * Errata Workaround for Cortex A76 Errata #1220197.
+        * This applies only to revision <= r2p0 of Cortex A76.
+        * Inputs:
+        * x0: variant[4:7] and revision[0:3] of current cpu.
+        * Shall clobber: x0-x17
+        * --------------------------------------------------
+        */
+func errata_a76_1220197_wa
+/*
+ * Compare x0 against revision r2p0
+ */
+       mov     x17, x30
+       bl      check_errata_1220197
+       cbz     x0, 1f
+       mrs     x1, CORTEX_A76_CPUECTLR_EL1
+       orr     x1, x1, #CORTEX_A76_CPUECTLR_EL1_WS_THR_L2
+       msr     CORTEX_A76_CPUECTLR_EL1, x1
+       isb
+1:
+       ret     x17
+endfunc errata_a76_1220197_wa
+
+func check_errata_1220197
+       mov     x1, #0x20
+       b       cpu_rev_var_ls
+endfunc check_errata_1220197
+
 func check_errata_cve_2018_3639
 #if WORKAROUND_CVE_2018_3639
        mov     x0, #ERRATA_APPLIES
@@ -206,8 +290,30 @@ func cortex_a76_disable_wa_cve_2018_3639
        ret
 endfunc cortex_a76_disable_wa_cve_2018_3639
 
+       /* -------------------------------------------------
+        * The CPU Ops reset function for Cortex-A76.
+        * Shall clobber: x0-x19
+        * -------------------------------------------------
+        */
 func cortex_a76_reset_func
        mov     x19, x30
+       bl      cpu_get_rev_var
+       mov     x18, x0
+
+#if ERRATA_A76_1073348
+       mov     x0, x18
+       bl      errata_a76_1073348_wa
+#endif
+
+#if ERRATA_A76_1130799
+       mov     x0, x18
+       bl      errata_a76_1130799_wa
+#endif
+
+#if ERRATA_A76_1220197
+       mov     x0, x18
+       bl      errata_a76_1220197_wa
+#endif
 
 #if WORKAROUND_CVE_2018_3639
        /* If the PE implements SSBS, we don't need the dynamic workaround */
@@ -271,6 +377,9 @@ func cortex_a76_errata_report
         * Report all errata. The revision-variant information is passed to
         * checking functions of each errata.
         */
+       report_errata ERRATA_A76_1073348, cortex_a76, 1073348
+       report_errata ERRATA_A76_1130799, cortex_a76, 1130799
+       report_errata ERRATA_A76_1220197, cortex_a76, 1220197
        report_errata WORKAROUND_CVE_2018_3639, cortex_a76, cve_2018_3639
        report_errata ERRATA_DSU_936184, cortex_a76, dsu_936184
 
diff --git a/lib/cpus/aarch64/cortex_ares.S b/lib/cpus/aarch64/cortex_ares.S
deleted file mode 100644 (file)
index 2788174..0000000
+++ /dev/null
@@ -1,136 +0,0 @@
-/*
- * Copyright (c) 2017-2018, ARM Limited and Contributors. All rights reserved.
- *
- * SPDX-License-Identifier: BSD-3-Clause
- */
-
-#include <arch.h>
-#include <asm_macros.S>
-#include <cortex_ares.h>
-#include <cpuamu.h>
-#include <cpu_macros.S>
-
-/* --------------------------------------------------
- * Errata Workaround for Cortex-Ares Errata
- * This applies to revision r0p0 and r1p0 of Cortex-Ares.
- * Inputs:
- * x0: variant[4:7] and revision[0:3] of current cpu.
- * Shall clobber: x0-x17
- * --------------------------------------------------
- */
-func errata_ares_1043202_wa
-       /* Compare x0 against revision r1p0 */
-       mov     x17, x30
-       bl      check_errata_1043202
-       cbz     x0, 1f
-
-       /* Apply instruction patching sequence */
-       ldr     x0, =0x0
-       msr     CPUPSELR_EL3, x0
-       ldr     x0, =0xF3BF8F2F
-       msr     CPUPOR_EL3, x0
-       ldr     x0, =0xFFFFFFFF
-       msr     CPUPMR_EL3, x0
-       ldr     x0, =0x800200071
-       msr     CPUPCR_EL3, x0
-       isb
-1:
-       ret     x17
-endfunc errata_ares_1043202_wa
-
-func check_errata_1043202
-       /* Applies to r0p0 and r1p0 */
-       mov     x1, #0x10
-       b       cpu_rev_var_ls
-endfunc check_errata_1043202
-
-func cortex_ares_reset_func
-       mov     x19, x30
-       bl      cpu_get_rev_var
-       mov     x18, x0
-
-#if ERRATA_ARES_1043202
-       mov     x0, x18
-       bl      errata_ares_1043202_wa
-#endif
-
-#if ENABLE_AMU
-       /* Make sure accesses from EL0/EL1 and EL2 are not trapped to EL3 */
-       mrs     x0, actlr_el3
-       orr     x0, x0, #CORTEX_ARES_ACTLR_AMEN_BIT
-       msr     actlr_el3, x0
-       isb
-
-       /* Make sure accesses from EL0/EL1 are not trapped to EL2 */
-       mrs     x0, actlr_el2
-       orr     x0, x0, #CORTEX_ARES_ACTLR_AMEN_BIT
-       msr     actlr_el2, x0
-       isb
-
-       /* Enable group0 counters */
-       mov     x0, #CORTEX_ARES_AMU_GROUP0_MASK
-       msr     CPUAMCNTENSET_EL0, x0
-       isb
-#endif
-       ret     x19
-endfunc cortex_ares_reset_func
-
-       /* ---------------------------------------------
-        * HW will do the cache maintenance while powering down
-        * ---------------------------------------------
-        */
-func cortex_ares_core_pwr_dwn
-       /* ---------------------------------------------
-        * Enable CPU power down bit in power control register
-        * ---------------------------------------------
-        */
-       mrs     x0, CORTEX_ARES_CPUPWRCTLR_EL1
-       orr     x0, x0, #CORTEX_ARES_CORE_PWRDN_EN_MASK
-       msr     CORTEX_ARES_CPUPWRCTLR_EL1, x0
-       isb
-       ret
-endfunc cortex_ares_core_pwr_dwn
-
-#if REPORT_ERRATA
-/*
- * Errata printing function for Cortex-Ares. Must follow AAPCS.
- */
-func cortex_ares_errata_report
-       stp     x8, x30, [sp, #-16]!
-
-       bl      cpu_get_rev_var
-       mov     x8, x0
-
-       /*
-        * Report all errata. The revision-variant information is passed to
-        * checking functions of each errata.
-        */
-       report_errata ERRATA_ARES_1043202, cortex_ares, 1043202
-
-       ldp     x8, x30, [sp], #16
-       ret
-endfunc cortex_ares_errata_report
-#endif
-
-       /* ---------------------------------------------
-        * This function provides cortex_ares specific
-        * register information for crash reporting.
-        * It needs to return with x6 pointing to
-        * a list of register names in ascii and
-        * x8 - x15 having values of registers to be
-        * reported.
-        * ---------------------------------------------
-        */
-.section .rodata.cortex_ares_regs, "aS"
-cortex_ares_regs:  /* The ascii list of register names to be reported */
-       .asciz  "cpuectlr_el1", ""
-
-func cortex_ares_cpu_reg_dump
-       adr     x6, cortex_ares_regs
-       mrs     x8, CORTEX_ARES_CPUECTLR_EL1
-       ret
-endfunc cortex_ares_cpu_reg_dump
-
-declare_cpu_ops cortex_ares, CORTEX_ARES_MIDR, \
-       cortex_ares_reset_func, \
-       cortex_ares_core_pwr_dwn
diff --git a/lib/cpus/aarch64/cortex_ares_pubsub.c b/lib/cpus/aarch64/cortex_ares_pubsub.c
deleted file mode 100644 (file)
index 4a4f333..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Copyright (c) 2018, ARM Limited and Contributors. All rights reserved.
- *
- * SPDX-License-Identifier: BSD-3-Clause
- */
-
-#include <cortex_ares.h>
-#include <cpuamu.h>
-#include <lib/el3_runtime/pubsub_events.h>
-
-static void *cortex_ares_context_save(const void *arg)
-{
-       if (midr_match(CORTEX_ARES_MIDR) != 0)
-               cpuamu_context_save(CORTEX_ARES_AMU_NR_COUNTERS);
-
-       return (void *)0;
-}
-
-static void *cortex_ares_context_restore(const void *arg)
-{
-       if (midr_match(CORTEX_ARES_MIDR) != 0)
-               cpuamu_context_restore(CORTEX_ARES_AMU_NR_COUNTERS);
-
-       return (void *)0;
-}
-
-SUBSCRIBE_TO_EVENT(psci_suspend_pwrdown_start, cortex_ares_context_save);
-SUBSCRIBE_TO_EVENT(psci_suspend_pwrdown_finish, cortex_ares_context_restore);
diff --git a/lib/cpus/aarch64/cortex_helios.S b/lib/cpus/aarch64/cortex_helios.S
deleted file mode 100644 (file)
index 7d3d7e4..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Copyright (c) 2018, ARM Limited and Contributors. All rights reserved.
- *
- * SPDX-License-Identifier: BSD-3-Clause
- */
-#include <arch.h>
-#include <asm_macros.S>
-#include <common/bl_common.h>
-#include <common/debug.h>
-#include <cortex_helios.h>
-#include <cpu_macros.S>
-#include <plat_macros.S>
-
-func cortex_helios_cpu_pwr_dwn
-       mrs     x0, CORTEX_HELIOS_CPUPWRCTLR_EL1
-       orr     x0, x0, #CORTEX_HELIOS_CPUPWRCTLR_EL1_CORE_PWRDN_BIT
-       msr     CORTEX_HELIOS_CPUPWRCTLR_EL1, x0
-       isb
-       ret
-endfunc cortex_helios_cpu_pwr_dwn
-
-#if REPORT_ERRATA
-/*
- * Errata printing function for Cortex Helios. Must follow AAPCS.
- */
-func cortex_helios_errata_report
-       ret
-endfunc cortex_helios_errata_report
-#endif
-
-
-.section .rodata.cortex_helios_regs, "aS"
-cortex_helios_regs:  /* The ascii list of register names to be reported */
-       .asciz  "cpuectlr_el1", ""
-
-func cortex_helios_cpu_reg_dump
-       adr     x6, cortex_helios_regs
-       mrs     x8, CORTEX_HELIOS_ECTLR_EL1
-       ret
-endfunc cortex_helios_cpu_reg_dump
-
-declare_cpu_ops cortex_helios, CORTEX_HELIOS_MIDR, \
-       CPU_NO_RESET_FUNC, \
-       cortex_helios_cpu_pwr_dwn
index 74d7bb2406b0ad93cbdb9cb3426a8f80a59080e4..de1177c3908e4941fe1593e94426eafe0feaa0ed 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014-2018, ARM Limited and Contributors. All rights reserved.
+ * Copyright (c) 2014-2019, ARM Limited and Contributors. All rights reserved.
  *
  * SPDX-License-Identifier: BSD-3-Clause
  */
@@ -7,6 +7,7 @@
 #include <arch.h>
 #include <asm_macros.S>
 #include <assert_macros.S>
+#include <common/bl_common.h>
 #include <common/debug.h>
 #include <cpu_macros.S>
 #include <lib/cpus/errata_report.h>
diff --git a/lib/cpus/aarch64/neoverse_e1.S b/lib/cpus/aarch64/neoverse_e1.S
new file mode 100644 (file)
index 0000000..8e40306
--- /dev/null
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 2018-2019, ARM Limited and Contributors. All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+#include <arch.h>
+#include <asm_macros.S>
+#include <common/bl_common.h>
+#include <common/debug.h>
+#include <neoverse_e1.h>
+#include <cpu_macros.S>
+#include <plat_macros.S>
+
+func neoverse_e1_cpu_pwr_dwn
+       mrs     x0, NEOVERSE_E1_CPUPWRCTLR_EL1
+       orr     x0, x0, #NEOVERSE_E1_CPUPWRCTLR_EL1_CORE_PWRDN_BIT
+       msr     NEOVERSE_E1_CPUPWRCTLR_EL1, x0
+       isb
+       ret
+endfunc neoverse_e1_cpu_pwr_dwn
+
+#if REPORT_ERRATA
+/*
+ * Errata printing function for Neoverse N1. Must follow AAPCS.
+ */
+func neoverse_e1_errata_report
+       ret
+endfunc neoverse_e1_errata_report
+#endif
+
+
+.section .rodata.neoverse_e1_regs, "aS"
+neoverse_e1_regs:  /* The ascii list of register names to be reported */
+       .asciz  "cpuectlr_el1", ""
+
+func neoverse_e1_cpu_reg_dump
+       adr     x6, neoverse_e1_regs
+       mrs     x8, NEOVERSE_E1_ECTLR_EL1
+       ret
+endfunc neoverse_e1_cpu_reg_dump
+
+declare_cpu_ops neoverse_e1, NEOVERSE_E1_MIDR, \
+       CPU_NO_RESET_FUNC, \
+       neoverse_e1_cpu_pwr_dwn
diff --git a/lib/cpus/aarch64/neoverse_n1.S b/lib/cpus/aarch64/neoverse_n1.S
new file mode 100644 (file)
index 0000000..c6a5c08
--- /dev/null
@@ -0,0 +1,136 @@
+/*
+ * Copyright (c) 2017-2019, ARM Limited and Contributors. All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+#include <arch.h>
+#include <asm_macros.S>
+#include <neoverse_n1.h>
+#include <cpuamu.h>
+#include <cpu_macros.S>
+
+/* --------------------------------------------------
+ * Errata Workaround for Neoverse N1 Errata
+ * This applies to revision r0p0 and r1p0 of Neoverse N1.
+ * Inputs:
+ * x0: variant[4:7] and revision[0:3] of current cpu.
+ * Shall clobber: x0-x17
+ * --------------------------------------------------
+ */
+func errata_n1_1043202_wa
+       /* Compare x0 against revision r1p0 */
+       mov     x17, x30
+       bl      check_errata_1043202
+       cbz     x0, 1f
+
+       /* Apply instruction patching sequence */
+       ldr     x0, =0x0
+       msr     CPUPSELR_EL3, x0
+       ldr     x0, =0xF3BF8F2F
+       msr     CPUPOR_EL3, x0
+       ldr     x0, =0xFFFFFFFF
+       msr     CPUPMR_EL3, x0
+       ldr     x0, =0x800200071
+       msr     CPUPCR_EL3, x0
+       isb
+1:
+       ret     x17
+endfunc errata_n1_1043202_wa
+
+func check_errata_1043202
+       /* Applies to r0p0 and r1p0 */
+       mov     x1, #0x10
+       b       cpu_rev_var_ls
+endfunc check_errata_1043202
+
+func neoverse_n1_reset_func
+       mov     x19, x30
+       bl      cpu_get_rev_var
+       mov     x18, x0
+
+#if ERRATA_N1_1043202
+       mov     x0, x18
+       bl      errata_n1_1043202_wa
+#endif
+
+#if ENABLE_AMU
+       /* Make sure accesses from EL0/EL1 and EL2 are not trapped to EL3 */
+       mrs     x0, actlr_el3
+       orr     x0, x0, #NEOVERSE_N1_ACTLR_AMEN_BIT
+       msr     actlr_el3, x0
+       isb
+
+       /* Make sure accesses from EL0/EL1 are not trapped to EL2 */
+       mrs     x0, actlr_el2
+       orr     x0, x0, #NEOVERSE_N1_ACTLR_AMEN_BIT
+       msr     actlr_el2, x0
+       isb
+
+       /* Enable group0 counters */
+       mov     x0, #NEOVERSE_N1_AMU_GROUP0_MASK
+       msr     CPUAMCNTENSET_EL0, x0
+       isb
+#endif
+       ret     x19
+endfunc neoverse_n1_reset_func
+
+       /* ---------------------------------------------
+        * HW will do the cache maintenance while powering down
+        * ---------------------------------------------
+        */
+func neoverse_n1_core_pwr_dwn
+       /* ---------------------------------------------
+        * Enable CPU power down bit in power control register
+        * ---------------------------------------------
+        */
+       mrs     x0, NEOVERSE_N1_CPUPWRCTLR_EL1
+       orr     x0, x0, #NEOVERSE_N1_CORE_PWRDN_EN_MASK
+       msr     NEOVERSE_N1_CPUPWRCTLR_EL1, x0
+       isb
+       ret
+endfunc neoverse_n1_core_pwr_dwn
+
+#if REPORT_ERRATA
+/*
+ * Errata printing function for Neoverse N1. Must follow AAPCS.
+ */
+func neoverse_n1_errata_report
+       stp     x8, x30, [sp, #-16]!
+
+       bl      cpu_get_rev_var
+       mov     x8, x0
+
+       /*
+        * Report all errata. The revision-variant information is passed to
+        * checking functions of each errata.
+        */
+       report_errata ERRATA_N1_1043202, neoverse_n1, 1043202
+
+       ldp     x8, x30, [sp], #16
+       ret
+endfunc neoverse_n1_errata_report
+#endif
+
+       /* ---------------------------------------------
+        * This function provides neoverse_n1 specific
+        * register information for crash reporting.
+        * It needs to return with x6 pointing to
+        * a list of register names in ascii and
+        * x8 - x15 having values of registers to be
+        * reported.
+        * ---------------------------------------------
+        */
+.section .rodata.neoverse_n1_regs, "aS"
+neoverse_n1_regs:  /* The ascii list of register names to be reported */
+       .asciz  "cpuectlr_el1", ""
+
+func neoverse_n1_cpu_reg_dump
+       adr     x6, neoverse_n1_regs
+       mrs     x8, NEOVERSE_N1_CPUECTLR_EL1
+       ret
+endfunc neoverse_n1_cpu_reg_dump
+
+declare_cpu_ops neoverse_n1, NEOVERSE_N1_MIDR, \
+       neoverse_n1_reset_func, \
+       neoverse_n1_core_pwr_dwn
diff --git a/lib/cpus/aarch64/neoverse_n1_pubsub.c b/lib/cpus/aarch64/neoverse_n1_pubsub.c
new file mode 100644 (file)
index 0000000..b1b7bb8
--- /dev/null
@@ -0,0 +1,28 @@
+/*
+ * Copyright (c) 2018-2019, ARM Limited and Contributors. All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+#include <neoverse_n1.h>
+#include <cpuamu.h>
+#include <lib/el3_runtime/pubsub_events.h>
+
+static void *neoverse_n1_context_save(const void *arg)
+{
+       if (midr_match(NEOVERSE_N1_MIDR) != 0)
+               cpuamu_context_save(NEOVERSE_N1_AMU_NR_COUNTERS);
+
+       return (void *)0;
+}
+
+static void *neoverse_n1_context_restore(const void *arg)
+{
+       if (midr_match(NEOVERSE_N1_MIDR) != 0)
+               cpuamu_context_restore(NEOVERSE_N1_AMU_NR_COUNTERS);
+
+       return (void *)0;
+}
+
+SUBSCRIBE_TO_EVENT(psci_suspend_pwrdown_start, neoverse_n1_context_save);
+SUBSCRIBE_TO_EVENT(psci_suspend_pwrdown_finish, neoverse_n1_context_restore);
index 40a8ac7ceb56909dadf3b23753566a665bdfd7fe..4985dd06240227a2e95d7b06db5fa5334c5c0351 100644 (file)
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2014-2018, ARM Limited and Contributors. All rights reserved.
+# Copyright (c) 2014-2019, ARM Limited and Contributors. All rights reserved.
 #
 # SPDX-License-Identifier: BSD-3-Clause
 #
@@ -53,10 +53,22 @@ endif
 # These should be enabled by the platform if the erratum workaround needs to be
 # applied.
 
+# Flag to apply erratum 819472 workaround during reset. This erratum applies
+# only to revision <= r0p1 of the Cortex A53 cpu.
+ERRATA_A53_819472      ?=0
+
+# Flag to apply erratum 824069 workaround during reset. This erratum applies
+# only to revision <= r0p2 of the Cortex A53 cpu.
+ERRATA_A53_824069      ?=0
+
 # Flag to apply erratum 826319 workaround during reset. This erratum applies
 # only to revision <= r0p2 of the Cortex A53 cpu.
 ERRATA_A53_826319      ?=0
 
+# Flag to apply erratum 827319 workaround during reset. This erratum applies
+# only to revision <= r0p2 of the Cortex A53 cpu.
+ERRATA_A53_827319      ?=0
+
 # Flag to apply erratum 835769 workaround at compile and link time.  This
 # erratum applies to revision <= r0p4 of the Cortex A53 cpu. Enabling this
 # workaround can lead the linker to create "*.stub" sections.
@@ -79,6 +91,26 @@ ERRATA_A53_843419    ?=0
 # of by the rich OS.
 ERRATA_A53_855873      ?=0
 
+# Flag to apply erratum 768277 workaround during reset. This erratum applies
+# only to revision r0p0 of the Cortex A55 cpu.
+ERRATA_A55_768277      ?=0
+
+# Flag to apply erratum 778703 workaround during reset. This erratum applies
+# only to revision r0p0 of the Cortex A55 cpu.
+ERRATA_A55_778703      ?=0
+
+# Flag to apply erratum 798797 workaround during reset. This erratum applies
+# only to revision r0p0 of the Cortex A55 cpu.
+ERRATA_A55_798797      ?=0
+
+# Flag to apply erratum 846532 workaround during reset. This erratum applies
+# only to revision <= r0p1 of the Cortex A55 cpu.
+ERRATA_A55_846532      ?=0
+
+# Flag to apply erratum 903758 workaround during reset. This erratum applies
+# only to revision <= r0p1 of the Cortex A55 cpu.
+ERRATA_A55_903758      ?=0
+
 # Flag to apply erratum 806969 workaround during reset. This erratum applies
 # only to revision r0p0 of the Cortex A57 cpu.
 ERRATA_A57_806969      ?=0
@@ -91,6 +123,14 @@ ERRATA_A57_813419   ?=0
 # only to revision r0p0 of the Cortex A57 cpu.
 ERRATA_A57_813420      ?=0
 
+# Flag to apply erratum 814670  workaround during reset. This erratum applies
+# only to revision r0p0 of the Cortex A57 cpu.
+ERRATA_A57_814670      ?=0
+
+# Flag to apply erratum 817169 workaround during power down. This erratum
+# applies only to revision <= r0p1 of the Cortex A57 cpu.
+ERRATA_A57_817169      ?=0
+
 # Flag to apply erratum 826974 workaround during reset. This erratum applies
 # only to revision <= r1p1 of the Cortex A57 cpu.
 ERRATA_A57_826974      ?=0
@@ -119,19 +159,59 @@ ERRATA_A57_859972 ?=0
 # only to revision <= r0p3 of the Cortex A72 cpu.
 ERRATA_A72_859971      ?=0
 
+# Flag to apply erratum 852427 workaround during reset. This erratum applies
+# only to revision r0p0 of the Cortex A73 cpu.
+ERRATA_A73_852427      ?=0
+
+# Flag to apply erratum 855423 workaround during reset. This erratum applies
+# only to revision <= r0p1 of the Cortex A73 cpu.
+ERRATA_A73_855423      ?=0
+
+# Flag to apply erratum 764081 workaround during reset. This erratum applies
+# only to revision <= r0p0 of the Cortex A75 cpu.
+ERRATA_A75_764081      ?=0
+
+# Flag to apply erratum 790748 workaround during reset. This erratum applies
+# only to revision <= r0p0 of the Cortex A75 cpu.
+ERRATA_A75_790748      ?=0
+
+# Flag to apply erratum 1073348 workaround during reset. This erratum applies
+# only to revision <= r1p0 of the Cortex A76 cpu.
+ERRATA_A76_1073348     ?=0
+
+# Flag to apply erratum 1130799 workaround during reset. This erratum applies
+# only to revision <= r2p0 of the Cortex A76 cpu.
+ERRATA_A76_1130799     ?=0
+
+# Flag to apply erratum 1220197 workaround during reset. This erratum applies
+# only to revision <= r2p0 of the Cortex A76 cpu.
+ERRATA_A76_1220197     ?=0
+
 # Flag to apply T32 CLREX workaround during reset. This erratum applies
-# only to r0p0 and r1p0 of the Ares cpu.
-ERRATA_ARES_1043202    ?=1
+# only to r0p0 and r1p0 of the Neoverse N1 cpu.
+ERRATA_N1_1043202      ?=1
 
 # Flag to apply DSU erratum 936184. This erratum applies to DSUs containing
 # the ACP interface and revision < r2p0. Applying the workaround results in
 # higher DSU power consumption on idle.
 ERRATA_DSU_936184      ?=0
 
+# Process ERRATA_A53_819472 flag
+$(eval $(call assert_boolean,ERRATA_A53_819472))
+$(eval $(call add_define,ERRATA_A53_819472))
+
+# Process ERRATA_A53_824069 flag
+$(eval $(call assert_boolean,ERRATA_A53_824069))
+$(eval $(call add_define,ERRATA_A53_824069))
+
 # Process ERRATA_A53_826319 flag
 $(eval $(call assert_boolean,ERRATA_A53_826319))
 $(eval $(call add_define,ERRATA_A53_826319))
 
+# Process ERRATA_A53_827319 flag
+$(eval $(call assert_boolean,ERRATA_A53_827319))
+$(eval $(call add_define,ERRATA_A53_827319))
+
 # Process ERRATA_A53_835769 flag
 $(eval $(call assert_boolean,ERRATA_A53_835769))
 $(eval $(call add_define,ERRATA_A53_835769))
@@ -148,6 +228,26 @@ $(eval $(call add_define,ERRATA_A53_843419))
 $(eval $(call assert_boolean,ERRATA_A53_855873))
 $(eval $(call add_define,ERRATA_A53_855873))
 
+# Process ERRATA_A55_768277 flag
+$(eval $(call assert_boolean,ERRATA_A55_768277))
+$(eval $(call add_define,ERRATA_A55_768277))
+
+# Process ERRATA_A55_778703 flag
+$(eval $(call assert_boolean,ERRATA_A55_778703))
+$(eval $(call add_define,ERRATA_A55_778703))
+
+# Process ERRATA_A55_798797 flag
+$(eval $(call assert_boolean,ERRATA_A55_798797))
+$(eval $(call add_define,ERRATA_A55_798797))
+
+# Process ERRATA_A55_846532 flag
+$(eval $(call assert_boolean,ERRATA_A55_846532))
+$(eval $(call add_define,ERRATA_A55_846532))
+
+# Process ERRATA_A55_903758 flag
+$(eval $(call assert_boolean,ERRATA_A55_903758))
+$(eval $(call add_define,ERRATA_A55_903758))
+
 # Process ERRATA_A57_806969 flag
 $(eval $(call assert_boolean,ERRATA_A57_806969))
 $(eval $(call add_define,ERRATA_A57_806969))
@@ -160,6 +260,14 @@ $(eval $(call add_define,ERRATA_A57_813419))
 $(eval $(call assert_boolean,ERRATA_A57_813420))
 $(eval $(call add_define,ERRATA_A57_813420))
 
+# Process ERRATA_A57_814670 flag
+$(eval $(call assert_boolean,ERRATA_A57_814670))
+$(eval $(call add_define,ERRATA_A57_814670))
+
+# Process ERRATA_A57_817169 flag
+$(eval $(call assert_boolean,ERRATA_A57_817169))
+$(eval $(call add_define,ERRATA_A57_817169))
+
 # Process ERRATA_A57_826974 flag
 $(eval $(call assert_boolean,ERRATA_A57_826974))
 $(eval $(call add_define,ERRATA_A57_826974))
@@ -188,9 +296,37 @@ $(eval $(call add_define,ERRATA_A57_859972))
 $(eval $(call assert_boolean,ERRATA_A72_859971))
 $(eval $(call add_define,ERRATA_A72_859971))
 
-# Process ERRATA_ARES_1043202 flag
-$(eval $(call assert_boolean,ERRATA_ARES_1043202))
-$(eval $(call add_define,ERRATA_ARES_1043202))
+# Process ERRATA_A73_852427 flag
+$(eval $(call assert_boolean,ERRATA_A73_852427))
+$(eval $(call add_define,ERRATA_A73_852427))
+
+# Process ERRATA_A73_855423 flag
+$(eval $(call assert_boolean,ERRATA_A73_855423))
+$(eval $(call add_define,ERRATA_A73_855423))
+
+# Process ERRATA_A75_764081 flag
+$(eval $(call assert_boolean,ERRATA_A75_764081))
+$(eval $(call add_define,ERRATA_A75_764081))
+
+# Process ERRATA_A75_790748 flag
+$(eval $(call assert_boolean,ERRATA_A75_790748))
+$(eval $(call add_define,ERRATA_A75_790748))
+
+# Process ERRATA_A76_1073348 flag
+$(eval $(call assert_boolean,ERRATA_A76_1073348))
+$(eval $(call add_define,ERRATA_A76_1073348))
+
+# Process ERRATA_A76_1130799 flag
+$(eval $(call assert_boolean,ERRATA_A76_1130799))
+$(eval $(call add_define,ERRATA_A76_1130799))
+
+# Process ERRATA_A76_1220197 flag
+$(eval $(call assert_boolean,ERRATA_A76_1220197))
+$(eval $(call add_define,ERRATA_A76_1220197))
+
+# Process ERRATA_N1_1043202 flag
+$(eval $(call assert_boolean,ERRATA_N1_1043202))
+$(eval $(call add_define,ERRATA_N1_1043202))
 
 # Process ERRATA_DSU_936184 flag
 $(eval $(call assert_boolean,ERRATA_DSU_936184))
index 707e6dbd4b80fe668cfded29b27759e8fdd7b0a6..4371cb2b211170059addeb0fef1ff9af42d1f15c 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013-2018, ARM Limited and Contributors. All rights reserved.
+ * Copyright (c) 2013-2019, ARM Limited and Contributors. All rights reserved.
  *
  * SPDX-License-Identifier: BSD-3-Clause
  */
 #if CTX_INCLUDE_FPREGS
        .global fpregs_context_save
        .global fpregs_context_restore
+#endif
+#if CTX_INCLUDE_PAUTH_REGS
+       .global pauth_context_restore
+       .global pauth_context_save
+#endif
+#if ENABLE_PAUTH
+       .global pauth_load_bl_apiakey
 #endif
        .global save_gp_registers
        .global restore_gp_registers
@@ -299,6 +306,96 @@ func fpregs_context_restore
 endfunc fpregs_context_restore
 #endif /* CTX_INCLUDE_FPREGS */
 
+#if CTX_INCLUDE_PAUTH_REGS
+/* -----------------------------------------------------
+ * The following function strictly follows the AArch64
+ * PCS to use x9-x17 (temporary caller-saved registers)
+ * to save the ARMv8.3-PAuth register context. It assumes
+ * that 'sp' is pointing to a 'cpu_context_t' structure
+ * to where the register context will be saved.
+ * -----------------------------------------------------
+ */
+func pauth_context_save
+       add     x11, sp, #CTX_PAUTH_REGS_OFFSET
+
+       mrs     x9, APIAKeyLo_EL1
+       mrs     x10, APIAKeyHi_EL1
+       stp     x9, x10, [x11, #CTX_PACIAKEY_LO]
+
+       mrs     x9, APIBKeyLo_EL1
+       mrs     x10, APIBKeyHi_EL1
+       stp     x9, x10, [x11, #CTX_PACIBKEY_LO]
+
+       mrs     x9, APDAKeyLo_EL1
+       mrs     x10, APDAKeyHi_EL1
+       stp     x9, x10, [x11, #CTX_PACDAKEY_LO]
+
+       mrs     x9, APDBKeyLo_EL1
+       mrs     x10, APDBKeyHi_EL1
+       stp     x9, x10, [x11, #CTX_PACDBKEY_LO]
+
+       mrs     x9, APGAKeyLo_EL1
+       mrs     x10, APGAKeyHi_EL1
+       stp     x9, x10, [x11, #CTX_PACGAKEY_LO]
+
+       ret
+endfunc pauth_context_save
+
+/* -----------------------------------------------------
+ * The following function strictly follows the AArch64
+ * PCS to use x9-x17 (temporary caller-saved registers)
+ * to restore the ARMv8.3-PAuth register context. It assumes
+ * that 'sp' is pointing to a 'cpu_context_t' structure
+ * from where the register context will be restored.
+ * -----------------------------------------------------
+ */
+func pauth_context_restore
+       add     x11, sp, #CTX_PAUTH_REGS_OFFSET
+
+       ldp     x9, x10, [x11, #CTX_PACIAKEY_LO]
+       msr     APIAKeyLo_EL1, x9
+       msr     APIAKeyHi_EL1, x10
+
+       ldp     x9, x10, [x11, #CTX_PACIAKEY_LO]
+       msr     APIBKeyLo_EL1, x9
+       msr     APIBKeyHi_EL1, x10
+
+       ldp     x9, x10, [x11, #CTX_PACDAKEY_LO]
+       msr     APDAKeyLo_EL1, x9
+       msr     APDAKeyHi_EL1, x10
+
+       ldp     x9, x10, [x11, #CTX_PACDBKEY_LO]
+       msr     APDBKeyLo_EL1, x9
+       msr     APDBKeyHi_EL1, x10
+
+       ldp     x9, x10, [x11, #CTX_PACGAKEY_LO]
+       msr     APGAKeyLo_EL1, x9
+       msr     APGAKeyHi_EL1, x10
+
+       ret
+endfunc pauth_context_restore
+#endif /* CTX_INCLUDE_PAUTH_REGS */
+
+/* -----------------------------------------------------
+ * The following function strictly follows the AArch64
+ * PCS to use x9-x17 (temporary caller-saved registers)
+ * to load the APIA key used by the firmware.
+ * -----------------------------------------------------
+ */
+#if ENABLE_PAUTH
+func pauth_load_bl_apiakey
+       /* Load instruction key A used by the Trusted Firmware. */
+       adrp    x11, plat_apiakey
+       add     x11, x11, :lo12:plat_apiakey
+       ldp     x9, x10, [x11, #0]
+
+       msr     APIAKeyLo_EL1, x9
+       msr     APIAKeyHi_EL1, x10
+
+       ret
+endfunc pauth_load_bl_apiakey
+#endif /* ENABLE_PAUTH */
+
 /* -----------------------------------------------------
  * The following functions are used to save and restore
  * all the general purpose registers. Ideally we would
@@ -332,9 +429,10 @@ func save_gp_registers
        ret
 endfunc save_gp_registers
 
-/*
+/* -----------------------------------------------------
  * This function restores all general purpose registers except x30 from the
  * CPU context. x30 register must be explicitly restored by the caller.
+ * -----------------------------------------------------
  */
 func restore_gp_registers
        ldp     x0, x1, [sp, #CTX_GPREGS_OFFSET + CTX_GPREG_X0]
@@ -357,9 +455,10 @@ func restore_gp_registers
        ret
 endfunc restore_gp_registers
 
-/*
- * Restore general purpose registers (including x30), and exit EL3 via. ERET to
+/* -----------------------------------------------------
+ * Restore general purpose registers (including x30), and exit EL3 via ERET to
  * a lower exception level.
+ * -----------------------------------------------------
  */
 func restore_gp_registers_eret
        bl      restore_gp_registers
@@ -377,12 +476,12 @@ func restore_gp_registers_eret
        eret
 endfunc        restore_gp_registers_eret
 
-       /* -----------------------------------------------------
       * This routine assumes that the SP_EL3 is pointing to
       * a valid context structure from where the gp regs and
       * other special registers can be retrieved.
       * -----------------------------------------------------
       */
+/* -----------------------------------------------------
+ * This routine assumes that the SP_EL3 is pointing to
+ * a valid context structure from where the gp regs and
+ * other special registers can be retrieved.
+ * -----------------------------------------------------
+ */
 func el3_exit
        /* -----------------------------------------------------
         * Save the current SP_EL0 i.e. the EL3 runtime stack
@@ -410,9 +509,14 @@ func el3_exit
        cmp     x17, xzr
        beq     1f
        blr     x17
+1:
+#endif
+
+#if CTX_INCLUDE_PAUTH_REGS
+       /* Restore ARMv8.3-PAuth registers */
+       bl      pauth_context_restore
 #endif
 
-1:
        /* Restore saved general purpose registers and return */
        b       restore_gp_registers_eret
 endfunc el3_exit
index b956491e3e84b7efc79a32b79a7e895333cfa030..89d7ed682dc9a410ce15d5baaa147cebb190919b 100644 (file)
@@ -122,6 +122,20 @@ void cm_setup_context(cpu_context_t *ctx, const entry_point_info_t *ep)
        scr_el3 |= SCR_FIEN_BIT;
 #endif
 
+#if !CTX_INCLUDE_PAUTH_REGS
+       /*
+        * If the pointer authentication registers aren't saved during world
+        * switches the value of the registers can be leaked from the Secure to
+        * the Non-secure world. To prevent this, rather than enabling pointer
+        * authentication everywhere, we only enable it in the Non-secure world.
+        *
+        * If the Secure world wants to use pointer authentication,
+        * CTX_INCLUDE_PAUTH_REGS must be set to 1.
+        */
+       if (security_state == NON_SECURE)
+               scr_el3 |= SCR_API_BIT | SCR_APK_BIT;
+#endif /* !CTX_INCLUDE_PAUTH_REGS */
+
 #ifdef IMAGE_BL31
        /*
         * SCR_EL3.IRQ, SCR_EL3.FIQ: Enable the physical FIQ and IRQ routing as
@@ -173,6 +187,14 @@ void cm_setup_context(cpu_context_t *ctx, const entry_point_info_t *ep)
                                        | SCTLR_NTWI_BIT | SCTLR_NTWE_BIT;
        }
 
+#if ERRATA_A75_764081
+       /*
+        * If workaround of errata 764081 for Cortex-A75 is used then set
+        * SCTLR_EL1.IESB to enable Implicit Error Synchronization Barrier.
+        */
+       sctlr_elx |= SCTLR_IESB_BIT;
+#endif
+
        /*
         * Store the initialised SCTLR_EL1 value in the cpu_context - SCTLR_EL2
         * and other EL2 registers are set up by cm_prepare_ns_entry() as they
@@ -305,6 +327,14 @@ void cm_prepare_el3_exit(uint32_t security_state)
                                                           CTX_SCTLR_EL1);
                        sctlr_elx &= SCTLR_EE_BIT;
                        sctlr_elx |= SCTLR_EL2_RES1;
+#if ERRATA_A75_764081
+                       /*
+                        * If workaround of errata 764081 for Cortex-A75 is used
+                        * then set SCTLR_EL2.IESB to enable Implicit Error
+                        * Synchronization Barrier.
+                        */
+                       sctlr_elx |= SCTLR_IESB_BIT;
+#endif
                        write_sctlr_el2(sctlr_elx);
                } else if (el_implemented(2) != EL_IMPL_NONE) {
                        el2_unused = true;
index 01667079019578d5edaf08a2d380df8fec942af5..e794f013b65394830a8969d0901313186bfb4c47 100644 (file)
@@ -31,11 +31,19 @@ void mpam_enable(bool el2_unused)
        /*
         * If EL2 is implemented but unused, disable trapping to EL2 when lower
         * ELs access their own MPAM registers.
+        * If EL2 is implemented and used, enable trapping to EL2.
         */
        if (el2_unused) {
                write_mpam2_el2(0);
 
                if ((read_mpamidr_el1() & MPAMIDR_HAS_HCR_BIT) != 0U)
                        write_mpamhcr_el2(0);
+       } else {
+               write_mpam2_el2(MPAM2_EL2_TRAPMPAM0EL1 |
+                               MPAM2_EL2_TRAPMPAM1EL1);
+
+               if ((read_mpamidr_el1() & MPAMIDR_HAS_HCR_BIT) != 0U) {
+                       write_mpamhcr_el2(MPAMHCR_EL2_TRAP_MPAMIDR_EL1);
+               }
        }
 }
diff --git a/lib/xlat_tables/aarch32/nonlpae_tables.c b/lib/xlat_tables/aarch32/nonlpae_tables.c
new file mode 100644 (file)
index 0000000..eca3be3
--- /dev/null
@@ -0,0 +1,550 @@
+/*
+ * Copyright (c) 2016-2017, Linaro Limited. All rights reserved.
+ * Copyright (c) 2014-2017, Arm Limited. All rights reserved.
+ * Copyright (c) 2014, STMicroelectronics International N.V.
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+#include <assert.h>
+#include <stdio.h>
+#include <string.h>
+
+#include <platform_def.h>
+
+#include <arch.h>
+#include <arch_helpers.h>
+#include <common/debug.h>
+#include <lib/cassert.h>
+#include <lib/utils.h>
+#include <lib/xlat_tables/xlat_tables.h>
+
+#include "../xlat_tables_private.h"
+
+#ifdef ARMV7_SUPPORTS_LARGE_PAGE_ADDRESSING
+#error "ARMV7_SUPPORTS_LARGE_PAGE_ADDRESSING flag is set. \
+This module is to be used when LPAE is not supported"
+#endif
+
+CASSERT(PLAT_VIRT_ADDR_SPACE_SIZE == (1ULL << 32), invalid_vaddr_space_size);
+CASSERT(PLAT_PHY_ADDR_SPACE_SIZE == (1ULL << 32), invalid_paddr_space_size);
+
+#define MMU32B_UNSET_DESC      ~0ul
+#define MMU32B_INVALID_DESC    0ul
+
+#define MT_UNKNOWN     ~0U
+
+/*
+ * MMU related values
+ */
+
+/* Sharable */
+#define MMU32B_TTB_S           (1 << 1)
+
+/* Not Outer Sharable */
+#define MMU32B_TTB_NOS         (1 << 5)
+
+/* Normal memory, Inner Non-cacheable */
+#define MMU32B_TTB_IRGN_NC     0
+
+/* Normal memory, Inner Write-Back Write-Allocate Cacheable */
+#define MMU32B_TTB_IRGN_WBWA   (1 << 6)
+
+/* Normal memory, Inner Write-Through Cacheable */
+#define MMU32B_TTB_IRGN_WT     1
+
+/* Normal memory, Inner Write-Back no Write-Allocate Cacheable */
+#define MMU32B_TTB_IRGN_WB     (1 | (1 << 6))
+
+/* Normal memory, Outer Write-Back Write-Allocate Cacheable */
+#define MMU32B_TTB_RNG_WBWA    (1 << 3)
+
+#define MMU32B_DEFAULT_ATTRS \
+               (MMU32B_TTB_S | MMU32B_TTB_NOS | \
+                MMU32B_TTB_IRGN_WBWA | MMU32B_TTB_RNG_WBWA)
+
+/* armv7 memory mapping attributes: section mapping */
+#define SECTION_SECURE                 (0 << 19)
+#define SECTION_NOTSECURE              (1 << 19)
+#define SECTION_SHARED                 (1 << 16)
+#define SECTION_NOTGLOBAL              (1 << 17)
+#define SECTION_ACCESS_FLAG            (1 << 10)
+#define SECTION_UNPRIV                 (1 << 11)
+#define SECTION_RO                     (1 << 15)
+#define SECTION_TEX(tex)               ((((tex) >> 2) << 12) | \
+                                       ((((tex) >> 1) & 0x1) << 3) | \
+                                       (((tex) & 0x1) << 2))
+#define SECTION_DEVICE                 SECTION_TEX(MMU32B_ATTR_DEVICE_INDEX)
+#define SECTION_NORMAL                 SECTION_TEX(MMU32B_ATTR_DEVICE_INDEX)
+#define SECTION_NORMAL_CACHED          \
+                               SECTION_TEX(MMU32B_ATTR_IWBWA_OWBWA_INDEX)
+
+#define SECTION_XN                     (1 << 4)
+#define SECTION_PXN                    (1 << 0)
+#define SECTION_SECTION                        (2 << 0)
+
+#define SECTION_PT_NOTSECURE           (1 << 3)
+#define SECTION_PT_PT                  (1 << 0)
+
+#define SMALL_PAGE_SMALL_PAGE          (1 << 1)
+#define SMALL_PAGE_SHARED              (1 << 10)
+#define SMALL_PAGE_NOTGLOBAL           (1 << 11)
+#define SMALL_PAGE_TEX(tex)            ((((tex) >> 2) << 6) | \
+                                       ((((tex) >> 1) & 0x1) << 3) | \
+                                       (((tex) & 0x1) << 2))
+#define SMALL_PAGE_DEVICE              \
+                               SMALL_PAGE_TEX(MMU32B_ATTR_DEVICE_INDEX)
+#define SMALL_PAGE_NORMAL              \
+                               SMALL_PAGE_TEX(MMU32B_ATTR_DEVICE_INDEX)
+#define SMALL_PAGE_NORMAL_CACHED       \
+                               SMALL_PAGE_TEX(MMU32B_ATTR_IWBWA_OWBWA_INDEX)
+#define SMALL_PAGE_ACCESS_FLAG         (1 << 4)
+#define SMALL_PAGE_UNPRIV              (1 << 5)
+#define SMALL_PAGE_RO                  (1 << 9)
+#define SMALL_PAGE_XN                  (1 << 0)
+
+/* The TEX, C and B bits concatenated */
+#define MMU32B_ATTR_DEVICE_INDEX               0x0
+#define MMU32B_ATTR_IWBWA_OWBWA_INDEX          0x1
+
+#define MMU32B_PRRR_IDX(idx, tr, nos)  (((tr) << (2 * (idx))) | \
+                                        ((uint32_t)(nos) << ((idx) + 24)))
+#define MMU32B_NMRR_IDX(idx, ir, or)   (((ir) << (2 * (idx))) | \
+                                        ((uint32_t)(or) << (2 * (idx) + 16)))
+#define MMU32B_PRRR_DS0                        (1 << 16)
+#define MMU32B_PRRR_DS1                        (1 << 17)
+#define MMU32B_PRRR_NS0                        (1 << 18)
+#define MMU32B_PRRR_NS1                        (1 << 19)
+
+#define DACR_DOMAIN(num, perm)         ((perm) << ((num) * 2))
+#define DACR_DOMAIN_PERM_NO_ACCESS     0x0
+#define DACR_DOMAIN_PERM_CLIENT                0x1
+#define DACR_DOMAIN_PERM_MANAGER       0x3
+
+#define NUM_1MB_IN_4GB         (1 << 12)
+#define NUM_4K_IN_1MB          (1 << 8)
+
+#define ONE_MB_SHIFT           20
+
+/* mmu 32b integration */
+#define MMU32B_L1_TABLE_SIZE           (NUM_1MB_IN_4GB * 4)
+#define MMU32B_L2_TABLE_SIZE           (NUM_4K_IN_1MB * 4)
+#define MMU32B_L1_TABLE_ALIGN          (1 << 14)
+#define MMU32B_L2_TABLE_ALIGN          (1 << 10)
+
+static unsigned int next_xlat;
+static unsigned long long xlat_max_pa;
+static uintptr_t xlat_max_va;
+
+static uint32_t mmu_l1_base[NUM_1MB_IN_4GB]
+       __aligned(MMU32B_L1_TABLE_ALIGN) __attribute__((section("xlat_table")));
+
+static uint32_t mmu_l2_base[MAX_XLAT_TABLES][NUM_4K_IN_1MB]
+       __aligned(MMU32B_L2_TABLE_ALIGN) __attribute__((section("xlat_table")));
+
+/*
+ * Array of all memory regions stored in order of ascending base address.
+ * The list is terminated by the first entry with size == 0.
+ */
+static mmap_region_t mmap[MAX_MMAP_REGIONS + 1];
+
+void print_mmap(void)
+{
+#if LOG_LEVEL >= LOG_LEVEL_VERBOSE
+       mmap_region_t *mm = mmap;
+
+       printf("init xlat - l1:%p  l2:%p (%d)\n",
+                   (void *)mmu_l1_base, (void *)mmu_l2_base, MAX_XLAT_TABLES);
+       printf("mmap:\n");
+       while (mm->size) {
+               printf(" VA:%p  PA:0x%llx  size:0x%zx  attr:0x%x\n",
+                               (void *)mm->base_va, mm->base_pa,
+                               mm->size, mm->attr);
+               ++mm;
+       };
+       printf("\n");
+#endif
+}
+
+void mmap_add(const mmap_region_t *mm)
+{
+       const mmap_region_t *mm_cursor = mm;
+
+       while ((mm_cursor->size != 0U) || (mm_cursor->attr != 0U)) {
+               mmap_add_region(mm_cursor->base_pa, mm_cursor->base_va,
+                               mm_cursor->size, mm_cursor->attr);
+               mm_cursor++;
+       }
+}
+
+void mmap_add_region(unsigned long long base_pa, uintptr_t base_va,
+                    size_t size, unsigned int attr)
+{
+       mmap_region_t *mm = mmap;
+       const mmap_region_t *mm_last = mm + ARRAY_SIZE(mmap) - 1U;
+       unsigned long long end_pa = base_pa + size - 1U;
+       uintptr_t end_va = base_va + size - 1U;
+
+       assert(IS_PAGE_ALIGNED(base_pa));
+       assert(IS_PAGE_ALIGNED(base_va));
+       assert(IS_PAGE_ALIGNED(size));
+
+       if (size == 0U)
+               return;
+
+       assert(base_pa < end_pa); /* Check for overflows */
+       assert(base_va < end_va);
+
+       assert((base_va + (uintptr_t)size - (uintptr_t)1) <=
+                                       (PLAT_VIRT_ADDR_SPACE_SIZE - 1U));
+       assert((base_pa + (unsigned long long)size - 1ULL) <=
+                                       (PLAT_PHY_ADDR_SPACE_SIZE - 1U));
+
+#if ENABLE_ASSERTIONS
+
+       /* Check for PAs and VAs overlaps with all other regions */
+       for (mm = mmap; mm->size; ++mm) {
+
+               uintptr_t mm_end_va = mm->base_va + mm->size - 1U;
+
+               /*
+                * Check if one of the regions is completely inside the other
+                * one.
+                */
+               bool fully_overlapped_va =
+                       ((base_va >= mm->base_va) && (end_va <= mm_end_va)) ||
+                       ((mm->base_va >= base_va) && (mm_end_va <= end_va));
+
+               /*
+                * Full VA overlaps are only allowed if both regions are
+                * identity mapped (zero offset) or have the same VA to PA
+                * offset. Also, make sure that it's not the exact same area.
+                */
+               if (fully_overlapped_va) {
+                       assert((mm->base_va - mm->base_pa) ==
+                              (base_va - base_pa));
+                       assert((base_va != mm->base_va) || (size != mm->size));
+               } else {
+                       /*
+                        * If the regions do not have fully overlapping VAs,
+                        * then they must have fully separated VAs and PAs.
+                        * Partial overlaps are not allowed
+                        */
+
+                       unsigned long long mm_end_pa =
+                                                    mm->base_pa + mm->size - 1;
+
+                       bool separated_pa = (end_pa < mm->base_pa) ||
+                               (base_pa > mm_end_pa);
+                       bool separated_va = (end_va < mm->base_va) ||
+                               (base_va > mm_end_va);
+
+                       assert(separated_va && separated_pa);
+               }
+       }
+
+       mm = mmap; /* Restore pointer to the start of the array */
+
+#endif /* ENABLE_ASSERTIONS */
+
+       /* Find correct place in mmap to insert new region */
+       while ((mm->base_va < base_va) && (mm->size != 0U))
+               ++mm;
+
+       /*
+        * If a section is contained inside another one with the same base
+        * address, it must be placed after the one it is contained in:
+        *
+        * 1st |-----------------------|
+        * 2nd |------------|
+        * 3rd |------|
+        *
+        * This is required for mmap_region_attr() to get the attributes of the
+        * small region correctly.
+        */
+       while ((mm->base_va == base_va) && (mm->size > size))
+               ++mm;
+
+       /* Make room for new region by moving other regions up by one place */
+       (void)memmove(mm + 1, mm, (uintptr_t)mm_last - (uintptr_t)mm);
+
+       /* Check we haven't lost the empty sentinal from the end of the array */
+       assert(mm_last->size == 0U);
+
+       mm->base_pa = base_pa;
+       mm->base_va = base_va;
+       mm->size = size;
+       mm->attr = attr;
+
+       if (end_pa > xlat_max_pa)
+               xlat_max_pa = end_pa;
+       if (end_va > xlat_max_va)
+               xlat_max_va = end_va;
+}
+
+/* map all memory as shared/global/domain0/no-usr access */
+static unsigned long mmap_desc(unsigned attr, unsigned long addr_pa,
+                                       unsigned int level)
+{
+       unsigned long desc;
+
+       switch (level) {
+       case 1:
+               assert(!(addr_pa & (MMU32B_L1_TABLE_ALIGN - 1)));
+
+               desc = SECTION_SECTION | SECTION_SHARED;
+
+               desc |= attr & MT_NS ? SECTION_NOTSECURE : 0;
+
+               desc |= SECTION_ACCESS_FLAG;
+               desc |= attr & MT_RW ? 0 : SECTION_RO;
+
+               desc |= attr & MT_MEMORY ?
+                       SECTION_NORMAL_CACHED : SECTION_DEVICE;
+
+               if ((attr & MT_RW) || !(attr & MT_MEMORY))
+                       desc |= SECTION_XN;
+               break;
+       case 2:
+               assert(!(addr_pa & (MMU32B_L2_TABLE_ALIGN - 1)));
+
+               desc = SMALL_PAGE_SMALL_PAGE | SMALL_PAGE_SHARED;
+
+               desc |= SMALL_PAGE_ACCESS_FLAG;
+               desc |= attr & MT_RW ? 0 : SMALL_PAGE_RO;
+
+               desc |= attr & MT_MEMORY ?
+                       SMALL_PAGE_NORMAL_CACHED : SMALL_PAGE_DEVICE;
+
+               if ((attr & MT_RW) || !(attr & MT_MEMORY))
+                       desc |= SMALL_PAGE_XN;
+               break;
+       default:
+               panic();
+       }
+#if LOG_LEVEL >= LOG_LEVEL_VERBOSE
+       /* dump only the non-lpae level 2 tables */
+       if (level == 2) {
+               printf(attr & MT_MEMORY ? "MEM" : "dev");
+               printf(attr & MT_RW ? "-rw" : "-RO");
+               printf(attr & MT_NS ? "-NS" : "-S");
+       }
+#endif
+       return desc | addr_pa;
+}
+
+static unsigned int mmap_region_attr(const mmap_region_t *mm, uintptr_t base_va,
+                                    size_t size, unsigned int *attr)
+{
+       /* Don't assume that the area is contained in the first region */
+       unsigned int ret = MT_UNKNOWN;
+
+       /*
+        * Get attributes from last (innermost) region that contains the
+        * requested area. Don't stop as soon as one region doesn't contain it
+        * because there may be other internal regions that contain this area:
+        *
+        * |-----------------------------1-----------------------------|
+        * |----2----|     |-------3-------|    |----5----|
+        *                   |--4--|
+        *
+        *                   |---| <- Area we want the attributes of.
+        *
+        * In this example, the area is contained in regions 1, 3 and 4 but not
+        * in region 2. The loop shouldn't stop at region 2 as inner regions
+        * have priority over outer regions, it should stop at region 5.
+        */
+       for ( ; ; ++mm) {
+
+               if (mm->size == 0U)
+                       return ret; /* Reached end of list */
+
+               if (mm->base_va > (base_va + size - 1U))
+                       return ret; /* Next region is after area so end */
+
+               if ((mm->base_va + mm->size - 1U) < base_va)
+                       continue; /* Next region has already been overtaken */
+
+               if ((ret == 0U) && (mm->attr == *attr))
+                       continue; /* Region doesn't override attribs so skip */
+
+               if ((mm->base_va > base_va) ||
+                       ((mm->base_va + mm->size - 1U) < (base_va + size - 1U)))
+                       return MT_UNKNOWN; /* Region doesn't fully cover area */
+
+               *attr = mm->attr;
+               ret = 0U;
+       }
+       return ret;
+}
+
+static mmap_region_t *init_xlation_table_inner(mmap_region_t *mm,
+                                               unsigned long base_va,
+                                               unsigned long *table,
+                                               unsigned int level)
+{
+       unsigned int level_size_shift = (level == 1) ?
+                                       ONE_MB_SHIFT : FOUR_KB_SHIFT;
+       unsigned int level_size = 1 << level_size_shift;
+       unsigned long level_index_mask = (level == 1) ?
+                                       (NUM_1MB_IN_4GB - 1) << ONE_MB_SHIFT :
+                                       (NUM_4K_IN_1MB - 1) << FOUR_KB_SHIFT;
+
+       assert(level == 1 || level == 2);
+
+       VERBOSE("init xlat table at %p (level%1d)\n", (void *)table, level);
+
+       do  {
+               unsigned long desc = MMU32B_UNSET_DESC;
+
+               if (mm->base_va + mm->size <= base_va) {
+                       /* Area now after the region so skip it */
+                       ++mm;
+                       continue;
+               }
+#if LOG_LEVEL >= LOG_LEVEL_VERBOSE
+               /* dump only non-lpae level 2 tables content */
+               if (level == 2)
+                       printf("      0x%lx %x " + 6 - 2 * level,
+                                               base_va, level_size);
+#endif
+               if (mm->base_va >= base_va + level_size) {
+                       /* Next region is after area so nothing to map yet */
+                       desc = MMU32B_INVALID_DESC;
+               } else if (mm->base_va <= base_va && mm->base_va + mm->size >=
+                               base_va + level_size) {
+                       /* Next region covers all of area */
+                       unsigned int attr = mm->attr;
+                       unsigned int r = mmap_region_attr(mm, base_va,
+                                                         level_size, &attr);
+
+                       if (r == 0U) {
+                               desc = mmap_desc(attr,
+                                       base_va - mm->base_va + mm->base_pa,
+                                       level);
+                       }
+               }
+
+               if (desc == MMU32B_UNSET_DESC) {
+                       unsigned long xlat_table;
+
+                       /*
+                        * Area not covered by a region so need finer table
+                        * Reuse next level table if any (assert attrib matching).
+                        * Otherwise allocate a xlat table.
+                        */
+                       if (*table) {
+                               assert((*table & 3) == SECTION_PT_PT);
+                               assert(!(*table & SECTION_PT_NOTSECURE) ==
+                                                       !(mm->attr & MT_NS));
+
+                               xlat_table = (*table) &
+                                               ~(MMU32B_L1_TABLE_ALIGN - 1);
+                               desc = *table;
+                       } else {
+                               xlat_table = (unsigned long)mmu_l2_base +
+                                       next_xlat * MMU32B_L2_TABLE_SIZE;
+                               assert(++next_xlat <= MAX_XLAT_TABLES);
+                               memset((char *)xlat_table, 0,
+                                       MMU32B_L2_TABLE_SIZE);
+
+                               desc = xlat_table | SECTION_PT_PT;
+                               desc |= mm->attr & MT_NS ?
+                                       SECTION_PT_NOTSECURE : 0;
+                       }
+                       /* Recurse to fill in new table */
+                       mm = init_xlation_table_inner(mm, base_va,
+                                               (unsigned long *)xlat_table,
+                                               level + 1);
+               }
+#if LOG_LEVEL >= LOG_LEVEL_VERBOSE
+               /* dump only non-lpae level 2 tables content */
+               if (level == 2)
+                       printf("\n");
+#endif
+               *table++ = desc;
+               base_va += level_size;
+       } while (mm->size && (base_va & level_index_mask));
+
+       return mm;
+}
+
+void init_xlat_tables(void)
+{
+       print_mmap();
+
+       assert(!((unsigned int)mmu_l1_base & (MMU32B_L1_TABLE_ALIGN - 1)));
+       assert(!((unsigned int)mmu_l2_base & (MMU32B_L2_TABLE_ALIGN - 1)));
+
+       memset(mmu_l1_base, 0, MMU32B_L1_TABLE_SIZE);
+
+       init_xlation_table_inner(mmap, 0, (unsigned long *)mmu_l1_base, 1);
+
+       VERBOSE("init xlat - max_va=%p, max_pa=%llx\n",
+                       (void *)xlat_max_va, xlat_max_pa);
+       assert(xlat_max_va <= PLAT_VIRT_ADDR_SPACE_SIZE - 1);
+       assert(xlat_max_pa <= PLAT_VIRT_ADDR_SPACE_SIZE - 1);
+}
+
+/*******************************************************************************
+ * Function for enabling the MMU in Secure PL1, assuming that the
+ * page-tables have already been created.
+ ******************************************************************************/
+void enable_mmu_svc_mon(unsigned int flags)
+{
+       unsigned int prrr;
+       unsigned int nmrr;
+       unsigned int sctlr;
+
+       assert(IS_IN_SECURE());
+       assert((read_sctlr() & SCTLR_M_BIT) == 0);
+
+       /* Enable Access flag (simplified access permissions) and TEX remap */
+       write_sctlr(read_sctlr() | SCTLR_AFE_BIT | SCTLR_TRE_BIT);
+
+       prrr = MMU32B_PRRR_IDX(MMU32B_ATTR_DEVICE_INDEX, 1, 0) \
+                       | MMU32B_PRRR_IDX(MMU32B_ATTR_IWBWA_OWBWA_INDEX, 2, 1);
+       nmrr = MMU32B_NMRR_IDX(MMU32B_ATTR_DEVICE_INDEX, 0, 0) \
+                       | MMU32B_NMRR_IDX(MMU32B_ATTR_IWBWA_OWBWA_INDEX, 1, 1);
+
+       prrr |= MMU32B_PRRR_NS1 | MMU32B_PRRR_DS1;
+
+       write_prrr(prrr);
+       write_nmrr(nmrr);
+
+       /* Program Domain access control register: domain 0 only */
+       write_dacr(DACR_DOMAIN(0, DACR_DOMAIN_PERM_CLIENT));
+
+       /* Invalidate TLBs at the current exception level */
+       tlbiall();
+
+       /* set MMU base xlat table entry (use only TTBR0) */
+       write_ttbr0((uint32_t)mmu_l1_base | MMU32B_DEFAULT_ATTRS);
+       write_ttbr1(0);
+
+       /*
+        * Ensure all translation table writes have drained
+        * into memory, the TLB invalidation is complete,
+        * and translation register writes are committed
+        * before enabling the MMU
+        */
+       dsb();
+       isb();
+
+       sctlr = read_sctlr();
+       sctlr |= SCTLR_M_BIT;
+#if ARMV7_SUPPORTS_VIRTUALIZATION
+       sctlr |= SCTLR_WXN_BIT;
+#endif
+
+       if (flags & DISABLE_DCACHE)
+               sctlr &= ~SCTLR_C_BIT;
+       else
+               sctlr |= SCTLR_C_BIT;
+
+       write_sctlr(sctlr);
+
+       /* Ensure the MMU enable takes effect immediately */
+       isb();
+}
index d7d8c220ac2f931553d9ad42ba3dced83e22443e..0e6a6fa809b88e4c104b1be83f99bd2e9f304c30 100644 (file)
@@ -231,8 +231,100 @@ typedef enum {
 
 } action_t;
 
+/*
+ * Function that returns the first VA of the table affected by the specified
+ * mmap region.
+ */
+static uintptr_t xlat_tables_find_start_va(mmap_region_t *mm,
+                                  const uintptr_t table_base_va,
+                                  const unsigned int level)
+{
+       uintptr_t table_idx_va;
+
+       if (mm->base_va > table_base_va) {
+               /* Find the first index of the table affected by the region. */
+               table_idx_va = mm->base_va & ~XLAT_BLOCK_MASK(level);
+       } else {
+               /* Start from the beginning of the table. */
+               table_idx_va = table_base_va;
+       }
+
+       return table_idx_va;
+}
+
+/*
+ * Function that returns table index for the given VA and level arguments.
+ */
+static inline unsigned int  xlat_tables_va_to_index(const uintptr_t table_base_va,
+                                               const uintptr_t va,
+                                               const unsigned int level)
+{
+       return (unsigned int)((va - table_base_va) >> XLAT_ADDR_SHIFT(level));
+}
+
 #if PLAT_XLAT_TABLES_DYNAMIC
 
+/*
+ * From the given arguments, it decides which action to take when unmapping the
+ * specified region.
+ */
+static action_t xlat_tables_unmap_region_action(const mmap_region_t *mm,
+               const uintptr_t table_idx_va, const uintptr_t table_idx_end_va,
+               const unsigned int level, const uint64_t desc_type)
+{
+       action_t action;
+       uintptr_t region_end_va = mm->base_va + mm->size - 1U;
+
+       if ((mm->base_va <= table_idx_va) &&
+           (region_end_va >= table_idx_end_va)) {
+               /* Region covers all block */
+
+               if (level == 3U) {
+                       /*
+                        * Last level, only page descriptors allowed,
+                        * erase it.
+                        */
+                       assert(desc_type == PAGE_DESC);
+
+                       action = ACTION_WRITE_BLOCK_ENTRY;
+               } else {
+                       /*
+                        * Other levels can have table descriptors. If
+                        * so, recurse into it and erase descriptors
+                        * inside it as needed. If there is a block
+                        * descriptor, just erase it. If an invalid
+                        * descriptor is found, this table isn't
+                        * actually mapped, which shouldn't happen.
+                        */
+                       if (desc_type == TABLE_DESC) {
+                               action = ACTION_RECURSE_INTO_TABLE;
+                       } else {
+                               assert(desc_type == BLOCK_DESC);
+                               action = ACTION_WRITE_BLOCK_ENTRY;
+                       }
+               }
+
+       } else if ((mm->base_va <= table_idx_end_va) ||
+                  (region_end_va >= table_idx_va)) {
+               /*
+                * Region partially covers block.
+                *
+                * It can't happen in level 3.
+                *
+                * There must be a table descriptor here, if not there
+                * was a problem when mapping the region.
+                */
+               assert(level < 3U);
+               assert(desc_type == TABLE_DESC);
+
+               action = ACTION_RECURSE_INTO_TABLE;
+       } else {
+               /* The region doesn't cover the block at all */
+               action = ACTION_NONE;
+       }
+
+       return action;
+}
 /*
  * Recursive function that writes to the translation tables and unmaps the
  * specified region.
@@ -255,19 +347,8 @@ static void xlat_tables_unmap_region(xlat_ctx_t *ctx, mmap_region_t *mm,
 
        unsigned int table_idx;
 
-       if (mm->base_va > table_base_va) {
-               /* Find the first index of the table affected by the region. */
-               table_idx_va = mm->base_va & ~XLAT_BLOCK_MASK(level);
-
-               table_idx = (unsigned int)((table_idx_va - table_base_va) >>
-                           XLAT_ADDR_SHIFT(level));
-
-               assert(table_idx < table_entries);
-       } else {
-               /* Start from the beginning of the table. */
-               table_idx_va = table_base_va;
-               table_idx = 0;
-       }
+       table_idx_va = xlat_tables_find_start_va(mm, table_base_va, level);
+       table_idx = xlat_tables_va_to_index(table_base_va, table_idx_va, level);
 
        while (table_idx < table_entries) {
 
@@ -276,55 +357,9 @@ static void xlat_tables_unmap_region(xlat_ctx_t *ctx, mmap_region_t *mm,
                desc = table_base[table_idx];
                uint64_t desc_type = desc & DESC_MASK;
 
-               action_t action;
-
-               if ((mm->base_va <= table_idx_va) &&
-                   (region_end_va >= table_idx_end_va)) {
-                       /* Region covers all block */
-
-                       if (level == 3U) {
-                               /*
-                                * Last level, only page descriptors allowed,
-                                * erase it.
-                                */
-                               assert(desc_type == PAGE_DESC);
-
-                               action = ACTION_WRITE_BLOCK_ENTRY;
-                       } else {
-                               /*
-                                * Other levels can have table descriptors. If
-                                * so, recurse into it and erase descriptors
-                                * inside it as needed. If there is a block
-                                * descriptor, just erase it. If an invalid
-                                * descriptor is found, this table isn't
-                                * actually mapped, which shouldn't happen.
-                                */
-                               if (desc_type == TABLE_DESC) {
-                                       action = ACTION_RECURSE_INTO_TABLE;
-                               } else {
-                                       assert(desc_type == BLOCK_DESC);
-                                       action = ACTION_WRITE_BLOCK_ENTRY;
-                               }
-                       }
-
-               } else if ((mm->base_va <= table_idx_end_va) ||
-                          (region_end_va >= table_idx_va)) {
-                       /*
-                        * Region partially covers block.
-                        *
-                        * It can't happen in level 3.
-                        *
-                        * There must be a table descriptor here, if not there
-                        * was a problem when mapping the region.
-                        */
-                       assert(level < 3U);
-                       assert(desc_type == TABLE_DESC);
-
-                       action = ACTION_RECURSE_INTO_TABLE;
-               } else {
-                       /* The region doesn't cover the block at all */
-                       action = ACTION_NONE;
-               }
+               action_t action = xlat_tables_unmap_region_action(mm,
+                               table_idx_va, table_idx_end_va, level,
+                               desc_type);
 
                if (action == ACTION_WRITE_BLOCK_ENTRY) {
 
@@ -525,19 +560,8 @@ static uintptr_t xlat_tables_map_region(xlat_ctx_t *ctx, mmap_region_t *mm,
 
        unsigned int table_idx;
 
-       if (mm->base_va > table_base_va) {
-               /* Find the first index of the table affected by the region. */
-               table_idx_va = mm->base_va & ~XLAT_BLOCK_MASK(level);
-
-               table_idx = (unsigned int)((table_idx_va - table_base_va) >>
-                           XLAT_ADDR_SHIFT(level));
-
-               assert(table_idx < table_entries);
-       } else {
-               /* Start from the beginning of the table. */
-               table_idx_va = table_base_va;
-               table_idx = 0U;
-       }
+       table_idx_va = xlat_tables_find_start_va(mm, table_base_va, level);
+       table_idx = xlat_tables_va_to_index(table_base_va, table_idx_va, level);
 
 #if PLAT_XLAT_TABLES_DYNAMIC
        if (level > ctx->base_level)
index 9f38b3341de051884135d49a96d02968ccbdbc8b..a1ad137fe49f5e11b8846da7f1bd9ae1febed6f4 100644 (file)
@@ -188,6 +188,8 @@ Renesas rcar-gen3 platform port
 -------------------------------
 :M: Jorge Ramirez-Ortiz  <jramirez@baylibre.com>
 :G: `ldts`_
+:M: Marek Vasut <marek.vasut@gmail.com>
+:G: `marex`_
 :F: docs/plat/rcar-gen3.rst
 :F: plat/renesas/rcar
 :F: drivers/renesas/rcar
@@ -263,6 +265,7 @@ Xilinx platform port
 .. _JackyBai: https://github.com/JackyBai
 .. _jenswi-linaro: https://github.com/jenswi-linaro
 .. _ldts: https://github.com/ldts
+.. _marex: https://github.com/marex
 .. _niej: https://github.com/niej
 .. _kostapr: https://github.com/kostapr
 .. _masahir0y: https://github.com/masahir0y
index 20e7ec533ed8fead274f60b64ce09fa1c6dfa3e5..5571ab0f73fb97fe3db59f2ed8521fdc90cbcde4 100644 (file)
@@ -47,4 +47,9 @@ ifeq ($(filter yes,$(ARM_CORTEX_A7) $(ARM_CORTEX_A12) $(ARM_CORTEX_A15) $(ARM_CO
 $(eval $(call add_define,ARMV7_SUPPORTS_LARGE_PAGE_ADDRESSING))
 $(eval $(call add_define,ARMV7_SUPPORTS_VIRTUALIZATION))
 $(eval $(call add_define,ARMV7_SUPPORTS_GENERIC_TIMER))
+$(eval $(call add_define,ARMV7_SUPPORTS_VFP))
+endif
+
+ifeq ($(ARM_CORTEX_A5),yes)
+$(eval $(call add_define,ARM_CORTEX_A5))
 endif
index 4a264d7eeb64fc7314b7914da1ae54b539198218..5d33954ad1947a221fd4b6aef56084af8ff3b917 100644 (file)
@@ -355,8 +355,13 @@ $(eval $(call MAKE_LIB_OBJS,$(BUILD_DIR),$(SOURCES),$(1)))
 .PHONY : lib${1}_dirs
 lib${1}_dirs: | ${BUILD_DIR} ${LIB_DIR}  ${ROMLIB_DIR} ${LIBWRAPPER_DIR}
 libraries: ${LIB_DIR}/lib$(1).a
+ifneq ($(findstring armlink,$(notdir $(LD))),)
+LDPATHS = --userlibpath=${LIB_DIR}
+LDLIBS += --library=$(1)
+else
 LDPATHS = -L${LIB_DIR}
 LDLIBS += -l$(1)
+endif
 
 ifeq ($(USE_ROMLIB),1)
 LIBWRAPPER = -lwrappers
@@ -421,9 +426,18 @@ else
               const char version_string[] = "${VERSION_STRING}";' | \
                $$(CC) $$(TF_CFLAGS) $$(CFLAGS) -xc -c - -o $(BUILD_DIR)/build_message.o
 endif
+ifneq ($(findstring armlink,$(notdir $(LD))),)
+       $$(Q)$$(LD) -o $$@ $$(TF_LDFLAGS) $$(LDFLAGS) --entry=bl${1}_entrypoint \
+               --predefine="-D__LINKER__=$(__LINKER__)" \
+               --predefine="-DTF_CFLAGS=$(TF_CFLAGS)" \
+               --map --list="$(MAPFILE)" --scatter=${PLAT_DIR}/scat/bl${1}.scat \
+               $(LDPATHS) $(LIBWRAPPER) $(LDLIBS) $(BL_LIBS) \
+               $(BUILD_DIR)/build_message.o $(OBJS)
+else
        $$(Q)$$(LD) -o $$@ $$(TF_LDFLAGS) $$(LDFLAGS) -Map=$(MAPFILE) \
                --script $(LINKERFILE) $(BUILD_DIR)/build_message.o \
                $(OBJS) $(LDPATHS) $(LIBWRAPPER) $(LDLIBS) $(BL_LIBS)
+endif
 
 $(DUMP): $(ELF)
        $${ECHO} "  OD      $$@"
index 76a9fd4fab10bcb790161d8d2b8fe48a94c5a359..be84f7791267039f7878ad149693cb65d2f389d3 100644 (file)
@@ -51,6 +51,11 @@ CTX_INCLUDE_AARCH32_REGS     := 1
 # Include FP registers in cpu context
 CTX_INCLUDE_FPREGS             := 0
 
+# Include pointer authentication (ARMv8.3-PAuth) registers in cpu context. This
+# must be set to 1 if the platform wants to use this feature in the Secure
+# world. It is not needed to use it in the Non-secure world.
+CTX_INCLUDE_PAUTH_REGS         := 0
+
 # Debug build
 DEBUG                          := 0
 
@@ -82,6 +87,9 @@ ENABLE_STACK_PROTECTOR                := 0
 # Flag to enable exception handling in EL3
 EL3_EXCEPTION_HANDLING         := 0
 
+# Flag to enable Pointer Authentication
+ENABLE_PAUTH                   := 0
+
 # Build flag to treat usage of deprecated platform and framework APIs as error.
 ERROR_DEPRECATED               := 0
 
@@ -132,8 +140,7 @@ PL011_GENERIC_UART          := 0
 # The platform Makefile is free to override this value.
 PROGRAMMABLE_RESET_ADDRESS     := 0
 
-# Flag used to choose the power state format viz Extended State-ID or the
-# Original format.
+# Flag used to choose the power state format: Extended State-ID or Original
 PSCI_EXTENDED_STATE_ID         := 0
 
 # Enable RAS support
index 1e1b0a4d12e1ad4dc537097e3c8402dde0a0e066..11668797b661eb2c1467d309e6da41e6470cdd55 100644 (file)
@@ -9,9 +9,9 @@
 
 void sunxi_configure_mmu_el3(int flags);
 
-void sunxi_cpu_on(unsigned int cluster, unsigned int core);
-void sunxi_cpu_off(unsigned int cluster, unsigned int core);
-void sunxi_disable_secondary_cpus(unsigned int primary_cpu);
+void sunxi_cpu_on(u_register_t mpidr);
+void sunxi_cpu_off(u_register_t mpidr);
+void sunxi_disable_secondary_cpus(u_register_t primary_mpidr);
 void __dead2 sunxi_power_down(void);
 
 int sunxi_pmic_setup(uint16_t socid, const void *fdt);
index 7ffa65821018aa40ddd6c246e98aea81e0388eb5..a24527c5d08860d6bee22fa11047dd7e0303f1c3 100644 (file)
@@ -11,6 +11,7 @@
 #include <platform_def.h>
 
 #include <arch.h>
+#include <arch_helpers.h>
 #include <common/debug.h>
 #include <drivers/arm/gicv2.h>
 #include <drivers/console.h>
@@ -101,7 +102,7 @@ void bl31_early_platform_setup2(u_register_t arg0, u_register_t arg1,
        SET_SECURITY_STATE(bl33_image_ep_info.h.attr, NON_SECURE);
 
        /* Turn off all secondary CPUs */
-       sunxi_disable_secondary_cpus(plat_my_core_pos());
+       sunxi_disable_secondary_cpus(read_mpidr());
 }
 
 void bl31_plat_arch_setup(void)
index 6bb8968cee125cc1278d5183b2880be431f100b5..3b44aab685f9d1943acde8f7bea0cea9e845d169 100644 (file)
@@ -18,7 +18,7 @@
 #include <sunxi_mmap.h>
 #include <sunxi_private.h>
 
-static mmap_region_t sunxi_mmap[PLATFORM_MMAP_REGIONS + 1] = {
+static const mmap_region_t sunxi_mmap[PLATFORM_MMAP_REGIONS + 1] = {
        MAP_REGION_FLAT(SUNXI_SRAM_BASE, SUNXI_SRAM_SIZE,
                        MT_MEMORY | MT_RW | MT_SECURE),
        MAP_REGION_FLAT(SUNXI_DEV_BASE, SUNXI_DEV_SIZE,
index 8c086030aeb106cd61d8de3b531dad687a6a83ca..b4c9fcc1893839dda4814b1ab9a84bdf90234069 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017-2018, ARM Limited and Contributors. All rights reserved.
+ * Copyright (c) 2017-2019, ARM Limited and Contributors. All rights reserved.
  *
  * SPDX-License-Identifier: BSD-3-Clause
  */
@@ -45,9 +45,10 @@ static void sunxi_cpu_enable_power(unsigned int cluster, unsigned int core)
        mmio_write_32(SUNXI_CPU_POWER_CLAMP_REG(cluster, core), 0x00);
 }
 
-void sunxi_cpu_off(unsigned int cluster, unsigned int core)
+void sunxi_cpu_off(u_register_t mpidr)
 {
-       int corenr = cluster * PLATFORM_MAX_CPUS_PER_CLUSTER + core;
+       unsigned int cluster = MPIDR_AFFLVL1_VAL(mpidr);
+       unsigned int core    = MPIDR_AFFLVL0_VAL(mpidr);
 
        VERBOSE("PSCI: Powering off cluster %d core %d\n", cluster, core);
 
@@ -55,9 +56,9 @@ void sunxi_cpu_off(unsigned int cluster, unsigned int core)
        mmio_clrbits_32(SUNXI_CPUCFG_DBG_REG0, BIT(core));
 
        /* We can't turn ourself off like this, but it works for other cores. */
-       if (plat_my_core_pos() != corenr) {
+       if (read_mpidr() != mpidr) {
                /* Activate the core output clamps, but not for core 0. */
-               if (corenr != 0)
+               if (core != 0)
                        mmio_setbits_32(SUNXI_POWEROFF_GATING_REG(cluster),
                                        BIT(core));
                /* Assert CPU power-on reset */
@@ -80,8 +81,11 @@ void sunxi_cpu_off(unsigned int cluster, unsigned int core)
                                 0, BIT_32(core));
 }
 
-void sunxi_cpu_on(unsigned int cluster, unsigned int core)
+void sunxi_cpu_on(u_register_t mpidr)
 {
+       unsigned int cluster = MPIDR_AFFLVL1_VAL(mpidr);
+       unsigned int core    = MPIDR_AFFLVL0_VAL(mpidr);
+
        VERBOSE("PSCI: Powering on cluster %d core %d\n", cluster, core);
 
        /* Assert CPU core reset */
@@ -102,12 +106,18 @@ void sunxi_cpu_on(unsigned int cluster, unsigned int core)
        mmio_setbits_32(SUNXI_CPUCFG_DBG_REG0, BIT(core));
 }
 
-void sunxi_disable_secondary_cpus(unsigned int primary_cpu)
+void sunxi_disable_secondary_cpus(u_register_t primary_mpidr)
 {
-       for (unsigned int cpu = 0; cpu < PLATFORM_CORE_COUNT; cpu += 1) {
-               if (cpu == primary_cpu)
-                       continue;
-               sunxi_cpu_off(cpu / PLATFORM_MAX_CPUS_PER_CLUSTER,
-                              cpu % PLATFORM_MAX_CPUS_PER_CLUSTER);
+       unsigned int cluster;
+       unsigned int core;
+
+       for (cluster = 0; cluster < PLATFORM_CLUSTER_COUNT; ++cluster) {
+               for (core = 0; core < PLATFORM_MAX_CPUS_PER_CLUSTER; ++core) {
+                       u_register_t mpidr = (cluster << MPIDR_AFF1_SHIFT) |
+                                            (core    << MPIDR_AFF0_SHIFT) |
+                                            BIT(31);
+                       if (mpidr != primary_mpidr)
+                               sunxi_cpu_off(mpidr);
+               }
        }
 }
index 8cc715c27a26ad1cf46dc485e91a9bb770e40e2d..1d2dc938527f961d81a195a9f64224a0fb6a8d90 100644 (file)
@@ -35,7 +35,7 @@ static int sunxi_pwr_domain_on(u_register_t mpidr)
        if (mpidr_is_valid(mpidr) == 0)
                return PSCI_E_INTERN_FAIL;
 
-       sunxi_cpu_on(MPIDR_AFFLVL1_VAL(mpidr), MPIDR_AFFLVL0_VAL(mpidr));
+       sunxi_cpu_on(mpidr);
 
        return PSCI_E_SUCCESS;
 }
@@ -47,9 +47,7 @@ static void sunxi_pwr_domain_off(const psci_power_state_t *target_state)
 
 static void __dead2 sunxi_pwr_down_wfi(const psci_power_state_t *target_state)
 {
-       u_register_t mpidr = read_mpidr();
-
-       sunxi_cpu_off(MPIDR_AFFLVL1_VAL(mpidr), MPIDR_AFFLVL0_VAL(mpidr));
+       sunxi_cpu_off(read_mpidr());
 
        while (1)
                wfi();
@@ -64,7 +62,7 @@ static void sunxi_pwr_domain_on_finish(const psci_power_state_t *target_state)
 static void __dead2 sunxi_system_off(void)
 {
        /* Turn off all secondary CPUs */
-       sunxi_disable_secondary_cpus(plat_my_core_pos());
+       sunxi_disable_secondary_cpus(read_mpidr());
 
        sunxi_power_down();
 }
index 7acc77a9a69ae3a518951f0c2224e2bb82cdebb1..45be1e03d26c18e01932d96b5e4e300ac599f4fc 100644 (file)
@@ -9,7 +9,7 @@
 #include <arch.h>
 #include <plat/common/platform.h>
 
-static unsigned char plat_power_domain_tree_desc[PLAT_MAX_PWR_LVL + 1] = {
+static const unsigned char plat_power_domain_tree_desc[PLAT_MAX_PWR_LVL + 1] = {
        /* One root node for the SoC */
        1,
        /* One node for each cluster */
index 706bfcecbe4f3bcfe91c89517b289acf4cdcc93e..b4d16a06837e54988af735b6dd3b921edd6c7bd3 100644 (file)
@@ -175,7 +175,7 @@ static int fdt_get_regulator_millivolt(const void *fdt, int node)
 
 #define NO_SPLIT 0xff
 
-struct axp_regulator {
+static const struct axp_regulator {
        char *dt_name;
        uint16_t min_volt;
        uint16_t max_volt;
@@ -247,7 +247,7 @@ static void setup_axp803_rails(const void *fdt)
        for (node = fdt_first_subnode(fdt, node);
             node != -FDT_ERR_NOTFOUND;
             node = fdt_next_subnode(fdt, node)) {
-               struct axp_regulator *reg;
+               const struct axp_regulator *reg;
                const char *name;
                int length;
 
index 115310175e939416a09fa990acae452f6e8d6ab0..780e6fcbf7ec9146a52312607024b5ed6bc16498 100644 (file)
 #define PLAT_ARM_BOOT_UART_BASE                V2M_IOFPGA_UART0_BASE
 #define PLAT_ARM_BOOT_UART_CLK_IN_HZ   V2M_IOFPGA_UART0_CLK_IN_HZ
 
-#define PLAT_ARM_BL31_RUN_UART_BASE            V2M_IOFPGA_UART1_BASE
-#define PLAT_ARM_BL31_RUN_UART_CLK_IN_HZ       V2M_IOFPGA_UART1_CLK_IN_HZ
+#define PLAT_ARM_RUN_UART_BASE         V2M_IOFPGA_UART1_BASE
+#define PLAT_ARM_RUN_UART_CLK_IN_HZ    V2M_IOFPGA_UART1_CLK_IN_HZ
 
-#define PLAT_ARM_SP_MIN_RUN_UART_BASE          V2M_IOFPGA_UART1_BASE
-#define PLAT_ARM_SP_MIN_RUN_UART_CLK_IN_HZ     V2M_IOFPGA_UART1_CLK_IN_HZ
-
-#define PLAT_ARM_CRASH_UART_BASE       PLAT_ARM_BL31_RUN_UART_BASE
-#define PLAT_ARM_CRASH_UART_CLK_IN_HZ  PLAT_ARM_BL31_RUN_UART_CLK_IN_HZ
+#define PLAT_ARM_CRASH_UART_BASE       PLAT_ARM_RUN_UART_BASE
+#define PLAT_ARM_CRASH_UART_CLK_IN_HZ  PLAT_ARM_RUN_UART_CLK_IN_HZ
 
 #define PLAT_ARM_TSP_UART_BASE         V2M_IOFPGA_UART2_BASE
 #define PLAT_ARM_TSP_UART_CLK_IN_HZ    V2M_IOFPGA_UART2_CLK_IN_HZ
index 42a9095d91631aea9e9922a76f0eae838f0e7f54..8e693991d9fec2c8891b43b2cff05708f152de94 100644 (file)
@@ -103,7 +103,7 @@ FVP_CPU_LIBS                +=      lib/cpus/aarch64/cortex_a35.S                   \
                                lib/cpus/aarch64/cortex_a73.S                   \
                                lib/cpus/aarch64/cortex_a75.S                   \
                                lib/cpus/aarch64/cortex_a76.S                   \
-                               lib/cpus/aarch64/cortex_ares.S                  \
+                               lib/cpus/aarch64/neoverse_n1.S                  \
                                lib/cpus/aarch64/cortex_deimos.S
 else
 FVP_CPU_LIBS           +=      lib/cpus/aarch32/cortex_a32.S
@@ -214,7 +214,7 @@ endif
 
 ifeq (${ENABLE_AMU},1)
 BL31_SOURCES           +=      lib/cpus/aarch64/cortex_a75_pubsub.c    \
-                               lib/cpus/aarch64/cortex_ares_pubsub.c   \
+                               lib/cpus/aarch64/neoverse_n1_pubsub.c   \
                                lib/cpus/aarch64/cpuamu.c               \
                                lib/cpus/aarch64/cpuamu_helpers.S
 endif
diff --git a/plat/arm/board/fvp_ve/aarch32/fvp_ve_helpers.S b/plat/arm/board/fvp_ve/aarch32/fvp_ve_helpers.S
new file mode 100644 (file)
index 0000000..78f6c68
--- /dev/null
@@ -0,0 +1,62 @@
+/*
+ * Copyright (c) 2019, Arm Limited. All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+#include <arch.h>
+#include <asm_macros.S>
+#include <platform_def.h>
+
+       .globl  plat_secondary_cold_boot_setup
+       .globl  plat_get_my_entrypoint
+       .globl  plat_is_my_cpu_primary
+
+       /* --------------------------------------------------------------------
+        * void plat_secondary_cold_boot_setup (void);
+        *
+        * For AArch32, cold-booting secondary CPUs is not yet
+        * implemented and they panic.
+        * --------------------------------------------------------------------
+        */
+func plat_secondary_cold_boot_setup
+cb_panic:
+       b       cb_panic
+endfunc plat_secondary_cold_boot_setup
+
+       /* ---------------------------------------------------------------------
+        * unsigned long plat_get_my_entrypoint (void);
+        *
+        * Main job of this routine is to distinguish between a cold and warm
+        * boot. On FVP, this information can be queried from the power
+        * controller. The Power Control SYS Status Register (PSYSR) indicates
+        * the wake-up reason for the CPU.
+        *
+        * For a cold boot, return 0.
+        * For a warm boot, read the mailbox and return the address it contains.
+        *
+        * TODO: PSYSR is a common register and should be
+        *      accessed using locks. Since it is not possible
+        *      to use locks immediately after a cold reset
+        *      we are relying on the fact that after a cold
+        *      reset all cpus will read the same WK field
+        * ---------------------------------------------------------------------
+        */
+func plat_get_my_entrypoint
+       /* TODO support warm boot */
+       /* Cold reset */
+       mov     r0, #0
+       bx      lr
+
+endfunc plat_get_my_entrypoint
+
+       /* -----------------------------------------------------
+        * unsigned int plat_is_my_cpu_primary (void);
+        *
+        * Currently configured for a sigle CPU
+        * -----------------------------------------------------
+        */
+func plat_is_my_cpu_primary
+       mov     r0, #1
+       bx      lr
+endfunc plat_is_my_cpu_primary
diff --git a/plat/arm/board/fvp_ve/fdts/fvp_ve_tb_fw_config.dts b/plat/arm/board/fvp_ve/fdts/fvp_ve_tb_fw_config.dts
new file mode 100644 (file)
index 0000000..9ab2d96
--- /dev/null
@@ -0,0 +1,18 @@
+/*
+ * Copyright (c) 2019, Arm Limited. All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+/dts-v1/;
+
+/ {
+       /* Platform Config */
+       plat_arm_bl2 {
+               compatible = "arm,tb_fw";
+               hw_config_addr = <0x0 0x82000000>;
+               hw_config_max_size = <0x01000000>;
+               /* Disable authentication for development */
+               disable_auth = <0x0>;
+       };
+};
diff --git a/plat/arm/board/fvp_ve/fvp_ve_bl1_setup.c b/plat/arm/board/fvp_ve/fvp_ve_bl1_setup.c
new file mode 100644 (file)
index 0000000..47cd876
--- /dev/null
@@ -0,0 +1,16 @@
+/*
+ * Copyright (c) 2019, Arm Limited. All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+#include <plat/arm/common/plat_arm.h>
+#include <plat/common/platform.h>
+
+/*******************************************************************************
+ * Perform any BL1 specific platform actions.
+ ******************************************************************************/
+void bl1_early_platform_setup(void)
+{
+       arm_bl1_early_platform_setup();
+}
diff --git a/plat/arm/board/fvp_ve/fvp_ve_bl2_setup.c b/plat/arm/board/fvp_ve/fvp_ve_bl2_setup.c
new file mode 100644 (file)
index 0000000..25e0964
--- /dev/null
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 2019, Arm Limited. All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+#include <drivers/arm/sp804_delay_timer.h>
+#include <drivers/generic_delay_timer.h>
+#include <lib/mmio.h>
+#include <plat/arm/common/plat_arm.h>
+#include <plat/common/platform.h>
+#include <platform_def.h>
+
+#include "fvp_ve_private.h"
+
+void bl2_early_platform_setup2(u_register_t arg0, u_register_t arg1, u_register_t arg2, u_register_t arg3)
+{
+       arm_bl2_early_platform_setup((uintptr_t)arg0, (meminfo_t *)arg1);
+
+       /* Initialize the platform config for future decision making */
+       fvp_ve_config_setup();
+}
+
+void bl2_platform_setup(void)
+{
+       arm_bl2_platform_setup();
+
+#ifdef FVP_VE_USE_SP804_TIMER
+       /*
+        * Enable the clock override for SP804 timer 0, which means that no
+        * clock dividers are applied and the raw (35 MHz) clock will be used
+        */
+       mmio_write_32(V2M_SP810_BASE, FVP_SP810_CTRL_TIM0_OV);
+
+       /* Initialize delay timer driver using SP804 dual timer 0 */
+       sp804_timer_init(V2M_SP804_TIMER0_BASE,
+                       SP804_TIMER_CLKMULT, SP804_TIMER_CLKDIV);
+#else
+       generic_delay_timer_init();
+#endif /* FVP_VE_USE_SP804_TIMER */
+}
diff --git a/plat/arm/board/fvp_ve/fvp_ve_common.c b/plat/arm/board/fvp_ve/fvp_ve_common.c
new file mode 100644 (file)
index 0000000..768dad5
--- /dev/null
@@ -0,0 +1,63 @@
+/*
+ * Copyright (c) 2019, Arm Limited. All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+#include <assert.h>
+
+#include <common/debug.h>
+#include <lib/mmio.h>
+#include <platform_def.h>
+#include <plat/arm/common/arm_config.h>
+#include <plat/arm/common/plat_arm.h>
+
+#define MAP_DEVICE0    MAP_REGION_FLAT(DEVICE0_BASE,                   \
+                                       DEVICE0_SIZE,                   \
+                                       MT_DEVICE | MT_RW | MT_SECURE)
+
+#ifdef IMAGE_BL1
+const mmap_region_t plat_arm_mmap[] = {
+       ARM_MAP_SHARED_RAM,
+       V2M_MAP_FLASH1_RW,
+       V2M_MAP_IOFPGA,
+       {0}
+};
+#endif
+#ifdef IMAGE_BL2
+const mmap_region_t plat_arm_mmap[] = {
+       ARM_MAP_SHARED_RAM,
+       V2M_MAP_FLASH1_RW,
+       V2M_MAP_IOFPGA,
+       ARM_MAP_NS_DRAM1,
+       {0}
+};
+#endif
+#ifdef IMAGE_BL32
+const mmap_region_t plat_arm_mmap[] = {
+       ARM_MAP_SHARED_RAM,
+       V2M_MAP_IOFPGA,
+       MAP_DEVICE0,
+       {0}
+};
+#endif
+
+ARM_CASSERT_MMAP
+
+void __init fvp_ve_config_setup(void)
+{
+       unsigned int sys_id, arch;
+
+       sys_id = mmio_read_32(V2M_SYSREGS_BASE + V2M_SYS_ID);
+       arch = (sys_id >> V2M_SYS_ID_ARCH_SHIFT) & V2M_SYS_ID_ARCH_MASK;
+
+       if (arch != ARCH_MODEL_VE) {
+               ERROR("This firmware is for FVP VE models\n");
+               panic();
+       }
+}
+
+unsigned int plat_get_syscnt_freq2(void)
+{
+       return FVP_VE_TIMER_BASE_FREQUENCY;
+}
diff --git a/plat/arm/board/fvp_ve/fvp_ve_def.h b/plat/arm/board/fvp_ve/fvp_ve_def.h
new file mode 100644 (file)
index 0000000..565753a
--- /dev/null
@@ -0,0 +1,84 @@
+/*
+ * Copyright (c) 2019, Arm Limited. All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+#ifndef FVP_VE_DEF_H
+#define FVP_VE_DEF_H
+
+#include <lib/utils_def.h>
+
+/* Default cluster count for FVP VE */
+#define FVP_VE_CLUSTER_COUNT   1
+
+/* Default number of CPUs per cluster on FVP VE */
+#define FVP_VE_MAX_CPUS_PER_CLUSTER    1
+
+/* Default number of threads per CPU on FVP VE */
+#define FVP_VE_MAX_PE_PER_CPU  1
+
+#define FVP_VE_CORE_COUNT 1
+
+#define FVP_VE_PRIMARY_CPU                     0x0
+
+/*******************************************************************************
+ * FVP memory map related constants
+ ******************************************************************************/
+
+#define FLASH1_BASE                    0x0c000000
+#define FLASH1_SIZE                    0x04000000
+
+/* Aggregate of all devices in the first GB */
+#define DEVICE0_BASE                   0x20000000
+#define DEVICE0_SIZE                   0x0c200000
+
+#define NSRAM_BASE                     0x2e000000
+#define NSRAM_SIZE                     0x10000
+
+#define PCIE_EXP_BASE                  0x40000000
+#define TZRNG_BASE                     0x7fe60000
+
+#define ARCH_MODEL_VE                  0x5
+
+/* FVP Power controller base address*/
+#define PWRC_BASE                      UL(0x1c100000)
+
+/* FVP SP804 timer frequency is 35 MHz*/
+#define SP804_TIMER_CLKMULT            1
+#define SP804_TIMER_CLKDIV             35
+
+/* SP810 controller. FVP specific flags */
+#define FVP_SP810_CTRL_TIM0_OV         (1 << 16)
+#define FVP_SP810_CTRL_TIM1_OV         (1 << 18)
+#define FVP_SP810_CTRL_TIM2_OV         (1 << 20)
+#define FVP_SP810_CTRL_TIM3_OV         (1 << 22)
+
+/*******************************************************************************
+ * GIC-400 & interrupt handling related constants
+ ******************************************************************************/
+/* VE compatible GIC memory map */
+#define VE_GICD_BASE                   0x2c001000
+#ifdef ARM_CORTEX_A5
+#define VE_GICC_BASE                   0x2c000100
+#else
+#define VE_GICC_BASE                   0x2c002000
+#endif
+#define VE_GICH_BASE                   0x2c004000
+#define VE_GICV_BASE                   0x2c006000
+
+#define FVP_VE_IRQ_TZ_WDOG                     56
+#define FVP_VE_IRQ_SEC_SYS_TIMER               57
+
+#define V2M_FLASH1_BASE                        UL(0x0C000000)
+#define V2M_FLASH1_SIZE                        UL(0x04000000)
+
+#define V2M_MAP_FLASH1_RW              MAP_REGION_FLAT(V2M_FLASH1_BASE,\
+                                               V2M_FLASH1_SIZE,        \
+                                               MT_DEVICE | MT_RW | MT_SECURE)
+
+#define V2M_MAP_FLASH1_RO              MAP_REGION_FLAT(V2M_FLASH1_BASE,\
+                                               V2M_FLASH1_SIZE,        \
+                                               MT_RO_DATA | MT_SECURE)
+
+#endif /* FVP_VE_DEF_H */
diff --git a/plat/arm/board/fvp_ve/fvp_ve_pm.c b/plat/arm/board/fvp_ve/fvp_ve_pm.c
new file mode 100644 (file)
index 0000000..a4d627b
--- /dev/null
@@ -0,0 +1,25 @@
+/*
+* Copyright (c) 2019, Arm Limited. All rights reserved.
+*
+* SPDX-License-Identifier: BSD-3-Clause
+*/
+
+#include <lib/psci/psci.h>
+#include <plat/arm/common/plat_arm.h>
+
+/*******************************************************************************
+ * Export the platform handlers via fvp_ve_psci_pm_ops. The ARM Standard
+ * platform layer will take care of registering the handlers with PSCI.
+ ******************************************************************************/
+plat_psci_ops_t fvp_ve_psci_pm_ops = {
+       /* dummy struct */
+       .validate_ns_entrypoint = NULL,
+};
+
+int __init plat_setup_psci_ops(uintptr_t sec_entrypoint,
+                               const plat_psci_ops_t **psci_ops)
+{
+       *psci_ops = &fvp_ve_psci_pm_ops;
+
+       return 0;
+}
diff --git a/plat/arm/board/fvp_ve/fvp_ve_private.h b/plat/arm/board/fvp_ve/fvp_ve_private.h
new file mode 100644 (file)
index 0000000..5d396bc
--- /dev/null
@@ -0,0 +1,18 @@
+/*
+ * Copyright (c) 2019, Arm Limited. All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+#ifndef FVP_VE_PRIVATE_H
+#define FVP_VE_PRIVATE_H
+
+#include <plat/arm/common/plat_arm.h>
+
+/*******************************************************************************
+ * Function and variable prototypes
+ ******************************************************************************/
+
+void fvp_ve_config_setup(void);
+
+#endif /* FVP_VE_PRIVATE_H */
diff --git a/plat/arm/board/fvp_ve/fvp_ve_security.c b/plat/arm/board/fvp_ve/fvp_ve_security.c
new file mode 100644 (file)
index 0000000..24465cb
--- /dev/null
@@ -0,0 +1,22 @@
+/*
+ * Copyright (c) 2019, Arm Limited. All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+/*
+ * We assume that all security programming is done by the primary core.
+ */
+void plat_arm_security_setup(void)
+{
+       /*
+        * The Base FVP has a TrustZone address space controller, the Foundation
+        * FVP does not. Trying to program the device on the foundation FVP will
+        * cause an abort.
+        *
+        * If the platform had additional peripheral specific security
+        * configurations, those would be configured here.
+        */
+
+       return;
+}
diff --git a/plat/arm/board/fvp_ve/fvp_ve_topology.c b/plat/arm/board/fvp_ve/fvp_ve_topology.c
new file mode 100644 (file)
index 0000000..51cc9da
--- /dev/null
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2019, Arm Limited. All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+#include <platform_def.h>
+
+#include <drivers/arm/fvp/fvp_pwrc.h>
+#include <plat/arm/common/arm_config.h>
+#include <plat/arm/common/plat_arm.h>
+#include <plat/common/platform.h>
+
+/* The FVP VE power domain tree descriptor */
+static const unsigned char fvp_ve_power_domain_tree_desc[] = {
+       1,
+       /* No of children for the root node */
+       FVP_VE_CLUSTER_COUNT,
+       /* No of children for the first cluster node */
+       FVP_VE_CORE_COUNT,
+};
+
+/*******************************************************************************
+ * This function returns the topology according to FVP_VE_CLUSTER_COUNT.
+ ******************************************************************************/
+const unsigned char *plat_get_power_domain_tree_desc(void)
+{
+       return fvp_ve_power_domain_tree_desc;
+}
+
+/*******************************************************************************
+ * Currently FVP VE has only been tested with one core, therefore 0 is returned.
+ ******************************************************************************/
+int plat_core_pos_by_mpidr(u_register_t mpidr)
+{
+       return 0;
+}
diff --git a/plat/arm/board/fvp_ve/include/platform_def.h b/plat/arm/board/fvp_ve/include/platform_def.h
new file mode 100644 (file)
index 0000000..1870442
--- /dev/null
@@ -0,0 +1,330 @@
+/*
+ * Copyright (c) 2019, Arm Limited. All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+#ifndef PLATFORM_DEF_H
+#define PLATFORM_DEF_H
+
+#include <common/tbbr/tbbr_img_def.h>
+#include <lib/utils_def.h>
+#include <lib/xlat_tables/xlat_tables_defs.h>
+#include <plat/arm/board/common/v2m_def.h>
+#include <plat/common/common_def.h>
+
+#include "../fvp_ve_def.h"
+
+#define ARM_CACHE_WRITEBACK_SHIFT      6
+
+/* Memory location options for TSP */
+#define ARM_DRAM_ID                    2
+
+#define ARM_DRAM1_BASE                 UL(0x80000000)
+#define ARM_DRAM1_SIZE                 UL(0x80000000)
+#define ARM_DRAM1_END                  (ARM_DRAM1_BASE +               \
+                                        ARM_DRAM1_SIZE - 1)
+
+#define ARM_DRAM2_BASE                 UL(0x880000000)
+#define ARM_DRAM2_SIZE                 PLAT_ARM_DRAM2_SIZE
+#define ARM_DRAM2_END                  (ARM_DRAM2_BASE +               \
+                                        ARM_DRAM2_SIZE - 1)
+
+#define ARM_NS_DRAM1_BASE              ARM_DRAM1_BASE
+/*
+ * The last 2MB is meant to be NOLOAD and will not be zero
+ * initialized.
+ */
+#define ARM_NS_DRAM1_SIZE              (ARM_DRAM1_SIZE -               \
+                                        0x00200000)
+
+
+/* The first 4KB of NS DRAM1 are used as shared memory */
+#define FVP_VE_SHARED_RAM_BASE         ARM_NS_DRAM1_BASE
+#define FVP_VE_SHARED_RAM_SIZE         UL(0x00001000)  /* 4 KB */
+
+/* The next 252 kB of NS DRAM is used to load the BL images */
+#define ARM_BL_RAM_BASE                        (FVP_VE_SHARED_RAM_BASE +       \
+                                        FVP_VE_SHARED_RAM_SIZE)
+#define ARM_BL_RAM_SIZE                        (PLAT_ARM_BL_PLUS_SHARED_RAM_SIZE -     \
+                                        FVP_VE_SHARED_RAM_SIZE)
+
+
+#define ARM_IRQ_SEC_PHY_TIMER          29
+
+#define ARM_IRQ_SEC_SGI_0              8
+#define ARM_IRQ_SEC_SGI_1              9
+#define ARM_IRQ_SEC_SGI_2              10
+#define ARM_IRQ_SEC_SGI_3              11
+#define ARM_IRQ_SEC_SGI_4              12
+#define ARM_IRQ_SEC_SGI_5              13
+#define ARM_IRQ_SEC_SGI_6              14
+#define ARM_IRQ_SEC_SGI_7              15
+
+/*
+ * Define a list of Group 1 Secure and Group 0 interrupt properties as per GICv3
+ * terminology. On a GICv2 system or mode, the lists will be merged and treated
+ * as Group 0 interrupts.
+ */
+#define ARM_G1S_IRQ_PROPS(grp) \
+       INTR_PROP_DESC(ARM_IRQ_SEC_PHY_TIMER, GIC_HIGHEST_SEC_PRIORITY, (grp), \
+                       GIC_INTR_CFG_LEVEL), \
+       INTR_PROP_DESC(ARM_IRQ_SEC_SGI_1, GIC_HIGHEST_SEC_PRIORITY, (grp), \
+                       GIC_INTR_CFG_EDGE), \
+       INTR_PROP_DESC(ARM_IRQ_SEC_SGI_2, GIC_HIGHEST_SEC_PRIORITY, (grp), \
+                       GIC_INTR_CFG_EDGE), \
+       INTR_PROP_DESC(ARM_IRQ_SEC_SGI_3, GIC_HIGHEST_SEC_PRIORITY, (grp), \
+                       GIC_INTR_CFG_EDGE), \
+       INTR_PROP_DESC(ARM_IRQ_SEC_SGI_4, GIC_HIGHEST_SEC_PRIORITY, (grp), \
+                       GIC_INTR_CFG_EDGE), \
+       INTR_PROP_DESC(ARM_IRQ_SEC_SGI_5, GIC_HIGHEST_SEC_PRIORITY, (grp), \
+                       GIC_INTR_CFG_EDGE), \
+       INTR_PROP_DESC(ARM_IRQ_SEC_SGI_7, GIC_HIGHEST_SEC_PRIORITY, (grp), \
+                       GIC_INTR_CFG_EDGE)
+
+#define ARM_G0_IRQ_PROPS(grp) \
+       INTR_PROP_DESC(ARM_IRQ_SEC_SGI_6, GIC_HIGHEST_SEC_PRIORITY, (grp), \
+                       GIC_INTR_CFG_EDGE)
+
+#define ARM_MAP_SHARED_RAM             MAP_REGION_FLAT(                \
+                                               FVP_VE_SHARED_RAM_BASE, \
+                                               FVP_VE_SHARED_RAM_SIZE, \
+                                               MT_DEVICE | MT_RW | MT_SECURE)
+
+#define ARM_MAP_NS_DRAM1               MAP_REGION_FLAT(                \
+                                               ARM_NS_DRAM1_BASE,      \
+                                               ARM_NS_DRAM1_SIZE,      \
+                                               MT_MEMORY | MT_RW | MT_NS)
+
+#define ARM_MAP_DRAM2                  MAP_REGION_FLAT(                \
+                                               ARM_DRAM2_BASE,         \
+                                               ARM_DRAM2_SIZE,         \
+                                               MT_MEMORY | MT_RW | MT_NS)
+
+#define ARM_MAP_BL_RO                  MAP_REGION_FLAT(                        \
+                                               BL_CODE_BASE,                   \
+                                               BL_CODE_END - BL_CODE_BASE,     \
+                                               MT_CODE | MT_SECURE),           \
+                                       MAP_REGION_FLAT(                        \
+                                               BL_RO_DATA_BASE,                \
+                                               BL_RO_DATA_END                  \
+                                                       - BL_RO_DATA_BASE,      \
+                                               MT_RO_DATA | MT_SECURE)
+
+#if USE_COHERENT_MEM
+#define ARM_MAP_BL_COHERENT_RAM                MAP_REGION_FLAT(                        \
+                                               BL_COHERENT_RAM_BASE,           \
+                                               BL_COHERENT_RAM_END             \
+                                                       - BL_COHERENT_RAM_BASE, \
+                                               MT_DEVICE | MT_RW | MT_SECURE)
+#endif
+
+/*
+ * The max number of regions like RO(code), coherent and data required by
+ * different BL stages which need to be mapped in the MMU.
+ */
+#define ARM_BL_REGIONS                 5
+
+#define MAX_MMAP_REGIONS               (PLAT_ARM_MMAP_ENTRIES +        \
+                                        ARM_BL_REGIONS)
+
+/* Memory mapped Generic timer interfaces  */
+#define FVP_VE_TIMER_BASE_FREQUENCY            UL(24000000)
+#define ARM_SYS_CNTREAD_BASE   UL(0x2a800000)
+#define ARM_SYS_CNT_BASE_S             UL(0x2a820000)
+#define ARM_SYS_CNT_BASE_NS            UL(0x2a830000)
+
+#define ARM_CONSOLE_BAUDRATE           115200
+
+/* Trusted Watchdog constants */
+#define ARM_SP805_TWDG_BASE            UL(0x1C0F0000)
+#define ARM_SP805_TWDG_CLK_HZ          32768
+/* The TBBR document specifies a watchdog timeout of 256 seconds. SP805
+ * asserts reset after two consecutive countdowns (2 x 128 = 256 sec) */
+#define ARM_TWDG_TIMEOUT_SEC           128
+#define ARM_TWDG_LOAD_VAL              (ARM_SP805_TWDG_CLK_HZ *        \
+                                        ARM_TWDG_TIMEOUT_SEC)
+
+#define PLAT_PHY_ADDR_SPACE_SIZE                       (1ULL << 32)
+#define PLAT_VIRT_ADDR_SPACE_SIZE                      (1ULL << 32)
+
+/*
+ * This macro defines the deepest retention state possible. A higher state
+ * id will represent an invalid or a power down state.
+ */
+#define PLAT_MAX_RET_STATE             1
+
+/*
+ * This macro defines the deepest power down states possible. Any state ID
+ * higher than this is invalid.
+ */
+#define PLAT_MAX_OFF_STATE             2
+
+/*
+ * Some data must be aligned on the biggest cache line size in the platform.
+ * This is known only to the platform as it might have a combination of
+ * integrated and external caches.
+ */
+#define CACHE_WRITEBACK_GRANULE                (U(1) << ARM_CACHE_WRITEBACK_SHIFT)
+
+/*
+ * To enable TB_FW_CONFIG to be loaded by BL1, define the corresponding base
+ * and limit. Leave enough space of BL2 meminfo.
+ */
+#define ARM_TB_FW_CONFIG_BASE          (ARM_BL_RAM_BASE + sizeof(meminfo_t))
+#define ARM_TB_FW_CONFIG_LIMIT         (ARM_BL_RAM_BASE + PAGE_SIZE)
+
+/*******************************************************************************
+ * BL1 specific defines.
+ * BL1 RW data is relocated from ROM to RAM at runtime so we need 2 sets of
+ * addresses.
+ ******************************************************************************/
+#define BL1_RO_BASE                    0x00000000
+#define BL1_RO_LIMIT                   PLAT_ARM_TRUSTED_ROM_SIZE
+/*
+ * Put BL1 RW at the top of the memory allocated for BL images in NS DRAM.
+ */
+#define BL1_RW_BASE                    (ARM_BL_RAM_BASE +              \
+                                               ARM_BL_RAM_SIZE -       \
+                                               (PLAT_ARM_MAX_BL1_RW_SIZE))
+#define BL1_RW_LIMIT                   (ARM_BL_RAM_BASE +              \
+                                           (ARM_BL_RAM_SIZE))
+
+
+/*******************************************************************************
+ * BL2 specific defines.
+ ******************************************************************************/
+
+/*
+ * Put BL2 just below BL1.
+ */
+#define BL2_BASE                       (BL1_RW_BASE - FVP_VE_MAX_BL2_SIZE)
+#define BL2_LIMIT                      BL1_RW_BASE
+
+
+/* Put BL32 below BL2 in NS DRAM.*/
+#define ARM_BL2_MEM_DESC_BASE          ARM_TB_FW_CONFIG_LIMIT
+
+#define BL32_BASE                      ((ARM_BL_RAM_BASE + ARM_BL_RAM_SIZE)\
+                                               - PLAT_ARM_MAX_BL32_SIZE)
+#define BL32_PROGBITS_LIMIT            BL2_BASE
+#define BL32_LIMIT                     (ARM_BL_RAM_BASE + ARM_BL_RAM_SIZE)
+
+/* Required platform porting definitions */
+#define PLATFORM_CORE_COUNT            1
+#define PLAT_NUM_PWR_DOMAINS           ((FVP_VE_CLUSTER_COUNT + \
+                                       PLATFORM_CORE_COUNT) + 1)
+
+#define PLAT_MAX_PWR_LVL               2
+
+/*
+ * Other platform porting definitions are provided by included headers
+ */
+
+/*
+ * Required ARM standard platform porting definitions
+ */
+
+#define PLAT_ARM_BL_PLUS_SHARED_RAM_SIZE       0x00040000      /* 256 KB */
+
+#define PLAT_ARM_TRUSTED_ROM_BASE      0x00000000
+#define PLAT_ARM_TRUSTED_ROM_SIZE      0x04000000      /* 64 MB */
+
+#define PLAT_ARM_DRAM2_SIZE            ULL(0x80000000)
+
+/*
+ * Load address of BL33 for this platform port
+ */
+#define PLAT_ARM_NS_IMAGE_BASE (ARM_DRAM1_BASE + U(0x8000000))
+
+/*
+ * PLAT_ARM_MMAP_ENTRIES depends on the number of entries in the
+ * plat_arm_mmap array defined for each BL stage.
+ */
+#if defined(IMAGE_BL32)
+# define PLAT_ARM_MMAP_ENTRIES         8
+# define MAX_XLAT_TABLES               6
+#else
+# define PLAT_ARM_MMAP_ENTRIES         12
+# define MAX_XLAT_TABLES               6
+#endif
+
+/*
+ * PLAT_ARM_MAX_BL1_RW_SIZE is calculated using the current BL1 RW debug size
+ * plus a little space for growth.
+ */
+#define PLAT_ARM_MAX_BL1_RW_SIZE       0xB000
+
+/*
+ * FVP_VE_MAX_BL2_SIZE is calculated using the current BL2 debug size plus a
+ * little space for growth.
+ */
+#define FVP_VE_MAX_BL2_SIZE            0x11000
+
+/*
+ * Since BL32 NOBITS overlays BL2 and BL1-RW, PLAT_ARM_MAX_BL32_SIZE is
+ * calculated using the current SP_MIN PROGBITS debug size plus the sizes of
+ * BL2 and BL1-RW
+ */
+#define PLAT_ARM_MAX_BL32_SIZE         0x3B000
+/*
+
+ * Size of cacheable stacks
+ */
+#if defined(IMAGE_BL1)
+#  define PLATFORM_STACK_SIZE 0x440
+#elif defined(IMAGE_BL2)
+#  define PLATFORM_STACK_SIZE 0x400
+#elif defined(IMAGE_BL32)
+# define PLATFORM_STACK_SIZE 0x440
+#endif
+
+#define MAX_IO_DEVICES                 3
+#define MAX_IO_HANDLES                 4
+
+/* Reserve the last block of flash for PSCI MEM PROTECT flag */
+#define PLAT_ARM_FIP_BASE              V2M_FLASH1_BASE
+#define PLAT_ARM_FIP_MAX_SIZE          (V2M_FLASH1_SIZE - V2M_FLASH_BLOCK_SIZE)
+
+#define PLAT_ARM_NVM_BASE              V2M_FLASH1_BASE
+#define PLAT_ARM_NVM_SIZE              (V2M_FLASH1_SIZE - V2M_FLASH_BLOCK_SIZE)
+
+/*
+ * PL011 related constants
+ */
+#define PLAT_ARM_BOOT_UART_BASE                V2M_IOFPGA_UART0_BASE
+#define PLAT_ARM_BOOT_UART_CLK_IN_HZ   V2M_IOFPGA_UART0_CLK_IN_HZ
+
+#define PLAT_ARM_RUN_UART_BASE         V2M_IOFPGA_UART1_BASE
+#define PLAT_ARM_RUN_UART_CLK_IN_HZ    V2M_IOFPGA_UART1_CLK_IN_HZ
+
+#define PLAT_ARM_CRASH_UART_BASE       PLAT_ARM_RUN_UART_BASE
+#define PLAT_ARM_CRASH_UART_CLK_IN_HZ  PLAT_ARM_RUN_UART_CLK_IN_HZ
+
+/* System timer related constants */
+#define PLAT_ARM_NSTIMER_FRAME_ID              1
+
+/* Mailbox base address */
+#define FVP_VE_TRUSTED_MAILBOX_BASE    FVP_VE_SHARED_RAM_BASE
+
+/*
+ * GIC related constants to cater for GICv2
+ */
+#define PLAT_ARM_GICD_BASE             VE_GICD_BASE
+#define PLAT_ARM_GICC_BASE             VE_GICC_BASE
+
+/*
+ * Define a list of Group 1 Secure and Group 0 interrupts as per GICv3
+ * terminology. On a GICv2 system or mode, the lists will be merged and treated
+ * as Group 0 interrupts.
+ */
+#define PLAT_ARM_G1S_IRQ_PROPS(grp) \
+       ARM_G1S_IRQ_PROPS(grp), \
+       INTR_PROP_DESC(FVP_VE_IRQ_TZ_WDOG, GIC_HIGHEST_SEC_PRIORITY, (grp), \
+                       GIC_INTR_CFG_LEVEL), \
+       INTR_PROP_DESC(FVP_VE_IRQ_SEC_SYS_TIMER, GIC_HIGHEST_SEC_PRIORITY, (grp), \
+                       GIC_INTR_CFG_LEVEL)
+
+#define PLAT_ARM_G0_IRQ_PROPS(grp)     ARM_G0_IRQ_PROPS(grp)
+
+#endif /* PLATFORM_H */
diff --git a/plat/arm/board/fvp_ve/platform.mk b/plat/arm/board/fvp_ve/platform.mk
new file mode 100644 (file)
index 0000000..f9ced2c
--- /dev/null
@@ -0,0 +1,125 @@
+#
+# Copyright (c) 2019, Arm Limited. All rights reserved.
+#
+# SPDX-License-Identifier: BSD-3-Clause
+#
+
+ifdef ARM_CORTEX_A5
+# Use the SP804 timer instead of the generic one
+FVP_VE_USE_SP804_TIMER := 1
+$(eval $(call add_define,FVP_VE_USE_SP804_TIMER))
+BL2_SOURCES            +=      drivers/arm/sp804/sp804_delay_timer.c
+endif
+
+FVP_VE_GIC_SOURCES             :=      drivers/arm/gic/common/gic_common.c     \
+                               drivers/arm/gic/v2/gicv2_main.c         \
+                               drivers/arm/gic/v2/gicv2_helpers.c      \
+                               plat/common/plat_gicv2.c                \
+                               plat/arm/common/arm_gicv2.c
+
+FVP_VE_SECURITY_SOURCES        :=      plat/arm/board/fvp_ve/fvp_ve_security.c
+
+PLAT_INCLUDES          :=      -Iplat/arm/board/fvp_ve/include
+
+PLAT_BL_COMMON_SOURCES :=      plat/arm/board/fvp_ve/fvp_ve_common.c           \
+                               plat/arm/common/${ARCH}/arm_helpers.S           \
+                               plat/arm/common/arm_common.c                    \
+                               plat/arm/common/arm_console.c                   \
+                               drivers/arm/pl011/${ARCH}/pl011_console.S       \
+                               plat/arm/board/common/${ARCH}/board_arm_helpers.S
+
+ifdef ARM_CORTEX_A5
+FVP_VE_CPU_LIBS                :=      lib/cpus/aarch32/cortex_a5.S
+else
+FVP_VE_CPU_LIBS                :=      lib/cpus/aarch32/cortex_a7.S
+endif
+
+BL1_SOURCES            +=      drivers/arm/sp805/sp805.c                       \
+                               drivers/io/io_fip.c                             \
+                               drivers/io/io_memmap.c                          \
+                               drivers/io/io_storage.c                         \
+                               plat/arm/common/arm_bl1_setup.c                 \
+                               plat/arm/common/arm_err.c                       \
+                               plat/arm/common/arm_io_storage.c                \
+                               drivers/cfi/v2m/v2m_flash.c                     \
+                               plat/arm/board/fvp_ve/${ARCH}/fvp_ve_helpers.S  \
+                               plat/arm/board/fvp_ve/fvp_ve_bl1_setup.c        \
+                               lib/aarch32/arm32_aeabi_divmod.c                \
+                               lib/aarch32/arm32_aeabi_divmod_a32.S            \
+                               ${FVP_VE_CPU_LIBS}                                      \
+                               ${DYN_CFG_SOURCES}
+
+BL2_SOURCES            +=      plat/arm/board/fvp_ve/fvp_ve_bl2_setup.c                \
+                               lib/aarch32/arm32_aeabi_divmod.c                \
+                               lib/aarch32/arm32_aeabi_divmod_a32.S            \
+                               drivers/delay_timer/delay_timer.c               \
+                               drivers/delay_timer/generic_delay_timer.c       \
+                               drivers/cfi/v2m/v2m_flash.c                     \
+                               drivers/io/io_fip.c                             \
+                               drivers/io/io_memmap.c                          \
+                               drivers/io/io_storage.c                         \
+                               plat/arm/common/arm_bl2_setup.c                 \
+                               plat/arm/common/arm_err.c                       \
+                               plat/arm/common/arm_io_storage.c                \
+                               plat/arm/common/${ARCH}/arm_bl2_mem_params_desc.c       \
+                               plat/arm/common/arm_image_load.c                \
+                               common/desc_image_load.c                        \
+                               ${DYN_CFG_SOURCES}                              \
+                               ${FVP_VE_SECURITY_SOURCES}
+
+# Add the FDT_SOURCES and options for Dynamic Config (only for Unix env)
+ifdef UNIX_MK
+
+FDT_SOURCES            +=      plat/arm/board/fvp_ve/fdts/fvp_ve_tb_fw_config.dts
+
+FVP_TB_FW_CONFIG       :=      ${BUILD_PLAT}/fdts/fvp_ve_tb_fw_config.dtb
+
+# Add the TB_FW_CONFIG to FIP and specify the same to certtool
+$(eval $(call TOOL_ADD_PAYLOAD,${FVP_TB_FW_CONFIG},--tb-fw-config))
+
+FDT_SOURCES            +=      ${FVP_HW_CONFIG_DTS}
+$(eval FVP_HW_CONFIG   :=      ${BUILD_PLAT}/$(patsubst %.dts,%.dtb, \
+       fdts/$(notdir ${FVP_HW_CONFIG_DTS})))
+# Add the HW_CONFIG to FIP and specify the same to certtool
+$(eval $(call TOOL_ADD_PAYLOAD,${FVP_HW_CONFIG},--hw-config))
+endif
+
+NEED_BL32 := yes
+
+# Modification of arm_common.mk
+
+# Process ARM_DISABLE_TRUSTED_WDOG flag
+# By default, Trusted Watchdog is always enabled unless SPIN_ON_BL1_EXIT is set
+ARM_DISABLE_TRUSTED_WDOG       :=      0
+ifeq (${SPIN_ON_BL1_EXIT}, 1)
+ARM_DISABLE_TRUSTED_WDOG       :=      1
+endif
+$(eval $(call assert_boolean,ARM_DISABLE_TRUSTED_WDOG))
+$(eval $(call add_define,ARM_DISABLE_TRUSTED_WDOG))
+
+# Use translation tables library v1 if using Cortex-A5
+ifdef ARM_CORTEX_A5
+ARM_XLAT_TABLES_LIB_V1         :=      1
+else
+ARM_XLAT_TABLES_LIB_V1         :=      0
+endif
+$(eval $(call assert_boolean,ARM_XLAT_TABLES_LIB_V1))
+$(eval $(call add_define,ARM_XLAT_TABLES_LIB_V1))
+
+MULTI_CONSOLE_API              :=      1
+
+ifeq (${ARM_XLAT_TABLES_LIB_V1}, 1)
+       # Only use nonlpae version of xlatv1 otherwise use xlat v2
+       PLAT_BL_COMMON_SOURCES  +=      lib/xlat_tables/${ARCH}/nonlpae_tables.c
+else
+       include lib/xlat_tables_v2/xlat_tables.mk
+       PLAT_BL_COMMON_SOURCES  +=      ${XLAT_TABLES_LIB_SRCS}
+endif
+
+# Add `libfdt` and Arm common helpers required for Dynamic Config
+include lib/libfdt/libfdt.mk
+
+DYN_CFG_SOURCES                +=      plat/arm/common/arm_dyn_cfg.c           \
+                               plat/arm/common/arm_dyn_cfg_helpers.c   \
+                               common/fdt_wrappers.c
+
diff --git a/plat/arm/board/fvp_ve/sp_min/fvp_ve_sp_min_setup.c b/plat/arm/board/fvp_ve/sp_min/fvp_ve_sp_min_setup.c
new file mode 100644 (file)
index 0000000..e6a1bbe
--- /dev/null
@@ -0,0 +1,15 @@
+/*
+ * Copyright (c) 2019, Arm Limited. All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+#include <assert.h>
+
+#include <plat/arm/common/plat_arm.h>
+
+void plat_arm_sp_min_early_platform_setup(u_register_t arg0, u_register_t arg1,
+                       u_register_t arg2, u_register_t arg3)
+{
+       arm_sp_min_early_platform_setup((void *)arg0, arg1, arg2, (void *)arg3);
+}
diff --git a/plat/arm/board/fvp_ve/sp_min/sp_min-fvp_ve.mk b/plat/arm/board/fvp_ve/sp_min/sp_min-fvp_ve.mk
new file mode 100644 (file)
index 0000000..4ca810d
--- /dev/null
@@ -0,0 +1,22 @@
+#
+# Copyright (c) 2019, Arm Limited. All rights reserved.
+#
+# SPDX-License-Identifier: BSD-3-Clause
+#
+
+# SP_MIN source files specific to FVP platform
+BL32_SOURCES           +=      drivers/cfi/v2m/v2m_flash.c                     \
+                               lib/utils/mem_region.c                          \
+                               plat/arm/board/fvp_ve/aarch32/fvp_ve_helpers.S  \
+                               drivers/arm/fvp/fvp_pwrc.c                      \
+                               plat/arm/board/fvp_ve/fvp_ve_pm.c               \
+                               plat/arm/board/fvp_ve/fvp_ve_topology.c         \
+                               plat/arm/board/fvp_ve/sp_min/fvp_ve_sp_min_setup.c      \
+                               lib/aarch32/arm32_aeabi_divmod.c                \
+                               lib/aarch32/arm32_aeabi_divmod_a32.S            \
+                               plat/arm/common/sp_min/arm_sp_min_setup.c       \
+                               plat/common/aarch32/platform_mp_stack.S         \
+                               plat/common/plat_psci_common.c                  \
+                               ${FVP_VE_CPU_LIBS}                              \
+                               ${FVP_VE_GIC_SOURCES}                           \
+                               ${FVP_VE_SECURITY_SOURCES}
index 6575811a669f23bfb83e99991fde93291186605e..e44791b49831fc91e332e5d2a9f382b2a7a4ba20 100644 (file)
@@ -105,7 +105,10 @@ bl1_romlib.bin : $(BUILD_PLAT)/bl1.bin $(BUILD_PLAT)/romlib/romlib.bin
        ./lib/romlib/gen_combined_bl1_romlib.sh -o bl1_romlib.bin $(BUILD_PLAT)
 
 # Errata workarounds for Cortex-A53:
+ERRATA_A53_819472              :=      1
+ERRATA_A53_824069              :=      1
 ERRATA_A53_826319              :=      1
+ERRATA_A53_827319              :=      1
 ERRATA_A53_835769              :=      1
 ERRATA_A53_836870              :=      1
 ERRATA_A53_843419              :=      1
@@ -115,6 +118,8 @@ ERRATA_A53_855873           :=      1
 ERRATA_A57_806969              :=      0
 ERRATA_A57_813419              :=      1
 ERRATA_A57_813420              :=      1
+ERRATA_A57_814670              :=      1
+ERRATA_A57_817169              :=      1
 ERRATA_A57_826974              :=      1
 ERRATA_A57_826977              :=      1
 ERRATA_A57_828024              :=      1
index 6eb01aa57bcbaedb3c6fb144b015007f7775d56e..c03185aea51b7a98f58de98ce9c54c55f3d3b612 100644 (file)
@@ -1,12 +1,12 @@
 /*
- * Copyright (c) 2018, ARM Limited and Contributors. All rights reserved.
+ * Copyright (c) 2018-2019, ARM Limited and Contributors. All rights reserved.
  *
  * SPDX-License-Identifier: BSD-3-Clause
  */
 
 #include <arch.h>
 #include <asm_macros.S>
-#include <cortex_ares.h>
+#include <neoverse_n1.h>
 #include <cpu_macros.S>
 #include <platform_def.h>
 
@@ -58,17 +58,17 @@ endfunc plat_arm_calc_core_pos
         */
 
 func plat_reset_handler
-       jump_if_cpu_midr CORTEX_ARES_MIDR, ARES
+       jump_if_cpu_midr NEOVERSE_N1_MIDR, N1
        ret
 
        /* -----------------------------------------------------
         * Disable CPU power down bit in power control register
         * -----------------------------------------------------
         */
-ARES:
-       mrs     x0, CORTEX_ARES_CPUPWRCTLR_EL1
-       bic     x0, x0, #CORTEX_ARES_CORE_PWRDN_EN_MASK
-       msr     CORTEX_ARES_CPUPWRCTLR_EL1, x0
+N1:
+       mrs     x0, NEOVERSE_N1_CPUPWRCTLR_EL1
+       bic     x0, x0, #NEOVERSE_N1_CORE_PWRDN_EN_MASK
+       msr     NEOVERSE_N1_CPUPWRCTLR_EL1, x0
        isb
        ret
 endfunc plat_reset_handler
index 7b8c367a2d4aea840ac0d9a865114f107ad66379..83b9f52d2b6b7ee7c51bdf465f78e86e4384af92 100644 (file)
 #define PLAT_ARM_BOOT_UART_BASE                        0x2A400000
 #define PLAT_ARM_BOOT_UART_CLK_IN_HZ           50000000
 
-#define PLAT_ARM_BL31_RUN_UART_BASE            0x2A410000
-#define PLAT_ARM_BL31_RUN_UART_CLK_IN_HZ       50000000
+#define PLAT_ARM_RUN_UART_BASE         0x2A410000
+#define PLAT_ARM_RUN_UART_CLK_IN_HZ    50000000
 
 #define PLAT_ARM_SP_MIN_RUN_UART_BASE          0x2A410000
 #define PLAT_ARM_SP_MIN_RUN_UART_CLK_IN_HZ     50000000
 
-#define PLAT_ARM_CRASH_UART_BASE               PLAT_ARM_BL31_RUN_UART_BASE
-#define PLAT_ARM_CRASH_UART_CLK_IN_HZ          PLAT_ARM_BL31_RUN_UART_CLK_IN_HZ
+#define PLAT_ARM_CRASH_UART_BASE               PLAT_ARM_RUN_UART_BASE
+#define PLAT_ARM_CRASH_UART_CLK_IN_HZ          PLAT_ARM_RUN_UART_CLK_IN_HZ
 
 #define PLAT_ARM_DRAM2_SIZE                    ULL(0x780000000)
 
index 2b68f657eb4b1547ae503e98b5e61ba26f495138..653d081062a43ee8f567a8cfc132c6d6ae4b3789 100644 (file)
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2018, ARM Limited and Contributors. All rights reserved.
+# Copyright (c) 2018-2019, ARM Limited and Contributors. All rights reserved.
 #
 # SPDX-License-Identifier: BSD-3-Clause
 #
@@ -12,7 +12,7 @@ INTERCONNECT_SOURCES  :=      ${N1SDP_BASE}/n1sdp_interconnect.c
 PLAT_INCLUDES          :=      -I${N1SDP_BASE}/include
 
 
-N1SDP_CPU_SOURCES      :=      lib/cpus/aarch64/cortex_ares.S
+N1SDP_CPU_SOURCES      :=      lib/cpus/aarch64/neoverse_n1.S
 
 
 N1SDP_GIC_SOURCES      :=      drivers/arm/gic/common/gic_common.c     \
diff --git a/plat/arm/board/rde1edge/fdts/rde1edge_nt_fw_config.dts b/plat/arm/board/rde1edge/fdts/rde1edge_nt_fw_config.dts
new file mode 100644 (file)
index 0000000..4176921
--- /dev/null
@@ -0,0 +1,22 @@
+/*
+ * Copyright (c) 2018-2019, Arm Limited. All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+/dts-v1/;
+/ {
+       /* compatible string */
+       compatible = "arm,rd-e1edge";
+
+       /*
+        * Place holder for system-id node with default values. The
+        * value of platform-id and config-id will be set to the
+        * correct values during the BL2 stage of boot.
+        */
+       system-id {
+               platform-id = <0x0>;
+               config-id = <0x0>;
+       };
+
+};
diff --git a/plat/arm/board/rde1edge/fdts/rde1edge_tb_fw_config.dts b/plat/arm/board/rde1edge/fdts/rde1edge_tb_fw_config.dts
new file mode 100644 (file)
index 0000000..766dc00
--- /dev/null
@@ -0,0 +1,25 @@
+/*
+ * Copyright (c) 2018, Arm Limited. All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+/dts-v1/;
+
+/ {
+       /* Platform Config */
+       compatible = "arm,tb_fw";
+       nt_fw_config_addr = <0x0 0xFEF00000>;
+       nt_fw_config_max_size = <0x0100000>;
+       /*
+        * The following two entries are placeholders for Mbed TLS
+        * heap information. The default values don't matter since
+        * they will be overwritten by BL1.
+        * In case of having shared Mbed TLS heap between BL1 and BL2,
+        * BL1 will populate these two properties with the respective
+        * info about the shared heap. This info will be available for
+        * BL2 in order to locate and re-use the heap.
+        */
+       mbedtls_heap_addr = <0x0 0x0>;
+       mbedtls_heap_size = <0x0>;
+};
diff --git a/plat/arm/board/rde1edge/include/platform_def.h b/plat/arm/board/rde1edge/include/platform_def.h
new file mode 100644 (file)
index 0000000..954a1cd
--- /dev/null
@@ -0,0 +1,28 @@
+/*
+ * Copyright (c) 2018-2019, Arm Limited. All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+#ifndef PLATFORM_DEF_H
+#define PLATFORM_DEF_H
+
+#include <lib/utils_def.h>
+
+#include <sgi_base_platform_def.h>
+
+#define PLAT_ARM_CLUSTER_COUNT         2
+#define CSS_SGI_MAX_CPUS_PER_CLUSTER   8
+#define CSS_SGI_MAX_PE_PER_CPU         2
+
+#define PLAT_CSS_MHU_BASE              UL(0x45400000)
+
+/* Base address of DMC-620 instances */
+#define RDE1EDGE_DMC620_BASE0          UL(0x4e000000)
+#define RDE1EDGE_DMC620_BASE1          UL(0x4e100000)
+
+#define PLAT_MAX_PWR_LVL               ARM_PWR_LVL2
+
+#define CSS_SYSTEM_PWR_DMN_LVL         ARM_PWR_LVL3
+
+#endif /* PLATFORM_DEF_H */
diff --git a/plat/arm/board/rde1edge/platform.mk b/plat/arm/board/rde1edge/platform.mk
new file mode 100644 (file)
index 0000000..833bb82
--- /dev/null
@@ -0,0 +1,42 @@
+#
+# Copyright (c) 2018-2019, Arm Limited. All rights reserved.
+#
+# SPDX-License-Identifier: BSD-3-Clause
+#
+
+include plat/arm/css/sgi/sgi-common.mk
+
+RDE1EDGE_BASE          =       plat/arm/board/rde1edge
+
+PLAT_INCLUDES          +=      -I${RDE1EDGE_BASE}/include/
+
+SGI_CPU_SOURCES                :=      lib/cpus/aarch64/neoverse_e1.S
+
+BL1_SOURCES            +=      ${SGI_CPU_SOURCES}
+
+BL2_SOURCES            +=      ${RDE1EDGE_BASE}/rde1edge_plat.c        \
+                               ${RDE1EDGE_BASE}/rde1edge_security.c    \
+                               drivers/arm/tzc/tzc_dmc620.c            \
+                               lib/utils/mem_region.c                  \
+                               plat/arm/common/arm_nor_psci_mem_protect.c
+
+BL31_SOURCES           +=      ${SGI_CPU_SOURCES}                      \
+                               ${RDE1EDGE_BASE}/rde1edge_plat.c        \
+                               drivers/cfi/v2m/v2m_flash.c             \
+                               lib/utils/mem_region.c                  \
+                               plat/arm/common/arm_nor_psci_mem_protect.c
+
+# Add the FDT_SOURCES and options for Dynamic Config
+FDT_SOURCES            +=      ${RDE1EDGE_BASE}/fdts/${PLAT}_tb_fw_config.dts
+TB_FW_CONFIG           :=      ${BUILD_PLAT}/fdts/${PLAT}_tb_fw_config.dtb
+
+# Add the TB_FW_CONFIG to FIP and specify the same to certtool
+$(eval $(call TOOL_ADD_PAYLOAD,${TB_FW_CONFIG},--tb-fw-config))
+
+FDT_SOURCES            +=      ${RDE1EDGE_BASE}/fdts/${PLAT}_nt_fw_config.dts
+NT_FW_CONFIG           :=      ${BUILD_PLAT}/fdts/${PLAT}_nt_fw_config.dtb
+
+# Add the NT_FW_CONFIG to FIP and specify the same to certtool
+$(eval $(call TOOL_ADD_PAYLOAD,${NT_FW_CONFIG},--nt-fw-config))
+
+override CTX_INCLUDE_AARCH32_REGS      := 0
diff --git a/plat/arm/board/rde1edge/rde1edge_plat.c b/plat/arm/board/rde1edge/rde1edge_plat.c
new file mode 100644 (file)
index 0000000..a1b8d62
--- /dev/null
@@ -0,0 +1,18 @@
+/*
+ * Copyright (c) 2018, Arm Limited. All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+#include <plat/common/platform.h>
+
+unsigned int plat_arm_sgi_get_platform_id(void)
+{
+       return mmio_read_32(SID_REG_BASE + SID_SYSTEM_ID_OFFSET)
+                               & SID_SYSTEM_ID_PART_NUM_MASK;
+}
+
+unsigned int plat_arm_sgi_get_config_id(void)
+{
+       return mmio_read_32(SID_REG_BASE + SID_SYSTEM_CFG_OFFSET);
+}
diff --git a/plat/arm/board/rde1edge/rde1edge_security.c b/plat/arm/board/rde1edge/rde1edge_security.c
new file mode 100644 (file)
index 0000000..2123e09
--- /dev/null
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2019, Arm Limited. All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+#include <platform_def.h>
+
+#include <common/debug.h>
+#include <drivers/arm/tzc_dmc620.h>
+
+uintptr_t rde1edge_dmc_base[] = {
+       RDE1EDGE_DMC620_BASE0,
+       RDE1EDGE_DMC620_BASE1
+};
+
+static const tzc_dmc620_driver_data_t rde1edge_plat_driver_data = {
+       .dmc_base = rde1edge_dmc_base,
+       .dmc_count = ARRAY_SIZE(rde1edge_dmc_base)
+};
+
+static const tzc_dmc620_acc_addr_data_t rde1edge_acc_addr_data[] = {
+       {
+               .region_base = ARM_AP_TZC_DRAM1_BASE,
+               .region_top = ARM_AP_TZC_DRAM1_BASE + ARM_TZC_DRAM1_SIZE - 1,
+               .sec_attr = TZC_DMC620_REGION_S_RDWR
+       }
+};
+
+static const tzc_dmc620_config_data_t rde1edge_plat_config_data = {
+       .plat_drv_data = &rde1edge_plat_driver_data,
+       .plat_acc_addr_data = rde1edge_acc_addr_data,
+       .acc_addr_count = ARRAY_SIZE(rde1edge_acc_addr_data)
+};
+
+/* Initialize the secure environment */
+void plat_arm_security_setup(void)
+{
+       arm_tzc_dmc620_setup(&rde1edge_plat_config_data);
+}
diff --git a/plat/arm/board/rdn1edge/fdts/rdn1edge_nt_fw_config.dts b/plat/arm/board/rdn1edge/fdts/rdn1edge_nt_fw_config.dts
new file mode 100644 (file)
index 0000000..fff5874
--- /dev/null
@@ -0,0 +1,21 @@
+/*
+ * Copyright (c) 2018-2019, ARM Limited and Contributors. All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+/dts-v1/;
+/ {
+       /* compatible string */
+       compatible = "arm,rd-n1edge";
+
+       /*
+        * Place holder for system-id node with default values. The
+        * value of platform-id and config-id will be set to the
+        * correct values during the BL2 stage of boot.
+        */
+       system-id {
+               platform-id = <0x0>;
+               config-id = <0x0>;
+       };
+};
diff --git a/plat/arm/board/rdn1edge/fdts/rdn1edge_tb_fw_config.dts b/plat/arm/board/rdn1edge/fdts/rdn1edge_tb_fw_config.dts
new file mode 100644 (file)
index 0000000..b14d7ad
--- /dev/null
@@ -0,0 +1,25 @@
+/*
+ * Copyright (c) 2018, ARM Limited and Contributors. All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+/dts-v1/;
+
+/ {
+       /* Platform Config */
+       compatible = "arm,tb_fw";
+       nt_fw_config_addr = <0x0 0xFEF00000>;
+       nt_fw_config_max_size = <0x0100000>;
+       /*
+        * The following two entries are placeholders for Mbed TLS
+        * heap information. The default values don't matter since
+        * they will be overwritten by BL1.
+        * In case of having shared Mbed TLS heap between BL1 and BL2,
+        * BL1 will populate these two properties with the respective
+        * info about the shared heap. This info will be available for
+        * BL2 in order to locate and re-use the heap.
+        */
+       mbedtls_heap_addr = <0x0 0x0>;
+       mbedtls_heap_size = <0x0>;
+};
diff --git a/plat/arm/board/rdn1edge/include/platform_def.h b/plat/arm/board/rdn1edge/include/platform_def.h
new file mode 100644 (file)
index 0000000..2ca0dd4
--- /dev/null
@@ -0,0 +1,29 @@
+/*
+ * Copyright (c) 2018-2019, ARM Limited and Contributors. All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+#ifndef PLATFORM_DEF_H
+#define PLATFORM_DEF_H
+
+#include <lib/utils_def.h>
+
+#include <sgi_base_platform_def.h>
+
+#define PLAT_ARM_CLUSTER_COUNT         2
+#define CSS_SGI_MAX_CPUS_PER_CLUSTER   4
+#define CSS_SGI_MAX_PE_PER_CPU         1
+
+#define PLAT_CSS_MHU_BASE              UL(0x45400000)
+
+/* Base address of DMC-620 instances */
+#define RDN1EDGE_DMC620_BASE0          UL(0x4e000000)
+#define RDN1EDGE_DMC620_BASE1          UL(0x4e100000)
+
+/* System power domain level */
+#define CSS_SYSTEM_PWR_DMN_LVL         ARM_PWR_LVL2
+
+#define PLAT_MAX_PWR_LVL               ARM_PWR_LVL1
+
+#endif /* PLATFORM_DEF_H */
diff --git a/plat/arm/board/rdn1edge/platform.mk b/plat/arm/board/rdn1edge/platform.mk
new file mode 100644 (file)
index 0000000..cacdaa1
--- /dev/null
@@ -0,0 +1,42 @@
+#
+# Copyright (c) 2018-2019, ARM Limited and Contributors. All rights reserved.
+#
+# SPDX-License-Identifier: BSD-3-Clause
+#
+
+include plat/arm/css/sgi/sgi-common.mk
+
+RDN1EDGE_BASE          =       plat/arm/board/rdn1edge
+
+PLAT_INCLUDES          +=      -I${RDN1EDGE_BASE}/include/
+
+SGI_CPU_SOURCES                :=      lib/cpus/aarch64/neoverse_n1.S
+
+BL1_SOURCES            +=      ${SGI_CPU_SOURCES}
+
+BL2_SOURCES            +=      ${RDN1EDGE_BASE}/rdn1edge_plat.c        \
+                               ${RDN1EDGE_BASE}/rdn1edge_security.c    \
+                               drivers/arm/tzc/tzc_dmc620.c            \
+                               lib/utils/mem_region.c                  \
+                               plat/arm/common/arm_nor_psci_mem_protect.c
+
+BL31_SOURCES           +=      ${SGI_CPU_SOURCES}                      \
+                               ${RDN1EDGE_BASE}/rdn1edge_plat.c        \
+                               drivers/cfi/v2m/v2m_flash.c             \
+                               lib/utils/mem_region.c                  \
+                               plat/arm/common/arm_nor_psci_mem_protect.c
+
+# Add the FDT_SOURCES and options for Dynamic Config
+FDT_SOURCES            +=      ${RDN1EDGE_BASE}/fdts/${PLAT}_tb_fw_config.dts
+TB_FW_CONFIG           :=      ${BUILD_PLAT}/fdts/${PLAT}_tb_fw_config.dtb
+
+# Add the TB_FW_CONFIG to FIP and specify the same to certtool
+$(eval $(call TOOL_ADD_PAYLOAD,${TB_FW_CONFIG},--tb-fw-config))
+
+FDT_SOURCES            +=      ${RDN1EDGE_BASE}/fdts/${PLAT}_nt_fw_config.dts
+NT_FW_CONFIG           :=      ${BUILD_PLAT}/fdts/${PLAT}_nt_fw_config.dtb
+
+# Add the NT_FW_CONFIG to FIP and specify the same to certtool
+$(eval $(call TOOL_ADD_PAYLOAD,${NT_FW_CONFIG},--nt-fw-config))
+
+override CTX_INCLUDE_AARCH32_REGS      := 0
diff --git a/plat/arm/board/rdn1edge/rdn1edge_plat.c b/plat/arm/board/rdn1edge/rdn1edge_plat.c
new file mode 100644 (file)
index 0000000..3b7e5ee
--- /dev/null
@@ -0,0 +1,18 @@
+/*
+ * Copyright (c) 2018, ARM Limited and Contributors. All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+#include <plat/common/platform.h>
+
+unsigned int plat_arm_sgi_get_platform_id(void)
+{
+       return mmio_read_32(SID_REG_BASE + SID_SYSTEM_ID_OFFSET)
+                               & SID_SYSTEM_ID_PART_NUM_MASK;
+}
+
+unsigned int plat_arm_sgi_get_config_id(void)
+{
+       return mmio_read_32(SID_REG_BASE + SID_SYSTEM_CFG_OFFSET);
+}
diff --git a/plat/arm/board/rdn1edge/rdn1edge_security.c b/plat/arm/board/rdn1edge/rdn1edge_security.c
new file mode 100644 (file)
index 0000000..ffa8935
--- /dev/null
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2019, ARM Limited. All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+#include <platform_def.h>
+
+#include <common/debug.h>
+#include <drivers/arm/tzc_dmc620.h>
+
+uintptr_t rdn1edge_dmc_base[] = {
+       RDN1EDGE_DMC620_BASE0,
+       RDN1EDGE_DMC620_BASE1
+};
+
+static const tzc_dmc620_driver_data_t rdn1edge_plat_driver_data = {
+       .dmc_base = rdn1edge_dmc_base,
+       .dmc_count = ARRAY_SIZE(rdn1edge_dmc_base)
+};
+
+static const tzc_dmc620_acc_addr_data_t rdn1edge_acc_addr_data[] = {
+       {
+               .region_base = ARM_AP_TZC_DRAM1_BASE,
+               .region_top = ARM_AP_TZC_DRAM1_BASE + ARM_TZC_DRAM1_SIZE - 1,
+               .sec_attr = TZC_DMC620_REGION_S_RDWR
+       }
+};
+
+static const tzc_dmc620_config_data_t rdn1edge_plat_config_data = {
+       .plat_drv_data = &rdn1edge_plat_driver_data,
+       .plat_acc_addr_data = rdn1edge_acc_addr_data,
+       .acc_addr_count = ARRAY_SIZE(rdn1edge_acc_addr_data)
+};
+
+/* Initialize the secure environment */
+void plat_arm_security_setup(void)
+{
+       arm_tzc_dmc620_setup(&rdn1edge_plat_config_data);
+}
diff --git a/plat/arm/board/sgiclarka/fdts/sgiclarka_nt_fw_config.dts b/plat/arm/board/sgiclarka/fdts/sgiclarka_nt_fw_config.dts
deleted file mode 100644 (file)
index 43bd856..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- * Copyright (c) 2018, ARM Limited and Contributors. All rights reserved.
- *
- * SPDX-License-Identifier: BSD-3-Clause
- */
-
-/dts-v1/;
-/ {
-       /* compatible string */
-       compatible = "arm,sgi-clark";
-
-       /*
-        * Place holder for system-id node with default values. The
-        * value of platform-id and config-id will be set to the
-        * correct values during the BL2 stage of boot.
-        */
-       system-id {
-               platform-id = <0x0>;
-               config-id = <0x0>;
-       };
-};
diff --git a/plat/arm/board/sgiclarka/fdts/sgiclarka_tb_fw_config.dts b/plat/arm/board/sgiclarka/fdts/sgiclarka_tb_fw_config.dts
deleted file mode 100644 (file)
index b14d7ad..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * Copyright (c) 2018, ARM Limited and Contributors. All rights reserved.
- *
- * SPDX-License-Identifier: BSD-3-Clause
- */
-
-/dts-v1/;
-
-/ {
-       /* Platform Config */
-       compatible = "arm,tb_fw";
-       nt_fw_config_addr = <0x0 0xFEF00000>;
-       nt_fw_config_max_size = <0x0100000>;
-       /*
-        * The following two entries are placeholders for Mbed TLS
-        * heap information. The default values don't matter since
-        * they will be overwritten by BL1.
-        * In case of having shared Mbed TLS heap between BL1 and BL2,
-        * BL1 will populate these two properties with the respective
-        * info about the shared heap. This info will be available for
-        * BL2 in order to locate and re-use the heap.
-        */
-       mbedtls_heap_addr = <0x0 0x0>;
-       mbedtls_heap_size = <0x0>;
-};
diff --git a/plat/arm/board/sgiclarka/include/platform_def.h b/plat/arm/board/sgiclarka/include/platform_def.h
deleted file mode 100644 (file)
index d2cdb49..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * Copyright (c) 2018, ARM Limited and Contributors. All rights reserved.
- *
- * SPDX-License-Identifier: BSD-3-Clause
- */
-
-#ifndef PLATFORM_DEF_H
-#define PLATFORM_DEF_H
-
-#include <lib/utils_def.h>
-
-#include <sgi_base_platform_def.h>
-
-#define PLAT_ARM_CLUSTER_COUNT         2
-#define CSS_SGI_MAX_CPUS_PER_CLUSTER   4
-#define CSS_SGI_MAX_PE_PER_CPU         1
-
-#define PLAT_CSS_MHU_BASE              UL(0x45400000)
-
-/* Base address of DMC-620 instances */
-#define SGICLARKA_DMC620_BASE0         UL(0x4e000000)
-#define SGICLARKA_DMC620_BASE1         UL(0x4e100000)
-
-/* System power domain level */
-#define CSS_SYSTEM_PWR_DMN_LVL         ARM_PWR_LVL2
-
-#define PLAT_MAX_PWR_LVL               ARM_PWR_LVL1
-
-#endif /* PLATFORM_DEF_H */
diff --git a/plat/arm/board/sgiclarka/platform.mk b/plat/arm/board/sgiclarka/platform.mk
deleted file mode 100644 (file)
index 1a8b157..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-#
-# Copyright (c) 2018, ARM Limited and Contributors. All rights reserved.
-#
-# SPDX-License-Identifier: BSD-3-Clause
-#
-
-include plat/arm/css/sgi/sgi-common.mk
-
-SGICLARKA_BASE         =       plat/arm/board/sgiclarka
-
-PLAT_INCLUDES          +=      -I${SGICLARKA_BASE}/include/
-
-SGI_CPU_SOURCES                :=      lib/cpus/aarch64/cortex_ares.S
-
-BL1_SOURCES            +=      ${SGI_CPU_SOURCES}
-
-BL2_SOURCES            +=      ${SGICLARKA_BASE}/sgiclarka_plat.c      \
-                               ${SGICLARKA_BASE}/sgiclarka_security.c  \
-                               drivers/arm/tzc/tzc_dmc620.c            \
-                               lib/utils/mem_region.c                  \
-                               plat/arm/common/arm_nor_psci_mem_protect.c
-
-BL31_SOURCES           +=      ${SGI_CPU_SOURCES}                      \
-                               ${SGICLARKA_BASE}/sgiclarka_plat.c      \
-                               drivers/cfi/v2m/v2m_flash.c             \
-                               lib/utils/mem_region.c                  \
-                               plat/arm/common/arm_nor_psci_mem_protect.c
-
-# Add the FDT_SOURCES and options for Dynamic Config
-FDT_SOURCES            +=      ${SGICLARKA_BASE}/fdts/${PLAT}_tb_fw_config.dts
-TB_FW_CONFIG           :=      ${BUILD_PLAT}/fdts/${PLAT}_tb_fw_config.dtb
-
-# Add the TB_FW_CONFIG to FIP and specify the same to certtool
-$(eval $(call TOOL_ADD_PAYLOAD,${TB_FW_CONFIG},--tb-fw-config))
-
-FDT_SOURCES            +=      ${SGICLARKA_BASE}/fdts/${PLAT}_nt_fw_config.dts
-NT_FW_CONFIG           :=      ${BUILD_PLAT}/fdts/${PLAT}_nt_fw_config.dtb
-
-# Add the NT_FW_CONFIG to FIP and specify the same to certtool
-$(eval $(call TOOL_ADD_PAYLOAD,${NT_FW_CONFIG},--nt-fw-config))
-
-override CTX_INCLUDE_AARCH32_REGS      := 0
diff --git a/plat/arm/board/sgiclarka/sgiclarka_plat.c b/plat/arm/board/sgiclarka/sgiclarka_plat.c
deleted file mode 100644 (file)
index 3b7e5ee..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-/*
- * Copyright (c) 2018, ARM Limited and Contributors. All rights reserved.
- *
- * SPDX-License-Identifier: BSD-3-Clause
- */
-
-#include <plat/common/platform.h>
-
-unsigned int plat_arm_sgi_get_platform_id(void)
-{
-       return mmio_read_32(SID_REG_BASE + SID_SYSTEM_ID_OFFSET)
-                               & SID_SYSTEM_ID_PART_NUM_MASK;
-}
-
-unsigned int plat_arm_sgi_get_config_id(void)
-{
-       return mmio_read_32(SID_REG_BASE + SID_SYSTEM_CFG_OFFSET);
-}
diff --git a/plat/arm/board/sgiclarka/sgiclarka_security.c b/plat/arm/board/sgiclarka/sgiclarka_security.c
deleted file mode 100644 (file)
index c455111..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright (c) 2018, ARM Limited and Contributors. All rights reserved.
- *
- * SPDX-License-Identifier: BSD-3-Clause
- */
-
-#include <platform_def.h>
-
-#include <common/debug.h>
-#include <drivers/arm/tzc_dmc620.h>
-
-uintptr_t sgiclarka_dmc_base[] = {
-       SGICLARKA_DMC620_BASE0,
-       SGICLARKA_DMC620_BASE1
-};
-
-static const tzc_dmc620_driver_data_t sgiclarka_plat_driver_data = {
-       .dmc_base = sgiclarka_dmc_base,
-       .dmc_count = ARRAY_SIZE(sgiclarka_dmc_base)
-};
-
-static const tzc_dmc620_acc_addr_data_t sgiclarka_acc_addr_data[] = {
-       {
-               .region_base = ARM_AP_TZC_DRAM1_BASE,
-               .region_top = ARM_AP_TZC_DRAM1_BASE + ARM_TZC_DRAM1_SIZE - 1,
-               .sec_attr = TZC_DMC620_REGION_S_RDWR
-       }
-};
-
-static const tzc_dmc620_config_data_t sgiclarka_plat_config_data = {
-       .plat_drv_data = &sgiclarka_plat_driver_data,
-       .plat_acc_addr_data = sgiclarka_acc_addr_data,
-       .acc_addr_count = ARRAY_SIZE(sgiclarka_acc_addr_data)
-};
-
-/* Initialize the secure environment */
-void plat_arm_security_setup(void)
-{
-       arm_tzc_dmc620_setup(&sgiclarka_plat_config_data);
-}
diff --git a/plat/arm/board/sgiclarkh/fdts/sgiclarkh_nt_fw_config.dts b/plat/arm/board/sgiclarkh/fdts/sgiclarkh_nt_fw_config.dts
deleted file mode 100644 (file)
index 3dedf1d..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- * Copyright (c) 2018, Arm Limited. All rights reserved.
- *
- * SPDX-License-Identifier: BSD-3-Clause
- */
-
-/dts-v1/;
-/ {
-       /* compatible string */
-       compatible = "arm,sgi-clark";
-
-       /*
-        * Place holder for system-id node with default values. The
-        * value of platform-id and config-id will be set to the
-        * correct values during the BL2 stage of boot.
-        */
-       system-id {
-               platform-id = <0x0>;
-               config-id = <0x0>;
-       };
-
-};
diff --git a/plat/arm/board/sgiclarkh/fdts/sgiclarkh_tb_fw_config.dts b/plat/arm/board/sgiclarkh/fdts/sgiclarkh_tb_fw_config.dts
deleted file mode 100644 (file)
index 766dc00..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * Copyright (c) 2018, Arm Limited. All rights reserved.
- *
- * SPDX-License-Identifier: BSD-3-Clause
- */
-
-/dts-v1/;
-
-/ {
-       /* Platform Config */
-       compatible = "arm,tb_fw";
-       nt_fw_config_addr = <0x0 0xFEF00000>;
-       nt_fw_config_max_size = <0x0100000>;
-       /*
-        * The following two entries are placeholders for Mbed TLS
-        * heap information. The default values don't matter since
-        * they will be overwritten by BL1.
-        * In case of having shared Mbed TLS heap between BL1 and BL2,
-        * BL1 will populate these two properties with the respective
-        * info about the shared heap. This info will be available for
-        * BL2 in order to locate and re-use the heap.
-        */
-       mbedtls_heap_addr = <0x0 0x0>;
-       mbedtls_heap_size = <0x0>;
-};
diff --git a/plat/arm/board/sgiclarkh/include/platform_def.h b/plat/arm/board/sgiclarkh/include/platform_def.h
deleted file mode 100644 (file)
index fe8907b..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Copyright (c) 2018, Arm Limited. All rights reserved.
- *
- * SPDX-License-Identifier: BSD-3-Clause
- */
-
-#ifndef PLATFORM_DEF_H
-#define PLATFORM_DEF_H
-
-#include <lib/utils_def.h>
-
-#include <sgi_base_platform_def.h>
-
-#define PLAT_ARM_CLUSTER_COUNT         2
-#define CSS_SGI_MAX_CPUS_PER_CLUSTER   8
-#define CSS_SGI_MAX_PE_PER_CPU         2
-
-#define PLAT_CSS_MHU_BASE              UL(0x45400000)
-
-/* Base address of DMC-620 instances */
-#define SGICLARKH_DMC620_BASE0         UL(0x4e000000)
-#define SGICLARKH_DMC620_BASE1         UL(0x4e100000)
-
-#define PLAT_MAX_PWR_LVL               ARM_PWR_LVL2
-
-#define CSS_SYSTEM_PWR_DMN_LVL         ARM_PWR_LVL3
-
-#endif /* PLATFORM_DEF_H */
diff --git a/plat/arm/board/sgiclarkh/platform.mk b/plat/arm/board/sgiclarkh/platform.mk
deleted file mode 100644 (file)
index 222ca60..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-#
-# Copyright (c) 2018, Arm Limited. All rights reserved.
-#
-# SPDX-License-Identifier: BSD-3-Clause
-#
-
-include plat/arm/css/sgi/sgi-common.mk
-
-SGICLARKH_BASE         =       plat/arm/board/sgiclarkh
-
-PLAT_INCLUDES          +=      -I${SGICLARKH_BASE}/include/
-
-SGI_CPU_SOURCES                :=      lib/cpus/aarch64/cortex_helios.S
-
-BL1_SOURCES            +=      ${SGI_CPU_SOURCES}
-
-BL2_SOURCES            +=      ${SGICLARKH_BASE}/sgiclarkh_plat.c      \
-                               ${SGICLARKH_BASE}/sgiclarkh_security.c  \
-                               drivers/arm/tzc/tzc_dmc620.c            \
-                               lib/utils/mem_region.c                  \
-                               plat/arm/common/arm_nor_psci_mem_protect.c
-
-BL31_SOURCES           +=      ${SGI_CPU_SOURCES}                      \
-                               ${SGICLARKH_BASE}/sgiclarkh_plat.c      \
-                               drivers/cfi/v2m/v2m_flash.c             \
-                               lib/utils/mem_region.c                  \
-                               plat/arm/common/arm_nor_psci_mem_protect.c
-
-# Add the FDT_SOURCES and options for Dynamic Config
-FDT_SOURCES            +=      ${SGICLARKH_BASE}/fdts/${PLAT}_tb_fw_config.dts
-TB_FW_CONFIG           :=      ${BUILD_PLAT}/fdts/${PLAT}_tb_fw_config.dtb
-
-# Add the TB_FW_CONFIG to FIP and specify the same to certtool
-$(eval $(call TOOL_ADD_PAYLOAD,${TB_FW_CONFIG},--tb-fw-config))
-
-FDT_SOURCES            +=      ${SGICLARKH_BASE}/fdts/${PLAT}_nt_fw_config.dts
-NT_FW_CONFIG           :=      ${BUILD_PLAT}/fdts/${PLAT}_nt_fw_config.dtb
-
-# Add the NT_FW_CONFIG to FIP and specify the same to certtool
-$(eval $(call TOOL_ADD_PAYLOAD,${NT_FW_CONFIG},--nt-fw-config))
-
-override CTX_INCLUDE_AARCH32_REGS      := 0
diff --git a/plat/arm/board/sgiclarkh/sgiclarkh_plat.c b/plat/arm/board/sgiclarkh/sgiclarkh_plat.c
deleted file mode 100644 (file)
index a1b8d62..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-/*
- * Copyright (c) 2018, Arm Limited. All rights reserved.
- *
- * SPDX-License-Identifier: BSD-3-Clause
- */
-
-#include <plat/common/platform.h>
-
-unsigned int plat_arm_sgi_get_platform_id(void)
-{
-       return mmio_read_32(SID_REG_BASE + SID_SYSTEM_ID_OFFSET)
-                               & SID_SYSTEM_ID_PART_NUM_MASK;
-}
-
-unsigned int plat_arm_sgi_get_config_id(void)
-{
-       return mmio_read_32(SID_REG_BASE + SID_SYSTEM_CFG_OFFSET);
-}
diff --git a/plat/arm/board/sgiclarkh/sgiclarkh_security.c b/plat/arm/board/sgiclarkh/sgiclarkh_security.c
deleted file mode 100644 (file)
index aaf9691..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright (c) 2018, Arm Limited. All rights reserved.
- *
- * SPDX-License-Identifier: BSD-3-Clause
- */
-
-#include <platform_def.h>
-
-#include <common/debug.h>
-#include <drivers/arm/tzc_dmc620.h>
-
-uintptr_t sgiclarkh_dmc_base[] = {
-       SGICLARKH_DMC620_BASE0,
-       SGICLARKH_DMC620_BASE1
-};
-
-static const tzc_dmc620_driver_data_t sgiclarkh_plat_driver_data = {
-       .dmc_base = sgiclarkh_dmc_base,
-       .dmc_count = ARRAY_SIZE(sgiclarkh_dmc_base)
-};
-
-static const tzc_dmc620_acc_addr_data_t sgiclarkh_acc_addr_data[] = {
-       {
-               .region_base = ARM_AP_TZC_DRAM1_BASE,
-               .region_top = ARM_AP_TZC_DRAM1_BASE + ARM_TZC_DRAM1_SIZE - 1,
-               .sec_attr = TZC_DMC620_REGION_S_RDWR
-       }
-};
-
-static const tzc_dmc620_config_data_t sgiclarkh_plat_config_data = {
-       .plat_drv_data = &sgiclarkh_plat_driver_data,
-       .plat_acc_addr_data = sgiclarkh_acc_addr_data,
-       .acc_addr_count = ARRAY_SIZE(sgiclarkh_acc_addr_data)
-};
-
-/* Initialize the secure environment */
-void plat_arm_security_setup(void)
-{
-       arm_tzc_dmc620_setup(&sgiclarkh_plat_config_data);
-}
diff --git a/plat/arm/common/aarch64/arm_pauth.c b/plat/arm/common/aarch64/arm_pauth.c
new file mode 100644 (file)
index 0000000..c847119
--- /dev/null
@@ -0,0 +1,32 @@
+/*
+ * Copyright (c) 2019, Arm Limited. All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+#include <cdefs.h>
+#include <stdint.h>
+
+/*
+ * Instruction pointer authentication key A. The low 64-bit are at [0], and the
+ * high bits at [1]. They are run-time constants so they are placed in the
+ * rodata section. They are written before MMU is turned on and the permissions
+ * are effective.
+ */
+uint64_t plat_apiakey[2] __section("rodata.apiakey");
+
+/*
+ * This is only a toy implementation to generate a seemingly random 128-bit key
+ * from sp and x30 values. A production system must re-implement this function
+ * to generate keys from a reliable randomness source.
+ */
+uint64_t *plat_init_apiakey(void)
+{
+       uintptr_t return_addr = (uintptr_t)__builtin_return_address(0U);
+       uintptr_t frame_addr = (uintptr_t)__builtin_frame_address(0U);
+
+       plat_apiakey[0] = (return_addr << 13) ^ frame_addr;
+       plat_apiakey[1] = (frame_addr << 15) ^ return_addr;
+
+       return plat_apiakey;
+}
index fd4809c16294cdf80c357d5b61109c22caa48bf8..1e9edefd50f5da8aff7c45b1e90259591e06d90c 100644 (file)
@@ -155,8 +155,12 @@ void arm_bl1_platform_setup(void)
         * Allow access to the System counter timer module and program
         * counter frequency for non secure images during FWU
         */
+#ifdef ARM_SYS_TIMCTL_BASE
        arm_configure_sys_timer();
+#endif
+#if (ARM_ARCH_MAJOR > 7) || defined(ARMV7_SUPPORTS_GENERIC_TIMER)
        write_cntfrq_el0(plat_get_syscnt_freq2());
+#endif
 }
 
 void bl1_platform_setup(void)
index f18a9af698268d4cd5f78dee06c8abc3f065c31a..5e890ed176ee9cdf16e35a43d54754cc0b6700b0 100644 (file)
@@ -236,6 +236,11 @@ BL31_SOURCES               +=      lib/extensions/ras/std_err_record.c             \
                                lib/extensions/ras/ras_common.c
 endif
 
+# Pointer Authentication sources
+ifeq (${ENABLE_PAUTH}, 1)
+PLAT_BL_COMMON_SOURCES +=      plat/arm/common/aarch64/arm_pauth.c
+endif
+
 # SPM uses libfdt in Arm platforms
 ifeq (${SPM_MM},0)
 ifeq (${ENABLE_SPM},1)
index 03670858ca3b640fc8ae3600dffbcf97306cf086..84886b470c9f751898d03aed3d0c2c209ae3e934 100644 (file)
@@ -61,8 +61,8 @@ void arm_console_boot_end(void)
 void arm_console_runtime_init(void)
 {
 #if MULTI_CONSOLE_API
-       int rc = console_pl011_register(PLAT_ARM_BL31_RUN_UART_BASE,
-                                       PLAT_ARM_BL31_RUN_UART_CLK_IN_HZ,
+       int rc = console_pl011_register(PLAT_ARM_RUN_UART_BASE,
+                                       PLAT_ARM_RUN_UART_CLK_IN_HZ,
                                        ARM_CONSOLE_BAUDRATE,
                                        &arm_runtime_console);
        if (rc == 0)
@@ -70,8 +70,8 @@ void arm_console_runtime_init(void)
 
        console_set_scope(&arm_runtime_console.console, CONSOLE_FLAG_RUNTIME);
 #else
-       (void)console_init(PLAT_ARM_BL31_RUN_UART_BASE,
-                          PLAT_ARM_BL31_RUN_UART_CLK_IN_HZ,
+       (void)console_init(PLAT_ARM_RUN_UART_BASE,
+                          PLAT_ARM_RUN_UART_CLK_IN_HZ,
                           ARM_CONSOLE_BAUDRATE);
 #endif /* MULTI_CONSOLE_API */
 }
index 1c58649ba51c59695940d6c63ad798d0b7eb067b..9a536495203bb52796f3a8a09d022cc836f350d4 100644 (file)
@@ -243,10 +243,11 @@ void arm_bl2_dyn_cfg_init(void)
                        if (check_uptr_overflow(image_base, image_size))
                                continue;
 
+#ifdef BL31_BASE
                        /* Ensure the configs don't overlap with BL31 */
                        if ((image_base > BL31_BASE) || ((image_base + image_size) > BL31_BASE))
                                continue;
-
+#endif
                        /* Ensure the configs are loaded in a valid address */
                        if (image_base < ARM_BL_RAM_BASE)
                                continue;
index c0ea027b846839ad23df7ea53d37d0fa5275e8fb..bb69914ae33b56fd35a4c6c3a9c58b0ab1a81901 100644 (file)
@@ -193,12 +193,14 @@ void sp_min_platform_setup(void)
 #endif
 
        /* Enable and initialize the System level generic timer */
+#ifdef ARM_SYS_CNTCTL_BASE
        mmio_write_32(ARM_SYS_CNTCTL_BASE + CNTCR_OFF,
                        CNTCR_FCREQ(0U) | CNTCR_EN);
-
+#endif
+#ifdef ARM_SYS_TIMCTL_BASE
        /* Allow access to the System counter timer module */
        arm_configure_sys_timer();
-
+#endif
        /* Initialize power controller before setting up topology */
        plat_arm_pwrc_setup();
 }
index d79f1aa21f6ca5ae69fc0c23f135e3934cb3e942..b80903d06199b25d1bef4681d1e6eb55b5cfc4ea 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018, ARM Limited and Contributors. All rights reserved.
+ * Copyright (c) 2018-2019, ARM Limited and Contributors. All rights reserved.
  *
  * SPDX-License-Identifier: BSD-3-Clause
  */
@@ -8,7 +8,7 @@
 #include <asm_macros.S>
 #include <platform_def.h>
 #include <cortex_a75.h>
-#include <cortex_ares.h>
+#include <neoverse_n1.h>
 #include <cpu_macros.S>
 
        .globl  plat_arm_calc_core_pos
@@ -59,7 +59,7 @@ endfunc plat_arm_calc_core_pos
         */
 func plat_reset_handler
        jump_if_cpu_midr CORTEX_A75_MIDR, A75
-       jump_if_cpu_midr CORTEX_ARES_MIDR, ARES
+       jump_if_cpu_midr NEOVERSE_N1_MIDR, N1
        ret
 
        /* -----------------------------------------------------
@@ -73,10 +73,10 @@ A75:
        isb
        ret
 
-ARES:
-       mrs     x0, CORTEX_ARES_CPUPWRCTLR_EL1
-       bic     x0, x0, #CORTEX_ARES_CORE_PWRDN_EN_MASK
-       msr     CORTEX_ARES_CPUPWRCTLR_EL1, x0
+N1:
+       mrs     x0, NEOVERSE_N1_CPUPWRCTLR_EL1
+       bic     x0, x0, #NEOVERSE_N1_CORE_PWRDN_EN_MASK
+       msr     NEOVERSE_N1_CPUPWRCTLR_EL1, x0
        isb
        ret
 endfunc plat_reset_handler
index e9b96dd461b72d64234e3f39913e1694bdd57393..c75f2132b9c38f1f19ed5b0da3ba02f81989b470 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018, ARM Limited and Contributors. All rights reserved.
+ * Copyright (c) 2018-2019, ARM Limited and Contributors. All rights reserved.
  *
  * SPDX-License-Identifier: BSD-3-Clause
  */
@@ -10,9 +10,9 @@
 /* SSC_VERSION values for SGI575 */
 #define SGI575_SSC_VER_PART_NUM                0x0783
 
-/* SID Version values for SGI-Clark */
-#define SGI_CLARK_SID_VER_PART_NUM             0x0786
-#define SGI_CLARK_HELIOS_CONFIG_ID             0x2
+/* SID Version values for RD-N1E1-Edge */
+#define RD_N1E1_EDGE_SID_VER_PART_NUM          0x0786
+#define RD_E1_EDGE_CONFIG_ID                   0x2
 
 /* Structure containing SGI platform variant information */
 typedef struct sgi_platform_info {
index bfcb521a3525de1e1f7f84f5112932e08a5ccf9f..8fa5b01b277d9e113946ef7b02d88cda10b61748 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018, ARM Limited and Contributors. All rights reserved.
+ * Copyright (c) 2018-2019, ARM Limited and Contributors. All rights reserved.
  *
  * SPDX-License-Identifier: BSD-3-Clause
  */
@@ -27,7 +27,7 @@ static scmi_channel_plat_info_t sgi575_scmi_plat_info = {
                .ring_doorbell = &mhu_ring_doorbell,
 };
 
-static scmi_channel_plat_info_t sgi_clark_scmi_plat_info = {
+static scmi_channel_plat_info_t rd_n1e1_edge_scmi_plat_info = {
                .scmi_mbx_mem = CSS_SCMI_PAYLOAD_BASE,
                .db_reg_addr = PLAT_CSS_MHU_BASE + SENDER_REG_SET(0),
                .db_preserve_mask = 0xfffffffe,
@@ -37,8 +37,8 @@ static scmi_channel_plat_info_t sgi_clark_scmi_plat_info = {
 
 scmi_channel_plat_info_t *plat_css_get_scmi_info()
 {
-       if (sgi_plat_info.platform_id == SGI_CLARK_SID_VER_PART_NUM)
-               return &sgi_clark_scmi_plat_info;
+       if (sgi_plat_info.platform_id == RD_N1E1_EDGE_SID_VER_PART_NUM)
+               return &rd_n1e1_edge_scmi_plat_info;
        else if (sgi_plat_info.platform_id == SGI575_SSC_VER_PART_NUM)
                return &sgi575_scmi_plat_info;
        else
@@ -65,9 +65,9 @@ void bl31_platform_setup(void)
 
 const plat_psci_ops_t *plat_arm_psci_override_pm_ops(plat_psci_ops_t *ops)
 {
-       /* For SGI-Clark.Helios platform only CPU ON/OFF is supported */
-       if ((sgi_plat_info.platform_id == SGI_CLARK_SID_VER_PART_NUM) &&
-           (sgi_plat_info.config_id == SGI_CLARK_HELIOS_CONFIG_ID)) {
+       /* For RD-E1-Edge platform only CPU ON/OFF is supported */
+       if ((sgi_plat_info.platform_id == RD_N1E1_EDGE_SID_VER_PART_NUM) &&
+           (sgi_plat_info.config_id == RD_E1_EDGE_CONFIG_ID)) {
                ops->cpu_standby = NULL;
                ops->system_off = NULL;
                ops->system_reset = NULL;
index dafaf40bf986029ef1145a6f166b9fc1a9550b51..f9dbdefe927a2da9eaa7a72c9c2ccc3897327ee7 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018, ARM Limited and Contributors. All rights reserved.
+ * Copyright (c) 2018-2019, ARM Limited and Contributors. All rights reserved.
  *
  * SPDX-License-Identifier: BSD-3-Clause
  */
@@ -21,8 +21,8 @@ const unsigned char sgi_pd_tree_desc[] = {
        CSS_SGI_MAX_CPUS_PER_CLUSTER
 };
 
-/* SGI-Clark.Helios platform consists of 16 physical CPUS and 32 threads */
-const unsigned char sgi_clark_helios_pd_tree_desc[] = {
+/* RD-E1-Edge platform consists of 16 physical CPUS and 32 threads */
+const unsigned char rd_e1_edge_pd_tree_desc[] = {
        PLAT_ARM_CLUSTER_COUNT,
        CSS_SGI_MAX_CPUS_PER_CLUSTER,
        CSS_SGI_MAX_CPUS_PER_CLUSTER,
@@ -49,9 +49,9 @@ const unsigned char sgi_clark_helios_pd_tree_desc[] = {
  ******************************************************************************/
 const unsigned char *plat_get_power_domain_tree_desc(void)
 {
-       if (sgi_plat_info.platform_id == SGI_CLARK_SID_VER_PART_NUM &&
-           sgi_plat_info.config_id == SGI_CLARK_HELIOS_CONFIG_ID)
-               return sgi_clark_helios_pd_tree_desc;
+       if (sgi_plat_info.platform_id == RD_N1E1_EDGE_SID_VER_PART_NUM &&
+           sgi_plat_info.config_id == RD_E1_EDGE_CONFIG_ID)
+               return rd_e1_edge_pd_tree_desc;
        else
                return sgi_pd_tree_desc;
 }
index 972a118a45f4d7064e5b427d99b64312103e4648..f9780e80cf51a81248a749f838ff96152f59455f 100644 (file)
        .weak   plat_set_my_stack
 
        /* ---------------------------------------------------------------------
-        * When the compatility layer is disabled, the new platform APIs
-        * viz plat_get_my_stack() and plat_set_my_stack() are
-        * supported by the platform and the previous APIs platform_get_stack()
-        * and platform_set_stack() are defined in terms of new APIs making use
-        * of the fact that they are only ever invoked for the current CPU.
-        * This is to enable components of Trusted Firmware like SPDs using the
-        * old platform APIs to continue to work.
+        * When the compatility layer is disabled, the platform APIs
+        * plat_get_my_stack() and plat_set_my_stack() are supported by the
+        * platform and the previous APIs platform_get_stack() and
+        * platform_set_stack() are defined in terms of new APIs making use of
+        * the fact that they are only ever invoked for the current CPU.  This
+        * is to enable components of Trusted Firmware like SPDs using the old
+        * platform APIs to continue to work.
         * --------------------------------------------------------------------
         */
 
index 2357edfa93a6414fd4e4017f0791ba2a616c8f02..b46656c7ac03c15b95794bfb244acb95fb847061 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018, ARM Limited and Contributors. All rights reserved.
+ * Copyright (c) 2018-2019, ARM Limited and Contributors. All rights reserved.
  *
  * SPDX-License-Identifier: BSD-3-Clause
  */
@@ -10,9 +10,6 @@
 #include <arch_helpers.h>
 #include <common/bl_common.h>
 #include <common/debug.h>
-#if TRUSTED_BOARD_BOOT
-#include <drivers/auth/mbedtls/mbedtls_config.h>
-#endif
 #include <lib/xlat_tables/xlat_tables_compat.h>
 #include <plat/common/platform.h>
 
@@ -26,7 +23,6 @@
 #pragma weak bl2_plat_handle_pre_image_load
 #pragma weak bl2_plat_handle_post_image_load
 #pragma weak plat_try_next_boot_source
-#pragma weak plat_get_mbedtls_heap
 
 void bl2_el3_plat_prepare_exit(void)
 {
@@ -57,24 +53,6 @@ int plat_try_next_boot_source(void)
        return 0;
 }
 
-#if TRUSTED_BOARD_BOOT
-/*
- * The following default implementation of the function simply returns the
- * by-default allocated heap.
- */
-int plat_get_mbedtls_heap(void **heap_addr, size_t *heap_size)
-{
-       static unsigned char heap[TF_MBEDTLS_HEAP_SIZE];
-
-       assert(heap_addr != NULL);
-       assert(heap_size != NULL);
-
-       *heap_addr = heap;
-       *heap_size = sizeof(heap);
-       return 0;
-}
-#endif /* TRUSTED_BOARD_BOOT */
-
 /*
  * Set up the page tables for the generic and platform-specific memory regions.
  * The size of the Trusted SRAM seen by the BL image must be specified as well
index 27c525b720ebad5f1628b6020fa71e03cdfacc85..3a7dcfec6d8bae311c21404572c60d95d037d8de 100644 (file)
@@ -9,6 +9,8 @@
 #include <common/bl_common.h>
 #include <common/interrupt_props.h>
 #include <drivers/arm/gicv3.h>
+#include <drivers/arm/arm_gicv3_common.h>
+#include <lib/mmio.h>
 #include <lib/utils.h>
 #include <plat/common/platform.h>
 
@@ -52,8 +54,27 @@ void plat_gic_driver_init(void)
 #endif
 }
 
+static __inline void plat_gicr_exit_sleep(void)
+{
+       unsigned int val = mmio_read_32(PLAT_GICR_BASE + GICR_WAKER);
+
+       /*
+        * ProcessorSleep bit can ONLY be set to zero when
+        * Quiescent bit and Sleep bit are both zero, so
+        * need to make sure Quiescent bit and Sleep bit
+        * are zero before clearing ProcessorSleep bit.
+        */
+       if (val & WAKER_QSC_BIT) {
+               mmio_write_32(PLAT_GICR_BASE + GICR_WAKER, val & ~WAKER_SL_BIT);
+               /* Wait till the WAKER_QSC_BIT changes to 0 */
+               while ((mmio_read_32(PLAT_GICR_BASE + GICR_WAKER) & WAKER_QSC_BIT) != 0U)
+                       ;
+       }
+}
+
 void plat_gic_init(void)
 {
+       plat_gicr_exit_sleep();
        gicv3_distif_init();
        gicv3_rdistif_init(plat_my_core_pos());
        gicv3_cpuif_enable(plat_my_core_pos());
index b18edd96d1b5833bced178d7552363b01316ee1c..99fa9807af0875c87cdb43bb3bc5299f15a74805 100644 (file)
@@ -84,6 +84,11 @@ void bl31_early_platform_setup2(u_register_t arg0, u_register_t arg1,
                mmio_write_32(IMX_CSU_BASE + i * 4, 0xffffffff);
        }
 
+       /* config CAAM JRaMID set MID to Cortex A */
+       mmio_write_32(CAAM_JR0MID, CAAM_NS_MID);
+       mmio_write_32(CAAM_JR1MID, CAAM_NS_MID);
+       mmio_write_32(CAAM_JR2MID, CAAM_NS_MID);
+
 #if DEBUG_CONSOLE
        static console_uart_t console;
 
index 4957582ad981b739ba0f9492aee7dbe19a2249b3..5c5b0a5f9fe30da8547394140e7170d6786893d4 100644 (file)
 #define DEBUG_CONSOLE                  0
 #define IMX_WDOG_B_RESET
 #define PLAT_IMX8M                     1
+
+#define CAAM_JR0MID                    U(0x30900010)
+#define CAAM_JR1MID                    U(0x30900018)
+#define CAAM_JR2MID                    U(0x30900020)
+#define CAAM_NS_MID                    U(0x1)
index aa68906dac9def9e8b3fd2607ea782273590ae5c..71e862fa51e4b7a37b5cd3e0c3866e0285288ccd 100644 (file)
 #include "aarch64/stratix10_private.h"
 
 const mmap_region_t plat_stratix10_mmap[] = {
-       MAP_REGION_FLAT(DRAM_BASE, DRAM_SIZE, MT_MEMORY | MT_RW | MT_NS),
-       MAP_REGION_FLAT(DEVICE1_BASE, DEVICE1_SIZE, MT_DEVICE | MT_RW | MT_NS),
-       MAP_REGION_FLAT(DEVICE2_BASE, DEVICE2_SIZE, MT_DEVICE | MT_RW | MT_NS),
+       MAP_REGION_FLAT(DRAM_BASE, DRAM_SIZE,
+               MT_MEMORY | MT_RW | MT_NS),
+       MAP_REGION_FLAT(DEVICE1_BASE, DEVICE1_SIZE,
+               MT_DEVICE | MT_RW | MT_NS),
+       MAP_REGION_FLAT(DEVICE2_BASE, DEVICE2_SIZE,
+               MT_DEVICE | MT_RW | MT_SECURE),
        MAP_REGION_FLAT(OCRAM_BASE, OCRAM_SIZE,
                MT_NON_CACHEABLE | MT_RW | MT_SECURE),
        MAP_REGION_FLAT(DEVICE3_BASE, DEVICE3_SIZE,
                MT_DEVICE | MT_RW | MT_SECURE),
-       MAP_REGION_FLAT(MEM64_BASE, MEM64_SIZE, MT_DEVICE | MT_RW | MT_NS),
-       MAP_REGION_FLAT(DEVICE4_BASE, DEVICE4_SIZE, MT_DEVICE | MT_RW | MT_NS),
+       MAP_REGION_FLAT(MEM64_BASE, MEM64_SIZE,
+               MT_DEVICE | MT_RW | MT_NS),
+       MAP_REGION_FLAT(DEVICE4_BASE, DEVICE4_SIZE,
+               MT_DEVICE | MT_RW | MT_NS),
        {0},
 };
 
index 851fc59a2eeb66b89d8837bd535eba086e7893ca..ed06f5498f0218506dbb3ae4c6a57fdc0199b3f7 100644 (file)
@@ -8,6 +8,7 @@
 #include <arch_helpers.h>
 #include <errno.h>
 #include <lib/mmio.h>
+#include <lib/utils.h>
 #include <common/debug.h>
 #include <drivers/delay_timer.h>
 #include <platform_def.h>
@@ -403,7 +404,7 @@ void configure_hmc_adaptor_regs(void)
                INFO("Scrubbing ECC\n");
 
                /* ECC Scrubbing */
-               memset(DRAM_BASE, 0, DRAM_SIZE);
+               zeromem(DRAM_BASE, DRAM_SIZE);
        } else {
                INFO("ECC is disabled.\n");
        }
index d9eec4d37c0701510fd4d87be10710a062584142..2a2f2782dccdc094b36151851b12ce042329fc6a 100644 (file)
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2015-2018, ARM Limited and Contributors. All rights reserved.
+# Copyright (c) 2015-2019, ARM Limited and Contributors. All rights reserved.
 #
 # SPDX-License-Identifier: BSD-3-Clause
 #
@@ -22,6 +22,7 @@ TEGRA_GICv2_SOURCES   :=      drivers/arm/gic/common/gic_common.c             \
 
 BL31_SOURCES           +=      drivers/console/aarch64/console.S               \
                                drivers/delay_timer/delay_timer.c               \
+                               drivers/io/io_storage.c                         \
                                ${TEGRA_GICv2_SOURCES}                          \
                                ${COMMON_DIR}/aarch64/tegra_helpers.S           \
                                ${COMMON_DIR}/drivers/pmc/pmc.c                 \
@@ -29,6 +30,7 @@ BL31_SOURCES          +=      drivers/console/aarch64/console.S               \
                                ${COMMON_DIR}/tegra_bl31_setup.c                \
                                ${COMMON_DIR}/tegra_delay_timer.c               \
                                ${COMMON_DIR}/tegra_fiq_glue.c                  \
+                               ${COMMON_DIR}/tegra_io_storage.c                \
                                ${COMMON_DIR}/tegra_platform.c                  \
                                ${COMMON_DIR}/tegra_pm.c                        \
                                ${COMMON_DIR}/tegra_sip_calls.c                 \
diff --git a/plat/nvidia/tegra/common/tegra_io_storage.c b/plat/nvidia/tegra/common/tegra_io_storage.c
new file mode 100644 (file)
index 0000000..21641aa
--- /dev/null
@@ -0,0 +1,20 @@
+/*
+ * Copyright (c) 2019, NVIDIA Corporation. All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+#include <errno.h>
+#include <plat/common/platform.h>
+
+/*
+ * Return an IO device handle and specification which can be used to access
+ * an image. Use this to enforce platform load policy.
+ *
+ * This function is not supported at this time
+ */
+int plat_get_image_source(unsigned int image_id, uintptr_t *dev_handle,
+                         uintptr_t *image_spec)
+{
+       return -ENOTSUP;
+}
index f68b8989b4950c0055e5b157e50c66d0c4b0e0fa..eb55def4a509110ba57c69e42150ab97d790a942 100644 (file)
 #define CACHE_WRITEBACK_SHIFT          6
 #define CACHE_WRITEBACK_GRANULE                (0x40) /* (U(1) << CACHE_WRITEBACK_SHIFT) */
 
+/*******************************************************************************
+ * Dummy macros to compile io_storage support
+ ******************************************************************************/
+#define MAX_IO_DEVICES                 U(0)
+#define MAX_IO_HANDLES                 U(0)
+
 #endif /* PLATFORM_DEF_H */
index 6ef1900c69210969b26ae136c01093311bea1d39..0917d87012678b489974821f64582a603bb5cdb3 100644 (file)
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2015-2018, ARM Limited and Contributors. All rights reserved.
+# Copyright (c) 2015-2019, ARM Limited and Contributors. All rights reserved.
 #
 # SPDX-License-Identifier: BSD-3-Clause
 #
@@ -59,3 +59,17 @@ override LIBC_SRCS :=        $(addprefix lib/libc/,          \
 
 INCLUDES       +=      -Iinclude/lib/libc              \
                        -Iinclude/lib/libc/$(ARCH)      \
+
+ifneq ($(findstring armlink,$(notdir $(LD))),)
+# o suppress warnings for section mismatches, undefined symbols
+# o use only those libraries that are specified in the input file
+#   list to resolve references
+# o create a static callgraph of functions
+# o resolve undefined symbols to el3_panic
+# o include only required sections
+TF_LDFLAGS     += --diag_suppress=L6314,L6332 --no_scanlib --callgraph
+TF_LDFLAGS     += --keep="*(__pubsub*)" --keep="*(rt_svc_descs*)" --keep="*(*cpu_ops)"
+ifeq (${ENABLE_PMF},1)
+TF_LDFLAGS     += --keep="*(*pmf_svc_descs*)"
+endif
+endif
diff --git a/plat/nvidia/tegra/scat/bl31.scat b/plat/nvidia/tegra/scat/bl31.scat
new file mode 100644 (file)
index 0000000..2f5fd9e
--- /dev/null
@@ -0,0 +1,284 @@
+#! armclang -E -x c
+
+/*
+ * Copyright (c) 2019, ARM Limited and Contributors. All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+#include <platform_def.h>
+
+#define PAGE_SIZE      (1024 * 4)
+
+LR_START BL31_BASE
+{
+       __BL31_START__ +0 FIXED EMPTY 0
+       {
+               /* placeholder */
+       }
+
+       /* BL31_BASE address must be aligned on a page boundary. */
+       ScatterAssert((ImageBase(__BL31_START__) AND 0xFFF) == 0)
+}
+
+LR_TEXT BL31_BASE
+{
+       __TEXT__ +0 FIXED
+       {
+               *(:gdef:bl31_entrypoint, +FIRST)
+               *(.text*)
+               *(.vectors)
+               .ANY1(+RO-CODE)
+       }
+
+       __TEXT_EPILOGUE__ AlignExpr(+0, PAGE_SIZE) FIXED EMPTY 0
+       {
+               /* section delimiter */
+       }
+}
+
+LR_RO_DATA +0
+{
+       __RODATA__ AlignExpr(ImageLimit(LR_TEXT), 0) FIXED
+       {
+               *(.rodata*)
+               .ANY2(+RO-DATA)
+       }
+
+       /* Ensure 8-byte alignment for descriptors and ensure inclusion */
+       __RT_SVC_DESCS__ AlignExpr(ImageLimit(__RODATA__), 8) FIXED
+       {
+               *(rt_svc_descs)
+       }
+
+#if ENABLE_PMF
+       /* Ensure 8-byte alignment for descriptors and ensure inclusion */
+       __PMF_SVC_DESCS__ AlignExpr(ImageLimit(__RT_SVC_DESCS__), 8) FIXED
+       {
+               *(pmf_svc_descs)
+       }
+#endif /* ENABLE_PMF */
+
+       /*
+        * Ensure 8-byte alignment for cpu_ops so that its fields are also
+        * aligned.
+        */
+       __CPU_OPS__ AlignExpr(+0, 8) FIXED
+       {
+               *(cpu_ops)
+       }
+
+       /*
+        * Keep the .got section in the RO section as it is patched
+        * prior to enabling the MMU and having the .got in RO is better for
+        * security. GOT is a table of addresses so ensure 8-byte alignment.
+        */
+       __GOT__ AlignExpr(ImageLimit(__CPU_OPS__), 8) FIXED
+       {
+               *(.got)
+       }
+
+       /* Place pubsub sections for events */
+       __PUBSUB_EVENTS__ AlignExpr(+0, 8) EMPTY 0
+       {
+               /* placeholder */
+       }
+
+#include <lib/el3_runtime/pubsub_events.h>
+
+       __RODATA_EPILOGUE__ AlignExpr(+0, PAGE_SIZE) FIXED EMPTY 0
+       {
+               /* section delimiter */
+       }
+}
+
+       /* cpu_ops must always be defined */
+       ScatterAssert(ImageLength(__CPU_OPS__) > 0)
+
+#if ENABLE_SPM
+LR_SPM +0
+{
+       /*
+        * Exception vectors of the SPM shim layer. They must be aligned to a 2K
+        * address, but we need to place them in a separate page so that we can set
+        * individual permissions to them, so the actual alignment needed is 4K.
+        *
+        * There's no need to include this into the RO section of BL31 because it
+        * doesn't need to be accessed by BL31.
+        */
+       __SPM_SHIM_EXCEPTIONS__ AlignExpr(ImageLimit(LR_RO_DATA), PAGE_SIZE) FIXED
+       {
+               *(.spm_shim_exceptions)
+       }
+
+       __SPM_SHIM_EXCEPTIONS_EPILOGUE__ AlignExpr(ImageLimit(__SPM_SHIM_EXCEPTIONS__), PAGE_SIZE) FIXED
+       {
+               /* placeholder */
+       }
+}
+#endif
+
+LR_RW_DATA +0
+{
+       __DATA__ AlignExpr(+0, 16) FIXED
+       {
+               *(.data*)
+               *(.constdata)
+               *(locale$$data)
+       }
+}
+
+LR_RELA +0
+{
+       /*
+        * .rela.dyn needs to come after .data for the read-elf utility to parse
+        * this section correctly. Ensure 8-byte alignment so that the fields of
+        * RELA data structure are aligned.
+        */
+       __RELA__ AlignExpr(ImageLimit(LR_RW_DATA), 8) FIXED
+       {
+               *(.rela.dyn)
+       }
+}
+
+#ifdef BL31_PROGBITS_LIMIT
+       /* BL31 progbits has exceeded its limit. */
+       ScatterAssert(ImageLimit(LR_RELA) <= BL31_PROGBITS_LIMIT)
+#endif
+
+LR_STACKS +0
+{
+       __STACKS__ AlignExpr(+0, 64) FIXED
+       {
+               *(tzfw_normal_stacks)
+       }
+}
+
+#define __BAKERY_LOCK_SIZE__           (ImageLimit(__BAKERY_LOCKS_EPILOGUE__) - \
+                                        ImageBase(__BAKERY_LOCKS__))
+#define BAKERY_LOCK_SIZE               (__BAKERY_LOCK_SIZE__ * (PLATFORM_CORE_COUNT - 1))
+#define __PMF_TIMESTAMP_SIZE__         (ImageLimit(__PMF_TIMESTAMP__) - \
+                                        ImageBase(__PMF_TIMESTAMP__))
+#define PER_CPU_TIMESTAMP_SIZE         (__PMF_TIMESTAMP_SIZE__ * (PLATFORM_CORE_COUNT - 1))
+
+LR_BSS +0
+{
+       __BSS__ AlignExpr(ImageLimit(LR_STACKS), 256) FIXED
+       {
+               *(.bss*)
+               *(COMDAT)
+       }
+
+#if !USE_COHERENT_MEM
+       /*
+        * Bakery locks are stored in normal .bss memory
+        *
+        * Each lock's data is spread across multiple cache lines, one per CPU,
+        * but multiple locks can share the same cache line.
+        * The compiler will allocate enough memory for one CPU's bakery locks,
+        * the remaining cache lines are allocated by the linker script
+        */
+       __BAKERY_LOCKS__ AlignExpr(ImageLimit(__BSS__), CACHE_WRITEBACK_GRANULE) FIXED
+       {
+               *(bakery_lock)
+       }
+
+       __BAKERY_LOCKS_EPILOGUE__ AlignExpr(ImageLimit(__BAKERY_LOCKS__), CACHE_WRITEBACK_GRANULE) FIXED EMPTY 0
+       {
+               /* section delimiter */
+       }
+
+       __PER_CPU_BAKERY_LOCKS__ ImageLimit(__BAKERY_LOCKS_EPILOGUE__) FIXED FILL 0 BAKERY_LOCK_SIZE
+       {
+               /* padded memory section to store per cpu bakery locks */
+       }
+
+#ifdef PLAT_PERCPU_BAKERY_LOCK_SIZE
+       /* PLAT_PERCPU_BAKERY_LOCK_SIZE does not match bakery lock requirements */
+       ScatterAssert(__PER_CPU_BAKERY_LOCK_SIZE__ == PLAT_PERCPU_BAKERY_LOCK_SIZE)
+#endif
+#endif
+
+#if ENABLE_PMF
+       /*
+        * Time-stamps are stored in normal .bss memory
+        *
+        * The compiler will allocate enough memory for one CPU's time-stamps,
+        * the remaining memory for other CPU's is allocated by the
+        * linker script
+        */
+       __PMF_TIMESTAMP__ AlignExpr(+0, CACHE_WRITEBACK_GRANULE) FIXED EMPTY CACHE_WRITEBACK_GRANULE
+       {
+               /* store timestamps in this carved out memory */
+       }
+
+       __PMF_TIMESTAMP_EPILOGUE__ AlignExpr(ImageLimit(__PMF_TIMESTAMP__), CACHE_WRITEBACK_GRANULE) FIXED EMPTY 0
+       {
+               /*
+                * placeholder to make __PMF_TIMESTAMP_START__ end on a
+                * CACHE_WRITEBACK_GRANULE boundary
+                */
+       }
+
+       __PER_CPU_TIMESTAMPS__ +0 FIXED FILL 0 PER_CPU_TIMESTAMP_SIZE
+       {
+               /* padded memory section to store per cpu timestamps */
+       }
+#endif /* ENABLE_PMF */
+}
+
+LR_XLAT_TABLE +0
+{
+       xlat_table +0 FIXED
+       {
+               *(xlat_table)
+       }
+}
+
+#if USE_COHERENT_MEM
+LR_COHERENT_RAM +0
+{
+       /*
+        * The base address of the coherent memory section must be page-aligned (4K)
+        * to guarantee that the coherent data are stored on their own pages and
+        * are not mixed with normal data.  This is required to set up the correct
+        * memory attributes for the coherent data page tables.
+        */
+       __COHERENT_RAM__ AlignExpr(+0, PAGE_SIZE) FIXED
+       {
+               /*
+                * Bakery locks are stored in coherent memory
+                *
+                * Each lock's data is contiguous and fully allocated by the compiler
+                */
+               *(bakery_lock)
+               *(tzfw_coherent_mem)
+       }
+
+       __COHERENT_RAM_EPILOGUE_UNALIGNED__ +0 FIXED EMPTY 0
+       {
+               /* section delimiter */
+       }
+
+       /*
+        * Memory page(s) mapped to this section will be marked
+        * as device memory.  No other unexpected data must creep in.
+        * Ensure the rest of the current memory page is unused.
+        */
+       __COHERENT_RAM_EPILOGUE__ AlignExpr(ImageLimit(__COHERENT_RAM_START__), PAGE_SIZE) FIXED EMPTY 0
+       {
+               /* section delimiter */
+       }
+}
+#endif
+
+LR_END +0
+{
+       __BL31_END__ +0 FIXED EMPTY 0
+       {
+               /* placeholder */
+       }
+
+       /* BL31 image has exceeded its limit. */
+       ScatterAssert(ImageLimit(__BL31_END__) <= BL31_LIMIT)
+}
index 2debbf94e7a99c220d49822ff6c1dd3af8c1671b..350df127acb5b600d3c2680d1f2bad7956bf0d58 100644 (file)
@@ -236,7 +236,7 @@ void bl2_plat_flush_bl31_params(void)
        product = reg & RCAR_PRODUCT_MASK;
        cut = reg & RCAR_CUT_MASK;
 
-       if (product == RCAR_PRODUCT_M3)
+       if (product == RCAR_PRODUCT_M3 && RCAR_CUT_VER30 > cut)
                goto tlb;
 
        if (product == RCAR_PRODUCT_H3 && RCAR_CUT_VER20 > cut)
@@ -693,8 +693,17 @@ void bl2_el3_early_platform_setup(u_register_t arg1, u_register_t arg2,
                break;
        }
 
-       if (RCAR_PRODUCT_M3_CUT11 == product_cut) {
-               NOTICE("BL2: PRR is R-Car %s Ver.1.1 / Ver.1.2\n", str);
+       if ((RCAR_PRODUCT_M3 == product) &&
+           (RCAR_CUT_VER20 == (reg & RCAR_MAJOR_MASK))) {
+               if (RCAR_M3_CUT_VER11 == (reg & RCAR_CUT_MASK)) {
+                       /* M3 Ver.1.1 or Ver.1.2 */
+                       NOTICE("BL2: PRR is R-Car %s Ver.1.1 / Ver.1.2\n",
+                               str);
+               } else {
+                       NOTICE("BL2: PRR is R-Car %s Ver.1.%d\n",
+                               str,
+                               (reg & RCAR_MINOR_MASK) + RCAR_M3_MINOR_OFFSET);
+               }
        } else {
                major = (reg & RCAR_MAJOR_MASK) >> RCAR_MAJOR_SHIFT;
                major = major + RCAR_MAJOR_OFFSET;
index 3bb03f2e5cb3cf14596e8c4575c7a25921913070..6bbd6fa7bb876da86863c9497c29abb31587ea78 100644 (file)
 #define RCAR_PRODUCT_M3N               U(0x00005500)
 #define RCAR_PRODUCT_E3                        U(0x00005700)
 #define RCAR_CUT_VER10                 U(0x00000000)
-#define RCAR_CUT_VER11                 U(0x00000001)   /* H3/M3N Ver.1.1 */
+#define RCAR_CUT_VER11                 U(0x00000001)   /* H3/M3N/E3 Ver.1.1 */
 #define RCAR_M3_CUT_VER11              U(0x00000010)   /* M3 Ver.1.1/Ver.1.2 */
 #define RCAR_CUT_VER20                 U(0x00000010)
 #define RCAR_CUT_VER30                 U(0x00000020)
 #define RCAR_MAJOR_SHIFT               U(4)
 #define RCAR_MINOR_SHIFT               U(0)
 #define RCAR_MAJOR_OFFSET              U(1)
+#define RCAR_M3_MINOR_OFFSET           U(2)
 #define RCAR_PRODUCT_H3_CUT10          (RCAR_PRODUCT_H3 | U(0x00))     /* 1.0 */
 #define RCAR_PRODUCT_H3_CUT11          (RCAR_PRODUCT_H3 | U(0x01))     /* 1.1 */
 #define RCAR_PRODUCT_H3_CUT20          (RCAR_PRODUCT_H3 | U(0x10))     /* 2.0 */
index 5c8805c2e98a6b9cd58560760ba8d1c25fae2d8f..e4363240760f2d77c49b3f0d84940d605e876d42 100644 (file)
@@ -9,7 +9,7 @@
 
 #include <arch_helpers.h>
 
-#define VERSION_OF_RENESAS             "2.0.0"
+#define VERSION_OF_RENESAS             "2.0.1"
 #define        VERSION_OF_RENESAS_MAXLEN       (128)
 
 extern const uint8_t version_of_renesas[VERSION_OF_RENESAS_MAXLEN];
index a54a60a37133425f436def4dc8c5ee021facddd0..715b8ae170c7b847dacf79739d2795309b11235a 100644 (file)
@@ -13,6 +13,9 @@ GENERATE_COT                  := 1
 BL2_AT_EL3                     := 1
 ENABLE_SVE_FOR_NS              := 0
 
+CRASH_REPORTING                        := 1
+HANDLE_EA_EL3_FIRST            := 1
+
 $(eval $(call add_define,PLAT_EXTRA_LD_SCRIPT))
 
 ifeq (${SPD},none)
@@ -35,10 +38,12 @@ $(eval $(call add_define,RCAR_H3N))
 $(eval $(call add_define,RCAR_AUTO))
 RCAR_CUT_10:=0
 RCAR_CUT_11:=1
+RCAR_CUT_13:=3
 RCAR_CUT_20:=10
 RCAR_CUT_30:=20
 $(eval $(call add_define,RCAR_CUT_10))
 $(eval $(call add_define,RCAR_CUT_11))
+$(eval $(call add_define,RCAR_CUT_13))
 $(eval $(call add_define,RCAR_CUT_20))
 $(eval $(call add_define,RCAR_CUT_30))
 
@@ -95,6 +100,10 @@ else
         RCAR_LSI_CUT:=0
       else ifeq (${LSI_CUT},11)
         RCAR_LSI_CUT:=1
+      else ifeq (${LSI_CUT},13)
+        RCAR_LSI_CUT:=3
+      else ifeq (${LSI_CUT},30)
+        RCAR_LSI_CUT:=20
       else
         $(error "Error: ${LSI_CUT} is not supported.")
       endif
@@ -127,6 +136,8 @@ else
       # disable compatible function.
       ifeq (${LSI_CUT},10)
         RCAR_LSI_CUT:=0
+      else ifeq (${LSI_CUT},11)
+        RCAR_LSI_CUT:=1
       else
         $(error "Error: ${LSI_CUT} is not supported.")
       endif
@@ -322,8 +333,8 @@ PLAT_INCLUDES       :=      -Idrivers/staging/renesas/rcar/ddr      \
                        -Iplat/renesas/rcar/include             \
                        -Iplat/renesas/rcar
 
-PLAT_BL_COMMON_SOURCES :=      drivers/renesas/rcar/iic_dvfs/iic_dvfs.c
-
+PLAT_BL_COMMON_SOURCES :=      drivers/renesas/rcar/iic_dvfs/iic_dvfs.c \
+                               plat/renesas/rcar/rcar_common.c
 
 RCAR_GIC_SOURCES       :=      drivers/arm/gic/common/gic_common.c     \
                                drivers/arm/gic/v2/gicv2_main.c         \
diff --git a/plat/renesas/rcar/rcar_common.c b/plat/renesas/rcar/rcar_common.c
new file mode 100644 (file)
index 0000000..b83df8b
--- /dev/null
@@ -0,0 +1,69 @@
+/*
+ * Copyright (c) 2019, Renesas Electronics Corporation. All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+#include <assert.h>
+
+#include <arch_helpers.h>
+#include <drivers/console.h>
+#include <lib/xlat_tables/xlat_mmu_helpers.h>
+#include <plat/common/platform.h>
+
+#include <lib/mmio.h>
+
+#define CPG_BASE               0xE6150000
+#define CPG_MSTPSR3            0x0048
+#define MSTP318                        (1 << 18)
+#define MSTP319                        (1 << 19)
+#define PMSR                   0x5c
+#define PMSR_L1FAEG            (1 << 31)
+#define PMSR_PMEL1RX           (1 << 23)
+#define PMCTLR                 0x60
+#define PMSR_L1IATN            (1 << 31)
+
+static int rcar_pcie_fixup(unsigned int controller)
+{
+       uint32_t rcar_pcie_base[] = { 0xfe011000, 0xee811000 };
+       uint32_t addr = rcar_pcie_base[controller];
+       uint32_t cpg, pmsr;
+       int ret = 0;
+
+       /* Test if PCIECx is enabled */
+       cpg = mmio_read_32(CPG_BASE + CPG_MSTPSR3);
+       if (cpg & (MSTP318 << !controller))
+               return ret;
+
+       pmsr = mmio_read_32(addr + PMSR);
+
+       if ((pmsr & PMSR_PMEL1RX) && ((pmsr & 0x70000) != 0x30000)) {
+               /* Fix applicable */
+               mmio_write_32(addr + PMCTLR, PMSR_L1IATN);
+               while (!(mmio_read_32(addr + PMSR) & PMSR_L1FAEG))
+                       ;
+               mmio_write_32(addr + PMSR, PMSR_L1FAEG | PMSR_PMEL1RX);
+               ret = 1;
+       }
+
+       return ret;
+}
+
+/* RAS functions common to AArch64 ARM platforms */
+void plat_ea_handler(unsigned int ea_reason, uint64_t syndrome, void *cookie,
+               void *handle, uint64_t flags)
+{
+       unsigned int fixed = 0;
+
+       fixed |= rcar_pcie_fixup(0);
+       fixed |= rcar_pcie_fixup(1);
+
+       if (fixed)
+               return;
+
+       ERROR("Unhandled External Abort received on 0x%lx at EL3!\n",
+                       read_mpidr_el1());
+       ERROR(" exception reason=%u syndrome=0x%llx\n", ea_reason, syndrome);
+
+       panic();
+}
index 3d1f8f9185c787bc34bce41a8bde4d83f3b59fdd..b5e58352aba665b3d7097bc0f34764b624f37606 100644 (file)
@@ -44,8 +44,8 @@ static void rpi3_sdhost_setup(void)
 
        memset(&params, 0, sizeof(struct rpi3_sdhost_params));
        params.reg_base = RPI3_SDHOST_BASE;
-       params.bus_width = MMC_BUS_WIDTH_4;
-       params.clk_rate = 392464;
+       params.bus_width = MMC_BUS_WIDTH_1;
+       params.clk_rate = 50000000;
        mmc_info.mmc_dev_type = MMC_IS_SD_HC;
        rpi3_sdhost_init(&params, &mmc_info);
 }
index c8bb559f4f851769329c0e40f8047afbe5b28133..f1721602dfb2329a71cec2e81ce6fbd610d29daa 100644 (file)
@@ -194,7 +194,8 @@ void stm32mp_io_setup(void)
        case BOOT_API_CTX_BOOT_INTERFACE_SEL_FLASH_EMMC:
                dmbsy();
 
-               memset(&params, 0, sizeof(struct stm32_sdmmc2_params));
+               zeromem(&device_info, sizeof(struct mmc_device_info));
+               zeromem(&params, sizeof(struct stm32_sdmmc2_params));
 
                if (boot_context->boot_interface_selected ==
                    BOOT_API_CTX_BOOT_INTERFACE_SEL_FLASH_EMMC) {
index c7bc39f4e2d05e9c2f1bb80ccf8e0c7d72c4e335..2477954b0fb7e324fd788a0c5be90f96240cb916 100644 (file)
@@ -202,6 +202,9 @@ void bl2_el3_plat_arch_setup(void)
                mmio_clrbits_32(rcc_base + RCC_BDCR, RCC_BDCR_VSWRST);
        }
 
+       /* Disable MCKPROT */
+       mmio_clrbits_32(rcc_base + RCC_TZCR, RCC_TZCR_MCKPROT);
+
        generic_delay_timer_init();
 
        if (stm32mp1_clk_probe() < 0) {
index f0dc575e222d0c652bdd470e170f11b497b932fd..1c897bdf4d0bd22fa3afd6ee61f5acf7afb528db 100644 (file)
@@ -183,6 +183,7 @@ enum ddr_type {
 #define STM32MP1_TZC_BASE              U(0x5C006000)
 
 #define STM32MP1_TZC_A7_ID             U(0)
+#define STM32MP1_TZC_M4_ID             U(1)
 #define STM32MP1_TZC_LCD_ID            U(3)
 #define STM32MP1_TZC_GPU_ID            U(4)
 #define STM32MP1_TZC_MDMA_ID           U(5)
index ebf1587a61e60d7b6e61b925de401a94947748d4..0ad43e43536bd87239c1a024c434a43639062c0a 100644 (file)
@@ -41,6 +41,7 @@ static void init_tzc400(void)
                        TZC_REGION_ACCESS_RDWR(STM32MP1_TZC_GPU_ID) |
                        TZC_REGION_ACCESS_RDWR(STM32MP1_TZC_LCD_ID) |
                        TZC_REGION_ACCESS_RDWR(STM32MP1_TZC_MDMA_ID) |
+                       TZC_REGION_ACCESS_RDWR(STM32MP1_TZC_M4_ID) |
                        TZC_REGION_ACCESS_RDWR(STM32MP1_TZC_DMA_ID) |
                        TZC_REGION_ACCESS_RDWR(STM32MP1_TZC_USB_HOST_ID) |
                        TZC_REGION_ACCESS_RDWR(STM32MP1_TZC_USB_OTG_ID) |
index 5404e741bb4f2368e9e7ab24ad30ed494047b243..cb8f800665b982a2315a41873ae820e7039afbed 100644 (file)
@@ -194,8 +194,8 @@ This release also contains the following platform support:
 
 -  Allwinner sun50i_64 and sun50i_h6
 -  Amlogic Meson S905 (GXBB)
--  Arm SGI-575, SGI Clark.A, SGI Clark.H and SGM-775
--  Arm NeoVerse N1 System Development Platform
+-  Arm SGI-575, RDN1Edge, RDE1Edge and SGM-775
+-  Arm Neoverse N1 System Development Platform
 -  HiKey, HiKey960 and Poplar boards
 -  Marvell Armada 3700 and 8K
 -  MediaTek MT6795 and MT8173 SoCs
@@ -260,6 +260,19 @@ vulnerability, please report this using the process defined in the TF-A
 
 Arm licensees may contact Arm directly via their partner managers.
 
+Security advisories
+~~~~~~~~~~~~~~~~~~~
+
+`Security Advisory TFV-1`_
+`Security Advisory TFV-2`_
+`Security Advisory TFV-3`_
+`Security Advisory TFV-4`_
+`Security Advisory TFV-5`_
+`Security Advisory TFV-6`_
+`Security Advisory TFV-7`_
+`Security Advisory TFV-8`_
+
+
 --------------
 
 *Copyright (c) 2013-2019, Arm Limited and Contributors. All rights reserved.*
@@ -282,7 +295,7 @@ Arm licensees may contact Arm directly via their partner managers.
 .. _Trusty Secure OS: https://source.android.com/security/trusty
 .. _GitHub: https://www.github.com/ARM-software/arm-trusted-firmware
 .. _GitHub issue tracker: https://github.com/ARM-software/tf-issues/issues
-.. _Security Centre: https://github.com/ARM-software/arm-trusted-firmware/wiki/ARM-Trusted-Firmware-Security-Centre
+.. _Security Center: ./docs/security-center.rst
 .. _license: ./license.rst
 .. _Contributing Guidelines: ./contributing.rst
 .. _Acknowledgments: ./acknowledgements.rst
@@ -292,3 +305,11 @@ Arm licensees may contact Arm directly via their partner managers.
 .. _Porting Guide: ./docs/porting-guide.rst
 .. _FreeBSD: http://www.freebsd.org
 .. _SCC: http://www.simple-cc.org/
+.. _Security Advisory TFV-1: ./docs/security_advisories/security-advisory-tfv-1.rst
+.. _Security Advisory TFV-2: ./docs/security_advisories/security-advisory-tfv-2.rst
+.. _Security Advisory TFV-3: ./docs/security_advisories/security-advisory-tfv-3.rst
+.. _Security Advisory TFV-4: ./docs/security_advisories/security-advisory-tfv-4.rst
+.. _Security Advisory TFV-5: ./docs/security_advisories/security-advisory-tfv-5.rst
+.. _Security Advisory TFV-6: ./docs/security_advisories/security-advisory-tfv-6.rst
+.. _Security Advisory TFV-7: ./docs/security_advisories/security-advisory-tfv-7.rst
+.. _Security Advisory TFV-8: ./docs/security_advisories/security-advisory-tfv-8.rst
index dfbe02cd3c8b21811ffd80bfb39c2f7f6da9cc2c..1fc7827b4d8d07bf7cc1348be7e1179a09b96e98 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018, ARM Limited and Contributors. All rights reserved.
+ * Copyright (c) 2018-2019, ARM Limited and Contributors. All rights reserved.
  *
  * SPDX-License-Identifier: BSD-3-Clause
  */
@@ -41,7 +41,7 @@ static int32_t smccc_arch_features(u_register_t arg)
                 * PE implements architectural Speculation Store Bypass Safe
                 * (SSBS) feature.
                 */
-               ssbs = (read_id_aa64pfr0_el1() >> ID_AA64PFR1_EL1_SSBS_SHIFT) &
+               ssbs = (read_id_aa64pfr1_el1() >> ID_AA64PFR1_EL1_SSBS_SHIFT) &
                        ID_AA64PFR1_EL1_SSBS_MASK;
 
                /*
index 771e2cfb60b3279cec5926f79abe6a799f6eed13..dfc3e71b75874dd8855f064c342ec710b96e98f0 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016-2018, ARM Limited and Contributors. All rights reserved.
+ * Copyright (c) 2016-2019, ARM Limited and Contributors. All rights reserved.
  *
  * SPDX-License-Identifier: BSD-3-Clause
  */
@@ -8,6 +8,7 @@
 
 #include <common/debug.h>
 #include <common/runtime_svc.h>
+#include <platform_def.h>
 
 #include "generic-arm64-smcall.h"