Skip to content

Commit df45da5

Browse files
committed
Merge tag 'arm64-upstream' of git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux
Pull arm64 updates from Will Deacon: "ACPI: - Improve error reporting when failing to manage SDEI on AGDI device removal Assembly routines: - Improve register constraints so that the compiler can make use of the zero register instead of moving an immediate #0 into a GPR - Allow the compiler to allocate the registers used for CAS instructions CPU features and system registers: - Cleanups to the way in which CPU features are identified from the ID register fields - Extend system register definition generation to handle Enum types when defining shared register fields - Generate definitions for new _EL2 registers and add new fields for ID_AA64PFR1_EL1 - Allow SVE to be disabled separately from SME on the kernel command-line Tracing: - Support for "direct calls" in ftrace, which enables BPF tracing for arm64 Kdump: - Don't bother unmapping the crashkernel from the linear mapping, which then allows us to use huge (block) mappings and reduce TLB pressure when a crashkernel is loaded. Memory management: - Try again to remove data cache invalidation from the coherent DMA allocation path - Simplify the fixmap code by mapping at page granularity - Allow the kfence pool to be allocated early, preventing the rest of the linear mapping from being forced to page granularity Perf and PMU: - Move CPU PMU code out to drivers/perf/ where it can be reused by the 32-bit ARM architecture when running on ARMv8 CPUs - Fix race between CPU PMU probing and pKVM host de-privilege - Add support for Apple M2 CPU PMU - Adjust the generic PERF_COUNT_HW_BRANCH_INSTRUCTIONS event dynamically, depending on what the CPU actually supports - Minor fixes and cleanups to system PMU drivers Stack tracing: - Use the XPACLRI instruction to strip PAC from pointers, rather than rolling our own function in C - Remove redundant PAC removal for toolchains that handle this in their builtins - Make backtracing more resilient in the face of instrumentation Miscellaneous: - Fix single-step with KGDB - Remove harmless warning when 'nokaslr' is passed on the kernel command-line - Minor fixes and cleanups across the board" * tag 'arm64-upstream' of git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux: (72 commits) KVM: arm64: Ensure CPU PMU probes before pKVM host de-privilege arm64: kexec: include reboot.h arm64: delete dead code in this_cpu_set_vectors() arm64/cpufeature: Use helper macro to specify ID register for capabilites drivers/perf: hisi: add NULL check for name drivers/perf: hisi: Remove redundant initialized of pmu->name arm64/cpufeature: Consistently use symbolic constants for min_field_value arm64/cpufeature: Pull out helper for CPUID register definitions arm64/sysreg: Convert HFGITR_EL2 to automatic generation ACPI: AGDI: Improve error reporting for problems during .remove() arm64: kernel: Fix kernel warning when nokaslr is passed to commandline perf/arm-cmn: Fix port detection for CMN-700 arm64: kgdb: Set PSTATE.SS to 1 to re-enable single-step arm64: move PAC masks to <asm/pointer_auth.h> arm64: use XPACLRI to strip PAC arm64: avoid redundant PAC stripping in __builtin_return_address() arm64/sme: Fix some comments of ARM SME arm64/signal: Alloc tpidr2 sigframe after checking system_supports_tpidr2() arm64/signal: Use system_supports_tpidr2() to check TPIDR2 arm64/idreg: Don't disable SME when disabling SVE ...
2 parents 53b5e72 + eeb3557 commit df45da5

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

88 files changed

+1936
-1725
lines changed

Documentation/devicetree/bindings/arm/pmu.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ properties:
2020
items:
2121
- enum:
2222
- apm,potenza-pmu
23+
- apple,avalanche-pmu
24+
- apple,blizzard-pmu
2325
- apple,firestorm-pmu
2426
- apple,icestorm-pmu
2527
- arm,armv8-pmuv3 # Only for s/w models

arch/arm/include/asm/arm_pmuv3.h

Lines changed: 247 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,247 @@
1+
/* SPDX-License-Identifier: GPL-2.0 */
2+
/*
3+
* Copyright (C) 2012 ARM Ltd.
4+
*/
5+
6+
#ifndef __ASM_PMUV3_H
7+
#define __ASM_PMUV3_H
8+
9+
#include <asm/cp15.h>
10+
#include <asm/cputype.h>
11+
12+
#define PMCCNTR __ACCESS_CP15_64(0, c9)
13+
14+
#define PMCR __ACCESS_CP15(c9, 0, c12, 0)
15+
#define PMCNTENSET __ACCESS_CP15(c9, 0, c12, 1)
16+
#define PMCNTENCLR __ACCESS_CP15(c9, 0, c12, 2)
17+
#define PMOVSR __ACCESS_CP15(c9, 0, c12, 3)
18+
#define PMSELR __ACCESS_CP15(c9, 0, c12, 5)
19+
#define PMCEID0 __ACCESS_CP15(c9, 0, c12, 6)
20+
#define PMCEID1 __ACCESS_CP15(c9, 0, c12, 7)
21+
#define PMXEVTYPER __ACCESS_CP15(c9, 0, c13, 1)
22+
#define PMXEVCNTR __ACCESS_CP15(c9, 0, c13, 2)
23+
#define PMUSERENR __ACCESS_CP15(c9, 0, c14, 0)
24+
#define PMINTENSET __ACCESS_CP15(c9, 0, c14, 1)
25+
#define PMINTENCLR __ACCESS_CP15(c9, 0, c14, 2)
26+
#define PMMIR __ACCESS_CP15(c9, 0, c14, 6)
27+
#define PMCCFILTR __ACCESS_CP15(c14, 0, c15, 7)
28+
29+
#define PMEVCNTR0 __ACCESS_CP15(c14, 0, c8, 0)
30+
#define PMEVCNTR1 __ACCESS_CP15(c14, 0, c8, 1)
31+
#define PMEVCNTR2 __ACCESS_CP15(c14, 0, c8, 2)
32+
#define PMEVCNTR3 __ACCESS_CP15(c14, 0, c8, 3)
33+
#define PMEVCNTR4 __ACCESS_CP15(c14, 0, c8, 4)
34+
#define PMEVCNTR5 __ACCESS_CP15(c14, 0, c8, 5)
35+
#define PMEVCNTR6 __ACCESS_CP15(c14, 0, c8, 6)
36+
#define PMEVCNTR7 __ACCESS_CP15(c14, 0, c8, 7)
37+
#define PMEVCNTR8 __ACCESS_CP15(c14, 0, c9, 0)
38+
#define PMEVCNTR9 __ACCESS_CP15(c14, 0, c9, 1)
39+
#define PMEVCNTR10 __ACCESS_CP15(c14, 0, c9, 2)
40+
#define PMEVCNTR11 __ACCESS_CP15(c14, 0, c9, 3)
41+
#define PMEVCNTR12 __ACCESS_CP15(c14, 0, c9, 4)
42+
#define PMEVCNTR13 __ACCESS_CP15(c14, 0, c9, 5)
43+
#define PMEVCNTR14 __ACCESS_CP15(c14, 0, c9, 6)
44+
#define PMEVCNTR15 __ACCESS_CP15(c14, 0, c9, 7)
45+
#define PMEVCNTR16 __ACCESS_CP15(c14, 0, c10, 0)
46+
#define PMEVCNTR17 __ACCESS_CP15(c14, 0, c10, 1)
47+
#define PMEVCNTR18 __ACCESS_CP15(c14, 0, c10, 2)
48+
#define PMEVCNTR19 __ACCESS_CP15(c14, 0, c10, 3)
49+
#define PMEVCNTR20 __ACCESS_CP15(c14, 0, c10, 4)
50+
#define PMEVCNTR21 __ACCESS_CP15(c14, 0, c10, 5)
51+
#define PMEVCNTR22 __ACCESS_CP15(c14, 0, c10, 6)
52+
#define PMEVCNTR23 __ACCESS_CP15(c14, 0, c10, 7)
53+
#define PMEVCNTR24 __ACCESS_CP15(c14, 0, c11, 0)
54+
#define PMEVCNTR25 __ACCESS_CP15(c14, 0, c11, 1)
55+
#define PMEVCNTR26 __ACCESS_CP15(c14, 0, c11, 2)
56+
#define PMEVCNTR27 __ACCESS_CP15(c14, 0, c11, 3)
57+
#define PMEVCNTR28 __ACCESS_CP15(c14, 0, c11, 4)
58+
#define PMEVCNTR29 __ACCESS_CP15(c14, 0, c11, 5)
59+
#define PMEVCNTR30 __ACCESS_CP15(c14, 0, c11, 6)
60+
61+
#define PMEVTYPER0 __ACCESS_CP15(c14, 0, c12, 0)
62+
#define PMEVTYPER1 __ACCESS_CP15(c14, 0, c12, 1)
63+
#define PMEVTYPER2 __ACCESS_CP15(c14, 0, c12, 2)
64+
#define PMEVTYPER3 __ACCESS_CP15(c14, 0, c12, 3)
65+
#define PMEVTYPER4 __ACCESS_CP15(c14, 0, c12, 4)
66+
#define PMEVTYPER5 __ACCESS_CP15(c14, 0, c12, 5)
67+
#define PMEVTYPER6 __ACCESS_CP15(c14, 0, c12, 6)
68+
#define PMEVTYPER7 __ACCESS_CP15(c14, 0, c12, 7)
69+
#define PMEVTYPER8 __ACCESS_CP15(c14, 0, c13, 0)
70+
#define PMEVTYPER9 __ACCESS_CP15(c14, 0, c13, 1)
71+
#define PMEVTYPER10 __ACCESS_CP15(c14, 0, c13, 2)
72+
#define PMEVTYPER11 __ACCESS_CP15(c14, 0, c13, 3)
73+
#define PMEVTYPER12 __ACCESS_CP15(c14, 0, c13, 4)
74+
#define PMEVTYPER13 __ACCESS_CP15(c14, 0, c13, 5)
75+
#define PMEVTYPER14 __ACCESS_CP15(c14, 0, c13, 6)
76+
#define PMEVTYPER15 __ACCESS_CP15(c14, 0, c13, 7)
77+
#define PMEVTYPER16 __ACCESS_CP15(c14, 0, c14, 0)
78+
#define PMEVTYPER17 __ACCESS_CP15(c14, 0, c14, 1)
79+
#define PMEVTYPER18 __ACCESS_CP15(c14, 0, c14, 2)
80+
#define PMEVTYPER19 __ACCESS_CP15(c14, 0, c14, 3)
81+
#define PMEVTYPER20 __ACCESS_CP15(c14, 0, c14, 4)
82+
#define PMEVTYPER21 __ACCESS_CP15(c14, 0, c14, 5)
83+
#define PMEVTYPER22 __ACCESS_CP15(c14, 0, c14, 6)
84+
#define PMEVTYPER23 __ACCESS_CP15(c14, 0, c14, 7)
85+
#define PMEVTYPER24 __ACCESS_CP15(c14, 0, c15, 0)
86+
#define PMEVTYPER25 __ACCESS_CP15(c14, 0, c15, 1)
87+
#define PMEVTYPER26 __ACCESS_CP15(c14, 0, c15, 2)
88+
#define PMEVTYPER27 __ACCESS_CP15(c14, 0, c15, 3)
89+
#define PMEVTYPER28 __ACCESS_CP15(c14, 0, c15, 4)
90+
#define PMEVTYPER29 __ACCESS_CP15(c14, 0, c15, 5)
91+
#define PMEVTYPER30 __ACCESS_CP15(c14, 0, c15, 6)
92+
93+
#define RETURN_READ_PMEVCNTRN(n) \
94+
return read_sysreg(PMEVCNTR##n)
95+
static unsigned long read_pmevcntrn(int n)
96+
{
97+
PMEVN_SWITCH(n, RETURN_READ_PMEVCNTRN);
98+
return 0;
99+
}
100+
101+
#define WRITE_PMEVCNTRN(n) \
102+
write_sysreg(val, PMEVCNTR##n)
103+
static void write_pmevcntrn(int n, unsigned long val)
104+
{
105+
PMEVN_SWITCH(n, WRITE_PMEVCNTRN);
106+
}
107+
108+
#define WRITE_PMEVTYPERN(n) \
109+
write_sysreg(val, PMEVTYPER##n)
110+
static void write_pmevtypern(int n, unsigned long val)
111+
{
112+
PMEVN_SWITCH(n, WRITE_PMEVTYPERN);
113+
}
114+
115+
static inline unsigned long read_pmmir(void)
116+
{
117+
return read_sysreg(PMMIR);
118+
}
119+
120+
static inline u32 read_pmuver(void)
121+
{
122+
/* PMUVers is not a signed field */
123+
u32 dfr0 = read_cpuid_ext(CPUID_EXT_DFR0);
124+
125+
return (dfr0 >> 24) & 0xf;
126+
}
127+
128+
static inline void write_pmcr(u32 val)
129+
{
130+
write_sysreg(val, PMCR);
131+
}
132+
133+
static inline u32 read_pmcr(void)
134+
{
135+
return read_sysreg(PMCR);
136+
}
137+
138+
static inline void write_pmselr(u32 val)
139+
{
140+
write_sysreg(val, PMSELR);
141+
}
142+
143+
static inline void write_pmccntr(u64 val)
144+
{
145+
write_sysreg(val, PMCCNTR);
146+
}
147+
148+
static inline u64 read_pmccntr(void)
149+
{
150+
return read_sysreg(PMCCNTR);
151+
}
152+
153+
static inline void write_pmxevcntr(u32 val)
154+
{
155+
write_sysreg(val, PMXEVCNTR);
156+
}
157+
158+
static inline u32 read_pmxevcntr(void)
159+
{
160+
return read_sysreg(PMXEVCNTR);
161+
}
162+
163+
static inline void write_pmxevtyper(u32 val)
164+
{
165+
write_sysreg(val, PMXEVTYPER);
166+
}
167+
168+
static inline void write_pmcntenset(u32 val)
169+
{
170+
write_sysreg(val, PMCNTENSET);
171+
}
172+
173+
static inline void write_pmcntenclr(u32 val)
174+
{
175+
write_sysreg(val, PMCNTENCLR);
176+
}
177+
178+
static inline void write_pmintenset(u32 val)
179+
{
180+
write_sysreg(val, PMINTENSET);
181+
}
182+
183+
static inline void write_pmintenclr(u32 val)
184+
{
185+
write_sysreg(val, PMINTENCLR);
186+
}
187+
188+
static inline void write_pmccfiltr(u32 val)
189+
{
190+
write_sysreg(val, PMCCFILTR);
191+
}
192+
193+
static inline void write_pmovsclr(u32 val)
194+
{
195+
write_sysreg(val, PMOVSR);
196+
}
197+
198+
static inline u32 read_pmovsclr(void)
199+
{
200+
return read_sysreg(PMOVSR);
201+
}
202+
203+
static inline void write_pmuserenr(u32 val)
204+
{
205+
write_sysreg(val, PMUSERENR);
206+
}
207+
208+
static inline u32 read_pmceid0(void)
209+
{
210+
return read_sysreg(PMCEID0);
211+
}
212+
213+
static inline u32 read_pmceid1(void)
214+
{
215+
return read_sysreg(PMCEID1);
216+
}
217+
218+
static inline void kvm_set_pmu_events(u32 set, struct perf_event_attr *attr) {}
219+
static inline void kvm_clr_pmu_events(u32 clr) {}
220+
static inline bool kvm_pmu_counter_deferred(struct perf_event_attr *attr)
221+
{
222+
return false;
223+
}
224+
225+
/* PMU Version in DFR Register */
226+
#define ARMV8_PMU_DFR_VER_NI 0
227+
#define ARMV8_PMU_DFR_VER_V3P4 0x5
228+
#define ARMV8_PMU_DFR_VER_V3P5 0x6
229+
#define ARMV8_PMU_DFR_VER_IMP_DEF 0xF
230+
231+
static inline bool pmuv3_implemented(int pmuver)
232+
{
233+
return !(pmuver == ARMV8_PMU_DFR_VER_IMP_DEF ||
234+
pmuver == ARMV8_PMU_DFR_VER_NI);
235+
}
236+
237+
static inline bool is_pmuv3p4(int pmuver)
238+
{
239+
return pmuver >= ARMV8_PMU_DFR_VER_V3P4;
240+
}
241+
242+
static inline bool is_pmuv3p5(int pmuver)
243+
{
244+
return pmuver >= ARMV8_PMU_DFR_VER_V3P5;
245+
}
246+
247+
#endif

arch/arm/mm/Kconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -403,7 +403,7 @@ config CPU_V6K
403403
select CPU_THUMB_CAPABLE
404404
select CPU_TLB_V6 if MMU
405405

406-
# ARMv7
406+
# ARMv7 and ARMv8 architectures
407407
config CPU_V7
408408
bool
409409
select CPU_32v6K

arch/arm64/Kconfig

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,10 @@ config ARM64
186186
select HAVE_DEBUG_KMEMLEAK
187187
select HAVE_DMA_CONTIGUOUS
188188
select HAVE_DYNAMIC_FTRACE
189+
select HAVE_DYNAMIC_FTRACE_WITH_ARGS \
190+
if $(cc-option,-fpatchable-function-entry=2)
191+
select HAVE_DYNAMIC_FTRACE_WITH_DIRECT_CALLS \
192+
if DYNAMIC_FTRACE_WITH_ARGS && DYNAMIC_FTRACE_WITH_CALL_OPS
189193
select HAVE_DYNAMIC_FTRACE_WITH_CALL_OPS \
190194
if (DYNAMIC_FTRACE_WITH_ARGS && !CFI_CLANG && \
191195
!CC_OPTIMIZE_FOR_SIZE)
@@ -363,6 +367,20 @@ config ARCH_PROC_KCORE_TEXT
363367
config BROKEN_GAS_INST
364368
def_bool !$(as-instr,1:\n.inst 0\n.rept . - 1b\n\nnop\n.endr\n)
365369

370+
config BUILTIN_RETURN_ADDRESS_STRIPS_PAC
371+
bool
372+
# Clang's __builtin_return_adddress() strips the PAC since 12.0.0
373+
# https://reviews.llvm.org/D75044
374+
default y if CC_IS_CLANG && (CLANG_VERSION >= 120000)
375+
# GCC's __builtin_return_address() strips the PAC since 11.1.0,
376+
# and this was backported to 10.2.0, 9.4.0, 8.5.0, but not earlier
377+
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94891
378+
default y if CC_IS_GCC && (GCC_VERSION >= 110100)
379+
default y if CC_IS_GCC && (GCC_VERSION >= 100200) && (GCC_VERSION < 110000)
380+
default y if CC_IS_GCC && (GCC_VERSION >= 90400) && (GCC_VERSION < 100000)
381+
default y if CC_IS_GCC && (GCC_VERSION >= 80500) && (GCC_VERSION < 90000)
382+
default n
383+
366384
config KASAN_SHADOW_OFFSET
367385
hex
368386
depends on KASAN_GENERIC || KASAN_SW_TAGS

0 commit comments

Comments
 (0)