提交 78f46ea2 编写于 作者: M Marc Zyngier 提交者: Wang ShaoBo

arm64: sve: Provide a conditional update accessor for ZCR_ELx

mainline inclusion
from mainline-v5.13-rc1~76^2
commit 71ce1ae5
category: feature
bugzilla: https://gitee.com/openeuler/kernel/issues/I5ITJT
CVE: NA

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=71ce1ae56e4d43a0c568e2d4bfb154cd15306a82

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

A common pattern is to conditionally update ZCR_ELx in order
to avoid the "self-synchronizing" effect that writing to this
register has.

Let's provide an accessor that does exactly this.
Acked-by: NWill Deacon <will@kernel.org>
Signed-off-by: NMarc Zyngier <maz@kernel.org>
Signed-off-by: NWang ShaoBo <bobo.shaobowang@huawei.com>
上级 5d789205
...@@ -129,6 +129,15 @@ static inline void sve_user_enable(void) ...@@ -129,6 +129,15 @@ static inline void sve_user_enable(void)
sysreg_clear_set(cpacr_el1, 0, CPACR_EL1_ZEN_EL0EN); sysreg_clear_set(cpacr_el1, 0, CPACR_EL1_ZEN_EL0EN);
} }
#define sve_cond_update_zcr_vq(val, reg) \
do { \
u64 __zcr = read_sysreg_s((reg)); \
u64 __new = __zcr & ~ZCR_ELx_LEN_MASK; \
__new |= (val) & ZCR_ELx_LEN_MASK; \
if (__zcr != __new) \
write_sysreg_s(__new, (reg)); \
} while (0)
/* /*
* Probing and setup functions. * Probing and setup functions.
* Calls to these functions must be serialised with one another. * Calls to these functions must be serialised with one another.
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册