Skip to content

Commit 1d47ae2

Browse files
committed
Merge tag 'arm64-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux
Pull arm64 fixes from Will Deacon: "A typo fix for a PMU driver, a workround for a side-channel erratum on Cortex-A520 and a fix for the local timer save/restore when using ACPI with Qualcomm's custom CPUs: - Workaround for Cortex-A520 erratum #2966298 - Fix typo in Arm CMN PMU driver that breaks counter overflow handling - Fix timer handling across idle for Qualcomm custom CPUs" * tag 'arm64-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux: cpuidle, ACPI: Evaluate LPI arch_flags for broadcast timer arm64: errata: Add Cortex-A520 speculative unprivileged load workaround arm64: Add Cortex-A520 CPU part definition perf/arm-cmn: Fix the unhandled overflow status of counter 4 to 7
2 parents 4940c15 + 4785aa8 commit 1d47ae2

File tree

10 files changed

+60
-3
lines changed

10 files changed

+60
-3
lines changed

Documentation/arch/arm64/silicon-errata.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,8 @@ stable kernels.
7171
+----------------+-----------------+-----------------+-----------------------------+
7272
| ARM | Cortex-A510 | #2658417 | ARM64_ERRATUM_2658417 |
7373
+----------------+-----------------+-----------------+-----------------------------+
74+
| ARM | Cortex-A520 | #2966298 | ARM64_ERRATUM_2966298 |
75+
+----------------+-----------------+-----------------+-----------------------------+
7476
| ARM | Cortex-A53 | #826319 | ARM64_ERRATUM_826319 |
7577
+----------------+-----------------+-----------------+-----------------------------+
7678
| ARM | Cortex-A53 | #827319 | ARM64_ERRATUM_827319 |

arch/arm64/Kconfig

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1037,6 +1037,19 @@ config ARM64_ERRATUM_2645198
10371037

10381038
If unsure, say Y.
10391039

1040+
config ARM64_ERRATUM_2966298
1041+
bool "Cortex-A520: 2966298: workaround for speculatively executed unprivileged load"
1042+
default y
1043+
help
1044+
This option adds the workaround for ARM Cortex-A520 erratum 2966298.
1045+
1046+
On an affected Cortex-A520 core, a speculatively executed unprivileged
1047+
load might leak data from a privileged level via a cache side channel.
1048+
1049+
Work around this problem by executing a TLBI before returning to EL0.
1050+
1051+
If unsure, say Y.
1052+
10401053
config CAVIUM_ERRATUM_22375
10411054
bool "Cavium erratum 22375, 24313"
10421055
default y

arch/arm64/include/asm/acpi.h

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
#ifndef _ASM_ACPI_H
1010
#define _ASM_ACPI_H
1111

12+
#include <linux/cpuidle.h>
1213
#include <linux/efi.h>
1314
#include <linux/memblock.h>
1415
#include <linux/psci.h>
@@ -44,6 +45,24 @@
4445

4546
#define ACPI_MADT_GICC_TRBE (offsetof(struct acpi_madt_generic_interrupt, \
4647
trbe_interrupt) + sizeof(u16))
48+
/*
49+
* Arm® Functional Fixed Hardware Specification Version 1.2.
50+
* Table 2: Arm Architecture context loss flags
51+
*/
52+
#define CPUIDLE_CORE_CTXT BIT(0) /* Core context Lost */
53+
54+
static inline unsigned int arch_get_idle_state_flags(u32 arch_flags)
55+
{
56+
if (arch_flags & CPUIDLE_CORE_CTXT)
57+
return CPUIDLE_FLAG_TIMER_STOP;
58+
59+
return 0;
60+
}
61+
#define arch_get_idle_state_flags arch_get_idle_state_flags
62+
63+
#define CPUIDLE_TRACE_CTXT BIT(1) /* Trace context loss */
64+
#define CPUIDLE_GICR_CTXT BIT(2) /* GICR */
65+
#define CPUIDLE_GICD_CTXT BIT(3) /* GICD */
4766

4867
/* Basic configuration for ACPI */
4968
#ifdef CONFIG_ACPI

arch/arm64/include/asm/cputype.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@
7979
#define ARM_CPU_PART_CORTEX_A78AE 0xD42
8080
#define ARM_CPU_PART_CORTEX_X1 0xD44
8181
#define ARM_CPU_PART_CORTEX_A510 0xD46
82+
#define ARM_CPU_PART_CORTEX_A520 0xD80
8283
#define ARM_CPU_PART_CORTEX_A710 0xD47
8384
#define ARM_CPU_PART_CORTEX_A715 0xD4D
8485
#define ARM_CPU_PART_CORTEX_X2 0xD48
@@ -148,6 +149,7 @@
148149
#define MIDR_CORTEX_A78AE MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_A78AE)
149150
#define MIDR_CORTEX_X1 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_X1)
150151
#define MIDR_CORTEX_A510 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_A510)
152+
#define MIDR_CORTEX_A520 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_A520)
151153
#define MIDR_CORTEX_A710 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_A710)
152154
#define MIDR_CORTEX_A715 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_A715)
153155
#define MIDR_CORTEX_X2 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_X2)

arch/arm64/kernel/cpu_errata.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -730,6 +730,14 @@ const struct arm64_cpu_capabilities arm64_errata[] = {
730730
.cpu_enable = cpu_clear_bf16_from_user_emulation,
731731
},
732732
#endif
733+
#ifdef CONFIG_ARM64_ERRATUM_2966298
734+
{
735+
.desc = "ARM erratum 2966298",
736+
.capability = ARM64_WORKAROUND_2966298,
737+
/* Cortex-A520 r0p0 - r0p1 */
738+
ERRATA_MIDR_REV_RANGE(MIDR_CORTEX_A520, 0, 0, 1),
739+
},
740+
#endif
733741
#ifdef CONFIG_AMPERE_ERRATUM_AC03_CPU_38
734742
{
735743
.desc = "AmpereOne erratum AC03_CPU_38",

arch/arm64/kernel/entry.S

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -428,6 +428,10 @@ alternative_else_nop_endif
428428
ldp x28, x29, [sp, #16 * 14]
429429

430430
.if \el == 0
431+
alternative_if ARM64_WORKAROUND_2966298
432+
tlbi vale1, xzr
433+
dsb nsh
434+
alternative_else_nop_endif
431435
alternative_if_not ARM64_UNMAP_KERNEL_AT_EL0
432436
ldr lr, [sp, #S_LR]
433437
add sp, sp, #PT_REGS_SIZE // restore sp

arch/arm64/tools/cpucaps

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ WORKAROUND_2077057
8484
WORKAROUND_2457168
8585
WORKAROUND_2645198
8686
WORKAROUND_2658417
87+
WORKAROUND_2966298
8788
WORKAROUND_AMPERE_AC03_CPU_38
8889
WORKAROUND_TRBE_OVERWRITE_FILL_MODE
8990
WORKAROUND_TSB_FLUSH_FAILURE

drivers/acpi/processor_idle.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1217,8 +1217,7 @@ static int acpi_processor_setup_lpi_states(struct acpi_processor *pr)
12171217
strscpy(state->desc, lpi->desc, CPUIDLE_DESC_LEN);
12181218
state->exit_latency = lpi->wake_latency;
12191219
state->target_residency = lpi->min_residency;
1220-
if (lpi->arch_flags)
1221-
state->flags |= CPUIDLE_FLAG_TIMER_STOP;
1220+
state->flags |= arch_get_idle_state_flags(lpi->arch_flags);
12221221
if (i != 0 && lpi->entry_method == ACPI_CSTATE_FFH)
12231222
state->flags |= CPUIDLE_FLAG_RCU_IDLE;
12241223
state->enter = acpi_idle_lpi_enter;

drivers/perf/arm-cmn.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1972,7 +1972,7 @@ static irqreturn_t arm_cmn_handle_irq(int irq, void *dev_id)
19721972
u64 delta;
19731973
int i;
19741974

1975-
for (i = 0; i < CMN_DTM_NUM_COUNTERS; i++) {
1975+
for (i = 0; i < CMN_DT_NUM_COUNTERS; i++) {
19761976
if (status & (1U << i)) {
19771977
ret = IRQ_HANDLED;
19781978
if (WARN_ON(!dtc->counters[i]))

include/linux/acpi.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1480,6 +1480,15 @@ static inline int lpit_read_residency_count_address(u64 *address)
14801480
}
14811481
#endif
14821482

1483+
#ifdef CONFIG_ACPI_PROCESSOR_IDLE
1484+
#ifndef arch_get_idle_state_flags
1485+
static inline unsigned int arch_get_idle_state_flags(u32 arch_flags)
1486+
{
1487+
return 0;
1488+
}
1489+
#endif
1490+
#endif /* CONFIG_ACPI_PROCESSOR_IDLE */
1491+
14831492
#ifdef CONFIG_ACPI_PPTT
14841493
int acpi_pptt_cpu_is_thread(unsigned int cpu);
14851494
int find_acpi_cpu_topology(unsigned int cpu, int level);

0 commit comments

Comments
 (0)