diff options
author | Dimitris Papastamos <dimitris.papastamos@arm.com> | 2018-03-12 13:27:02 +0000 |
---|---|---|
committer | Dimitris Papastamos <dimitris.papastamos@arm.com> | 2018-03-14 11:15:44 +0000 |
commit | 3991a6a49f3cf8d0b30a2800428e60454e2f92dd (patch) | |
tree | 8af432a51fa27ca1dc415bffee189d50b03ce2c9 /include/lib | |
parent | 16b05e94a2d1757cbb98de068c662d58a6919613 (diff) |
Use PFR0 to identify need for mitigation of CVE-2017-5715
If the CSV2 field reads as 1 then branch targets trained in one
context cannot affect speculative execution in a different context.
In that case skip the workaround on Cortex A72 and A73.
Change-Id: Ide24fb6efc77c548e4296295adc38dca87d042ee
Signed-off-by: Dimitris Papastamos <dimitris.papastamos@arm.com>
Diffstat (limited to 'include/lib')
-rw-r--r-- | include/lib/cpus/aarch64/cpu_macros.S | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/include/lib/cpus/aarch64/cpu_macros.S b/include/lib/cpus/aarch64/cpu_macros.S index ccf53066..6c3a5b99 100644 --- a/include/lib/cpus/aarch64/cpu_macros.S +++ b/include/lib/cpus/aarch64/cpu_macros.S @@ -229,3 +229,18 @@ CPU_OPS_SIZE = . #endif #endif /* __CPU_MACROS_S__ */ + + /* + * This macro is used on some CPUs to detect if they are vulnerable + * to CVE-2017-5715. + */ + .macro cpu_check_csv2 _reg _label + mrs \_reg, id_aa64pfr0_el1 + ubfx \_reg, \_reg, #ID_AA64PFR0_CSV2_SHIFT, #ID_AA64PFR0_CSV2_LENGTH + /* + * If the field equals to 1 then branch targets trained in one + * context cannot affect speculative execution in a different context. + */ + cmp \_reg, #1 + beq \_label + .endm |