Re: [PATCH 4/4] KVM: arm64: vgic-v3: Advertise GICR_CTLR.{IR, CES} as a new GICD_IIDR revision

Marc Zyngier
2022-03-16T15:01:14Z

Hi Oliver,

On Tue, 15 Mar 2022 23:13:09 +0000,
Oliver Upton <oupton@google.com> wrote:
>
> Hi Marc,
>
> On Mon, Mar 14, 2022 at 04:40:44PM +0000, Marc Zyngier wrote:
> > @@ -87,8 +91,16 @@ static int vgic_mmio_uaccess_write_v2_misc(struct kvm_vcpu *vcpu,
> > * migration from old kernels to new kernels with legacy
> > * userspace.
> > */
> > - vcpu->kvm->arch.vgic.v2_groups_user_writable = true;
> > - return 0;
> > + reg = FIELD_GET(GICD_IIDR_REVISION_MASK, reg);
> > + switch (reg) {
> > + case KVM_VGIC_IMP_REV_2:
> > + case KVM_VGIC_IMP_REV_3:
> > + dist->v2_groups_user_writable = true;
>
> Could you eliminate this bool and just pivot off of the implementation
> version?

[coming back to this]

Now I remember why this doesn't work. The established behaviour is
that it takes a write to IIDR to switch to the 'writable groups'
mode. If we base the switch on the implementation version, we don't
need a write anymore (we always allow groups to be writable), and old
guests cannot be reliably restored.

32f8777ed92d has the gory details, and that's really not old enough
that we can turn a blind eye to it, unfortunately.

Thanks,

M.

--
Without deviation from the norm, progress is not possible.