Skip to content

Commit e85d68f

Browse files
Steven Pricewilldeacon
authored andcommitted
arm64: Rename WORKAROUND_1165522 to SPECULATIVE_AT_VHE
Cortex-A55 is affected by a similar erratum, so rename the existing workaround for errarum 1165522 so it can be used for both errata. Acked-by: Marc Zyngier <[email protected]> Reviewed-by: Suzuki K Poulose <[email protected]> Signed-off-by: Steven Price <[email protected]> Signed-off-by: Will Deacon <[email protected]>
1 parent 46cf053 commit e85d68f

File tree

7 files changed

+23
-10
lines changed

7 files changed

+23
-10
lines changed

arch/arm64/Kconfig

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -514,9 +514,13 @@ config ARM64_ERRATUM_1418040
514514

515515
If unsure, say Y.
516516

517+
config ARM64_WORKAROUND_SPECULATIVE_AT_VHE
518+
bool
519+
517520
config ARM64_ERRATUM_1165522
518521
bool "Cortex-A76: Speculative AT instruction using out-of-context translation regime could cause subsequent request to generate an incorrect translation"
519522
default y
523+
select ARM64_WORKAROUND_SPECULATIVE_AT_VHE
520524
help
521525
This option adds a workaround for ARM Cortex-A76 erratum 1165522.
522526

arch/arm64/include/asm/cpucaps.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
#define ARM64_SSBS 34
4545
#define ARM64_WORKAROUND_1418040 35
4646
#define ARM64_HAS_SB 36
47-
#define ARM64_WORKAROUND_1165522 37
47+
#define ARM64_WORKAROUND_SPECULATIVE_AT_VHE 37
4848
#define ARM64_HAS_ADDRESS_AUTH_ARCH 38
4949
#define ARM64_HAS_ADDRESS_AUTH_IMP_DEF 39
5050
#define ARM64_HAS_GENERIC_AUTH_ARCH 40

arch/arm64/include/asm/kvm_host.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -571,7 +571,7 @@ static inline bool kvm_arch_requires_vhe(void)
571571
return true;
572572

573573
/* Some implementations have defects that confine them to VHE */
574-
if (cpus_have_cap(ARM64_WORKAROUND_1165522))
574+
if (cpus_have_cap(ARM64_WORKAROUND_SPECULATIVE_AT_VHE))
575575
return true;
576576

577577
return false;

arch/arm64/include/asm/kvm_hyp.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ static __always_inline void __hyp_text __load_guest_stage2(struct kvm *kvm)
9595
* before we can switch to the EL1/EL0 translation regime used by
9696
* the guest.
9797
*/
98-
asm(ALTERNATIVE("nop", "isb", ARM64_WORKAROUND_1165522));
98+
asm(ALTERNATIVE("nop", "isb", ARM64_WORKAROUND_SPECULATIVE_AT_VHE));
9999
}
100100

101101
#endif /* __ARM64_KVM_HYP_H__ */

arch/arm64/kernel/cpu_errata.c

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -757,6 +757,16 @@ static const struct arm64_cpu_capabilities erratum_843419_list[] = {
757757
};
758758
#endif
759759

760+
#ifdef CONFIG_ARM64_WORKAROUND_SPECULATIVE_AT_VHE
761+
static const struct midr_range erratum_speculative_at_vhe_list[] = {
762+
#ifdef CONFIG_ARM64_ERRATUM_1165522
763+
/* Cortex A76 r0p0 to r2p0 */
764+
MIDR_RANGE(MIDR_CORTEX_A76, 0, 0, 2, 0),
765+
#endif
766+
{},
767+
};
768+
#endif
769+
760770
const struct arm64_cpu_capabilities arm64_errata[] = {
761771
#ifdef CONFIG_ARM64_WORKAROUND_CLEAN_CACHE
762772
{
@@ -883,12 +893,11 @@ const struct arm64_cpu_capabilities arm64_errata[] = {
883893
ERRATA_MIDR_RANGE_LIST(erratum_1418040_list),
884894
},
885895
#endif
886-
#ifdef CONFIG_ARM64_ERRATUM_1165522
896+
#ifdef CONFIG_ARM64_WORKAROUND_SPECULATIVE_AT_VHE
887897
{
888-
/* Cortex-A76 r0p0 to r2p0 */
889898
.desc = "ARM erratum 1165522",
890-
.capability = ARM64_WORKAROUND_1165522,
891-
ERRATA_MIDR_RANGE(MIDR_CORTEX_A76, 0, 0, 2, 0),
899+
.capability = ARM64_WORKAROUND_SPECULATIVE_AT_VHE,
900+
ERRATA_MIDR_RANGE_LIST(erratum_speculative_at_vhe_list),
892901
},
893902
#endif
894903
#ifdef CONFIG_ARM64_ERRATUM_1463225

arch/arm64/kvm/hyp/switch.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ static void deactivate_traps_vhe(void)
162162
* before we can switch to the EL2/EL0 translation regime used by
163163
* the host.
164164
*/
165-
asm(ALTERNATIVE("nop", "isb", ARM64_WORKAROUND_1165522));
165+
asm(ALTERNATIVE("nop", "isb", ARM64_WORKAROUND_SPECULATIVE_AT_VHE));
166166

167167
write_sysreg(CPACR_EL1_DEFAULT, cpacr_el1);
168168
write_sysreg(vectors, vbar_el1);

arch/arm64/kvm/hyp/tlb.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ static void __hyp_text __tlb_switch_to_guest_vhe(struct kvm *kvm,
2323

2424
local_irq_save(cxt->flags);
2525

26-
if (cpus_have_const_cap(ARM64_WORKAROUND_1165522)) {
26+
if (cpus_have_const_cap(ARM64_WORKAROUND_SPECULATIVE_AT_VHE)) {
2727
/*
2828
* For CPUs that are affected by ARM erratum 1165522, we
2929
* cannot trust stage-1 to be in a correct state at that
@@ -103,7 +103,7 @@ static void __hyp_text __tlb_switch_to_host_vhe(struct kvm *kvm,
103103
write_sysreg(HCR_HOST_VHE_FLAGS, hcr_el2);
104104
isb();
105105

106-
if (cpus_have_const_cap(ARM64_WORKAROUND_1165522)) {
106+
if (cpus_have_const_cap(ARM64_WORKAROUND_SPECULATIVE_AT_VHE)) {
107107
/* Restore the registers to what they were */
108108
write_sysreg_el1(cxt->tcr, SYS_TCR);
109109
write_sysreg_el1(cxt->sctlr, SYS_SCTLR);

0 commit comments

Comments
 (0)