Subject: Re: [PATCH] KVM: arm64: Preserve all guest ZCR_EL2.LEN values

From: Marc Zyngier <[email-masked]>
Date: Sat, 23 May 2026 16:24:52 +0100

On Sat, 23 May 2026 15:38:28 +0100,
Mark Brown <[email-masked]> wrote:
> 
> On Sat, May 23, 2026 at 09:47:38AM +0100, Marc Zyngier wrote:
> > Mark Brown <[email-masked]> wrote:
> 
> > > Currently all other bits in ZCR_EL2 are either RES0 or RAZ/WI, values
> > > written are sanitised based on this.
> 
> > Only for the direct writes to ZCR_EL2, as they are trapping. I don't
> > see any sanitisation for writes using the ZCR_EL1 accessor, which is
> > the common case. This needs fixing at the same time.
> 
> OK, I'll convert ZCR_EL2 to a sanitised register.  As I mentioned I was
> a bit confused about why the existing code is the way it is and so
> followed it in only managing the direct writes.  I figured it was
> considered OK to rely on the hardware for the RES0 and WI behaviour for
> untrapped access.

In general, that's OK. But given that you need sanitisation in the
trapping case, it is way better to have a uniform behaviour and keep
sanitisation at the accessor level. It is also more sustainable in the
long run, should ZCR_ELx get new significant bits.

Thanks,

	M.

-- 
Jazz isn't dead. It just smells funny.