Skip to content

Commit b90d2b2

Browse files
Julien Thierryctmarinas
authored andcommitted
arm64: cpufeature: Add cpufeature for IRQ priority masking
Add a cpufeature indicating whether a cpu supports masking interrupts by priority. The feature will be properly enabled in a later patch. Signed-off-by: Julien Thierry <[email protected]> Reviewed-by: Suzuki K Poulose <[email protected]> Reviewed-by: Mark Rutland <[email protected]> Acked-by: Catalin Marinas <[email protected]> Acked-by: Marc Zyngier <[email protected]> Cc: Will Deacon <[email protected]> Cc: Marc Zyngier <[email protected]> Cc: Suzuki K Poulose <[email protected]> Signed-off-by: Catalin Marinas <[email protected]>
1 parent c9bfdf7 commit b90d2b2

File tree

3 files changed

+31
-1
lines changed

3 files changed

+31
-1
lines changed

arch/arm64/include/asm/cpucaps.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,8 @@
6060
#define ARM64_HAS_ADDRESS_AUTH_IMP_DEF 39
6161
#define ARM64_HAS_GENERIC_AUTH_ARCH 40
6262
#define ARM64_HAS_GENERIC_AUTH_IMP_DEF 41
63+
#define ARM64_HAS_IRQ_PRIO_MASKING 42
6364

64-
#define ARM64_NCAPS 42
65+
#define ARM64_NCAPS 43
6566

6667
#endif /* __ASM_CPUCAPS_H */

arch/arm64/include/asm/cpufeature.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -612,6 +612,12 @@ static inline bool system_supports_generic_auth(void)
612612
cpus_have_const_cap(ARM64_HAS_GENERIC_AUTH_IMP_DEF));
613613
}
614614

615+
static inline bool system_uses_irq_prio_masking(void)
616+
{
617+
return IS_ENABLED(CONFIG_ARM64_PSEUDO_NMI) &&
618+
cpus_have_const_cap(ARM64_HAS_IRQ_PRIO_MASKING);
619+
}
620+
615621
#define ARM64_SSBD_UNKNOWN -1
616622
#define ARM64_SSBD_FORCE_DISABLE 0
617623
#define ARM64_SSBD_KERNEL 1

arch/arm64/kernel/cpufeature.c

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1203,6 +1203,14 @@ static void cpu_enable_address_auth(struct arm64_cpu_capabilities const *cap)
12031203
}
12041204
#endif /* CONFIG_ARM64_PTR_AUTH */
12051205

1206+
#ifdef CONFIG_ARM64_PSEUDO_NMI
1207+
static bool can_use_gic_priorities(const struct arm64_cpu_capabilities *entry,
1208+
int scope)
1209+
{
1210+
return false;
1211+
}
1212+
#endif
1213+
12061214
static const struct arm64_cpu_capabilities arm64_features[] = {
12071215
{
12081216
.desc = "GIC system register CPU interface",
@@ -1480,6 +1488,21 @@ static const struct arm64_cpu_capabilities arm64_features[] = {
14801488
.matches = has_cpuid_feature,
14811489
},
14821490
#endif /* CONFIG_ARM64_PTR_AUTH */
1491+
#ifdef CONFIG_ARM64_PSEUDO_NMI
1492+
{
1493+
/*
1494+
* Depends on having GICv3
1495+
*/
1496+
.desc = "IRQ priority masking",
1497+
.capability = ARM64_HAS_IRQ_PRIO_MASKING,
1498+
.type = ARM64_CPUCAP_STRICT_BOOT_CPU_FEATURE,
1499+
.matches = can_use_gic_priorities,
1500+
.sys_reg = SYS_ID_AA64PFR0_EL1,
1501+
.field_pos = ID_AA64PFR0_GIC_SHIFT,
1502+
.sign = FTR_UNSIGNED,
1503+
.min_field_value = 1,
1504+
},
1505+
#endif
14831506
{},
14841507
};
14851508

0 commit comments

Comments
 (0)