diff mbox series

[1/4] Revert "misc: pci_endpoint_test: Add support for PCITEST_IRQ_TYPE_AUTO"

Message ID 20250318103330.1840678-7-cassel@kernel.org (mailing list archive)
State Not Applicable
Delegated to: Krzysztof WilczyƄski
Headers show
Series pci_endpoint_test: Let PCITEST_{READ,WRITE,COPY} set IRQ type automatically | expand

Commit Message

Niklas Cassel March 18, 2025, 10:33 a.m. UTC
This reverts commit c4aaa6b5b5ac14ea9b0abf1e0f4bf24c332a9b34.

The PCI endpoint maintainer did not like PCITEST_IRQ_TYPE_AUTO,
so let's remove this IRQ type and rework the implementation.

Signed-off-by: Niklas Cassel <cassel@kernel.org>
---
Hello PCI maintainers,
feel free to squash / drop the original commit from the branch.

 drivers/misc/pci_endpoint_test.c              | 25 ++++---------------
 include/uapi/linux/pcitest.h                  |  1 -
 .../pci_endpoint/pci_endpoint_test.c          | 12 ++++-----
 3 files changed, 11 insertions(+), 27 deletions(-)
diff mbox series

Patch

diff --git a/drivers/misc/pci_endpoint_test.c b/drivers/misc/pci_endpoint_test.c
index d294850a35a12..849d730ba14dd 100644
--- a/drivers/misc/pci_endpoint_test.c
+++ b/drivers/misc/pci_endpoint_test.c
@@ -66,9 +66,6 @@ 
 
 #define PCI_ENDPOINT_TEST_CAPS			0x30
 #define CAP_UNALIGNED_ACCESS			BIT(0)
-#define CAP_MSI					BIT(1)
-#define CAP_MSIX				BIT(2)
-#define CAP_INTX				BIT(3)
 
 #define PCI_DEVICE_ID_TI_AM654			0xb00c
 #define PCI_DEVICE_ID_TI_J7200			0xb00f
@@ -115,7 +112,6 @@  struct pci_endpoint_test {
 	struct miscdevice miscdev;
 	enum pci_barno test_reg_bar;
 	size_t alignment;
-	u32 ep_caps;
 	const char *name;
 };
 
@@ -806,23 +802,11 @@  static int pci_endpoint_test_set_irq(struct pci_endpoint_test *test,
 	int ret;
 
 	if (req_irq_type < PCITEST_IRQ_TYPE_INTX ||
-	    req_irq_type > PCITEST_IRQ_TYPE_AUTO) {
+	    req_irq_type > PCITEST_IRQ_TYPE_MSIX) {
 		dev_err(dev, "Invalid IRQ type option\n");
 		return -EINVAL;
 	}
 
-	if (req_irq_type == PCITEST_IRQ_TYPE_AUTO) {
-		if (test->ep_caps & CAP_MSI)
-			req_irq_type = PCITEST_IRQ_TYPE_MSI;
-		else if (test->ep_caps & CAP_MSIX)
-			req_irq_type = PCITEST_IRQ_TYPE_MSIX;
-		else if (test->ep_caps & CAP_INTX)
-			req_irq_type = PCITEST_IRQ_TYPE_INTX;
-		else
-			/* fallback to MSI if no caps defined */
-			req_irq_type = PCITEST_IRQ_TYPE_MSI;
-	}
-
 	if (test->irq_type == req_irq_type)
 		return 0;
 
@@ -908,12 +892,13 @@  static void pci_endpoint_test_get_capabilities(struct pci_endpoint_test *test)
 {
 	struct pci_dev *pdev = test->pdev;
 	struct device *dev = &pdev->dev;
+	u32 caps;
 
-	test->ep_caps = pci_endpoint_test_readl(test, PCI_ENDPOINT_TEST_CAPS);
-	dev_dbg(dev, "PCI_ENDPOINT_TEST_CAPS: %#x\n", test->ep_caps);
+	caps = pci_endpoint_test_readl(test, PCI_ENDPOINT_TEST_CAPS);
+	dev_dbg(dev, "PCI_ENDPOINT_TEST_CAPS: %#x\n", caps);
 
 	/* CAP_UNALIGNED_ACCESS is set if the EP can do unaligned access */
-	if (test->ep_caps & CAP_UNALIGNED_ACCESS)
+	if (caps & CAP_UNALIGNED_ACCESS)
 		test->alignment = 0;
 }
 
diff --git a/include/uapi/linux/pcitest.h b/include/uapi/linux/pcitest.h
index d3aa8715a525e..304bf9be0f9a0 100644
--- a/include/uapi/linux/pcitest.h
+++ b/include/uapi/linux/pcitest.h
@@ -27,7 +27,6 @@ 
 #define PCITEST_IRQ_TYPE_INTX		0
 #define PCITEST_IRQ_TYPE_MSI		1
 #define PCITEST_IRQ_TYPE_MSIX		2
-#define PCITEST_IRQ_TYPE_AUTO		3
 
 #define PCITEST_FLAGS_USE_DMA	0x00000001
 
diff --git a/tools/testing/selftests/pci_endpoint/pci_endpoint_test.c b/tools/testing/selftests/pci_endpoint/pci_endpoint_test.c
index ac26481d29d9d..fdf4bc6aa9d2a 100644
--- a/tools/testing/selftests/pci_endpoint/pci_endpoint_test.c
+++ b/tools/testing/selftests/pci_endpoint/pci_endpoint_test.c
@@ -181,8 +181,8 @@  TEST_F(pci_ep_data_transfer, READ_TEST)
 	if (variant->use_dma)
 		param.flags = PCITEST_FLAGS_USE_DMA;
 
-	pci_ep_ioctl(PCITEST_SET_IRQTYPE, PCITEST_IRQ_TYPE_AUTO);
-	ASSERT_EQ(0, ret) TH_LOG("Can't set AUTO IRQ type");
+	pci_ep_ioctl(PCITEST_SET_IRQTYPE, PCITEST_IRQ_TYPE_MSI);
+	ASSERT_EQ(0, ret) TH_LOG("Can't set MSI IRQ type");
 
 	for (i = 0; i < ARRAY_SIZE(test_size); i++) {
 		param.size = test_size[i];
@@ -200,8 +200,8 @@  TEST_F(pci_ep_data_transfer, WRITE_TEST)
 	if (variant->use_dma)
 		param.flags = PCITEST_FLAGS_USE_DMA;
 
-	pci_ep_ioctl(PCITEST_SET_IRQTYPE, PCITEST_IRQ_TYPE_AUTO);
-	ASSERT_EQ(0, ret) TH_LOG("Can't set AUTO IRQ type");
+	pci_ep_ioctl(PCITEST_SET_IRQTYPE, PCITEST_IRQ_TYPE_MSI);
+	ASSERT_EQ(0, ret) TH_LOG("Can't set MSI IRQ type");
 
 	for (i = 0; i < ARRAY_SIZE(test_size); i++) {
 		param.size = test_size[i];
@@ -219,8 +219,8 @@  TEST_F(pci_ep_data_transfer, COPY_TEST)
 	if (variant->use_dma)
 		param.flags = PCITEST_FLAGS_USE_DMA;
 
-	pci_ep_ioctl(PCITEST_SET_IRQTYPE, PCITEST_IRQ_TYPE_AUTO);
-	ASSERT_EQ(0, ret) TH_LOG("Can't set AUTO IRQ type");
+	pci_ep_ioctl(PCITEST_SET_IRQTYPE, PCITEST_IRQ_TYPE_MSI);
+	ASSERT_EQ(0, ret) TH_LOG("Can't set MSI IRQ type");
 
 	for (i = 0; i < ARRAY_SIZE(test_size); i++) {
 		param.size = test_size[i];