Skip to content

Commit 51595e3

Browse files
committed
Merge tag 'arm64-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux
Pull more arm64 updates from Catalin Marinas: "A mix of fixes and clean-ups that turned up too late for the first pull request: - Restore terminal stack frame records. Their previous removal caused traces which cross secondary_start_kernel to terminate one entry too late, with a spurious "0" entry. - Fix boot warning with pseudo-NMI due to the way we manipulate the PMR register. - ACPI fixes: avoid corruption of interrupt mappings on watchdog probe failure (GTDT), prevent unregistering of GIC SGIs. - Force SPARSEMEM_VMEMMAP as the only memory model, it saves with having to test all the other combinations. - Documentation fixes and updates: tagged address ABI exceptions on brk/mmap/mremap(), event stream frequency, update booting requirements on the configuration of traps" * tag 'arm64-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux: arm64: kernel: Update the stale comment arm64: Fix the documented event stream frequency arm64: entry: always set GIC_PRIO_PSR_I_SET during entry arm64: Explicitly document boot requirements for SVE arm64: Explicitly require that FPSIMD instructions do not trap arm64: Relax booting requirements for configuration of traps arm64: cpufeatures: use min and max arm64: stacktrace: restore terminal records arm64/vdso: Discard .note.gnu.property sections in vDSO arm64: doc: Add brk/mmap/mremap() to the Tagged Address ABI Exceptions psci: Remove unneeded semicolon ACPI: irq: Prevent unregistering of GIC SGIs ACPI: GTDT: Don't corrupt interrupt mappings on watchdow probe failure arm64: Show three registers per line arm64: remove HAVE_DEBUG_BUGVERBOSE arm64: alternative: simplify passing alt_region arm64: Force SPARSEMEM_VMEMMAP as the only memory management model arm64: vdso32: drop -no-integrated-as flag
2 parents 2059c40 + c76fba3 commit 51595e3

File tree

23 files changed

+87
-92
lines changed

23 files changed

+87
-92
lines changed

Documentation/arm64/booting.rst

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -277,9 +277,40 @@ Before jumping into the kernel, the following conditions must be met:
277277

278278
- SCR_EL3.FGTEn (bit 27) must be initialised to 0b1.
279279

280+
For CPUs with Advanced SIMD and floating point support:
281+
282+
- If EL3 is present:
283+
284+
- CPTR_EL3.TFP (bit 10) must be initialised to 0b0.
285+
286+
- If EL2 is present and the kernel is entered at EL1:
287+
288+
- CPTR_EL2.TFP (bit 10) must be initialised to 0b0.
289+
290+
For CPUs with the Scalable Vector Extension (FEAT_SVE) present:
291+
292+
- if EL3 is present:
293+
294+
- CPTR_EL3.EZ (bit 8) must be initialised to 0b1.
295+
296+
- ZCR_EL3.LEN must be initialised to the same value for all CPUs the
297+
kernel is executed on.
298+
299+
- If the kernel is entered at EL1 and EL2 is present:
300+
301+
- CPTR_EL2.TZ (bit 8) must be initialised to 0b0.
302+
303+
- CPTR_EL2.ZEN (bits 17:16) must be initialised to 0b11.
304+
305+
- ZCR_EL2.LEN must be initialised to the same value for all CPUs the
306+
kernel will execute on.
307+
280308
The requirements described above for CPU mode, caches, MMUs, architected
281309
timers, coherency and system registers apply to all CPUs. All CPUs must
282-
enter the kernel in the same exception level.
310+
enter the kernel in the same exception level. Where the values documented
311+
disable traps it is permissible for these traps to be enabled so long as
312+
those traps are handled transparently by higher exception levels as though
313+
the values documented were set.
283314

284315
The boot loader is expected to enter the kernel on each CPU in the
285316
following manner:

Documentation/arm64/elf_hwcaps.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ HWCAP_ASIMD
7474

7575
HWCAP_EVTSTRM
7676
The generic timer is configured to generate events at a frequency of
77-
approximately 100KHz.
77+
approximately 10KHz.
7878

7979
HWCAP_AES
8080
Functionality implied by ID_AA64ISAR0_EL1.AES == 0b0001.

Documentation/arm64/tagged-address-abi.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,12 @@ ABI relaxation:
113113

114114
- ``shmat()`` and ``shmdt()``.
115115

116+
- ``brk()`` (since kernel v5.6).
117+
118+
- ``mmap()`` (since kernel v5.6).
119+
120+
- ``mremap()``, the ``new_address`` argument (since kernel v5.6).
121+
116122
Any attempt to use non-zero tagged pointers may result in an error code
117123
being returned, a (fatal) signal being raised, or other modes of
118124
failure.

arch/arm64/Kconfig

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,6 @@ config ARM64
170170
select HAVE_CMPXCHG_DOUBLE
171171
select HAVE_CMPXCHG_LOCAL
172172
select HAVE_CONTEXT_TRACKING
173-
select HAVE_DEBUG_BUGVERBOSE
174173
select HAVE_DEBUG_KMEMLEAK
175174
select HAVE_DMA_CONTIGUOUS
176175
select HAVE_DYNAMIC_FTRACE
@@ -1061,15 +1060,7 @@ source "kernel/Kconfig.hz"
10611060
config ARCH_SPARSEMEM_ENABLE
10621061
def_bool y
10631062
select SPARSEMEM_VMEMMAP_ENABLE
1064-
1065-
config ARCH_SPARSEMEM_DEFAULT
1066-
def_bool ARCH_SPARSEMEM_ENABLE
1067-
1068-
config ARCH_SELECT_MEMORY_MODEL
1069-
def_bool ARCH_SPARSEMEM_ENABLE
1070-
1071-
config ARCH_FLATMEM_ENABLE
1072-
def_bool !NUMA
1063+
select SPARSEMEM_VMEMMAP
10731064

10741065
config HW_PERF_EVENTS
10751066
def_bool y

arch/arm64/include/asm/daifflags.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,9 @@ static inline void local_daif_inherit(struct pt_regs *regs)
131131
if (interrupts_enabled(regs))
132132
trace_hardirqs_on();
133133

134+
if (system_uses_irq_prio_masking())
135+
gic_write_pmr(regs->pmr_save);
136+
134137
/*
135138
* We can't use local_daif_restore(regs->pstate) here as
136139
* system_has_prio_mask_debugging() won't restore the I bit if it can

arch/arm64/include/asm/kernel-pgtable.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@
136136
* has a direct correspondence, and needs to appear sufficiently aligned
137137
* in the virtual address space.
138138
*/
139-
#if defined(CONFIG_SPARSEMEM_VMEMMAP) && ARM64_MEMSTART_SHIFT < SECTION_SIZE_BITS
139+
#if ARM64_MEMSTART_SHIFT < SECTION_SIZE_BITS
140140
#define ARM64_MEMSTART_ALIGN (1UL << SECTION_SIZE_BITS)
141141
#else
142142
#define ARM64_MEMSTART_ALIGN (1UL << ARM64_MEMSTART_SHIFT)

arch/arm64/include/asm/memory.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -345,7 +345,7 @@ static inline void *phys_to_virt(phys_addr_t x)
345345
*/
346346
#define ARCH_PFN_OFFSET ((unsigned long)PHYS_PFN_OFFSET)
347347

348-
#if !defined(CONFIG_SPARSEMEM_VMEMMAP) || defined(CONFIG_DEBUG_VIRTUAL)
348+
#if defined(CONFIG_DEBUG_VIRTUAL)
349349
#define page_to_virt(x) ({ \
350350
__typeof__(x) __page = x; \
351351
void *__addr = __va(page_to_phys(__page)); \
@@ -365,7 +365,7 @@ static inline void *phys_to_virt(phys_addr_t x)
365365
u64 __addr = VMEMMAP_START + (__idx * sizeof(struct page)); \
366366
(struct page *)__addr; \
367367
})
368-
#endif /* !CONFIG_SPARSEMEM_VMEMMAP || CONFIG_DEBUG_VIRTUAL */
368+
#endif /* CONFIG_DEBUG_VIRTUAL */
369369

370370
#define virt_addr_valid(addr) ({ \
371371
__typeof__(addr) __addr = __tag_reset(addr); \

arch/arm64/include/asm/sparsemem.h

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

8-
#ifdef CONFIG_SPARSEMEM
98
#define MAX_PHYSMEM_BITS CONFIG_ARM64_PA_BITS
109

1110
/*
@@ -27,6 +26,4 @@
2726
#define SECTION_SIZE_BITS 27
2827
#endif /* CONFIG_ARM64_64K_PAGES */
2928

30-
#endif /* CONFIG_SPARSEMEM*/
31-
3229
#endif

arch/arm64/kernel/alternative.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -133,11 +133,10 @@ static void clean_dcache_range_nopatch(u64 start, u64 end)
133133
} while (cur += d_size, cur < end);
134134
}
135135

136-
static void __nocfi __apply_alternatives(void *alt_region, bool is_module,
137-
unsigned long *feature_mask)
136+
static void __nocfi __apply_alternatives(struct alt_region *region, bool is_module,
137+
unsigned long *feature_mask)
138138
{
139139
struct alt_instr *alt;
140-
struct alt_region *region = alt_region;
141140
__le32 *origptr, *updptr;
142141
alternative_cb_t alt_cb;
143142

arch/arm64/kernel/cpufeature.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@
6868
#include <linux/sort.h>
6969
#include <linux/stop_machine.h>
7070
#include <linux/types.h>
71+
#include <linux/minmax.h>
7172
#include <linux/mm.h>
7273
#include <linux/cpu.h>
7374
#include <linux/kasan.h>
@@ -694,14 +695,14 @@ static s64 arm64_ftr_safe_value(const struct arm64_ftr_bits *ftrp, s64 new,
694695
ret = ftrp->safe_val;
695696
break;
696697
case FTR_LOWER_SAFE:
697-
ret = new < cur ? new : cur;
698+
ret = min(new, cur);
698699
break;
699700
case FTR_HIGHER_OR_ZERO_SAFE:
700701
if (!cur || !new)
701702
break;
702703
fallthrough;
703704
case FTR_HIGHER_SAFE:
704-
ret = new > cur ? new : cur;
705+
ret = max(new, cur);
705706
break;
706707
default:
707708
BUG();

arch/arm64/kernel/cpuidle.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ int arm_cpuidle_init(unsigned int cpu)
2929

3030
/**
3131
* arm_cpuidle_suspend() - function to enter a low-power idle state
32-
* @arg: argument to pass to CPU suspend operations
32+
* @index: argument to pass to CPU suspend operations
3333
*
3434
* Return: 0 on success, -EOPNOTSUPP if CPU suspend hook not initialized, CPU
3535
* operations back-end error code otherwise.

arch/arm64/kernel/entry-common.c

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -230,14 +230,6 @@ static void noinstr el1_dbg(struct pt_regs *regs, unsigned long esr)
230230
{
231231
unsigned long far = read_sysreg(far_el1);
232232

233-
/*
234-
* The CPU masked interrupts, and we are leaving them masked during
235-
* do_debug_exception(). Update PMR as if we had called
236-
* local_daif_mask().
237-
*/
238-
if (system_uses_irq_prio_masking())
239-
gic_write_pmr(GIC_PRIO_IRQON | GIC_PRIO_PSR_I_SET);
240-
241233
arm64_enter_el1_dbg(regs);
242234
if (!cortex_a76_erratum_1463225_debug_handler(regs))
243235
do_debug_exception(far, esr, regs);
@@ -404,19 +396,13 @@ static void noinstr el0_dbg(struct pt_regs *regs, unsigned long esr)
404396
/* Only watchpoints write FAR_EL1, otherwise its UNKNOWN */
405397
unsigned long far = read_sysreg(far_el1);
406398

407-
if (system_uses_irq_prio_masking())
408-
gic_write_pmr(GIC_PRIO_IRQON | GIC_PRIO_PSR_I_SET);
409-
410399
enter_from_user_mode();
411400
do_debug_exception(far, esr, regs);
412401
local_daif_restore(DAIF_PROCCTX_NOIRQ);
413402
}
414403

415404
static void noinstr el0_svc(struct pt_regs *regs)
416405
{
417-
if (system_uses_irq_prio_masking())
418-
gic_write_pmr(GIC_PRIO_IRQON | GIC_PRIO_PSR_I_SET);
419-
420406
enter_from_user_mode();
421407
cortex_a76_erratum_1463225_svc_handler();
422408
do_el0_svc(regs);
@@ -492,9 +478,6 @@ static void noinstr el0_cp15(struct pt_regs *regs, unsigned long esr)
492478

493479
static void noinstr el0_svc_compat(struct pt_regs *regs)
494480
{
495-
if (system_uses_irq_prio_masking())
496-
gic_write_pmr(GIC_PRIO_IRQON | GIC_PRIO_PSR_I_SET);
497-
498481
enter_from_user_mode();
499482
cortex_a76_erratum_1463225_svc_handler();
500483
do_el0_svc_compat(regs);

arch/arm64/kernel/entry.S

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -285,16 +285,16 @@ alternative_else_nop_endif
285285
stp lr, x21, [sp, #S_LR]
286286

287287
/*
288-
* For exceptions from EL0, terminate the callchain here.
288+
* For exceptions from EL0, create a terminal frame record.
289289
* For exceptions from EL1, create a synthetic frame record so the
290290
* interrupted code shows up in the backtrace.
291291
*/
292292
.if \el == 0
293-
mov x29, xzr
293+
stp xzr, xzr, [sp, #S_STACKFRAME]
294294
.else
295295
stp x29, x22, [sp, #S_STACKFRAME]
296-
add x29, sp, #S_STACKFRAME
297296
.endif
297+
add x29, sp, #S_STACKFRAME
298298

299299
#ifdef CONFIG_ARM64_SW_TTBR0_PAN
300300
alternative_if_not ARM64_HAS_PAN
@@ -314,6 +314,8 @@ alternative_else_nop_endif
314314
alternative_if ARM64_HAS_IRQ_PRIO_MASKING
315315
mrs_s x20, SYS_ICC_PMR_EL1
316316
str x20, [sp, #S_PMR_SAVE]
317+
mov x20, #GIC_PRIO_IRQON | GIC_PRIO_PSR_I_SET
318+
msr_s SYS_ICC_PMR_EL1, x20
317319
alternative_else_nop_endif
318320

319321
/* Re-enable tag checking (TCO set on exception entry) */
@@ -550,17 +552,7 @@ tsk .req x28 // current thread_info
550552
#endif
551553
.endm
552554

553-
.macro gic_prio_irq_setup, pmr:req, tmp:req
554-
#ifdef CONFIG_ARM64_PSEUDO_NMI
555-
alternative_if ARM64_HAS_IRQ_PRIO_MASKING
556-
orr \tmp, \pmr, #GIC_PRIO_PSR_I_SET
557-
msr_s SYS_ICC_PMR_EL1, \tmp
558-
alternative_else_nop_endif
559-
#endif
560-
.endm
561-
562555
.macro el1_interrupt_handler, handler:req
563-
gic_prio_irq_setup pmr=x20, tmp=x1
564556
enable_da
565557

566558
mov x0, sp
@@ -590,7 +582,6 @@ alternative_else_nop_endif
590582
.endm
591583

592584
.macro el0_interrupt_handler, handler:req
593-
gic_prio_irq_setup pmr=x20, tmp=x0
594585
user_exit_irqoff
595586
enable_da
596587

@@ -788,7 +779,6 @@ SYM_CODE_END(el0_fiq)
788779
SYM_CODE_START_LOCAL(el1_error)
789780
kernel_entry 1
790781
mrs x1, esr_el1
791-
gic_prio_kentry_setup tmp=x2
792782
enable_dbg
793783
mov x0, sp
794784
bl do_serror
@@ -799,7 +789,6 @@ SYM_CODE_START_LOCAL(el0_error)
799789
kernel_entry 0
800790
el0_error_naked:
801791
mrs x25, esr_el1
802-
gic_prio_kentry_setup tmp=x2
803792
user_exit_irqoff
804793
enable_dbg
805794
mov x0, sp

arch/arm64/kernel/process.c

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -294,13 +294,10 @@ void __show_regs(struct pt_regs *regs)
294294
i = top_reg;
295295

296296
while (i >= 0) {
297-
printk("x%-2d: %016llx ", i, regs->regs[i]);
298-
i--;
297+
printk("x%-2d: %016llx", i, regs->regs[i]);
299298

300-
if (i % 2 == 0) {
301-
pr_cont("x%-2d: %016llx ", i, regs->regs[i]);
302-
i--;
303-
}
299+
while (i-- % 3)
300+
pr_cont(" x%-2d: %016llx", i, regs->regs[i]);
304301

305302
pr_cont("\n");
306303
}

arch/arm64/kernel/stacktrace.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,10 +68,6 @@ int notrace unwind_frame(struct task_struct *tsk, struct stackframe *frame)
6868
unsigned long fp = frame->fp;
6969
struct stack_info info;
7070

71-
/* Terminal record; nothing to unwind */
72-
if (!fp)
73-
return -ENOENT;
74-
7571
if (fp & 0xf)
7672
return -EINVAL;
7773

@@ -132,6 +128,12 @@ int notrace unwind_frame(struct task_struct *tsk, struct stackframe *frame)
132128

133129
frame->pc = ptrauth_strip_insn_pac(frame->pc);
134130

131+
/*
132+
* This is a terminal record, so we have finished unwinding.
133+
*/
134+
if (!frame->fp && !frame->pc)
135+
return -ENOENT;
136+
135137
return 0;
136138
}
137139
NOKPROBE_SYMBOL(unwind_frame);

arch/arm64/kernel/vdso/vdso.lds.S

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,13 @@ SECTIONS
3131
.gnu.version_d : { *(.gnu.version_d) }
3232
.gnu.version_r : { *(.gnu.version_r) }
3333

34+
/*
35+
* Discard .note.gnu.property sections which are unused and have
36+
* different alignment requirement from vDSO note sections.
37+
*/
38+
/DISCARD/ : {
39+
*(.note.GNU-stack .note.gnu.property)
40+
}
3441
.note : { *(.note.*) } :text :note
3542

3643
. = ALIGN(16);
@@ -48,7 +55,6 @@ SECTIONS
4855
PROVIDE(end = .);
4956

5057
/DISCARD/ : {
51-
*(.note.GNU-stack)
5258
*(.data .data.* .gnu.linkonce.d.* .sdata*)
5359
*(.bss .sbss .dynbss .dynsbss)
5460
*(.eh_frame .eh_frame_hdr)

arch/arm64/kernel/vdso32/Makefile

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,7 @@ include $(srctree)/lib/vdso/Makefile
1010

1111
# Same as cc-*option, but using CC_COMPAT instead of CC
1212
ifeq ($(CONFIG_CC_IS_CLANG), y)
13-
COMPAT_GCC_TOOLCHAIN_DIR := $(dir $(shell which $(CROSS_COMPILE_COMPAT)elfedit))
14-
COMPAT_GCC_TOOLCHAIN := $(realpath $(COMPAT_GCC_TOOLCHAIN_DIR)/..)
15-
1613
CC_COMPAT_CLANG_FLAGS := --target=$(notdir $(CROSS_COMPILE_COMPAT:%-=%))
17-
CC_COMPAT_CLANG_FLAGS += --prefix=$(COMPAT_GCC_TOOLCHAIN_DIR)$(notdir $(CROSS_COMPILE_COMPAT))
18-
CC_COMPAT_CLANG_FLAGS += -no-integrated-as -Qunused-arguments
19-
ifneq ($(COMPAT_GCC_TOOLCHAIN),)
20-
CC_COMPAT_CLANG_FLAGS += --gcc-toolchain=$(COMPAT_GCC_TOOLCHAIN)
21-
endif
2214

2315
CC_COMPAT ?= $(CC)
2416
CC_COMPAT += $(CC_COMPAT_CLANG_FLAGS)

0 commit comments

Comments
 (0)