Commit 7a7f6045 authored by Will Deacon's avatar Will Deacon

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
parents d4ea881f 588de8c6
...@@ -431,6 +431,9 @@ ...@@ -431,6 +431,9 @@
arcrimi= [HW,NET] ARCnet - "RIM I" (entirely mem-mapped) cards arcrimi= [HW,NET] ARCnet - "RIM I" (entirely mem-mapped) cards
Format: <io>,<irq>,<nodeID> Format: <io>,<irq>,<nodeID>
arm64.no32bit_el0 [ARM64] Unconditionally disable the execution of
32 bit applications.
arm64.nobti [ARM64] Unconditionally disable Branch Target arm64.nobti [ARM64] Unconditionally disable Branch Target
Identification support Identification support
......
...@@ -50,16 +50,12 @@ ...@@ -50,16 +50,12 @@
msr daif, \flags msr daif, \flags
.endm .endm
.macro enable_dbg
msr daifclr, #8
.endm
.macro disable_step_tsk, flgs, tmp .macro disable_step_tsk, flgs, tmp
tbz \flgs, #TIF_SINGLESTEP, 9990f tbz \flgs, #TIF_SINGLESTEP, 9990f
mrs \tmp, mdscr_el1 mrs \tmp, mdscr_el1
bic \tmp, \tmp, #DBG_MDSCR_SS bic \tmp, \tmp, #DBG_MDSCR_SS
msr mdscr_el1, \tmp msr mdscr_el1, \tmp
isb // Synchronise with enable_dbg isb // Take effect before a subsequent clear of DAIF.D
9990: 9990:
.endm .endm
......
...@@ -86,6 +86,7 @@ ...@@ -86,6 +86,7 @@
#define ARM_CPU_PART_CORTEX_X2 0xD48 #define ARM_CPU_PART_CORTEX_X2 0xD48
#define ARM_CPU_PART_NEOVERSE_N2 0xD49 #define ARM_CPU_PART_NEOVERSE_N2 0xD49
#define ARM_CPU_PART_CORTEX_A78C 0xD4B #define ARM_CPU_PART_CORTEX_A78C 0xD4B
#define ARM_CPU_PART_NEOVERSE_V2 0xD4F
#define APM_CPU_PART_XGENE 0x000 #define APM_CPU_PART_XGENE 0x000
#define APM_CPU_VAR_POTENZA 0x00 #define APM_CPU_VAR_POTENZA 0x00
...@@ -159,6 +160,7 @@ ...@@ -159,6 +160,7 @@
#define MIDR_CORTEX_X2 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_X2) #define MIDR_CORTEX_X2 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_X2)
#define MIDR_NEOVERSE_N2 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_NEOVERSE_N2) #define MIDR_NEOVERSE_N2 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_NEOVERSE_N2)
#define MIDR_CORTEX_A78C MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_A78C) #define MIDR_CORTEX_A78C MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_A78C)
#define MIDR_NEOVERSE_V2 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_NEOVERSE_V2)
#define MIDR_THUNDERX MIDR_CPU_MODEL(ARM_CPU_IMP_CAVIUM, CAVIUM_CPU_PART_THUNDERX) #define MIDR_THUNDERX MIDR_CPU_MODEL(ARM_CPU_IMP_CAVIUM, CAVIUM_CPU_PART_THUNDERX)
#define MIDR_THUNDERX_81XX MIDR_CPU_MODEL(ARM_CPU_IMP_CAVIUM, CAVIUM_CPU_PART_THUNDERX_81XX) #define MIDR_THUNDERX_81XX MIDR_CPU_MODEL(ARM_CPU_IMP_CAVIUM, CAVIUM_CPU_PART_THUNDERX_81XX)
#define MIDR_THUNDERX_83XX MIDR_CPU_MODEL(ARM_CPU_IMP_CAVIUM, CAVIUM_CPU_PART_THUNDERX_83XX) #define MIDR_THUNDERX_83XX MIDR_CPU_MODEL(ARM_CPU_IMP_CAVIUM, CAVIUM_CPU_PART_THUNDERX_83XX)
......
...@@ -5,7 +5,6 @@ ...@@ -5,7 +5,6 @@
#ifndef __ASM_IRQFLAGS_H #ifndef __ASM_IRQFLAGS_H
#define __ASM_IRQFLAGS_H #define __ASM_IRQFLAGS_H
#include <asm/alternative.h>
#include <asm/barrier.h> #include <asm/barrier.h>
#include <asm/ptrace.h> #include <asm/ptrace.h>
#include <asm/sysreg.h> #include <asm/sysreg.h>
......
...@@ -15,17 +15,23 @@ ...@@ -15,17 +15,23 @@
#define JUMP_LABEL_NOP_SIZE AARCH64_INSN_SIZE #define JUMP_LABEL_NOP_SIZE AARCH64_INSN_SIZE
#define JUMP_TABLE_ENTRY(key, label) \
".pushsection __jump_table, \"aw\"\n\t" \
".align 3\n\t" \
".long 1b - ., %l["#label"] - .\n\t" \
".quad %c0 - .\n\t" \
".popsection\n\t" \
: : "i"(key) : : label
static __always_inline bool arch_static_branch(struct static_key * const key, static __always_inline bool arch_static_branch(struct static_key * const key,
const bool branch) const bool branch)
{ {
char *k = &((char *)key)[branch];
asm goto( asm goto(
"1: nop \n\t" "1: nop \n\t"
" .pushsection __jump_table, \"aw\" \n\t" JUMP_TABLE_ENTRY(k, l_yes)
" .align 3 \n\t" );
" .long 1b - ., %l[l_yes] - . \n\t"
" .quad %c0 - . \n\t"
" .popsection \n\t"
: : "i"(&((char *)key)[branch]) : : l_yes);
return false; return false;
l_yes: l_yes:
...@@ -35,15 +41,11 @@ static __always_inline bool arch_static_branch(struct static_key * const key, ...@@ -35,15 +41,11 @@ static __always_inline bool arch_static_branch(struct static_key * const key,
static __always_inline bool arch_static_branch_jump(struct static_key * const key, static __always_inline bool arch_static_branch_jump(struct static_key * const key,
const bool branch) const bool branch)
{ {
char *k = &((char *)key)[branch];
asm goto( asm goto(
"1: b %l[l_yes] \n\t" "1: b %l[l_yes] \n\t"
" .pushsection __jump_table, \"aw\" \n\t" JUMP_TABLE_ENTRY(k, l_yes)
" .align 3 \n\t" );
" .long 1b - ., %l[l_yes] - . \n\t"
" .quad %c0 - . \n\t"
" .popsection \n\t"
: : "i"(&((char *)key)[branch]) : : l_yes);
return false; return false;
l_yes: l_yes:
return true; return true;
......
...@@ -1036,18 +1036,18 @@ ...@@ -1036,18 +1036,18 @@
* Permission Indirection Extension (PIE) permission encodings. * Permission Indirection Extension (PIE) permission encodings.
* Encodings with the _O suffix, have overlays applied (Permission Overlay Extension). * Encodings with the _O suffix, have overlays applied (Permission Overlay Extension).
*/ */
#define PIE_NONE_O 0x0 #define PIE_NONE_O UL(0x0)
#define PIE_R_O 0x1 #define PIE_R_O UL(0x1)
#define PIE_X_O 0x2 #define PIE_X_O UL(0x2)
#define PIE_RX_O 0x3 #define PIE_RX_O UL(0x3)
#define PIE_RW_O 0x5 #define PIE_RW_O UL(0x5)
#define PIE_RWnX_O 0x6 #define PIE_RWnX_O UL(0x6)
#define PIE_RWX_O 0x7 #define PIE_RWX_O UL(0x7)
#define PIE_R 0x8 #define PIE_R UL(0x8)
#define PIE_GCS 0x9 #define PIE_GCS UL(0x9)
#define PIE_RX 0xa #define PIE_RX UL(0xa)
#define PIE_RW 0xc #define PIE_RW UL(0xc)
#define PIE_RWX 0xe #define PIE_RWX UL(0xe)
#define PIRx_ELx_PERM(idx, perm) ((perm) << ((idx) * 4)) #define PIRx_ELx_PERM(idx, perm) ((perm) << ((idx) * 4))
......
...@@ -108,6 +108,7 @@ static const struct ftr_set_desc pfr0 __prel64_initconst = { ...@@ -108,6 +108,7 @@ static const struct ftr_set_desc pfr0 __prel64_initconst = {
.override = &id_aa64pfr0_override, .override = &id_aa64pfr0_override,
.fields = { .fields = {
FIELD("sve", ID_AA64PFR0_EL1_SVE_SHIFT, pfr0_sve_filter), FIELD("sve", ID_AA64PFR0_EL1_SVE_SHIFT, pfr0_sve_filter),
FIELD("el0", ID_AA64PFR0_EL1_EL0_SHIFT, NULL),
{} {}
}, },
}; };
...@@ -223,6 +224,7 @@ static const struct { ...@@ -223,6 +224,7 @@ static const struct {
{ "nokaslr", "arm64_sw.nokaslr=1" }, { "nokaslr", "arm64_sw.nokaslr=1" },
{ "rodata=off", "arm64_sw.rodataoff=1" }, { "rodata=off", "arm64_sw.rodataoff=1" },
{ "arm64.nolva", "id_aa64mmfr2.varange=0" }, { "arm64.nolva", "id_aa64mmfr2.varange=0" },
{ "arm64.no32bit_el0", "id_aa64pfr0.el0=1" },
}; };
static int __init parse_hexdigit(const char *p, u64 *v) static int __init parse_hexdigit(const char *p, u64 *v)
......
...@@ -298,8 +298,15 @@ void __init __no_sanitize_address setup_arch(char **cmdline_p) ...@@ -298,8 +298,15 @@ void __init __no_sanitize_address setup_arch(char **cmdline_p)
dynamic_scs_init(); dynamic_scs_init();
/* /*
* Unmask SError as soon as possible after initializing earlycon so * The primary CPU enters the kernel with all DAIF exceptions masked.
* that we can report any SErrors immediately. *
* We must unmask Debug and SError before preemption or scheduling is
* possible to ensure that these are consistently unmasked across
* threads, and we want to unmask SError as soon as possible after
* initializing earlycon so that we can report any SErrors immediately.
*
* IRQ and FIQ will be unmasked after the root irqchip has been
* detected and initialized.
*/ */
local_daif_restore(DAIF_PROCCTX_NOIRQ); local_daif_restore(DAIF_PROCCTX_NOIRQ);
......
...@@ -264,6 +264,13 @@ asmlinkage notrace void secondary_start_kernel(void) ...@@ -264,6 +264,13 @@ asmlinkage notrace void secondary_start_kernel(void)
set_cpu_online(cpu, true); set_cpu_online(cpu, true);
complete(&cpu_running); complete(&cpu_running);
/*
* Secondary CPUs enter the kernel with all DAIF exceptions masked.
*
* As with setup_arch() we must unmask Debug and SError exceptions, and
* as the root irqchip has already been detected and initialized we can
* unmask IRQ and FIQ at the same time.
*/
local_daif_restore(DAIF_PROCCTX); local_daif_restore(DAIF_PROCCTX);
/* /*
......
...@@ -135,14 +135,6 @@ SYM_FUNC_START(cpu_do_resume) ...@@ -135,14 +135,6 @@ SYM_FUNC_START(cpu_do_resume)
msr tcr_el1, x8 msr tcr_el1, x8
msr vbar_el1, x9 msr vbar_el1, x9
/*
* __cpu_setup() cleared MDSCR_EL1.MDE and friends, before unmasking
* debug exceptions. By restoring MDSCR_EL1 here, we may take a debug
* exception. Mask them until local_daif_restore() in cpu_suspend()
* resets them.
*/
disable_daif
msr mdscr_el1, x10 msr mdscr_el1, x10
msr sctlr_el1, x12 msr sctlr_el1, x12
...@@ -466,8 +458,6 @@ SYM_FUNC_START(__cpu_setup) ...@@ -466,8 +458,6 @@ SYM_FUNC_START(__cpu_setup)
msr cpacr_el1, xzr // Reset cpacr_el1 msr cpacr_el1, xzr // Reset cpacr_el1
mov x1, #1 << 12 // Reset mdscr_el1 and disable mov x1, #1 << 12 // Reset mdscr_el1 and disable
msr mdscr_el1, x1 // access to the DCC from EL0 msr mdscr_el1, x1 // access to the DCC from EL0
isb // Unmask debug exceptions now,
enable_dbg // since this is per-cpu
reset_pmuserenr_el0 x1 // Disable PMU access from EL0 reset_pmuserenr_el0 x1 // Disable PMU access from EL0
reset_amuserenr_el0 x1 // Disable AMU access from EL0 reset_amuserenr_el0 x1 // Disable AMU access from EL0
......
...@@ -701,18 +701,18 @@ ...@@ -701,18 +701,18 @@
* Permission Indirection Extension (PIE) permission encodings. * Permission Indirection Extension (PIE) permission encodings.
* Encodings with the _O suffix, have overlays applied (Permission Overlay Extension). * Encodings with the _O suffix, have overlays applied (Permission Overlay Extension).
*/ */
#define PIE_NONE_O 0x0 #define PIE_NONE_O UL(0x0)
#define PIE_R_O 0x1 #define PIE_R_O UL(0x1)
#define PIE_X_O 0x2 #define PIE_X_O UL(0x2)
#define PIE_RX_O 0x3 #define PIE_RX_O UL(0x3)
#define PIE_RW_O 0x5 #define PIE_RW_O UL(0x5)
#define PIE_RWnX_O 0x6 #define PIE_RWnX_O UL(0x6)
#define PIE_RWX_O 0x7 #define PIE_RWX_O UL(0x7)
#define PIE_R 0x8 #define PIE_R UL(0x8)
#define PIE_GCS 0x9 #define PIE_GCS UL(0x9)
#define PIE_RX 0xa #define PIE_RX UL(0xa)
#define PIE_RW 0xc #define PIE_RW UL(0xc)
#define PIE_RWX 0xe #define PIE_RWX UL(0xe)
#define PIRx_ELx_PERM(idx, perm) ((perm) << ((idx) * 4)) #define PIRx_ELx_PERM(idx, perm) ((perm) << ((idx) * 4))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment