KVM: selftests: Make number of IRQs configurable in IRQ test

Extend the eventfd IRQ test with a '-i' flag to let the user specify the
the number of IRQs to generate (instead of hardcoding the test to always
generate 1000 interrupts).

Signed-off-by: David Matlack <dmatlack@google.com>
Co-developed-by: Josh Hilke <jrhilke@google.com>
Signed-off-by: Josh Hilke <jrhilke@google.com>
[sean: massage changelog]
Link: https://patch.msgid.link/20260626213534.3866178-14-seanjc@google.com
Signed-off-by: Sean Christopherson <seanjc@google.com>
This commit is contained in:
David Matlack 2026-06-26 14:35:26 -07:00 committed by Sean Christopherson
parent ec333e3ace
commit 38950af64a

View File

@ -146,12 +146,13 @@ static const char *probe_iommu_type(void)
static void help(const char *name)
{
printf("Usage: %s [-a] [-d <segment:bus:device.function>] [-e] [-h] [-t iommu_type]\n", name);
printf("Usage: %s [-a] [-d <segment:bus:device.function>] [-e] [-h] [-i nr_irqs] [-t iommu_type]\n", name);
printf("\n");
printf("Tests KVM interrupt routing and delivery via irqfd.\n");
printf("-a Affine the device's host IRQ to a random physical CPU\n");
printf("-d Use a VFIO device to send MSI-X interrupts instead of manually signaling the eventfd\n");
printf("-e Set empty GSI routing in-between some interrupts\n");
printf("-i The number of IRQs to generate during the test\n");
printf("-t Override the IOMMU type to use (vfio_type1_iommu or iommufd)\n");
printf("\n");
exit(KSFT_FAIL);
@ -186,7 +187,7 @@ int main(int argc, char **argv)
struct kvm_vm *vm;
int irq, irq_cpu;
while ((c = getopt(argc, argv, "ad:eht:")) != -1) {
while ((c = getopt(argc, argv, "ad:ehi:t:")) != -1) {
switch (c) {
case 'a':
irq_affinity = true;
@ -197,6 +198,9 @@ int main(int argc, char **argv)
case 'e':
set_empty_routing = true;
break;
case 'i':
nr_irqs = atoi_positive("Number of IRQs", optarg);
break;
case 't':
iommu_type = optarg;
break;