mirror of
https://github.com/raspberrypi/linux.git
synced 2025-12-27 20:42:52 +00:00
* arm64/for-next/perf:
perf: Switch back to struct platform_driver::remove()
perf: arm_pmuv3: Add support for Samsung Mongoose PMU
dt-bindings: arm: pmu: Add Samsung Mongoose core compatible
perf/dwc_pcie: Fix typos in event names
perf/dwc_pcie: Add support for Ampere SoCs
ARM: pmuv3: Add missing write_pmuacr()
perf/marvell: Marvell PEM performance monitor support
perf/arm_pmuv3: Add PMUv3.9 per counter EL0 access control
perf/dwc_pcie: Convert the events with mixed case to lowercase
perf/cxlpmu: Support missing events in 3.1 spec
perf: imx_perf: add support for i.MX91 platform
dt-bindings: perf: fsl-imx-ddr: Add i.MX91 compatible
drivers perf: remove unused field pmu_node
* for-next/gcs: (42 commits)
: arm64 Guarded Control Stack user-space support
kselftest/arm64: Fix missing printf() argument in gcs/gcs-stress.c
arm64/gcs: Fix outdated ptrace documentation
kselftest/arm64: Ensure stable names for GCS stress test results
kselftest/arm64: Validate that GCS push and write permissions work
kselftest/arm64: Enable GCS for the FP stress tests
kselftest/arm64: Add a GCS stress test
kselftest/arm64: Add GCS signal tests
kselftest/arm64: Add test coverage for GCS mode locking
kselftest/arm64: Add a GCS test program built with the system libc
kselftest/arm64: Add very basic GCS test program
kselftest/arm64: Always run signals tests with GCS enabled
kselftest/arm64: Allow signals tests to specify an expected si_code
kselftest/arm64: Add framework support for GCS to signal handling tests
kselftest/arm64: Add GCS as a detected feature in the signal tests
kselftest/arm64: Verify the GCS hwcap
arm64: Add Kconfig for Guarded Control Stack (GCS)
arm64/ptrace: Expose GCS via ptrace and core files
arm64/signal: Expose GCS state in signal frames
arm64/signal: Set up and restore the GCS context for signal handlers
arm64/mm: Implement map_shadow_stack()
...
* for-next/probes:
: Various arm64 uprobes/kprobes cleanups
arm64: insn: Simulate nop instruction for better uprobe performance
arm64: probes: Remove probe_opcode_t
arm64: probes: Cleanup kprobes endianness conversions
arm64: probes: Move kprobes-specific fields
arm64: probes: Fix uprobes for big-endian kernels
arm64: probes: Fix simulate_ldr*_literal()
arm64: probes: Remove broken LDR (literal) uprobe support
* for-next/asm-offsets:
: arm64 asm-offsets.c cleanup (remove unused offsets)
arm64: asm-offsets: remove PREEMPT_DISABLE_OFFSET
arm64: asm-offsets: remove DMA_{TO,FROM}_DEVICE
arm64: asm-offsets: remove VM_EXEC and PAGE_SZ
arm64: asm-offsets: remove MM_CONTEXT_ID
arm64: asm-offsets: remove COMPAT_{RT_,SIGFRAME_REGS_OFFSET
arm64: asm-offsets: remove VMA_VM_*
arm64: asm-offsets: remove TSK_ACTIVE_MM
* for-next/tlb:
: TLB flushing optimisations
arm64: optimize flush tlb kernel range
arm64: tlbflush: add __flush_tlb_range_limit_excess()
* for-next/misc:
: Miscellaneous patches
arm64: tls: Fix context-switching of tpidrro_el0 when kpti is enabled
arm64/ptrace: Clarify documentation of VL configuration via ptrace
acpi/arm64: remove unnecessary cast
arm64/mm: Change protval as 'pteval_t' in map_range()
arm64: uprobes: Optimize cache flushes for xol slot
acpi/arm64: Adjust error handling procedure in gtdt_parse_timer_block()
arm64: fix .data.rel.ro size assertion when CONFIG_LTO_CLANG
arm64/ptdump: Test both PTE_TABLE_BIT and PTE_VALID for block mappings
arm64/mm: Sanity check PTE address before runtime P4D/PUD folding
arm64/mm: Drop setting PTE_TYPE_PAGE in pte_mkcont()
ACPI: GTDT: Tighten the check for the array of platform timer structures
arm64/fpsimd: Fix a typo
arm64: Expose ID_AA64ISAR1_EL1.XS to sanitised feature consumers
arm64: Return early when break handler is found on linked-list
arm64/mm: Re-organize arch_make_huge_pte()
arm64/mm: Drop _PROT_SECT_DEFAULT
arm64: Add command-line override for ID_AA64MMFR0_EL1.ECV
arm64: head: Drop SWAPPER_TABLE_SHIFT
arm64: cpufeature: add POE to cpucap_is_possible()
arm64/mm: Change pgattr_change_is_safe() arguments as pteval_t
* for-next/mte:
: Various MTE improvements
selftests: arm64: add hugetlb mte tests
hugetlb: arm64: add mte support
* for-next/sysreg:
: arm64 sysreg updates
arm64/sysreg: Update ID_AA64MMFR1_EL1 to DDI0601 2024-09
* for-next/stacktrace:
: arm64 stacktrace improvements
arm64: preserve pt_regs::stackframe during exec*()
arm64: stacktrace: unwind exception boundaries
arm64: stacktrace: split unwind_consume_stack()
arm64: stacktrace: report recovered PCs
arm64: stacktrace: report source of unwind data
arm64: stacktrace: move dump_backtrace() to kunwind_stack_walk()
arm64: use a common struct frame_record
arm64: pt_regs: swap 'unused' and 'pmr' fields
arm64: pt_regs: rename "pmr_save" -> "pmr"
arm64: pt_regs: remove stale big-endian layout
arm64: pt_regs: assert pt_regs is a multiple of 16 bytes
* for-next/hwcap3:
: Add AT_HWCAP3 support for arm64 (also wire up AT_HWCAP4)
arm64: Support AT_HWCAP3
binfmt_elf: Wire up AT_HWCAP3 at AT_HWCAP4
* for-next/kselftest: (30 commits)
: arm64 kselftest fixes/cleanups
kselftest/arm64: Try harder to generate different keys during PAC tests
kselftest/arm64: Don't leak pipe fds in pac.exec_sign_all()
kselftest/arm64: Corrupt P0 in the irritator when testing SSVE
kselftest/arm64: Add FPMR coverage to fp-ptrace
kselftest/arm64: Expand the set of ZA writes fp-ptrace does
kselftets/arm64: Use flag bits for features in fp-ptrace assembler code
kselftest/arm64: Enable build of PAC tests with LLVM=1
kselftest/arm64: Check that SVCR is 0 in signal handlers
kselftest/arm64: Fix printf() compiler warnings in the arm64 syscall-abi.c tests
kselftest/arm64: Fix printf() warning in the arm64 MTE prctl() test
kselftest/arm64: Fix printf() compiler warnings in the arm64 fp tests
kselftest/arm64: Fix build with stricter assemblers
kselftest/arm64: Test signal handler state modification in fp-stress
kselftest/arm64: Provide a SIGUSR1 handler in the kernel mode FP stress test
kselftest/arm64: Implement irritators for ZA and ZT
kselftest/arm64: Remove unused ADRs from irritator handlers
kselftest/arm64: Correct misleading comments on fp-stress irritators
kselftest/arm64: Poll less often while waiting for fp-stress children
kselftest/arm64: Increase frequency of signal delivery in fp-stress
kselftest/arm64: Fix encoding for SVE B16B16 test
...
* for-next/crc32:
: Optimise CRC32 using PMULL instructions
arm64/crc32: Implement 4-way interleave using PMULL
arm64/crc32: Reorganize bit/byte ordering macros
arm64/lib: Handle CRC-32 alternative in C code
* for-next/guest-cca:
: Support for running Linux as a guest in Arm CCA
arm64: Document Arm Confidential Compute
virt: arm-cca-guest: TSM_REPORT support for realms
arm64: Enable memory encrypt for Realms
arm64: mm: Avoid TLBI when marking pages as valid
arm64: Enforce bounce buffers for realm DMA
efi: arm64: Map Device with Prot Shared
arm64: rsi: Map unprotected MMIO as decrypted
arm64: rsi: Add support for checking whether an MMIO is protected
arm64: realm: Query IPA size from the RMM
arm64: Detect if in a realm and set RIPAS RAM
arm64: rsi: Add RSI definitions
* for-next/haft:
: Support for arm64 FEAT_HAFT
arm64: pgtable: Warn unexpected pmdp_test_and_clear_young()
arm64: Enable ARCH_HAS_NONLEAF_PMD_YOUNG
arm64: Add support for FEAT_HAFT
arm64: setup: name 'tcr2' register
arm64/sysreg: Update ID_AA64MMFR1_EL1 register
* for-next/scs:
: Dynamic shadow call stack fixes
arm64/scs: Drop unused prototype __pi_scs_patch_vmlinux()
arm64/scs: Deal with 64-bit relative offsets in FDE frames
arm64/scs: Fix handling of DWARF augmentation data in CIE/FDE frames
440 lines
12 KiB
C
440 lines
12 KiB
C
/* SPDX-License-Identifier: GPL-2.0-only */
|
|
/*
|
|
* Based on arch/arm/include/asm/processor.h
|
|
*
|
|
* Copyright (C) 1995-1999 Russell King
|
|
* Copyright (C) 2012 ARM Ltd.
|
|
*/
|
|
#ifndef __ASM_PROCESSOR_H
|
|
#define __ASM_PROCESSOR_H
|
|
|
|
/*
|
|
* On arm64 systems, unaligned accesses by the CPU are cheap, and so there is
|
|
* no point in shifting all network buffers by 2 bytes just to make some IP
|
|
* header fields appear aligned in memory, potentially sacrificing some DMA
|
|
* performance on some platforms.
|
|
*/
|
|
#define NET_IP_ALIGN 0
|
|
|
|
#define MTE_CTRL_GCR_USER_EXCL_SHIFT 0
|
|
#define MTE_CTRL_GCR_USER_EXCL_MASK 0xffff
|
|
|
|
#define MTE_CTRL_TCF_SYNC (1UL << 16)
|
|
#define MTE_CTRL_TCF_ASYNC (1UL << 17)
|
|
#define MTE_CTRL_TCF_ASYMM (1UL << 18)
|
|
|
|
#ifndef __ASSEMBLY__
|
|
|
|
#include <linux/build_bug.h>
|
|
#include <linux/cache.h>
|
|
#include <linux/init.h>
|
|
#include <linux/stddef.h>
|
|
#include <linux/string.h>
|
|
#include <linux/thread_info.h>
|
|
|
|
#include <vdso/processor.h>
|
|
|
|
#include <asm/alternative.h>
|
|
#include <asm/cpufeature.h>
|
|
#include <asm/hw_breakpoint.h>
|
|
#include <asm/kasan.h>
|
|
#include <asm/lse.h>
|
|
#include <asm/pgtable-hwdef.h>
|
|
#include <asm/pointer_auth.h>
|
|
#include <asm/ptrace.h>
|
|
#include <asm/spectre.h>
|
|
#include <asm/types.h>
|
|
|
|
/*
|
|
* TASK_SIZE - the maximum size of a user space task.
|
|
* TASK_UNMAPPED_BASE - the lower boundary of the mmap VM area.
|
|
*/
|
|
|
|
#define DEFAULT_MAP_WINDOW_64 (UL(1) << VA_BITS_MIN)
|
|
#define TASK_SIZE_64 (UL(1) << vabits_actual)
|
|
#define TASK_SIZE_MAX (UL(1) << VA_BITS)
|
|
|
|
#ifdef CONFIG_COMPAT
|
|
#if defined(CONFIG_ARM64_64K_PAGES) && defined(CONFIG_KUSER_HELPERS)
|
|
/*
|
|
* With CONFIG_ARM64_64K_PAGES enabled, the last page is occupied
|
|
* by the compat vectors page.
|
|
*/
|
|
#define TASK_SIZE_32 UL(0x100000000)
|
|
#else
|
|
#define TASK_SIZE_32 (UL(0x100000000) - PAGE_SIZE)
|
|
#endif /* CONFIG_ARM64_64K_PAGES */
|
|
#define TASK_SIZE (test_thread_flag(TIF_32BIT) ? \
|
|
TASK_SIZE_32 : TASK_SIZE_64)
|
|
#define TASK_SIZE_OF(tsk) (test_tsk_thread_flag(tsk, TIF_32BIT) ? \
|
|
TASK_SIZE_32 : TASK_SIZE_64)
|
|
#define DEFAULT_MAP_WINDOW (test_thread_flag(TIF_32BIT) ? \
|
|
TASK_SIZE_32 : DEFAULT_MAP_WINDOW_64)
|
|
#else
|
|
#define TASK_SIZE TASK_SIZE_64
|
|
#define DEFAULT_MAP_WINDOW DEFAULT_MAP_WINDOW_64
|
|
#endif /* CONFIG_COMPAT */
|
|
|
|
#ifdef CONFIG_ARM64_FORCE_52BIT
|
|
#define STACK_TOP_MAX TASK_SIZE_64
|
|
#define TASK_UNMAPPED_BASE (PAGE_ALIGN(TASK_SIZE / 4))
|
|
#else
|
|
#define STACK_TOP_MAX DEFAULT_MAP_WINDOW_64
|
|
#define TASK_UNMAPPED_BASE (PAGE_ALIGN(DEFAULT_MAP_WINDOW / 4))
|
|
#endif /* CONFIG_ARM64_FORCE_52BIT */
|
|
|
|
#ifdef CONFIG_COMPAT
|
|
#define AARCH32_VECTORS_BASE 0xffff0000
|
|
#define STACK_TOP (test_thread_flag(TIF_32BIT) ? \
|
|
AARCH32_VECTORS_BASE : STACK_TOP_MAX)
|
|
#else
|
|
#define STACK_TOP STACK_TOP_MAX
|
|
#endif /* CONFIG_COMPAT */
|
|
|
|
#ifndef CONFIG_ARM64_FORCE_52BIT
|
|
#define arch_get_mmap_end(addr, len, flags) \
|
|
(((addr) > DEFAULT_MAP_WINDOW) ? TASK_SIZE : DEFAULT_MAP_WINDOW)
|
|
|
|
#define arch_get_mmap_base(addr, base) ((addr > DEFAULT_MAP_WINDOW) ? \
|
|
base + TASK_SIZE - DEFAULT_MAP_WINDOW :\
|
|
base)
|
|
#endif /* CONFIG_ARM64_FORCE_52BIT */
|
|
|
|
extern phys_addr_t arm64_dma_phys_limit;
|
|
#define ARCH_LOW_ADDRESS_LIMIT (arm64_dma_phys_limit - 1)
|
|
|
|
struct debug_info {
|
|
#ifdef CONFIG_HAVE_HW_BREAKPOINT
|
|
/* Have we suspended stepping by a debugger? */
|
|
int suspended_step;
|
|
/* Allow breakpoints and watchpoints to be disabled for this thread. */
|
|
int bps_disabled;
|
|
int wps_disabled;
|
|
/* Hardware breakpoints pinned to this task. */
|
|
struct perf_event *hbp_break[ARM_MAX_BRP];
|
|
struct perf_event *hbp_watch[ARM_MAX_WRP];
|
|
#endif
|
|
};
|
|
|
|
enum vec_type {
|
|
ARM64_VEC_SVE = 0,
|
|
ARM64_VEC_SME,
|
|
ARM64_VEC_MAX,
|
|
};
|
|
|
|
enum fp_type {
|
|
FP_STATE_CURRENT, /* Save based on current task state. */
|
|
FP_STATE_FPSIMD,
|
|
FP_STATE_SVE,
|
|
};
|
|
|
|
struct cpu_context {
|
|
unsigned long x19;
|
|
unsigned long x20;
|
|
unsigned long x21;
|
|
unsigned long x22;
|
|
unsigned long x23;
|
|
unsigned long x24;
|
|
unsigned long x25;
|
|
unsigned long x26;
|
|
unsigned long x27;
|
|
unsigned long x28;
|
|
unsigned long fp;
|
|
unsigned long sp;
|
|
unsigned long pc;
|
|
};
|
|
|
|
struct thread_struct {
|
|
struct cpu_context cpu_context; /* cpu context */
|
|
|
|
/*
|
|
* Whitelisted fields for hardened usercopy:
|
|
* Maintainers must ensure manually that this contains no
|
|
* implicit padding.
|
|
*/
|
|
struct {
|
|
unsigned long tp_value; /* TLS register */
|
|
unsigned long tp2_value;
|
|
u64 fpmr;
|
|
unsigned long pad;
|
|
struct user_fpsimd_state fpsimd_state;
|
|
} uw;
|
|
|
|
enum fp_type fp_type; /* registers FPSIMD or SVE? */
|
|
unsigned int fpsimd_cpu;
|
|
void *sve_state; /* SVE registers, if any */
|
|
void *sme_state; /* ZA and ZT state, if any */
|
|
unsigned int vl[ARM64_VEC_MAX]; /* vector length */
|
|
unsigned int vl_onexec[ARM64_VEC_MAX]; /* vl after next exec */
|
|
unsigned long fault_address; /* fault info */
|
|
unsigned long fault_code; /* ESR_EL1 value */
|
|
struct debug_info debug; /* debugging */
|
|
|
|
struct user_fpsimd_state kernel_fpsimd_state;
|
|
unsigned int kernel_fpsimd_cpu;
|
|
#ifdef CONFIG_ARM64_PTR_AUTH
|
|
struct ptrauth_keys_user keys_user;
|
|
#ifdef CONFIG_ARM64_PTR_AUTH_KERNEL
|
|
struct ptrauth_keys_kernel keys_kernel;
|
|
#endif
|
|
#endif
|
|
#ifdef CONFIG_ARM64_MTE
|
|
u64 mte_ctrl;
|
|
#endif
|
|
u64 sctlr_user;
|
|
u64 svcr;
|
|
u64 tpidr2_el0;
|
|
u64 por_el0;
|
|
#ifdef CONFIG_ARM64_GCS
|
|
unsigned int gcs_el0_mode;
|
|
unsigned int gcs_el0_locked;
|
|
u64 gcspr_el0;
|
|
u64 gcs_base;
|
|
u64 gcs_size;
|
|
#endif
|
|
};
|
|
|
|
static inline unsigned int thread_get_vl(struct thread_struct *thread,
|
|
enum vec_type type)
|
|
{
|
|
return thread->vl[type];
|
|
}
|
|
|
|
static inline unsigned int thread_get_sve_vl(struct thread_struct *thread)
|
|
{
|
|
return thread_get_vl(thread, ARM64_VEC_SVE);
|
|
}
|
|
|
|
static inline unsigned int thread_get_sme_vl(struct thread_struct *thread)
|
|
{
|
|
return thread_get_vl(thread, ARM64_VEC_SME);
|
|
}
|
|
|
|
static inline unsigned int thread_get_cur_vl(struct thread_struct *thread)
|
|
{
|
|
if (system_supports_sme() && (thread->svcr & SVCR_SM_MASK))
|
|
return thread_get_sme_vl(thread);
|
|
else
|
|
return thread_get_sve_vl(thread);
|
|
}
|
|
|
|
unsigned int task_get_vl(const struct task_struct *task, enum vec_type type);
|
|
void task_set_vl(struct task_struct *task, enum vec_type type,
|
|
unsigned long vl);
|
|
void task_set_vl_onexec(struct task_struct *task, enum vec_type type,
|
|
unsigned long vl);
|
|
unsigned int task_get_vl_onexec(const struct task_struct *task,
|
|
enum vec_type type);
|
|
|
|
static inline unsigned int task_get_sve_vl(const struct task_struct *task)
|
|
{
|
|
return task_get_vl(task, ARM64_VEC_SVE);
|
|
}
|
|
|
|
static inline unsigned int task_get_sme_vl(const struct task_struct *task)
|
|
{
|
|
return task_get_vl(task, ARM64_VEC_SME);
|
|
}
|
|
|
|
static inline void task_set_sve_vl(struct task_struct *task, unsigned long vl)
|
|
{
|
|
task_set_vl(task, ARM64_VEC_SVE, vl);
|
|
}
|
|
|
|
static inline unsigned int task_get_sve_vl_onexec(const struct task_struct *task)
|
|
{
|
|
return task_get_vl_onexec(task, ARM64_VEC_SVE);
|
|
}
|
|
|
|
static inline void task_set_sve_vl_onexec(struct task_struct *task,
|
|
unsigned long vl)
|
|
{
|
|
task_set_vl_onexec(task, ARM64_VEC_SVE, vl);
|
|
}
|
|
|
|
#define SCTLR_USER_MASK \
|
|
(SCTLR_ELx_ENIA | SCTLR_ELx_ENIB | SCTLR_ELx_ENDA | SCTLR_ELx_ENDB | \
|
|
SCTLR_EL1_TCF0_MASK)
|
|
|
|
static inline void arch_thread_struct_whitelist(unsigned long *offset,
|
|
unsigned long *size)
|
|
{
|
|
/* Verify that there is no padding among the whitelisted fields: */
|
|
BUILD_BUG_ON(sizeof_field(struct thread_struct, uw) !=
|
|
sizeof_field(struct thread_struct, uw.tp_value) +
|
|
sizeof_field(struct thread_struct, uw.tp2_value) +
|
|
sizeof_field(struct thread_struct, uw.fpmr) +
|
|
sizeof_field(struct thread_struct, uw.pad) +
|
|
sizeof_field(struct thread_struct, uw.fpsimd_state));
|
|
|
|
*offset = offsetof(struct thread_struct, uw);
|
|
*size = sizeof_field(struct thread_struct, uw);
|
|
}
|
|
|
|
#ifdef CONFIG_COMPAT
|
|
#define task_user_tls(t) \
|
|
({ \
|
|
unsigned long *__tls; \
|
|
if (is_compat_thread(task_thread_info(t))) \
|
|
__tls = &(t)->thread.uw.tp2_value; \
|
|
else \
|
|
__tls = &(t)->thread.uw.tp_value; \
|
|
__tls; \
|
|
})
|
|
#else
|
|
#define task_user_tls(t) (&(t)->thread.uw.tp_value)
|
|
#endif
|
|
|
|
/* Sync TPIDR_EL0 back to thread_struct for current */
|
|
void tls_preserve_current_state(void);
|
|
|
|
#define INIT_THREAD { \
|
|
.fpsimd_cpu = NR_CPUS, \
|
|
}
|
|
|
|
static inline void start_thread_common(struct pt_regs *regs, unsigned long pc,
|
|
unsigned long pstate)
|
|
{
|
|
/*
|
|
* Ensure all GPRs are zeroed, and initialize PC + PSTATE.
|
|
* The SP (or compat SP) will be initialized later.
|
|
*/
|
|
regs->user_regs = (struct user_pt_regs) {
|
|
.pc = pc,
|
|
.pstate = pstate,
|
|
};
|
|
|
|
/*
|
|
* To allow the syscalls:sys_exit_execve tracepoint we need to preserve
|
|
* syscallno, but do not need orig_x0 or the original GPRs.
|
|
*/
|
|
regs->orig_x0 = 0;
|
|
|
|
/*
|
|
* An exec from a kernel thread won't have an existing PMR value.
|
|
*/
|
|
if (system_uses_irq_prio_masking())
|
|
regs->pmr = GIC_PRIO_IRQON;
|
|
|
|
/*
|
|
* The pt_regs::stackframe field must remain valid throughout this
|
|
* function as a stacktrace can be taken at any time. Any user or
|
|
* kernel task should have a valid final frame.
|
|
*/
|
|
WARN_ON_ONCE(regs->stackframe.record.fp != 0);
|
|
WARN_ON_ONCE(regs->stackframe.record.lr != 0);
|
|
WARN_ON_ONCE(regs->stackframe.type != FRAME_META_TYPE_FINAL);
|
|
}
|
|
|
|
static inline void start_thread(struct pt_regs *regs, unsigned long pc,
|
|
unsigned long sp)
|
|
{
|
|
start_thread_common(regs, pc, PSR_MODE_EL0t);
|
|
spectre_v4_enable_task_mitigation(current);
|
|
regs->sp = sp;
|
|
}
|
|
|
|
#ifdef CONFIG_COMPAT
|
|
static inline void compat_start_thread(struct pt_regs *regs, unsigned long pc,
|
|
unsigned long sp)
|
|
{
|
|
unsigned long pstate = PSR_AA32_MODE_USR;
|
|
if (pc & 1)
|
|
pstate |= PSR_AA32_T_BIT;
|
|
if (IS_ENABLED(CONFIG_CPU_BIG_ENDIAN))
|
|
pstate |= PSR_AA32_E_BIT;
|
|
|
|
start_thread_common(regs, pc, pstate);
|
|
spectre_v4_enable_task_mitigation(current);
|
|
regs->compat_sp = sp;
|
|
}
|
|
#endif
|
|
|
|
static __always_inline bool is_ttbr0_addr(unsigned long addr)
|
|
{
|
|
/* entry assembly clears tags for TTBR0 addrs */
|
|
return addr < TASK_SIZE;
|
|
}
|
|
|
|
static __always_inline bool is_ttbr1_addr(unsigned long addr)
|
|
{
|
|
/* TTBR1 addresses may have a tag if KASAN_SW_TAGS is in use */
|
|
return arch_kasan_reset_tag(addr) >= PAGE_OFFSET;
|
|
}
|
|
|
|
/* Forward declaration, a strange C thing */
|
|
struct task_struct;
|
|
|
|
unsigned long __get_wchan(struct task_struct *p);
|
|
|
|
void update_sctlr_el1(u64 sctlr);
|
|
|
|
/* Thread switching */
|
|
extern struct task_struct *cpu_switch_to(struct task_struct *prev,
|
|
struct task_struct *next);
|
|
|
|
#define task_pt_regs(p) \
|
|
((struct pt_regs *)(THREAD_SIZE + task_stack_page(p)) - 1)
|
|
|
|
#define KSTK_EIP(tsk) ((unsigned long)task_pt_regs(tsk)->pc)
|
|
#define KSTK_ESP(tsk) user_stack_pointer(task_pt_regs(tsk))
|
|
|
|
/*
|
|
* Prefetching support
|
|
*/
|
|
#define ARCH_HAS_PREFETCH
|
|
static inline void prefetch(const void *ptr)
|
|
{
|
|
asm volatile("prfm pldl1keep, %a0\n" : : "p" (ptr));
|
|
}
|
|
|
|
#define ARCH_HAS_PREFETCHW
|
|
static inline void prefetchw(const void *ptr)
|
|
{
|
|
asm volatile("prfm pstl1keep, %a0\n" : : "p" (ptr));
|
|
}
|
|
|
|
extern unsigned long __ro_after_init signal_minsigstksz; /* sigframe size */
|
|
extern void __init minsigstksz_setup(void);
|
|
|
|
/*
|
|
* Not at the top of the file due to a direct #include cycle between
|
|
* <asm/fpsimd.h> and <asm/processor.h>. Deferring this #include
|
|
* ensures that contents of processor.h are visible to fpsimd.h even if
|
|
* processor.h is included first.
|
|
*
|
|
* These prctl helpers are the only things in this file that require
|
|
* fpsimd.h. The core code expects them to be in this header.
|
|
*/
|
|
#include <asm/fpsimd.h>
|
|
|
|
/* Userspace interface for PR_S[MV]E_{SET,GET}_VL prctl()s: */
|
|
#define SVE_SET_VL(arg) sve_set_current_vl(arg)
|
|
#define SVE_GET_VL() sve_get_current_vl()
|
|
#define SME_SET_VL(arg) sme_set_current_vl(arg)
|
|
#define SME_GET_VL() sme_get_current_vl()
|
|
|
|
/* PR_PAC_RESET_KEYS prctl */
|
|
#define PAC_RESET_KEYS(tsk, arg) ptrauth_prctl_reset_keys(tsk, arg)
|
|
|
|
/* PR_PAC_{SET,GET}_ENABLED_KEYS prctl */
|
|
#define PAC_SET_ENABLED_KEYS(tsk, keys, enabled) \
|
|
ptrauth_set_enabled_keys(tsk, keys, enabled)
|
|
#define PAC_GET_ENABLED_KEYS(tsk) ptrauth_get_enabled_keys(tsk)
|
|
|
|
#ifdef CONFIG_ARM64_TAGGED_ADDR_ABI
|
|
/* PR_{SET,GET}_TAGGED_ADDR_CTRL prctl */
|
|
long set_tagged_addr_ctrl(struct task_struct *task, unsigned long arg);
|
|
long get_tagged_addr_ctrl(struct task_struct *task);
|
|
#define SET_TAGGED_ADDR_CTRL(arg) set_tagged_addr_ctrl(current, arg)
|
|
#define GET_TAGGED_ADDR_CTRL() get_tagged_addr_ctrl(current)
|
|
#endif
|
|
|
|
int get_tsc_mode(unsigned long adr);
|
|
int set_tsc_mode(unsigned int val);
|
|
#define GET_TSC_CTL(adr) get_tsc_mode((adr))
|
|
#define SET_TSC_CTL(val) set_tsc_mode((val))
|
|
|
|
#endif /* __ASSEMBLY__ */
|
|
#endif /* __ASM_PROCESSOR_H */
|