From: Wang ShaoBo bobo.shaobowang@huawei.com
hulk inclusion category: bugfix bugzilla: https://gitee.com/openeuler/kernel/issues/I92AK4 CVE: NA
-----------------------------
This supports MPAM v0.1 version for cpufeature detection, check [1] for details.
[1] https://developer.arm.com/documentation/ddi0595/2021-12/ AArch64-Registers/ID-AA64PFR1-EL1--AArch64-Processor-Feature-Register-1?lang=en
Signed-off-by: Wang ShaoBo bobo.shaobowang@huawei.com --- arch/arm64/kernel/cpufeature.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-)
diff --git a/arch/arm64/kernel/cpufeature.c b/arch/arm64/kernel/cpufeature.c index 6c07804d9466..5aabbbc74f28 100644 --- a/arch/arm64/kernel/cpufeature.c +++ b/arch/arm64/kernel/cpufeature.c @@ -1355,6 +1355,17 @@ static bool has_cache_idc(const struct arm64_cpu_capabilities *entry, return ctr & BIT(CTR_IDC_SHIFT); }
+#ifdef CONFIG_MPAM +static bool has_mpam(const struct arm64_cpu_capabilities *entry, int __unused) +{ + u64 pfr0 = read_sanitised_ftr_reg(SYS_ID_AA64PFR0_EL1); + u64 pfr1 = read_sanitised_ftr_reg(SYS_ID_AA64PFR1_EL1); + + return cpuid_feature_extract_unsigned_field(pfr0, ID_AA64PFR0_MPAM_SHIFT) | + cpuid_feature_extract_unsigned_field(pfr1, ID_AA64PFR1_MPAMFRAC_SHIFT); +} +#endif + static void cpu_emulate_effective_ctr(const struct arm64_cpu_capabilities *__unused) { /* @@ -2320,12 +2331,7 @@ static const struct arm64_cpu_capabilities arm64_features[] = { .desc = "ARM64 MPAM Extension Support", .capability = ARM64_HAS_MPAM, .type = ARM64_CPUCAP_SCOPE_SYSTEM, - .matches = has_cpuid_feature, - .sys_reg = SYS_ID_AA64PFR0_EL1, - .sign = FTR_UNSIGNED, - .field_pos = ID_AA64PFR0_MPAM_SHIFT, - .field_width = 4, - .min_field_value = ID_AA64PFR0_MPAM, + .matches = has_mpam, }, #endif /* CONFIG_MPAM */ #ifdef CONFIG_ARM64_AMU_EXTN
反馈: 您发送到kernel@openeuler.org的补丁/补丁集,已成功转换为PR! PR链接地址: https://gitee.com/openeuler/kernel/pulls/4602 邮件列表地址:https://mailweb.openeuler.org/hyperkitty/list/kernel@openeuler.org/message/I...
FeedBack: The patch(es) which you have sent to kernel@openeuler.org mailing list has been converted to a pull request successfully! Pull request link: https://gitee.com/openeuler/kernel/pulls/4602 Mailing list address: https://mailweb.openeuler.org/hyperkitty/list/kernel@openeuler.org/message/I...