[PATCH v2 05/11] arm64: sve: Provide a conditional update accessor for ZCR_ELx
Mark Brown
broonie at kernel.org
Fri Mar 19 16:42:36 GMT 2021
On Thu, Mar 18, 2021 at 12:25:26PM +0000, Marc Zyngier wrote:
> 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.
Reviewed-by: Mark Brown <broonie at kernel.org>
> +#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)
> +
Do compilers actually do much better with this than with a static
inline like the other functions in this header? Seems like something
they should be figuring out.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20210319/e0474dd2/attachment-0001.sig>
More information about the linux-arm-kernel
mailing list