OSDN Git Service

KVM: selftests: aarch64: Skip tests if we can't create a vgic-v3
authorMark Brown <broonie@kernel.org>
Wed, 23 Feb 2022 13:16:24 +0000 (13:16 +0000)
committerMarc Zyngier <maz@kernel.org>
Fri, 25 Feb 2022 13:02:28 +0000 (13:02 +0000)
commit456f89e0928ab938122a40e9f094a6524cc158b4
treed6156bf3d768bbae937ef3853a3743572629201f
parenta867e9d0cc15039a6ef72e17e2603303dcd1783f
KVM: selftests: aarch64: Skip tests if we can't create a vgic-v3

The arch_timer and vgic_irq kselftests assume that they can create a
vgic-v3, using the library function vgic_v3_setup() which aborts with a
test failure if it is not possible to do so. Since vgic-v3 can only be
instantiated on systems where the host has GICv3 this leads to false
positives on older systems where that is not the case.

Fix this by changing vgic_v3_setup() to return an error if the vgic can't
be instantiated and have the callers skip if this happens. We could also
exit flagging a skip in vgic_v3_setup() but this would prevent future test
cases conditionally deciding which GIC to use or generally doing more
complex output.

Signed-off-by: Mark Brown <broonie@kernel.org>
Reviewed-by: Andrew Jones <drjones@redhat.com>
Tested-by: Ricardo Koller <ricarkol@google.com>
Signed-off-by: Marc Zyngier <maz@kernel.org>
Link: https://lore.kernel.org/r/20220223131624.1830351-1-broonie@kernel.org
tools/testing/selftests/kvm/aarch64/arch_timer.c
tools/testing/selftests/kvm/aarch64/vgic_irq.c
tools/testing/selftests/kvm/lib/aarch64/vgic.c