Skip to content

Commit 6a4f7fc

Browse files
author
Marc Zyngier
committed
KVM: arm64: selftests: Add support for GICv2 on v3
The current vgic_init test wrongly assumes that the host cannot multiple versions of the GIC architecture, while v2 emulation on v3 has almost always been supported (it was supported before the standalone v3 emulation). Tweak the test to support multiple GIC incarnations. Signed-off-by: Marc Zyngier <[email protected]> Fixes: 3f4db37 ("KVM: arm64: selftests: Make vgic_init gic version agnostic") Reviewed-by: Ricardo Koller <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 1c3ace2 commit 6a4f7fc

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

tools/testing/selftests/kvm/aarch64/vgic_init.c

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -670,7 +670,7 @@ int test_kvm_device(uint32_t gic_dev_type)
670670

671671
if (!_kvm_create_device(v.vm, other, true, &fd)) {
672672
ret = _kvm_create_device(v.vm, other, false, &fd);
673-
TEST_ASSERT(ret && errno == EINVAL,
673+
TEST_ASSERT(ret && (errno == EINVAL || errno == EEXIST),
674674
"create GIC device while other version exists");
675675
}
676676

@@ -698,6 +698,7 @@ int main(int ac, char **av)
698698
{
699699
int ret;
700700
int pa_bits;
701+
int cnt_impl = 0;
701702

702703
pa_bits = vm_guest_mode_params[VM_MODE_DEFAULT].pa_bits;
703704
max_phys_size = 1ULL << pa_bits;
@@ -706,17 +707,19 @@ int main(int ac, char **av)
706707
if (!ret) {
707708
pr_info("Running GIC_v3 tests.\n");
708709
run_tests(KVM_DEV_TYPE_ARM_VGIC_V3);
709-
return 0;
710+
cnt_impl++;
710711
}
711712

712713
ret = test_kvm_device(KVM_DEV_TYPE_ARM_VGIC_V2);
713714
if (!ret) {
714715
pr_info("Running GIC_v2 tests.\n");
715716
run_tests(KVM_DEV_TYPE_ARM_VGIC_V2);
716-
return 0;
717+
cnt_impl++;
717718
}
718719

719-
print_skip("No GICv2 nor GICv3 support");
720-
exit(KSFT_SKIP);
720+
if (!cnt_impl) {
721+
print_skip("No GICv2 nor GICv3 support");
722+
exit(KSFT_SKIP);
723+
}
721724
return 0;
722725
}

0 commit comments

Comments
 (0)