Skip to content
Merged
Show file tree
Hide file tree
Changes from 93 commits
Commits
Show all changes
95 commits
Select commit Hold shift + click to select a range
a296a2d
arm64/booting: Document boot requirements for FEAT_NMI
broonie Oct 11, 2022
ec154b3
arm64/sysreg: Add definitions for immediate versions of MSR ALLINT
broonie Oct 11, 2022
ee34373
arm64/asm: Introduce assembly macros for managing ALLINT
broonie Oct 7, 2022
e7d8889
arm64/hyp-stub: Enable access to ALLINT
broonie Oct 6, 2022
40efa49
arm64/idreg: Add an override for FEAT_NMI
broonie Nov 4, 2022
f9171c8
arm64/cpufeature: Detect PE support for FEAT_NMI
broonie Nov 3, 2022
2a0c41f
KVM: arm64: Hide FEAT_NMI from guests
broonie Nov 11, 2022
99b0d70
arm64/nmi: Manage masking for superpriority interrupts along with DAIF
broonie Nov 11, 2022
39970c7
arm64/entry: Don't call preempt_schedule_irq() with NMIs masked
broonie Dec 12, 2022
534c87e
arm64/irq: Document handling of FEAT_NMI in irqflags.h
broonie Nov 2, 2022
3dccb9a
arm64/nmi: Add handling of superpriority interrupts as NMIs
broonie Oct 11, 2022
16b6cc6
arm64/nmi: Add Kconfig for NMI
broonie Oct 11, 2022
8064f24
irqchip/gic-v3: Implement FEAT_GICv3_NMI support
Oct 13, 2022
966cba9
irqchip/gic-v3: Fix hard LOCKUP caused by NMI being masked
ruanjinjie-eng Jan 30, 2024
b60a0e5
arm64: Enable hardware NMI for perf events NMI
ruanjinjie-eng Mar 29, 2024
138647f
irqchip/gic-v3: Fix one race condition due to NMI withdraw
May 16, 2024
94dbcc3
irqchip/gic-v3: Fix a system stall when using pseudo NMI with CONFIG_…
ruanjinjie-eng Mar 28, 2024
d4738b8
drivers/perf: hisi: Add support for HiSilicon DDRC v3 PMU driver
Dec 5, 2024
ac54b74
drivers/perf: hisi: Define a symbol namespace for HiSilicon Uncore PMUs
Apr 11, 2025
545e4bb
drivers/perf: hisi: Don't update the associated_cpus on CPU offline
Apr 11, 2025
187c91f
drivers/perf: hisi: Migrate to one online CPU if no associated one on…
Apr 11, 2025
aaf9ac0
drivers/perf: hisi: Refactor the detection of associated CPUs
Apr 11, 2025
6b96639
drivers/perf: hisi: Extract topology information to a separate structure
Apr 11, 2025
c26479e
drivers/perf: hisi: Add a common function to retrieve topology from f…
Apr 11, 2025
f08e399
drivers/perf: hisi: Provide a generic implementation of cpumask/ident…
Apr 11, 2025
c2f8873
drivers/perf: hisi: Export associated CPUs of each PMU through sysfs
Apr 11, 2025
f92e179
drivers/perf: hisi: Fix incorrect variable name "hha_pmu" in DDRC PMU…
Apr 11, 2025
5cb94fa
drivers/perf: hisi: Delete redundant blank line of DDRC PMU
Apr 11, 2025
65dc8b8
drivers/perf: hisi: Simplify the probe process for each DDRC version
Apr 11, 2025
96d7481
drivers/perf: hisi: Add support for HiSilicon DDRC v3 PMU driver
Apr 11, 2025
73a1dbd
perf parse-events: Make legacy events lower priority than sysfs/JSON
captain5050 May 17, 2024
5e4f602
perf x86 test: Update hybrid expectations
captain5050 May 17, 2024
2e80f79
drivers/perf: hisi_pcie: Export supported Root Ports [bdf_min, bdf_max]
Aug 29, 2024
f0a9b99
perf arm: Workaround ARM PMUs cpu maps having offline cpus
captain5050 Jun 7, 2024
6416186
perf mem: Count L2 HITM for c2c statistic
Apr 25, 2025
b796bd4
arm64: arm_pmuv3: Correctly extract and check the PMUVer
May 14, 2024
a944d2f
arm64: cputype: Add cputype definition for HIP12
Apr 25, 2025
dd0e1a4
drivers/perf: hisi: Use ACPI driver_data to retrieve SLLC PMU informa…
Apr 11, 2025
f25cc8f
drivers/perf: hisi: Add support for HiSilicon SLLC v3 PMU driver
Apr 11, 2025
c55ac54
drivers/perf: hisi: Relax the event number check of v2 PMUs
Apr 11, 2025
2ba1dc2
drivers/perf: hisi: Support PMUs with no interrupt
Apr 11, 2025
6f634a8
drivers/perf: hisi: Add support for HiSilicon NoC PMU
Apr 11, 2025
45c3054
drivers/perf: hisi: Add support for HiSilicon MN PMU driver
Apr 11, 2025
a08ce98
drivers/perf: hisi: Export hisi_uncore_pmu_isr()
Apr 16, 2025
4507e8a
drivers/perf: hisi: Simplify the probe process of each L3C PMU version
Apr 16, 2025
9ccbbee
drivers/perf: hisi: Extract the event filter check of L3C PMU
Apr 16, 2025
8138331
drivers/perf: hisi: Extend the field of tt_core
Apr 16, 2025
94f70c4
drivers/perf: hisi: Refactor the event configuration of L3C PMU
Apr 16, 2025
aed26b7
drivers/perf: hisi: Add support for L3C PMU v3
Apr 16, 2025
9adbc0c
drivers/perf: hisi: Clarifying event names and fix event ID for pa_pmu
Jun 16, 2025
e9e199f
perf: Remove unstable events for uncore L3C PMU
Jun 16, 2025
19d4e9c
drivers/perf: hisi: Add cacheable option for L3C PMU
Jun 16, 2025
2b84ce4
drivers/perf: hisi: Fixes the incorrect bitmask limit for the CPA eve…
Jun 16, 2025
c7bbce1
drivers/perf: hisi: Add events and rename event "cycle" for pa_pmu
Jun 17, 2025
b43819c
arm64: Add missing _EL12 encodings
Sep 20, 2024
fd16ce1
arm64: Add missing _EL2 encodings
Sep 20, 2024
350a46e
KVM: arm64: Fix TRFCR_EL1/PMSCR_EL1 access in hVHE mode
Feb 29, 2024
865b459
KVM: arm64: Add accessor for per-CPU state
Mar 1, 2024
a2d7853
KVM: arm64: Exclude host_debug_data from vcpu_arch
Feb 26, 2024
72b8f60
KVM: arm64: Exclude mdcr_el2_host from kvm_vcpu_arch
Feb 27, 2024
90075ab
KVM: arm64: Exclude host_fpsimd_state pointer from kvm_vcpu_arch
Mar 1, 2024
3602840
KVM: arm64: Move vcpu SVE/SME flags to the state flag set
May 28, 2022
ba341b3
KVM: arm64: Exclude FP ownership from kvm_vcpu_arch
Mar 1, 2024
067c7b9
KVM: arm64: nv: Drop VCPU_HYP_CONTEXT flag
Apr 19, 2024
32589c5
KVM: arm64: Initialize the kvm host data's fpsimd_state pointer in pKVM
Apr 23, 2024
73a3ec0
arm64/sysreg: Add BRBE registers and fields
Jun 13, 2024
550e2bf
KVM: arm64: Explicitly handle BRBE traps as UNDEFINED
Apr 5, 2024
9d24a96
drivers: perf: arm_pmu: Add infrastructure for branch stack sampling
Apr 5, 2024
e1e07d5
arm64/boot: Enable EL2 requirements for BRBE
Apr 5, 2024
f21229b
drivers: perf: arm_pmuv3: Enable branch stack sampling via FEAT_BRBE
Jun 13, 2024
e6c537f
KVM: arm64: nvhe: Disable branch generation in nVHE guests
Jun 13, 2024
0e71d35
perf: test: Speed up running brstack test on an Arm model
James-A-Clark Apr 5, 2024
626fa7d
perf: test: Remove empty lines from branch filter test output
James-A-Clark Apr 5, 2024
63f6f3d
perf: test: Extend branch stack sampling test for Arm64 BRBE
James-A-Clark Apr 5, 2024
43e26ec
perf: Configure BRBE correctly on VHE host
Mar 12, 2025
6f006a2
cpuinspect: add CPU-inspect infrastructure
yuliao0214 Dec 31, 2023
17e9d3a
cpuinspect: add ATF inspector
yuliao0214 Dec 31, 2023
2f8eb21
blk-mq: avoid housekeeping CPUs scheduling a worker on a non-housekee…
fenghusthu Jan 26, 2024
3aef22c
locking/qspinlock: Add CNA support for ARM64 without pvspinlock
stkid Mar 26, 2024
6cfd43b
arm64: topology: Setup amu fie when cpu hotplugging
Jun 13, 2025
2bc9208
arm64/sysreg: Update ID_AA64MMFR1_EL1 register
Nov 2, 2024
f2a7a84
arm64: setup: name 'tcr2' register
Nov 2, 2024
0da1bdf
arm64: Add support for FEAT_HAFT
Nov 21, 2024
6e24b87
arm64: Enable ARCH_HAS_NONLEAF_PMD_YOUNG
Nov 2, 2024
04c92bf
arm64: pgtable: Warn unexpected pmdp_test_and_clear_young()
Nov 2, 2024
65c46f5
arm64: Support AT_HWCAP3
broonie May 13, 2025
b9ea2e9
uapi/auxvec: Define AT_HWCAP3 and AT_HWCAP4 aux vector, entries
May 13, 2025
68c4bb0
binfmt_elf: Wire up AT_HWCAP3 at AT_HWCAP4
broonie May 13, 2025
6b63a6e
arm64: Provide basic EL2 setup for FEAT_{LS64, LS64_V} usage at EL0/1
May 13, 2025
ed45119
arm64: Add support for FEAT_{LS64, LS64_V}
May 13, 2025
f243d6f
Workaround the issue when compile with CONFIG_FUNCTION_ALIGNMENT_64B
May 13, 2025
f390b95
KVM: arm64: Enable FEAT_{LS64, LS64_V} in the supported guest
May 13, 2025
d78838c
Revert "deepin: qspinlock: Disable CNA by default"
Avenger-285714 Feb 3, 2026
2e6b1c4
ipmi: Errata workaround to prevent SMS message processing timeout
Oct 31, 2023
9d05ee6
arm64: Kconfig: Fix typo in ARCH_HAS_NONLEAF_PMD_YOUNG dependency
Avenger-285714 Feb 4, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions Documentation/admin-guide/kernel-parameters.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4075,14 +4075,12 @@
numa_spinlock= [NUMA, PV_OPS] Select the NUMA-aware variant
of spinlock. The options are:
auto - Enable this variant if running on a multi-node
machine in native environment. (Under this option, if
paravirt spinlock is already enabled, this variant will
not be enabled.)
machine in native environment.
on - Unconditionally enable this variant.
off - Unconditionally disable this variant.

Not specifying this option is equivalent to
numa_spinlock=off.
numa_spinlock=auto.

numa_zonelist_order= [KNL, BOOT] Select zonelist order for NUMA.
'node', 'default' can be specified
Expand Down
4 changes: 3 additions & 1 deletion Documentation/admin-guide/perf/hisi-pcie-pmu.rst
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@ The "identifier" sysfs file allows users to identify the version of the
PMU hardware device.

The "bus" sysfs file allows users to get the bus number of Root Ports
monitored by PMU.
monitored by PMU. Furthermore users can get the Root Ports range in
[bdf_min, bdf_max] from "bdf_min" and "bdf_max" sysfs attributes
respectively.

Example usage of perf::

Expand Down
16 changes: 15 additions & 1 deletion Documentation/admin-guide/perf/hisi-pmu.rst
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,10 @@ e.g. hisi_sccl1_hha0/rx_operations is RX_OPERATIONS event of HHA index #0 in
SCCL ID #1.

The driver also provides a "cpumask" sysfs attribute, which shows the CPU core
ID used to count the uncore PMU event.
ID used to count the uncore PMU event. An "associated_cpus" sysfs attribute is
also provided to show the CPUs associated with this PMU. The "cpumask" indicates
the CPUs to open the events, usually as a hint for userspaces tools like perf.
It only contains one associated CPU from the "associated_cpus".

Example usage of perf::

Expand Down Expand Up @@ -110,6 +113,17 @@ uring channel. It is 2 bits. Some important codes are as follows:
- 2'b00: default value, count the events which sent to the both uring and
uring_ext channel;

6. ch: NoC PMU supports filtering the event counts of certain transaction
channel with this option. The current supported channels are as follows:

- 3'b010: Request channel
- 3'b100: Snoop channel
- 3'b110: Response channel
- 3'b111: Data channel

7. tt_en: NoC PMU supports counting only transactions that have tracetag set
if this option is set. See the 2nd list for more information about tracetag.

Users could configure IDs to count data come from specific CCL/ICL, by setting
srcid_cmd & srcid_msk, and data desitined for specific CCL/ICL by setting
tgtid_cmd & tgtid_msk. A set bit in srcid_msk/tgtid_msk means the PMU will not
Expand Down
39 changes: 39 additions & 0 deletions Documentation/arch/arm64/booting.rst
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,27 @@ Before jumping into the kernel, the following conditions must be met:

- HWFGWTR_EL2.nSMPRI_EL1 (bit 54) must be initialised to 0b01.

For CPUs with feature Branch Record Buffer Extension (FEAT_BRBE):

- If EL3 is present:

- MDCR_EL3.SBRBE (bits 33:32) must be initialised to 0b11.

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

- BRBCR_EL2.CC (bit 3) must be initialised to 0b1.
- BRBCR_EL2.MPRED (bit 4) must be initialised to 0b1.

- HDFGRTR_EL2.nBRBDATA (bit 61) must be initialised to 0b1.
- HDFGRTR_EL2.nBRBCTL (bit 60) must be initialised to 0b1.
- HDFGRTR_EL2.nBRBIDR (bit 59) must be initialised to 0b1.

- HDFGWTR_EL2.nBRBDATA (bit 61) must be initialised to 0b1.
- HDFGWTR_EL2.nBRBCTL (bit 60) must be initialised to 0b1.

- HFGITR_EL2.nBRBIALL (bit 56) must be initialised to 0b1.
- HFGITR_EL2.nBRBINJ (bit 55) must be initialised to 0b1.

For CPUs with the Scalable Matrix Extension FA64 feature (FEAT_SME_FA64):

- If EL3 is present:
Expand Down Expand Up @@ -411,6 +432,24 @@ Before jumping into the kernel, the following conditions must be met:

- HFGRWR_EL2.nPIRE0_EL1 (bit 57) must be initialised to 0b1.

For CPUs with Non-maskable Interrupts (FEAT_NMI):

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

- HCRX_EL2.TALLINT must be initialised to 0b0.

For CPUs support for 64-byte loads and stores without status (FEAT_LS64):

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

- HCRX_EL2.EnALS (bit 1) must be initialised to 0b1.

For CPUs support for 64-byte loads and stores with status (FEAT_LS64_V):

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

- HCRX_EL2.EnASR (bit 2) must be initialised to 0b1.

The requirements described above for CPU mode, caches, MMUs, architected
timers, coherency and system registers apply to all CPUs. All CPUs must
enter the kernel in the same exception level. Where the values documented
Expand Down
12 changes: 9 additions & 3 deletions Documentation/arch/arm64/elf_hwcaps.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ architected discovery mechanism available to userspace code at EL0. The
kernel exposes the presence of these features to userspace through a set
of flags called hwcaps, exposed in the auxiliary vector.

Userspace software can test for features by acquiring the AT_HWCAP or
AT_HWCAP2 entry of the auxiliary vector, and testing whether the relevant
flags are set, e.g.::
Userspace software can test for features by acquiring the AT_HWCAP,
AT_HWCAP2 or AT_HWCAP3 entry of the auxiliary vector, and testing
whether the relevant flags are set, e.g.::

bool floating_point_is_present(void)
{
Expand Down Expand Up @@ -320,6 +320,12 @@ HWCAP2_MOPS
HWCAP2_HBC
Functionality implied by ID_AA64ISAR2_EL1.BC == 0b0001.

HWCAP3_LS64
Functionality implied by ID_AA64ISAR1_EL1.LS64 == 0b0001.

HWCAP3_LS64_V
Functionality implied by ID_AA64ISAR1_EL1.LS64 == 0b0010.

4. Unused AT_HWCAP bits
-----------------------

Expand Down
58 changes: 57 additions & 1 deletion arch/arm64/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ config ARM64
select ARCH_HAS_MEMBARRIER_SYNC_CORE
select ARCH_HAS_NMI_SAFE_THIS_CPU_OPS
select ARCH_HAS_NON_OVERLAPPING_ADDRESS_SPACE
select ARCH_HAS_NONLEAF_PMD_YOUNG if ARM64_HAF
Copy link

Copilot AI Feb 3, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new select ARCH_HAS_NONLEAF_PMD_YOUNG if ARM64_HAF line references a Kconfig symbol ARM64_HAF that does not exist (the feature config added below is ARM64_HAFT and the existing AF/DBM option is ARM64_HW_AFDBM). This will cause Kconfig warnings or errors and prevent the intended selection from taking effect; the condition should be updated to use the correct symbol name (likely ARM64_HAFT).

Suggested change
select ARCH_HAS_NONLEAF_PMD_YOUNG if ARM64_HAF
select ARCH_HAS_NONLEAF_PMD_YOUNG if ARM64_HAFT

Copilot uses AI. Check for mistakes.
select ARCH_HAS_PTE_DEVMAP
select ARCH_HAS_PTE_SPECIAL
select ARCH_HAS_SETUP_DMA_OPS
Expand Down Expand Up @@ -116,6 +117,7 @@ config ARM64
select ARM_GIC_V3
select ARM_GIC_V3_ITS if PCI
select ARM_PSCI_FW
select ARM64_LS64 if !FUNCTION_ALIGNMENT_64B
select BUILDTIME_TABLE_SORT
select CLONE_BACKWARDS
select COMMON_CLK
Expand Down Expand Up @@ -220,7 +222,7 @@ config ARM64
select HAVE_MOD_ARCH_SPECIFIC
select HAVE_NMI
select HAVE_PERF_EVENTS
select HAVE_PERF_EVENTS_NMI if ARM64_PSEUDO_NMI
select HAVE_PERF_EVENTS_NMI if ARM64_PSEUDO_NMI || ARM64_NMI
select HAVE_PERF_REGS
select HAVE_PERF_USER_STACK_DUMP
select HAVE_PREEMPT_DYNAMIC_KEY
Expand Down Expand Up @@ -1513,6 +1515,21 @@ config NODES_SHIFT
Specify the maximum number of NUMA Nodes available on the target
system. Increases memory reserved to accommodate various tables.

config NUMA_AWARE_SPINLOCKS
bool "Numa-aware spinlocks"
depends on NUMA
depends on QUEUED_SPINLOCKS
default n
help
Introduce NUMA (Non Uniform Memory Access) awareness into
the slow path of spinlocks.

In this variant of qspinlock, the kernel will try to keep the lock
on the same node, thus reducing the number of remote cache misses,
while trading some of the short term fairness for better performance.

Say N if you want absolute first come first serve fairness.

source "kernel/Kconfig.hz"

config ARCH_SPARSEMEM_ENABLE
Expand Down Expand Up @@ -2132,6 +2149,13 @@ config ARM64_MTE

endmenu # "ARMv8.5 architectural features"

menu "ARMv8.6 architectural features"

config ARM64_LS64
bool

endmenu # "ARMv8.6 architectural features"

menu "ARMv8.7 architectural features"

config ARM64_EPAN
Expand All @@ -2146,6 +2170,38 @@ config ARM64_EPAN
if the cpu does not implement the feature.
endmenu # "ARMv8.7 architectural features"

menu "ARMv8.8 architectural features"

config ARM64_NMI
bool "Enable support for Non-maskable Interrupts (NMI)"
default y
help
Non-maskable interrupts are an architecture and GIC feature
which allow the system to configure some interrupts to be
configured to have superpriority, allowing them to be handled
before other interrupts and masked for shorter periods of time.

The feature is detected at runtime, and will remain disabled
if the cpu does not implement the feature. It will also be
disabled if pseudo NMIs are enabled at runtime.

config ARM64_HAFT
bool "Support for Hardware managed Access Flag for Table Descriptors"
depends on ARM64_HW_AFDBM
default y
help
The ARMv8.9/ARMv9.5 introduces the feature Hardware managed Access
Flag for Table descriptors. When enabled an architectural executed
memory access will update the Access Flag in each Table descriptor
which is accessed during the translation table walk and for which
the Access Flag is 0. The Access Flag of the Table descriptor use
the same bit of PTE_AF.

The feature will only be enabled if all the CPUs in the system
support this feature. If unsure, say Y.

endmenu # "ARMv8.8 architectural features"

config ARM64_SVE
bool "ARM Scalable Vector Extension support"
default y
Expand Down
1 change: 0 additions & 1 deletion arch/arm64/include/asm/Kbuild
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
generic-y += early_ioremap.h
generic-y += mcs_spinlock.h
generic-y += qrwlock.h
generic-y += qspinlock.h
generic-y += parport.h
generic-y += user.h

Expand Down
25 changes: 22 additions & 3 deletions arch/arm64/include/asm/assembler.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,30 @@
wx\n .req w\n
.endr

.macro disable_allint
#ifdef CONFIG_ARM64_NMI
alternative_if ARM64_HAS_NMI
msr_s SYS_ALLINT_SET, xzr
alternative_else_nop_endif
#endif
.endm

.macro enable_allint
#ifdef CONFIG_ARM64_NMI
alternative_if ARM64_HAS_NMI
msr_s SYS_ALLINT_CLR, xzr
alternative_else_nop_endif
#endif
.endm

.macro disable_daif
disable_allint
msr daifset, #0xf
.endm

.macro enable_daif
msr daifclr, #0xf
enable_allint
.endm

/*
Expand Down Expand Up @@ -503,9 +521,10 @@ alternative_endif
*/
.macro reset_pmuserenr_el0, tmpreg
mrs \tmpreg, id_aa64dfr0_el1
sbfx \tmpreg, \tmpreg, #ID_AA64DFR0_EL1_PMUVer_SHIFT, #4
cmp \tmpreg, #1 // Skip if no PMU present
b.lt 9000f
ubfx \tmpreg, \tmpreg, #ID_AA64DFR0_EL1_PMUVer_SHIFT, #4
cmp \tmpreg, #ID_AA64DFR0_EL1_PMUVer_NI
ccmp \tmpreg, #ID_AA64DFR0_EL1_PMUVer_IMP_DEF, #4, ne
b.eq 9000f // Skip if no PMU present or IMP_DEF
msr pmuserenr_el0, xzr // Disable PMU access from EL0
9000:
.endm
Expand Down
15 changes: 14 additions & 1 deletion arch/arm64/include/asm/cpufeature.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#include <asm/hwcap.h>
#include <asm/sysreg.h>

#define MAX_CPU_FEATURES 128
#define MAX_CPU_FEATURES 192
#define cpu_feature(x) KERNEL_HWCAP_ ## x

#define ARM64_SW_FEATURE_OVERRIDE_NOKASLR 0
Expand Down Expand Up @@ -434,6 +434,7 @@ void cpu_set_feature(unsigned int num);
bool cpu_have_feature(unsigned int num);
unsigned long cpu_get_elf_hwcap(void);
unsigned long cpu_get_elf_hwcap2(void);
unsigned long cpu_get_elf_hwcap3(void);

#define cpu_set_named_feature(name) cpu_set_feature(cpu_feature(name))
#define cpu_have_named_feature(name) cpu_have_feature(cpu_feature(name))
Expand Down Expand Up @@ -808,6 +809,12 @@ static __always_inline bool system_uses_irq_prio_masking(void)
cpus_have_const_cap(ARM64_HAS_GIC_PRIO_MASKING);
}

static __always_inline bool system_uses_nmi(void)
{
return IS_ENABLED(CONFIG_ARM64_NMI) &&
cpus_have_const_cap(ARM64_USES_NMI);
}

static inline bool system_supports_mte(void)
{
return IS_ENABLED(CONFIG_ARM64_MTE) &&
Expand All @@ -831,6 +838,12 @@ static inline bool system_supports_tlb_range(void)
cpus_have_const_cap(ARM64_HAS_TLB_RANGE);
}

static inline bool system_supports_haft(void)
{
return IS_ENABLED(CONFIG_ARM64_HAFT) &&
cpus_have_final_cap(ARM64_HAFT);
}

int do_emulate_mrs(struct pt_regs *regs, u32 sys_reg, u32 rt);
bool try_emulate_mrs(struct pt_regs *regs, u32 isn);

Expand Down
2 changes: 2 additions & 0 deletions arch/arm64/include/asm/cputype.h
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@

#define HISI_CPU_PART_TSV110 0xD01
#define HISI_CPU_PART_HIP09 0xD02
#define HISI_CPU_PART_HIP12 0xD06

#define APPLE_CPU_PART_M1_ICESTORM 0x022
#define APPLE_CPU_PART_M1_FIRESTORM 0x023
Expand Down Expand Up @@ -222,6 +223,7 @@
#define MIDR_FUJITSU_A64FX MIDR_CPU_MODEL(ARM_CPU_IMP_FUJITSU, FUJITSU_CPU_PART_A64FX)
#define MIDR_HISI_TSV110 MIDR_CPU_MODEL(ARM_CPU_IMP_HISI, HISI_CPU_PART_TSV110)
#define MIDR_HISI_HIP09 MIDR_CPU_MODEL(ARM_CPU_IMP_HISI, HISI_CPU_PART_HIP09)
#define MIDR_HISI_HIP12 MIDR_CPU_MODEL(ARM_CPU_IMP_HISI, HISI_CPU_PART_HIP12)
#define MIDR_APPLE_M1_ICESTORM MIDR_CPU_MODEL(ARM_CPU_IMP_APPLE, APPLE_CPU_PART_M1_ICESTORM)
#define MIDR_APPLE_M1_FIRESTORM MIDR_CPU_MODEL(ARM_CPU_IMP_APPLE, APPLE_CPU_PART_M1_FIRESTORM)
#define MIDR_APPLE_M1_ICESTORM_PRO MIDR_CPU_MODEL(ARM_CPU_IMP_APPLE, APPLE_CPU_PART_M1_ICESTORM_PRO)
Expand Down
21 changes: 21 additions & 0 deletions arch/arm64/include/asm/daifflags.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#include <asm/arch_gicv3.h>
#include <asm/barrier.h>
#include <asm/cpufeature.h>
#include <asm/nmi.h>
#include <asm/ptrace.h>

#define DAIF_PROCCTX 0
Expand All @@ -35,6 +36,9 @@ static inline void local_daif_mask(void)
if (system_uses_irq_prio_masking())
gic_write_pmr(GIC_PRIO_IRQON | GIC_PRIO_PSR_I_SET);

if (system_uses_nmi())
_allint_set();

trace_hardirqs_off();
}

Expand Down Expand Up @@ -116,6 +120,14 @@ static inline void local_daif_restore(unsigned long flags)

write_sysreg(flags, daif);

/* If we can take asynchronous errors we can take NMIs */
if (system_uses_nmi()) {
if (flags & PSR_A_BIT)
_allint_set();
else
_allint_clear();
}

if (irq_disabled)
trace_hardirqs_off();
}
Expand All @@ -140,5 +152,14 @@ static inline void local_daif_inherit(struct pt_regs *regs)
* use the pmr instead.
*/
write_sysreg(flags, daif);

/* The ALLINT field is at the same position in pstate and ALLINT */
if (system_uses_nmi()) {
if (regs->pstate & ALLINT_ALLINT)
_allint_set();
Comment on lines +156 to +159
Copy link

Copilot AI Feb 3, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ALLINT_ALLINT is used here to test the ALLINT field, but there is no definition of this macro in the tree, so this code will not compile. A proper bitmask definition for the ALLINT field (in the same style as other sysreg field masks) needs to be added, or this test should use whatever generated field macro exists once the ALLINT register is described in sysreg-defs.

Copilot uses AI. Check for mistakes.
else
_allint_clear();
}
}

#endif
Loading
Loading