linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/7] Improvements to pci_endpoint_test driver
@ 2019-12-30 12:33 Kishon Vijay Abraham I
  2019-12-30 12:33 ` [PATCH 1/7] misc: pci_endpoint_test: Avoid using module parameter to determine irqtype Kishon Vijay Abraham I
                   ` (6 more replies)
  0 siblings, 7 replies; 12+ messages in thread
From: Kishon Vijay Abraham I @ 2019-12-30 12:33 UTC (permalink / raw)
  To: Kishon Vijay Abraham I, Lorenzo Pieralisi, Arnd Bergmann
  Cc: Greg Kroah-Hartman, Bjorn Helgaas, linux-pci, linux-kernel

This series adds improvements and fixes to pci_endpoint_test driver
mostly applicable when used with multi-function endpoint (or multiple
endpoint instances using pci_epf_test).

*) Using module parameter to determine irqtype would indicate all the
   pci_endpoint_test device have the same irqtype. Fix it here.
*) Add ioctl to clear irq so that "cat /proc/interrupts" only lists
   the entries for the devices that is actually being used.
*) Creating more than 10 pci-endpoint-test devices results in a kernel
   error.
*) Use full pci-endpoint-test name in request irq so that it's easy to
   profile the interrupt details in "cat /proc/interrupts"
*) Always enable legacy interrupt.

Kishon Vijay Abraham I (7):
  misc: pci_endpoint_test: Avoid using module parameter to determine
    irqtype
  misc: pci_endpoint_test: Do not request or allocate IRQs in probe
  misc: pci_endpoint_test: Add ioctl to clear IRQ
  tools: PCI: Add 'e' to clear IRQ
  misc: pci_endpoint_test: Fix to support > 10 pci-endpoint-test devices
  misc: pci_endpoint_test: Use full pci-endpoint-test name in request
    irq
  misc: pci_endpoint_test: Enable legacy interrupt

 drivers/misc/pci_endpoint_test.c | 43 +++++++++++++++++++++++++-------
 include/uapi/linux/pcitest.h     |  1 +
 tools/pci/pcitest.c              | 16 +++++++++++-
 3 files changed, 50 insertions(+), 10 deletions(-)

-- 
2.17.1


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH 1/7] misc: pci_endpoint_test: Avoid using module parameter to determine irqtype
  2019-12-30 12:33 [PATCH 0/7] Improvements to pci_endpoint_test driver Kishon Vijay Abraham I
@ 2019-12-30 12:33 ` Kishon Vijay Abraham I
  2019-12-30 12:33 ` [PATCH 2/7] misc: pci_endpoint_test: Do not request or allocate IRQs in probe Kishon Vijay Abraham I
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 12+ messages in thread
From: Kishon Vijay Abraham I @ 2019-12-30 12:33 UTC (permalink / raw)
  To: Kishon Vijay Abraham I, Lorenzo Pieralisi, Arnd Bergmann
  Cc: Greg Kroah-Hartman, Bjorn Helgaas, linux-pci, linux-kernel

commit e03327122e2c8e6ae4565ef ("pci_endpoint_test: Add 2 ioctl
commands") uses module parameter in pci_endpoint_test_set_irq()
'irqtype' to check if irq vectors of a particular type is already
allocated. However with multi-function devices, irqtype will not
correctly reflect the irq type of the PCI device. Fix it here by
adding 'irqtype' for each PCI device to show the irq type of a
particular PCI device.

Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
---
 drivers/misc/pci_endpoint_test.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/drivers/misc/pci_endpoint_test.c b/drivers/misc/pci_endpoint_test.c
index 215f9b8432a3..743ff4dcb3f0 100644
--- a/drivers/misc/pci_endpoint_test.c
+++ b/drivers/misc/pci_endpoint_test.c
@@ -99,6 +99,7 @@ struct pci_endpoint_test {
 	struct completion irq_raised;
 	int		last_irq;
 	int		num_irqs;
+	int		irq_type;
 	/* mutex to protect the ioctls */
 	struct mutex	mutex;
 	struct miscdevice miscdev;
@@ -158,6 +159,7 @@ static void pci_endpoint_test_free_irq_vectors(struct pci_endpoint_test *test)
 	struct pci_dev *pdev = test->pdev;
 
 	pci_free_irq_vectors(pdev);
+	test->irq_type = IRQ_TYPE_UNDEFINED;
 }
 
 static bool pci_endpoint_test_alloc_irq_vectors(struct pci_endpoint_test *test,
@@ -192,6 +194,8 @@ static bool pci_endpoint_test_alloc_irq_vectors(struct pci_endpoint_test *test,
 		irq = 0;
 		res = false;
 	}
+
+	test->irq_type = type;
 	test->num_irqs = irq;
 
 	return res;
@@ -331,6 +335,7 @@ static bool pci_endpoint_test_copy(struct pci_endpoint_test *test, size_t size)
 	dma_addr_t orig_dst_phys_addr;
 	size_t offset;
 	size_t alignment = test->alignment;
+	int irq_type = test->irq_type;
 	u32 src_crc32;
 	u32 dst_crc32;
 
@@ -427,6 +432,7 @@ static bool pci_endpoint_test_write(struct pci_endpoint_test *test, size_t size)
 	dma_addr_t orig_phys_addr;
 	size_t offset;
 	size_t alignment = test->alignment;
+	int irq_type = test->irq_type;
 	u32 crc32;
 
 	if (size > SIZE_MAX - alignment)
@@ -495,6 +501,7 @@ static bool pci_endpoint_test_read(struct pci_endpoint_test *test, size_t size)
 	dma_addr_t orig_phys_addr;
 	size_t offset;
 	size_t alignment = test->alignment;
+	int irq_type = test->irq_type;
 	u32 crc32;
 
 	if (size > SIZE_MAX - alignment)
@@ -556,7 +563,7 @@ static bool pci_endpoint_test_set_irq(struct pci_endpoint_test *test,
 		return false;
 	}
 
-	if (irq_type == req_irq_type)
+	if (test->irq_type == req_irq_type)
 		return true;
 
 	pci_endpoint_test_release_irq(test);
@@ -568,12 +575,10 @@ static bool pci_endpoint_test_set_irq(struct pci_endpoint_test *test,
 	if (!pci_endpoint_test_request_irq(test))
 		goto err;
 
-	irq_type = req_irq_type;
 	return true;
 
 err:
 	pci_endpoint_test_free_irq_vectors(test);
-	irq_type = IRQ_TYPE_UNDEFINED;
 	return false;
 }
 
@@ -653,6 +658,7 @@ static int pci_endpoint_test_probe(struct pci_dev *pdev,
 	test->test_reg_bar = 0;
 	test->alignment = 0;
 	test->pdev = pdev;
+	test->irq_type = IRQ_TYPE_UNDEFINED;
 
 	if (no_msi)
 		irq_type = IRQ_TYPE_LEGACY;
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH 2/7] misc: pci_endpoint_test: Do not request or allocate IRQs in probe
  2019-12-30 12:33 [PATCH 0/7] Improvements to pci_endpoint_test driver Kishon Vijay Abraham I
  2019-12-30 12:33 ` [PATCH 1/7] misc: pci_endpoint_test: Avoid using module parameter to determine irqtype Kishon Vijay Abraham I
@ 2019-12-30 12:33 ` Kishon Vijay Abraham I
  2019-12-30 15:07   ` kbuild test robot
  2019-12-30 17:10   ` kbuild test robot
  2019-12-30 12:33 ` [PATCH 3/7] misc: pci_endpoint_test: Add ioctl to clear IRQ Kishon Vijay Abraham I
                   ` (4 subsequent siblings)
  6 siblings, 2 replies; 12+ messages in thread
From: Kishon Vijay Abraham I @ 2019-12-30 12:33 UTC (permalink / raw)
  To: Kishon Vijay Abraham I, Lorenzo Pieralisi, Arnd Bergmann
  Cc: Greg Kroah-Hartman, Bjorn Helgaas, linux-pci, linux-kernel

Allocation of IRQ vectors and requesting IRQ is done as part of
PCITEST_SET_IRQTYPE. Do not request or allocate IRQs in probe for
AM654 and J721E so that the user space test script has better control
of the devices for which the IRQs are configured.

Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
---
 drivers/misc/pci_endpoint_test.c | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/drivers/misc/pci_endpoint_test.c b/drivers/misc/pci_endpoint_test.c
index 743ff4dcb3f0..04505890eae9 100644
--- a/drivers/misc/pci_endpoint_test.c
+++ b/drivers/misc/pci_endpoint_test.c
@@ -70,6 +70,9 @@
 #define is_am654_pci_dev(pdev)		\
 		((pdev)->device == PCI_DEVICE_ID_TI_AM654)
 
+#define is_j721e_pci_dev(pdev)         \
+		((pdev)->device == PCI_DEVICE_ID_TI_J721E)
+
 static DEFINE_IDA(pci_endpoint_test_ida);
 
 #define to_endpoint_test(priv) container_of((priv), struct pci_endpoint_test, \
@@ -688,11 +691,13 @@ static int pci_endpoint_test_probe(struct pci_dev *pdev,
 
 	pci_set_master(pdev);
 
-	if (!pci_endpoint_test_alloc_irq_vectors(test, irq_type))
-		goto err_disable_irq;
+	if (!(is_am654_pci_dev(pdev) || is_j721e_pci_dev(pdev))) {
+		if (!pci_endpoint_test_alloc_irq_vectors(test, irq_type))
+			goto err_disable_irq;
 
-	if (!pci_endpoint_test_request_irq(test))
-		goto err_disable_irq;
+		if (!pci_endpoint_test_request_irq(test))
+			goto err_disable_irq;
+	}
 
 	for (bar = 0; bar < PCI_STD_NUM_BARS; bar++) {
 		if (pci_resource_flags(pdev, bar) & IORESOURCE_MEM) {
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH 3/7] misc: pci_endpoint_test: Add ioctl to clear IRQ
  2019-12-30 12:33 [PATCH 0/7] Improvements to pci_endpoint_test driver Kishon Vijay Abraham I
  2019-12-30 12:33 ` [PATCH 1/7] misc: pci_endpoint_test: Avoid using module parameter to determine irqtype Kishon Vijay Abraham I
  2019-12-30 12:33 ` [PATCH 2/7] misc: pci_endpoint_test: Do not request or allocate IRQs in probe Kishon Vijay Abraham I
@ 2019-12-30 12:33 ` Kishon Vijay Abraham I
  2019-12-30 12:33 ` [PATCH 4/7] tools: PCI: Add 'e' " Kishon Vijay Abraham I
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 12+ messages in thread
From: Kishon Vijay Abraham I @ 2019-12-30 12:33 UTC (permalink / raw)
  To: Kishon Vijay Abraham I, Lorenzo Pieralisi, Arnd Bergmann
  Cc: Greg Kroah-Hartman, Bjorn Helgaas, linux-pci, linux-kernel

Add ioctl to clear IRQ which can be used to free the allocated
IRQ vectors and free the requested IRQ.

Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
---
 drivers/misc/pci_endpoint_test.c | 10 ++++++++++
 include/uapi/linux/pcitest.h     |  1 +
 2 files changed, 11 insertions(+)

diff --git a/drivers/misc/pci_endpoint_test.c b/drivers/misc/pci_endpoint_test.c
index 04505890eae9..861b3d0cea19 100644
--- a/drivers/misc/pci_endpoint_test.c
+++ b/drivers/misc/pci_endpoint_test.c
@@ -555,6 +555,13 @@ static bool pci_endpoint_test_read(struct pci_endpoint_test *test, size_t size)
 	return ret;
 }
 
+static bool pci_endpoint_test_clear_irq(struct pci_endpoint_test *test)
+{
+	pci_endpoint_test_release_irq(test);
+	pci_endpoint_test_free_irq_vectors(test);
+	return true;
+}
+
 static bool pci_endpoint_test_set_irq(struct pci_endpoint_test *test,
 				      int req_irq_type)
 {
@@ -625,6 +632,9 @@ static long pci_endpoint_test_ioctl(struct file *file, unsigned int cmd,
 	case PCITEST_GET_IRQTYPE:
 		ret = irq_type;
 		break;
+	case PCITEST_CLEAR_IRQ:
+		ret = pci_endpoint_test_clear_irq(test);
+		break;
 	}
 
 ret:
diff --git a/include/uapi/linux/pcitest.h b/include/uapi/linux/pcitest.h
index cbf422e56696..c6d3076fa732 100644
--- a/include/uapi/linux/pcitest.h
+++ b/include/uapi/linux/pcitest.h
@@ -19,5 +19,6 @@
 #define PCITEST_MSIX		_IOW('P', 0x7, int)
 #define PCITEST_SET_IRQTYPE	_IOW('P', 0x8, int)
 #define PCITEST_GET_IRQTYPE	_IO('P', 0x9)
+#define PCITEST_CLEAR_IRQ	_IO('P', 0x10)
 
 #endif /* __UAPI_LINUX_PCITEST_H */
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH 4/7] tools: PCI: Add 'e' to clear IRQ
  2019-12-30 12:33 [PATCH 0/7] Improvements to pci_endpoint_test driver Kishon Vijay Abraham I
                   ` (2 preceding siblings ...)
  2019-12-30 12:33 ` [PATCH 3/7] misc: pci_endpoint_test: Add ioctl to clear IRQ Kishon Vijay Abraham I
@ 2019-12-30 12:33 ` Kishon Vijay Abraham I
  2019-12-30 12:33 ` [PATCH 5/7] misc: pci_endpoint_test: Fix to support > 10 pci-endpoint-test devices Kishon Vijay Abraham I
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 12+ messages in thread
From: Kishon Vijay Abraham I @ 2019-12-30 12:33 UTC (permalink / raw)
  To: Kishon Vijay Abraham I, Lorenzo Pieralisi, Arnd Bergmann
  Cc: Greg Kroah-Hartman, Bjorn Helgaas, linux-pci, linux-kernel

Add a new command line option 'e' to invoke "PCITEST_CLEAR_IRQ"
ioctl. This can be used to clear the irqs set using the 'i' option.

Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
---
 tools/pci/pcitest.c | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/tools/pci/pcitest.c b/tools/pci/pcitest.c
index 32b7c6f9043d..449c2c687797 100644
--- a/tools/pci/pcitest.c
+++ b/tools/pci/pcitest.c
@@ -30,6 +30,7 @@ struct pci_test {
 	int		irqtype;
 	bool		set_irqtype;
 	bool		get_irqtype;
+	bool		clear_irq;
 	bool		read;
 	bool		write;
 	bool		copy;
@@ -74,6 +75,15 @@ static int run_test(struct pci_test *test)
 			fprintf(stdout, "%s\n", irq[ret]);
 	}
 
+	if (test->clear_irq) {
+		ret = ioctl(fd, PCITEST_CLEAR_IRQ);
+		fprintf(stdout, "CLEAR IRQ:\t\t");
+		if (ret < 0)
+			fprintf(stdout, "FAILED\n");
+		else
+			fprintf(stdout, "%s\n", result[ret]);
+	}
+
 	if (test->legacyirq) {
 		ret = ioctl(fd, PCITEST_LEGACY_IRQ, 0);
 		fprintf(stdout, "LEGACY IRQ:\t");
@@ -153,7 +163,7 @@ int main(int argc, char **argv)
 	/* set default endpoint device */
 	test->device = "/dev/pci-endpoint-test.0";
 
-	while ((c = getopt(argc, argv, "D:b:m:x:i:Ilhrwcs:")) != EOF)
+	while ((c = getopt(argc, argv, "D:b:m:x:i:eIlhrwcs:")) != EOF)
 	switch (c) {
 	case 'D':
 		test->device = optarg;
@@ -194,6 +204,9 @@ int main(int argc, char **argv)
 	case 'c':
 		test->copy = true;
 		continue;
+	case 'e':
+		test->clear_irq = true;
+		continue;
 	case 's':
 		test->size = strtoul(optarg, NULL, 0);
 		continue;
@@ -208,6 +221,7 @@ int main(int argc, char **argv)
 			"\t-m <msi num>		MSI test (msi number between 1..32)\n"
 			"\t-x <msix num>	\tMSI-X test (msix number between 1..2048)\n"
 			"\t-i <irq type>	\tSet IRQ type (0 - Legacy, 1 - MSI, 2 - MSI-X)\n"
+			"\t-e			Clear IRQ\n"
 			"\t-I			Get current IRQ type configured\n"
 			"\t-l			Legacy IRQ test\n"
 			"\t-r			Read buffer test\n"
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH 5/7] misc: pci_endpoint_test: Fix to support > 10 pci-endpoint-test devices
  2019-12-30 12:33 [PATCH 0/7] Improvements to pci_endpoint_test driver Kishon Vijay Abraham I
                   ` (3 preceding siblings ...)
  2019-12-30 12:33 ` [PATCH 4/7] tools: PCI: Add 'e' " Kishon Vijay Abraham I
@ 2019-12-30 12:33 ` Kishon Vijay Abraham I
  2019-12-30 12:33 ` [PATCH 6/7] misc: pci_endpoint_test: Use full pci-endpoint-test name in request irq Kishon Vijay Abraham I
  2019-12-30 12:33 ` [PATCH 7/7] misc: pci_endpoint_test: Enable legacy interrupt Kishon Vijay Abraham I
  6 siblings, 0 replies; 12+ messages in thread
From: Kishon Vijay Abraham I @ 2019-12-30 12:33 UTC (permalink / raw)
  To: Kishon Vijay Abraham I, Lorenzo Pieralisi, Arnd Bergmann
  Cc: Greg Kroah-Hartman, Bjorn Helgaas, linux-pci, linux-kernel

Adding more than 10 pci-endpoint-test devices results in
"kobject_add_internal failed for pci-endpoint-test.1 with -EEXIST, don't
try to register things with the same name in the same directory". This
is because commit 2c156ac71c6b ("misc: Add host side PCI driver for PCI
test function device") limited the length of the "name" to 20 characters.
Change the length of the name to 24 in order to support upto 10000
pci-endpoint-test devices.

Fixes: 2c156ac71c6b ("misc: Add host side PCI driver for PCI test function device")
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
---
 drivers/misc/pci_endpoint_test.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/misc/pci_endpoint_test.c b/drivers/misc/pci_endpoint_test.c
index 861b3d0cea19..b622e234f57c 100644
--- a/drivers/misc/pci_endpoint_test.c
+++ b/drivers/misc/pci_endpoint_test.c
@@ -652,7 +652,7 @@ static int pci_endpoint_test_probe(struct pci_dev *pdev,
 {
 	int err;
 	int id;
-	char name[20];
+	char name[24];
 	enum pci_barno bar;
 	void __iomem *base;
 	struct device *dev = &pdev->dev;
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH 6/7] misc: pci_endpoint_test: Use full pci-endpoint-test name in request irq
  2019-12-30 12:33 [PATCH 0/7] Improvements to pci_endpoint_test driver Kishon Vijay Abraham I
                   ` (4 preceding siblings ...)
  2019-12-30 12:33 ` [PATCH 5/7] misc: pci_endpoint_test: Fix to support > 10 pci-endpoint-test devices Kishon Vijay Abraham I
@ 2019-12-30 12:33 ` Kishon Vijay Abraham I
  2019-12-30 12:33 ` [PATCH 7/7] misc: pci_endpoint_test: Enable legacy interrupt Kishon Vijay Abraham I
  6 siblings, 0 replies; 12+ messages in thread
From: Kishon Vijay Abraham I @ 2019-12-30 12:33 UTC (permalink / raw)
  To: Kishon Vijay Abraham I, Lorenzo Pieralisi, Arnd Bergmann
  Cc: Greg Kroah-Hartman, Bjorn Helgaas, linux-pci, linux-kernel

Use full pci-endpoint-test name in request irq, so that it's easy to
profile the device that actually raised the interrupt.

Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
---
 drivers/misc/pci_endpoint_test.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/misc/pci_endpoint_test.c b/drivers/misc/pci_endpoint_test.c
index b622e234f57c..dae450c1a653 100644
--- a/drivers/misc/pci_endpoint_test.c
+++ b/drivers/misc/pci_endpoint_test.c
@@ -108,6 +108,7 @@ struct pci_endpoint_test {
 	struct miscdevice miscdev;
 	enum pci_barno test_reg_bar;
 	size_t alignment;
+	const char *name;
 };
 
 struct pci_endpoint_test_data {
@@ -226,7 +227,7 @@ static bool pci_endpoint_test_request_irq(struct pci_endpoint_test *test)
 	for (i = 0; i < test->num_irqs; i++) {
 		err = devm_request_irq(dev, pci_irq_vector(pdev, i),
 				       pci_endpoint_test_irqhandler,
-				       IRQF_SHARED, DRV_MODULE_NAME, test);
+				       IRQF_SHARED, test->name, test);
 		if (err)
 			goto fail;
 	}
@@ -752,6 +753,7 @@ static int pci_endpoint_test_probe(struct pci_dev *pdev,
 		dev_err(dev, "Failed to register device\n");
 		goto err_kfree_name;
 	}
+	test->name = kstrdup(name, GFP_KERNEL);
 
 	return 0;
 
@@ -792,6 +794,7 @@ static void pci_endpoint_test_remove(struct pci_dev *pdev)
 
 	misc_deregister(&test->miscdev);
 	kfree(misc_device->name);
+	kfree(test->name);
 	ida_simple_remove(&pci_endpoint_test_ida, id);
 	for (bar = 0; bar < PCI_STD_NUM_BARS; bar++) {
 		if (test->bar[bar])
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH 7/7] misc: pci_endpoint_test: Enable legacy interrupt
  2019-12-30 12:33 [PATCH 0/7] Improvements to pci_endpoint_test driver Kishon Vijay Abraham I
                   ` (5 preceding siblings ...)
  2019-12-30 12:33 ` [PATCH 6/7] misc: pci_endpoint_test: Use full pci-endpoint-test name in request irq Kishon Vijay Abraham I
@ 2019-12-30 12:33 ` Kishon Vijay Abraham I
  6 siblings, 0 replies; 12+ messages in thread
From: Kishon Vijay Abraham I @ 2019-12-30 12:33 UTC (permalink / raw)
  To: Kishon Vijay Abraham I, Lorenzo Pieralisi, Arnd Bergmann
  Cc: Greg Kroah-Hartman, Bjorn Helgaas, linux-pci, linux-kernel

PCI core does not enable legacy interrupt if it finds MSI or
MSIX interrupt. Explicitly enable legacy interrupt here in order
to perform legacy interrupt tests.

Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
---
 drivers/misc/pci_endpoint_test.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/misc/pci_endpoint_test.c b/drivers/misc/pci_endpoint_test.c
index dae450c1a653..b2458988939e 100644
--- a/drivers/misc/pci_endpoint_test.c
+++ b/drivers/misc/pci_endpoint_test.c
@@ -701,6 +701,7 @@ static int pci_endpoint_test_probe(struct pci_dev *pdev,
 	}
 
 	pci_set_master(pdev);
+	pci_intx(pdev, true);
 
 	if (!(is_am654_pci_dev(pdev) || is_j721e_pci_dev(pdev))) {
 		if (!pci_endpoint_test_alloc_irq_vectors(test, irq_type))
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* Re: [PATCH 2/7] misc: pci_endpoint_test: Do not request or allocate IRQs in probe
  2019-12-30 12:33 ` [PATCH 2/7] misc: pci_endpoint_test: Do not request or allocate IRQs in probe Kishon Vijay Abraham I
@ 2019-12-30 15:07   ` kbuild test robot
  2019-12-30 17:10   ` kbuild test robot
  1 sibling, 0 replies; 12+ messages in thread
From: kbuild test robot @ 2019-12-30 15:07 UTC (permalink / raw)
  To: Kishon Vijay Abraham I
  Cc: kbuild-all, Kishon Vijay Abraham I, Lorenzo Pieralisi,
	Arnd Bergmann, Greg Kroah-Hartman, Bjorn Helgaas, linux-pci,
	linux-kernel

[-- Attachment #1: Type: text/plain, Size: 2542 bytes --]

Hi Kishon,

I love your patch! Yet something to improve:

[auto build test ERROR on char-misc/char-misc-testing]
[also build test ERROR on pci/next arm-soc/for-next linus/master v5.5-rc4 next-20191220]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]

url:    https://github.com/0day-ci/linux/commits/Kishon-Vijay-Abraham-I/Improvements-to-pci_endpoint_test-driver/20191230-203402
base:   https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc.git d1eef1c619749b2a57e514a3fa67d9a516ffa919
config: s390-randconfig-a001-20191230 (attached as .config)
compiler: s390-linux-gcc (GCC) 7.5.0
reproduce:
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        GCC_VERSION=7.5.0 make.cross ARCH=s390 

If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp@intel.com>

All error/warnings (new ones prefixed by >>):

   drivers//misc/pci_endpoint_test.c: In function 'pci_endpoint_test_probe':
>> drivers//misc/pci_endpoint_test.c:73:22: error: 'PCI_DEVICE_ID_TI_J721E' undeclared (first use in this function); did you mean 'PCI_DEVICE_ID_TI_7510'?
      ((pdev)->device == PCI_DEVICE_ID_TI_J721E)
                         ^
>> drivers//misc/pci_endpoint_test.c:693:34: note: in expansion of macro 'is_j721e_pci_dev'
     if (!(is_am654_pci_dev(pdev) || is_j721e_pci_dev(pdev))) {
                                     ^~~~~~~~~~~~~~~~
   drivers//misc/pci_endpoint_test.c:73:22: note: each undeclared identifier is reported only once for each function it appears in
      ((pdev)->device == PCI_DEVICE_ID_TI_J721E)
                         ^
>> drivers//misc/pci_endpoint_test.c:693:34: note: in expansion of macro 'is_j721e_pci_dev'
     if (!(is_am654_pci_dev(pdev) || is_j721e_pci_dev(pdev))) {
                                     ^~~~~~~~~~~~~~~~

vim +73 drivers//misc/pci_endpoint_test.c

    68	
    69	#define is_am654_pci_dev(pdev)		\
    70			((pdev)->device == PCI_DEVICE_ID_TI_AM654)
    71	
    72	#define is_j721e_pci_dev(pdev)         \
  > 73			((pdev)->device == PCI_DEVICE_ID_TI_J721E)
    74	

---
0-DAY kernel test infrastructure                 Open Source Technology Center
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org Intel Corporation

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 29048 bytes --]

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 2/7] misc: pci_endpoint_test: Do not request or allocate IRQs in probe
  2019-12-30 12:33 ` [PATCH 2/7] misc: pci_endpoint_test: Do not request or allocate IRQs in probe Kishon Vijay Abraham I
  2019-12-30 15:07   ` kbuild test robot
@ 2019-12-30 17:10   ` kbuild test robot
  2019-12-31  8:35     ` Kishon Vijay Abraham I
  1 sibling, 1 reply; 12+ messages in thread
From: kbuild test robot @ 2019-12-30 17:10 UTC (permalink / raw)
  To: Kishon Vijay Abraham I
  Cc: kbuild-all, Kishon Vijay Abraham I, Lorenzo Pieralisi,
	Arnd Bergmann, Greg Kroah-Hartman, Bjorn Helgaas, linux-pci,
	linux-kernel

[-- Attachment #1: Type: text/plain, Size: 7092 bytes --]

Hi Kishon,

I love your patch! Perhaps something to improve:

[auto build test WARNING on char-misc/char-misc-testing]
[also build test WARNING on pci/next arm-soc/for-next linus/master v5.5-rc4 next-20191220]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]

url:    https://github.com/0day-ci/linux/commits/Kishon-Vijay-Abraham-I/Improvements-to-pci_endpoint_test-driver/20191230-203402
base:   https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc.git d1eef1c619749b2a57e514a3fa67d9a516ffa919
config: arm-randconfig-a001-20191229 (attached as .config)
compiler: arm-linux-gnueabi-gcc (GCC) 7.5.0
reproduce:
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        GCC_VERSION=7.5.0 make.cross ARCH=arm 

If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp@intel.com>

All warnings (new ones prefixed by >>):

   In file included from include/linux/kernel.h:11:0,
                    from include/linux/delay.h:22,
                    from drivers/misc/pci_endpoint_test.c:10:
   drivers/misc/pci_endpoint_test.c: In function 'pci_endpoint_test_probe':
   drivers/misc/pci_endpoint_test.c:73:22: error: 'PCI_DEVICE_ID_TI_J721E' undeclared (first use in this function); did you mean 'PCI_DEVICE_ID_TI_7510'?
      ((pdev)->device == PCI_DEVICE_ID_TI_J721E)
                         ^
   include/linux/compiler.h:58:52: note: in definition of macro '__trace_if_var'
    #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond))
                                                       ^~~~
>> drivers/misc/pci_endpoint_test.c:693:2: note: in expansion of macro 'if'
     if (!(is_am654_pci_dev(pdev) || is_j721e_pci_dev(pdev))) {
     ^~
   drivers/misc/pci_endpoint_test.c:693:34: note: in expansion of macro 'is_j721e_pci_dev'
     if (!(is_am654_pci_dev(pdev) || is_j721e_pci_dev(pdev))) {
                                     ^~~~~~~~~~~~~~~~
   drivers/misc/pci_endpoint_test.c:73:22: note: each undeclared identifier is reported only once for each function it appears in
      ((pdev)->device == PCI_DEVICE_ID_TI_J721E)
                         ^
   include/linux/compiler.h:58:52: note: in definition of macro '__trace_if_var'
    #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond))
                                                       ^~~~
>> drivers/misc/pci_endpoint_test.c:693:2: note: in expansion of macro 'if'
     if (!(is_am654_pci_dev(pdev) || is_j721e_pci_dev(pdev))) {
     ^~
   drivers/misc/pci_endpoint_test.c:693:34: note: in expansion of macro 'is_j721e_pci_dev'
     if (!(is_am654_pci_dev(pdev) || is_j721e_pci_dev(pdev))) {
                                     ^~~~~~~~~~~~~~~~

vim +/if +693 drivers/misc/pci_endpoint_test.c

   638	
   639	static int pci_endpoint_test_probe(struct pci_dev *pdev,
   640					   const struct pci_device_id *ent)
   641	{
   642		int err;
   643		int id;
   644		char name[20];
   645		enum pci_barno bar;
   646		void __iomem *base;
   647		struct device *dev = &pdev->dev;
   648		struct pci_endpoint_test *test;
   649		struct pci_endpoint_test_data *data;
   650		enum pci_barno test_reg_bar = BAR_0;
   651		struct miscdevice *misc_device;
   652	
   653		if (pci_is_bridge(pdev))
   654			return -ENODEV;
   655	
   656		test = devm_kzalloc(dev, sizeof(*test), GFP_KERNEL);
   657		if (!test)
   658			return -ENOMEM;
   659	
   660		test->test_reg_bar = 0;
   661		test->alignment = 0;
   662		test->pdev = pdev;
   663		test->irq_type = IRQ_TYPE_UNDEFINED;
   664	
   665		if (no_msi)
   666			irq_type = IRQ_TYPE_LEGACY;
   667	
   668		data = (struct pci_endpoint_test_data *)ent->driver_data;
   669		if (data) {
   670			test_reg_bar = data->test_reg_bar;
   671			test->test_reg_bar = test_reg_bar;
   672			test->alignment = data->alignment;
   673			irq_type = data->irq_type;
   674		}
   675	
   676		init_completion(&test->irq_raised);
   677		mutex_init(&test->mutex);
   678	
   679		err = pci_enable_device(pdev);
   680		if (err) {
   681			dev_err(dev, "Cannot enable PCI device\n");
   682			return err;
   683		}
   684	
   685		err = pci_request_regions(pdev, DRV_MODULE_NAME);
   686		if (err) {
   687			dev_err(dev, "Cannot obtain PCI resources\n");
   688			goto err_disable_pdev;
   689		}
   690	
   691		pci_set_master(pdev);
   692	
 > 693		if (!(is_am654_pci_dev(pdev) || is_j721e_pci_dev(pdev))) {
   694			if (!pci_endpoint_test_alloc_irq_vectors(test, irq_type))
   695				goto err_disable_irq;
   696	
   697			if (!pci_endpoint_test_request_irq(test))
   698				goto err_disable_irq;
   699		}
   700	
   701		for (bar = 0; bar < PCI_STD_NUM_BARS; bar++) {
   702			if (pci_resource_flags(pdev, bar) & IORESOURCE_MEM) {
   703				base = pci_ioremap_bar(pdev, bar);
   704				if (!base) {
   705					dev_err(dev, "Failed to read BAR%d\n", bar);
   706					WARN_ON(bar == test_reg_bar);
   707				}
   708				test->bar[bar] = base;
   709			}
   710		}
   711	
   712		test->base = test->bar[test_reg_bar];
   713		if (!test->base) {
   714			err = -ENOMEM;
   715			dev_err(dev, "Cannot perform PCI test without BAR%d\n",
   716				test_reg_bar);
   717			goto err_iounmap;
   718		}
   719	
   720		pci_set_drvdata(pdev, test);
   721	
   722		id = ida_simple_get(&pci_endpoint_test_ida, 0, 0, GFP_KERNEL);
   723		if (id < 0) {
   724			err = id;
   725			dev_err(dev, "Unable to get id\n");
   726			goto err_iounmap;
   727		}
   728	
   729		snprintf(name, sizeof(name), DRV_MODULE_NAME ".%d", id);
   730		misc_device = &test->miscdev;
   731		misc_device->minor = MISC_DYNAMIC_MINOR;
   732		misc_device->name = kstrdup(name, GFP_KERNEL);
   733		if (!misc_device->name) {
   734			err = -ENOMEM;
   735			goto err_ida_remove;
   736		}
   737		misc_device->fops = &pci_endpoint_test_fops,
   738	
   739		err = misc_register(misc_device);
   740		if (err) {
   741			dev_err(dev, "Failed to register device\n");
   742			goto err_kfree_name;
   743		}
   744	
   745		return 0;
   746	
   747	err_kfree_name:
   748		kfree(misc_device->name);
   749	
   750	err_ida_remove:
   751		ida_simple_remove(&pci_endpoint_test_ida, id);
   752	
   753	err_iounmap:
   754		for (bar = 0; bar < PCI_STD_NUM_BARS; bar++) {
   755			if (test->bar[bar])
   756				pci_iounmap(pdev, test->bar[bar]);
   757		}
   758		pci_endpoint_test_release_irq(test);
   759	
   760	err_disable_irq:
   761		pci_endpoint_test_free_irq_vectors(test);
   762		pci_release_regions(pdev);
   763	
   764	err_disable_pdev:
   765		pci_disable_device(pdev);
   766	
   767		return err;
   768	}
   769	

---
0-DAY kernel test infrastructure                 Open Source Technology Center
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org Intel Corporation

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 28136 bytes --]

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 2/7] misc: pci_endpoint_test: Do not request or allocate IRQs in probe
  2019-12-30 17:10   ` kbuild test robot
@ 2019-12-31  8:35     ` Kishon Vijay Abraham I
  2019-12-31 10:40       ` [kbuild-all] " Philip Li
  0 siblings, 1 reply; 12+ messages in thread
From: Kishon Vijay Abraham I @ 2019-12-31  8:35 UTC (permalink / raw)
  To: kbuild test robot
  Cc: kbuild-all, Lorenzo Pieralisi, Arnd Bergmann, Greg Kroah-Hartman,
	Bjorn Helgaas, linux-pci, linux-kernel

Hi,

On 30/12/19 10:40 PM, kbuild test robot wrote:
> Hi Kishon,
> 
> I love your patch! Perhaps something to improve:
> 
> [auto build test WARNING on char-misc/char-misc-testing]
> [also build test WARNING on pci/next arm-soc/for-next linus/master v5.5-rc4 next-20191220]
> [if your patch is applied to the wrong git tree, please drop us a note to help
> improve the system. BTW, we also suggest to use '--base' option to specify the
> base tree in git format-patch, please see https://stackoverflow.com/a/37406982]
> 
> url:    https://github.com/0day-ci/linux/commits/Kishon-Vijay-Abraham-I/Improvements-to-pci_endpoint_test-driver/20191230-203402
> base:   https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc.git d1eef1c619749b2a57e514a3fa67d9a516ffa919
> config: arm-randconfig-a001-20191229 (attached as .config)
> compiler: arm-linux-gnueabi-gcc (GCC) 7.5.0
> reproduce:
>         wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
>         chmod +x ~/bin/make.cross
>         # save the attached .config to linux build tree
>         GCC_VERSION=7.5.0 make.cross ARCH=arm 
> 
> If you fix the issue, kindly add following tag
> Reported-by: kbuild test robot <lkp@intel.com>
> 
> All warnings (new ones prefixed by >>):
> 
>    In file included from include/linux/kernel.h:11:0,
>                     from include/linux/delay.h:22,
>                     from drivers/[1] -> http://lore.kernel.org/r/20191209092147.22901-1-kishon@ti.commisc/pci_endpoint_test.c:10:
>    drivers/misc/pci_endpoint_test.c: In function 'pci_endpoint_test_probe':
>    drivers/misc/pci_endpoint_test.c:73:22: error: 'PCI_DEVICE_ID_TI_J721E' undeclared (first use in this function); did you mean 'PCI_DEVICE_ID_TI_7510'?
>       ((pdev)->device == PCI_DEVICE_ID_TI_J721E)

The patches in this series should be merged only after [1]. With that
this error wouldn't be seen.

[1] -> http://lore.kernel.org/r/20191209092147.22901-1-kishon@ti.com

Thanks
Kishon

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [kbuild-all] Re: [PATCH 2/7] misc: pci_endpoint_test: Do not request or allocate IRQs in probe
  2019-12-31  8:35     ` Kishon Vijay Abraham I
@ 2019-12-31 10:40       ` Philip Li
  0 siblings, 0 replies; 12+ messages in thread
From: Philip Li @ 2019-12-31 10:40 UTC (permalink / raw)
  To: Kishon Vijay Abraham I
  Cc: kbuild test robot, kbuild-all, Lorenzo Pieralisi, Arnd Bergmann,
	Greg Kroah-Hartman, Bjorn Helgaas, linux-pci, linux-kernel

On Tue, Dec 31, 2019 at 02:05:15PM +0530, Kishon Vijay Abraham I wrote:
> Hi,
> 
> On 30/12/19 10:40 PM, kbuild test robot wrote:
> > Hi Kishon,
> > 
> > I love your patch! Perhaps something to improve:
> > 
> > [auto build test WARNING on char-misc/char-misc-testing]
> > [also build test WARNING on pci/next arm-soc/for-next linus/master v5.5-rc4 next-20191220]
> > [if your patch is applied to the wrong git tree, please drop us a note to help
> > improve the system. BTW, we also suggest to use '--base' option to specify the
> > base tree in git format-patch, please see https://stackoverflow.com/a/37406982]
> > 
> > url:    https://github.com/0day-ci/linux/commits/Kishon-Vijay-Abraham-I/Improvements-to-pci_endpoint_test-driver/20191230-203402
> > base:   https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc.git d1eef1c619749b2a57e514a3fa67d9a516ffa919
> > config: arm-randconfig-a001-20191229 (attached as .config)
> > compiler: arm-linux-gnueabi-gcc (GCC) 7.5.0
> > reproduce:
> >         wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
> >         chmod +x ~/bin/make.cross
> >         # save the attached .config to linux build tree
> >         GCC_VERSION=7.5.0 make.cross ARCH=arm 
> > 
> > If you fix the issue, kindly add following tag
> > Reported-by: kbuild test robot <lkp@intel.com>
> > 
> > All warnings (new ones prefixed by >>):
> > 
> >    In file included from include/linux/kernel.h:11:0,
> >                     from include/linux/delay.h:22,
> >                     from drivers/[1] -> http://lore.kernel.org/r/20191209092147.22901-1-kishon@ti.commisc/pci_endpoint_test.c:10:
> >    drivers/misc/pci_endpoint_test.c: In function 'pci_endpoint_test_probe':
> >    drivers/misc/pci_endpoint_test.c:73:22: error: 'PCI_DEVICE_ID_TI_J721E' undeclared (first use in this function); did you mean 'PCI_DEVICE_ID_TI_7510'?
> >       ((pdev)->device == PCI_DEVICE_ID_TI_J721E)
> 
> The patches in this series should be merged only after [1]. With that
> this error wouldn't be seen.
thanks Kishon for the info, sorry for the false positive.

> 
> [1] -> http://lore.kernel.org/r/20191209092147.22901-1-kishon@ti.com
> 
> Thanks
> Kishon
> _______________________________________________
> kbuild-all mailing list -- kbuild-all@lists.01.org
> To unsubscribe send an email to kbuild-all-leave@lists.01.org

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2019-12-31 10:41 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-30 12:33 [PATCH 0/7] Improvements to pci_endpoint_test driver Kishon Vijay Abraham I
2019-12-30 12:33 ` [PATCH 1/7] misc: pci_endpoint_test: Avoid using module parameter to determine irqtype Kishon Vijay Abraham I
2019-12-30 12:33 ` [PATCH 2/7] misc: pci_endpoint_test: Do not request or allocate IRQs in probe Kishon Vijay Abraham I
2019-12-30 15:07   ` kbuild test robot
2019-12-30 17:10   ` kbuild test robot
2019-12-31  8:35     ` Kishon Vijay Abraham I
2019-12-31 10:40       ` [kbuild-all] " Philip Li
2019-12-30 12:33 ` [PATCH 3/7] misc: pci_endpoint_test: Add ioctl to clear IRQ Kishon Vijay Abraham I
2019-12-30 12:33 ` [PATCH 4/7] tools: PCI: Add 'e' " Kishon Vijay Abraham I
2019-12-30 12:33 ` [PATCH 5/7] misc: pci_endpoint_test: Fix to support > 10 pci-endpoint-test devices Kishon Vijay Abraham I
2019-12-30 12:33 ` [PATCH 6/7] misc: pci_endpoint_test: Use full pci-endpoint-test name in request irq Kishon Vijay Abraham I
2019-12-30 12:33 ` [PATCH 7/7] misc: pci_endpoint_test: Enable legacy interrupt Kishon Vijay Abraham I

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).