Skip to content

Commit 2d09a94

Browse files
committed
Merge tag 'arm64-upstream' of git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux
Pull arm64 updates from Catalin Marinas: "Nothing major this time around. Apart from the usual perf/PMU updates, some page table cleanups, the notable features are average CPU frequency based on the AMUv1 counters, CONFIG_HOTPLUG_SMT and MOPS instructions (memcpy/memset) in the uaccess routines. Perf and PMUs: - Support for the 'Rainier' CPU PMU from Arm - Preparatory driver changes and cleanups that pave the way for BRBE support - Support for partial virtualisation of the Apple-M1 PMU - Support for the second event filter in Arm CSPMU designs - Minor fixes and cleanups (CMN and DWC PMUs) - Enable EL2 requirements for FEAT_PMUv3p9 Power, CPU topology: - Support for AMUv1-based average CPU frequency - Run-time SMT control wired up for arm64 (CONFIG_HOTPLUG_SMT). It adds a generic topology_is_primary_thread() function overridden by x86 and powerpc New(ish) features: - MOPS (memcpy/memset) support for the uaccess routines Security/confidential compute: - Fix the DMA address for devices used in Realms with Arm CCA. The CCA architecture uses the address bit to differentiate between shared and private addresses - Spectre-BHB: assume CPUs Linux doesn't know about vulnerable by default Memory management clean-ups: - Drop the P*D_TABLE_BIT definition in preparation for 128-bit PTEs - Some minor page table accessor clean-ups - PIE/POE (permission indirection/overlay) helpers clean-up Kselftests: - MTE: skip hugetlb tests if MTE is not supported on such mappings and user correct naming for sync/async tag checking modes Miscellaneous: - Add a PKEY_UNRESTRICTED definition as 0 to uapi (toolchain people request) - Sysreg updates for new register fields - CPU type info for some Qualcomm Kryo cores" * tag 'arm64-upstream' of git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux: (72 commits) arm64: mm: Don't use %pK through printk perf/arm_cspmu: Fix missing io.h include arm64: errata: Add newer ARM cores to the spectre_bhb_loop_affected() lists arm64: cputype: Add MIDR_CORTEX_A76AE arm64: errata: Add KRYO 2XX/3XX/4XX silver cores to Spectre BHB safe list arm64: errata: Assume that unknown CPUs _are_ vulnerable to Spectre BHB arm64: errata: Add QCOM_KRYO_4XX_GOLD to the spectre_bhb_k24_list arm64/sysreg: Enforce whole word match for open/close tokens arm64/sysreg: Fix unbalanced closing block arm64: Kconfig: Enable HOTPLUG_SMT arm64: topology: Support SMT control on ACPI based system arch_topology: Support SMT control for OF based system cpu/SMT: Provide a default topology_is_primary_thread() arm64/mm: Define PTDESC_ORDER perf/arm_cspmu: Add PMEVFILT2R support perf/arm_cspmu: Generalise event filtering perf/arm_cspmu: Move register definitons to header arm64/kernel: Always use level 2 or higher for early mappings arm64/mm: Drop PXD_TABLE_BIT arm64/mm: Check pmd_table() in pmd_trans_huge() ...
2 parents 317a76a + 64fa6b9 commit 2d09a94

Some content is hidden

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

70 files changed

+1116
-484
lines changed

Documentation/admin-guide/pm/cpufreq.rst

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,20 @@ are the following:
248248
If that frequency cannot be determined, this attribute should not
249249
be present.
250250

251+
``cpuinfo_avg_freq``
252+
An average frequency (in KHz) of all CPUs belonging to a given policy,
253+
derived from a hardware provided feedback and reported on a time frame
254+
spanning at most few milliseconds.
255+
256+
This is expected to be based on the frequency the hardware actually runs
257+
at and, as such, might require specialised hardware support (such as AMU
258+
extension on ARM). If one cannot be determined, this attribute should
259+
not be present.
260+
261+
Note, that failed attempt to retrieve current frequency for a given
262+
CPU(s) will result in an appropriate error, i.e: EAGAIN for CPU that
263+
remains idle (raised on ARM).
264+
251265
``cpuinfo_max_freq``
252266
Maximum possible operating frequency the CPUs belonging to this policy
253267
can run at (in kHz).
@@ -293,7 +307,8 @@ are the following:
293307
Some architectures (e.g. ``x86``) may attempt to provide information
294308
more precisely reflecting the current CPU frequency through this
295309
attribute, but that still may not be the exact current CPU frequency as
296-
seen by the hardware at the moment.
310+
seen by the hardware at the moment. This behavior though, is only
311+
available via c:macro:``CPUFREQ_ARCH_CUR_FREQ`` option.
297312

298313
``scaling_driver``
299314
The scaling driver currently in use.

Documentation/arch/arm64/booting.rst

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -288,6 +288,12 @@ Before jumping into the kernel, the following conditions must be met:
288288

289289
- SCR_EL3.FGTEn (bit 27) must be initialised to 0b1.
290290

291+
For CPUs with the Fine Grained Traps 2 (FEAT_FGT2) extension present:
292+
293+
- If EL3 is present and the kernel is entered at EL2:
294+
295+
- SCR_EL3.FGTEn2 (bit 59) must be initialised to 0b1.
296+
291297
For CPUs with support for HCRX_EL2 (FEAT_HCX) present:
292298

293299
- If EL3 is present and the kernel is entered at EL2:
@@ -382,6 +388,22 @@ Before jumping into the kernel, the following conditions must be met:
382388

383389
- SMCR_EL2.EZT0 (bit 30) must be initialised to 0b1.
384390

391+
For CPUs with the Performance Monitors Extension (FEAT_PMUv3p9):
392+
393+
- If EL3 is present:
394+
395+
- MDCR_EL3.EnPM2 (bit 7) must be initialised to 0b1.
396+
397+
- If the kernel is entered at EL1 and EL2 is present:
398+
399+
- HDFGRTR2_EL2.nPMICNTR_EL0 (bit 2) must be initialised to 0b1.
400+
- HDFGRTR2_EL2.nPMICFILTR_EL0 (bit 3) must be initialised to 0b1.
401+
- HDFGRTR2_EL2.nPMUACR_EL1 (bit 4) must be initialised to 0b1.
402+
403+
- HDFGWTR2_EL2.nPMICNTR_EL0 (bit 2) must be initialised to 0b1.
404+
- HDFGWTR2_EL2.nPMICFILTR_EL0 (bit 3) must be initialised to 0b1.
405+
- HDFGWTR2_EL2.nPMUACR_EL1 (bit 4) must be initialised to 0b1.
406+
385407
For CPUs with Memory Copy and Memory Set instructions (FEAT_MOPS):
386408

387409
- If the kernel is entered at EL1 and EL2 is present:

arch/arm64/Kconfig

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,7 @@ config ARM64
251251
select HAVE_KRETPROBES
252252
select HAVE_GENERIC_VDSO
253253
select HOTPLUG_CORE_SYNC_DEAD if HOTPLUG_CPU
254+
select HOTPLUG_SMT if HOTPLUG_CPU
254255
select IRQ_DOMAIN
255256
select IRQ_FORCED_THREADING
256257
select KASAN_VMALLOC if KASAN
@@ -324,7 +325,7 @@ config ARCH_MMAP_RND_BITS_MIN
324325
default 18
325326

326327
# max bits determined by the following formula:
327-
# VA_BITS - PAGE_SHIFT - 3
328+
# VA_BITS - PTDESC_TABLE_SHIFT
328329
config ARCH_MMAP_RND_BITS_MAX
329330
default 19 if ARM64_VA_BITS=36
330331
default 24 if ARM64_VA_BITS=39

arch/arm64/include/asm/apple_m1_pmu.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
#define PMCR0_PMI_ENABLE_8_9 GENMASK(45, 44)
3838

3939
#define SYS_IMP_APL_PMCR1_EL1 sys_reg(3, 1, 15, 1, 0)
40+
#define SYS_IMP_APL_PMCR1_EL12 sys_reg(3, 1, 15, 7, 2)
4041
#define PMCR1_COUNT_A64_EL0_0_7 GENMASK(15, 8)
4142
#define PMCR1_COUNT_A64_EL1_0_7 GENMASK(23, 16)
4243
#define PMCR1_COUNT_A64_EL0_8_9 GENMASK(41, 40)

arch/arm64/include/asm/asm-extable.h

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@
99
#define EX_TYPE_BPF 1
1010
#define EX_TYPE_UACCESS_ERR_ZERO 2
1111
#define EX_TYPE_KACCESS_ERR_ZERO 3
12-
#define EX_TYPE_LOAD_UNALIGNED_ZEROPAD 4
12+
#define EX_TYPE_UACCESS_CPY 4
13+
#define EX_TYPE_LOAD_UNALIGNED_ZEROPAD 5
1314

1415
/* Data fields for EX_TYPE_UACCESS_ERR_ZERO */
1516
#define EX_DATA_REG_ERR_SHIFT 0
@@ -23,6 +24,9 @@
2324
#define EX_DATA_REG_ADDR_SHIFT 5
2425
#define EX_DATA_REG_ADDR GENMASK(9, 5)
2526

27+
/* Data fields for EX_TYPE_UACCESS_CPY */
28+
#define EX_DATA_UACCESS_WRITE BIT(0)
29+
2630
#ifdef __ASSEMBLY__
2731

2832
#define __ASM_EXTABLE_RAW(insn, fixup, type, data) \
@@ -69,6 +73,10 @@
6973
.endif
7074
.endm
7175

76+
.macro _asm_extable_uaccess_cpy, insn, fixup, uaccess_is_write
77+
__ASM_EXTABLE_RAW(\insn, \fixup, EX_TYPE_UACCESS_CPY, \uaccess_is_write)
78+
.endm
79+
7280
#else /* __ASSEMBLY__ */
7381

7482
#include <linux/stringify.h>

arch/arm64/include/asm/asm-uaccess.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,10 @@ alternative_else_nop_endif
6161
9999: x; \
6262
_asm_extable_uaccess 9999b, l
6363

64+
#define USER_CPY(l, uaccess_is_write, x...) \
65+
9999: x; \
66+
_asm_extable_uaccess_cpy 9999b, l, uaccess_is_write
67+
6468
/*
6569
* Generate the assembly for LDTR/STTR with exception table entries.
6670
* This is complicated as there is no post-increment or pair versions of the

arch/arm64/include/asm/cputype.h

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@
7575
#define ARM_CPU_PART_CORTEX_A76 0xD0B
7676
#define ARM_CPU_PART_NEOVERSE_N1 0xD0C
7777
#define ARM_CPU_PART_CORTEX_A77 0xD0D
78+
#define ARM_CPU_PART_CORTEX_A76AE 0xD0E
7879
#define ARM_CPU_PART_NEOVERSE_V1 0xD40
7980
#define ARM_CPU_PART_CORTEX_A78 0xD41
8081
#define ARM_CPU_PART_CORTEX_A78AE 0xD42
@@ -119,6 +120,7 @@
119120
#define QCOM_CPU_PART_KRYO 0x200
120121
#define QCOM_CPU_PART_KRYO_2XX_GOLD 0x800
121122
#define QCOM_CPU_PART_KRYO_2XX_SILVER 0x801
123+
#define QCOM_CPU_PART_KRYO_3XX_GOLD 0x802
122124
#define QCOM_CPU_PART_KRYO_3XX_SILVER 0x803
123125
#define QCOM_CPU_PART_KRYO_4XX_GOLD 0x804
124126
#define QCOM_CPU_PART_KRYO_4XX_SILVER 0x805
@@ -159,6 +161,7 @@
159161
#define MIDR_CORTEX_A76 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_A76)
160162
#define MIDR_NEOVERSE_N1 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_NEOVERSE_N1)
161163
#define MIDR_CORTEX_A77 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_A77)
164+
#define MIDR_CORTEX_A76AE MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_A76AE)
162165
#define MIDR_NEOVERSE_V1 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_NEOVERSE_V1)
163166
#define MIDR_CORTEX_A78 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_A78)
164167
#define MIDR_CORTEX_A78AE MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_A78AE)
@@ -196,10 +199,21 @@
196199
#define MIDR_QCOM_KRYO MIDR_CPU_MODEL(ARM_CPU_IMP_QCOM, QCOM_CPU_PART_KRYO)
197200
#define MIDR_QCOM_KRYO_2XX_GOLD MIDR_CPU_MODEL(ARM_CPU_IMP_QCOM, QCOM_CPU_PART_KRYO_2XX_GOLD)
198201
#define MIDR_QCOM_KRYO_2XX_SILVER MIDR_CPU_MODEL(ARM_CPU_IMP_QCOM, QCOM_CPU_PART_KRYO_2XX_SILVER)
202+
#define MIDR_QCOM_KRYO_3XX_GOLD MIDR_CPU_MODEL(ARM_CPU_IMP_QCOM, QCOM_CPU_PART_KRYO_3XX_GOLD)
199203
#define MIDR_QCOM_KRYO_3XX_SILVER MIDR_CPU_MODEL(ARM_CPU_IMP_QCOM, QCOM_CPU_PART_KRYO_3XX_SILVER)
200204
#define MIDR_QCOM_KRYO_4XX_GOLD MIDR_CPU_MODEL(ARM_CPU_IMP_QCOM, QCOM_CPU_PART_KRYO_4XX_GOLD)
201205
#define MIDR_QCOM_KRYO_4XX_SILVER MIDR_CPU_MODEL(ARM_CPU_IMP_QCOM, QCOM_CPU_PART_KRYO_4XX_SILVER)
202206
#define MIDR_QCOM_ORYON_X1 MIDR_CPU_MODEL(ARM_CPU_IMP_QCOM, QCOM_CPU_PART_ORYON_X1)
207+
208+
/*
209+
* NOTES:
210+
* - Qualcomm Kryo 5XX Prime / Gold ID themselves as MIDR_CORTEX_A77
211+
* - Qualcomm Kryo 5XX Silver IDs itself as MIDR_QCOM_KRYO_4XX_SILVER
212+
* - Qualcomm Kryo 6XX Prime IDs itself as MIDR_CORTEX_X1
213+
* - Qualcomm Kryo 6XX Gold IDs itself as ARM_CPU_PART_CORTEX_A78
214+
* - Qualcomm Kryo 6XX Silver IDs itself as MIDR_CORTEX_A55
215+
*/
216+
203217
#define MIDR_NVIDIA_DENVER MIDR_CPU_MODEL(ARM_CPU_IMP_NVIDIA, NVIDIA_CPU_PART_DENVER)
204218
#define MIDR_NVIDIA_CARMEL MIDR_CPU_MODEL(ARM_CPU_IMP_NVIDIA, NVIDIA_CPU_PART_CARMEL)
205219
#define MIDR_FUJITSU_A64FX MIDR_CPU_MODEL(ARM_CPU_IMP_FUJITSU, FUJITSU_CPU_PART_A64FX)

arch/arm64/include/asm/el2_setup.h

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,30 @@
259259
.Lskip_fgt_\@:
260260
.endm
261261

262+
.macro __init_el2_fgt2
263+
mrs x1, id_aa64mmfr0_el1
264+
ubfx x1, x1, #ID_AA64MMFR0_EL1_FGT_SHIFT, #4
265+
cmp x1, #ID_AA64MMFR0_EL1_FGT_FGT2
266+
b.lt .Lskip_fgt2_\@
267+
268+
mov x0, xzr
269+
mrs x1, id_aa64dfr0_el1
270+
ubfx x1, x1, #ID_AA64DFR0_EL1_PMUVer_SHIFT, #4
271+
cmp x1, #ID_AA64DFR0_EL1_PMUVer_V3P9
272+
b.lt .Lskip_pmuv3p9_\@
273+
274+
orr x0, x0, #HDFGRTR2_EL2_nPMICNTR_EL0
275+
orr x0, x0, #HDFGRTR2_EL2_nPMICFILTR_EL0
276+
orr x0, x0, #HDFGRTR2_EL2_nPMUACR_EL1
277+
.Lskip_pmuv3p9_\@:
278+
msr_s SYS_HDFGRTR2_EL2, x0
279+
msr_s SYS_HDFGWTR2_EL2, x0
280+
msr_s SYS_HFGRTR2_EL2, xzr
281+
msr_s SYS_HFGWTR2_EL2, xzr
282+
msr_s SYS_HFGITR2_EL2, xzr
283+
.Lskip_fgt2_\@:
284+
.endm
285+
262286
.macro __init_el2_gcs
263287
mrs_s x1, SYS_ID_AA64PFR1_EL1
264288
ubfx x1, x1, #ID_AA64PFR1_EL1_GCS_SHIFT, #4
@@ -304,6 +328,7 @@
304328
__init_el2_nvhe_idregs
305329
__init_el2_cptr
306330
__init_el2_fgt
331+
__init_el2_fgt2
307332
__init_el2_gcs
308333
.endm
309334

arch/arm64/include/asm/extable.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ do { \
3333
(b)->data = (tmp).data; \
3434
} while (0)
3535

36+
bool insn_may_access_user(unsigned long addr, unsigned long esr);
37+
3638
#ifdef CONFIG_BPF_JIT
3739
bool ex_handler_bpf(const struct exception_table_entry *ex,
3840
struct pt_regs *regs);
@@ -45,5 +47,5 @@ bool ex_handler_bpf(const struct exception_table_entry *ex,
4547
}
4648
#endif /* !CONFIG_BPF_JIT */
4749

48-
bool fixup_exception(struct pt_regs *regs);
50+
bool fixup_exception(struct pt_regs *regs, unsigned long esr);
4951
#endif

arch/arm64/include/asm/fpsimd.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,6 @@ extern void fpsimd_signal_preserve_current_state(void);
8080
extern void fpsimd_preserve_current_state(void);
8181
extern void fpsimd_restore_current_state(void);
8282
extern void fpsimd_update_current_state(struct user_fpsimd_state const *state);
83-
extern void fpsimd_kvm_prepare(void);
8483

8584
struct cpu_fp_state {
8685
struct user_fpsimd_state *st;

0 commit comments

Comments
 (0)