All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] KVM: arm64: selftests: Add support for GICv2 on v3
@ 2022-07-14 15:41 ` Marc Zyngier
  0 siblings, 0 replies; 9+ messages in thread
From: Marc Zyngier @ 2022-07-14 15:41 UTC (permalink / raw)
  To: kvmarm, kvm, linux-arm-kernel
  Cc: James Morse, Suzuki K Poulose, Alexandru Elisei, Oliver Upton,
	Ricardo Koller

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 <maz@kernel.org>
---
 tools/testing/selftests/kvm/aarch64/vgic_init.c | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/tools/testing/selftests/kvm/aarch64/vgic_init.c b/tools/testing/selftests/kvm/aarch64/vgic_init.c
index 34379c98d2f4..21ba4002fc18 100644
--- a/tools/testing/selftests/kvm/aarch64/vgic_init.c
+++ b/tools/testing/selftests/kvm/aarch64/vgic_init.c
@@ -670,7 +670,7 @@ int test_kvm_device(uint32_t gic_dev_type)
 
 	if (!_kvm_create_device(v.vm, other, true, &fd)) {
 		ret = _kvm_create_device(v.vm, other, false, &fd);
-		TEST_ASSERT(ret && errno == EINVAL,
+		TEST_ASSERT(ret && (errno == EINVAL || errno == EEXIST),
 				"create GIC device while other version exists");
 	}
 
@@ -698,6 +698,7 @@ int main(int ac, char **av)
 {
 	int ret;
 	int pa_bits;
+	int cnt_impl = 0;
 
 	pa_bits = vm_guest_mode_params[VM_MODE_DEFAULT].pa_bits;
 	max_phys_size = 1ULL << pa_bits;
@@ -706,17 +707,19 @@ int main(int ac, char **av)
 	if (!ret) {
 		pr_info("Running GIC_v3 tests.\n");
 		run_tests(KVM_DEV_TYPE_ARM_VGIC_V3);
-		return 0;
+		cnt_impl++;
 	}
 
 	ret = test_kvm_device(KVM_DEV_TYPE_ARM_VGIC_V2);
 	if (!ret) {
 		pr_info("Running GIC_v2 tests.\n");
 		run_tests(KVM_DEV_TYPE_ARM_VGIC_V2);
-		return 0;
+		cnt_impl++;
 	}
 
-	print_skip("No GICv2 nor GICv3 support");
-	exit(KSFT_SKIP);
+	if (!cnt_impl) {
+		print_skip("No GICv2 nor GICv3 support");
+		exit(KSFT_SKIP);
+	}
 	return 0;
 }
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH] KVM: arm64: selftests: Add support for GICv2 on v3
@ 2022-07-14 15:41 ` Marc Zyngier
  0 siblings, 0 replies; 9+ messages in thread
From: Marc Zyngier @ 2022-07-14 15:41 UTC (permalink / raw)
  To: kvmarm, kvm, linux-arm-kernel; +Cc: Oliver Upton

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 <maz@kernel.org>
---
 tools/testing/selftests/kvm/aarch64/vgic_init.c | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/tools/testing/selftests/kvm/aarch64/vgic_init.c b/tools/testing/selftests/kvm/aarch64/vgic_init.c
index 34379c98d2f4..21ba4002fc18 100644
--- a/tools/testing/selftests/kvm/aarch64/vgic_init.c
+++ b/tools/testing/selftests/kvm/aarch64/vgic_init.c
@@ -670,7 +670,7 @@ int test_kvm_device(uint32_t gic_dev_type)
 
 	if (!_kvm_create_device(v.vm, other, true, &fd)) {
 		ret = _kvm_create_device(v.vm, other, false, &fd);
-		TEST_ASSERT(ret && errno == EINVAL,
+		TEST_ASSERT(ret && (errno == EINVAL || errno == EEXIST),
 				"create GIC device while other version exists");
 	}
 
@@ -698,6 +698,7 @@ int main(int ac, char **av)
 {
 	int ret;
 	int pa_bits;
+	int cnt_impl = 0;
 
 	pa_bits = vm_guest_mode_params[VM_MODE_DEFAULT].pa_bits;
 	max_phys_size = 1ULL << pa_bits;
@@ -706,17 +707,19 @@ int main(int ac, char **av)
 	if (!ret) {
 		pr_info("Running GIC_v3 tests.\n");
 		run_tests(KVM_DEV_TYPE_ARM_VGIC_V3);
-		return 0;
+		cnt_impl++;
 	}
 
 	ret = test_kvm_device(KVM_DEV_TYPE_ARM_VGIC_V2);
 	if (!ret) {
 		pr_info("Running GIC_v2 tests.\n");
 		run_tests(KVM_DEV_TYPE_ARM_VGIC_V2);
-		return 0;
+		cnt_impl++;
 	}
 
-	print_skip("No GICv2 nor GICv3 support");
-	exit(KSFT_SKIP);
+	if (!cnt_impl) {
+		print_skip("No GICv2 nor GICv3 support");
+		exit(KSFT_SKIP);
+	}
 	return 0;
 }
-- 
2.34.1

_______________________________________________
kvmarm mailing list
kvmarm@lists.cs.columbia.edu
https://lists.cs.columbia.edu/mailman/listinfo/kvmarm

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH] KVM: arm64: selftests: Add support for GICv2 on v3
@ 2022-07-14 15:41 ` Marc Zyngier
  0 siblings, 0 replies; 9+ messages in thread
From: Marc Zyngier @ 2022-07-14 15:41 UTC (permalink / raw)
  To: kvmarm, kvm, linux-arm-kernel
  Cc: James Morse, Suzuki K Poulose, Alexandru Elisei, Oliver Upton,
	Ricardo Koller

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 <maz@kernel.org>
---
 tools/testing/selftests/kvm/aarch64/vgic_init.c | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/tools/testing/selftests/kvm/aarch64/vgic_init.c b/tools/testing/selftests/kvm/aarch64/vgic_init.c
index 34379c98d2f4..21ba4002fc18 100644
--- a/tools/testing/selftests/kvm/aarch64/vgic_init.c
+++ b/tools/testing/selftests/kvm/aarch64/vgic_init.c
@@ -670,7 +670,7 @@ int test_kvm_device(uint32_t gic_dev_type)
 
 	if (!_kvm_create_device(v.vm, other, true, &fd)) {
 		ret = _kvm_create_device(v.vm, other, false, &fd);
-		TEST_ASSERT(ret && errno == EINVAL,
+		TEST_ASSERT(ret && (errno == EINVAL || errno == EEXIST),
 				"create GIC device while other version exists");
 	}
 
@@ -698,6 +698,7 @@ int main(int ac, char **av)
 {
 	int ret;
 	int pa_bits;
+	int cnt_impl = 0;
 
 	pa_bits = vm_guest_mode_params[VM_MODE_DEFAULT].pa_bits;
 	max_phys_size = 1ULL << pa_bits;
@@ -706,17 +707,19 @@ int main(int ac, char **av)
 	if (!ret) {
 		pr_info("Running GIC_v3 tests.\n");
 		run_tests(KVM_DEV_TYPE_ARM_VGIC_V3);
-		return 0;
+		cnt_impl++;
 	}
 
 	ret = test_kvm_device(KVM_DEV_TYPE_ARM_VGIC_V2);
 	if (!ret) {
 		pr_info("Running GIC_v2 tests.\n");
 		run_tests(KVM_DEV_TYPE_ARM_VGIC_V2);
-		return 0;
+		cnt_impl++;
 	}
 
-	print_skip("No GICv2 nor GICv3 support");
-	exit(KSFT_SKIP);
+	if (!cnt_impl) {
+		print_skip("No GICv2 nor GICv3 support");
+		exit(KSFT_SKIP);
+	}
 	return 0;
 }
-- 
2.34.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH] KVM: arm64: selftests: Add support for GICv2 on v3
  2022-07-14 15:41 ` Marc Zyngier
  (?)
@ 2022-07-14 18:30   ` Ricardo Koller
  -1 siblings, 0 replies; 9+ messages in thread
From: Ricardo Koller @ 2022-07-14 18:30 UTC (permalink / raw)
  To: Marc Zyngier; +Cc: kvm, Oliver Upton, kvmarm, linux-arm-kernel

Hi Marc,

On Thu, Jul 14, 2022 at 04:41:08PM +0100, Marc Zyngier wrote:
> 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).

Thanks for the fix. This was my mistake (also I was taking too long to
send the fix).

> 
> Tweak the test to support multiple GIC incarnations.
> 

Nit. You could add a fixes tag:

Fixes: 3f4db37e203b ("KVM: arm64: selftests: Make vgic_init gic version agnostic")

> Signed-off-by: Marc Zyngier <maz@kernel.org>
> ---
>  tools/testing/selftests/kvm/aarch64/vgic_init.c | 13 ++++++++-----
>  1 file changed, 8 insertions(+), 5 deletions(-)
> 
> diff --git a/tools/testing/selftests/kvm/aarch64/vgic_init.c b/tools/testing/selftests/kvm/aarch64/vgic_init.c
> index 34379c98d2f4..21ba4002fc18 100644
> --- a/tools/testing/selftests/kvm/aarch64/vgic_init.c
> +++ b/tools/testing/selftests/kvm/aarch64/vgic_init.c
> @@ -670,7 +670,7 @@ int test_kvm_device(uint32_t gic_dev_type)
>  
>  	if (!_kvm_create_device(v.vm, other, true, &fd)) {
>  		ret = _kvm_create_device(v.vm, other, false, &fd);
> -		TEST_ASSERT(ret && errno == EINVAL,
> +		TEST_ASSERT(ret && (errno == EINVAL || errno == EEXIST),
>  				"create GIC device while other version exists");
>  	}
>  
> @@ -698,6 +698,7 @@ int main(int ac, char **av)
>  {
>  	int ret;
>  	int pa_bits;
> +	int cnt_impl = 0;
>  
>  	pa_bits = vm_guest_mode_params[VM_MODE_DEFAULT].pa_bits;
>  	max_phys_size = 1ULL << pa_bits;
> @@ -706,17 +707,19 @@ int main(int ac, char **av)
>  	if (!ret) {
>  		pr_info("Running GIC_v3 tests.\n");
>  		run_tests(KVM_DEV_TYPE_ARM_VGIC_V3);
> -		return 0;
> +		cnt_impl++;
>  	}
>  
>  	ret = test_kvm_device(KVM_DEV_TYPE_ARM_VGIC_V2);
>  	if (!ret) {
>  		pr_info("Running GIC_v2 tests.\n");
>  		run_tests(KVM_DEV_TYPE_ARM_VGIC_V2);
> -		return 0;
> +		cnt_impl++;
>  	}
>  
> -	print_skip("No GICv2 nor GICv3 support");
> -	exit(KSFT_SKIP);
> +	if (!cnt_impl) {
> +		print_skip("No GICv2 nor GICv3 support");
> +		exit(KSFT_SKIP);
> +	}
>  	return 0;
>  }
> -- 
> 2.34.1
>

Reviewed-by: Ricardo Koller <ricarkol@google.com>
_______________________________________________
kvmarm mailing list
kvmarm@lists.cs.columbia.edu
https://lists.cs.columbia.edu/mailman/listinfo/kvmarm

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] KVM: arm64: selftests: Add support for GICv2 on v3
@ 2022-07-14 18:30   ` Ricardo Koller
  0 siblings, 0 replies; 9+ messages in thread
From: Ricardo Koller @ 2022-07-14 18:30 UTC (permalink / raw)
  To: Marc Zyngier
  Cc: kvmarm, kvm, linux-arm-kernel, James Morse, Suzuki K Poulose,
	Alexandru Elisei, Oliver Upton

Hi Marc,

On Thu, Jul 14, 2022 at 04:41:08PM +0100, Marc Zyngier wrote:
> 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).

Thanks for the fix. This was my mistake (also I was taking too long to
send the fix).

> 
> Tweak the test to support multiple GIC incarnations.
> 

Nit. You could add a fixes tag:

Fixes: 3f4db37e203b ("KVM: arm64: selftests: Make vgic_init gic version agnostic")

> Signed-off-by: Marc Zyngier <maz@kernel.org>
> ---
>  tools/testing/selftests/kvm/aarch64/vgic_init.c | 13 ++++++++-----
>  1 file changed, 8 insertions(+), 5 deletions(-)
> 
> diff --git a/tools/testing/selftests/kvm/aarch64/vgic_init.c b/tools/testing/selftests/kvm/aarch64/vgic_init.c
> index 34379c98d2f4..21ba4002fc18 100644
> --- a/tools/testing/selftests/kvm/aarch64/vgic_init.c
> +++ b/tools/testing/selftests/kvm/aarch64/vgic_init.c
> @@ -670,7 +670,7 @@ int test_kvm_device(uint32_t gic_dev_type)
>  
>  	if (!_kvm_create_device(v.vm, other, true, &fd)) {
>  		ret = _kvm_create_device(v.vm, other, false, &fd);
> -		TEST_ASSERT(ret && errno == EINVAL,
> +		TEST_ASSERT(ret && (errno == EINVAL || errno == EEXIST),
>  				"create GIC device while other version exists");
>  	}
>  
> @@ -698,6 +698,7 @@ int main(int ac, char **av)
>  {
>  	int ret;
>  	int pa_bits;
> +	int cnt_impl = 0;
>  
>  	pa_bits = vm_guest_mode_params[VM_MODE_DEFAULT].pa_bits;
>  	max_phys_size = 1ULL << pa_bits;
> @@ -706,17 +707,19 @@ int main(int ac, char **av)
>  	if (!ret) {
>  		pr_info("Running GIC_v3 tests.\n");
>  		run_tests(KVM_DEV_TYPE_ARM_VGIC_V3);
> -		return 0;
> +		cnt_impl++;
>  	}
>  
>  	ret = test_kvm_device(KVM_DEV_TYPE_ARM_VGIC_V2);
>  	if (!ret) {
>  		pr_info("Running GIC_v2 tests.\n");
>  		run_tests(KVM_DEV_TYPE_ARM_VGIC_V2);
> -		return 0;
> +		cnt_impl++;
>  	}
>  
> -	print_skip("No GICv2 nor GICv3 support");
> -	exit(KSFT_SKIP);
> +	if (!cnt_impl) {
> +		print_skip("No GICv2 nor GICv3 support");
> +		exit(KSFT_SKIP);
> +	}
>  	return 0;
>  }
> -- 
> 2.34.1
>

Reviewed-by: Ricardo Koller <ricarkol@google.com>

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] KVM: arm64: selftests: Add support for GICv2 on v3
@ 2022-07-14 18:30   ` Ricardo Koller
  0 siblings, 0 replies; 9+ messages in thread
From: Ricardo Koller @ 2022-07-14 18:30 UTC (permalink / raw)
  To: Marc Zyngier
  Cc: kvmarm, kvm, linux-arm-kernel, James Morse, Suzuki K Poulose,
	Alexandru Elisei, Oliver Upton

Hi Marc,

On Thu, Jul 14, 2022 at 04:41:08PM +0100, Marc Zyngier wrote:
> 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).

Thanks for the fix. This was my mistake (also I was taking too long to
send the fix).

> 
> Tweak the test to support multiple GIC incarnations.
> 

Nit. You could add a fixes tag:

Fixes: 3f4db37e203b ("KVM: arm64: selftests: Make vgic_init gic version agnostic")

> Signed-off-by: Marc Zyngier <maz@kernel.org>
> ---
>  tools/testing/selftests/kvm/aarch64/vgic_init.c | 13 ++++++++-----
>  1 file changed, 8 insertions(+), 5 deletions(-)
> 
> diff --git a/tools/testing/selftests/kvm/aarch64/vgic_init.c b/tools/testing/selftests/kvm/aarch64/vgic_init.c
> index 34379c98d2f4..21ba4002fc18 100644
> --- a/tools/testing/selftests/kvm/aarch64/vgic_init.c
> +++ b/tools/testing/selftests/kvm/aarch64/vgic_init.c
> @@ -670,7 +670,7 @@ int test_kvm_device(uint32_t gic_dev_type)
>  
>  	if (!_kvm_create_device(v.vm, other, true, &fd)) {
>  		ret = _kvm_create_device(v.vm, other, false, &fd);
> -		TEST_ASSERT(ret && errno == EINVAL,
> +		TEST_ASSERT(ret && (errno == EINVAL || errno == EEXIST),
>  				"create GIC device while other version exists");
>  	}
>  
> @@ -698,6 +698,7 @@ int main(int ac, char **av)
>  {
>  	int ret;
>  	int pa_bits;
> +	int cnt_impl = 0;
>  
>  	pa_bits = vm_guest_mode_params[VM_MODE_DEFAULT].pa_bits;
>  	max_phys_size = 1ULL << pa_bits;
> @@ -706,17 +707,19 @@ int main(int ac, char **av)
>  	if (!ret) {
>  		pr_info("Running GIC_v3 tests.\n");
>  		run_tests(KVM_DEV_TYPE_ARM_VGIC_V3);
> -		return 0;
> +		cnt_impl++;
>  	}
>  
>  	ret = test_kvm_device(KVM_DEV_TYPE_ARM_VGIC_V2);
>  	if (!ret) {
>  		pr_info("Running GIC_v2 tests.\n");
>  		run_tests(KVM_DEV_TYPE_ARM_VGIC_V2);
> -		return 0;
> +		cnt_impl++;
>  	}
>  
> -	print_skip("No GICv2 nor GICv3 support");
> -	exit(KSFT_SKIP);
> +	if (!cnt_impl) {
> +		print_skip("No GICv2 nor GICv3 support");
> +		exit(KSFT_SKIP);
> +	}
>  	return 0;
>  }
> -- 
> 2.34.1
>

Reviewed-by: Ricardo Koller <ricarkol@google.com>

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] KVM: arm64: selftests: Add support for GICv2 on v3
  2022-07-14 15:41 ` Marc Zyngier
  (?)
@ 2022-07-15 10:06   ` Marc Zyngier
  -1 siblings, 0 replies; 9+ messages in thread
From: Marc Zyngier @ 2022-07-15 10:06 UTC (permalink / raw)
  To: Marc Zyngier, kvmarm, linux-arm-kernel, kvm; +Cc: Oliver Upton

On Thu, 14 Jul 2022 16:41:08 +0100, Marc Zyngier wrote:
> 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.

Applied to next, thanks!

[1/1] KVM: arm64: selftests: Add support for GICv2 on v3
      commit: 6a4f7fcd750497cb2fa870f799e8b23270bec6e3

Cheers,

	M.
-- 
Marc Zyngier <maz@kernel.org>

_______________________________________________
kvmarm mailing list
kvmarm@lists.cs.columbia.edu
https://lists.cs.columbia.edu/mailman/listinfo/kvmarm

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] KVM: arm64: selftests: Add support for GICv2 on v3
@ 2022-07-15 10:06   ` Marc Zyngier
  0 siblings, 0 replies; 9+ messages in thread
From: Marc Zyngier @ 2022-07-15 10:06 UTC (permalink / raw)
  To: Marc Zyngier, kvmarm, linux-arm-kernel, kvm
  Cc: James Morse, Suzuki K Poulose, Oliver Upton, Alexandru Elisei,
	Ricardo Koller

On Thu, 14 Jul 2022 16:41:08 +0100, Marc Zyngier wrote:
> 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.

Applied to next, thanks!

[1/1] KVM: arm64: selftests: Add support for GICv2 on v3
      commit: 6a4f7fcd750497cb2fa870f799e8b23270bec6e3

Cheers,

	M.
-- 
Marc Zyngier <maz@kernel.org>


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] KVM: arm64: selftests: Add support for GICv2 on v3
@ 2022-07-15 10:06   ` Marc Zyngier
  0 siblings, 0 replies; 9+ messages in thread
From: Marc Zyngier @ 2022-07-15 10:06 UTC (permalink / raw)
  To: Marc Zyngier, kvmarm, linux-arm-kernel, kvm
  Cc: James Morse, Suzuki K Poulose, Oliver Upton, Alexandru Elisei,
	Ricardo Koller

On Thu, 14 Jul 2022 16:41:08 +0100, Marc Zyngier wrote:
> 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.

Applied to next, thanks!

[1/1] KVM: arm64: selftests: Add support for GICv2 on v3
      commit: 6a4f7fcd750497cb2fa870f799e8b23270bec6e3

Cheers,

	M.
-- 
Marc Zyngier <maz@kernel.org>


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2022-07-15 10:08 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-14 15:41 [PATCH] KVM: arm64: selftests: Add support for GICv2 on v3 Marc Zyngier
2022-07-14 15:41 ` Marc Zyngier
2022-07-14 15:41 ` Marc Zyngier
2022-07-14 18:30 ` Ricardo Koller
2022-07-14 18:30   ` Ricardo Koller
2022-07-14 18:30   ` Ricardo Koller
2022-07-15 10:06 ` Marc Zyngier
2022-07-15 10:06   ` Marc Zyngier
2022-07-15 10:06   ` Marc Zyngier

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.