Commit fd5fa1c8 authored by Marc Zyngier's avatar Marc Zyngier Committed by Oliver Upton
Browse files

KVM: arm64: selftests: vgic_irq: Remove LR-bound limitation



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: default avatarFuad Tabba <tabba@google.com>
Signed-off-by: default avatarMarc Zyngier <maz@kernel.org>
Tested-by: default avatarMark Brown <broonie@kernel.org>
Link: https://msgid.link/20251120172540.2267180-46-maz@kernel.org


Signed-off-by: default avatarOliver Upton <oupton@kernel.org>
parent 5053c2ab
Loading
Loading
Loading
Loading
+6 −13
Original line number Diff line number Diff line
@@ -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)