[PATCH 0/3] KVM: arm64: vgic: Fix IIDR revision handling and add revision 1

David Woodhouse
2026-04-07T21:10:07Z

The uaccess write handlers for GICD_IIDR extract the revision field
from the wrong variable, making it impossible for userspace to actually
change the implementation revision. Fix that.

Additionally, allow userspace to select IIDR revision 1, restoring the
behaviour from before commit d53c2c29ae0d ("KVM: arm/arm64: vgic: Allow
configuration of interrupt groups") behaviour where interrupt groups are
not guest-configurable. This is needed by hypervisors that were
reverting that commit to preserve the original guest-visible
semantics.

When revision 1 is selected:
- GICv2: IGROUPR reads as zero (group 0), writes ignored
- GICv3: IGROUPR reads as all-ones (group 1), writes ignored

The IIDR revision comments in both vgic-mmio-v2.c and vgic-mmio-v3.c
are updated to document all three revisions.

David Woodhouse (3):
KVM: arm64: vgic: Fix IIDR revision field extracted from wrong value
KVM: arm64: vgic: Allow userspace to set IIDR revision 1
KVM: arm64: selftests: Add vgic IIDR revision test

arch/arm64/kvm/vgic/vgic-mmio-v2.c | 7 +-
arch/arm64/kvm/vgic/vgic-mmio-v3.c | 6 +-
arch/arm64/kvm/vgic/vgic-mmio.c | 15 +++
include/kvm/arm_vgic.h | 1 +
tools/testing/selftests/kvm/Makefile.kvm | 1 +
.../testing/selftests/kvm/arm64/vgic_group_iidr.c | 112 +++++++++++++++++++++
6 files changed, 140 insertions(+), 2 deletions(-)