Skip to content

Commit 7a7f604

Browse files
committed
Merge branch 'for-next/misc' into for-next/core
* for-next/misc: arm64: simplify arch_static_branch/_jump function arm64: Add the arm64.no32bit_el0 command line option arm64: defer clearing DAIF.D arm64: assembler: update stale comment for disable_step_tsk arm64/sysreg: Update PIE permission encodings arm64: Add Neoverse-V2 part arm64: Remove unnecessary irqflags alternative.h include
2 parents d4ea881 + 588de8c commit 7a7f604

File tree

11 files changed

+63
-55
lines changed

11 files changed

+63
-55
lines changed

Documentation/admin-guide/kernel-parameters.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -431,6 +431,9 @@
431431
arcrimi= [HW,NET] ARCnet - "RIM I" (entirely mem-mapped) cards
432432
Format: <io>,<irq>,<nodeID>
433433

434+
arm64.no32bit_el0 [ARM64] Unconditionally disable the execution of
435+
32 bit applications.
436+
434437
arm64.nobti [ARM64] Unconditionally disable Branch Target
435438
Identification support
436439

arch/arm64/include/asm/assembler.h

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,16 +50,12 @@
5050
msr daif, \flags
5151
.endm
5252

53-
.macro enable_dbg
54-
msr daifclr, #8
55-
.endm
56-
5753
.macro disable_step_tsk, flgs, tmp
5854
tbz \flgs, #TIF_SINGLESTEP, 9990f
5955
mrs \tmp, mdscr_el1
6056
bic \tmp, \tmp, #DBG_MDSCR_SS
6157
msr mdscr_el1, \tmp
62-
isb // Synchronise with enable_dbg
58+
isb // Take effect before a subsequent clear of DAIF.D
6359
9990:
6460
.endm
6561

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 ARM_CPU_PART_CORTEX_X2 0xD48
8787
#define ARM_CPU_PART_NEOVERSE_N2 0xD49
8888
#define ARM_CPU_PART_CORTEX_A78C 0xD4B
89+
#define ARM_CPU_PART_NEOVERSE_V2 0xD4F
8990

9091
#define APM_CPU_PART_XGENE 0x000
9192
#define APM_CPU_VAR_POTENZA 0x00
@@ -159,6 +160,7 @@
159160
#define MIDR_CORTEX_X2 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_X2)
160161
#define MIDR_NEOVERSE_N2 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_NEOVERSE_N2)
161162
#define MIDR_CORTEX_A78C MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_A78C)
163+
#define MIDR_NEOVERSE_V2 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_NEOVERSE_V2)
162164
#define MIDR_THUNDERX MIDR_CPU_MODEL(ARM_CPU_IMP_CAVIUM, CAVIUM_CPU_PART_THUNDERX)
163165
#define MIDR_THUNDERX_81XX MIDR_CPU_MODEL(ARM_CPU_IMP_CAVIUM, CAVIUM_CPU_PART_THUNDERX_81XX)
164166
#define MIDR_THUNDERX_83XX MIDR_CPU_MODEL(ARM_CPU_IMP_CAVIUM, CAVIUM_CPU_PART_THUNDERX_83XX)

arch/arm64/include/asm/irqflags.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
#ifndef __ASM_IRQFLAGS_H
66
#define __ASM_IRQFLAGS_H
77

8-
#include <asm/alternative.h>
98
#include <asm/barrier.h>
109
#include <asm/ptrace.h>
1110
#include <asm/sysreg.h>

arch/arm64/include/asm/jump_label.h

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,23 @@
1515

1616
#define JUMP_LABEL_NOP_SIZE AARCH64_INSN_SIZE
1717

18+
#define JUMP_TABLE_ENTRY(key, label) \
19+
".pushsection __jump_table, \"aw\"\n\t" \
20+
".align 3\n\t" \
21+
".long 1b - ., %l["#label"] - .\n\t" \
22+
".quad %c0 - .\n\t" \
23+
".popsection\n\t" \
24+
: : "i"(key) : : label
25+
1826
static __always_inline bool arch_static_branch(struct static_key * const key,
1927
const bool branch)
2028
{
29+
char *k = &((char *)key)[branch];
30+
2131
asm goto(
2232
"1: nop \n\t"
23-
" .pushsection __jump_table, \"aw\" \n\t"
24-
" .align 3 \n\t"
25-
" .long 1b - ., %l[l_yes] - . \n\t"
26-
" .quad %c0 - . \n\t"
27-
" .popsection \n\t"
28-
: : "i"(&((char *)key)[branch]) : : l_yes);
33+
JUMP_TABLE_ENTRY(k, l_yes)
34+
);
2935

3036
return false;
3137
l_yes:
@@ -35,15 +41,11 @@ static __always_inline bool arch_static_branch(struct static_key * const key,
3541
static __always_inline bool arch_static_branch_jump(struct static_key * const key,
3642
const bool branch)
3743
{
44+
char *k = &((char *)key)[branch];
3845
asm goto(
3946
"1: b %l[l_yes] \n\t"
40-
" .pushsection __jump_table, \"aw\" \n\t"
41-
" .align 3 \n\t"
42-
" .long 1b - ., %l[l_yes] - . \n\t"
43-
" .quad %c0 - . \n\t"
44-
" .popsection \n\t"
45-
: : "i"(&((char *)key)[branch]) : : l_yes);
46-
47+
JUMP_TABLE_ENTRY(k, l_yes)
48+
);
4749
return false;
4850
l_yes:
4951
return true;

arch/arm64/include/asm/sysreg.h

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1036,18 +1036,18 @@
10361036
* Permission Indirection Extension (PIE) permission encodings.
10371037
* Encodings with the _O suffix, have overlays applied (Permission Overlay Extension).
10381038
*/
1039-
#define PIE_NONE_O 0x0
1040-
#define PIE_R_O 0x1
1041-
#define PIE_X_O 0x2
1042-
#define PIE_RX_O 0x3
1043-
#define PIE_RW_O 0x5
1044-
#define PIE_RWnX_O 0x6
1045-
#define PIE_RWX_O 0x7
1046-
#define PIE_R 0x8
1047-
#define PIE_GCS 0x9
1048-
#define PIE_RX 0xa
1049-
#define PIE_RW 0xc
1050-
#define PIE_RWX 0xe
1039+
#define PIE_NONE_O UL(0x0)
1040+
#define PIE_R_O UL(0x1)
1041+
#define PIE_X_O UL(0x2)
1042+
#define PIE_RX_O UL(0x3)
1043+
#define PIE_RW_O UL(0x5)
1044+
#define PIE_RWnX_O UL(0x6)
1045+
#define PIE_RWX_O UL(0x7)
1046+
#define PIE_R UL(0x8)
1047+
#define PIE_GCS UL(0x9)
1048+
#define PIE_RX UL(0xa)
1049+
#define PIE_RW UL(0xc)
1050+
#define PIE_RWX UL(0xe)
10511051

10521052
#define PIRx_ELx_PERM(idx, perm) ((perm) << ((idx) * 4))
10531053

arch/arm64/kernel/pi/idreg-override.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@ static const struct ftr_set_desc pfr0 __prel64_initconst = {
108108
.override = &id_aa64pfr0_override,
109109
.fields = {
110110
FIELD("sve", ID_AA64PFR0_EL1_SVE_SHIFT, pfr0_sve_filter),
111+
FIELD("el0", ID_AA64PFR0_EL1_EL0_SHIFT, NULL),
111112
{}
112113
},
113114
};
@@ -223,6 +224,7 @@ static const struct {
223224
{ "nokaslr", "arm64_sw.nokaslr=1" },
224225
{ "rodata=off", "arm64_sw.rodataoff=1" },
225226
{ "arm64.nolva", "id_aa64mmfr2.varange=0" },
227+
{ "arm64.no32bit_el0", "id_aa64pfr0.el0=1" },
226228
};
227229

228230
static int __init parse_hexdigit(const char *p, u64 *v)

arch/arm64/kernel/setup.c

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -298,8 +298,15 @@ void __init __no_sanitize_address setup_arch(char **cmdline_p)
298298
dynamic_scs_init();
299299

300300
/*
301-
* Unmask SError as soon as possible after initializing earlycon so
302-
* that we can report any SErrors immediately.
301+
* The primary CPU enters the kernel with all DAIF exceptions masked.
302+
*
303+
* We must unmask Debug and SError before preemption or scheduling is
304+
* possible to ensure that these are consistently unmasked across
305+
* threads, and we want to unmask SError as soon as possible after
306+
* initializing earlycon so that we can report any SErrors immediately.
307+
*
308+
* IRQ and FIQ will be unmasked after the root irqchip has been
309+
* detected and initialized.
303310
*/
304311
local_daif_restore(DAIF_PROCCTX_NOIRQ);
305312

arch/arm64/kernel/smp.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -264,6 +264,13 @@ asmlinkage notrace void secondary_start_kernel(void)
264264
set_cpu_online(cpu, true);
265265
complete(&cpu_running);
266266

267+
/*
268+
* Secondary CPUs enter the kernel with all DAIF exceptions masked.
269+
*
270+
* As with setup_arch() we must unmask Debug and SError exceptions, and
271+
* as the root irqchip has already been detected and initialized we can
272+
* unmask IRQ and FIQ at the same time.
273+
*/
267274
local_daif_restore(DAIF_PROCCTX);
268275

269276
/*

arch/arm64/mm/proc.S

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -135,14 +135,6 @@ SYM_FUNC_START(cpu_do_resume)
135135

136136
msr tcr_el1, x8
137137
msr vbar_el1, x9
138-
139-
/*
140-
* __cpu_setup() cleared MDSCR_EL1.MDE and friends, before unmasking
141-
* debug exceptions. By restoring MDSCR_EL1 here, we may take a debug
142-
* exception. Mask them until local_daif_restore() in cpu_suspend()
143-
* resets them.
144-
*/
145-
disable_daif
146138
msr mdscr_el1, x10
147139

148140
msr sctlr_el1, x12
@@ -466,8 +458,6 @@ SYM_FUNC_START(__cpu_setup)
466458
msr cpacr_el1, xzr // Reset cpacr_el1
467459
mov x1, #1 << 12 // Reset mdscr_el1 and disable
468460
msr mdscr_el1, x1 // access to the DCC from EL0
469-
isb // Unmask debug exceptions now,
470-
enable_dbg // since this is per-cpu
471461
reset_pmuserenr_el0 x1 // Disable PMU access from EL0
472462
reset_amuserenr_el0 x1 // Disable AMU access from EL0
473463

0 commit comments

Comments
 (0)