Re: [PATCH v4 02/19] KVM: selftests: Add /proc/interrupts parsing helpers for IRQ test
From: Sean Christopherson
Date: Mon Jun 01 2026 - 15:23:42 EST
On Sat, May 30, 2026, Josh Hilke wrote:
> index 000000000000..7c465e8584e2
> --- /dev/null
> +++ b/tools/testing/selftests/kvm/include/proc_util.h
> @@ -0,0 +1,9 @@
> +/* SPDX-License-Identifier: GPL-2.0-only */
> +#ifndef SELFTEST_KVM_PROC_UTIL_H
> +#define SELFTEST_KVM_PROC_UTIL_H
> +
> +#include <stdint.h>
> +
> +int get_proc_vfio_irq_number(const char *vfio_device_bdf, int msi);
I feel like the "proc" is confusing and unintesting. How the utility gets the
information is an implementation detail that I don't think the caller particular
cares about.
"irq_number" is also vague. There are myriad IRQ "numbers" in play. "virtual
IRQ", as they're sometimes described by the IRQ subsystem, is unfortunately
terrible terminology for KVM+VFIO. host_irq and linux_irq are the two names I
can think of that are fairly specific without too much potential for confusion.
I'd probably vote for host_irq?
I also think the function needs to have msix in the name, because within VFIO,
there are multiple flavors of interrupts that can be wired up, and this _only_
works for MSI-X. And The param should be @msix.
I also think it might make sense to return an "unsigned int", to communicate that
it guarantees a valid IRQ was found, but I don't care terribly either way.
Maybe something like this?
unsigned int vfio_msix_to_host_irq(const char *vfio_device_bdf, int msix)
or
unsigned int vfio_get_msix_host_irq(const char *vfio_device_bdf, int msix)
or
unsigned int vfio_get_host_irq_for_msix(const char *vfio_device_bdf, int msix)
I'd probably vote for the first one, vfio_msix_to_host_irq(), as it's more
obviously "just" a translation helper, e.g. isn't allocating an IRQ or anything.