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

Mark Brown broonie at kernel.org
Wed Jan 14 09:07:25 PST 2026


On Tue, Jan 13, 2026 at 02:06:53PM +0000, Fuad Tabba wrote:
> On Tue, 23 Dec 2025 at 01:23, Mark Brown <broonie at kernel.org> 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.
-------------- 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/20260114/cef30e94/attachment.sig>


More information about the linux-arm-kernel mailing list