Skip to content

Commit ec84c3f

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: "Nothing earth-shattering, really - some CPU errata workarounds (one day they'll get it right, ha!) and a fix for a boot failure with very large kernel images where the alternative patching gets confused when patching relative branches using veneers. - Fix alternative patching for very large kernel images and modules - Hook up existing CPU errata workarounds for Qualcomm Kryo CPUs" * tag 'arm64-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux: arm64: Add KRYO4XX silver CPU cores to erratum list 1530923 and 1024718 arm64: Add KRYO4XX gold CPU cores to erratum list 1463225 and 1418040 arm64: Add MIDR value for KRYO4XX gold CPU cores arm64/alternatives: use subsections for replacement sequences
2 parents 35e884f + 9b23d95 commit ec84c3f

File tree

6 files changed

+35
-17
lines changed

6 files changed

+35
-17
lines changed

Documentation/arm64/silicon-errata.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,14 @@ stable kernels.
147147
+----------------+-----------------+-----------------+-----------------------------+
148148
| Qualcomm Tech. | Falkor v{1,2} | E1041 | QCOM_FALKOR_ERRATUM_1041 |
149149
+----------------+-----------------+-----------------+-----------------------------+
150+
| Qualcomm Tech. | Kryo4xx Gold | N/A | ARM64_ERRATUM_1463225 |
151+
+----------------+-----------------+-----------------+-----------------------------+
152+
| Qualcomm Tech. | Kryo4xx Gold | N/A | ARM64_ERRATUM_1418040 |
153+
+----------------+-----------------+-----------------+-----------------------------+
154+
| Qualcomm Tech. | Kryo4xx Silver | N/A | ARM64_ERRATUM_1530923 |
155+
+----------------+-----------------+-----------------+-----------------------------+
156+
| Qualcomm Tech. | Kryo4xx Silver | N/A | ARM64_ERRATUM_1024718 |
157+
+----------------+-----------------+-----------------+-----------------------------+
150158
+----------------+-----------------+-----------------+-----------------------------+
151159
| Fujitsu | A64FX | E#010001 | FUJITSU_ERRATUM_010001 |
152160
+----------------+-----------------+-----------------+-----------------------------+

arch/arm64/include/asm/alternative.h

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -73,11 +73,11 @@ static inline void apply_alternatives_module(void *start, size_t length) { }
7373
".pushsection .altinstructions,\"a\"\n" \
7474
ALTINSTR_ENTRY(feature) \
7575
".popsection\n" \
76-
".pushsection .altinstr_replacement, \"a\"\n" \
76+
".subsection 1\n" \
7777
"663:\n\t" \
7878
newinstr "\n" \
7979
"664:\n\t" \
80-
".popsection\n\t" \
80+
".previous\n\t" \
8181
".org . - (664b-663b) + (662b-661b)\n\t" \
8282
".org . - (662b-661b) + (664b-663b)\n" \
8383
".endif\n"
@@ -117,9 +117,9 @@ static inline void apply_alternatives_module(void *start, size_t length) { }
117117
662: .pushsection .altinstructions, "a"
118118
altinstruction_entry 661b, 663f, \cap, 662b-661b, 664f-663f
119119
.popsection
120-
.pushsection .altinstr_replacement, "ax"
120+
.subsection 1
121121
663: \insn2
122-
664: .popsection
122+
664: .previous
123123
.org . - (664b-663b) + (662b-661b)
124124
.org . - (662b-661b) + (664b-663b)
125125
.endif
@@ -160,7 +160,7 @@ static inline void apply_alternatives_module(void *start, size_t length) { }
160160
.pushsection .altinstructions, "a"
161161
altinstruction_entry 663f, 661f, \cap, 664f-663f, 662f-661f
162162
.popsection
163-
.pushsection .altinstr_replacement, "ax"
163+
.subsection 1
164164
.align 2 /* So GAS knows label 661 is suitably aligned */
165165
661:
166166
.endm
@@ -179,9 +179,9 @@ static inline void apply_alternatives_module(void *start, size_t length) { }
179179
.macro alternative_else
180180
662:
181181
.if .Lasm_alt_mode==0
182-
.pushsection .altinstr_replacement, "ax"
182+
.subsection 1
183183
.else
184-
.popsection
184+
.previous
185185
.endif
186186
663:
187187
.endm
@@ -192,7 +192,7 @@ static inline void apply_alternatives_module(void *start, size_t length) { }
192192
.macro alternative_endif
193193
664:
194194
.if .Lasm_alt_mode==0
195-
.popsection
195+
.previous
196196
.endif
197197
.org . - (664b-663b) + (662b-661b)
198198
.org . - (662b-661b) + (664b-663b)

arch/arm64/include/asm/cputype.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@
8686
#define QCOM_CPU_PART_FALKOR 0xC00
8787
#define QCOM_CPU_PART_KRYO 0x200
8888
#define QCOM_CPU_PART_KRYO_3XX_SILVER 0x803
89+
#define QCOM_CPU_PART_KRYO_4XX_GOLD 0x804
8990
#define QCOM_CPU_PART_KRYO_4XX_SILVER 0x805
9091

9192
#define NVIDIA_CPU_PART_DENVER 0x003
@@ -114,6 +115,7 @@
114115
#define MIDR_QCOM_FALKOR MIDR_CPU_MODEL(ARM_CPU_IMP_QCOM, QCOM_CPU_PART_FALKOR)
115116
#define MIDR_QCOM_KRYO MIDR_CPU_MODEL(ARM_CPU_IMP_QCOM, QCOM_CPU_PART_KRYO)
116117
#define MIDR_QCOM_KRYO_3XX_SILVER MIDR_CPU_MODEL(ARM_CPU_IMP_QCOM, QCOM_CPU_PART_KRYO_3XX_SILVER)
118+
#define MIDR_QCOM_KRYO_4XX_GOLD MIDR_CPU_MODEL(ARM_CPU_IMP_QCOM, QCOM_CPU_PART_KRYO_4XX_GOLD)
117119
#define MIDR_QCOM_KRYO_4XX_SILVER MIDR_CPU_MODEL(ARM_CPU_IMP_QCOM, QCOM_CPU_PART_KRYO_4XX_SILVER)
118120
#define MIDR_NVIDIA_DENVER MIDR_CPU_MODEL(ARM_CPU_IMP_NVIDIA, NVIDIA_CPU_PART_DENVER)
119121
#define MIDR_NVIDIA_CARMEL MIDR_CPU_MODEL(ARM_CPU_IMP_NVIDIA, NVIDIA_CPU_PART_CARMEL)

arch/arm64/kernel/cpu_errata.c

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -472,12 +472,7 @@ static bool
472472
has_cortex_a76_erratum_1463225(const struct arm64_cpu_capabilities *entry,
473473
int scope)
474474
{
475-
u32 midr = read_cpuid_id();
476-
/* Cortex-A76 r0p0 - r3p1 */
477-
struct midr_range range = MIDR_RANGE(MIDR_CORTEX_A76, 0, 0, 3, 1);
478-
479-
WARN_ON(scope != SCOPE_LOCAL_CPU || preemptible());
480-
return is_midr_in_range(midr, &range) && is_kernel_in_hyp_mode();
475+
return is_affected_midr_range_list(entry, scope) && is_kernel_in_hyp_mode();
481476
}
482477
#endif
483478

@@ -728,6 +723,8 @@ static const struct midr_range erratum_1418040_list[] = {
728723
MIDR_RANGE(MIDR_CORTEX_A76, 0, 0, 3, 1),
729724
/* Neoverse-N1 r0p0 to r3p1 */
730725
MIDR_RANGE(MIDR_NEOVERSE_N1, 0, 0, 3, 1),
726+
/* Kryo4xx Gold (rcpe to rfpf) => (r0p0 to r3p1) */
727+
MIDR_RANGE(MIDR_QCOM_KRYO_4XX_GOLD, 0xc, 0xe, 0xf, 0xf),
731728
{},
732729
};
733730
#endif
@@ -772,11 +769,22 @@ static const struct midr_range erratum_speculative_at_list[] = {
772769
#ifdef CONFIG_ARM64_ERRATUM_1530923
773770
/* Cortex A55 r0p0 to r2p0 */
774771
MIDR_RANGE(MIDR_CORTEX_A55, 0, 0, 2, 0),
772+
/* Kryo4xx Silver (rdpe => r1p0) */
773+
MIDR_REV(MIDR_QCOM_KRYO_4XX_SILVER, 0xd, 0xe),
775774
#endif
776775
{},
777776
};
778777
#endif
779778

779+
#ifdef CONFIG_ARM64_ERRATUM_1463225
780+
static const struct midr_range erratum_1463225[] = {
781+
/* Cortex-A76 r0p0 - r3p1 */
782+
MIDR_RANGE(MIDR_CORTEX_A76, 0, 0, 3, 1),
783+
/* Kryo4xx Gold (rcpe to rfpf) => (r0p0 to r3p1) */
784+
MIDR_RANGE(MIDR_QCOM_KRYO_4XX_GOLD, 0xc, 0xe, 0xf, 0xf),
785+
};
786+
#endif
787+
780788
const struct arm64_cpu_capabilities arm64_errata[] = {
781789
#ifdef CONFIG_ARM64_WORKAROUND_CLEAN_CACHE
782790
{
@@ -916,6 +924,7 @@ const struct arm64_cpu_capabilities arm64_errata[] = {
916924
.capability = ARM64_WORKAROUND_1463225,
917925
.type = ARM64_CPUCAP_LOCAL_CPU_ERRATUM,
918926
.matches = has_cortex_a76_erratum_1463225,
927+
.midr_range_list = erratum_1463225,
919928
},
920929
#endif
921930
#ifdef CONFIG_CAVIUM_TX2_ERRATUM_219

arch/arm64/kernel/cpufeature.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1408,6 +1408,8 @@ static bool cpu_has_broken_dbm(void)
14081408
static const struct midr_range cpus[] = {
14091409
#ifdef CONFIG_ARM64_ERRATUM_1024718
14101410
MIDR_RANGE(MIDR_CORTEX_A55, 0, 0, 1, 0), // A55 r0p0 -r1p0
1411+
/* Kryo4xx Silver (rdpe => r1p0) */
1412+
MIDR_REV(MIDR_QCOM_KRYO_4XX_SILVER, 0xd, 0xe),
14111413
#endif
14121414
{},
14131415
};

arch/arm64/kernel/vmlinux.lds.S

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -165,9 +165,6 @@ SECTIONS
165165
*(.altinstructions)
166166
__alt_instructions_end = .;
167167
}
168-
.altinstr_replacement : {
169-
*(.altinstr_replacement)
170-
}
171168

172169
. = ALIGN(SEGMENT_ALIGN);
173170
__inittext_end = .;

0 commit comments

Comments
 (0)