Skip to content

Commit 5d311b8

Browse files
asdfugiljannau
authored andcommitted
arm64: cpufeature: Pretend that Apple A10 family does not support 32-bit EL0
The Apple A10 family consists of physical performance and efficiency cores, and only one of them can be active at a given time depending on the current p-state. However, only the performance cores can execute 32-bit EL0. This results in logical cores that can only execute 32-bit EL0 in high p-states. Trying to support 32-bit EL0 on a CPU that can only execute it in certain states is a bad idea. The A10 family only supports 16KB page size anyway so many AArch32 executables won't run anyways. Pretend that it does not support 32-bit EL0 at all. Signed-off-by: Nick Chan <towinchenmi@gmail.com>
1 parent 4fe04bc commit 5d311b8

1 file changed

Lines changed: 27 additions & 0 deletions

File tree

arch/arm64/kernel/cpufeature.c

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3506,6 +3506,31 @@ void __init setup_boot_cpu_features(void)
35063506
setup_boot_cpu_capabilities();
35073507
}
35083508

3509+
static void __init bad_aarch32_el0_fixup(void)
3510+
{
3511+
static const struct midr_range bad_aarch32_el0[] = {
3512+
MIDR_ALL_VERSIONS(MIDR_APPLE_A10_T2_HURRICANE_ZEPHYR),
3513+
MIDR_ALL_VERSIONS(MIDR_APPLE_A10X_HURRICANE_ZEPHYR),
3514+
{}
3515+
};
3516+
3517+
/*
3518+
* The Apple A10 family can only execute 32-bit EL0 when in high
3519+
* p-states. Pretend it does not support 32-bit EL0.
3520+
*/
3521+
if (is_midr_in_range_list(read_cpuid_id(), bad_aarch32_el0)) {
3522+
struct arm64_ftr_reg *regp;
3523+
3524+
regp = get_arm64_ftr_reg(SYS_ID_AA64PFR0_EL1);
3525+
if (!regp)
3526+
return;
3527+
u64 val = (regp->sys_val & ~ID_AA64PFR0_EL1_EL0_MASK)
3528+
| ID_AA64PFR0_EL1_EL0_IMP;
3529+
3530+
update_cpu_ftr_reg(regp, val);
3531+
}
3532+
}
3533+
35093534
static void __init setup_system_capabilities(void)
35103535
{
35113536
/*
@@ -3539,6 +3564,8 @@ static void __init setup_system_capabilities(void)
35393564

35403565
void __init setup_system_features(void)
35413566
{
3567+
bad_aarch32_el0_fixup();
3568+
35423569
setup_system_capabilities();
35433570

35443571
kpti_install_ng_mappings();

0 commit comments

Comments
 (0)