Skip to content

Commit bf83dae

Browse files
jgoulywilldeacon
authored andcommitted
arm64: enable the Permission Overlay Extension for EL0
Expose a HWCAP and ID_AA64MMFR3_EL1_S1POE to userspace, so they can be used to check if the CPU supports the feature. Signed-off-by: Joey Gouly <[email protected]> Cc: Catalin Marinas <[email protected]> Cc: Will Deacon <[email protected]> Reviewed-by: Catalin Marinas <[email protected]> Reviewed-by: Anshuman Khandual <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Will Deacon <[email protected]>
1 parent 9f82f15 commit bf83dae

File tree

5 files changed

+19
-0
lines changed

5 files changed

+19
-0
lines changed

Documentation/arch/arm64/elf_hwcaps.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -365,6 +365,8 @@ HWCAP2_SME_SF8DP2
365365
HWCAP2_SME_SF8DP4
366366
Functionality implied by ID_AA64SMFR0_EL1.SF8DP4 == 0b1.
367367

368+
HWCAP2_POE
369+
Functionality implied by ID_AA64MMFR3_EL1.S1POE == 0b0001.
368370

369371
4. Unused AT_HWCAP bits
370372
-----------------------

arch/arm64/include/asm/hwcap.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,7 @@
157157
#define KERNEL_HWCAP_SME_SF8FMA __khwcap2_feature(SME_SF8FMA)
158158
#define KERNEL_HWCAP_SME_SF8DP4 __khwcap2_feature(SME_SF8DP4)
159159
#define KERNEL_HWCAP_SME_SF8DP2 __khwcap2_feature(SME_SF8DP2)
160+
#define KERNEL_HWCAP_POE __khwcap2_feature(POE)
160161

161162
/*
162163
* This yields a mask that user programs can use to figure out what

arch/arm64/include/uapi/asm/hwcap.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,5 +122,6 @@
122122
#define HWCAP2_SME_SF8FMA (1UL << 60)
123123
#define HWCAP2_SME_SF8DP4 (1UL << 61)
124124
#define HWCAP2_SME_SF8DP2 (1UL << 62)
125+
#define HWCAP2_POE (1UL << 63)
125126

126127
#endif /* _UAPI__ASM_HWCAP_H */

arch/arm64/kernel/cpufeature.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -466,6 +466,8 @@ static const struct arm64_ftr_bits ftr_id_aa64mmfr2[] = {
466466
};
467467

468468
static const struct arm64_ftr_bits ftr_id_aa64mmfr3[] = {
469+
ARM64_FTR_BITS(FTR_VISIBLE_IF_IS_ENABLED(CONFIG_ARM64_POE),
470+
FTR_NONSTRICT, FTR_LOWER_SAFE, ID_AA64MMFR3_EL1_S1POE_SHIFT, 4, 0),
469471
ARM64_FTR_BITS(FTR_HIDDEN, FTR_NONSTRICT, FTR_LOWER_SAFE, ID_AA64MMFR3_EL1_S1PIE_SHIFT, 4, 0),
470472
ARM64_FTR_BITS(FTR_HIDDEN, FTR_NONSTRICT, FTR_LOWER_SAFE, ID_AA64MMFR3_EL1_TCRX_SHIFT, 4, 0),
471473
ARM64_FTR_END,
@@ -2348,6 +2350,14 @@ static void cpu_enable_mops(const struct arm64_cpu_capabilities *__unused)
23482350
sysreg_clear_set(sctlr_el1, 0, SCTLR_EL1_MSCEn);
23492351
}
23502352

2353+
#ifdef CONFIG_ARM64_POE
2354+
static void cpu_enable_poe(const struct arm64_cpu_capabilities *__unused)
2355+
{
2356+
sysreg_clear_set(REG_TCR2_EL1, 0, TCR2_EL1x_E0POE);
2357+
sysreg_clear_set(CPACR_EL1, 0, CPACR_ELx_E0POE);
2358+
}
2359+
#endif
2360+
23512361
/* Internal helper functions to match cpu capability type */
23522362
static bool
23532363
cpucap_late_cpu_optional(const struct arm64_cpu_capabilities *cap)
@@ -2876,6 +2886,7 @@ static const struct arm64_cpu_capabilities arm64_features[] = {
28762886
.capability = ARM64_HAS_S1POE,
28772887
.type = ARM64_CPUCAP_BOOT_CPU_FEATURE,
28782888
.matches = has_cpuid_feature,
2889+
.cpu_enable = cpu_enable_poe,
28792890
ARM64_CPUID_FIELDS(ID_AA64MMFR3_EL1, S1POE, IMP)
28802891
},
28812892
#endif
@@ -3043,6 +3054,9 @@ static const struct arm64_cpu_capabilities arm64_elf_hwcaps[] = {
30433054
HWCAP_CAP(ID_AA64FPFR0_EL1, F8DP2, IMP, CAP_HWCAP, KERNEL_HWCAP_F8DP2),
30443055
HWCAP_CAP(ID_AA64FPFR0_EL1, F8E4M3, IMP, CAP_HWCAP, KERNEL_HWCAP_F8E4M3),
30453056
HWCAP_CAP(ID_AA64FPFR0_EL1, F8E5M2, IMP, CAP_HWCAP, KERNEL_HWCAP_F8E5M2),
3057+
#ifdef CONFIG_ARM64_POE
3058+
HWCAP_CAP(ID_AA64MMFR3_EL1, S1POE, IMP, CAP_HWCAP, KERNEL_HWCAP_POE),
3059+
#endif
30463060
{},
30473061
};
30483062

arch/arm64/kernel/cpuinfo.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,7 @@ static const char *const hwcap_str[] = {
143143
[KERNEL_HWCAP_SME_SF8FMA] = "smesf8fma",
144144
[KERNEL_HWCAP_SME_SF8DP4] = "smesf8dp4",
145145
[KERNEL_HWCAP_SME_SF8DP2] = "smesf8dp2",
146+
[KERNEL_HWCAP_POE] = "poe",
146147
};
147148

148149
#ifdef CONFIG_COMPAT

0 commit comments

Comments
 (0)