projects/linux·commit 3cd86a58

Merge tag 'arm64-upstream' of git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux

3cd86a58 · Linus Torvalds <[email protected]> · 2020-03-31 10:05:01 -07:00

Pull arm64 updates from Catalin Marinas:
 "The bulk is in-kernel pointer authentication, activity monitors and
  lots of asm symbol annotations. I also queued the sys_mremap() patch
  commenting the asymmetry in the address untagging.

  Summary:

   - In-kernel Pointer Authentication support (previously only offered
     to user space).

   - ARM Activity Monitors (AMU) extension support allowing better CPU
     utilisation numbers for the scheduler (frequency invariance).

   - Memory hot-remove support for arm64.

   - Lots of asm annotations (SYM_*) in preparation for the in-kernel
     Branch Target Identification (BTI) support.

   - arm64 perf updates: ARMv8.5-PMU 64-bit counters, refactoring the
     PMU init callbacks, support for new DT compatibles.

   - IPv6 header checksum optimisation.

   - Fixes: SDEI (software delegated exception interface) double-lock on
     hibernate with shared events.

   - Minor clean-ups and refactoring: cpu_ops accessor,
     cpu_do_switch_mm() converted to C, cpufeature finalisation helper.

   - sys_mremap() comment explaining the asymmetric address untagging
     behaviour"

* tag 'arm64-upstream' of git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux: (81 commits)
  mm/mremap: Add comment explaining the untagging behaviour of mremap()
  arm64: head: Convert install_el2_stub to SYM_INNER_LABEL
  arm64: Introduce get_cpu_ops() helper function
  arm64: Rename cpu_read_ops() to init_cpu_ops()
  arm64: Declare ACPI parking protocol CPU operation if needed
  arm64: move kimage_vaddr to .rodata
  arm64: use mov_q instead of literal ldr
  arm64: Kconfig: verify binutils support for ARM64_PTR_AUTH
  lkdtm: arm64: test kernel pointer authentication
  arm64: compile the kernel with ptrauth return address signing
  kconfig: Add support for 'as-option'
  arm64: suspend: restore the kernel ptrauth keys
  arm64: __show_regs: strip PAC from lr in printk
  arm64: unwind: strip PAC from kernel addresses
  arm64: mask PAC bits of __builtin_return_address
  arm64: initialize ptrauth keys for kernel booting task
  arm64: initialize and switch ptrauth kernel keys
  arm64: enable ptrauth earlier
  arm64: cpufeature: handle conflicts based on capability
  arm64: cpufeature: Move cpu capability helpers inside C file
  ...
Commit
3cd86a58f7734bf9cef38f6f899608ebcaa3da13
Parents
a8222fd5 · b2a84de2

Merge commit. Changes below are compared with the first parent: a8222fd5.

Changes

88 files changed · +2192 −700

FileStatusAddDelContent
Documentation/arm64/amu.rstadded+112−0View file
Documentation/arm64/booting.rstmodified+14−0View file
Documentation/arm64/index.rstmodified+1−0View file
arch/arm64/Kconfigmodified+66−3View file
arch/arm64/Makefilemodified+11−0View file
arch/arm64/crypto/aes-ce.Smodified+2−2View file
arch/arm64/crypto/aes-modes.Smodified+24−24View file
arch/arm64/crypto/aes-neon.Smodified+2−2View file
arch/arm64/crypto/ghash-ce-core.Smodified+8−8View file
arch/arm64/include/asm/asm_pointer_auth.hadded+65−0View file
arch/arm64/include/asm/assembler.hmodified+10−6View file
arch/arm64/include/asm/checksum.hmodified+6−1View file
arch/arm64/include/asm/compiler.hadded+24−0View file
arch/arm64/include/asm/cpu_ops.hmodified+4−4View file
arch/arm64/include/asm/cpucaps.hmodified+4−1View file
arch/arm64/include/asm/cpufeature.hmodified+96−29View file
arch/arm64/include/asm/esr.hmodified+1−1View file
arch/arm64/include/asm/kvm_arm.hmodified+1−0View file
arch/arm64/include/asm/kvm_asm.hmodified+4−0View file
arch/arm64/include/asm/kvm_mmu.hmodified+4−5View file
arch/arm64/include/asm/memory.hmodified+1−0View file
arch/arm64/include/asm/mmu.hmodified+6−4View file
arch/arm64/include/asm/mmu_context.hmodified+2−0View file
arch/arm64/include/asm/page.hmodified+4−0View file
arch/arm64/include/asm/perf_event.hmodified+2−1View file
arch/arm64/include/asm/pointer_auth.hmodified+22−28View file
arch/arm64/include/asm/proc-fns.hmodified+0−2View file
arch/arm64/include/asm/processor.hmodified+2−1View file
arch/arm64/include/asm/smp.hmodified+12−0View file
arch/arm64/include/asm/stackprotector.hmodified+5−0View file
arch/arm64/include/asm/sysreg.hmodified+48−0View file
arch/arm64/include/asm/topology.hmodified+9−0View file
arch/arm64/kernel/Makefilemodified+1−1View file
arch/arm64/kernel/armv8_deprecated.cmodified+1−1View file
arch/arm64/kernel/asm-offsets.cmodified+16−0View file
arch/arm64/kernel/cpu-reset.Smodified+1−1View file
arch/arm64/kernel/cpu_errata.cmodified+8−10View file
arch/arm64/kernel/cpu_ops.cmodified+9−2View file
arch/arm64/kernel/cpufeature.cmodified+142−23View file
arch/arm64/kernel/cpuidle.cmodified+5−4View file
arch/arm64/kernel/entry-common.cmodified+1−1View file
arch/arm64/kernel/entry-ftrace.Smodified+24−24View file
arch/arm64/kernel/entry.Smodified+64−57View file
arch/arm64/kernel/head.Smodified+46−40View file
arch/arm64/kernel/hibernate-asm.Smodified+0−2View file
arch/arm64/kernel/hyp-stub.Smodified+1−1View file
arch/arm64/kernel/machine_kexec_file.cmodified+1−1View file
arch/arm64/kernel/perf_event.cmodified+181−157View file
arch/arm64/kernel/pointer_auth.cmodified+2−5View file
arch/arm64/kernel/process.cmodified+3−2View file
arch/arm64/kernel/ptrace.cmodified+8−8View file
arch/arm64/kernel/relocate_kernel.Smodified+1−3View file
arch/arm64/kernel/setup.cmodified+5−3View file
arch/arm64/kernel/sleep.Smodified+2−0View file
arch/arm64/kernel/smp.cmodified+92−67View file
arch/arm64/kernel/stacktrace.cmodified+4−1View file
arch/arm64/kernel/topology.cmodified+180−0View file
arch/arm64/kernel/vdso/sigreturn.Smodified+2−2View file
arch/arm64/kernel/vdso32/sigreturn.Smodified+8−15View file
arch/arm64/kvm/hyp-init.Smodified+8−10View file
arch/arm64/kvm/hyp.Smodified+2−2View file
arch/arm64/kvm/hyp/fpsimd.Smodified+4−4View file
arch/arm64/kvm/hyp/hyp-entry.Smodified+16−11View file
arch/arm64/kvm/hyp/switch.cmodified+20−8View file
arch/arm64/kvm/hyp/sysreg-sr.cmodified+4−4View file
arch/arm64/kvm/hyp/tlb.cmodified+4−4View file
arch/arm64/kvm/sys_regs.cmodified+101−2View file
arch/arm64/lib/csum.cmodified+27−0View file
arch/arm64/lib/strcmp.Smodified+1−1View file
arch/arm64/mm/context.cmodified+30−2View file
arch/arm64/mm/mmu.cmodified+370−9View file
arch/arm64/mm/proc.Smodified+64−40View file
arch/arm64/mm/ptdump_debugfs.cmodified+4−0View file
drivers/base/arch_topology.cmodified+12−0View file
drivers/clocksource/arm_arch_timer.cmodified+15−3View file
drivers/cpufreq/cpufreq.cmodified+20−0View file
drivers/firmware/arm_sdei.cmodified+36−35View file
drivers/misc/lkdtm/bugs.cmodified+36−0View file
drivers/misc/lkdtm/core.cmodified+1−0View file
drivers/misc/lkdtm/lkdtm.hmodified+1−0View file
drivers/perf/arm-ccn.cmodified+10−10View file
drivers/perf/arm_spe_pmu.cmodified+1−1View file
include/linux/arch_topology.hmodified+2−0View file
include/linux/cpufreq.hmodified+5−0View file
include/linux/perf/arm_pmu.hmodified+1−0View file
include/linux/stackprotector.hmodified+1−1View file
mm/mremap.cmodified+10−0View file
scripts/Kconfig.includemodified+6−0View file

Only the first 600 diff lines are shown. Download the complete patch.

Documentation/arm64/amu.rst

View file
diff --git a/Documentation/arm64/amu.rst b/Documentation/arm64/amu.rst
new file mode 100644
index 0000000..5057b11
--- /dev/null
+++ b/Documentation/arm64/amu.rst
@@ -0,0 +1,112 @@
+=======================================================
+Activity Monitors Unit (AMU) extension in AArch64 Linux
+=======================================================
+
+Author: Ionela Voinescu <[email protected]>
+
+Date: 2019-09-10
+
+This document briefly describes the provision of Activity Monitors Unit
+support in AArch64 Linux.
+
+
+Architecture overview
+---------------------
+
+The activity monitors extension is an optional extension introduced by the
+ARMv8.4 CPU architecture.
+
+The activity monitors unit, implemented in each CPU, provides performance
+counters intended for system management use. The AMU extension provides a
+system register interface to the counter registers and also supports an
+optional external memory-mapped interface.
+
+Version 1 of the Activity Monitors architecture implements a counter group
+of four fixed and architecturally defined 64-bit event counters.
+ - CPU cycle counter: increments at the frequency of the CPU.
+ - Constant counter: increments at the fixed frequency of the system
+ clock.
+ - Instructions retired: increments with every architecturally executed
+ instruction.
+ - Memory stall cycles: counts instruction dispatch stall cycles caused by
+ misses in the last level cache within the clock domain.
+
+When in WFI or WFE these counters do not increment.
+
+The Activity Monitors architecture provides space for up to 16 architected
+event counters. Future versions of the architecture may use this space to
+implement additional architected event counters.
+
+Additionally, version 1 implements a counter group of up to 16 auxiliary
+64-bit event counters.
+
+On cold reset all counters reset to 0.
+
+
+Basic support
+-------------
+
+The kernel can safely run a mix of CPUs with and without support for the
+activity monitors extension. Therefore, when CONFIG_ARM64_AMU_EXTN is
+selected we unconditionally enable the capability to allow any late CPU
+(secondary or hotplugged) to detect and use the feature.
+
+When the feature is detected on a CPU, we flag the availability of the
+feature but this does not guarantee the correct functionality of the
+counters, only the presence of the extension.
+
+Firmware (code running at higher exception levels, e.g. arm-tf) support is
+needed to:
+ - Enable access for lower exception levels (EL2 and EL1) to the AMU
+ registers.
+ - Enable the counters. If not enabled these will read as 0.
+ - Save/restore the counters before/after the CPU is being put/brought up
+ from the 'off' power state.
+
+When using kernels that have this feature enabled but boot with broken
+firmware the user may experience panics or lockups when accessing the
+counter registers. Even if these symptoms are not observed, the values
+returned by the register reads might not correctly reflect reality. Most
+commonly, the counters will read as 0, indicating that they are not
+enabled.
+
+If proper support is not provided in firmware it's best to disable
+CONFIG_ARM64_AMU_EXTN. To be noted that for security reasons, this does not
+bypass the setting of AMUSERENR_EL0 to trap accesses from EL0 (userspace) to
+EL1 (kernel). Therefore, firmware should still ensure accesses to AMU registers
+are not trapped in EL2/EL3.
+
+The fixed counters of AMUv1 are accessible though the following system
+register definitions:
+ - SYS_AMEVCNTR0_CORE_EL0
+ - SYS_AMEVCNTR0_CONST_EL0
+ - SYS_AMEVCNTR0_INST_RET_EL0
+ - SYS_AMEVCNTR0_MEM_STALL_EL0
+
+Auxiliary platform specific counters can be accessed using
+SYS_AMEVCNTR1_EL0(n), where n is a value between 0 and 15.
+
+Details can be found in: arch/arm64/include/asm/sysreg.h.
+
+
+Userspace access
+----------------
+
+Currently, access from userspace to the AMU registers is disabled due to:
+ - Security reasons: they might expose information about code executed in
+ secure mode.
+ - Purpose: AMU counters are intended for system management use.
+
+Also, the presence of the feature is not visible to userspace.
+
+
+Virtualization
+--------------
+
+Currently, access from userspace (EL0) and kernelspace (EL1) on the KVM
+guest side is disabled due to:
+ - Security reasons: they might expose information about code executed
+ by other guests or the host.
+
+Any attempt to access the AMU registers will result in an UNDEFINED
+exception being injected into the guest.

Documentation/arm64/booting.rst

View file
diff --git a/Documentation/arm64/booting.rst b/Documentation/arm64/booting.rst
index 5d78a6f..a3f1a47 100644
--- a/Documentation/arm64/booting.rst
+++ b/Documentation/arm64/booting.rst
@@ -248,6 +248,20 @@ Before jumping into the kernel, the following conditions must be met:
- HCR_EL2.APK (bit 40) must be initialised to 0b1
- HCR_EL2.API (bit 41) must be initialised to 0b1
+ For CPUs with Activity Monitors Unit v1 (AMUv1) extension present:
+ - If EL3 is present:
+ CPTR_EL3.TAM (bit 30) must be initialised to 0b0
+ CPTR_EL2.TAM (bit 30) must be initialised to 0b0
+ AMCNTENSET0_EL0 must be initialised to 0b1111
+ AMCNTENSET1_EL0 must be initialised to a platform specific value
+ having 0b1 set for the corresponding bit for each of the auxiliary
+ counters present.
+ - If the kernel is entered at EL1:
+ AMCNTENSET0_EL0 must be initialised to 0b1111
+ AMCNTENSET1_EL0 must be initialised to a platform specific value
+ having 0b1 set for the corresponding bit for each of the auxiliary
+ counters present.
+
The requirements described above for CPU mode, caches, MMUs, architected
timers, coherency and system registers apply to all CPUs. All CPUs must
enter the kernel in the same exception level.

Documentation/arm64/index.rst

View file
diff --git a/Documentation/arm64/index.rst b/Documentation/arm64/index.rst
index 5c0c69d..09cbb4e 100644
--- a/Documentation/arm64/index.rst
+++ b/Documentation/arm64/index.rst
@@ -6,6 +6,7 @@ ARM64 Architecture
:maxdepth: 1
acpi_object_usage
+ amu
arm-acpi
booting
cpu-feature-registers

arch/arm64/Kconfig

View file
diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
index c6c32fb..6e41c4b 100644
--- a/arch/arm64/Kconfig
+++ b/arch/arm64/Kconfig
@@ -117,6 +117,7 @@ config ARM64
select HAVE_ALIGNED_STRUCT_PAGE if SLUB
select HAVE_ARCH_AUDITSYSCALL
select HAVE_ARCH_BITREVERSE
+ select HAVE_ARCH_COMPILER_H
select HAVE_ARCH_HUGE_VMAP
select HAVE_ARCH_JUMP_LABEL
select HAVE_ARCH_JUMP_LABEL_RELATIVE
@@ -280,6 +281,9 @@ config ZONE_DMA32
config ARCH_ENABLE_MEMORY_HOTPLUG
def_bool y
+config ARCH_ENABLE_MEMORY_HOTREMOVE
+ def_bool y
+
config SMP
def_bool y
@@ -951,11 +955,11 @@ config HOTPLUG_CPU
# Common NUMA Features
config NUMA
- bool "Numa Memory Allocation and Scheduler Support"
+ bool "NUMA Memory Allocation and Scheduler Support"
select ACPI_NUMA if ACPI
select OF_NUMA
help
- Enable NUMA (Non Uniform Memory Access) support.
+ Enable NUMA (Non-Uniform Memory Access) support.
The kernel will try to allocate memory used by a CPU on the
local memory of the CPU and add some more
@@ -1497,6 +1501,9 @@ config ARM64_PTR_AUTH
bool "Enable support for pointer authentication"
default y
depends on !KVM || ARM64_VHE
+ depends on (CC_HAS_SIGN_RETURN_ADDRESS || CC_HAS_BRANCH_PROT_PAC_RET) && AS_HAS_PAC
+ depends on CC_IS_GCC || (CC_IS_CLANG && AS_HAS_CFI_NEGATE_RA_STATE)
+ depends on (!FUNCTION_GRAPH_TRACER || DYNAMIC_FTRACE_WITH_REGS)
help
Pointer authentication (part of the ARMv8.3 Extensions) provides
instructions for signing and authenticating pointers against secret
@@ -1504,16 +1511,72 @@ config ARM64_PTR_AUTH
and other attacks.
This option enables these instructions at EL0 (i.e. for userspace).
-
Choosing this option will cause the kernel to initialise secret keys
for each process at exec() time, with these keys being
context-switched along with the process.
+ If the compiler supports the -mbranch-protection or
+ -msign-return-address flag (e.g. GCC 7 or later), then this option
+ will also cause the kernel itself to be compiled with return address
+ protection. In this case, and if the target hardware is known to
+ support pointer authentication, then CONFIG_STACKPROTECTOR can be
+ disabled with minimal loss of protection.
+
The feature is detected at runtime. If the feature is not present in
hardware it will not be advertised to userspace/KVM guest nor will it
be enabled. However, KVM guest also require VHE mode and hence
CONFIG_ARM64_VHE=y option to use this feature.
+ If the feature is present on the boot CPU but not on a late CPU, then
+ the late CPU will be parked. Also, if the boot CPU does not have
+ address auth and the late CPU has then the late CPU will still boot
+ but with the feature disabled. On such a system, this option should
+ not be selected.
+
+ This feature works with FUNCTION_GRAPH_TRACER option only if
+ DYNAMIC_FTRACE_WITH_REGS is enabled.
+
+config CC_HAS_BRANCH_PROT_PAC_RET
+ # GCC 9 or later, clang 8 or later
+ def_bool $(cc-option,-mbranch-protection=pac-ret+leaf)
+
+config CC_HAS_SIGN_RETURN_ADDRESS
+ # GCC 7, 8
+ def_bool $(cc-option,-msign-return-address=all)
+
+config AS_HAS_PAC
+ def_bool $(as-option,-Wa$(comma)-march=armv8.3-a)
+
+config AS_HAS_CFI_NEGATE_RA_STATE
+ def_bool $(as-instr,.cfi_startproc\n.cfi_negate_ra_state\n.cfi_endproc\n)
+
+endmenu
+
+menu "ARMv8.4 architectural features"
+
+config ARM64_AMU_EXTN
+ bool "Enable support for the Activity Monitors Unit CPU extension"
+ default y
+ help
+ The activity monitors extension is an optional extension introduced
+ by the ARMv8.4 CPU architecture. This enables support for version 1
+ of the activity monitors architecture, AMUv1.
+
+ To enable the use of this extension on CPUs that implement it, say Y.
+
+ Note that for architectural reasons, firmware _must_ implement AMU
+ support when running on CPUs that present the activity monitors
+ extension. The required support is present in:
+ * Version 1.5 and later of the ARM Trusted Firmware
+
+ For kernels that have this configuration enabled but boot with broken
+ firmware, you may need to say N here until the firmware is fixed.
+ Otherwise you may experience firmware panics or lockups when
+ accessing the counter registers. Even if you are not observing these
+ symptoms, the values returned by the register reads might not
+ correctly reflect reality. Most commonly, the value read will be 0,
+ indicating that the counter is not enabled.
+
endmenu
menu "ARMv8.5 architectural features"

arch/arm64/Makefile

View file
diff --git a/arch/arm64/Makefile b/arch/arm64/Makefile
index dca1a97..f15f92b 100644
--- a/arch/arm64/Makefile
+++ b/arch/arm64/Makefile
@@ -65,6 +65,17 @@ stack_protector_prepare: prepare0
include/generated/asm-offsets.h))
endif
+ifeq ($(CONFIG_ARM64_PTR_AUTH),y)
+branch-prot-flags-$(CONFIG_CC_HAS_SIGN_RETURN_ADDRESS) := -msign-return-address=all
+branch-prot-flags-$(CONFIG_CC_HAS_BRANCH_PROT_PAC_RET) := -mbranch-protection=pac-ret+leaf
+# -march=armv8.3-a enables the non-nops instructions for PAC, to avoid the
+# compiler to generate them and consequently to break the single image contract
+# we pass it only to the assembler. This option is utilized only in case of non
+# integrated assemblers.
+branch-prot-flags-$(CONFIG_AS_HAS_PAC) += -Wa,-march=armv8.3-a
+KBUILD_CFLAGS += $(branch-prot-flags-y)
+endif
+
ifeq ($(CONFIG_CPU_BIG_ENDIAN), y)
KBUILD_CPPFLAGS += -mbig-endian
CHECKFLAGS += -D__AARCH64EB__

arch/arm64/crypto/aes-ce.S

View file
diff --git a/arch/arm64/crypto/aes-ce.S b/arch/arm64/crypto/aes-ce.S
index 4506255..1dc5bbb 100644
--- a/arch/arm64/crypto/aes-ce.S
+++ b/arch/arm64/crypto/aes-ce.S
@@ -9,8 +9,8 @@
#include <linux/linkage.h>
#include <asm/assembler.h>
-#define AES_ENTRY(func) SYM_FUNC_START(ce_ ## func)
-#define AES_ENDPROC(func) SYM_FUNC_END(ce_ ## func)
+#define AES_FUNC_START(func) SYM_FUNC_START(ce_ ## func)
+#define AES_FUNC_END(func) SYM_FUNC_END(ce_ ## func)
.arch armv8-a+crypto

arch/arm64/crypto/aes-modes.S

View file
diff --git a/arch/arm64/crypto/aes-modes.S b/arch/arm64/crypto/aes-modes.S
index 8a2faa4..cf618d8 100644
--- a/arch/arm64/crypto/aes-modes.S
+++ b/arch/arm64/crypto/aes-modes.S
@@ -51,7 +51,7 @@ SYM_FUNC_END(aes_decrypt_block5x)
* int blocks)
*/
-AES_ENTRY(aes_ecb_encrypt)
+AES_FUNC_START(aes_ecb_encrypt)
stp x29, x30, [sp, #-16]!
mov x29, sp
@@ -79,10 +79,10 @@ ST5( st1 {v4.16b}, [x0], #16 )
.Lecbencout:
ldp x29, x30, [sp], #16
ret
-AES_ENDPROC(aes_ecb_encrypt)
+AES_FUNC_END(aes_ecb_encrypt)
-AES_ENTRY(aes_ecb_decrypt)
+AES_FUNC_START(aes_ecb_decrypt)
stp x29, x30, [sp, #-16]!
mov x29, sp
@@ -110,7 +110,7 @@ ST5( st1 {v4.16b}, [x0], #16 )
.Lecbdecout:
ldp x29, x30, [sp], #16
ret
-AES_ENDPROC(aes_ecb_decrypt)
+AES_FUNC_END(aes_ecb_decrypt)
/*
@@ -126,7 +126,7 @@ AES_ENDPROC(aes_ecb_decrypt)
* u32 const rk2[]);
*/
-AES_ENTRY(aes_essiv_cbc_encrypt)
+AES_FUNC_START(aes_essiv_cbc_encrypt)
ld1 {v4.16b}, [x5] /* get iv */
mov w8, #14 /* AES-256: 14 rounds */
@@ -135,7 +135,7 @@ AES_ENTRY(aes_essiv_cbc_encrypt)
enc_switch_key w3, x2, x6
b .Lcbcencloop4x
-AES_ENTRY(aes_cbc_encrypt)
+AES_FUNC_START(aes_cbc_encrypt)
ld1 {v4.16b}, [x5] /* get iv */
enc_prepare w3, x2, x6
@@ -167,10 +167,10 @@ AES_ENTRY(aes_cbc_encrypt)
.Lcbcencout:
st1 {v4.16b}, [x5] /* return iv */
ret
-AES_ENDPROC(aes_cbc_encrypt)
-AES_ENDPROC(aes_essiv_cbc_encrypt)
+AES_FUNC_END(aes_cbc_encrypt)
+AES_FUNC_END(aes_essiv_cbc_encrypt)
-AES_ENTRY(aes_essiv_cbc_decrypt)
+AES_FUNC_START(aes_essiv_cbc_decrypt)
stp x29, x30, [sp, #-16]!
mov x29, sp
@@ -181,7 +181,7 @@ AES_ENTRY(aes_essiv_cbc_decrypt)
encrypt_block cbciv, w8, x6, x7, w9
b .Lessivcbcdecstart
-AES_ENTRY(aes_cbc_decrypt)
+AES_FUNC_START(aes_cbc_decrypt)
stp x29, x30, [sp, #-16]!
mov x29, sp
@@ -238,8 +238,8 @@ ST5( st1 {v4.16b}, [x0], #16 )
st1 {cbciv.16b}, [x5] /* return iv */
ldp x29, x30, [sp], #16
ret
-AES_ENDPROC(aes_cbc_decrypt)
-AES_ENDPROC(aes_essiv_cbc_decrypt)
+AES_FUNC_END(aes_cbc_decrypt)
+AES_FUNC_END(aes_essiv_cbc_decrypt)
/*
@@ -249,7 +249,7 @@ AES_ENDPROC(aes_essiv_cbc_decrypt)
* int rounds, int bytes, u8 const iv[])
*/
-AES_ENTRY(aes_cbc_cts_encrypt)
+AES_FUNC_START(aes_cbc_cts_encrypt)
adr_l x8, .Lcts_permute_table
sub x4, x4, #16
add x9, x8, #32
@@ -276,9 +276,9 @@ AES_ENTRY(aes_cbc_cts_encrypt)
st1 {v0.16b}, [x4] /* overlapping stores */
st1 {v1.16b}, [x0]
ret
-AES_ENDPROC(aes_cbc_cts_encrypt)
+AES_FUNC_END(aes_cbc_cts_encrypt)
-AES_ENTRY(aes_cbc_cts_decrypt)
+AES_FUNC_START(aes_cbc_cts_decrypt)
adr_l x8, .Lcts_permute_table
sub x4, x4, #16
add x9, x8, #32
@@ -305,7 +305,7 @@ AES_ENTRY(aes_cbc_cts_decrypt)
st1 {v2.16b}, [x4] /* overlapping stores */
st1 {v0.16b}, [x0]
ret
-AES_ENDPROC(aes_cbc_cts_decrypt)
+AES_FUNC_END(aes_cbc_cts_decrypt)
.section ".rodata", "a"
.align 6
@@ -324,7 +324,7 @@ AES_ENDPROC(aes_cbc_cts_decrypt)
* int blocks, u8 ctr[])
*/
-AES_ENTRY(aes_ctr_encrypt)
+AES_FUNC_START(aes_ctr_encrypt)
stp x29, x30, [sp, #-16]!
mov x29, sp
@@ -409,7 +409,7 @@ ST5( st1 {v4.16b}, [x0], #16 )
rev x7, x7
ins vctr.d[0], x7
b .Lctrcarrydone
-AES_ENDPROC(aes_ctr_encrypt)
+AES_FUNC_END(aes_ctr_encrypt)
/*
@@ -433,7 +433,7 @@ AES_ENDPROC(aes_ctr_encrypt)
uzp1 xtsmask.4s, xtsmask.4s, \tmp\().4s
.endm
-AES_ENTRY(aes_xts_encrypt)
+AES_FUNC_START(aes_xts_encrypt)
stp x29, x30, [sp, #-16]!
mov x29, sp
@@ -518,9 +518,9 @@ AES_ENTRY(aes_xts_encrypt)
st1 {v2.16b}, [x4] /* overlapping stores */
mov w4, wzr
b .Lxtsencctsout
-AES_ENDPROC(aes_xts_encrypt)
+AES_FUNC_END(aes_xts_encrypt)
-AES_ENTRY(aes_xts_decrypt)
+AES_FUNC_START(aes_xts_decrypt)
stp x29, x30, [sp, #-16]!
mov x29, sp
@@ -612,13 +612,13 @@ AES_ENTRY(aes_xts_decrypt)
st1 {v2.16b}, [x4] /* overlapping stores */
mov w4, wzr
b .Lxtsdecctsout
-AES_ENDPROC(aes_xts_decrypt)
+AES_FUNC_END(aes_xts_decrypt)
/*
* aes_mac_update(u8 const in[], u32 const rk[], int rounds,
* int blocks, u8 dg[], int enc_before, int enc_after)
*/
-AES_ENTRY(aes_mac_update)
+AES_FUNC_START(aes_mac_update)
frame_push 6
mov x19, x0
@@ -676,4 +676,4 @@ AES_ENTRY(aes_mac_update)
ld1 {v0.16b}, [x23] /* get dg */
enc_prepare w21, x20, x0
b .Lmacloop4x
-AES_ENDPROC(aes_mac_update)
+AES_FUNC_END(aes_mac_update)

arch/arm64/crypto/aes-neon.S

View file
diff --git a/arch/arm64/crypto/aes-neon.S b/arch/arm64/crypto/aes-neon.S
index 247d34d..e47d3ec 100644
--- a/arch/arm64/crypto/aes-neon.S
+++ b/arch/arm64/crypto/aes-neon.S
@@ -8,8 +8,8 @@
#include <linux/linkage.h>
#include <asm/assembler.h>
-#define AES_ENTRY(func) SYM_FUNC_START(neon_ ## func)
-#define AES_ENDPROC(func) SYM_FUNC_END(neon_ ## func)
+#define AES_FUNC_START(func) SYM_FUNC_START(neon_ ## func)
+#define AES_FUNC_END(func) SYM_FUNC_END(neon_ ## func)
xtsmask .req v7
cbciv .req v7

arch/arm64/crypto/ghash-ce-core.S

View file
diff --git a/arch/arm64/crypto/ghash-ce-core.S b/arch/arm64/crypto/ghash-ce-core.S
index 084c6a3..6b958dc 100644
--- a/arch/arm64/crypto/ghash-ce-core.S
+++ b/arch/arm64/crypto/ghash-ce-core.S
@@ -587,20 +587,20 @@ CPU_LE( rev w8, w8 )
* struct ghash_key const *k, u64 dg[], u8 ctr[],
* int rounds, u8 tag)
*/
-ENTRY(pmull_gcm_encrypt)
+SYM_FUNC_START(pmull_gcm_encrypt)
pmull_gcm_do_crypt 1
-ENDPROC(pmull_gcm_encrypt)
+SYM_FUNC_END(pmull_gcm_encrypt)
/*
* void pmull_gcm_decrypt(int blocks, u8 dst[], const u8 src[],
* struct ghash_key const *k, u64 dg[], u8 ctr[],
* int rounds, u8 tag)
*/
-ENTRY(pmull_gcm_decrypt)
+SYM_FUNC_START(pmull_gcm_decrypt)
pmull_gcm_do_crypt 0
-ENDPROC(pmull_gcm_decrypt)
+SYM_FUNC_END(pmull_gcm_decrypt)
-pmull_gcm_ghash_4x:
+SYM_FUNC_START_LOCAL(pmull_gcm_ghash_4x)
movi MASK.16b, #0xe1
shl MASK.2d, MASK.2d, #57
@@ -681,9 +681,9 @@ pmull_gcm_ghash_4x:
eor XL.16b, XL.16b, T2.16b
ret
-ENDPROC(pmull_gcm_ghash_4x)
+SYM_FUNC_END(pmull_gcm_ghash_4x)
-pmull_gcm_enc_4x:
+SYM_FUNC_START_LOCAL(pmull_gcm_enc_4x)
ld1 {KS0.16b}, [x5] // load upper counter
sub w10, w8, #4
sub w11, w8, #3
@@ -746,7 +746,7 @@ pmull_gcm_enc_4x:
eor INP3.16b, INP3.16b, KS3.16b
ret
-ENDPROC(pmull_gcm_enc_4x)
+SYM_FUNC_END(pmull_gcm_enc_4x)
.section ".rodata", "a"
.align 6

arch/arm64/include/asm/asm_pointer_auth.h

View file
diff --git a/arch/arm64/include/asm/asm_pointer_auth.h b/arch/arm64/include/asm/asm_pointer_auth.h
new file mode 100644
index 0000000..ce2a848
--- /dev/null
+++ b/arch/arm64/include/asm/asm_pointer_auth.h
@@ -0,0 +1,65 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+#ifndef __ASM_ASM_POINTER_AUTH_H
+#define __ASM_ASM_POINTER_AUTH_H
+
+#include <asm/alternative.h>
+#include <asm/asm-offsets.h>
+#include <asm/cpufeature.h>
+#include <asm/sysreg.h>
+
+#ifdef CONFIG_ARM64_PTR_AUTH
+/*
+ * thread.keys_user.ap* as offset exceeds the #imm offset range
+ * so use the base value of ldp as thread.keys_user and offset as
+ * thread.keys_user.ap*.
+ */
+ .macro ptrauth_keys_install_user tsk, tmp1, tmp2, tmp3
+ mov \tmp1, #THREAD_KEYS_USER
+ add \tmp1, \tsk, \tmp1
+alternative_if_not ARM64_HAS_ADDRESS_AUTH
+ b .Laddr_auth_skip_\@
+alternative_else_nop_endif
+ ldp \tmp2, \tmp3, [\tmp1, #PTRAUTH_USER_KEY_APIA]
+ msr_s SYS_APIAKEYLO_EL1, \tmp2
+ msr_s SYS_APIAKEYHI_EL1, \tmp3
+ ldp \tmp2, \tmp3, [\tmp1, #PTRAUTH_USER_KEY_APIB]
+ msr_s SYS_APIBKEYLO_EL1, \tmp2
+ msr_s SYS_APIBKEYHI_EL1, \tmp3
+ ldp \tmp2, \tmp3, [\tmp1, #PTRAUTH_USER_KEY_APDA]
+ msr_s SYS_APDAKEYLO_EL1, \tmp2
+ msr_s SYS_APDAKEYHI_EL1, \tmp3
+ ldp \tmp2, \tmp3, [\tmp1, #PTRAUTH_USER_KEY_APDB]
+ msr_s SYS_APDBKEYLO_EL1, \tmp2
+ msr_s SYS_APDBKEYHI_EL1, \tmp3
+.Laddr_auth_skip_\@:
+alternative_if ARM64_HAS_GENERIC_AUTH
+ ldp \tmp2, \tmp3, [\tmp1, #PTRAUTH_USER_KEY_APGA]
+ msr_s SYS_APGAKEYLO_EL1, \tmp2
+ msr_s SYS_APGAKEYHI_EL1, \tmp3

This diff is incomplete. Download the complete patch.

arch/arm64/include/asm/assembler.h

View file

This diff is incomplete. Download the complete patch.

arch/arm64/include/asm/checksum.h

View file

This diff is incomplete. Download the complete patch.

arch/arm64/include/asm/compiler.h

View file

This diff is incomplete. Download the complete patch.

arch/arm64/include/asm/cpu_ops.h

View file

This diff is incomplete. Download the complete patch.

arch/arm64/include/asm/cpucaps.h

View file

This diff is incomplete. Download the complete patch.

arch/arm64/include/asm/cpufeature.h

View file

This diff is incomplete. Download the complete patch.

arch/arm64/include/asm/esr.h

View file

This diff is incomplete. Download the complete patch.

arch/arm64/include/asm/kvm_arm.h

View file

This diff is incomplete. Download the complete patch.

arch/arm64/include/asm/kvm_asm.h

View file

This diff is incomplete. Download the complete patch.

arch/arm64/include/asm/kvm_mmu.h

View file

This diff is incomplete. Download the complete patch.

arch/arm64/include/asm/memory.h

View file

This diff is incomplete. Download the complete patch.

arch/arm64/include/asm/mmu.h

View file

This diff is incomplete. Download the complete patch.

arch/arm64/include/asm/mmu_context.h

View file

This diff is incomplete. Download the complete patch.

arch/arm64/include/asm/page.h

View file

This diff is incomplete. Download the complete patch.

arch/arm64/include/asm/perf_event.h

View file

This diff is incomplete. Download the complete patch.

arch/arm64/include/asm/pointer_auth.h

View file

This diff is incomplete. Download the complete patch.

arch/arm64/include/asm/proc-fns.h

View file

This diff is incomplete. Download the complete patch.

arch/arm64/include/asm/processor.h

View file

This diff is incomplete. Download the complete patch.

arch/arm64/include/asm/smp.h

View file

This diff is incomplete. Download the complete patch.

arch/arm64/include/asm/stackprotector.h

View file

This diff is incomplete. Download the complete patch.

arch/arm64/include/asm/sysreg.h

View file

This diff is incomplete. Download the complete patch.

arch/arm64/include/asm/topology.h

View file

This diff is incomplete. Download the complete patch.

arch/arm64/kernel/Makefile

View file

This diff is incomplete. Download the complete patch.

arch/arm64/kernel/armv8_deprecated.c

View file

This diff is incomplete. Download the complete patch.

arch/arm64/kernel/asm-offsets.c

View file

This diff is incomplete. Download the complete patch.

arch/arm64/kernel/cpu-reset.S

View file

This diff is incomplete. Download the complete patch.

arch/arm64/kernel/cpu_errata.c

View file

This diff is incomplete. Download the complete patch.

arch/arm64/kernel/cpu_ops.c

View file

This diff is incomplete. Download the complete patch.

arch/arm64/kernel/cpufeature.c

View file

This diff is incomplete. Download the complete patch.

arch/arm64/kernel/cpuidle.c

View file

This diff is incomplete. Download the complete patch.

arch/arm64/kernel/entry-common.c

View file

This diff is incomplete. Download the complete patch.

arch/arm64/kernel/entry-ftrace.S

View file

This diff is incomplete. Download the complete patch.

arch/arm64/kernel/entry.S

View file

This diff is incomplete. Download the complete patch.

arch/arm64/kernel/head.S

View file

This diff is incomplete. Download the complete patch.

arch/arm64/kernel/hibernate-asm.S

View file

This diff is incomplete. Download the complete patch.

arch/arm64/kernel/hyp-stub.S

View file

This diff is incomplete. Download the complete patch.

arch/arm64/kernel/machine_kexec_file.c

View file

This diff is incomplete. Download the complete patch.

arch/arm64/kernel/perf_event.c

View file

This diff is incomplete. Download the complete patch.

arch/arm64/kernel/pointer_auth.c

View file

This diff is incomplete. Download the complete patch.

arch/arm64/kernel/process.c

View file

This diff is incomplete. Download the complete patch.

arch/arm64/kernel/ptrace.c

View file

This diff is incomplete. Download the complete patch.

arch/arm64/kernel/relocate_kernel.S

View file

This diff is incomplete. Download the complete patch.

arch/arm64/kernel/setup.c

View file

This diff is incomplete. Download the complete patch.

arch/arm64/kernel/sleep.S

View file

This diff is incomplete. Download the complete patch.

arch/arm64/kernel/smp.c

View file

This diff is incomplete. Download the complete patch.

arch/arm64/kernel/stacktrace.c

View file

This diff is incomplete. Download the complete patch.

arch/arm64/kernel/topology.c

View file

This diff is incomplete. Download the complete patch.

arch/arm64/kernel/vdso/sigreturn.S

View file

This diff is incomplete. Download the complete patch.

arch/arm64/kernel/vdso32/sigreturn.S

View file

This diff is incomplete. Download the complete patch.

arch/arm64/kvm/hyp-init.S

View file

This diff is incomplete. Download the complete patch.

arch/arm64/kvm/hyp.S

View file

This diff is incomplete. Download the complete patch.

arch/arm64/kvm/hyp/fpsimd.S

View file

This diff is incomplete. Download the complete patch.

arch/arm64/kvm/hyp/hyp-entry.S

View file

This diff is incomplete. Download the complete patch.

arch/arm64/kvm/hyp/switch.c

View file

This diff is incomplete. Download the complete patch.

arch/arm64/kvm/hyp/sysreg-sr.c

View file

This diff is incomplete. Download the complete patch.

arch/arm64/kvm/hyp/tlb.c

View file

This diff is incomplete. Download the complete patch.

arch/arm64/kvm/sys_regs.c

View file

This diff is incomplete. Download the complete patch.

arch/arm64/lib/csum.c

View file

This diff is incomplete. Download the complete patch.

arch/arm64/lib/strcmp.S

View file

This diff is incomplete. Download the complete patch.

arch/arm64/mm/context.c

View file

This diff is incomplete. Download the complete patch.

arch/arm64/mm/mmu.c

View file

This diff is incomplete. Download the complete patch.

arch/arm64/mm/proc.S

View file

This diff is incomplete. Download the complete patch.

arch/arm64/mm/ptdump_debugfs.c

View file

This diff is incomplete. Download the complete patch.

drivers/base/arch_topology.c

View file

This diff is incomplete. Download the complete patch.

drivers/clocksource/arm_arch_timer.c

View file

This diff is incomplete. Download the complete patch.

drivers/cpufreq/cpufreq.c

View file

This diff is incomplete. Download the complete patch.

drivers/firmware/arm_sdei.c

View file

This diff is incomplete. Download the complete patch.

drivers/misc/lkdtm/bugs.c

View file

This diff is incomplete. Download the complete patch.

drivers/misc/lkdtm/core.c

View file

This diff is incomplete. Download the complete patch.

drivers/misc/lkdtm/lkdtm.h

View file

This diff is incomplete. Download the complete patch.

drivers/perf/arm-ccn.c

View file

This diff is incomplete. Download the complete patch.

drivers/perf/arm_spe_pmu.c

View file

This diff is incomplete. Download the complete patch.

include/linux/arch_topology.h

View file

This diff is incomplete. Download the complete patch.

include/linux/cpufreq.h

View file

This diff is incomplete. Download the complete patch.

include/linux/perf/arm_pmu.h

View file

This diff is incomplete. Download the complete patch.

include/linux/stackprotector.h

View file

This diff is incomplete. Download the complete patch.

mm/mremap.c

View file

This diff is incomplete. Download the complete patch.

scripts/Kconfig.include

View file

This diff is incomplete. Download the complete patch.