linux/arch/arm64/kernel
Mark Rutland 124c49b1b5 arm64: armv8_deprecated: rework deprected instruction handling
Support for deprecated instructions can be enabled or disabled at
runtime. To handle this, the code in armv8_deprecated.c registers and
unregisters undef_hooks, and makes cross CPU calls to configure HW
support. This is rather complicated, and the synchronization required to
make this safe ends up serializing the handling of instructions which
have been trapped.

This patch simplifies the deprecated instruction handling by removing
the dynamic registration and unregistration, and changing the trap
handling code to determine whether a handler should be invoked. This
removes the need for dynamic list management, and simplifies the locking
requirements, making it possible to handle trapped instructions entirely
in parallel.

Where changing the emulation state requires a cross-call, this is
serialized by locally disabling interrupts, ensuring that the CPU is not
left in an inconsistent state.

To simplify sysctl management, each insn_emulation is given a separate
sysctl table, permitting these to be registered separately. The core
sysctl code will iterate over all of these when walking sysfs.

I've tested this with userspace programs which use each of the
deprecated instructions, and I've concurrently modified the support
level for each of the features back-and-forth between HW and emulated to
check that there are no spurious SIGILLs sent to userspace when the
support level is changed.

Signed-off-by: Mark Rutland <mark.rutland@arm.com>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: James Morse <james.morse@arm.com>
Cc: Joey Gouly <joey.gouly@arm.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Will Deacon <will@kernel.org>
Link: https://lore.kernel.org/r/20221019144123.612388-10-mark.rutland@arm.com
Signed-off-by: Will Deacon <will@kernel.org>
2022-11-15 13:46:19 +00:00
..
pi arm64: adjust KASLR relocation after ARCH_RANDOM removal 2022-08-17 14:52:50 +01:00
probes arm64/kprobe: Optimize the performance of patching single-step slot 2022-09-30 09:17:15 +01:00
vdso arm64 updates for 6.1: 2022-10-06 11:51:49 -07:00
vdso32 arm64: vdso32: Add DWARF_DEBUG 2022-07-01 12:07:43 +01:00
.gitignore
acpi.c arm64: mm: Convert to GENERIC_IOREMAP 2022-06-27 12:22:31 +01:00
acpi_numa.c arm64: numa: Don't check node against MAX_NUMNODES 2022-07-19 19:10:28 +01:00
acpi_parking_protocol.c treewide: Drop function_nocfi 2022-09-26 10:13:14 -07:00
alternative.c arm64 updates for 6.1: 2022-10-06 11:51:49 -07:00
armv8_deprecated.c arm64: armv8_deprecated: rework deprected instruction handling 2022-11-15 13:46:19 +00:00
asm-offsets.c KVM: arm64: Drop unused workaround_flags vcpu field 2021-12-08 14:54:07 +00:00
cacheinfo.c arm64: cacheinfo: Fix incorrect assignment of signed error value to unsigned fw_level 2022-08-23 11:10:24 +01:00
compat_alignment.c arm64: compat: Implement misalignment fixups for multiword loads 2022-09-06 09:34:53 +01:00
cpu-reset.S arm64: Add types to indirect called assembly functions 2022-09-26 10:13:13 -07:00
cpu_errata.c arm64: errata: Add Cortex-A55 to the repeat tlbi list 2022-10-07 14:42:20 +01:00
cpu_ops.c
cpufeature.c arm64: rework EL0 MRS emulation 2022-11-15 13:46:18 +00:00
cpuidle.c arm64: cpuidle: remove generic cpuidle support 2022-06-23 14:19:33 +01:00
cpuinfo.c arm64/sysreg: Add hwcap for SVE EBF16 2022-09-06 18:53:52 +01:00
crash_core.c arm64: crash_core: Export MODULES, VMALLOC, and VMEMMAP ranges 2022-03-07 21:25:47 +00:00
crash_dump.c vmcore: convert copy_oldmem_page() to take an iov_iter 2022-04-29 14:37:59 -07:00
debug-monitors.c arm64/sysreg: Add _EL1 into ID_AA64DFR0_EL1 definition names 2022-09-16 12:38:57 +01:00
efi-entry.S
efi-header.S
efi-rt-wrapper.S arm64: efi: Recover from synchronous exceptions occurring in firmware 2022-11-03 18:01:15 +01:00
efi.c arm64: efi: Recover from synchronous exceptions occurring in firmware 2022-11-03 18:01:15 +01:00
elfcore.c arm64: Change elfcore for_each_mte_vma() to use VMA iterator 2022-09-26 19:46:19 -07:00
entry-common.c arm64: split EL0/EL1 UNDEF handlers 2022-11-15 13:46:17 +00:00
entry-fpsimd.S arm64/sme: Implement ZA context switching 2022-04-22 18:51:02 +01:00
entry-ftrace.S ftrace,kcfi: Separate ftrace_stub() and ftrace_stub_graph() 2022-10-20 17:10:27 +02:00
entry.S arm64: alternatives: have callbacks take a cap 2022-09-16 17:15:03 +01:00
fpsimd.c arm64/sme: Don't flush SVE register state when handling SME traps 2022-08-23 11:29:12 +01:00
ftrace.c arm64 updates for 6.1: 2022-10-06 11:51:49 -07:00
head.S arm64 updates for 6.1: 2022-10-06 11:51:49 -07:00
hibernate-asm.S arm64: kexec: install a copy of the linear-map 2021-10-01 13:31:00 +01:00
hibernate.c arm64: kasan: Revert "arm64: mte: reset the page tag in page->flags" 2022-07-07 10:48:37 +01:00
hw_breakpoint.c arm64: Treat ESR_ELx as a 64-bit register 2022-04-29 19:26:27 +01:00
hyp-stub.S arm64/sysreg: Standardise naming for ID_AA64MMFR1_EL1 fields 2022-09-09 10:59:03 +01:00
idle.c Merge branch 'for-next/entry' into for-next/core 2021-06-24 14:01:55 +01:00
idreg-override.c arm64/sysreg: Standardise naming for ID_AA64MMFR1_EL1 fields 2022-09-09 10:59:03 +01:00
image-vars.h EFI updates for v6.1 2022-10-09 08:56:54 -07:00
image.h
io.c
irq.c arm64: run softirqs on the per-CPU IRQ stack 2022-09-09 19:01:38 +01:00
jump_label.c jump_label: make initial NOP patching the special case 2022-06-24 09:48:55 +02:00
kaslr.c random: handle archrandom with multiple longs 2022-07-25 13:26:14 +02:00
kexec_image.c arm64: kexec_file: use more system keyrings to verify kernel image signature 2022-07-15 12:21:16 -04:00
kgdb.c arm64: Treat ESR_ELx as a 64-bit register 2022-04-29 19:26:27 +01:00
kuser32.S arm64: compat: Move kuser32.S to .rodata section 2022-06-23 16:01:42 +01:00
machine_kexec.c treewide: Drop function_nocfi 2022-09-26 10:13:14 -07:00
machine_kexec_file.c arm64/kexec: Fix missing extra range for crashkres_low. 2022-09-01 11:50:00 +01:00
Makefile Kbuild updates for v6.1 2022-10-10 12:00:45 -07:00
module-plts.c arm64: module: Make plt_equals_entry() static 2022-09-29 17:47:18 +01:00
module.c arm64: module: move find_section to header 2022-09-09 12:27:25 +01:00
mte.c arm64: mte: Avoid setting PG_mte_tagged if no tags cleared or restored 2022-10-12 10:00:19 +01:00
paravirt.c arm64: paravirt: Use RCU read locks to guard stolen_time 2022-05-17 14:23:37 +01:00
patching.c arm64: patch_text: Fixup last cpu should be master 2022-04-08 11:43:46 +01:00
pci.c arm64: PCI: Support root bridge preparation for Hyper-V 2021-08-23 10:59:26 +01:00
perf_callchain.c Peter Zijlstra says: 2022-01-12 16:26:58 -08:00
perf_event.c arm64/sysreg: Use feature numbering for PMU and SPE revisions 2022-09-16 12:38:57 +01:00
perf_regs.c perf: arm64: Add SVE vector granule register to user regs 2022-09-22 15:06:02 +01:00
pointer_auth.c arm64: move preemption disablement to prctl handlers 2021-07-28 18:33:49 +01:00
process.c Random number generator fixes for Linux 6.1-rc1. 2022-10-16 15:27:07 -07:00
proton-pack.c arm64: factor out EL1 SSBS emulation hook 2022-11-15 13:46:18 +00:00
psci.c treewide: Drop function_nocfi 2022-09-26 10:13:14 -07:00
ptrace.c arm64 updates for 6.1: 2022-10-06 11:51:49 -07:00
reloc_test_core.c ARM64: reloc_test: add __init/__exit annotations to module init/exit funcs 2022-09-29 18:04:25 +01:00
reloc_test_syms.S
relocate_kernel.S arm64: kexec: load from kimage prior to clobbering 2022-05-17 14:25:35 +01:00
return_address.c arm64: Make return_address() use arch_stack_walk() 2021-12-10 14:06:04 +00:00
sdei.c arm64: stacktrace: move SDEI stack helpers to stacktrace code 2022-09-09 12:30:07 +01:00
setup.c arm64: fix KASAN_INLINE 2022-07-20 16:08:10 +01:00
signal.c arm64/sme: Don't flush SVE register state when allocating SME storage 2022-08-23 11:29:11 +01:00
signal32.c signal: Deliver SIGTRAP on perf event asynchronously if blocked 2022-04-22 12:14:05 +02:00
sigreturn32.S arm64: compat: Move sigreturn32.S to .rodata section 2022-07-01 12:05:45 +01:00
sleep.S arm64: mm: fix resume for 52-bit enabled builds 2022-09-10 14:46:28 +01:00
smccc-call.S arm64: smccc: Save lr before calling __arm_smccc_sve_check() 2021-07-21 11:23:25 +01:00
smp.c profile: setup_profiling_timer() is moslty not implemented 2022-07-29 18:12:36 -07:00
smp_spin_table.c treewide: Drop function_nocfi 2022-09-26 10:13:14 -07:00
stacktrace.c arm64: stacktrace: track hyp stacks in unwinder's address space 2022-09-09 12:30:08 +01:00
suspend.c arm64: mte: move register initialization to C 2022-09-22 18:02:50 +01:00
sys.c
sys32.c
sys_compat.c arm64: compat: Do not treat syscall number as ESR_ELx for a bad syscall 2022-04-29 19:26:27 +01:00
syscall.c treewide: use get_random_{u8,u16}() when possible, part 1 2022-10-11 17:42:58 -06:00
time.c arm64: Make profile_pc() use arch_stack_walk() 2021-12-10 14:06:04 +00:00
topology.c RISC-V Patches for the 6.1 Merge Window, Part 1 2022-10-09 13:24:01 -07:00
trace-events-emulation.h
traps.c arm64: armv8_deprecated: rework deprected instruction handling 2022-11-15 13:46:19 +00:00
vdso-wrap.S
vdso.c - Yu Zhao's Multi-Gen LRU patches are here. They've been under test in 2022-10-10 17:53:04 -07:00
vdso32-wrap.S
vmlinux.lds.S Merge branch 'for-next/boot' into for-next/core 2022-07-25 10:59:15 +01:00