Skip to content

Commit 601d58c

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 8d66841 commit 601d58c

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
@@ -3505,6 +3505,31 @@ void __init setup_boot_cpu_features(void)
35053505
setup_boot_cpu_capabilities();
35063506
}
35073507

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

35393564
void __init setup_system_features(void)
35403565
{
3566+
bad_aarch32_el0_fixup();
3567+
35413568
setup_system_capabilities();
35423569

35433570
kpti_install_ng_mappings();

0 commit comments

Comments
 (0)