mirror of
https://github.com/torvalds/linux.git
synced 2026-11-07 06:17:02 +01:00
KVM: selftests: Reject GICv3 ITS with a GICv5 VGIC
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> Reviewed-by: Fuad Tabba <fuad.tabba@linux.dev> Link: https://patch.msgid.link/20261020163923.1407856-3-sascha.bischoff@arm.com Signed-off-by: Marc Zyngier <maz@kernel.org>
This commit is contained in:
parent
05620a3142
commit
b17eea28dc
|
|
@ -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();
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user