Re: [PATCH] KVM: arm64: selftests: Fix multiple versions of GIC creation

From: Oliver Upton
Date: Mon Oct 10 2022 - 00:11:04 EST


On Sun, Oct 09, 2022 at 11:31:31AM +0800, Zenghui Yu wrote:
> Commit 98f94ce42ac6 ("KVM: selftests: Move KVM_CREATE_DEVICE_TEST code to
> separate helper") wrongly converted a "real" GIC device creation to
> __kvm_test_create_device() and caused the test failure on my D05 (which
> supports v2 emulation). Fix it.
>
> Fixes: 98f94ce42ac6 ("KVM: selftests: Move KVM_CREATE_DEVICE_TEST code to separate helper")
> Signed-off-by: Zenghui Yu <yuzenghui@xxxxxxxxxx>

Reviewed-by: Oliver Upton <oliver.upton@xxxxxxxxx>

--
Thanks,
Oliver

> ---
> tools/testing/selftests/kvm/aarch64/vgic_init.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/tools/testing/selftests/kvm/aarch64/vgic_init.c b/tools/testing/selftests/kvm/aarch64/vgic_init.c
> index e05ecb31823f..9c131d977a1b 100644
> --- a/tools/testing/selftests/kvm/aarch64/vgic_init.c
> +++ b/tools/testing/selftests/kvm/aarch64/vgic_init.c
> @@ -662,8 +662,8 @@ int test_kvm_device(uint32_t gic_dev_type)
> : KVM_DEV_TYPE_ARM_VGIC_V2;
>
> if (!__kvm_test_create_device(v.vm, other)) {
> - ret = __kvm_test_create_device(v.vm, other);
> - TEST_ASSERT(ret && (errno == EINVAL || errno == EEXIST),
> + ret = __kvm_create_device(v.vm, other);
> + TEST_ASSERT(ret < 0 && (errno == EINVAL || errno == EEXIST),
> "create GIC device while other version exists");
> }
>
> --
> 2.33.0
>
>