Re: [PATCH] arm64/fpsimd: Only provide the length to cpufeature for xCR registers

From: Mark Brown
Date: Fri Jul 28 2023 - 07:55:03 EST


On Fri, Jul 28, 2023 at 11:27:20AM +0100, Jonathan Cameron wrote:
> Mark Brown <broonie@xxxxxxxxxx> wrote:

> > zcr = read_sysreg_s(SYS_ZCR_EL1);
> > - zcr &= ~(u64)ZCR_ELx_LEN_MASK; /* find sticky 1s outside LEN field */
> > + zcr &= ~(u64)ZCR_ELx_LEN_MASK;
> > vq_max = sve_vq_from_vl(sve_get_vl());
> > zcr |= vq_max - 1; /* set LEN field to maximum effective value */

> > - return zcr;
> > + return SYS_FIELD_GET(ZCR_ELx, LEN, zcr);

> Isn't that overly complex if we only end up with the length? (if I'm reading this right)
> Perhaps it is more logical to build the register then pull the
> field out of it, but it would be simpler as something like...

> return sve_vq_from_vl(sve_get_vl()) - 1;

We could, yes - I did prefer to keep it clear that this is an actual
if modified register value we're returning, though that could've been a
comment.

Attachment: signature.asc
Description: PGP signature