diff options
author | Eleanor Bonnici <Eleanor.bonnici@arm.com> | 2017-08-02 18:33:41 +0100 |
---|---|---|
committer | Kostya Porotchkin <kostap@marvell.com> | 2018-04-16 14:05:18 +0300 |
commit | d1f581f1aae5b7fc75966cd00d4c7e13514a2f3f (patch) | |
tree | 047802644e9e05cf9ca70636ee3974a60d3a99af | |
parent | 7c3a542da2128e4c2d09c191b00b6e00c3c4fc50 (diff) |
Cortex-A72: Implement workaround for erratum 859971
Erratum 855971 applies to revision r0p3 or earlier Cortex-A72 CPUs. The
recommended workaround is to disable instruction prefetch.
Change-Id: I7fde74ee2a8a23b2a8a1891b260f0eb909fad4bf
Signed-off-by: Eleanor Bonnici <Eleanor.bonnici@arm.com>
Signed-off-by: Jeenu Viswambharan <jeenu.viswambharan@arm.com>
Reviewed-on: http://vgitil04.il.marvell.com:8080/53228
Tested-by: iSoC Platform CI <ykjenk@marvell.com>
Reviewed-by: Kostya Porotchkin <kostap@marvell.com>
-rw-r--r-- | docs/cpu-specific-build-macros.rst | 2 | ||||
-rw-r--r-- | include/lib/cpus/aarch32/cortex_a72.h | 1 | ||||
-rw-r--r-- | include/lib/cpus/aarch64/cortex_a72.h | 1 | ||||
-rw-r--r-- | lib/cpus/aarch32/cortex_a72.S | 56 | ||||
-rw-r--r-- | lib/cpus/aarch64/cortex_a72.S | 59 | ||||
-rw-r--r-- | lib/cpus/cpu-ops.mk | 8 |
6 files changed, 124 insertions, 3 deletions
diff --git a/docs/cpu-specific-build-macros.rst b/docs/cpu-specific-build-macros.rst index b8fe13d0..e512d099 100644 --- a/docs/cpu-specific-build-macros.rst +++ b/docs/cpu-specific-build-macros.rst @@ -30,6 +30,7 @@ by ARM: - `Cortex-A53 MPCore Software Developers Errata Notice`_ - `Cortex-A57 MPCore Software Developers Errata Notice`_ +- `Cortex-A72 MPCore Software Developers Errata Notice`_ The errata workarounds are implemented for a particular revision or a set of processor revisions. This is checked by the reset handler at runtime. Each @@ -133,5 +134,6 @@ architecture that can be enabled by the platform as desired. .. _CVE-2017-5715: http://www.cve.mitre.org/cgi-bin/cvename.cgi?name=2017-5715 .. _Cortex-A53 MPCore Software Developers Errata Notice: http://infocenter.arm.com/help/topic/com.arm.doc.epm048406/index.html .. _Cortex-A57 MPCore Software Developers Errata Notice: http://infocenter.arm.com/help/topic/com.arm.doc.epm049219/cortex_a57_mpcore_software_developers_errata_notice.pdf +.. _Cortex-A72 MPCore Software Developers Errata Notice: http://infocenter.arm.com/help/topic/com.arm.doc.epm012079/index.html .. _Firmware Design guide: firmware-design.rst .. _Cortex-A57 Software Optimization Guide: http://infocenter.arm.com/help/topic/com.arm.doc.uan0015b/Cortex_A57_Software_Optimization_Guide_external.pdf diff --git a/include/lib/cpus/aarch32/cortex_a72.h b/include/lib/cpus/aarch32/cortex_a72.h index 59057bc5..938bacba 100644 --- a/include/lib/cpus/aarch32/cortex_a72.h +++ b/include/lib/cpus/aarch32/cortex_a72.h @@ -33,6 +33,7 @@ #define CORTEX_A72_ACTLR_DISABLE_L1_DCACHE_HW_PFTCH (1 << 56) #define CORTEX_A72_ACTLR_NO_ALLOC_WBWA (1 << 49) #define CORTEX_A72_ACTLR_DCC_AS_DCCI (1 << 44) +#define CORTEX_A72_ACTLR_DIS_INSTR_PREFETCH (1 << 32) /******************************************************************************* * L2 Control register specific definitions. diff --git a/include/lib/cpus/aarch64/cortex_a72.h b/include/lib/cpus/aarch64/cortex_a72.h index 90f0abd9..bfd64918 100644 --- a/include/lib/cpus/aarch64/cortex_a72.h +++ b/include/lib/cpus/aarch64/cortex_a72.h @@ -33,6 +33,7 @@ #define CORTEX_A72_ACTLR_DISABLE_L1_DCACHE_HW_PFTCH (1 << 56) #define CORTEX_A72_ACTLR_NO_ALLOC_WBWA (1 << 49) #define CORTEX_A72_ACTLR_DCC_AS_DCCI (1 << 44) +#define CORTEX_A72_ACTLR_EL1_DIS_INSTR_PREFETCH (1 << 32) /******************************************************************************* * L2 Control register specific definitions. diff --git a/lib/cpus/aarch32/cortex_a72.S b/lib/cpus/aarch32/cortex_a72.S index cdd83adf..7f91cc46 100644 --- a/lib/cpus/aarch32/cortex_a72.S +++ b/lib/cpus/aarch32/cortex_a72.S @@ -61,11 +61,46 @@ func cortex_a72_disable_ext_debug bx lr endfunc cortex_a72_disable_ext_debug + /* --------------------------------------------------- + * Errata Workaround for Cortex A72 Errata #859971. + * This applies only to revision <= r0p3 of Cortex A72. + * Inputs: + * r0: variant[4:7] and revision[0:3] of current cpu. + * Shall clobber: r0-r3 + * --------------------------------------------------- + */ +func errata_a72_859971_wa + mov r2,lr + bl check_errata_859971 + mov lr, r2 + cmp r0, #ERRATA_NOT_APPLIES + beq 1f + ldcopr16 r0, r1, CORTEX_A72_ACTLR + orr64_imm r1, r1, CORTEX_A72_ACTLR_DIS_INSTR_PREFETCH + stcopr16 r0, r1, CORTEX_A72_ACTLR +1: + bx lr +endfunc errata_a72_859971_wa + +func check_errata_859971 + mov r1, #0x03 + b cpu_rev_var_ls +endfunc check_errata_859971 + + /* ------------------------------------------------- * The CPU Ops reset function for Cortex-A72. * ------------------------------------------------- */ func cortex_a72_reset_func + mov r5, lr + bl cpu_get_rev_var + mov r4, r0 + +#if ERRATA_A72_859971 + mov r0, r4 + bl errata_a72_859971_wa +#endif /* --------------------------------------------- * Enable the SMP bit. * --------------------------------------------- @@ -186,6 +221,27 @@ func cortex_a72_cluster_pwr_dwn b cortex_a72_disable_ext_debug endfunc cortex_a72_cluster_pwr_dwn +#if REPORT_ERRATA +/* + * Errata printing function for Cortex A72. Must follow AAPCS. + */ +func cortex_a72_errata_report + push {r12, lr} + + bl cpu_get_rev_var + mov r4, r0 + + /* + * Report all errata. The revision-variant information is passed to + * checking functions of each errata. + */ + report_errata ERRATA_A72_859971, cortex_a72, 859971 + + pop {r12, lr} + bx lr +endfunc cortex_a72_errata_report +#endif + declare_cpu_ops cortex_a72, CORTEX_A72_MIDR, \ cortex_a72_reset_func, \ cortex_a72_core_pwr_dwn, \ diff --git a/lib/cpus/aarch64/cortex_a72.S b/lib/cpus/aarch64/cortex_a72.S index dfc8e553..8e078903 100644 --- a/lib/cpus/aarch64/cortex_a72.S +++ b/lib/cpus/aarch64/cortex_a72.S @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, ARM Limited and Contributors. All rights reserved. + * Copyright (c) 2015-2017, ARM Limited and Contributors. All rights reserved. * * SPDX-License-Identifier: BSD-3-Clause */ @@ -73,11 +73,43 @@ func cortex_a72_disable_ext_debug ret endfunc cortex_a72_disable_ext_debug + /* -------------------------------------------------- + * Errata Workaround for Cortex A72 Errata #859971. + * This applies only to revision <= r0p3 of Cortex A72. + * Inputs: + * x0: variant[4:7] and revision[0:3] of current cpu. + * Shall clobber: + * -------------------------------------------------- + */ +func errata_a72_859971_wa + mov x17,x30 + bl check_errata_859971 + cbz x0, 1f + mrs x1, CORTEX_A72_ACTLR_EL1 + orr x1, x1, #CORTEX_A72_ACTLR_EL1_DIS_INSTR_PREFETCH + msr CORTEX_A72_ACTLR_EL1, x1 +1: + ret x17 +endfunc errata_a72_859971_wa + +func check_errata_859971 + mov x1, #0x03 + b cpu_rev_var_ls +endfunc check_errata_859971 + /* ------------------------------------------------- * The CPU Ops reset function for Cortex-A72. * ------------------------------------------------- */ func cortex_a72_reset_func + mov x19, x30 + bl cpu_get_rev_var + mov x18, x0 + +#if ERRATA_A72_859971 + mov x0, x18 + bl errata_a72_859971_wa +#endif #if IMAGE_BL31 && WORKAROUND_CVE_2017_5715 adr x0, workaround_mmu_runtime_exceptions @@ -85,14 +117,14 @@ func cortex_a72_reset_func #endif /* --------------------------------------------- - * As a bare minimum enable the SMP bit. + * Enable the SMP bit. * --------------------------------------------- */ mrs x0, CORTEX_A72_ECTLR_EL1 orr x0, x0, #CORTEX_A72_ECTLR_SMP_BIT msr CORTEX_A72_ECTLR_EL1, x0 isb - ret + ret x19 endfunc cortex_a72_reset_func /* ---------------------------------------------------- @@ -202,6 +234,27 @@ func cortex_a72_cluster_pwr_dwn b cortex_a72_disable_ext_debug endfunc cortex_a72_cluster_pwr_dwn +#if REPORT_ERRATA +/* + * Errata printing function for Cortex A72. Must follow AAPCS. + */ +func cortex_a72_errata_report + stp x8, x30, [sp, #-16]! + + bl cpu_get_rev_var + mov x8, x0 + + /* + * Report all errata. The revision-variant information is passed to + * checking functions of each errata. + */ + report_errata ERRATA_A72_859971, cortex_a72, 859971 + + ldp x8, x30, [sp], #16 + ret +endfunc cortex_a72_errata_report +#endif + /* --------------------------------------------- * This function provides cortex_a72 specific * register information for crash reporting. diff --git a/lib/cpus/cpu-ops.mk b/lib/cpus/cpu-ops.mk index 54444189..f3abd467 100644 --- a/lib/cpus/cpu-ops.mk +++ b/lib/cpus/cpu-ops.mk @@ -96,6 +96,10 @@ ERRATA_A57_829520 ?=0 # only to revision <= r1p2 of the Cortex A57 cpu. ERRATA_A57_833471 ?=0 +# Flag to apply erratum 855971 workaround during reset. This erratum applies +# only to revision <= r0p3 of the Cortex A72 cpu. +ERRATA_A72_859971 ?=0 + # Process ERRATA_A53_826319 flag $(eval $(call assert_boolean,ERRATA_A53_826319)) $(eval $(call add_define,ERRATA_A53_826319)) @@ -148,6 +152,10 @@ $(eval $(call add_define,ERRATA_A57_829520)) $(eval $(call assert_boolean,ERRATA_A57_833471)) $(eval $(call add_define,ERRATA_A57_833471)) +# Process ERRATA_A72_859971 flag +$(eval $(call assert_boolean,ERRATA_A72_859971)) +$(eval $(call add_define,ERRATA_A72_859971)) + # Errata build flags ifneq (${ERRATA_A53_843419},0) TF_LDFLAGS_aarch64 += --fix-cortex-a53-843419 |