[PATCH v3 1/2] KVM: arm64: vgic: Require matching VGIC and ITS models
Fuad Tabba
fuad.tabba at linux.dev
Tue Oct 20 23:47:33 PDT 2026
On Tue, 20 Oct 2026 at 17:39, Sascha Bischoff <sascha.bischoff at arm.com> wrote:
>
> On a GICv5 host with legacy support, KVM registers both VGICv3 and
> VGICv5 devices. Without a model check, a VM can create a GICv3 ITS
> alongside an incompatible VGIC, regardless of creation order.
>
> The same problem exists for GICv2 on hosts that support a GICv3 ITS.
> KVM used to allow userspace to create both devices in either order,
> then ignored the ITS.
>
> Record the VGIC model required by an ITS. Reject an ITS if the VM
> already has an incompatible VGIC, and reject a VGIC if an existing
> ITS requires a different model. These checks apply on every host:
> a GICv2 VGIC and a GICv3 ITS now fail with -ENODEV in either order.
> Allow either creation order when the models match.
>
> Have vgic_has_its() require matching VGIC and ITS models, and drop
> the separate has_its flag.
>
> As part of this change, swap the type of vgic_model from u32 to enum
> kvm_device_type. This requires updating the switch cases in
> kvm_vgic_vcpu_init() and kvm_vgic_dist_destroy() to include default
> cases, which we mark as unreachable().
>
> Signed-off-by: Sascha Bischoff <sascha.bischoff at arm.com>
Reviewed-by: Fuad Tabba <fuad.tabba at linux.dev>
Cheers,
/fuad
More information about the linux-arm-kernel
mailing list