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 <[email protected]>

> +#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.

Attachment: signature.asc
Description: PGP signature

_______________________________________________
kvmarm mailing list
[email protected]
https://lists.cs.columbia.edu/mailman/listinfo/kvmarm

Reply via email to