[PATCH v4 05/14] KVM: arm64: Initialize feature id registers for protected VMs
Fuad Tabba
tabba at google.com
Fri Dec 6 02:04:51 PST 2024
Hi Oliver,
On Fri, 6 Dec 2024 at 01:02, Oliver Upton <oliver.upton at linux.dev> wrote:
>
> Hi Fuad,
>
> On Mon, Dec 02, 2024 at 03:47:32PM +0000, Fuad Tabba wrote:
> > +/*
> > + * Initializes feature registers for protected vms.
> > + */
> > +void kvm_init_pvm_id_regs(struct kvm_vcpu *vcpu)
> > +{
> > + struct kvm *kvm = vcpu->kvm;
> > + struct kvm_arch *ka = &kvm->arch;
> > + u32 r;
> > +
>
> Can you add an assertion that this is called while holding the
> vm_table_lock? Otherwise it isn't clear why its safe to initialize
> per-VM state.
Will do, and I'll update the documentation around vm_table_lock to
clarify that. Should I respin after this, or would you like me to wait
a bit?
Thanks,
/fuad
> > + if (test_bit(KVM_ARCH_FLAG_ID_REGS_INITIALIZED, &kvm->arch.flags))
> > + return;
> > +
> > + /*
> > + * Initialize only AArch64 id registers since AArch32 isn't supported
> > + * for protected VMs.
> > + */
> > + for (r = sys_reg(3, 0, 0, 4, 0); r <= sys_reg(3, 0, 0, 7, 7); r += sys_reg(0, 0, 0, 0, 1))
> > + ka->id_regs[IDREG_IDX(r)] = pvm_calc_id_reg(vcpu, r);
> > +
> > + set_bit(KVM_ARCH_FLAG_ID_REGS_INITIALIZED, &kvm->arch.flags);
> > +}
> > +
> > /*
> > * Checks that the sysreg table is unique and in-order.
> > *
> > --
> > 2.47.0.338.g60cca15819-goog
> >
>
> --
> Thanks,
> Oliver
More information about the linux-arm-kernel
mailing list