|
@@ -880,10 +880,9 @@ static bool has_cache_dic(const struct arm64_cpu_capabilities *entry,
|
|
|
static int __kpti_forced; /* 0: not forced, >0: forced on, <0: forced off */
|
|
|
|
|
|
static bool unmap_kernel_at_el0(const struct arm64_cpu_capabilities *entry,
|
|
|
- int __unused)
|
|
|
+ int scope)
|
|
|
{
|
|
|
char const *str = "command line option";
|
|
|
- u64 pfr0 = read_sanitised_ftr_reg(SYS_ID_AA64PFR0_EL1);
|
|
|
|
|
|
/*
|
|
|
* For reasons that aren't entirely clear, enabling KPTI on Cavium
|
|
@@ -914,8 +913,7 @@ static bool unmap_kernel_at_el0(const struct arm64_cpu_capabilities *entry,
|
|
|
}
|
|
|
|
|
|
/* Defer to CPU feature registers */
|
|
|
- return !cpuid_feature_extract_unsigned_field(pfr0,
|
|
|
- ID_AA64PFR0_CSV3_SHIFT);
|
|
|
+ return !has_cpuid_feature(entry, scope);
|
|
|
}
|
|
|
|
|
|
static void
|
|
@@ -1062,7 +1060,15 @@ static const struct arm64_cpu_capabilities arm64_features[] = {
|
|
|
{
|
|
|
.desc = "Kernel page table isolation (KPTI)",
|
|
|
.capability = ARM64_UNMAP_KERNEL_AT_EL0,
|
|
|
- .type = ARM64_CPUCAP_SYSTEM_FEATURE,
|
|
|
+ .type = ARM64_CPUCAP_BOOT_RESTRICTED_CPU_LOCAL_FEATURE,
|
|
|
+ /*
|
|
|
+ * The ID feature fields below are used to indicate that
|
|
|
+ * the CPU doesn't need KPTI. See unmap_kernel_at_el0 for
|
|
|
+ * more details.
|
|
|
+ */
|
|
|
+ .sys_reg = SYS_ID_AA64PFR0_EL1,
|
|
|
+ .field_pos = ID_AA64PFR0_CSV3_SHIFT,
|
|
|
+ .min_field_value = 1,
|
|
|
.matches = unmap_kernel_at_el0,
|
|
|
.cpu_enable = kpti_install_ng_mappings,
|
|
|
},
|