]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
KVM: arm64: selftests: vgic_irq: Remove LR-bound limitation
authorMarc Zyngier <maz@kernel.org>
Thu, 20 Nov 2025 17:25:35 +0000 (17:25 +0000)
committerOliver Upton <oupton@kernel.org>
Mon, 24 Nov 2025 22:29:15 +0000 (14:29 -0800)
Good news: our GIC emulation is not completely broken, and we can
activate as many interrupts as we want.

Bump the test to cover all the SGIs, all the allowed PPIs, and
31 SPIs. Yes, 31, because we have 31 available priorities, and the
test is not happy with having two interrupts with the same priority.

Tested-by: Fuad Tabba <tabba@google.com>
Signed-off-by: Marc Zyngier <maz@kernel.org>
Tested-by: Mark Brown <broonie@kernel.org>
Link: https://msgid.link/20251120172540.2267180-46-maz@kernel.org
Signed-off-by: Oliver Upton <oupton@kernel.org>
tools/testing/selftests/kvm/arm64/vgic_irq.c

index b0415bdb89524f5b8186d7c16c8587042256a0de..9d4761f1a3204938fa70af1d56c250acc86f53af 100644 (file)
@@ -449,12 +449,6 @@ static void test_injection_failure(struct test_args *args,
 
 static void test_preemption(struct test_args *args, struct kvm_inject_desc *f)
 {
-       /*
-        * Test up to 4 levels of preemption. The reason is that KVM doesn't
-        * currently implement the ability to have more than the number-of-LRs
-        * number of concurrently active IRQs. The number of LRs implemented is
-        * IMPLEMENTATION DEFINED, however, it seems that most implement 4.
-        */
        /* Timer PPIs cannot be injected from userspace */
        static const unsigned long ppi_exclude = (BIT(27 - MIN_PPI) |
                                                  BIT(30 - MIN_PPI) |
@@ -462,26 +456,25 @@ static void test_preemption(struct test_args *args, struct kvm_inject_desc *f)
                                                  BIT(26 - MIN_PPI));
 
        if (f->sgi)
-               test_inject_preemption(args, MIN_SGI, 4, NULL, f->cmd);
+               test_inject_preemption(args, MIN_SGI, 16, NULL, f->cmd);
 
        if (f->ppi)
-               test_inject_preemption(args, MIN_PPI, 4, &ppi_exclude, f->cmd);
+               test_inject_preemption(args, MIN_PPI, 16, &ppi_exclude, f->cmd);
 
        if (f->spi)
-               test_inject_preemption(args, MIN_SPI, 4, NULL, f->cmd);
+               test_inject_preemption(args, MIN_SPI, 31, NULL, f->cmd);
 }
 
 static void test_restore_active(struct test_args *args, struct kvm_inject_desc *f)
 {
-       /* Test up to 4 active IRQs. Same reason as in test_preemption. */
        if (f->sgi)
-               guest_restore_active(args, MIN_SGI, 4, f->cmd);
+               guest_restore_active(args, MIN_SGI, 16, f->cmd);
 
        if (f->ppi)
-               guest_restore_active(args, MIN_PPI, 4, f->cmd);
+               guest_restore_active(args, MIN_PPI, 16, f->cmd);
 
        if (f->spi)
-               guest_restore_active(args, MIN_SPI, 4, f->cmd);
+               guest_restore_active(args, MIN_SPI, 31, f->cmd);
 }
 
 static void guest_code(struct test_args *args)