mirror of
https://github.com/torvalds/linux.git
synced 2026-04-25 18:12:26 -04:00
* arm64/for-next/perf: perf: arm_spe: Print the version of SPE detected perf: arm_spe: Add support for SPEv1.2 inverted event filtering perf: Add perf_event_attr::config3 drivers/perf: fsl_imx8_ddr_perf: Remove set-but-not-used variable perf: arm_spe: Support new SPEv1.2/v8.7 'not taken' event perf: arm_spe: Use new PMSIDR_EL1 register enums perf: arm_spe: Drop BIT() and use FIELD_GET/PREP accessors arm64/sysreg: Convert SPE registers to automatic generation arm64: Drop SYS_ from SPE register defines perf: arm_spe: Use feature numbering for PMSEVFR_EL1 defines perf/marvell: Add ACPI support to TAD uncore driver perf/marvell: Add ACPI support to DDR uncore driver perf/arm-cmn: Reset DTM_PMU_CONFIG at probe drivers/perf: hisi: Extract initialization of "cpa_pmu->pmu" drivers/perf: hisi: Simplify the parameters of hisi_pmu_init() drivers/perf: hisi: Advertise the PERF_PMU_CAP_NO_EXCLUDE capability * for-next/sysreg: : arm64 sysreg and cpufeature fixes/updates KVM: arm64: Use symbolic definition for ISR_EL1.A arm64/sysreg: Add definition of ISR_EL1 arm64/sysreg: Add definition for ICC_NMIAR1_EL1 arm64/cpufeature: Remove 4 bit assumption in ARM64_FEATURE_MASK() arm64/sysreg: Fix errors in 32 bit enumeration values arm64/cpufeature: Fix field sign for DIT hwcap detection * for-next/sme: : SME-related updates arm64/sme: Optimise SME exit on syscall entry arm64/sme: Don't use streaming mode to probe the maximum SME VL arm64/ptrace: Use system_supports_tpidr2() to check for TPIDR2 support * for-next/kselftest: (23 commits) : arm64 kselftest fixes and improvements kselftest/arm64: Don't require FA64 for streaming SVE+ZA tests kselftest/arm64: Copy whole EXTRA context kselftest/arm64: Fix enumeration of systems without 128 bit SME for SSVE+ZA kselftest/arm64: Fix enumeration of systems without 128 bit SME kselftest/arm64: Don't require FA64 for streaming SVE tests kselftest/arm64: Limit the maximum VL we try to set via ptrace kselftest/arm64: Correct buffer size for SME ZA storage kselftest/arm64: Remove the local NUM_VL definition kselftest/arm64: Verify simultaneous SSVE and ZA context generation kselftest/arm64: Verify that SSVE signal context has SVE_SIG_FLAG_SM set kselftest/arm64: Remove spurious comment from MTE test Makefile kselftest/arm64: Support build of MTE tests with clang kselftest/arm64: Initialise current at build time in signal tests kselftest/arm64: Don't pass headers to the compiler as source kselftest/arm64: Remove redundant _start labels from FP tests kselftest/arm64: Fix .pushsection for strings in FP tests kselftest/arm64: Run BTI selftests on systems without BTI kselftest/arm64: Fix test numbering when skipping tests kselftest/arm64: Skip non-power of 2 SVE vector lengths in fp-stress kselftest/arm64: Only enumerate power of two VLs in syscall-abi ... * for-next/misc: : Miscellaneous arm64 updates arm64/mm: Intercept pfn changes in set_pte_at() Documentation: arm64: correct spelling arm64: traps: attempt to dump all instructions arm64: Apply dynamic shadow call stack patching in two passes arm64: el2_setup.h: fix spelling typo in comments arm64: Kconfig: fix spelling arm64: cpufeature: Use kstrtobool() instead of strtobool() arm64: Avoid repeated AA64MMFR1_EL1 register read on pagefault path arm64: make ARCH_FORCE_MAX_ORDER selectable * for-next/sme2: (23 commits) : Support for arm64 SME 2 and 2.1 arm64/sme: Fix __finalise_el2 SMEver check kselftest/arm64: Remove redundant _start labels from zt-test kselftest/arm64: Add coverage of SME 2 and 2.1 hwcaps kselftest/arm64: Add coverage of the ZT ptrace regset kselftest/arm64: Add SME2 coverage to syscall-abi kselftest/arm64: Add test coverage for ZT register signal frames kselftest/arm64: Teach the generic signal context validation about ZT kselftest/arm64: Enumerate SME2 in the signal test utility code kselftest/arm64: Cover ZT in the FP stress test kselftest/arm64: Add a stress test program for ZT0 arm64/sme: Add hwcaps for SME 2 and 2.1 features arm64/sme: Implement ZT0 ptrace support arm64/sme: Implement signal handling for ZT arm64/sme: Implement context switching for ZT0 arm64/sme: Provide storage for ZT0 arm64/sme: Add basic enumeration for SME2 arm64/sme: Enable host kernel to access ZT0 arm64/sme: Manually encode ZT0 load and store instructions arm64/esr: Document ISS for ZT0 being disabled arm64/sme: Document SME 2 and SME 2.1 ABI ... * for-next/tpidr2: : Include TPIDR2 in the signal context kselftest/arm64: Add test case for TPIDR2 signal frame records kselftest/arm64: Add TPIDR2 to the set of known signal context records arm64/signal: Include TPIDR2 in the signal context arm64/sme: Document ABI for TPIDR2 signal information * for-next/scs: : arm64: harden shadow call stack pointer handling arm64: Stash shadow stack pointer in the task struct on interrupt arm64: Always load shadow stack pointer directly from the task struct * for-next/compat-hwcap: : arm64: Expose compat ARMv8 AArch32 features (HWCAPs) arm64: Add compat hwcap SSBS arm64: Add compat hwcap SB arm64: Add compat hwcap I8MM arm64: Add compat hwcap ASIMDBF16 arm64: Add compat hwcap ASIMDFHM arm64: Add compat hwcap ASIMDDP arm64: Add compat hwcap FPHP and ASIMDHP * for-next/ftrace: : Add arm64 support for DYNAMICE_FTRACE_WITH_CALL_OPS arm64: avoid executing padding bytes during kexec / hibernation arm64: Implement HAVE_DYNAMIC_FTRACE_WITH_CALL_OPS arm64: ftrace: Update stale comment arm64: patching: Add aarch64_insn_write_literal_u64() arm64: insn: Add helpers for BTI arm64: Extend support for CONFIG_FUNCTION_ALIGNMENT ACPI: Don't build ACPICA with '-Os' Compiler attributes: GCC cold function alignment workarounds ftrace: Add DYNAMIC_FTRACE_WITH_CALL_OPS * for-next/efi-boot-mmu-on: : Permit arm64 EFI boot with MMU and caches on arm64: kprobes: Drop ID map text from kprobes blacklist arm64: head: Switch endianness before populating the ID map efi: arm64: enter with MMU and caches enabled arm64: head: Clean the ID map and the HYP text to the PoC if needed arm64: head: avoid cache invalidation when entering with the MMU on arm64: head: record the MMU state at primary entry arm64: kernel: move identity map out of .text mapping arm64: head: Move all finalise_el2 calls to after __enable_mmu * for-next/ptrauth: : arm64 pointer authentication cleanup arm64: pauth: don't sign leaf functions arm64: unify asm-arch manipulation * for-next/pseudo-nmi: : Pseudo-NMI code generation optimisations arm64: irqflags: use alternative branches for pseudo-NMI logic arm64: add ARM64_HAS_GIC_PRIO_RELAXED_SYNC cpucap arm64: make ARM64_HAS_GIC_PRIO_MASKING depend on ARM64_HAS_GIC_CPUIF_SYSREGS arm64: rename ARM64_HAS_IRQ_PRIO_MASKING to ARM64_HAS_GIC_PRIO_MASKING arm64: rename ARM64_HAS_SYSREG_GIC_CPUIF to ARM64_HAS_GIC_CPUIF_SYSREGS
363 lines
7.9 KiB
ArmAsm
363 lines
7.9 KiB
ArmAsm
// SPDX-License-Identifier: GPL-2.0-only
|
|
// Copyright (C) 2021 ARM Limited.
|
|
//
|
|
// Assembly portion of the syscall ABI test
|
|
|
|
//
|
|
// Load values from memory into registers, invoke a syscall and save the
|
|
// register values back to memory for later checking. The syscall to be
|
|
// invoked is configured in x8 of the input GPR data.
|
|
//
|
|
// x0: SVE VL, 0 for FP only
|
|
// x1: SME VL
|
|
//
|
|
// GPRs: gpr_in, gpr_out
|
|
// FPRs: fpr_in, fpr_out
|
|
// Zn: z_in, z_out
|
|
// Pn: p_in, p_out
|
|
// FFR: ffr_in, ffr_out
|
|
// ZA: za_in, za_out
|
|
// SVCR: svcr_in, svcr_out
|
|
|
|
#include "syscall-abi.h"
|
|
|
|
.arch_extension sve
|
|
|
|
#define ID_AA64SMFR0_EL1_SMEver_SHIFT 56
|
|
#define ID_AA64SMFR0_EL1_SMEver_WIDTH 4
|
|
|
|
/*
|
|
* LDR (vector to ZA array):
|
|
* LDR ZA[\nw, #\offset], [X\nxbase, #\offset, MUL VL]
|
|
*/
|
|
.macro _ldr_za nw, nxbase, offset=0
|
|
.inst 0xe1000000 \
|
|
| (((\nw) & 3) << 13) \
|
|
| ((\nxbase) << 5) \
|
|
| ((\offset) & 7)
|
|
.endm
|
|
|
|
/*
|
|
* STR (vector from ZA array):
|
|
* STR ZA[\nw, #\offset], [X\nxbase, #\offset, MUL VL]
|
|
*/
|
|
.macro _str_za nw, nxbase, offset=0
|
|
.inst 0xe1200000 \
|
|
| (((\nw) & 3) << 13) \
|
|
| ((\nxbase) << 5) \
|
|
| ((\offset) & 7)
|
|
.endm
|
|
|
|
/*
|
|
* LDR (ZT0)
|
|
*
|
|
* LDR ZT0, nx
|
|
*/
|
|
.macro _ldr_zt nx
|
|
.inst 0xe11f8000 \
|
|
| (((\nx) & 0x1f) << 5)
|
|
.endm
|
|
|
|
/*
|
|
* STR (ZT0)
|
|
*
|
|
* STR ZT0, nx
|
|
*/
|
|
.macro _str_zt nx
|
|
.inst 0xe13f8000 \
|
|
| (((\nx) & 0x1f) << 5)
|
|
.endm
|
|
|
|
.globl do_syscall
|
|
do_syscall:
|
|
// Store callee saved registers x19-x29 (80 bytes) plus x0 and x1
|
|
stp x29, x30, [sp, #-112]!
|
|
mov x29, sp
|
|
stp x0, x1, [sp, #16]
|
|
stp x19, x20, [sp, #32]
|
|
stp x21, x22, [sp, #48]
|
|
stp x23, x24, [sp, #64]
|
|
stp x25, x26, [sp, #80]
|
|
stp x27, x28, [sp, #96]
|
|
|
|
// Set SVCR if we're doing SME
|
|
cbz x1, 1f
|
|
adrp x2, svcr_in
|
|
ldr x2, [x2, :lo12:svcr_in]
|
|
msr S3_3_C4_C2_2, x2
|
|
1:
|
|
|
|
// Load ZA and ZT0 if enabled - uses x12 as scratch due to SME LDR
|
|
tbz x2, #SVCR_ZA_SHIFT, 1f
|
|
mov w12, #0
|
|
ldr x2, =za_in
|
|
2: _ldr_za 12, 2
|
|
add x2, x2, x1
|
|
add x12, x12, #1
|
|
cmp x1, x12
|
|
bne 2b
|
|
|
|
// ZT0
|
|
mrs x2, S3_0_C0_C4_5 // ID_AA64SMFR0_EL1
|
|
ubfx x2, x2, #ID_AA64SMFR0_EL1_SMEver_SHIFT, \
|
|
#ID_AA64SMFR0_EL1_SMEver_WIDTH
|
|
cbz x2, 1f
|
|
adrp x2, zt_in
|
|
add x2, x2, :lo12:zt_in
|
|
_ldr_zt 2
|
|
1:
|
|
|
|
// Load GPRs x8-x28, and save our SP/FP for later comparison
|
|
ldr x2, =gpr_in
|
|
add x2, x2, #64
|
|
ldp x8, x9, [x2], #16
|
|
ldp x10, x11, [x2], #16
|
|
ldp x12, x13, [x2], #16
|
|
ldp x14, x15, [x2], #16
|
|
ldp x16, x17, [x2], #16
|
|
ldp x18, x19, [x2], #16
|
|
ldp x20, x21, [x2], #16
|
|
ldp x22, x23, [x2], #16
|
|
ldp x24, x25, [x2], #16
|
|
ldp x26, x27, [x2], #16
|
|
ldr x28, [x2], #8
|
|
str x29, [x2], #8 // FP
|
|
str x30, [x2], #8 // LR
|
|
|
|
// Load FPRs if we're not doing neither SVE nor streaming SVE
|
|
cbnz x0, 1f
|
|
ldr x2, =svcr_in
|
|
tbnz x2, #SVCR_SM_SHIFT, 1f
|
|
|
|
ldr x2, =fpr_in
|
|
ldp q0, q1, [x2]
|
|
ldp q2, q3, [x2, #16 * 2]
|
|
ldp q4, q5, [x2, #16 * 4]
|
|
ldp q6, q7, [x2, #16 * 6]
|
|
ldp q8, q9, [x2, #16 * 8]
|
|
ldp q10, q11, [x2, #16 * 10]
|
|
ldp q12, q13, [x2, #16 * 12]
|
|
ldp q14, q15, [x2, #16 * 14]
|
|
ldp q16, q17, [x2, #16 * 16]
|
|
ldp q18, q19, [x2, #16 * 18]
|
|
ldp q20, q21, [x2, #16 * 20]
|
|
ldp q22, q23, [x2, #16 * 22]
|
|
ldp q24, q25, [x2, #16 * 24]
|
|
ldp q26, q27, [x2, #16 * 26]
|
|
ldp q28, q29, [x2, #16 * 28]
|
|
ldp q30, q31, [x2, #16 * 30]
|
|
|
|
b 2f
|
|
1:
|
|
|
|
// Load the SVE registers if we're doing SVE/SME
|
|
|
|
ldr x2, =z_in
|
|
ldr z0, [x2, #0, MUL VL]
|
|
ldr z1, [x2, #1, MUL VL]
|
|
ldr z2, [x2, #2, MUL VL]
|
|
ldr z3, [x2, #3, MUL VL]
|
|
ldr z4, [x2, #4, MUL VL]
|
|
ldr z5, [x2, #5, MUL VL]
|
|
ldr z6, [x2, #6, MUL VL]
|
|
ldr z7, [x2, #7, MUL VL]
|
|
ldr z8, [x2, #8, MUL VL]
|
|
ldr z9, [x2, #9, MUL VL]
|
|
ldr z10, [x2, #10, MUL VL]
|
|
ldr z11, [x2, #11, MUL VL]
|
|
ldr z12, [x2, #12, MUL VL]
|
|
ldr z13, [x2, #13, MUL VL]
|
|
ldr z14, [x2, #14, MUL VL]
|
|
ldr z15, [x2, #15, MUL VL]
|
|
ldr z16, [x2, #16, MUL VL]
|
|
ldr z17, [x2, #17, MUL VL]
|
|
ldr z18, [x2, #18, MUL VL]
|
|
ldr z19, [x2, #19, MUL VL]
|
|
ldr z20, [x2, #20, MUL VL]
|
|
ldr z21, [x2, #21, MUL VL]
|
|
ldr z22, [x2, #22, MUL VL]
|
|
ldr z23, [x2, #23, MUL VL]
|
|
ldr z24, [x2, #24, MUL VL]
|
|
ldr z25, [x2, #25, MUL VL]
|
|
ldr z26, [x2, #26, MUL VL]
|
|
ldr z27, [x2, #27, MUL VL]
|
|
ldr z28, [x2, #28, MUL VL]
|
|
ldr z29, [x2, #29, MUL VL]
|
|
ldr z30, [x2, #30, MUL VL]
|
|
ldr z31, [x2, #31, MUL VL]
|
|
|
|
// Only set a non-zero FFR, test patterns must be zero since the
|
|
// syscall should clear it - this lets us handle FA64.
|
|
ldr x2, =ffr_in
|
|
ldr p0, [x2]
|
|
ldr x2, [x2, #0]
|
|
cbz x2, 1f
|
|
wrffr p0.b
|
|
1:
|
|
|
|
ldr x2, =p_in
|
|
ldr p0, [x2, #0, MUL VL]
|
|
ldr p1, [x2, #1, MUL VL]
|
|
ldr p2, [x2, #2, MUL VL]
|
|
ldr p3, [x2, #3, MUL VL]
|
|
ldr p4, [x2, #4, MUL VL]
|
|
ldr p5, [x2, #5, MUL VL]
|
|
ldr p6, [x2, #6, MUL VL]
|
|
ldr p7, [x2, #7, MUL VL]
|
|
ldr p8, [x2, #8, MUL VL]
|
|
ldr p9, [x2, #9, MUL VL]
|
|
ldr p10, [x2, #10, MUL VL]
|
|
ldr p11, [x2, #11, MUL VL]
|
|
ldr p12, [x2, #12, MUL VL]
|
|
ldr p13, [x2, #13, MUL VL]
|
|
ldr p14, [x2, #14, MUL VL]
|
|
ldr p15, [x2, #15, MUL VL]
|
|
2:
|
|
|
|
// Do the syscall
|
|
svc #0
|
|
|
|
// Save GPRs x8-x30
|
|
ldr x2, =gpr_out
|
|
add x2, x2, #64
|
|
stp x8, x9, [x2], #16
|
|
stp x10, x11, [x2], #16
|
|
stp x12, x13, [x2], #16
|
|
stp x14, x15, [x2], #16
|
|
stp x16, x17, [x2], #16
|
|
stp x18, x19, [x2], #16
|
|
stp x20, x21, [x2], #16
|
|
stp x22, x23, [x2], #16
|
|
stp x24, x25, [x2], #16
|
|
stp x26, x27, [x2], #16
|
|
stp x28, x29, [x2], #16
|
|
str x30, [x2]
|
|
|
|
// Restore x0 and x1 for feature checks
|
|
ldp x0, x1, [sp, #16]
|
|
|
|
// Save FPSIMD state
|
|
ldr x2, =fpr_out
|
|
stp q0, q1, [x2]
|
|
stp q2, q3, [x2, #16 * 2]
|
|
stp q4, q5, [x2, #16 * 4]
|
|
stp q6, q7, [x2, #16 * 6]
|
|
stp q8, q9, [x2, #16 * 8]
|
|
stp q10, q11, [x2, #16 * 10]
|
|
stp q12, q13, [x2, #16 * 12]
|
|
stp q14, q15, [x2, #16 * 14]
|
|
stp q16, q17, [x2, #16 * 16]
|
|
stp q18, q19, [x2, #16 * 18]
|
|
stp q20, q21, [x2, #16 * 20]
|
|
stp q22, q23, [x2, #16 * 22]
|
|
stp q24, q25, [x2, #16 * 24]
|
|
stp q26, q27, [x2, #16 * 26]
|
|
stp q28, q29, [x2, #16 * 28]
|
|
stp q30, q31, [x2, #16 * 30]
|
|
|
|
// Save SVCR if we're doing SME
|
|
cbz x1, 1f
|
|
mrs x2, S3_3_C4_C2_2
|
|
adrp x3, svcr_out
|
|
str x2, [x3, :lo12:svcr_out]
|
|
1:
|
|
|
|
// Save ZA if it's enabled - uses x12 as scratch due to SME STR
|
|
tbz x2, #SVCR_ZA_SHIFT, 1f
|
|
mov w12, #0
|
|
ldr x2, =za_out
|
|
2: _str_za 12, 2
|
|
add x2, x2, x1
|
|
add x12, x12, #1
|
|
cmp x1, x12
|
|
bne 2b
|
|
|
|
// ZT0
|
|
mrs x2, S3_0_C0_C4_5 // ID_AA64SMFR0_EL1
|
|
ubfx x2, x2, #ID_AA64SMFR0_EL1_SMEver_SHIFT, \
|
|
#ID_AA64SMFR0_EL1_SMEver_WIDTH
|
|
cbz x2, 1f
|
|
adrp x2, zt_out
|
|
add x2, x2, :lo12:zt_out
|
|
_str_zt 2
|
|
1:
|
|
|
|
// Save the SVE state if we have some
|
|
cbz x0, 1f
|
|
|
|
ldr x2, =z_out
|
|
str z0, [x2, #0, MUL VL]
|
|
str z1, [x2, #1, MUL VL]
|
|
str z2, [x2, #2, MUL VL]
|
|
str z3, [x2, #3, MUL VL]
|
|
str z4, [x2, #4, MUL VL]
|
|
str z5, [x2, #5, MUL VL]
|
|
str z6, [x2, #6, MUL VL]
|
|
str z7, [x2, #7, MUL VL]
|
|
str z8, [x2, #8, MUL VL]
|
|
str z9, [x2, #9, MUL VL]
|
|
str z10, [x2, #10, MUL VL]
|
|
str z11, [x2, #11, MUL VL]
|
|
str z12, [x2, #12, MUL VL]
|
|
str z13, [x2, #13, MUL VL]
|
|
str z14, [x2, #14, MUL VL]
|
|
str z15, [x2, #15, MUL VL]
|
|
str z16, [x2, #16, MUL VL]
|
|
str z17, [x2, #17, MUL VL]
|
|
str z18, [x2, #18, MUL VL]
|
|
str z19, [x2, #19, MUL VL]
|
|
str z20, [x2, #20, MUL VL]
|
|
str z21, [x2, #21, MUL VL]
|
|
str z22, [x2, #22, MUL VL]
|
|
str z23, [x2, #23, MUL VL]
|
|
str z24, [x2, #24, MUL VL]
|
|
str z25, [x2, #25, MUL VL]
|
|
str z26, [x2, #26, MUL VL]
|
|
str z27, [x2, #27, MUL VL]
|
|
str z28, [x2, #28, MUL VL]
|
|
str z29, [x2, #29, MUL VL]
|
|
str z30, [x2, #30, MUL VL]
|
|
str z31, [x2, #31, MUL VL]
|
|
|
|
ldr x2, =p_out
|
|
str p0, [x2, #0, MUL VL]
|
|
str p1, [x2, #1, MUL VL]
|
|
str p2, [x2, #2, MUL VL]
|
|
str p3, [x2, #3, MUL VL]
|
|
str p4, [x2, #4, MUL VL]
|
|
str p5, [x2, #5, MUL VL]
|
|
str p6, [x2, #6, MUL VL]
|
|
str p7, [x2, #7, MUL VL]
|
|
str p8, [x2, #8, MUL VL]
|
|
str p9, [x2, #9, MUL VL]
|
|
str p10, [x2, #10, MUL VL]
|
|
str p11, [x2, #11, MUL VL]
|
|
str p12, [x2, #12, MUL VL]
|
|
str p13, [x2, #13, MUL VL]
|
|
str p14, [x2, #14, MUL VL]
|
|
str p15, [x2, #15, MUL VL]
|
|
|
|
// Only save FFR if we wrote a value for SME
|
|
ldr x2, =ffr_in
|
|
ldr x2, [x2, #0]
|
|
cbz x2, 1f
|
|
ldr x2, =ffr_out
|
|
rdffr p0.b
|
|
str p0, [x2]
|
|
1:
|
|
|
|
// Restore callee saved registers x19-x30
|
|
ldp x19, x20, [sp, #32]
|
|
ldp x21, x22, [sp, #48]
|
|
ldp x23, x24, [sp, #64]
|
|
ldp x25, x26, [sp, #80]
|
|
ldp x27, x28, [sp, #96]
|
|
ldp x29, x30, [sp], #112
|
|
|
|
// Clear SVCR if we were doing SME so future tests don't have ZA
|
|
cbz x1, 1f
|
|
msr S3_3_C4_C2_2, xzr
|
|
1:
|
|
|
|
ret
|