提交 6403b043 编写于 作者: W Wei Li 提交者: Zheng Zengkai

arm64: clear_page() shouldn't use DC ZVA when DCZID_EL0.DZP == 1

hulk inclusion
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I53K4K
CVE: NA
backport: openEuler-22.03-LTS

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=f0616abd4e67143b45b04b565839148458857347

-------------------------------------------------

Currently, clear_page() uses DC ZVA instruction unconditionally.  But it
should make sure that DCZID_EL0.DZP, which indicates whether or not use
of DC ZVA instruction is prohibited, is zero when using the instruction.
Use STNP instead when DCZID_EL0.DZP == 1.

Fixes: f27bb139 ("arm64: Miscellaneous library functions")
Based-on-patch-by: NReiji Watanabe <reijiw@google.com>
Signed-off-by: NWei Li <liwei391@huawei.com>
Reviewed-by: NXie XiuQi <xiexiuqi@huawei.com>
Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
上级 90fba22b
...@@ -1792,6 +1792,9 @@ static bool has_mor_nontemporal(const struct arm64_cpu_capabilities *entry) ...@@ -1792,6 +1792,9 @@ static bool has_mor_nontemporal(const struct arm64_cpu_capabilities *entry)
static bool can_clearpage_use_stnp(const struct arm64_cpu_capabilities *entry, static bool can_clearpage_use_stnp(const struct arm64_cpu_capabilities *entry,
int scope) int scope)
{ {
if (read_sysreg(dczid_el0) & BIT(DCZID_DZP_SHIFT))
return true;
return use_clearpage_stnp && has_mor_nontemporal(entry); return use_clearpage_stnp && has_mor_nontemporal(entry);
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册