Re: [PATCH v9 22/30] KVM: arm64: Expose SME specific state to userspace

From: Mark Brown

Date: Wed Jan 14 2026 - 12:07:31 EST


On Tue, Jan 13, 2026 at 02:06:53PM +0000, Fuad Tabba wrote:
> On Tue, 23 Dec 2025 at 01:23, Mark Brown <broonie@xxxxxxxxxx> wrote:

> > +static int sme_reg_to_region(struct vec_state_reg_region *region,
> > + struct kvm_vcpu *vcpu,
> > + const struct kvm_one_reg *reg)
> > +{

> > + reg_num = (reg->id & SVE_REG_ID_MASK) >> SVE_REG_ID_SHIFT;

> You use array_index_nospec() below for koffset, but it might be worth
> using it for intermediate values, such as this one.

This is following the existing pattern for the SVE registers, I'm
trusting the logic there.

> > + sme_state_size = vcpu_sme_state_size(vcpu);

> Is it worth caching this value and storing it in arch, since the state
> size doesn't change after finalization?

It feels marginal, and we've not been caching it for SVE all this time.
Most of the time we use the value we're doing so as part of a fairly
expensive operation so it seems like a reasonable choice.

Attachment: signature.asc
Description: PGP signature