Skip to content

Commit 56ec8e4

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: "No major architecture features this time around, just some new HWCAP definitions, support for the Ampere SoC PMUs and a few fixes/cleanups. The bulk of the changes is reworking of the CPU capability checking code (cpus_have_cap() etc). - Major refactoring of the CPU capability detection logic resulting in the removal of the cpus_have_const_cap() function and migrating the code to "alternative" branches where possible - Backtrace/kgdb: use IPIs and pseudo-NMI - Perf and PMU: - Add support for Ampere SoC PMUs - Multi-DTC improvements for larger CMN configurations with multiple Debug & Trace Controllers - Rework the Arm CoreSight PMU driver to allow separate registration of vendor backend modules - Fixes: add missing MODULE_DEVICE_TABLE to the amlogic perf driver; use device_get_match_data() in the xgene driver; fix NULL pointer dereference in the hisi driver caused by calling cpuhp_state_remove_instance(); use-after-free in the hisi driver - HWCAP updates: - FEAT_SVE_B16B16 (BFloat16) - FEAT_LRCPC3 (release consistency model) - FEAT_LSE128 (128-bit atomic instructions) - SVE: remove a couple of pseudo registers from the cpufeature code. There is logic in place already to detect mismatched SVE features - Miscellaneous: - Reduce the default swiotlb size (currently 64MB) if no ZONE_DMA bouncing is needed. The buffer is still required for small kmalloc() buffers - Fix module PLT counting with !RANDOMIZE_BASE - Restrict CPU_BIG_ENDIAN to LLVM IAS 15.x or newer move synchronisation code out of the set_ptes() loop - More compact cpufeature displaying enabled cores - Kselftest updates for the new CPU features" * tag 'arm64-upstream' of git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux: (83 commits) arm64: Restrict CPU_BIG_ENDIAN to GNU as or LLVM IAS 15.x or newer arm64: module: Fix PLT counting when CONFIG_RANDOMIZE_BASE=n arm64, irqchip/gic-v3, ACPI: Move MADT GICC enabled check into a helper perf: hisi: Fix use-after-free when register pmu fails drivers/perf: hisi_pcie: Initialize event->cpu only on success drivers/perf: hisi_pcie: Check the type first in pmu::event_init() arm64: cpufeature: Change DBM to display enabled cores arm64: cpufeature: Display the set of cores with a feature perf/arm-cmn: Enable per-DTC counter allocation perf/arm-cmn: Rework DTC counters (again) perf/arm-cmn: Fix DTC domain detection drivers: perf: arm_pmuv3: Drop some unused arguments from armv8_pmu_init() drivers: perf: arm_pmuv3: Read PMMIR_EL1 unconditionally drivers/perf: hisi: use cpuhp_state_remove_instance_nocalls() for hisi_hns3_pmu uninit process clocksource/drivers/arm_arch_timer: limit XGene-1 workaround arm64: Remove system_uses_lse_atomics() arm64: Mark the 'addr' argument to set_ptes() and __set_pte_at() as unused drivers/perf: xgene: Use device_get_match_data() perf/amlogic: add missing MODULE_DEVICE_TABLE arm64/mm: Hoist synchronization out of set_ptes() loop ...
2 parents 7d461b2 + 14dcf78 commit 56ec8e4

Some content is hidden

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

89 files changed

+1459
-734
lines changed
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
.. SPDX-License-Identifier: GPL-2.0
2+
3+
============================================
4+
Ampere SoC Performance Monitoring Unit (PMU)
5+
============================================
6+
7+
Ampere SoC PMU is a generic PMU IP that follows Arm CoreSight PMU architecture.
8+
Therefore, the driver is implemented as a submodule of arm_cspmu driver. At the
9+
first phase it's used for counting MCU events on AmpereOne.
10+
11+
12+
MCU PMU events
13+
--------------
14+
15+
The PMU driver supports setting filters for "rank", "bank", and "threshold".
16+
Note, that the filters are per PMU instance rather than per event.
17+
18+
19+
Example for perf tool use::
20+
21+
/ # perf list ampere
22+
23+
ampere_mcu_pmu_0/act_sent/ [Kernel PMU event]
24+
<...>
25+
ampere_mcu_pmu_1/rd_sent/ [Kernel PMU event]
26+
<...>
27+
28+
/ # perf stat -a -e ampere_mcu_pmu_0/act_sent,bank=5,rank=3,threshold=2/,ampere_mcu_pmu_1/rd_sent/ \
29+
sleep 1

Documentation/admin-guide/perf/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,4 @@ Performance monitor support
2222
nvidia-pmu
2323
meson-ddr-pmu
2424
cxl
25+
ampere_cspmu

Documentation/arch/arm64/cpu-feature-registers.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -268,6 +268,8 @@ infrastructure:
268268
+------------------------------+---------+---------+
269269
| SHA3 | [35-32] | y |
270270
+------------------------------+---------+---------+
271+
| B16B16 | [27-24] | y |
272+
+------------------------------+---------+---------+
271273
| BF16 | [23-20] | y |
272274
+------------------------------+---------+---------+
273275
| BitPerm | [19-16] | y |

Documentation/arch/arm64/elf_hwcaps.rst

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -308,6 +308,15 @@ HWCAP2_MOPS
308308
HWCAP2_HBC
309309
Functionality implied by ID_AA64ISAR2_EL1.BC == 0b0001.
310310

311+
HWCAP2_SVE_B16B16
312+
Functionality implied by ID_AA64ZFR0_EL1.B16B16 == 0b0001.
313+
314+
HWCAP2_LRCPC3
315+
Functionality implied by ID_AA64ISAR1_EL1.LRCPC == 0b0011.
316+
317+
HWCAP2_LSE128
318+
Functionality implied by ID_AA64ISAR0_EL1.Atomic == 0b0011.
319+
311320
4. Unused AT_HWCAP bits
312321
-----------------------
313322

arch/arm/xen/enlighten.c

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -164,9 +164,6 @@ static int xen_starting_cpu(unsigned int cpu)
164164
BUG_ON(err);
165165
per_cpu(xen_vcpu, cpu) = vcpup;
166166

167-
if (!xen_kernel_unmapped_at_usr())
168-
xen_setup_runstate_info(cpu);
169-
170167
after_register_vcpu_info:
171168
enable_percpu_irq(xen_events_irq, 0);
172169
return 0;
@@ -523,9 +520,6 @@ static int __init xen_guest_init(void)
523520
return -EINVAL;
524521
}
525522

526-
if (!xen_kernel_unmapped_at_usr())
527-
xen_time_setup_guest();
528-
529523
if (xen_initial_domain())
530524
pvclock_gtod_register_notifier(&xen_pvclock_gtod_notifier);
531525

@@ -535,7 +529,13 @@ static int __init xen_guest_init(void)
535529
}
536530
early_initcall(xen_guest_init);
537531

538-
static int __init xen_pm_init(void)
532+
static int xen_starting_runstate_cpu(unsigned int cpu)
533+
{
534+
xen_setup_runstate_info(cpu);
535+
return 0;
536+
}
537+
538+
static int __init xen_late_init(void)
539539
{
540540
if (!xen_domain())
541541
return -ENODEV;
@@ -548,9 +548,16 @@ static int __init xen_pm_init(void)
548548
do_settimeofday64(&ts);
549549
}
550550

551-
return 0;
551+
if (xen_kernel_unmapped_at_usr())
552+
return 0;
553+
554+
xen_time_setup_guest();
555+
556+
return cpuhp_setup_state(CPUHP_AP_ARM_XEN_RUNSTATE_STARTING,
557+
"arm/xen_runstate:starting",
558+
xen_starting_runstate_cpu, NULL);
552559
}
553-
late_initcall(xen_pm_init);
560+
late_initcall(xen_late_init);
554561

555562

556563
/* empty stubs */

arch/arm64/Kconfig

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1368,6 +1368,8 @@ choice
13681368
config CPU_BIG_ENDIAN
13691369
bool "Build big-endian kernel"
13701370
depends on !LD_IS_LLD || LLD_VERSION >= 130000
1371+
# https://github.com/llvm/llvm-project/commit/1379b150991f70a5782e9a143c2ba5308da1161c
1372+
depends on AS_IS_GNU || AS_VERSION >= 150000
13711373
help
13721374
Say Y if you plan on running a kernel with a big-endian userspace.
13731375

arch/arm64/include/asm/Kbuild

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,5 @@ generic-y += qspinlock.h
66
generic-y += parport.h
77
generic-y += user.h
88

9-
generated-y += cpucaps.h
9+
generated-y += cpucap-defs.h
1010
generated-y += sysreg-defs.h

arch/arm64/include/asm/alternative-macros.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -226,8 +226,8 @@ alternative_endif
226226
static __always_inline bool
227227
alternative_has_cap_likely(const unsigned long cpucap)
228228
{
229-
compiletime_assert(cpucap < ARM64_NCAPS,
230-
"cpucap must be < ARM64_NCAPS");
229+
if (!cpucap_is_possible(cpucap))
230+
return false;
231231

232232
asm_volatile_goto(
233233
ALTERNATIVE_CB("b %l[l_no]", %[cpucap], alt_cb_patch_nops)
@@ -244,8 +244,8 @@ alternative_has_cap_likely(const unsigned long cpucap)
244244
static __always_inline bool
245245
alternative_has_cap_unlikely(const unsigned long cpucap)
246246
{
247-
compiletime_assert(cpucap < ARM64_NCAPS,
248-
"cpucap must be < ARM64_NCAPS");
247+
if (!cpucap_is_possible(cpucap))
248+
return false;
249249

250250
asm_volatile_goto(
251251
ALTERNATIVE("nop", "b %l[l_yes]", %[cpucap])

arch/arm64/include/asm/arch_gicv3.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,14 @@ static inline u64 gic_read_iar_cavium_thunderx(void)
7979
return 0x3ff;
8080
}
8181

82+
static u64 __maybe_unused gic_read_iar(void)
83+
{
84+
if (alternative_has_cap_unlikely(ARM64_WORKAROUND_CAVIUM_23154))
85+
return gic_read_iar_cavium_thunderx();
86+
else
87+
return gic_read_iar_common();
88+
}
89+
8290
static inline void gic_write_ctlr(u32 val)
8391
{
8492
write_sysreg_s(val, SYS_ICC_CTLR_EL1);

arch/arm64/include/asm/archrandom.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ static __always_inline bool __cpu_has_rng(void)
6363
{
6464
if (unlikely(!system_capabilities_finalized() && !preemptible()))
6565
return this_cpu_has_cap(ARM64_HAS_RNG);
66-
return cpus_have_const_cap(ARM64_HAS_RNG);
66+
return alternative_has_cap_unlikely(ARM64_HAS_RNG);
6767
}
6868

6969
static inline size_t __must_check arch_get_random_longs(unsigned long *v, size_t max_longs)

0 commit comments

Comments
 (0)