Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

KVM: arm64: vgic: Fix IIDR revision field extracted from wrong value

The uaccess write handlers for GICD_IIDR in both GICv2 and GICv3
extract the revision field from 'reg' (the current IIDR value read back
from the emulated distributor) instead of 'val' (the value userspace is
trying to write). This means userspace can never actually change the
implementation revision — the extracted value is always the current one.

Fix the FIELD_GET to use 'val' so that userspace can select a different
revision for migration compatibility.

Fixes: 49a1a2c70a7f ("KVM: arm64: vgic-v3: Advertise GICR_CTLR.{IR, CES} as a new GICD_IIDR revision")
Signed-off-by: David Woodhouse <dwmw@amazon.co.uk>
Link: https://patch.msgid.link/20260407210949.2076251-2-dwmw2@infradead.org
Signed-off-by: Marc Zyngier <maz@kernel.org>
Cc: stable@vger.kernel.org

authored by

David Woodhouse and committed by
Marc Zyngier
a0e6ae45 f0579949

+2 -2
+1 -1
arch/arm64/kvm/vgic/vgic-mmio-v2.c
··· 91 91 * migration from old kernels to new kernels with legacy 92 92 * userspace. 93 93 */ 94 - reg = FIELD_GET(GICD_IIDR_REVISION_MASK, reg); 94 + reg = FIELD_GET(GICD_IIDR_REVISION_MASK, val); 95 95 switch (reg) { 96 96 case KVM_VGIC_IMP_REV_2: 97 97 case KVM_VGIC_IMP_REV_3:
+1 -1
arch/arm64/kvm/vgic/vgic-mmio-v3.c
··· 194 194 if ((reg ^ val) & ~GICD_IIDR_REVISION_MASK) 195 195 return -EINVAL; 196 196 197 - reg = FIELD_GET(GICD_IIDR_REVISION_MASK, reg); 197 + reg = FIELD_GET(GICD_IIDR_REVISION_MASK, val); 198 198 switch (reg) { 199 199 case KVM_VGIC_IMP_REV_2: 200 200 case KVM_VGIC_IMP_REV_3: