[RFC PATCH v3 00/29] KVM: arm64: Make CPU ID registers writable by userspace

Reiji Watanabe reijiw at google.com
Wed Nov 24 09:00:39 PST 2021


Hi Alex,

> > > I started reviewing the series, but I ended up being very confused, see
> > > below.
> > >
> > > On Tue, Nov 16, 2021 at 10:43:30PM -0800, Reiji Watanabe wrote:
> > > > In KVM/arm64, values of ID registers for a guest are mostly same as
> > > > its host's values except for bits for feature that KVM doesn't support
> > > > and for opt-in features that userspace didn't configure.  Userspace
> > > > can use KVM_SET_ONE_REG to a set ID register value, but it fails
> > > > if userspace attempts to modify the register value.
> > > >
> > > > This patch series adds support to allow userspace to modify a value of
> > > > ID registers (as long as KVM can support features that are indicated
> > > > in the registers) so userspace can have more control of configuring
> > > > and unconfiguring features for guests.
> > >
> > > What not use VCPU features? Isn't that why the field
> > > kvm_vcpu_init->features exists in the first place? This cover letter does
> > > nothing to explaing why any changes are needed.
> > >
> > > Do you require finer grained control over certain feature that you cannot
> > > get with the 32 * 7 = 224 feature flag bits from kvm_vcpu_init? Does using
> > > the ID registers simplify certain aspects of the implementation?
> >
> > Since some features are not binary in nature (e.g. AA64DFR0_EL1.BRPs
> > fields indicate number of breakpoints minus 1), using
> > kvm_vcpu_init->features to configure such features is inconvenient.
>
> I see, this makes a lot of sense and this looks like a nice solution to
> that problem.
>
> >
> > One of the reasons why we want the finer grained control is that
> > we want to expose a uniform set/level of features for a group of
> > guests on systems with different ARM CPUs.
>
> So here you are talking specifically about KVM not checking that all VCPUs
> have the same feature bits set in vcpu->arch.features, which makes it
> possible for userspace to set different features for different VCPUs,
> right?

Yes, that is correct.  For features that can be configured by
KVM_ARM_VCPU_INIT, userspace can configure different features
for different vCPUs by using KVM_ARM_VCPU_INIT as before.

Thanks,
Reiji



More information about the linux-arm-kernel mailing list