Merge "Introduce BTI support in ROMLIB" into integration
authorJohn Tsichritzis <john.tsichritzis@arm.com>
Thu, 6 Jun 2019 10:26:10 +0000 (10:26 +0000)
committerTrustedFirmware Code Review <review@review.trustedfirmware.org>
Thu, 6 Jun 2019 10:26:10 +0000 (10:26 +0000)
69 files changed:
Makefile
bl1/bl1.mk
bl2/aarch64/bl2_el3_entrypoint.S
bl2/aarch64/bl2_entrypoint.S
bl2/bl2.mk
bl31/aarch64/bl31_entrypoint.S
bl31/bl31.mk
bl32/tsp/aarch64/tsp_entrypoint.S
bl32/tsp/tsp.mk
docs/change-log.rst
docs/components/arm-sip-service.rst
docs/components/exception-handling.rst
docs/components/firmware-update.rst
docs/components/sdei.rst
docs/conf.py
docs/contents.rst [new file with mode: 0644]
docs/design/cpu-specific-build-macros.rst
docs/design/firmware-design.rst
docs/design/trusted-board-boot.rst
docs/getting_started/porting-guide.rst
docs/getting_started/psci-lib-integration-guide.rst
docs/getting_started/rt-svc-writers-guide.rst
docs/getting_started/user-guide.rst
docs/index.rst
docs/process/contributing.rst
docs/process/security.rst
docs/requirements.txt [new file with mode: 0644]
docs/security_advisories/security-advisory-tfv-6.rst
drivers/arm/gic/v3/gicv3_main.c
include/arch/aarch64/arch.h
include/arch/aarch64/arch_features.h
include/arch/aarch64/asm_macros.S
include/common/asm_macros_common.S
include/lib/cpus/aarch64/cortex_a55.h
include/lib/xlat_tables/xlat_tables_defs.h
lib/aarch64/cache_helpers.S
lib/cpus/aarch64/cortex_a55.S
lib/cpus/aarch64/cortex_a76.S
lib/cpus/aarch64/cortex_a76ae.S
lib/cpus/aarch64/cortex_deimos.S
lib/cpus/aarch64/cpuamu_helpers.S
lib/cpus/aarch64/neoverse_e1.S
lib/cpus/aarch64/neoverse_n1.S
lib/cpus/aarch64/neoverse_zeus.S
lib/cpus/cpu-ops.mk
lib/extensions/amu/aarch64/amu_helpers.S
lib/xlat_tables_v2/xlat_tables_core.c
lib/xlat_tables_v2/xlat_tables_utils.c
make_helpers/defaults.mk
plat/arm/board/fvp/platform.mk
plat/imx/imx8m/imx8mm/imx8mm_bl31_setup.c
plat/imx/imx8m/imx8mm/platform.mk
plat/imx/imx8m/imx8mq/imx8mq_bl31_setup.c
plat/imx/imx8m/imx8mq/platform.mk
plat/imx/imx8m/imx_aipstz.c [new file with mode: 0644]
plat/imx/imx8m/include/imx_aipstz.h [new file with mode: 0644]
plat/mediatek/mt8183/aarch64/platform_common.c
plat/mediatek/mt8183/bl31_plat_setup.c
plat/mediatek/mt8183/drivers/mcsi/mcsi.c [new file with mode: 0644]
plat/mediatek/mt8183/drivers/mcsi/mcsi.h [new file with mode: 0644]
plat/mediatek/mt8183/include/mt_gic_v3.h [new file with mode: 0644]
plat/mediatek/mt8183/include/plat_private.h
plat/mediatek/mt8183/plat_mt_gic.c [new file with mode: 0644]
plat/mediatek/mt8183/platform.mk
plat/meson/gxl/gxl_bl31_setup.c
plat/rockchip/common/bl31_plat_setup.c
plat/ti/k3/common/k3_helpers.S
plat/ti/k3/common/plat_common.mk
readme.rst

index 30b591c2f07fa8e4896e0bf61a7a7a109b686537..d2e7b5829e8d8475e6881181bf0e0fc958ead5f9 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -117,6 +117,29 @@ ifneq (${GENERATE_COT},0)
         FWU_FIP_DEPS += fwu_certificates
 endif
 
+# Process BRANCH_PROTECTION value and set
+# Pointer Authentication and Branch Target Identification flags
+ifeq (${BRANCH_PROTECTION},0)
+       # Default value turns off all types of branch protection
+       BP_OPTION := none
+else ifneq (${ARCH},aarch64)
+        $(error BRANCH_PROTECTION requires AArch64)
+else ifeq (${BRANCH_PROTECTION},1)
+       # Enables all types of branch protection features
+       BP_OPTION := standard
+       ENABLE_BTI := 1
+       ENABLE_PAUTH := 1
+else ifeq (${BRANCH_PROTECTION},2)
+       # Return address signing to its standard level
+       BP_OPTION := pac-ret
+       ENABLE_PAUTH := 1
+else ifeq (${BRANCH_PROTECTION},3)
+       # Extend the signing to include leaf functions
+       BP_OPTION := pac-ret+leaf
+       ENABLE_PAUTH := 1
+else
+        $(error Unknown BRANCH_PROTECTION value ${BRANCH_PROTECTION})
+endif
 
 ################################################################################
 # Toolchain
@@ -189,27 +212,27 @@ endif
 TF_CFLAGS_aarch32      +=      -mno-unaligned-access
 TF_CFLAGS_aarch64      +=      -mgeneral-regs-only -mstrict-align
 
+ifneq (${BP_OPTION},none)
+TF_CFLAGS_aarch64      +=      -mbranch-protection=${BP_OPTION}
+endif
+
 ASFLAGS_aarch32                =       $(march32-directive)
 ASFLAGS_aarch64                =       $(march64-directive)
 
 WARNING1 := -Wextra
-WARNING1 += -Wunused -Wno-unused-parameter
 WARNING1 += -Wmissing-declarations
 WARNING1 += -Wmissing-format-attribute
 WARNING1 += -Wmissing-prototypes
 WARNING1 += -Wold-style-definition
-WARNING1 += -Wunused-but-set-variable
 WARNING1 += -Wunused-const-variable
 
 WARNING2 := -Waggregate-return
 WARNING2 += -Wcast-align
-WARNING2 += -Wdisabled-optimization
 WARNING2 += -Wnested-externs
 WARNING2 += -Wshadow
 WARNING2 += -Wlogical-op
 WARNING2 += -Wmissing-field-initializers
 WARNING2 += -Wsign-compare
-WARNING2 += -Wmaybe-uninitialized
 
 WARNING3 := -Wbad-function-cast
 WARNING3 += -Wcast-qual
@@ -219,8 +242,6 @@ WARNING3 += -Wpadded
 WARNING3 += -Wpointer-arith
 WARNING3 += -Wredundant-decls
 WARNING3 += -Wswitch-default
-WARNING3 += -Wpacked-bitfield-compat
-WARNING3 += -Wvla
 
 ifeq (${W},1)
 WARNINGS := $(WARNING1)
@@ -230,6 +251,16 @@ else ifeq (${W},3)
 WARNINGS := $(WARNING1) $(WARNING2) $(WARNING3)
 endif
 
+WARNINGS       +=              -Wunused -Wno-unused-parameter  \
+                               -Wdisabled-optimization         \
+                               -Wvla
+
+ifeq ($(findstring clang,$(notdir $(CC))),)
+WARNINGS       +=              -Wunused-but-set-variable       \
+                               -Wmaybe-uninitialized           \
+                               -Wpacked-bitfield-compat
+endif
+
 ifneq (${E},0)
 ERRORS := -Werror
 endif
@@ -451,26 +482,30 @@ ifeq ($(DYN_DISABLE_AUTH), 1)
 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.
+# registers associated to it are also saved and restored.
+# Not doing it would leak the value of the keys used by EL3 to EL1 and S-EL1.
 ifeq ($(ENABLE_PAUTH),1)
-    ifneq ($(ARCH),aarch64)
-        $(error ENABLE_PAUTH=1 requires AArch64)
-    else ifeq ($(CTX_INCLUDE_PAUTH_REGS),0)
-        $(error ENABLE_PAUTH=1 requires CTX_INCLUDE_PAUTH_REGS=1)
-    else
-        $(info ENABLE_PAUTH and CTX_INCLUDE_PAUTH_REGS are experimental features)
+    ifeq ($(CTX_INCLUDE_PAUTH_REGS),0)
+        $(error Pointer Authentication requires CTX_INCLUDE_PAUTH_REGS=1)
     endif
-else
-    ifeq ($(CTX_INCLUDE_PAUTH_REGS),1)
-        ifneq ($(ARCH),aarch64)
-            $(error CTX_INCLUDE_PAUTH_REGS=1 requires AArch64)
-        else
-            $(info CTX_INCLUDE_PAUTH_REGS is an experimental feature)
-        endif
+endif
+
+ifeq ($(CTX_INCLUDE_PAUTH_REGS),1)
+    ifneq (${ARCH},aarch64)
+        $(error CTX_INCLUDE_PAUTH_REGS requires AArch64)
+    else
+        $(info CTX_INCLUDE_PAUTH_REGS is an experimental feature)
     endif
 endif
 
+ifeq ($(ENABLE_PAUTH),1)
+    $(info Pointer Authentication is an experimental feature)
+endif
+
+ifeq ($(ENABLE_BTI),1)
+    $(info Branch Protection is an experimental feature)
+endif
+
 ################################################################################
 # Process platform overrideable behaviour
 ################################################################################
@@ -599,7 +634,6 @@ $(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))
@@ -635,6 +669,7 @@ $(eval $(call assert_boolean,BL2_IN_XIP_MEM))
 
 $(eval $(call assert_numeric,ARM_ARCH_MAJOR))
 $(eval $(call assert_numeric,ARM_ARCH_MINOR))
+$(eval $(call assert_numeric,BRANCH_PROTECTION))
 
 ################################################################################
 # Add definitions to the cpp preprocessor based on the current build options.
@@ -651,6 +686,7 @@ $(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_BTI))
 $(eval $(call add_define,ENABLE_MPAM_FOR_LOWER_ELS))
 $(eval $(call add_define,ENABLE_PAUTH))
 $(eval $(call add_define,ENABLE_PIE))
@@ -909,11 +945,13 @@ cscope:
        ${Q}cscope -b -q -k
 
 help:
-       @echo "usage: ${MAKE} PLAT=<${PLATFORM_LIST}> [OPTIONS] [TARGET]"
+       @echo "usage: ${MAKE} [PLAT=<platform>] [OPTIONS] [TARGET]"
        @echo ""
        @echo "PLAT is used to specify which platform you wish to build."
        @echo "If no platform is specified, PLAT defaults to: ${DEFAULT_PLAT}"
        @echo ""
+       @echo "platform = ${PLATFORM_LIST}"
+       @echo ""
        @echo "Please refer to the User Guide for a list of all supported options."
        @echo "Note that the build system doesn't track dependencies for build "
        @echo "options. Therefore, if any of the build options are changed "
index 7f1a8230642af573e8f088d0eb976591cf8913ff..b839990751668dab787ba922d66e4f4517fe14f0 100644 (file)
@@ -21,10 +21,6 @@ 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 d1e42471877be950d5a521a3979d257084fad1a2..261d2957348bd388db103a24512403c36e5ac79e 100644 (file)
@@ -10,7 +10,6 @@
 #include <el3_common_macros.S>
 
        .globl  bl2_entrypoint
-       .globl  bl2_vector_table
        .globl  bl2_el3_run_image
        .globl  bl2_run_next_image
 
@@ -51,6 +50,13 @@ func bl2_entrypoint
 #if ENABLE_PAUTH
        mrs     x0, sctlr_el3
        orr     x0, x0, #SCTLR_EnIA_BIT
+#if ENABLE_BTI
+       /* ---------------------------------------------
+        * Enable PAC branch type compatibility
+        * ---------------------------------------------
+        */
+       bic     x0, x0, #SCTLR_BT_BIT
+#endif /* ENABLE_BTI */
        msr     sctlr_el3, x0
        isb
 #endif /* ENABLE_PAUTH */
index c820cd1318cc6b10e842c05f16d43d485176a4d2..5e5b83b1d55616abe462100608ee72d22fb76362 100644 (file)
@@ -124,6 +124,13 @@ func bl2_entrypoint
 #if ENABLE_PAUTH
        mrs     x0, sctlr_el1
        orr     x0, x0, #SCTLR_EnIA_BIT
+#if ENABLE_BTI
+       /* ---------------------------------------------
+        * Enable PAC branch type compatibility
+        * ---------------------------------------------
+        */
+       bic     x0, x0, #(SCTLR_BT0_BIT | SCTLR_BT1_BIT)
+#endif /* ENABLE_BTI */
        msr     sctlr_el1, x0
        isb
 #endif /* ENABLE_PAUTH */
index 9523918bccf3f8d84bfaac659e0871302fbca656..6dc0f18253753b2c07b8b312685010e1b26e8070 100644 (file)
@@ -15,10 +15,6 @@ ifeq (${ARCH},aarch64)
 BL2_SOURCES            +=      common/aarch64/early_exceptions.S
 endif
 
-ifeq (${ENABLE_PAUTH},1)
-BL2_CFLAGS             +=      -msign-return-address=non-leaf
-endif
-
 ifeq (${BL2_AT_EL3},0)
 BL2_SOURCES            +=      bl2/${ARCH}/bl2_entrypoint.S
 BL2_LINKERFILE         :=      bl2/bl2.ld.S
index f24458c1bb47e5ec3e04603858c7cdca2c7d2f21..e7ad5a8977c82561530db490bafe11b5f04656c7 100644 (file)
@@ -105,6 +105,13 @@ func bl31_entrypoint
 #if ENABLE_PAUTH
        mrs     x0, sctlr_el3
        orr     x0, x0, #SCTLR_EnIA_BIT
+#if ENABLE_BTI
+       /* --------------------------------------------------------------------
+        * Enable PAC branch type compatibility
+        * --------------------------------------------------------------------
+        */
+       bic     x0, x0, #SCTLR_BT_BIT
+#endif /* ENABLE_BTI */
        msr     sctlr_el3, x0
        isb
 #endif /* ENABLE_PAUTH */
@@ -211,6 +218,13 @@ func bl31_warm_entrypoint
 
        mrs     x0, sctlr_el3
        orr     x0, x0, #SCTLR_EnIA_BIT
+#if ENABLE_BTI
+       /* --------------------------------------------------------------------
+        * Enable PAC branch type compatibility
+        * --------------------------------------------------------------------
+        */
+       bic     x0, x0, #SCTLR_BT_BIT
+#endif /* ENABLE_BTI */
        msr     sctlr_el3, x0
        isb
 #endif /* ENABLE_PAUTH */
index 10feae161f06ea30701c01cd71ec80732144d490..c9ba926c591f2ae2645eaf9da6445827a4cf54f6 100644 (file)
@@ -75,10 +75,6 @@ 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 cd08ce7d8de5061b89cd15079d883fca79b8189a..fd6b0fbcba2dbcd01b9fd158d51fc0540d8f042e 100644 (file)
@@ -136,6 +136,13 @@ func tsp_entrypoint _align=3
 #if ENABLE_PAUTH
        mrs     x0, sctlr_el1
        orr     x0, x0, #SCTLR_EnIA_BIT
+#if ENABLE_BTI
+       /* ---------------------------------------------
+        * Enable PAC branch type compatibility
+        * ---------------------------------------------
+        */
+       bic     x0, x0, #(SCTLR_BT0_BIT | SCTLR_BT1_BIT)
+#endif /* ENABLE_BTI */
        msr     sctlr_el1, x0
        isb
 #endif /* ENABLE_PAUTH */
@@ -164,7 +171,7 @@ endfunc tsp_entrypoint
         * TSPD for the various entrypoints
         * -------------------------------------------
         */
-func tsp_vector_table
+vector_base tsp_vector_table
        b       tsp_yield_smc_entry
        b       tsp_fast_smc_entry
        b       tsp_cpu_on_entry
@@ -175,7 +182,6 @@ func tsp_vector_table
        b       tsp_system_off_entry
        b       tsp_system_reset_entry
        b       tsp_abort_yield_smc_entry
-endfunc tsp_vector_table
 
        /*---------------------------------------------
         * This entrypoint is used by the TSPD when this
index b1fe7ff600e930f28360019f7a5ea477cd1ac4f3..3fd6d99577cfb7cb7fa0b45afe425e4fd915eedd 100644 (file)
@@ -17,11 +17,6 @@ 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 5941a8ba0c1578cff2e49c568a02597cada0ab69..71f24fd6247e1506ef5369f8da3219df0b7d1fbd 100644 (file)
@@ -2425,9 +2425,10 @@ releases of TF-A.
 .. _SDEI Specification: http://infocenter.arm.com/help/topic/com.arm.doc.den0054a/ARM_DEN0054A_Software_Delegated_Exception_Interface.pdf
 .. _PSCI Integration Guide: ./getting_started/psci-lib-integration-guide.rst
 .. _Developer Certificate of Origin: ../dco.txt
-.. _Contribution Guide: ./contributing.rst
+.. _Contribution Guide: ./process/contributing.rst
 .. _Authentication framework: ./design/auth-framework.rst
 .. _Firmware Update: ./design/firmware-update.rst
+.. _Firmware Design: ./design/firmware-design.rst
 .. _TF-A Reset Design: ./design/reset-design.rst
 .. _Power Domain Topology Design: ./design/psci-pd-tree.rst
 .. _TF-A wiki on GitHub: https://github.com/ARM-software/arm-trusted-firmware/wiki/ARM-Trusted-Firmware-Image-Terminology
index 9cbf199467e3fbda0523322e4fbaad542011f59f..e450d3756697a56d80cdc60a2a1f7c6f584b3bc4 100644 (file)
@@ -92,5 +92,5 @@ respectively.
 *Copyright (c) 2017-2018, Arm Limited and Contributors. All rights reserved.*
 
 .. _SMC Calling Convention: http://infocenter.arm.com/help/topic/com.arm.doc.den0028a/index.html
-.. _Performance Measurement Framework: ./firmware-design.rst#user-content-performance-measurement-framework
-.. _Firmware Design document: ./firmware-design.rst
+.. _Performance Measurement Framework: ../design/firmware-design.rst#user-content-performance-measurement-framework
+.. _Firmware Design document: ../design/firmware-design.rst
index 8f74eb65728409e815625b2e5cc302eb5f2ffa99..0d0173318d8641ba3c50a5c3e75d48b283f9dc0d 100644 (file)
@@ -622,5 +622,5 @@ The |EHF| has the following limitations:
 
 *Copyright (c) 2018, Arm Limited and Contributors. All rights reserved.*
 
-.. _Interrupt Framework Design: interrupt-framework-design.rst
+.. _Interrupt Framework Design: ../design/interrupt-framework-design.rst
 .. _SDEI specification: http://infocenter.arm.com/help/topic/com.arm.doc.den0054a/ARM_DEN0054A_Software_Delegated_Exception_Interface.pdf
index 31f5917e08c33c3aaa429ff0c7e788d466f679ec..d6bb6ce8a2bdb4052e607e4b271b9299744b3dce 100644 (file)
@@ -394,10 +394,10 @@ This is only allowed if the image is not being executed.
 
 *Copyright (c) 2015-2018, Arm Limited and Contributors. All rights reserved.*
 
-.. _Trusted Board Boot: ./trusted-board-boot.rst
+.. _Trusted Board Boot: ../design/trusted-board-boot.rst
 .. _Porting Guide: ../getting_started/porting-guide.rst
 .. _here: https://github.com/ARM-software/arm-trusted-firmware/wiki/ARM-Trusted-Firmware-Image-Terminology
-.. _Authentication Framework Design: ./auth-framework.rst
+.. _Authentication Framework Design: ../design/auth-framework.rst
 .. _Universally Unique Identifier: https://tools.ietf.org/rfc/rfc4122.txt
 
 .. |Flow Diagram| image:: ../resources/diagrams/fwu_flow.png
index 845a2955673a82a77d3ad6bfadea851d0d22bc4d..6d0e1563d64928fe951a70dd0e1a3bbfa4fa2e66 100644 (file)
@@ -41,7 +41,7 @@ execute the registered handler [10]. The client terminates its execution with
 original EL2 execution [13]. Note that the SDEI interrupt remains active until
 the client handler completes, at which point EL3 does EOI [12].
 
-Other than events bound to interrupts (as depicted in the sequence above, SDEI
+Other than events bound to interruptsas depicted in the sequence above, SDEI
 events can be explicitly dispatched in response to other exceptions, for
 example, upon receiving an *SError* or *Synchronous External Abort*. See
 `Explicit dispatch of events`_.
@@ -370,3 +370,4 @@ implemented in assembly, following a similar pattern as below:
 
 .. _SDEI specification: http://infocenter.arm.com/help/topic/com.arm.doc.den0054a/ARM_DEN0054A_Software_Delegated_Exception_Interface.pdf
 .. _SDEI porting requirements: ../getting_started/porting-guide.rst#sdei-porting-requirements
+.. _Software Delegated Exception Interface: `SDEI specification`_
index 697b8711542127ecda16cd719184381d9d733834..64f12431bb3f4f64427717d9b8aeaced470735ad 100644 (file)
@@ -23,7 +23,7 @@ release = version # We don't need these to be distinct
 # Add any Sphinx extension module names here, as strings. They can be
 # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
 # ones.
-extensions = []
+extensions = ['sphinx.ext.autosectionlabel']
 
 # Add any paths that contain templates here, relative to this directory.
 templates_path = ['_templates']
@@ -54,6 +54,9 @@ pygments_style = 'sphinx'
 with open('global_substitutions.txt', 'r') as subs:
   rst_prolog = subs.read()
 
+# Minimum version of sphinx required
+needs_sphinx = '2.0'
+
 # -- Options for HTML output -------------------------------------------------
 
 # Don't show the "Built with Sphinx" footer
@@ -75,3 +78,8 @@ html_theme_options = {
     'prev_next_buttons_location': 'both', # Top and bottom of the page
     'style_external_links': True # Display an icon next to external links
 }
+
+# -- Options for autosectionlabel --------------------------------------------
+
+# Only generate automatic section labels for document titles
+autosectionlabel_maxdepth = 1
\ No newline at end of file
diff --git a/docs/contents.rst b/docs/contents.rst
new file mode 100644 (file)
index 0000000..4909dab
--- /dev/null
@@ -0,0 +1,165 @@
+Trusted Firmware-A Documentation Contents
+=========================================
+
+This document serves as a list of the documentation that is included with the
+Trusted Firmware-A source.
+
+Introduction
+------------
+
+`About Trusted Firmware-A`_
+
+Getting Started
+---------------
+
+`Frequently-Asked Questions (FAQ)`_
+
+`Image Terminology`_
+
+`Porting Guide`_
+
+`User Guide`_
+
+Contributing
+------------
+
+`Coding Style and Guidelines`_
+
+`Contributor Acknowledgements`_
+
+`Contributor's Guide`_
+
+`License`_
+
+`Maintainers`_
+
+Processes and Policies
+----------------------
+
+`Platform Compatibility Policy`_
+
+`Release Processes`_
+
+Secure Payload Dispatch
+-----------------------
+
+`OP-TEE Dispatcher`_
+
+`Trusted Little Kernel (TLK) Dispatcher`_
+
+`Trusty Dispatcher`_
+
+System Design and Components
+----------------------------
+
+`Arm CPU Specific Build Macros`_
+
+`Arm SiP Services`_
+
+`Authentication Framework & Chain of Trust`_
+
+`CPU Reset`_
+
+`EL3 Runtime Service Writer’s Guide`_
+
+`Exception Handling Framework`_
+
+`Firmware Design Overview`_
+
+`Firmware Update (FWU)`_
+
+`Interrupt Management Framework`_
+
+`Library at ROM`_
+
+`Platform Interrupt Controller API`_
+
+`PSCI Library Integration Guide for Armv8-A AArch32 systems`_
+
+`PSCI Power Domain Tree design`_
+
+`Reliability, Availability, and Serviceability (RAS) Extensions`_
+
+`Secure Partition Manager`_
+
+`Software Delegated Exception Interface`_
+
+`Translation (XLAT) Tables Library`_
+
+`Trusted Board Boot Design Guide`_
+
+Performance and Testing
+-----------------------
+
+`PSCI Performance Measurements on Arm Juno Development Platform`_
+
+Security and Advisories
+-----------------------
+
+`Security Processes`_
+
+`TFV-1`_
+
+`TFV-2`_
+
+`TFV-3`_
+
+`TFV-4`_
+
+`TFV-5`_
+
+`TFV-6`_
+
+`TFV-7`_
+
+`TFV-8`_
+
+Other Documents
+---------------
+
+`Change Log`_
+
+.. _About Trusted Firmware-A: ../readme.rst
+.. _Frequently-Asked Questions (FAQ): ./process/faq.rst
+.. _Image Terminology: ./getting_started/image-terminology.rst
+.. _Porting Guide: ./getting_started/porting-guide.rst
+.. _User Guide: ./getting_started/user-guide.rst
+.. _Coding Style and Guidelines: ./process/coding-guidelines.rst
+.. _Contributor Acknowledgements: ./acknowledgements.rst
+.. _`Contributor's Guide`: ./process/contributing.rst
+.. _License: ../license.rst
+.. _Maintainers: ./maintainers.rst
+.. _Platform Compatibility Policy: ./process/platform-compatibility-policy.rst
+.. _Release Processes: ./process/release-information.rst
+.. _Arm SiP Services: ./components/arm-sip-service.rst
+.. _Exception Handling Framework: ./components/exception-handling.rst
+.. _Firmware Update (FWU): ./components/firmware-update.rst
+.. _Interrupt Management Framework: ./design/interrupt-framework-design.rst
+.. _Library at ROM: ./components/romlib-design.rst
+.. _Platform Interrupt Controller API: ./components/platform-interrupt-controller-API.rst
+.. _`Reliability, Availability, and Serviceability (RAS) Extensions`: ./components/ras.rst
+.. _Secure Partition Manager: ./components/secure-partition-manager-design.rst
+.. _Software Delegated Exception Interface: ./components/sdei.rst
+.. _Translation (XLAT) Tables Library: ./components/xlat-tables-lib-v2-design.rst
+.. _OP-TEE Dispatcher: ./components/spd/optee-dispatcher.rst
+.. _Trusted Little Kernel (TLK) Dispatcher: ./components/spd/tlk-dispatcher.rst
+.. _Trusty Dispatcher: ./components/spd/trusty-dispatcher.rst
+.. _Arm CPU Specific Build Macros: ./design/cpu-specific-build-macros.rst
+.. _`Authentication Framework & Chain of Trust`: ./design/auth-framework.rst
+.. _CPU Reset: ./design/reset-design.rst
+.. _`EL3 Runtime Service Writer’s Guide`: ./getting_started/rt-svc-writers-guide.rst
+.. _Firmware Design Overview: ./design/firmware-design.rst
+.. _PSCI Library Integration Guide for Armv8-A AArch32 systems: ./getting_started/psci-lib-integration-guide.rst
+.. _PSCI Power Domain Tree design: ./design/psci-pd-tree.rst
+.. _Trusted Board Boot Design Guide: ./design/trusted-board-boot.rst
+.. _PSCI Performance Measurements on Arm Juno Development Platform: ./perf/psci-performance-juno.rst
+.. _Security Processes: ./process/security.rst
+.. _Change Log: ./change-log.rst
+.. _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
index e49c73e7b90a4a1cbf3bfd79e1d1d7608f1c22db..07983a901866ac5c74958b8d8d15fe2496e988c5 100644 (file)
@@ -143,6 +143,9 @@ For Cortex-A55, the following errata build flags are defined :
 -  ``ERRATA_A55_903758``: This applies errata 903758 workaround to Cortex-A55
    CPU. This needs to be enabled only for revision <= r0p1 of the CPU.
 
+-  ``ERRATA_A55_1221012``: This applies errata 1221012 workaround to Cortex-A55
+   CPU. This needs to be enabled only for revision <= r1p0 of the CPU.
+
 For Cortex-A57, the following errata build flags are defined :
 
 -  ``ERRATA_A57_806969``: This applies errata 806969 workaround to Cortex-A57
index 21b8234633043d8670004eb2cd3a03280d5d2d48..00e199a20013be9a93ff09c1d9c8f831bdf0e87c 100644 (file)
@@ -19,7 +19,7 @@ in either security state. The details of the interrupt management framework
 and its design can be found in TF-A Interrupt Management Design guide [4]_.
 
 TF-A also implements a library for setting up and managing the translation
-tables. The details of this library can be found in `Xlat_tables design`_.
+tables. The details of this library can be found in `Translation tables design`_.
 
 TF-A can be built to support either AArch64 or AArch32 execution state.
 
@@ -1333,7 +1333,7 @@ different CPUs during power down and reset handling. The platform can specify
 any CPU optimization it wants to enable for each CPU. It can also specify
 the CPU errata workarounds to be applied for each CPU type during reset
 handling by defining CPU errata compile time macros. Details on these macros
-can be found in the `cpu-specific-build-macros.rst`_ file.
+can be found in `CPU specific build macros`_.
 
 The CPU specific operations framework depends on the ``cpu_ops`` structure which
 needs to be exported for each type of CPU in the platform. It is defined in
@@ -2564,7 +2564,7 @@ Armv8.3-A
    to the context that is saved when doing a world switch.
 
    The TF-A itself has support for pointer authentication at runtime
-   that can be enabled by setting both options ``ENABLE_PAUTH`` and
+   that can be enabled by setting ``BRANCH_PROTECTION`` option to non-zero and
    ``CTX_INCLUDE_PAUTH_REGS`` to 1. This enables pointer authentication in BL1,
    BL2, BL31, and the TSP if it is used.
 
@@ -2577,6 +2577,12 @@ Armv8.3-A
    enabling PAuth is lower because the compiler will use the optimized
    PAuth instructions rather than the backwards-compatible ones.
 
+Armv8.5-A
+~~~~~~~~~
+
+-  Branch Target Identification feature is selected by ``BRANCH_PROTECTION``
+   option set to 1. This option defaults to 0 and this is an experimental feature.
+
 Armv7-A
 ~~~~~~~
 
@@ -2664,7 +2670,7 @@ References
 
 .. _Reset Design: ./reset-design.rst
 .. _Porting Guide: ../getting_started/porting-guide.rst
-.. _Firmware Update: ./firmware-update.rst
+.. _Firmware Update: ../components/firmware-update.rst
 .. _PSCI PDD: http://infocenter.arm.com/help/topic/com.arm.doc.den0022d/Power_State_Coordination_Interface_PDD_v1_1_DEN0022D.pdf
 .. _SMC calling convention PDD: http://infocenter.arm.com/help/topic/com.arm.doc.den0028b/ARM_DEN0028B_SMC_Calling_Convention.pdf
 .. _PSCI Library integration guide: ../getting_started/psci-lib-integration-guide.rst
@@ -2672,15 +2678,15 @@ References
 .. _PSCI: http://infocenter.arm.com/help/topic/com.arm.doc.den0022d/Power_State_Coordination_Interface_PDD_v1_1_DEN0022D.pdf
 .. _Power State Coordination Interface PDD: http://infocenter.arm.com/help/topic/com.arm.doc.den0022d/Power_State_Coordination_Interface_PDD_v1_1_DEN0022D.pdf
 .. _here: ../getting_started/psci-lib-integration-guide.rst
-.. _cpu-specific-build-macros.rst: ./cpu-specific-build-macros.rst
+.. _CPU specific build macros: ./cpu-specific-build-macros.rst
 .. _CPUBM: ./cpu-specific-build-macros.rst
 .. _Arm ARM: http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.ddi0487a.e/index.html
 .. _User Guide: ../getting_started/user-guide.rst
 .. _SMC Calling Convention PDD: http://infocenter.arm.com/help/topic/com.arm.doc.den0028b/ARM_DEN0028B_SMC_Calling_Convention.pdf
 .. _TF-A Interrupt Management Design guide: ./interrupt-framework-design.rst
-.. _Xlat_tables design: xlat-tables-lib-v2-design.rst
-.. _Exception Handling Framework: exception-handling.rst
-.. _ROMLIB Design: romlib-design.rst
+.. _Translation tables design: ../components/xlat-tables-lib-v2-design.rst
+.. _Exception Handling Framework: ../components/exception-handling.rst
+.. _ROMLIB Design: ../components/romlib-design.rst
 .. _Trusted Board Boot Requirements CLIENT (TBBR-CLIENT) Armv8-A (ARM DEN0006D): https://developer.arm.com/docs/den0006/latest/trusted-board-boot-requirements-client-tbbr-client-armv8-a
 
 .. |Image 1| image:: ../resources/diagrams/rt-svc-descs-layout.png
index 6f648f51321785584e7a1a3bcc152a368d72179b..82be272bfe80b2efbb666ce959725ec592998c9a 100644 (file)
@@ -227,7 +227,7 @@ for building and using the tool can be found in the `User Guide`_.
 
 *Copyright (c) 2015-2019, Arm Limited and Contributors. All rights reserved.*
 
-.. _Firmware Update: firmware-update.rst
+.. _Firmware Update: ../components/firmware-update.rst
 .. _X.509 v3: https://tools.ietf.org/rfc/rfc5280.txt
 .. _User Guide: ../getting_started/user-guide.rst
 .. _Auth Framework: auth-framework.rst
index 94ec93232b8c9dbec8cd1393b3e413f8266df6a6..72865a5176f4b0ec8514ca1acf2f96968935d98c 100644 (file)
@@ -2821,14 +2821,14 @@ amount of open resources per driver.
 .. _plat/common/aarch64/platform_mp_stack.S: ../plat/common/aarch64/platform_mp_stack.S
 .. _plat/common/aarch64/platform_up_stack.S: ../plat/common/aarch64/platform_up_stack.S
 .. _For example, define the build flag in platform.mk: PLAT_PL061_MAX_GPIOS%20:=%20160
-.. _Power Domain Topology Design: psci-pd-tree.rst
+.. _Power Domain Topology Design: ../design/psci-pd-tree.rst
 .. _include/common/bl_common.h: ../include/common/bl_common.h
 .. _include/lib/aarch32/arch.h: ../include/lib/aarch32/arch.h
-.. _Firmware Design: firmware-design.rst
+.. _Firmware Design: ../design/firmware-design.rst
 .. _PSCI: http://infocenter.arm.com/help/topic/com.arm.doc.den0022c/DEN0022C_Power_State_Coordination_Interface.pdf
 .. _plat/arm/board/fvp/fvp_pm.c: ../plat/arm/board/fvp/fvp_pm.c
-.. _Platform compatibility policy: ./platform-compatibility-policy.rst
-.. _IMF Design Guide: interrupt-framework-design.rst
+.. _Platform compatibility policy: ../process/platform-compatibility-policy.rst
+.. _IMF Design Guide: ../design/interrupt-framework-design.rst
 .. _Arm Generic Interrupt Controller version 2.0 (GICv2): http://infocenter.arm.com/help/topic/com.arm.doc.ihi0048b/index.html
 .. _3.0 (GICv3): http://infocenter.arm.com/help/topic/com.arm.doc.ihi0069b/index.html
 .. _FreeBSD: https://www.freebsd.org
index f5ea0d78b74b36dd932b05891d8a718e167ca702..25936d900ae379fad0f396e458f8dfc4ce4e9014 100644 (file)
@@ -544,5 +544,5 @@ workarounds.
 .. _SMCCC: https://silver.arm.com/download/ARM_and_AMBA_Architecture/AR570-DA-80002-r0p0-00rel0/ARM_DEN0028A_SMC_Calling_Convention.pdf
 .. _PSCI specification: http://infocenter.arm.com/help/topic/com.arm.doc.den0022c/DEN0022C_Power_State_Coordination_Interface.pdf
 .. _PSCI Specification: http://infocenter.arm.com/help/topic/com.arm.doc.den0022c/DEN0022C_Power_State_Coordination_Interface.pdf
-.. _Porting Guide: ../getting_started/porting-guide.rst
+.. _Porting Guide: ./porting-guide.rst
 .. _Firmware Design: ../design/firmware-design.rst
index 03212af1af33b71abeabc345d0801229b34192b4..6c17a1fb4a6bac8de6c605d6fe1a3a7df510a0e9 100644 (file)
@@ -300,7 +300,7 @@ provide this information....
 
 .. _SMCCC: http://infocenter.arm.com/help/topic/com.arm.doc.den0028a/index.html
 .. _PSCI: http://infocenter.arm.com/help/topic/com.arm.doc.den0022c/DEN0022C_Power_State_Coordination_Interface.pdf
-.. _Firmware Design: ../designb_documents/firmware-design.rst
+.. _Firmware Design: ../design/firmware-design.rst
 .. _services: ../../services
 .. _lib/psci: ../../lib/psci
 .. _runtime_svc.h: ../../include/common/runtime_svc.h
index 606546447dc3bc49c3ad5c2009a7b722b942e1c0..1a4df03d441c75c78a4b159c9f1b2d2257c91a6b 100644 (file)
@@ -315,6 +315,34 @@ Common build options
    file that contains the BL33 private key in PEM format. If ``SAVE_KEYS=1``,
    this file name will be used to save the key.
 
+-  ``BRANCH_PROTECTION``: Numeric value to enable ARMv8.3 Pointer Authentication
+   and ARMv8.5 Branch Target Identification support for TF-A BL images themselves.
+   If enabled, it is needed to use a compiler that supports the option
+   ``-mbranch-protection``. Selects the branch protection features to use:
+-  0: Default value turns off all types of branch protection
+-  1: Enables all types of branch protection features
+-  2: Return address signing to its standard level
+-  3: Extend the signing to include leaf functions
+
+   The table below summarizes ``BRANCH_PROTECTION`` values, GCC compilation options
+   and resulting PAuth/BTI features.
+
+   +-------+--------------+-------+-----+
+   | Value |  GCC option  | PAuth | BTI |
+   +=======+==============+=======+=====+
+   |   0   |     none     |   N   |  N  |
+   +-------+--------------+-------+-----+
+   |   1   |   standard   |   Y   |  Y  |
+   +-------+--------------+-------+-----+
+   |   2   |   pac-ret    |   Y   |  N  |
+   +-------+--------------+-------+-----+
+   |   3   | pac-ret+leaf |   Y   |  N  |
+   +-------+--------------+-------+-----+
+
+   This option defaults to 0 and this is an experimental feature.
+   Note that Pointer Authentication is enabled for Non-secure world
+   irrespective of the value of this option if the CPU supports it.
+
 -  ``BUILD_MESSAGE_TIMESTAMP``: String used to identify the time and date of the
    compilation of each build. It must be set to a C string (including quotes
    where applicable). Defaults to a string that contains the time and date of
@@ -354,17 +382,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, allows
-   Pointer Authentication for **Secure world**. This will cause the
-   Armv8.3-PAuth registers to be included when saving and restoring the CPU
-   context as part of a world switch. Default value is 0. Pointer Authentication
-   is an experimental feature.
-
-   Note that, if the CPU supports it, Pointer Authentication is allowed for
-   Non-secure world irrespectively of the value of this flag. "Allowed" means
-   that accesses to PAuth-related registers or execution of PAuth-related
-   instructions will not be trapped to EL3. As such, usage or not of PAuth in
-   Non-secure world images, depends on those images themselves.
+-  ``CTX_INCLUDE_PAUTH_REGS``: Boolean option that, when set to 1, enables
+   Pointer Authentication for Secure world. This will cause the ARMv8.3-PAuth
+   registers to be included when saving and restoring the CPU context as
+   part of world switch. Default value is 0 and this is an experimental feature.
+   Note that Pointer Authentication is enabled for Non-secure world irrespective
+   of the value of this flag if the CPU supports it.
 
 -  ``DEBUG``: Chooses between a debug and release build. It can take either 0
    (release) or 1 (debug) as values. 0 is the default.
@@ -417,13 +440,6 @@ 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
-   for **TF-A BL images themselves**. If enabled, the compiler must support the
-   ``-msign-return-address`` option. This flag defaults to 0. Pointer
-   Authentication is an experimental feature.
-
-   If this flag is enabled, ``CTX_INCLUDE_PAUTH_REGS`` must also be enabled.
-
 -  ``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.
@@ -2144,17 +2160,17 @@ wakeup interrupt from RTC.
 .. _Linux master tree: https://github.com/torvalds/linux/tree/master/
 .. _Dia: https://wiki.gnome.org/Apps/Dia/Download
 .. _here: psci-lib-integration-guide.rst
-.. _Trusted Board Boot: trusted-board-boot.rst
-.. _TB_FW_CONFIG for FVP: ../plat/arm/board/fvp/fdts/fvp_tb_fw_config.dts
-.. _Secure-EL1 Payloads and Dispatchers: firmware-design.rst#user-content-secure-el1-payloads-and-dispatchers
-.. _Firmware Update: firmware-update.rst
-.. _Firmware Design: firmware-design.rst
+.. _Trusted Board Boot: ../design/trusted-board-boot.rst
+.. _TB_FW_CONFIG for FVP: ../../plat/arm/board/fvp/fdts/fvp_tb_fw_config.dts
+.. _Secure-EL1 Payloads and Dispatchers: ../design/firmware-design.rst#user-content-secure-el1-payloads-and-dispatchers
+.. _Firmware Update: ../components/firmware-update.rst
+.. _Firmware Design: ../design/firmware-design.rst
 .. _mbed TLS Repository: https://github.com/ARMmbed/mbedtls.git
 .. _mbed TLS Security Center: https://tls.mbed.org/security
 .. _Arm's website: `FVP models`_
 .. _FVP models: https://developer.arm.com/products/system-design/fixed-virtual-platforms
 .. _Juno Getting Started Guide: http://infocenter.arm.com/help/topic/com.arm.doc.dui0928e/DUI0928E_juno_arm_development_platform_gsg.pdf
 .. _PSCI: http://infocenter.arm.com/help/topic/com.arm.doc.den0022d/Power_State_Coordination_Interface_PDD_v1_1_DEN0022D.pdf
-.. _Secure Partition Manager Design guide: secure-partition-manager-design.rst
-.. _`Trusted Firmware-A Coding Guidelines`: coding-guidelines.rst
-.. _`Library at ROM`: romlib-design.rst
+.. _Secure Partition Manager Design guide: ../components/secure-partition-manager-design.rst
+.. _`Trusted Firmware-A Coding Guidelines`: ../process/coding-guidelines.rst
+.. _Library at ROM: ../components/romlib-design.rst
index 6f6cfdff0f02defe825baad32c75439622d38872..7ac0584cc0c7b58ee5ad31d1c391d30402e21cbc 100644 (file)
@@ -260,20 +260,13 @@ See the `Contributing Guidelines`_ for information on how to contribute to this
 project and the `Acknowledgments`_ file for a list of contributors to the
 project.
 
-IRC channel
-~~~~~~~~~~~
+Contact us
+~~~~~~~~~~
 
-Development discussion takes place on the #trusted-firmware-a channel
-on the Freenode IRC network. This is not an official support channel.
-If you have an issue to raise, please use the `issue tracker`_.
-
-Feedback and support
-~~~~~~~~~~~~~~~~~~~~
-
-Arm welcomes any feedback on TF-A. If you think you have found a security
+We welcome any feedback on TF-A. If you think you have found a security
 vulnerability, please report this using the process defined in the TF-A
-`Security Center`_. For all other feedback, please use the
-`issue tracker`_.
+`Security Center`_. For all other feedback, you can use either the
+`issue tracker`_ or our `mailing list`_.
 
 Arm licensees may contact Arm directly via their partner managers.
 
@@ -300,21 +293,12 @@ Arm licensees may contact Arm directly via their partner managers.
 .. _Trusty Secure OS: https://source.android.com/security/trusty
 .. _trustedfirmware.org: https://git.trustedfirmware.org/TF-A/trusted-firmware-a.git
 .. _issue tracker: https://issues.trustedfirmware.org
-.. _Security Center: ./docs/security-center.rst
+.. _mailing list: https://lists.trustedfirmware.org/mailman/listinfo/tf-a
+.. _Security Center: ./process/security.rst
 .. _license: ./license.rst
-.. _Contributing Guidelines: ./contributing.rst
+.. _Contributing Guidelines: ./process/contributing.rst
 .. _Acknowledgments: ./acknowledgements.rst
-.. _Firmware Design: ./docs/firmware-design.rst
-.. _Change Log: ./docs/change-log.rst
-.. _User Guide: ./docs/user-guide.rst
-.. _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
+.. _Firmware Design: ./design/firmware-design.rst
+.. _Change Log: ./change-log.rst
+.. _User Guide: ./getting_started/user-guide.rst
+.. _Porting Guide: ./getting_started/porting-guide.rst
index 8f8143f87f1b5c6129e666de69fa9e4bc698608f..66b282c914e243887df2e75aadf883c46565420f 100644 (file)
@@ -13,9 +13,9 @@ Getting Started
       raise a separate `issue`_ for this and ensure that the changes that
       include Third Party IP are made on a separate topic branch.
 
--  Clone `arm-trusted-firmware-a`_ on your own machine as suggested on the
+-  Clone `Trusted Firmware-A`_ on your own machine as suggested on the
    `User Guide`_.
--  Create a local topic branch based on the `arm-trusted-firmware-a`_ ``master``
+-  Create a local topic branch based on the `Trusted Firmware-A`_ ``master``
    branch.
 
 Making Changes
@@ -130,17 +130,17 @@ Binary Components
 
 .. _developer.trustedfirmware.org: https://developer.trustedfirmware.org
 .. _issue: https://developer.trustedfirmware.org/project/board/1/
-.. _arm-trusted-firmware-a: https://git.trustedfirmware.org/TF-A/trusted-firmware-a.git
+.. _Trusted Firmware-A: https://git.trustedfirmware.org/TF-A/trusted-firmware-a.git
 .. _Git guidelines: http://git-scm.com/book/ch5-2.html
-.. _Coding Guidelines: ./docs/coding-guidelines.rst
-.. _User Guide: ./docs/user-guide.rst
-.. _Porting Guide: ./docs/porting-guide.rst
-.. _Firmware Design: ./docs/firmware-design.rst
-.. _license.rst: ./license.rst
-.. _Acknowledgements: ./acknowledgements.rst
-.. _Maintainers: ./maintainers.rst
-.. _Running the software on FVP: ./docs/user-guide.rst#user-content-running-the-software-on-fvp
-.. _Developer Certificate of Origin (DCO): ./dco.txt
+.. _Coding Guidelines: ./coding-guidelines.rst
+.. _User Guide: ../getting_started/user-guide.rst
+.. _Porting Guide: ../getting_started/porting-guide.rst
+.. _Firmware Design: ../design/firmware-design.rst
+.. _license.rst: ../license.rst
+.. _Acknowledgements: ../acknowledgements.rst
+.. _Maintainers: ../maintainers.rst
+.. _Running the software on FVP: ../getting_started/user-guide.rst#user-content-running-the-software-on-fvp
+.. _Developer Certificate of Origin (DCO): ../../dco.txt
 .. _Gerrit Uploading Changes documentation: https://review.trustedfirmware.org/Documentation/user-upload.html
 .. _Gerrit Signed-off-by Lines guidelines: https://review.trustedfirmware.org/Documentation/user-signedoffby.html
 .. _Gerrit Change-Ids documentation: https://review.trustedfirmware.org/Documentation/user-changeid.html
index b4831c8229ad6a963b12960991a129fbbd75d74a..d1c997ba4ba396e6fc78d3445becc63f22dad000 100644 (file)
@@ -4,28 +4,29 @@ Security Handling
 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
+We disclose all security vulnerabilities we find, or are advised about, that are
+relevant to Trusted Firmware-A. 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.
+We disclose TF-A vulnerabilities as Security Advisories, all of which are listed
+at the bottom of this page. Any new ones will, additionally, be announced as
+issues in the project's `issue tracker`_ with the ``security-advisory`` tag. You
+can receive notification emails for these by watching the "Trusted Firmware-A"
+project at https://developer.trustedfirmware.org/.
 
 Found a Security Issue?
 -----------------------
 
-Although we try to keep TF secure, we can only do so with the help of the
+Although we try to keep TF-A 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
+If you think you have found a security vulnerability, please **do not** report it
+in the `issue tracker`_. Instead send an email to
 trusted-firmware-security@arm.com
 
 Please include:
 
-* Trusted Firmware version (or commit) affected
+* Trusted Firmware-A version (or commit) affected
 
 * A description of the concern or vulnerability
 
@@ -49,10 +50,11 @@ 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
+ensure providers of products that use TF-A 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.
+Afterwards, we encourage you to write-up your findings about the TF-A source
+code.
 
 Attribution
 -----------
@@ -81,7 +83,7 @@ Security Advisories
 | `TFV-5`_  | Not initializing or saving/restoring PMCR_EL0 can leak secure    |
 |           | world timing information                                         |
 +-----------+------------------------------------------------------------------+
-| `TFV-6`_  | Arm Trusted Firmware exposure to speculative processor           |
+| `TFV-6`_  | Trusted Firmware-A exposure to speculative processor             |
 |           | vulnerabilities using cache timing side-channels                 |
 +-----------+------------------------------------------------------------------+
 | `TFV-7`_  | Trusted Firmware-A exposure to cache speculation vulnerability   |
@@ -91,7 +93,7 @@ Security Advisories
 |           | Normal World SMC client to another                               |
 +-----------+------------------------------------------------------------------+
 
-.. _GitHub issue tracker: https://github.com/ARM-software/tf-issues/issues
+.. _issue tracker: https://developer.trustedfirmware.org/project/board/1/
 .. _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
diff --git a/docs/requirements.txt b/docs/requirements.txt
new file mode 100644 (file)
index 0000000..8f95774
--- /dev/null
@@ -0,0 +1,2 @@
+sphinx>=2.0.0
+sphinx-rtd-theme>=0.4.3
\ No newline at end of file
index f968262c2a4c0d71bc620c7e43025d05b0e4cf08..495edddae5f5be2fc63a2b3f24dd23b6317bb5da 100644 (file)
@@ -2,7 +2,7 @@ Advisory TFV-6 (CVE-2017-5753, CVE-2017-5715, CVE-2017-5754)
 ============================================================
 
 +----------------+-------------------------------------------------------------+
-| Title          | Arm Trusted Firmware exposure to speculative processor      |
+| Title          | Trusted Firmware-A exposure to speculative processor        |
 |                | vulnerabilities using cache timing side-channels            |
 +================+=============================================================+
 | CVE ID         | `CVE-2017-5753`_ / `CVE-2017-5715`_ / `CVE-2017-5754`_      |
@@ -24,11 +24,11 @@ Advisory TFV-6 (CVE-2017-5753, CVE-2017-5715, CVE-2017-5754)
 | 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`_.
+This security advisory describes the current understanding of the Trusted
+Firmware-A 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`_)
 ----------------------------
index cf92f10ba7b907c33eb56d0d984bbaf6631e24e4..a94dbf6791666d4583dac2919970b41c619a4751 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
  */
@@ -265,6 +265,10 @@ void gicv3_cpuif_enable(unsigned int proc_num)
        write_scr_el3(scr_el3 & (~SCR_NS_BIT));
        isb();
 
+       /* Write the secure ICC_SRE_EL1 register */
+       write_icc_sre_el1(ICC_SRE_SRE_BIT);
+       isb();
+
        /* Program the idle priority in the PMR */
        write_icc_pmr_el1(GIC_PRI_MASK);
 
@@ -274,9 +278,6 @@ void gicv3_cpuif_enable(unsigned int proc_num)
        /* Enable Group1 Secure interrupts */
        write_icc_igrpen1_el3(read_icc_igrpen1_el3() |
                                IGRPEN1_EL3_ENABLE_G1S_BIT);
-
-       /* Write the secure ICC_SRE_EL1 register */
-       write_icc_sre_el1(ICC_SRE_SRE_BIT);
        isb();
 }
 
index d15851d813ece953553a71ecab652402f6a80300..d23d89e3cb49f81abb15a6558716b34219f70c0b 100644 (file)
 /* 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_APA_MASK  ULL(0xf)
 
 /* ID_AA64MMFR0_EL1 definitions */
 
 #define SSBS_UNAVAILABLE       ULL(0)  /* No architectural SSBS support */
 
+#define ID_AA64PFR1_EL1_BT_SHIFT       U(0)
+#define ID_AA64PFR1_EL1_BT_MASK                ULL(0xf)
+
+#define BTI_IMPLEMENTED                ULL(1)  /* The BTI mechanism is implemented */
+
 /* ID_PFR1_EL1 definitions */
 #define ID_PFR1_VIRTEXT_SHIFT  U(12)
 #define ID_PFR1_VIRTEXT_MASK   U(0xf)
 #define SCTLR_EE_BIT           (ULL(1) << 25)
 #define SCTLR_UCI_BIT          (ULL(1) << 26)
 #define SCTLR_EnIA_BIT         (ULL(1) << 31)
+#define SCTLR_BT0_BIT          (ULL(1) << 35)
+#define SCTLR_BT1_BIT          (ULL(1) << 36)
+#define SCTLR_BT_BIT           (ULL(1) << 36)
 #define SCTLR_DSSBS_BIT                (ULL(1) << 44)
 #define SCTLR_RESET_VAL                SCTLR_EL3_RES1
 
index 6af1d039797691a68c6f9858c9d7428646dbf6c8..1129b8e432995ab175223dc4ac63e69aa3d58ba6 100644 (file)
@@ -48,4 +48,10 @@ static inline bool is_armv8_4_ttst_present(void)
                ID_AA64MMFR2_EL1_ST_MASK) == 1U;
 }
 
+static inline bool is_armv8_5_bti_present(void)
+{
+       return ((read_id_aa64pfr1_el1() >> ID_AA64PFR1_EL1_BT_SHIFT) &
+               ID_AA64PFR1_EL1_BT_MASK) == BTI_IMPLEMENTED;
+}
+
 #endif /* ARCH_FEATURES_H */
index 9b12185591bde73bc3491f2fb66cd01b60e0107e..79e0ad7f3c6517d8bade9a0cd1b0b74759461680 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
  */
 #include <common/asm_macros_common.S>
 #include <lib/spinlock.h>
 
+#if ENABLE_BTI && !ARM_ARCH_AT_LEAST(8, 5)
+#error Branch Target Identification requires ARM_ARCH_MINOR >= 5
+#endif
+
 /*
  * TLBI instruction with type specifier that implements the workaround for
  * errata 813419 of Cortex-A57 or errata 1286807 of Cortex-A76.
        .endm
 #endif
 
+       /*
+        * Helper macro to read system register value into x0
+        */
+       .macro  read reg:req
+#if ENABLE_BTI
+       bti     j
+#endif
+       mrs     x0, \reg
+       ret
+       .endm
+
+       /*
+        * Helper macro to write value from x1 to system register
+        */
+       .macro  write reg:req
+#if ENABLE_BTI
+       bti     j
+#endif
+       msr     \reg, x1
+       ret
+       .endm
+
 #endif /* ASM_MACROS_S */
index 09742af16326496cc0eb0d94b546ce0e18363d1d..fd0ea81d23d66ce81e8e004b8428dba4716bfcf0 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
  */
        .cfi_startproc
        .align \_align
        \_name:
+#if ENABLE_BTI
+       /* When Branch Target Identification is enabled, insert "bti jc"
+        * instruction to enable indirect calls and branches
+        */
+        bti    jc
+#endif
        .endm
 
        /*
index feac1d2f0832edf24187354e00f7b849af24560c..60ed957df2ca75840495e5592e0073ae1ebba75a 100644 (file)
 /* Definitions of register field mask in CORTEX_A55_CPUPWRCTLR_EL1 */
 #define CORTEX_A55_CORE_PWRDN_EN_MASK  U(0x1)
 
+/* 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_A55_H */
index f9bbe0f6076314caa1ca252991445e890039cd1f..000811f3cf8d02985ed8dd991a503a0772cda2cd 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
  */
 #define OSH                    (U(0x2) << 6)
 #define ISH                    (U(0x3) << 6)
 
+#ifdef AARCH64
+/* Guarded Page bit */
+#define GP                     (ULL(1) << 50)
+#endif
+
 #define TABLE_ADDR_MASK                ULL(0x0000FFFFFFFFF000)
 
 /*
index 9c40b9db869779243d20dccb813d630f7c7d716c..9ef8ca79bfe49f067044d4ee513743e1dda7afdf 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013-2014, ARM Limited and Contributors. All rights reserved.
+ * Copyright (c) 2013-2019, ARM Limited and Contributors. All rights reserved.
  *
  * SPDX-License-Identifier: BSD-3-Clause
  */
@@ -91,6 +91,9 @@ func do_dcsw_op
        cbz     x3, exit
        adr     x14, dcsw_loop_table    // compute inner loop address
        add     x14, x14, x0, lsl #5    // inner loop is 8x32-bit instructions
+#if ENABLE_BTI
+       add     x14, x14, x0, lsl #2    // inner loop is + "bti j" instruction
+#endif
        mov     x0, x9
        mov     w8, #1
 loop1:
@@ -116,6 +119,9 @@ loop1:
        br      x14                     // jump to DC operation specific loop
 
        .macro  dcsw_loop _op
+#if ENABLE_BTI
+       bti     j
+#endif
 loop2_\_op:
        lsl     w7, w6, w2              // w7 = aligned max set number
 
index 0ef373a0a80f4306207c6545e73589b473f2c446..8e138244b83fa575d2164481153db372be95fe89 100644 (file)
@@ -175,6 +175,53 @@ func check_errata_903758
        b       cpu_rev_var_ls
 endfunc check_errata_903758
 
+       /* -----------------------------------------------------
+        * Errata Workaround for Cortex A55 Errata #1221012.
+        * This applies only to revisions <= r1p0 of Cortex A55.
+        * Inputs:
+        * x0: variant[4:7] and revision[0:3] of current cpu.
+        * Shall clobber: x0-x17
+        * -----------------------------------------------------
+        */
+func errata_a55_1221012_wa
+       /*
+        * Compare x0 against revision r1p0
+        */
+       mov     x17, x30
+       bl      check_errata_1221012
+       cbz     x0, 1f
+       mov     x0, #0x0020
+       movk    x0, #0x0850, lsl #16
+       msr     CPUPOR_EL3, x0
+       mov     x0, #0x0000
+       movk    x0, #0x1FF0, lsl #16
+       movk    x0, #0x2, lsl #32
+       msr     CPUPMR_EL3, x0
+       mov     x0, #0x03fd
+       movk    x0, #0x0110, lsl #16
+       msr     CPUPCR_EL3, x0
+       mov     x0, #0x1
+       msr     CPUPSELR_EL3, x0
+       mov     x0, #0x0040
+       movk    x0, #0x08D0, lsl #16
+       msr     CPUPOR_EL3, x0
+       mov     x0, #0x0040
+       movk    x0, #0x1FF0, lsl #16
+       movk    x0, #0x2, lsl #32
+       msr     CPUPMR_EL3, x0
+       mov     x0, #0x03fd
+       movk    x0, #0x0110, lsl #16
+       msr     CPUPCR_EL3, x0
+       isb
+1:
+       ret     x17
+endfunc errata_a55_1221012_wa
+
+func check_errata_1221012
+       mov     x1, #0x10
+       b       cpu_rev_var_ls
+endfunc check_errata_1221012
+
 func cortex_a55_reset_func
        mov     x19, x30
 
@@ -214,6 +261,11 @@ func cortex_a55_reset_func
        bl      errata_a55_903758_wa
 #endif
 
+#if ERRATA_A55_1221012
+       mov     x0, x18
+       bl      errata_a55_1221012_wa
+#endif
+
        ret     x19
 endfunc cortex_a55_reset_func
 
@@ -253,6 +305,7 @@ func cortex_a55_errata_report
        report_errata ERRATA_A55_798797, cortex_a55, 798797
        report_errata ERRATA_A55_846532, cortex_a55, 846532
        report_errata ERRATA_A55_903758, cortex_a55, 903758
+       report_errata ERRATA_A55_1221012, cortex_a55, 1221012
 
        ldp     x8, x30, [sp], #16
        ret
index b48283cbb9e8a9cc70532212d614908d8e0b689e..868667ebc2fbbd09f64f7366569249c4c7e9df4a 100644 (file)
 #error "Cortex-A76 must be compiled with HW_ASSISTED_COHERENCY enabled"
 #endif
 
+/* 64-bit only core */
+#if CTX_INCLUDE_AARCH32_REGS == 1
+#error "Cortex-A76 supports only AArch64. Compile with CTX_INCLUDE_AARCH32_REGS=0"
+#endif
+
 #define ESR_EL3_A64_SMC0       0x5e000000
 #define ESR_EL3_A32_SMC0       0x4e000000
 
index 46e9450f29d4f2736114d251c3b193ae3a51d2b8..888f98b5052589e489c579bc31028ddcd9312774 100644 (file)
 /* Hardware handled coherency */
 #if HW_ASSISTED_COHERENCY == 0
 #error "Cortex-A76AE must be compiled with HW_ASSISTED_COHERENCY enabled"
+#endif
+
+/* 64-bit only core */
+#if CTX_INCLUDE_AARCH32_REGS == 1
+#error "Cortex-A76AE supports only AArch64. Compile with CTX_INCLUDE_AARCH32_REGS=0"
 #endif
 
        /* ---------------------------------------------
index e73e89f73843c7605170030d4ca23bf684ac3af0..df4c128532624c0e6653d6d140d0c563f3d5e18f 100644 (file)
 /* Hardware handled coherency */
 #if HW_ASSISTED_COHERENCY == 0
 #error "Deimos must be compiled with HW_ASSISTED_COHERENCY enabled"
+#endif
+
+/* 64-bit only core */
+#if CTX_INCLUDE_AARCH32_REGS == 1
+#error "Cortex-Deimos supports only AArch64. Compile with CTX_INCLUDE_AARCH32_REGS=0"
 #endif
 
        /* ---------------------------------------------
index 79b72883b3746682d5d73c9b795aede21dcce8e3..5a77fc7b30227e4d50760ef6ee957f2c304b77d8 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
  */
  */
 func cpuamu_cnt_read
        adr     x1, 1f
-       lsl     x0, x0, #3
-       add     x1, x1, x0
+       add     x1, x1, x0, lsl #3      /* each mrs/ret sequence is 8 bytes */
+#if ENABLE_BTI
+       add     x1, x1, x0, lsl #2      /* + "bti j" instruction */
+#endif
        br      x1
 
-1:
-       mrs     x0, CPUAMEVCNTR0_EL0
-       ret
-       mrs     x0, CPUAMEVCNTR1_EL0
-       ret
-       mrs     x0, CPUAMEVCNTR2_EL0
-       ret
-       mrs     x0, CPUAMEVCNTR3_EL0
-       ret
-       mrs     x0, CPUAMEVCNTR4_EL0
-       ret
+1:     read    CPUAMEVCNTR0_EL0
+       read    CPUAMEVCNTR1_EL0
+       read    CPUAMEVCNTR2_EL0
+       read    CPUAMEVCNTR3_EL0
+       read    CPUAMEVCNTR4_EL0
 endfunc cpuamu_cnt_read
 
 /*
@@ -47,21 +43,17 @@ endfunc cpuamu_cnt_read
  */
 func cpuamu_cnt_write
        adr     x2, 1f
-       lsl     x0, x0, #3
-       add     x2, x2, x0
+       add     x2, x2, x0, lsl #3      /* each msr/ret sequence is 8 bytes */
+#if ENABLE_BTI
+       add     x2, x2, x0, lsl #2      /* + "bti j" instruction */
+#endif
        br      x2
 
-1:
-       msr     CPUAMEVCNTR0_EL0, x0
-       ret
-       msr     CPUAMEVCNTR1_EL0, x0
-       ret
-       msr     CPUAMEVCNTR2_EL0, x0
-       ret
-       msr     CPUAMEVCNTR3_EL0, x0
-       ret
-       msr     CPUAMEVCNTR4_EL0, x0
-       ret
+1:     write   CPUAMEVCNTR0_EL0
+       write   CPUAMEVCNTR1_EL0
+       write   CPUAMEVCNTR2_EL0
+       write   CPUAMEVCNTR3_EL0
+       write   CPUAMEVCNTR4_EL0
 endfunc cpuamu_cnt_write
 
 /*
index 71e7b5171866abff46b181daac610ab5857b7b3f..d840da84b4a637df0042944c377a76651c06179c 100644 (file)
 #error "Neoverse E1 must be compiled with HW_ASSISTED_COHERENCY enabled"
 #endif
 
+/* 64-bit only core */
+#if CTX_INCLUDE_AARCH32_REGS == 1
+#error "Neoverse-E1 supports only AArch64. Compile with CTX_INCLUDE_AARCH32_REGS=0"
+#endif
+
 func neoverse_e1_cpu_pwr_dwn
        mrs     x0, NEOVERSE_E1_CPUPWRCTLR_EL1
        orr     x0, x0, #NEOVERSE_E1_CPUPWRCTLR_EL1_CORE_PWRDN_BIT
index a0babb0ef6af3b9c4bb0347411a110bfa4e9c1a5..dadaf98b42aede5bf23791508be5676963a90d6f 100644 (file)
 #error "Neoverse N1 must be compiled with HW_ASSISTED_COHERENCY enabled"
 #endif
 
+/* 64-bit only core */
+#if CTX_INCLUDE_AARCH32_REGS == 1
+#error "Neoverse-N1 supports only AArch64. Compile with CTX_INCLUDE_AARCH32_REGS=0"
+#endif
+
 /* --------------------------------------------------
  * Errata Workaround for Neoverse N1 Errata
  * This applies to revision r0p0 and r1p0 of Neoverse N1.
index c5241afab0529a70ea0d88e0fcc10b100c74affc..3d850137c108b3ac4e6d4eb36c31c5963291508d 100644 (file)
 /* Hardware handled coherency */
 #if HW_ASSISTED_COHERENCY == 0
 #error "Neoverse Zeus must be compiled with HW_ASSISTED_COHERENCY enabled"
+#endif
+
+/* 64-bit only core */
+#if CTX_INCLUDE_AARCH32_REGS == 1
+#error "Neoverse-Zeus supports only AArch64. Compile with CTX_INCLUDE_AARCH32_REGS=0"
 #endif
 
        /* ---------------------------------------------
index e45d79d99ae0ff2bc153d1100679ac3a0786d1ec..599e11ed5a135085c64d5e5bfc24e0282b340406 100644 (file)
@@ -134,6 +134,10 @@ ERRATA_A55_846532  ?=0
 # only to revision <= r0p1 of the Cortex A55 cpu.
 ERRATA_A55_903758      ?=0
 
+# Flag to apply erratum 1221012 workaround during reset. This erratum applies
+# only to revision <= r1p0 of the Cortex A55 cpu.
+ERRATA_A55_1221012     ?=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
@@ -319,6 +323,10 @@ $(eval $(call add_define,ERRATA_A55_846532))
 $(eval $(call assert_boolean,ERRATA_A55_903758))
 $(eval $(call add_define,ERRATA_A55_903758))
 
+# Process ERRATA_A55_1221012 flag
+$(eval $(call assert_boolean,ERRATA_A55_1221012))
+$(eval $(call add_define,ERRATA_A55_1221012))
+
 # Process ERRATA_A57_806969 flag
 $(eval $(call assert_boolean,ERRATA_A57_806969))
 $(eval $(call add_define,ERRATA_A57_806969))
index e0b1f56414a9711ad6fe5e52f7b3dbadb5e37577..89007a3fb2ebf6ec5ae0271586076bb3a9fbd254 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
  */
  * and return it in `x0`.
  */
 func amu_group0_cnt_read_internal
+       adr     x1, 1f
 #if ENABLE_ASSERTIONS
        /*
         * It can be dangerous to call this function with an
         * out of bounds index.  Ensure `idx` is valid.
         */
-       mov     x1, x0
-       lsr     x1, x1, #2
-       cmp     x1, #0
+       tst     x0, #~3
        ASM_ASSERT(eq)
 #endif
-
        /*
         * Given `idx` calculate address of mrs/ret instruction pair
         * in the table below.
         */
-       adr     x1, 1f
-       lsl     x0, x0, #3              /* each mrs/ret sequence is 8 bytes */
-       add     x1, x1, x0
+       add     x1, x1, x0, lsl #3      /* each mrs/ret sequence is 8 bytes */
+#if ENABLE_BTI
+       add     x1, x1, x0, lsl #2      /* + "bti j" instruction */
+#endif
        br      x1
 
-1:
-       mrs     x0, AMEVCNTR00_EL0      /* index 0 */
-       ret
-       mrs     x0, AMEVCNTR01_EL0      /* index 1 */
-       ret
-       mrs     x0, AMEVCNTR02_EL0      /* index 2 */
-       ret
-       mrs     x0, AMEVCNTR03_EL0      /* index 3 */
-       ret
+1:     read    AMEVCNTR00_EL0          /* index 0 */
+       read    AMEVCNTR01_EL0          /* index 1 */
+       read    AMEVCNTR02_EL0          /* index 2 */
+       read    AMEVCNTR03_EL0          /* index 3 */
 endfunc amu_group0_cnt_read_internal
 
 /*
@@ -58,35 +52,29 @@ endfunc amu_group0_cnt_read_internal
  * Given `idx`, write `val` to the corresponding AMU counter.
  */
 func amu_group0_cnt_write_internal
+       adr     x2, 1f
 #if ENABLE_ASSERTIONS
        /*
         * It can be dangerous to call this function with an
         * out of bounds index.  Ensure `idx` is valid.
         */
-       mov     x2, x0
-       lsr     x2, x2, #2
-       cmp     x2, #0
+       tst     x0, #~3
        ASM_ASSERT(eq)
 #endif
-
        /*
         * Given `idx` calculate address of mrs/ret instruction pair
         * in the table below.
         */
-       adr     x2, 1f
-       lsl     x0, x0, #3              /* each msr/ret sequence is 8 bytes */
-       add     x2, x2, x0
+       add     x2, x2, x0, lsl #3      /* each msr/ret sequence is 8 bytes */
+#if ENABLE_BTI
+       add     x2, x2, x0, lsl #2      /* + "bti j" instruction */
+#endif
        br      x2
 
-1:
-       msr     AMEVCNTR00_EL0, x1      /* index 0 */
-       ret
-       msr     AMEVCNTR01_EL0, x1      /* index 1 */
-       ret
-       msr     AMEVCNTR02_EL0, x1      /* index 2 */
-       ret
-       msr     AMEVCNTR03_EL0, x1      /* index 3 */
-       ret
+1:     write   AMEVCNTR00_EL0          /* index 0 */
+       write   AMEVCNTR01_EL0          /* index 1 */
+       write   AMEVCNTR02_EL0          /* index 2 */
+       write   AMEVCNTR03_EL0          /* index 3 */
 endfunc amu_group0_cnt_write_internal
 
 /*
@@ -96,59 +84,41 @@ endfunc amu_group0_cnt_write_internal
  * and return it in `x0`.
  */
 func amu_group1_cnt_read_internal
+       adr     x1, 1f
 #if ENABLE_ASSERTIONS
        /*
         * It can be dangerous to call this function with an
         * out of bounds index.  Ensure `idx` is valid.
         */
-       mov     x1, x0
-       lsr     x1, x1, #4
-       cmp     x1, #0
+       tst     x0, #~0xF
        ASM_ASSERT(eq)
 #endif
-
        /*
         * Given `idx` calculate address of mrs/ret instruction pair
         * in the table below.
         */
-       adr     x1, 1f
-       lsl     x0, x0, #3              /* each mrs/ret sequence is 8 bytes */
-       add     x1, x1, x0
+       add     x1, x1, x0, lsl #3      /* each mrs/ret sequence is 8 bytes */
+#if ENABLE_BTI
+       add     x1, x1, x0, lsl #2      /* + "bti j" instruction */
+#endif
        br      x1
 
-1:
-       mrs     x0, AMEVCNTR10_EL0      /* index 0 */
-       ret
-       mrs     x0, AMEVCNTR11_EL0      /* index 1 */
-       ret
-       mrs     x0, AMEVCNTR12_EL0      /* index 2 */
-       ret
-       mrs     x0, AMEVCNTR13_EL0      /* index 3 */
-       ret
-       mrs     x0, AMEVCNTR14_EL0      /* index 4 */
-       ret
-       mrs     x0, AMEVCNTR15_EL0      /* index 5 */
-       ret
-       mrs     x0, AMEVCNTR16_EL0      /* index 6 */
-       ret
-       mrs     x0, AMEVCNTR17_EL0      /* index 7 */
-       ret
-       mrs     x0, AMEVCNTR18_EL0      /* index 8 */
-       ret
-       mrs     x0, AMEVCNTR19_EL0      /* index 9 */
-       ret
-       mrs     x0, AMEVCNTR1A_EL0      /* index 10 */
-       ret
-       mrs     x0, AMEVCNTR1B_EL0      /* index 11 */
-       ret
-       mrs     x0, AMEVCNTR1C_EL0      /* index 12 */
-       ret
-       mrs     x0, AMEVCNTR1D_EL0      /* index 13 */
-       ret
-       mrs     x0, AMEVCNTR1E_EL0      /* index 14 */
-       ret
-       mrs     x0, AMEVCNTR1F_EL0      /* index 15 */
-       ret
+1:     read    AMEVCNTR10_EL0          /* index 0 */
+       read    AMEVCNTR11_EL0          /* index 1 */
+       read    AMEVCNTR12_EL0          /* index 2 */
+       read    AMEVCNTR13_EL0          /* index 3 */
+       read    AMEVCNTR14_EL0          /* index 4 */
+       read    AMEVCNTR15_EL0          /* index 5 */
+       read    AMEVCNTR16_EL0          /* index 6 */
+       read    AMEVCNTR17_EL0          /* index 7 */
+       read    AMEVCNTR18_EL0          /* index 8 */
+       read    AMEVCNTR19_EL0          /* index 9 */
+       read    AMEVCNTR1A_EL0          /* index 10 */
+       read    AMEVCNTR1B_EL0          /* index 11 */
+       read    AMEVCNTR1C_EL0          /* index 12 */
+       read    AMEVCNTR1D_EL0          /* index 13 */
+       read    AMEVCNTR1E_EL0          /* index 14 */
+       read    AMEVCNTR1F_EL0          /* index 15 */
 endfunc amu_group1_cnt_read_internal
 
 /*
@@ -157,59 +127,41 @@ endfunc amu_group1_cnt_read_internal
  * Given `idx`, write `val` to the corresponding AMU counter.
  */
 func amu_group1_cnt_write_internal
+       adr     x2, 1f
 #if ENABLE_ASSERTIONS
        /*
         * It can be dangerous to call this function with an
         * out of bounds index.  Ensure `idx` is valid.
         */
-       mov     x2, x0
-       lsr     x2, x2, #4
-       cmp     x2, #0
+       tst     x0, #~0xF
        ASM_ASSERT(eq)
 #endif
-
        /*
         * Given `idx` calculate address of mrs/ret instruction pair
         * in the table below.
         */
-       adr     x2, 1f
-       lsl     x0, x0, #3              /* each msr/ret sequence is 8 bytes */
-       add     x2, x2, x0
+       add     x2, x2, x0, lsl #3      /* each msr/ret sequence is 8 bytes */
+#if ENABLE_BTI
+       add     x2, x2, x0, lsl #2      /* + "bti j" instruction */
+#endif
        br      x2
 
-1:
-       msr     AMEVCNTR10_EL0, x1      /* index 0 */
-       ret
-       msr     AMEVCNTR11_EL0, x1      /* index 1 */
-       ret
-       msr     AMEVCNTR12_EL0, x1      /* index 2 */
-       ret
-       msr     AMEVCNTR13_EL0, x1      /* index 3 */
-       ret
-       msr     AMEVCNTR14_EL0, x1      /* index 4 */
-       ret
-       msr     AMEVCNTR15_EL0, x1      /* index 5 */
-       ret
-       msr     AMEVCNTR16_EL0, x1      /* index 6 */
-       ret
-       msr     AMEVCNTR17_EL0, x1      /* index 7 */
-       ret
-       msr     AMEVCNTR18_EL0, x1      /* index 8 */
-       ret
-       msr     AMEVCNTR19_EL0, x1      /* index 9 */
-       ret
-       msr     AMEVCNTR1A_EL0, x1      /* index 10 */
-       ret
-       msr     AMEVCNTR1B_EL0, x1      /* index 11 */
-       ret
-       msr     AMEVCNTR1C_EL0, x1      /* index 12 */
-       ret
-       msr     AMEVCNTR1D_EL0, x1      /* index 13 */
-       ret
-       msr     AMEVCNTR1E_EL0, x1      /* index 14 */
-       ret
-       msr     AMEVCNTR1F_EL0, x1      /* index 15 */
-       ret
+1:     write   AMEVCNTR10_EL0          /* index 0 */
+       write   AMEVCNTR11_EL0          /* index 1 */
+       write   AMEVCNTR12_EL0          /* index 2 */
+       write   AMEVCNTR13_EL0          /* index 3 */
+       write   AMEVCNTR14_EL0          /* index 4 */
+       write   AMEVCNTR15_EL0          /* index 5 */
+       write   AMEVCNTR16_EL0          /* index 6 */
+       write   AMEVCNTR17_EL0          /* index 7 */
+       write   AMEVCNTR18_EL0          /* index 8 */
+       write   AMEVCNTR19_EL0          /* index 9 */
+       write   AMEVCNTR1A_EL0          /* index 10 */
+       write   AMEVCNTR1B_EL0          /* index 11 */
+       write   AMEVCNTR1C_EL0          /* index 12 */
+       write   AMEVCNTR1D_EL0          /* index 13 */
+       write   AMEVCNTR1E_EL0          /* index 14 */
+       write   AMEVCNTR1F_EL0          /* index 15 */
 endfunc amu_group1_cnt_write_internal
 
 /*
@@ -219,63 +171,43 @@ endfunc amu_group1_cnt_write_internal
  * with the value `val`.
  */
 func amu_group1_set_evtype_internal
+       adr     x2, 1f
 #if ENABLE_ASSERTIONS
        /*
         * It can be dangerous to call this function with an
         * out of bounds index.  Ensure `idx` is valid.
         */
-       mov     x2, x0
-       lsr     x2, x2, #4
-       cmp     x2, #0
+       tst     x0, #~0xF
        ASM_ASSERT(eq)
 
        /* val should be between [0, 65535] */
-       mov     x2, x1
-       lsr     x2, x2, #16
-       cmp     x2, #0
+       tst     x1, #~0xFFFF
        ASM_ASSERT(eq)
 #endif
-
        /*
         * Given `idx` calculate address of msr/ret instruction pair
         * in the table below.
         */
-       adr     x2, 1f
-       lsl     x0, x0, #3              /* each msr/ret sequence is 8 bytes */
-       add     x2, x2, x0
+       add     x2, x2, x0, lsl #3      /* each msr/ret sequence is 8 bytes */
+#if ENABLE_BTI
+       add     x2, x2, x0, lsl #2      /* + "bti j" instruction */
+#endif
        br      x2
 
-1:
-       msr     AMEVTYPER10_EL0, x1     /* index 0 */
-       ret
-       msr     AMEVTYPER11_EL0, x1     /* index 1 */
-       ret
-       msr     AMEVTYPER12_EL0, x1     /* index 2 */
-       ret
-       msr     AMEVTYPER13_EL0, x1     /* index 3 */
-       ret
-       msr     AMEVTYPER14_EL0, x1     /* index 4 */
-       ret
-       msr     AMEVTYPER15_EL0, x1     /* index 5 */
-       ret
-       msr     AMEVTYPER16_EL0, x1     /* index 6 */
-       ret
-       msr     AMEVTYPER17_EL0, x1     /* index 7 */
-       ret
-       msr     AMEVTYPER18_EL0, x1     /* index 8 */
-       ret
-       msr     AMEVTYPER19_EL0, x1     /* index 9 */
-       ret
-       msr     AMEVTYPER1A_EL0, x1     /* index 10 */
-       ret
-       msr     AMEVTYPER1B_EL0, x1     /* index 11 */
-       ret
-       msr     AMEVTYPER1C_EL0, x1     /* index 12 */
-       ret
-       msr     AMEVTYPER1D_EL0, x1     /* index 13 */
-       ret
-       msr     AMEVTYPER1E_EL0, x1     /* index 14 */
-       ret
-       msr     AMEVTYPER1F_EL0, x1     /* index 15 */
-       ret
+1:     write   AMEVTYPER10_EL0         /* index 0 */
+       write   AMEVTYPER11_EL0         /* index 1 */
+       write   AMEVTYPER12_EL0         /* index 2 */
+       write   AMEVTYPER13_EL0         /* index 3 */
+       write   AMEVTYPER14_EL0         /* index 4 */
+       write   AMEVTYPER15_EL0         /* index 5 */
+       write   AMEVTYPER16_EL0         /* index 6 */
+       write   AMEVTYPER17_EL0         /* index 7 */
+       write   AMEVTYPER18_EL0         /* index 8 */
+       write   AMEVTYPER19_EL0         /* index 9 */
+       write   AMEVTYPER1A_EL0         /* index 10 */
+       write   AMEVTYPER1B_EL0         /* index 11 */
+       write   AMEVTYPER1C_EL0         /* index 12 */
+       write   AMEVTYPER1D_EL0         /* index 13 */
+       write   AMEVTYPER1E_EL0         /* index 14 */
+       write   AMEVTYPER1F_EL0         /* index 15 */
 endfunc amu_group1_set_evtype_internal
index 0e6a6fa809b88e4c104b1be83f99bd2e9f304c30..4f62f469f50cd24e99255ae39d3638cd3d9ee081 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
  */
@@ -12,6 +12,7 @@
 
 #include <platform_def.h>
 
+#include <arch_features.h>
 #include <arch_helpers.h>
 #include <common/debug.h>
 #include <lib/utils_def.h>
@@ -195,6 +196,18 @@ uint64_t xlat_desc(const xlat_ctx_t *ctx, uint32_t attr,
 
                if (mem_type == MT_MEMORY) {
                        desc |= LOWER_ATTRS(ATTR_IWBWA_OWBWA_NTR_INDEX | ISH);
+
+                       /* Check if Branch Target Identification is enabled */
+#if ENABLE_BTI
+                       /* Set GP bit for block and page code entries
+                        * if BTI mechanism is implemented.
+                        */
+                       if (is_armv8_5_bti_present() &&
+                          ((attr & (MT_TYPE_MASK | MT_RW |
+                               MT_EXECUTE_NEVER)) == MT_CODE)) {
+                               desc |= GP;
+                       }
+#endif
                } else {
                        assert(mem_type == MT_NON_CACHEABLE);
                        desc |= LOWER_ATTRS(ATTR_NON_CACHEABLE_INDEX | OSH);
index f5848a255ea912a2d62ab528a1fce7a9b7ba2cb3..761d00c3df24fd8790d35594d6495c82fd5a9ddb 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
  */
@@ -96,6 +96,13 @@ static void xlat_desc_print(const xlat_ctx_t *ctx, uint64_t desc)
        }
 
        printf(((LOWER_ATTRS(NS) & desc) != 0ULL) ? "-NS" : "-S");
+
+#ifdef AARCH64
+       /* Check Guarded Page bit */
+       if ((desc & GP) != 0ULL) {
+               printf("-GP");
+       }
+#endif
 }
 
 static const char * const level_spacers[] = {
index dc797ed1f61ec34993ca7784ae9b10ac71a0d0e5..6becf8086480e55d2f4d7804c34b39b18d94396b 100644 (file)
@@ -33,6 +33,9 @@ BL2_AT_EL3                    := 0
 # when BL2_AT_EL3 is 1.
 BL2_IN_XIP_MEM                 := 0
 
+# Select the branch protection features to use.
+BRANCH_PROTECTION              := 0
+
 # By default, consider that the platform may release several CPUs out of reset.
 # The platform Makefile is free to override this value.
 COLD_BOOT_SINGLE_CPU           := 0
@@ -90,7 +93,14 @@ ENABLE_STACK_PROTECTOR               := 0
 # Flag to enable exception handling in EL3
 EL3_EXCEPTION_HANDLING         := 0
 
-# Flag to enable Pointer Authentication
+# Flag to enable Branch Target Identification.
+# Internal flag not meant for direct setting.
+# Use BRANCH_PROTECTION to enable BTI.
+ENABLE_BTI                     := 0
+
+# Flag to enable Pointer Authentication.
+# Internal flag not meant for direct setting.
+# Use BRANCH_PROTECTION to enable PAUTH.
 ENABLE_PAUTH                   := 0
 
 # Build flag to treat usage of deprecated platform and framework APIs as error.
index dbc5c21ba6f5aad9b85c231b9d25bf81eff64272..3cbdfbc4643b384bbc41dd4e661b8de27ac9e0cd 100644 (file)
@@ -96,8 +96,8 @@ FVP_CPU_LIBS          :=      lib/cpus/${ARCH}/aem_generic.S
 
 ifeq (${ARCH}, aarch64)
 
-# select a different set of CPU files, depending on whether we compile with
-# hardware assisted coherency configurations or not
+# select a different set of CPU files, depending on whether we compile for
+# hardware assisted coherency cores or not
 ifeq (${HW_ASSISTED_COHERENCY}, 0)
        FVP_CPU_LIBS    +=      lib/cpus/aarch64/cortex_a35.S                   \
                                lib/cpus/aarch64/cortex_a53.S                   \
@@ -105,14 +105,19 @@ ifeq (${HW_ASSISTED_COHERENCY}, 0)
                                lib/cpus/aarch64/cortex_a72.S                   \
                                lib/cpus/aarch64/cortex_a73.S
 else
-       FVP_CPU_LIBS    +=      lib/cpus/aarch64/cortex_a55.S                   \
-                               lib/cpus/aarch64/cortex_a75.S                   \
-                               lib/cpus/aarch64/cortex_a76.S                   \
-                               lib/cpus/aarch64/cortex_a76ae.S                 \
-                               lib/cpus/aarch64/neoverse_n1.S                  \
-                               lib/cpus/aarch64/neoverse_e1.S                  \
-                               lib/cpus/aarch64/cortex_deimos.S                \
-                               lib/cpus/aarch64/neoverse_zeus.S
+       # AArch64-only cores
+       ifeq (${CTX_INCLUDE_AARCH32_REGS}, 0)
+               FVP_CPU_LIBS    +=      lib/cpus/aarch64/cortex_a76.S           \
+                                       lib/cpus/aarch64/cortex_a76ae.S         \
+                                       lib/cpus/aarch64/neoverse_n1.S          \
+                                       lib/cpus/aarch64/neoverse_e1.S          \
+                                       lib/cpus/aarch64/cortex_deimos.S        \
+                                       lib/cpus/aarch64/neoverse_zeus.S
+       # AArch64/AArch32
+       else
+               FVP_CPU_LIBS    +=      lib/cpus/aarch64/cortex_a55.S           \
+                                       lib/cpus/aarch64/cortex_a75.S
+       endif
 endif
 
 else
index a541ed377a2f59d5f58041274be78b798f3808e2..8bfb5452a748edba7882a217027cfd5a50bfa0ea 100644 (file)
@@ -22,6 +22,7 @@
 #include <plat/common/platform.h>
 
 #include <gpc.h>
+#include <imx_aipstz.h>
 #include <imx_uart.h>
 #include <plat_imx8.h>
 
@@ -31,6 +32,14 @@ static const mmap_region_t imx_mmap[] = {
        {0},
 };
 
+static const struct aipstz_cfg aipstz[] = {
+       {IMX_AIPSTZ1, 0x77777777, 0x77777777, .opacr = {0x0, 0x0, 0x0, 0x0, 0x0}, },
+       {IMX_AIPSTZ2, 0x77777777, 0x77777777, .opacr = {0x0, 0x0, 0x0, 0x0, 0x0}, },
+       {IMX_AIPSTZ3, 0x77777777, 0x77777777, .opacr = {0x0, 0x0, 0x0, 0x0, 0x0}, },
+       {IMX_AIPSTZ4, 0x77777777, 0x77777777, .opacr = {0x0, 0x0, 0x0, 0x0, 0x0}, },
+       {0},
+};
+
 static entry_point_info_t bl32_image_ep_info;
 static entry_point_info_t bl33_image_ep_info;
 
@@ -82,6 +91,7 @@ void bl31_early_platform_setup2(u_register_t arg0, u_register_t arg1,
                mmio_write_32(IMX_CSU_BASE + i * 4, 0x00ff00ff);
        }
 
+       imx_aipstz_init(aipstz);
 
        console_imx_uart_register(IMX_BOOT_UART_BASE, IMX_BOOT_UART_CLK_IN_HZ,
                IMX_CONSOLE_BAUDRATE, &console);
index 9f9ba922c69867b4fb303daea44e74892a690d67..bd1c058396c181c7aad0daabe362241c9408f307 100644 (file)
@@ -19,6 +19,7 @@ IMX_GIC_SOURCES               :=      drivers/arm/gic/v3/gicv3_helpers.c      \
 
 BL31_SOURCES           +=      plat/imx/common/imx8_helpers.S                  \
                                plat/imx/imx8m/gpc_common.c                     \
+                               plat/imx/imx8m/imx_aipstz.c                     \
                                plat/imx/imx8m/imx8m_psci_common.c              \
                                plat/imx/imx8m/imx8mm/imx8mm_bl31_setup.c       \
                                plat/imx/imx8m/imx8mm/imx8mm_psci.c             \
index ea60466f7ebbdf2a3be9c6e9f8e024115932afeb..ce55d7f3134061f0581f824f284976c855010e80 100644 (file)
@@ -22,6 +22,7 @@
 #include <plat/common/platform.h>
 
 #include <gpc.h>
+#include <imx_aipstz.h>
 #include <imx_uart.h>
 #include <plat_imx8.h>
 
@@ -33,6 +34,14 @@ static const mmap_region_t imx_mmap[] = {
        {0},
 };
 
+static const struct aipstz_cfg aipstz[] = {
+       {AIPSTZ1_BASE, 0x77777777, 0x77777777, .opacr = {0x0, 0x0, 0x0, 0x0, 0x0}, },
+       {AIPSTZ2_BASE, 0x77777777, 0x77777777, .opacr = {0x0, 0x0, 0x0, 0x0, 0x0}, },
+       {AIPSTZ3_BASE, 0x77777777, 0x77777777, .opacr = {0x0, 0x0, 0x0, 0x0, 0x0}, },
+       {AIPSTZ4_BASE, 0x77777777, 0x77777777, .opacr = {0x0, 0x0, 0x0, 0x0, 0x0}, },
+       {0},
+};
+
 static entry_point_info_t bl32_image_ep_info;
 static entry_point_info_t bl33_image_ep_info;
 
@@ -118,6 +127,8 @@ void bl31_early_platform_setup2(u_register_t arg0, u_register_t arg1,
                mmio_write_32(IMX_CSU_BASE + i * 4, 0xffffffff);
        }
 
+       imx_aipstz_init(aipstz);
+
        /* config CAAM JRaMID set MID to Cortex A */
        mmio_write_32(CAAM_JR0MID, CAAM_NS_MID);
        mmio_write_32(CAAM_JR1MID, CAAM_NS_MID);
index 3152c7215a64f0f9b88a7410c5719536bd79b4fb..c6bec6f3c4190f686a54dbab4ac66cb4226168cb 100644 (file)
@@ -21,6 +21,7 @@ BL31_SOURCES          +=      plat/imx/common/imx8_helpers.S                  \
                                plat/imx/imx8m/imx8mq/imx8mq_bl31_setup.c       \
                                plat/imx/imx8m/imx8mq/imx8mq_psci.c             \
                                plat/imx/imx8m/gpc_common.c                     \
+                               plat/imx/imx8m/imx_aipstz.c                     \
                                plat/imx/imx8m/imx8m_psci_common.c              \
                                plat/imx/imx8m/imx8mq/gpc.c                     \
                                plat/imx/common/imx8_topology.c                 \
diff --git a/plat/imx/imx8m/imx_aipstz.c b/plat/imx/imx8m/imx_aipstz.c
new file mode 100644 (file)
index 0000000..a36e296
--- /dev/null
@@ -0,0 +1,24 @@
+/*
+ * copyright (c) 2019, arm limited and contributors. all rights reserved.
+ *
+ * spdx-license-identifier: bsd-3-clause
+ */
+
+#include <lib/mmio.h>
+
+#include <imx_aipstz.h>
+
+void imx_aipstz_init(const struct aipstz_cfg *aipstz_cfg)
+{
+       const struct aipstz_cfg *aipstz = aipstz_cfg;
+
+       while (aipstz->base != 0U) {
+               mmio_write_32(aipstz->base + AIPSTZ_MPR0, aipstz->mpr0);
+               mmio_write_32(aipstz->base + AIPSTZ_MPR1, aipstz->mpr1);
+
+               for (int i = 0; i < AIPSTZ_OPACR_NUM; i++)
+                       mmio_write_32(aipstz->base + OPACR_OFFSET(i), aipstz->opacr[i]);
+
+               aipstz++;
+       }
+}
diff --git a/plat/imx/imx8m/include/imx_aipstz.h b/plat/imx/imx8m/include/imx_aipstz.h
new file mode 100644 (file)
index 0000000..7616862
--- /dev/null
@@ -0,0 +1,27 @@
+/*
+ * Copyright (c) 2019, ARM Limited and Contributors. All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+#ifndef IMX_AIPSTZ_H
+#define IMX_AIPSTZ_H
+
+#include <lib/utils_def.h>
+
+#define AIPSTZ_MPR0            U(0x0)
+#define AIPSTZ_MPR1            U(0x4)
+
+#define AIPSTZ_OPACR_NUM       U(0x5)
+#define OPACR_OFFSET(i)                U((i) * 4 + 0x40)
+
+struct aipstz_cfg {
+       uintptr_t base;
+       uint32_t mpr0;
+       uint32_t mpr1;
+       uint32_t opacr[AIPSTZ_OPACR_NUM];
+};
+
+void imx_aipstz_init(const struct aipstz_cfg *aipstz_cfg);
+
+#endif /* IMX_AIPSTZ_H */
index ff0aaeb97c16a1ec4f52165d2d653af0c1d61faa..31d133908afb5971ee3b40d75b4c9fb77407679e 100644 (file)
@@ -7,10 +7,16 @@
 #include <arch_helpers.h>
 #include <common/bl_common.h>
 #include <common/debug.h>
+#include <mcsi/mcsi.h>
 #include <platform_def.h>
 #include <lib/utils.h>
 #include <lib/xlat_tables/xlat_tables.h>
 
+static const int cci_map[] = {
+       PLAT_MT_CCI_CLUSTER0_SL_IFACE_IX,
+       PLAT_MT_CCI_CLUSTER1_SL_IFACE_IX
+};
+
 /* Table of regions to map using the MMU.  */
 const mmap_region_t plat_mmap[] = {
        /* for TF text, RO, RW */
@@ -51,3 +57,28 @@ unsigned int plat_get_syscnt_freq2(void)
 {
        return SYS_COUNTER_FREQ_IN_TICKS;
 }
+
+void plat_mtk_cci_init(void)
+{
+       /* Initialize CCI driver */
+       mcsi_init(PLAT_MT_CCI_BASE, ARRAY_SIZE(cci_map));
+}
+
+void plat_mtk_cci_enable(void)
+{
+       /* Enable CCI coherency for this cluster.
+        * No need for locks as no other cpu is active at the moment.
+        */
+       cci_enable_cluster_coherency(read_mpidr());
+}
+
+void plat_mtk_cci_disable(void)
+{
+       cci_disable_cluster_coherency(read_mpidr());
+}
+
+void plat_mtk_cci_init_sf(void)
+{
+       /* Init mcsi snoop filter. */
+       cci_init_sf();
+}
index 1e5367fc8bab0843c6bfa24d3d357a20ea391ad1..b451189d4bdf91b1155956db88a1bc5ddf4a7d47 100644 (file)
@@ -12,6 +12,7 @@
 #include <common/debug.h>
 #include <drivers/generic_delay_timer.h>
 #include <mcucfg.h>
+#include <mt_gic_v3.h>
 #include <lib/mmio.h>
 #include <mtk_plat_common.h>
 #include <plat_debug.h>
@@ -69,8 +70,8 @@ void bl31_early_platform_setup2(u_register_t arg0, u_register_t arg1,
                                u_register_t arg2, u_register_t arg3)
 {
        struct mtk_bl31_params *arg_from_bl2 = (struct mtk_bl31_params *)arg0;
-
        static console_16550_t console;
+
        console_16550_register(UART0_BASE, UART_CLOCK, UART_BAUDRATE, &console);
 
        NOTICE("MT8183 bl31_setup\n");
@@ -91,6 +92,13 @@ void bl31_platform_setup(void)
 {
        platform_setup_cpu();
        generic_delay_timer_init();
+
+       /* Initialize the GIC driver, CPU and distributor interfaces */
+       mt_gic_driver_init();
+       mt_gic_init();
+
+       /* Init mcsi SF */
+       plat_mtk_cci_init_sf();
 }
 
 /*******************************************************************************
@@ -99,6 +107,9 @@ void bl31_platform_setup(void)
  ******************************************************************************/
 void bl31_plat_arch_setup(void)
 {
+       plat_mtk_cci_init();
+       plat_mtk_cci_enable();
+
        enable_scu(read_mpidr());
 
        plat_configure_mmu_el3(BL_CODE_BASE,
diff --git a/plat/mediatek/mt8183/drivers/mcsi/mcsi.c b/plat/mediatek/mt8183/drivers/mcsi/mcsi.c
new file mode 100644 (file)
index 0000000..cbe7f0a
--- /dev/null
@@ -0,0 +1,211 @@
+/*
+ * Copyright (c) 2019, ARM Limited and Contributors. All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+#include <arch.h>
+#include <arch_helpers.h>
+#include <assert.h>
+#include <common/debug.h>
+#include <lib/mmio.h>
+#include <scu.h>
+#include <mcucfg.h>
+#include <drivers/delay_timer.h>
+#include <mcsi/mcsi.h>
+
+#define MAX_CLUSTERS           5
+
+static unsigned long cci_base_addr;
+static unsigned int cci_cluster_ix_to_iface[MAX_CLUSTERS];
+
+void mcsi_init(unsigned long cci_base,
+               unsigned int num_cci_masters)
+{
+       int i;
+
+       assert(cci_base);
+       assert(num_cci_masters < MAX_CLUSTERS);
+
+       cci_base_addr = cci_base;
+
+       for (i = 0; i < num_cci_masters; i++)
+               cci_cluster_ix_to_iface[i] = SLAVE_IFACE_OFFSET(i);
+}
+
+void mcsi_cache_flush(void)
+{
+       /* timeout is 10ms */
+       int timeout = 10000;
+
+       /* to make flush by SF safe, need to disable BIU DCM */
+       mmio_clrbits_32(CCI_CLK_CTRL, 1 << 8);
+       mmio_write_32(cci_base_addr + FLUSH_SF, 0x1);
+
+       for (; timeout; timeout--, udelay(1)) {
+               if ((mmio_read_32(cci_base_addr + FLUSH_SF) & 0x1) == 0x0)
+                       break;
+       }
+
+       if (!timeout) {
+               INFO("SF lush timeout\n");
+               return;
+       }
+
+       /* enable BIU DCM as it was */
+       mmio_setbits_32(CCI_CLK_CTRL, 1 << 8);
+}
+
+static inline unsigned long get_slave_iface_base(unsigned long mpidr)
+{
+       /*
+        * We assume the TF topology code allocates affinity instances
+        * consecutively from zero.
+        * It is a programming error if this is called without initializing
+        * the slave interface to use for this cluster.
+        */
+       unsigned int cluster_id =
+               (mpidr >> MPIDR_AFF1_SHIFT) & MPIDR_AFFLVL_MASK;
+
+       assert(cluster_id < MAX_CLUSTERS);
+       assert(cci_cluster_ix_to_iface[cluster_id] != 0);
+
+       return cci_base_addr + cci_cluster_ix_to_iface[cluster_id];
+}
+
+void cci_enable_cluster_coherency(unsigned long mpidr)
+{
+       unsigned long slave_base;
+       unsigned int support_ability;
+       unsigned int config = 0;
+       unsigned int pending = 0;
+
+       assert(cci_base_addr);
+       slave_base  = get_slave_iface_base(mpidr);
+       support_ability = mmio_read_32(slave_base);
+
+       pending = (mmio_read_32(
+                  cci_base_addr + SNP_PENDING_REG)) >> SNP_PENDING;
+       while (pending) {
+               pending = (mmio_read_32(
+                          cci_base_addr + SNP_PENDING_REG)) >> SNP_PENDING;
+       }
+
+       if (support_ability & SNP_SUPPORT)
+               config |= SNOOP_EN_BIT;
+       if (support_ability & DVM_SUPPORT)
+               config |= DVM_EN_BIT;
+
+       mmio_write_32(slave_base, support_ability | config);
+
+       /* Wait for the dust to settle down */
+       while (mmio_read_32(cci_base_addr + SNP_PENDING_REG) >> SNP_PENDING)
+               ;
+}
+
+#if ERRATA_MCSIB_SW
+#pragma weak mcsib_sw_workaround_main
+#endif
+
+void cci_disable_cluster_coherency(unsigned long mpidr)
+{
+       unsigned long slave_base;
+       unsigned int config = 0;
+
+       assert(cci_base_addr);
+       slave_base = get_slave_iface_base(mpidr);
+
+       while (mmio_read_32(cci_base_addr + SNP_PENDING_REG) >> SNP_PENDING)
+               ;
+
+       config = mmio_read_32(slave_base);
+       config &= ~(DVM_EN_BIT | SNOOP_EN_BIT);
+
+       /* Disable Snoops and DVM messages */
+       mmio_write_32(slave_base, config);
+
+#if ERRATA_MCSIB_SW
+       mcsib_sw_workaround_main();
+#endif
+
+       /* Wait for the dust to settle down */
+       while (mmio_read_32(cci_base_addr + SNP_PENDING_REG) >> SNP_PENDING)
+               ;
+}
+
+void cci_secure_switch(unsigned int status)
+{
+       unsigned int config;
+
+       config = mmio_read_32(cci_base_addr + CENTRAL_CTRL_REG);
+       if (status == NS_ACC)
+               config |= SECURE_ACC_EN;
+       else
+               config &= ~SECURE_ACC_EN;
+       mmio_write_32(cci_base_addr + CENTRAL_CTRL_REG, config);
+}
+
+void cci_pmu_secure_switch(unsigned int status)
+{
+       unsigned int config;
+
+       config = mmio_read_32(cci_base_addr + CENTRAL_CTRL_REG);
+       if (status == NS_ACC)
+               config |= PMU_SECURE_ACC_EN;
+       else
+               config &= ~PMU_SECURE_ACC_EN;
+       mmio_write_32(cci_base_addr + CENTRAL_CTRL_REG, config);
+}
+
+void cci_init_sf(void)
+{
+       while (mmio_read_32(cci_base_addr + SNP_PENDING_REG) >> SNP_PENDING)
+               ;
+       /* init sf1 */
+       mmio_write_32(cci_base_addr + SF_INIT_REG, TRIG_SF1_INIT);
+       while (mmio_read_32(cci_base_addr + SF_INIT_REG) & TRIG_SF1_INIT)
+               ;
+       while (!(mmio_read_32(cci_base_addr + SF_INIT_REG) & SF1_INIT_DONE))
+               ;
+       /* init sf2 */
+       mmio_write_32(cci_base_addr + SF_INIT_REG, TRIG_SF2_INIT);
+       while (mmio_read_32(cci_base_addr + SF_INIT_REG) & TRIG_SF2_INIT)
+               ;
+       while (!(mmio_read_32(cci_base_addr + SF_INIT_REG) & SF2_INIT_DONE))
+               ;
+}
+
+void cci_interrupt_en(void)
+{
+       mmio_setbits_32(cci_base_addr + CENTRAL_CTRL_REG, INT_EN);
+}
+
+unsigned long cci_reg_access(unsigned int op, unsigned long offset,
+                            unsigned long val)
+{
+       unsigned long ret = 0;
+
+       if ((cci_base_addr == 0) || (offset > MSCI_MEMORY_SZ))
+               panic();
+
+       switch (op) {
+       case MCSI_REG_ACCESS_READ:
+               ret = mmio_read_32(cci_base_addr + offset);
+               break;
+       case MCSI_REG_ACCESS_WRITE:
+               mmio_write_32(cci_base_addr + offset, val);
+               dsb();
+               break;
+       case MCSI_REG_ACCESS_SET_BITMASK:
+               mmio_setbits_32(cci_base_addr + offset, val);
+               dsb();
+               break;
+       case MCSI_REG_ACCESS_CLEAR_BITMASK:
+               mmio_clrbits_32(cci_base_addr + offset, val);
+               dsb();
+               break;
+       default:
+               break;
+       }
+       return ret;
+}
diff --git a/plat/mediatek/mt8183/drivers/mcsi/mcsi.h b/plat/mediatek/mt8183/drivers/mcsi/mcsi.h
new file mode 100644 (file)
index 0000000..c13e22a
--- /dev/null
@@ -0,0 +1,116 @@
+/*
+ * Copyright (c) 2019, ARM Limited and Contributors. All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+#ifndef MCSI_H
+#define MCSI_H
+
+#define SLAVE_IFACE7_OFFSET            0x1700
+#define SLAVE_IFACE6_OFFSET            0x1600
+#define SLAVE_IFACE5_OFFSET            0x1500
+#define SLAVE_IFACE4_OFFSET            0x1400
+#define SLAVE_IFACE3_OFFSET            0x1300
+#define SLAVE_IFACE2_OFFSET            0x1200
+#define SLAVE_IFACE1_OFFSET            0x1100
+#define SLAVE_IFACE0_OFFSET            0x1000
+#define SLAVE_IFACE_OFFSET(index)      (SLAVE_IFACE0_OFFSET + \
+                                                       (0x100 * (index)))
+/* Control and ID register offsets */
+#define CENTRAL_CTRL_REG               0x0
+#define ERR_FLAG_REG                   0x4
+#define SF_INIT_REG                    0x10
+#define SF_CTRL_REG                    0x14
+#define DCM_CTRL_REG                   0x18
+#define ERR_FLAG2_REG                  0x20
+#define SNP_PENDING_REG                        0x28
+#define ACP_PENDING_REG                        0x2c
+#define FLUSH_SF                       0x500
+#define SYS_CCE_CTRL                   0x2000
+#define MST1_CTRL                      0x2100
+#define MTS2_CTRL                      0x2200
+#define XBAR_ARAW_ARB                  0x3000
+#define XBAR_R_ARB                     0x3004
+
+/* Slave interface register offsets */
+#define SNOOP_CTRL_REG                 0x0
+#define QOS_CTRL_REG                   0x4
+#define QOS_OVERRIDE_REG               0x8
+#define QOS_TARGET_REG                 0xc
+#define BD_CTRL_REG                    0x40
+
+/* Snoop Control register bit definitions */
+#define DVM_SUPPORT                    (1 << 31)
+#define SNP_SUPPORT                    (1 << 30)
+#define SHAREABLE_OVWRT                        (1 << 2)
+#define DVM_EN_BIT                     (1 << 1)
+#define SNOOP_EN_BIT                   (1 << 0)
+#define SF2_INIT_DONE                  (1 << 17)
+#define SF1_INIT_DONE                  (1 << 16)
+#define TRIG_SF2_INIT                  (1 << 1)
+#define TRIG_SF1_INIT                  (1 << 0)
+
+/* Status register bit definitions */
+#define SNP_PENDING                    31
+
+/* Status bit */
+#define NS_ACC                         1
+#define S_ACC                          0
+
+/* Central control register bit definitions */
+#define PMU_SECURE_ACC_EN              (1 << 4)
+#define INT_EN                         (1 << 3)
+#define SECURE_ACC_EN                  (1 << 2)
+#define DVM_DIS                                (1 << 1)
+#define SNOOP_DIS                      (1 << 0)
+
+#define MSCI_MEMORY_SZ                 (0x10000)
+
+#define MCSI_REG_ACCESS_READ           (0x0)
+#define MCSI_REG_ACCESS_WRITE          (0x1)
+#define MCSI_REG_ACCESS_SET_BITMASK    (0x2)
+#define MCSI_REG_ACCESS_CLEAR_BITMASK  (0x3)
+
+#define NR_MAX_SLV                     (7)
+
+/* ICCS */
+#define CACHE_INSTR_EN                 (1 << 2)
+#define IDLE_CACHE                     (1 << 3)
+#define USE_SHARED_CACHE               (1 << 4)
+#define CACHE_SHARED_PRE_EN            (1 << 5)
+#define CACHE_SHARED_POST_EN           (1 << 6)
+
+#define ACP_PENDING_MASK               (0x1007f)
+
+#define CCI_CLK_CTRL                   (MCUCFG_BASE + 0x660)
+
+#ifndef __ASSEMBLY__
+
+#include <plat/common/common_def.h>
+#include <stdint.h>
+
+/* Function declarations */
+
+/*
+ * The MCSI driver must be initialized with the base address of the
+ * MCSI device in the platform memory map, and the cluster indices for
+ * the MCSI slave interfaces 3 and 4 respectively. These are the fully
+ * coherent ACE slave interfaces of MCSI.
+ * The cluster indices must either be 0 or 1, corresponding to the level 1
+ * affinity instance of the mpidr representing the cluster. A negative cluster
+ * index indicates that no cluster is present on that slave interface.
+ */
+void mcsi_init(unsigned long cci_base,
+               unsigned int num_cci_masters);
+void mcsi_cache_flush(void);
+
+void cci_enable_cluster_coherency(unsigned long mpidr);
+void cci_disable_cluster_coherency(unsigned long mpidr);
+
+void cci_secure_switch(unsigned int ns);
+void cci_init_sf(void);
+unsigned long cci_reg_access(unsigned int op, unsigned long offset, unsigned long val);
+
+#endif /* __ASSEMBLY__ */
+#endif /* MCSI_H */
diff --git a/plat/mediatek/mt8183/include/mt_gic_v3.h b/plat/mediatek/mt8183/include/mt_gic_v3.h
new file mode 100644 (file)
index 0000000..e2706f4
--- /dev/null
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 2019, ARM Limited and Contributors. All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+#ifndef MT_GIC_V3_H
+#define MT_GIC_V3_H
+
+#include <lib/mmio.h>
+
+enum irq_schedule_mode {
+       SW_MODE,
+       HW_MODE
+};
+
+#define GIC_INT_MASK (MCUCFG_BASE + 0x5e8)
+#define GIC500_ACTIVE_SEL_SHIFT 3
+#define GIC500_ACTIVE_SEL_MASK (0x7 << GIC500_ACTIVE_SEL_SHIFT)
+#define GIC500_ACTIVE_CPU_SHIFT 16
+#define GIC500_ACTIVE_CPU_MASK (0xff << GIC500_ACTIVE_CPU_SHIFT)
+
+void mt_gic_driver_init(void);
+void mt_gic_init(void);
+void mt_gic_set_pending(uint32_t irq);
+uint32_t mt_gic_get_pending(uint32_t irq);
+void mt_gic_cpuif_enable(void);
+void mt_gic_cpuif_disable(void);
+void mt_gic_pcpu_init(void);
+void mt_gic_irq_save(void);
+void mt_gic_irq_restore(void);
+void mt_gic_sync_dcm_enable(void);
+void mt_gic_sync_dcm_disable(void);
+
+#endif /* MT_GIC_V3_H */
index e57ae45d5c78622fcd710cd6121bd04a9b6a1dda..0853934b9f8a5d18e7cd0ba260f72ed303fce547 100644 (file)
@@ -17,11 +17,10 @@ void plat_configure_mmu_el3(uintptr_t total_base,
                            uintptr_t coh_start,
                            uintptr_t coh_limit);
 
-void plat_cci_init(void);
-void plat_cci_enable(void);
-void plat_cci_disable(void);
-void plat_cci_init_sf(void);
-void plat_gic_init(void);
+void plat_mtk_cci_init(void);
+void plat_mtk_cci_enable(void);
+void plat_mtk_cci_disable(void);
+void plat_mtk_cci_init_sf(void);
 
 /* Declarations for plat_topology.c */
 int mt_setup_topology(void);
diff --git a/plat/mediatek/mt8183/plat_mt_gic.c b/plat/mediatek/mt8183/plat_mt_gic.c
new file mode 100644 (file)
index 0000000..2144379
--- /dev/null
@@ -0,0 +1,146 @@
+/*
+ * Copyright (c) 2019, ARM Limited and Contributors. All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+#include <common/bl_common.h>
+#include <common/debug.h>
+#include <drivers/arm/gicv3.h>
+#include <bl31/interrupt_mgmt.h>
+#include <../drivers/arm/gic/v3/gicv3_private.h>
+#include <mt_gic_v3.h>
+#include <mtk_plat_common.h>
+#include "plat_private.h"
+#include <plat/common/platform.h>
+#include <platform_def.h>
+#include <stdint.h>
+#include <stdio.h>
+
+#define NR_INT_POL_CTL         20
+
+uintptr_t rdistif_base_addrs[PLATFORM_CORE_COUNT];
+
+/*
+ * We save and restore the GICv3 context on system suspend. Allocate the
+ * data in the designated EL3 Secure carve-out memory
+ */
+gicv3_redist_ctx_t rdist_ctx __section("arm_el3_tzc_dram");
+gicv3_dist_ctx_t dist_ctx __section("arm_el3_tzc_dram");
+
+
+static unsigned int mt_mpidr_to_core_pos(u_register_t mpidr)
+{
+       return plat_core_pos_by_mpidr(mpidr);
+}
+
+gicv3_driver_data_t mt_gicv3_data = {
+       .gicd_base = MT_GIC_BASE,
+       .gicr_base = MT_GIC_RDIST_BASE,
+       .rdistif_num = PLATFORM_CORE_COUNT,
+       .rdistif_base_addrs = rdistif_base_addrs,
+       .mpidr_to_core_pos = mt_mpidr_to_core_pos,
+};
+
+void setup_int_schedule_mode(enum irq_schedule_mode mode,
+                            unsigned int active_cpu)
+{
+       assert(mode <= HW_MODE);
+       assert(active_cpu <= 0xFF);
+
+       if (mode == HW_MODE) {
+               mmio_write_32(GIC_INT_MASK,
+               (mmio_read_32(GIC_INT_MASK) & ~(GIC500_ACTIVE_SEL_MASK))
+               | (0x1 << GIC500_ACTIVE_SEL_SHIFT));
+       } else if (mode == SW_MODE) {
+               mmio_write_32(GIC_INT_MASK,
+               (mmio_read_32(GIC_INT_MASK) & ~(GIC500_ACTIVE_SEL_MASK)));
+       }
+
+       mmio_write_32(GIC_INT_MASK,
+               (mmio_read_32(GIC_INT_MASK) & ~(GIC500_ACTIVE_CPU_MASK))
+               | (active_cpu << GIC500_ACTIVE_CPU_SHIFT));
+       return;
+}
+
+void clear_sec_pol_ctl_en(void)
+{
+       unsigned int i;
+
+       /* total 19 polarity ctrl registers */
+       for (i = 0; i <= NR_INT_POL_CTL - 1; i++) {
+               mmio_write_32((SEC_POL_CTL_EN0 + (i * 4)), 0);
+       }
+       dsb();
+}
+
+void mt_gic_driver_init(void)
+{
+       gicv3_driver_init(&mt_gicv3_data);
+}
+
+void mt_gic_init(void)
+{
+       gicv3_distif_init();
+       gicv3_rdistif_init(plat_my_core_pos());
+       gicv3_cpuif_enable(plat_my_core_pos());
+
+       setup_int_schedule_mode(SW_MODE, 0xf);
+       clear_sec_pol_ctl_en();
+}
+
+void mt_gic_set_pending(uint32_t irq)
+{
+       gicv3_set_interrupt_pending(irq, plat_my_core_pos());
+}
+
+uint32_t mt_gic_get_pending(uint32_t irq)
+{
+       uint32_t bit = 1 << (irq % 32);
+
+       return (mmio_read_32(gicv3_driver_data->gicd_base +
+                            GICD_ISPENDR + irq / 32 * 4) & bit) ? 1 : 0;
+}
+
+void mt_gic_cpuif_enable(void)
+{
+       gicv3_cpuif_enable(plat_my_core_pos());
+}
+
+void mt_gic_cpuif_disable(void)
+{
+       gicv3_cpuif_disable(plat_my_core_pos());
+}
+
+void mt_gic_pcpu_init(void)
+{
+       gicv3_rdistif_init(plat_my_core_pos());
+}
+
+void mt_gic_irq_save(void)
+{
+       gicv3_rdistif_save(plat_my_core_pos(), &rdist_ctx);
+       gicv3_distif_save(&dist_ctx);
+}
+
+void mt_gic_irq_restore(void)
+{
+       gicv3_distif_init_restore(&dist_ctx);
+       gicv3_rdistif_init_restore(plat_my_core_pos(), &rdist_ctx);
+}
+
+void mt_gic_sync_dcm_enable(void)
+{
+       unsigned int val = mmio_read_32(GIC_SYNC_DCM);
+
+       val &= ~GIC_SYNC_DCM_MASK;
+       mmio_write_32(GIC_SYNC_DCM, val | GIC_SYNC_DCM_ON);
+}
+
+void mt_gic_sync_dcm_disable(void)
+{
+       unsigned int val = mmio_read_32(GIC_SYNC_DCM);
+
+       val &= ~GIC_SYNC_DCM_MASK;
+       mmio_write_32(GIC_SYNC_DCM, val | GIC_SYNC_DCM_OFF);
+}
index 2ceb45977088d81f5ed191f4f0de1e213b92893b..8c8e2fe9cc215745ccdba81fb28afcb1af3f9e28 100644 (file)
@@ -8,18 +8,20 @@ MTK_PLAT      := plat/mediatek
 MTK_PLAT_SOC  := ${MTK_PLAT}/${PLAT}
 
 PLAT_INCLUDES := -I${MTK_PLAT}/common/                            \
+                 -I${MTK_PLAT_SOC}/drivers/                       \
                  -I${MTK_PLAT_SOC}/include/
 
 PLAT_BL_COMMON_SOURCES := lib/xlat_tables/aarch64/xlat_tables.c       \
                           lib/xlat_tables/xlat_tables_common.c        \
-                          plat/common/plat_gicv2.c                    \
                           plat/common/plat_psci_common.c              \
                           plat/common/aarch64/crash_console_helpers.S
 
 BL31_SOURCES    += drivers/arm/cci/cci.c                                 \
                    drivers/arm/gic/common/gic_common.c                   \
-                   drivers/arm/gic/v2/gicv2_main.c                       \
-                   drivers/arm/gic/v2/gicv2_helpers.c                    \
+                   drivers/arm/gic/v3/arm_gicv3_common.c                 \
+                   drivers/arm/gic/v3/gicv3_helpers.c                    \
+                   drivers/arm/gic/v3/gic500.c                           \
+                   drivers/arm/gic/v3/gicv3_main.c                       \
                    drivers/delay_timer/delay_timer.c                     \
                    drivers/delay_timer/generic_delay_timer.c             \
                    drivers/gpio/gpio.c                                   \
@@ -27,11 +29,14 @@ BL31_SOURCES    += drivers/arm/cci/cci.c                                 \
                    lib/cpus/aarch64/aem_generic.S                        \
                    lib/cpus/aarch64/cortex_a53.S                         \
                    lib/cpus/aarch64/cortex_a73.S                         \
+                   plat/common/plat_gicv3.c                              \
                    ${MTK_PLAT}/common/mtk_plat_common.c                  \
                    ${MTK_PLAT_SOC}/aarch64/plat_helpers.S                \
                    ${MTK_PLAT_SOC}/aarch64/platform_common.c             \
+                   ${MTK_PLAT_SOC}/drivers/mcsi/mcsi.c                   \
                    ${MTK_PLAT_SOC}/plat_pm.c                             \
                    ${MTK_PLAT_SOC}/plat_topology.c                       \
+                   ${MTK_PLAT_SOC}/plat_mt_gic.c                         \
                    ${MTK_PLAT_SOC}/bl31_plat_setup.c                     \
                    ${MTK_PLAT_SOC}/plat_debug.c                          \
                    ${MTK_PLAT_SOC}/scu.c
index 7fe05292ddf0f9cf3ec51624fbfc66f65f520f1c..f8ce6605bdbcf4ec21e61448e724504a168ac3c6 100644 (file)
@@ -70,12 +70,6 @@ void bl31_early_platform_setup2(u_register_t arg0, u_register_t arg1,
        /* Initialize the console to provide early debug support */
        gxbb_console_init();
 
-       /*
-        * In debug builds, we pass a special value in 'arg1' to verify platform
-        * parameters from BL2 to BL31. In release builds it's not used.
-        */
-       assert(arg1 == GXBB_BL31_PLAT_PARAM_VAL);
-
        /* Check that params passed from BL2 are not NULL. */
        from_bl2 = (struct gxl_bl31_param *) arg0;
 
index 30782d1d5139c41e4b8ba704a5ff0f371ae81999..18f8dd915e9304f40b75758e2c796018a5f3d14d 100644 (file)
 #include <plat_private.h>
 #include <plat/common/platform.h>
 
-/*
- * The next 2 constants identify the extents of the code & RO data region.
- * These addresses are used by the MMU setup code and therefore they must be
- * page-aligned.  It is the responsibility of the linker script to ensure that
- * __RO_START__ and __RO_END__ linker symbols refer to page-aligned addresses.
- */
-IMPORT_SYM(unsigned long, __RO_START__,        BL31_RO_BASE);
-IMPORT_SYM(unsigned long, __RO_END__,  BL31_RO_LIMIT);
-
 static entry_point_info_t bl32_ep_info;
 static entry_point_info_t bl33_ep_info;
 
@@ -116,10 +107,10 @@ void bl31_plat_arch_setup(void)
 {
        plat_cci_init();
        plat_cci_enable();
-       plat_configure_mmu_el3(BL31_RO_BASE,
-                              BL_COHERENT_RAM_END - BL31_RO_BASE,
-                              BL31_RO_BASE,
-                              BL31_RO_LIMIT,
+       plat_configure_mmu_el3(BL_CODE_BASE,
+                              BL_COHERENT_RAM_END - BL_CODE_BASE,
+                              BL_CODE_BASE,
+                              BL_CODE_END,
                               BL_COHERENT_RAM_BASE,
                               BL_COHERENT_RAM_END);
 }
index 1ab1af54c549d36d6b125fd39405f4ed0d1666ff..3afca591ec974b80b9af0a071838cb44de53fb70 100644 (file)
@@ -6,6 +6,8 @@
 
 #include <arch.h>
 #include <asm_macros.S>
+#include <cortex_a72.h>
+#include <cpu_macros.S>
 #include <platform_def.h>
 
 #define K3_BOOT_REASON_COLD_RESET 0x1
@@ -89,6 +91,26 @@ out:
        ret
 endfunc plat_my_core_pos
 
+       /* --------------------------------------------------------------------
+        * This handler does the following:
+        * - Set the L2 Data RAM latency to 2 (i.e. 3 cycles) for Cortex-A72
+        * --------------------------------------------------------------------
+        */
+       .globl plat_reset_handler
+func plat_reset_handler
+       /* Only on Cortex-A72 */
+       jump_if_cpu_midr CORTEX_A72_MIDR, a72
+       ret
+
+       /* Cortex-A72 specific settings */
+a72:
+       mrs x0, CORTEX_A72_L2CTLR_EL1
+       orr x0, x0, #(CORTEX_A72_L2_DATA_RAM_LATENCY_3_CYCLES << CORTEX_A72_L2CTLR_DATA_RAM_LATENCY_SHIFT)
+       msr CORTEX_A72_L2CTLR_EL1, x0
+       isb
+       ret
+endfunc plat_reset_handler
+
        /* ---------------------------------------------
         * int plat_crash_console_init(void)
         * Function to initialize the crash console
index 29fcafdb94fc7983706d05da9f61b9eb401b65e9..2e5f5845365c35da470b59df99462ecb11165714 100644 (file)
@@ -22,6 +22,9 @@ ERRATA_A53_836870     :=      1
 ERRATA_A53_843419      :=      1
 ERRATA_A53_855873      :=      1
 
+# A72 Erratum for SoC
+ERRATA_A72_859971      :=      1
+
 # Split out RO data into a non-executable section
 SEPARATE_CODE_AND_RODATA :=    1
 
@@ -68,6 +71,7 @@ K3_TI_SCI_SOURCES     +=      \
 
 PLAT_BL_COMMON_SOURCES +=      \
                                lib/cpus/aarch64/cortex_a53.S           \
+                               lib/cpus/aarch64/cortex_a72.S           \
                                ${XLAT_TABLES_LIB_SRCS}                 \
                                ${K3_CONSOLE_SOURCES}                   \
 
index 2737d5c6714b43c5e1897a6682558be07087ad6b..6846419978ec99d2221a27f71275f922af15b16f 100644 (file)
@@ -282,20 +282,13 @@ See the `Contributing Guidelines`_ for information on how to contribute to this
 project and the `Acknowledgments`_ file for a list of contributors to the
 project.
 
-IRC channel
-~~~~~~~~~~~
+Contact us
+~~~~~~~~~~
 
-Development discussion takes place on the #trusted-firmware-a channel
-on the Freenode IRC network. This is not an official support channel.
-If you have an issue to raise, please use the `issue tracker`_.
-
-Feedback and support
-~~~~~~~~~~~~~~~~~~~~
-
-Arm welcomes any feedback on TF-A. If you think you have found a security
+We welcome any feedback on TF-A. If you think you have found a security
 vulnerability, please report this using the process defined in the TF-A
-`Security Center`_. For all other feedback, please use the
-`issue tracker`_.
+`Security Center`_. For all other feedback, you can use either the
+`issue tracker`_ or our `mailing list`_.
 
 Arm licensees may contact Arm directly via their partner managers.
 
@@ -335,14 +328,15 @@ Security advisories
 .. _Trusty Secure OS: https://source.android.com/security/trusty
 .. _trustedfirmware.org: https://git.trustedfirmware.org/TF-A/trusted-firmware-a.git
 .. _issue tracker: https://developer.trustedfirmware.org/project/board/1/
-.. _Security Center: ./docs/security-center.rst
+.. _mailing list: https://lists.trustedfirmware.org/mailman/listinfo/tf-a
+.. _Security Center: ./docs/process/security.rst
 .. _license: ./license.rst
-.. _Contributing Guidelines: ./contributing.rst
-.. _Acknowledgments: ./acknowledgements.rst
-.. _Firmware Design: ./docs/firmware-design.rst
+.. _Contributing Guidelines: ./docs/process/contributing.rst
+.. _Acknowledgments: ./docs/acknowledgements.rst
+.. _Firmware Design: ./docs/design/firmware-design.rst
 .. _Change Log: ./docs/change-log.rst
-.. _User Guide: ./docs/user-guide.rst
-.. _Porting Guide: ./docs/porting-guide.rst
+.. _User Guide: ./docs/getting_started/user-guide.rst
+.. _Porting Guide: ./docs/getting_started/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