From: Sascha Bischoff <sascha.bischoff@arm.com>
To: linux-arm-kernel@lists.infradead.org, kvmarm@lists.linux.dev,
kvm@vger.kernel.org
Cc: maz@kernel.org, oupton@kernel.org, fuad.tabba@linux.dev,
joey.gouly@arm.com, seiden@linux.ibm.com, suzuki.poulose@arm.com,
yuzenghui@huawei.com
Subject: [PATCH v3 0/2] KVM: arm64: Reject mismatched VGIC/ITS models
Date: Tue, 20 Oct 2026 17:39:21 +0100 [thread overview]
Message-ID: <20261020163923.1407856-1-sascha.bischoff@arm.com> (raw)
On a GICv5 host with legacy GICv3 support, KVM exposes both VGIC
models to userspace. A VM can create a GICv3 ITS alongside a GICv5
VGIC, because neither creation path checks the model of the other
device. The ITS sets has_its, but a GICv5 VM cannot use a GICv3 ITS
for MSI translation. Creating the ITS before the VGIC also lets
userspace select an incompatible VGIC model later.
The same issue affects GICv2 on hosts with GICv3 ITS support. KVM
previously accepted a GICv2 VGIC and a GICv3 ITS in either order, then
ignored the ITS. The new checks reject this pairing with -ENODEV.
Record the VGIC model required by a GICv3 ITS and reject incompatible
device creation in either order. Drop has_its in favour of checking
that its_model matches vgic_model, so an ITS created without an
in-kernel VGIC is not reported as available. The second patch tests
both orderings of the GICv5 mismatch, skipping the test if the host
does not offer a GICv3 ITS.
This series is based on kvmarm/next-7.4+fixes-7.3-2.
Changes since V2:
* Check vgic_model in vgic_has_its(), as pointed out by Sashiko [1]
and Fuad [2], so an ITS without an in-kernel VGIC is not reported as
present.
* Document the GICv2 behaviour and make the first patch subject
independent of the GIC version.
Changes since V1:
* Worked in Marc's suggestion to drop has_its.
* Check for its_model being non-zero in vgic_has_its(), allowing us to
drop has_its.
* Added a comment to explain what we are actually doing. Again, Marc's
suggestion.
* Changed the type of vgic_model from u32 to enum kvm_device_type.
Thanks,
Sascha
[1] https://lore.kernel.org/all/sashiko-outbox-177254@kernel.org
[2] https://lore.kernel.org/all/CA+EHjTzqKiWr2tnV0rUiA4VVCs5a0E2XQQTdwvH0bTKZ5dxe5A@mail.gmail.com/
Sascha Bischoff (2):
KVM: arm64: vgic: Require matching VGIC and ITS models
KVM: selftests: Reject GICv3 ITS with a GICv5 VGIC
arch/arm64/kvm/vgic/vgic-init.c | 17 +++++++++++
arch/arm64/kvm/vgic/vgic-its.c | 15 +++++++++-
arch/arm64/kvm/vgic/vgic-mmio-v3.c | 5 +---
include/kvm/arm_vgic.h | 5 ++--
tools/testing/selftests/kvm/arm64/vgic_v5.c | 32 +++++++++++++++++++++
5 files changed, 67 insertions(+), 7 deletions(-)
--
2.34.1
next reply other threads:[~2026-10-20 16:46 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-20 16:39 Sascha Bischoff [this message]
2026-10-20 16:39 ` [PATCH v3 1/2] KVM: arm64: vgic: Require matching VGIC and ITS models Sascha Bischoff
2026-10-20 16:39 ` [PATCH v3 2/2] KVM: selftests: Reject GICv3 ITS with a GICv5 VGIC Sascha Bischoff
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261020163923.1407856-1-sascha.bischoff@arm.com \
--to=sascha.bischoff@arm.com \
--cc=fuad.tabba@linux.dev \
--cc=joey.gouly@arm.com \
--cc=kvm@vger.kernel.org \
--cc=kvmarm@lists.linux.dev \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=maz@kernel.org \
--cc=oupton@kernel.org \
--cc=seiden@linux.ibm.com \
--cc=suzuki.poulose@arm.com \
--cc=yuzenghui@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox