]> www.infradead.org Git - users/jedix/linux-maple.git/commit
misc: pci_endpoint_test: Add support for PCITEST_IRQ_TYPE_AUTO
authorNiklas Cassel <cassel@kernel.org>
Mon, 10 Mar 2025 11:10:24 +0000 (12:10 +0100)
committerKrzysztof Wilczyński <kwilczynski@kernel.org>
Wed, 26 Mar 2025 06:11:54 +0000 (06:11 +0000)
commit08818c6d7f276eb5895959f34c491a3911ae7820
tree1d4cb402967b0ca8fc32d50e91afef04532876d4
parent7c3b54cf6464b4d6ba5440ae5bb44552f099a078
misc: pci_endpoint_test: Add support for PCITEST_IRQ_TYPE_AUTO

For PCITEST_MSI we really want to set PCITEST_SET_IRQTYPE explicitly
to PCITEST_IRQ_TYPE_MSI, since we want to test if MSI works.

For PCITEST_MSIX we really want to set PCITEST_SET_IRQTYPE explicitly
to PCITEST_IRQ_TYPE_MSIX, since we want to test if MSI works.

For PCITEST_LEGACY_IRQ we really want to set PCITEST_SET_IRQTYPE
explicitly to PCITEST_IRQ_TYPE_INTX, since we want to test if INTx
works.

However, for PCITEST_WRITE, PCITEST_READ, PCITEST_COPY, we really don't
care which IRQ type that is used, we just want to use a IRQ type that is
supported by the EPC.

The old behavior was to always use MSI for PCITEST_WRITE, PCITEST_READ,
PCITEST_COPY, was to always set IRQ type to MSI before doing the actual
test, however, there are EPC drivers that do not support MSI.

Add a new PCITEST_IRQ_TYPE_AUTO, that will use the CAPS register to see
which IRQ types the endpoint supports, and use one of the supported IRQ
types.

For backwards compatibility, if the endpoint does not expose any supported
IRQ type in the CAPS register, simply fallback to using MSI, as it was
unconditionally done before.

Signed-off-by: Niklas Cassel <cassel@kernel.org>
Signed-off-by: Krzysztof Wilczyński <kwilczynski@kernel.org>
Link: https://lore.kernel.org/r/20250310111016.859445-16-cassel@kernel.org
drivers/misc/pci_endpoint_test.c
include/uapi/linux/pcitest.h
tools/testing/selftests/pci_endpoint/pci_endpoint_test.c