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 2/2] KVM: selftests: Reject GICv3 ITS with a GICv5 VGIC
Date: Tue, 20 Oct 2026 17:39:23 +0100 [thread overview]
Message-ID: <20261020163923.1407856-3-sascha.bischoff@arm.com> (raw)
In-Reply-To: <20261020163923.1407856-1-sascha.bischoff@arm.com>
Check that a GICv3 ITS and a GICv5 VGIC cannot be paired, regardless
of which device is created first. Skip the check when the host does not
expose a GICv3 ITS.
Signed-off-by: Sascha Bischoff <sascha.bischoff@arm.com>
---
tools/testing/selftests/kvm/arm64/vgic_v5.c | 32 +++++++++++++++++++++
1 file changed, 32 insertions(+)
diff --git a/tools/testing/selftests/kvm/arm64/vgic_v5.c b/tools/testing/selftests/kvm/arm64/vgic_v5.c
index d5df742b23001..5bf7d99d29147 100644
--- a/tools/testing/selftests/kvm/arm64/vgic_v5.c
+++ b/tools/testing/selftests/kvm/arm64/vgic_v5.c
@@ -2003,8 +2003,40 @@ int test_kvm_device(u32 gic_dev_type)
return 0;
}
+static void test_vgic_v3_its_with_vgic_v5(void)
+{
+ struct kvm_vm *vm = vm_create_barebones();
+ int gic_fd, its_fd, ret;
+
+ if (__kvm_test_create_device(vm, KVM_DEV_TYPE_ARM_VGIC_ITS)) {
+ pr_info("No GICv3 ITS support; skipping mixed-model test.\n");
+ kvm_vm_free(vm);
+ return;
+ }
+
+ gic_fd = kvm_create_device(vm, KVM_DEV_TYPE_ARM_VGIC_V5);
+ ret = __kvm_create_device(vm, KVM_DEV_TYPE_ARM_VGIC_ITS);
+ TEST_ASSERT(ret < 0 && errno == ENODEV,
+ "GICv3 ITS created after GICv5 VGIC: ret=%d errno=%d",
+ ret, errno);
+ close(gic_fd);
+ kvm_vm_free(vm);
+
+ vm = vm_create_barebones();
+ its_fd = kvm_create_device(vm, KVM_DEV_TYPE_ARM_VGIC_ITS);
+ ret = __kvm_create_device(vm, KVM_DEV_TYPE_ARM_VGIC_V5);
+ TEST_ASSERT(ret < 0 && errno == ENODEV,
+ "GICv5 VGIC created after GICv3 ITS: ret=%d errno=%d",
+ ret, errno);
+ close(its_fd);
+ kvm_vm_free(vm);
+}
+
void run_tests(u32 gic_dev_type)
{
+ pr_info("Test VGICv5 and GICv3 ITS model mismatch\n");
+ test_vgic_v3_its_with_vgic_v5();
+
pr_info("Test VGICv5 address attrs\n");
test_vgic_v5_addr_attrs();
--
2.34.1
prev parent reply other threads:[~2026-10-20 16:40 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-20 16:39 [PATCH v3 0/2] KVM: arm64: Reject mismatched VGIC/ITS models Sascha Bischoff
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 ` Sascha Bischoff [this message]
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-3-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