All of lore.kernel.org
 help / color / mirror / Atom feed
From: Gustavo Pimentel <gustavo.pimentel@synopsys.com>
To: bhelgaas@google.com, lorenzo.pieralisi@arm.com,
	Joao.Pinto@synopsys.com, jingoohan1@gmail.com, kishon@ti.com,
	adouglas@cadence.com, niklas.cassel@axis.com,
	jesper.nilsson@axis.com
Cc: linux-pci@vger.kernel.org, linux-doc@vger.kernel.org,
	linux-kernel@vger.kernel.org, gustavo.pimentel@synopsys.com
Subject: [RFC 10/10] tools: PCI: Add MSI-X support
Date: Tue, 10 Apr 2018 18:14:49 +0100	[thread overview]
Message-ID: <9865822fb89ea84cb55fe93e151295afcd5c96b3.1523379766.git.gustavo.pimentel@synopsys.com> (raw)
In-Reply-To: <cover.1523379766.git.gustavo.pimentel@synopsys.com>
In-Reply-To: <cover.1523379766.git.gustavo.pimentel@synopsys.com>

Adds MSI-X support to the pcitest tool and modified the pcitest.sh script
to accomodate this new type of interruption test.

Signed-off-by: Gustavo Pimentel <gustavo.pimentel@synopsys.com>
---
 include/uapi/linux/pcitest.h |  1 +
 tools/pci/pcitest.c          | 18 +++++++++++++++++-
 tools/pci/pcitest.sh         | 25 +++++++++++++++++++++++++
 3 files changed, 43 insertions(+), 1 deletion(-)

diff --git a/include/uapi/linux/pcitest.h b/include/uapi/linux/pcitest.h
index 953cf03..d746fb1 100644
--- a/include/uapi/linux/pcitest.h
+++ b/include/uapi/linux/pcitest.h
@@ -16,5 +16,6 @@
 #define PCITEST_WRITE		_IOW('P', 0x4, unsigned long)
 #define PCITEST_READ		_IOW('P', 0x5, unsigned long)
 #define PCITEST_COPY		_IOW('P', 0x6, unsigned long)
+#define PCITEST_MSIX		_IOW('P', 0x7, int)
 
 #endif /* __UAPI_LINUX_PCITEST_H */
diff --git a/tools/pci/pcitest.c b/tools/pci/pcitest.c
index 9074b47..9d145a3 100644
--- a/tools/pci/pcitest.c
+++ b/tools/pci/pcitest.c
@@ -37,6 +37,7 @@ struct pci_test {
 	char		barnum;
 	bool		legacyirq;
 	unsigned int	msinum;
+	unsigned int	msixnum;
 	bool		read;
 	bool		write;
 	bool		copy;
@@ -83,6 +84,15 @@ static int run_test(struct pci_test *test)
 			fprintf(stdout, "%s\n", result[ret]);
 	}
 
+	if (test->msixnum > 0 && test->msixnum <= 2048) {
+		ret = ioctl(fd, PCITEST_MSIX, test->msixnum);
+		fprintf(stdout, "MSI-X%d:\t\t", test->msixnum);
+		if (ret < 0)
+			fprintf(stdout, "TEST FAILED\n");
+		else
+			fprintf(stdout, "%s\n", result[ret]);
+	}
+
 	if (test->write) {
 		ret = ioctl(fd, PCITEST_WRITE, test->size);
 		fprintf(stdout, "WRITE (%7ld bytes):\t\t", test->size);
@@ -133,7 +143,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:lrwcs:")) != EOF)
+	while ((c = getopt(argc, argv, "D:b:m:x:lrwcs:")) != EOF)
 	switch (c) {
 	case 'D':
 		test->device = optarg;
@@ -151,6 +161,11 @@ int main(int argc, char **argv)
 		if (test->msinum < 1 || test->msinum > 32)
 			goto usage;
 		continue;
+	case 'x':
+		test->msixnum = atoi(optarg);
+		if (test->msixnum < 1 || test->msixnum > 2048)
+			goto usage;
+		continue;
 	case 'r':
 		test->read = true;
 		continue;
@@ -173,6 +188,7 @@ int main(int argc, char **argv)
 			"\t-D <dev>		PCI endpoint test device {default: /dev/pci-endpoint-test.0}\n"
 			"\t-b <bar num>		BAR test (bar number between 0..5)\n"
 			"\t-m <msi num>		MSI test (msi number between 1..32)\n"
+			"\t-x <msix num>	MSI-X test (msix number between 1..2048)\n"
 			"\t-l			Legacy IRQ test\n"
 			"\t-r			Read buffer test\n"
 			"\t-w			Write buffer test\n"
diff --git a/tools/pci/pcitest.sh b/tools/pci/pcitest.sh
index 77e8c85..86709a2 100644
--- a/tools/pci/pcitest.sh
+++ b/tools/pci/pcitest.sh
@@ -4,6 +4,8 @@
 echo "BAR tests"
 echo
 
+modprobe pci_endpoint_test
+sleep 2
 bar=0
 
 while [ $bar -lt 6 ]
@@ -16,7 +18,14 @@ echo
 echo "Interrupt tests"
 echo
 
+rmmod pci_endpoint_test
+sleep 2
+modprobe pci_endpoint_test irq_type=0
 pcitest -l
+
+rmmod pci_endpoint_test
+sleep 2
+modprobe pci_endpoint_test irq_type=1
 msi=1
 
 while [ $msi -lt 33 ]
@@ -26,9 +35,25 @@ do
 done
 echo
 
+rmmod pci_endpoint_test
+sleep 2
+modprobe pci_endpoint_test irq_type=2
+msix=1
+
+while [ $msix -lt 2049 ]
+do
+        pcitest -x $msix
+        msix=`expr $msix + 1`
+done
+echo
+
 echo "Read Tests"
 echo
 
+rmmod pci_endpoint_test
+sleep 2
+modprobe pci_endpoint_test irq_type=1
+
 pcitest -r -s 1
 pcitest -r -s 1024
 pcitest -r -s 1025
-- 
2.7.4

WARNING: multiple messages have this Message-ID (diff)
From: Gustavo Pimentel <gustavo.pimentel@synopsys.com>
To: bhelgaas@google.com, lorenzo.pieralisi@arm.com,
	Joao.Pinto@synopsys.com, jingoohan1@gmail.com, kishon@ti.com,
	adouglas@cadence.com, niklas.cassel@axis.com,
	jesper.nilsson@axis.com
Cc: linux-pci@vger.kernel.org, linux-doc@vger.kernel.org,
	linux-kernel@vger.kernel.org, gustavo.pimentel@synopsys.com
Subject: [RFC 10/10] tools: PCI: Add MSI-X support
Date: Tue, 10 Apr 2018 18:14:49 +0100	[thread overview]
Message-ID: <9865822fb89ea84cb55fe93e151295afcd5c96b3.1523379766.git.gustavo.pimentel@synopsys.com> (raw)
In-Reply-To: <cover.1523379766.git.gustavo.pimentel@synopsys.com>
In-Reply-To: <cover.1523379766.git.gustavo.pimentel@synopsys.com>

Adds MSI-X support to the pcitest tool and modified the pcitest.sh script
to accomodate this new type of interruption test.

Signed-off-by: Gustavo Pimentel <gustavo.pimentel@synopsys.com>
---
 include/uapi/linux/pcitest.h |  1 +
 tools/pci/pcitest.c          | 18 +++++++++++++++++-
 tools/pci/pcitest.sh         | 25 +++++++++++++++++++++++++
 3 files changed, 43 insertions(+), 1 deletion(-)

diff --git a/include/uapi/linux/pcitest.h b/include/uapi/linux/pcitest.h
index 953cf03..d746fb1 100644
--- a/include/uapi/linux/pcitest.h
+++ b/include/uapi/linux/pcitest.h
@@ -16,5 +16,6 @@
 #define PCITEST_WRITE		_IOW('P', 0x4, unsigned long)
 #define PCITEST_READ		_IOW('P', 0x5, unsigned long)
 #define PCITEST_COPY		_IOW('P', 0x6, unsigned long)
+#define PCITEST_MSIX		_IOW('P', 0x7, int)
 
 #endif /* __UAPI_LINUX_PCITEST_H */
diff --git a/tools/pci/pcitest.c b/tools/pci/pcitest.c
index 9074b47..9d145a3 100644
--- a/tools/pci/pcitest.c
+++ b/tools/pci/pcitest.c
@@ -37,6 +37,7 @@ struct pci_test {
 	char		barnum;
 	bool		legacyirq;
 	unsigned int	msinum;
+	unsigned int	msixnum;
 	bool		read;
 	bool		write;
 	bool		copy;
@@ -83,6 +84,15 @@ static int run_test(struct pci_test *test)
 			fprintf(stdout, "%s\n", result[ret]);
 	}
 
+	if (test->msixnum > 0 && test->msixnum <= 2048) {
+		ret = ioctl(fd, PCITEST_MSIX, test->msixnum);
+		fprintf(stdout, "MSI-X%d:\t\t", test->msixnum);
+		if (ret < 0)
+			fprintf(stdout, "TEST FAILED\n");
+		else
+			fprintf(stdout, "%s\n", result[ret]);
+	}
+
 	if (test->write) {
 		ret = ioctl(fd, PCITEST_WRITE, test->size);
 		fprintf(stdout, "WRITE (%7ld bytes):\t\t", test->size);
@@ -133,7 +143,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:lrwcs:")) != EOF)
+	while ((c = getopt(argc, argv, "D:b:m:x:lrwcs:")) != EOF)
 	switch (c) {
 	case 'D':
 		test->device = optarg;
@@ -151,6 +161,11 @@ int main(int argc, char **argv)
 		if (test->msinum < 1 || test->msinum > 32)
 			goto usage;
 		continue;
+	case 'x':
+		test->msixnum = atoi(optarg);
+		if (test->msixnum < 1 || test->msixnum > 2048)
+			goto usage;
+		continue;
 	case 'r':
 		test->read = true;
 		continue;
@@ -173,6 +188,7 @@ int main(int argc, char **argv)
 			"\t-D <dev>		PCI endpoint test device {default: /dev/pci-endpoint-test.0}\n"
 			"\t-b <bar num>		BAR test (bar number between 0..5)\n"
 			"\t-m <msi num>		MSI test (msi number between 1..32)\n"
+			"\t-x <msix num>	MSI-X test (msix number between 1..2048)\n"
 			"\t-l			Legacy IRQ test\n"
 			"\t-r			Read buffer test\n"
 			"\t-w			Write buffer test\n"
diff --git a/tools/pci/pcitest.sh b/tools/pci/pcitest.sh
index 77e8c85..86709a2 100644
--- a/tools/pci/pcitest.sh
+++ b/tools/pci/pcitest.sh
@@ -4,6 +4,8 @@
 echo "BAR tests"
 echo
 
+modprobe pci_endpoint_test
+sleep 2
 bar=0
 
 while [ $bar -lt 6 ]
@@ -16,7 +18,14 @@ echo
 echo "Interrupt tests"
 echo
 
+rmmod pci_endpoint_test
+sleep 2
+modprobe pci_endpoint_test irq_type=0
 pcitest -l
+
+rmmod pci_endpoint_test
+sleep 2
+modprobe pci_endpoint_test irq_type=1
 msi=1
 
 while [ $msi -lt 33 ]
@@ -26,9 +35,25 @@ do
 done
 echo
 
+rmmod pci_endpoint_test
+sleep 2
+modprobe pci_endpoint_test irq_type=2
+msix=1
+
+while [ $msix -lt 2049 ]
+do
+        pcitest -x $msix
+        msix=`expr $msix + 1`
+done
+echo
+
 echo "Read Tests"
 echo
 
+rmmod pci_endpoint_test
+sleep 2
+modprobe pci_endpoint_test irq_type=1
+
 pcitest -r -s 1
 pcitest -r -s 1024
 pcitest -r -s 1025
-- 
2.7.4


--
To unsubscribe from this list: send the line "unsubscribe linux-doc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  parent reply	other threads:[~2018-04-10 17:15 UTC|newest]

Thread overview: 80+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-10 17:14 [RFC 00/10] Adds pcitest tool support for MSI-X Gustavo Pimentel
2018-04-10 17:14 ` Gustavo Pimentel
2018-04-10 17:14 ` [RFC 01/10] PCI: dwc: Add MSI-X callbacks handler Gustavo Pimentel
2018-04-10 17:14   ` Gustavo Pimentel
2018-04-16  9:29   ` Kishon Vijay Abraham I
2018-04-16  9:29     ` Kishon Vijay Abraham I
2018-04-23  9:36     ` Gustavo Pimentel
2018-04-23  9:36       ` Gustavo Pimentel
2018-04-24  7:07       ` Kishon Vijay Abraham I
2018-04-24  7:07         ` Kishon Vijay Abraham I
2018-04-24  9:36         ` Gustavo Pimentel
2018-04-24  9:36           ` Gustavo Pimentel
2018-04-24 11:24           ` Kishon Vijay Abraham I
2018-04-24 11:24             ` Kishon Vijay Abraham I
2018-04-26 15:30             ` Gustavo Pimentel
2018-04-26 15:30               ` Gustavo Pimentel
2018-04-24 14:05           ` Alan Douglas
2018-04-24 14:05             ` Alan Douglas
2018-04-24 14:05             ` Alan Douglas
2018-04-24  9:15   ` Alan Douglas
2018-04-24  9:15     ` Alan Douglas
2018-04-24  9:15     ` Alan Douglas
2018-04-24 11:43     ` Gustavo Pimentel
2018-04-24 11:43       ` Gustavo Pimentel
2018-05-10 10:40     ` Gustavo Pimentel
2018-05-10 10:40       ` Gustavo Pimentel
2018-04-10 17:14 ` [RFC 02/10] PCI: cadence: Update cdns_pcie_ep_raise_irq function signature Gustavo Pimentel
2018-04-10 17:14   ` Gustavo Pimentel
2018-04-13 16:05   ` Alan Douglas
2018-04-13 16:05     ` Alan Douglas
2018-04-13 16:05     ` Alan Douglas
2018-04-10 17:14 ` [RFC 03/10] PCI: endpoint: Add MSI-X interfaces Gustavo Pimentel
2018-04-10 17:14   ` Gustavo Pimentel
2018-04-17 10:24   ` Kishon Vijay Abraham I
2018-04-17 10:24     ` Kishon Vijay Abraham I
2018-04-17 15:51     ` Gustavo Pimentel
2018-04-17 15:51       ` Gustavo Pimentel
2018-04-10 17:14 ` [RFC 04/10] PCI: dwc: MSI callbacks handler rework Gustavo Pimentel
2018-04-10 17:14   ` Gustavo Pimentel
2018-04-10 17:14 ` [RFC 05/10] PCI: dwc: Add legacy interrupt callback handler Gustavo Pimentel
2018-04-10 17:14   ` Gustavo Pimentel
2018-04-10 17:14 ` [RFC 06/10] misc: pci_endpoint_test: Add MSI-X support Gustavo Pimentel
2018-04-10 17:14   ` Gustavo Pimentel
2018-04-17 10:33   ` Kishon Vijay Abraham I
2018-04-17 10:33     ` Kishon Vijay Abraham I
2018-04-17 17:38     ` Gustavo Pimentel
2018-04-17 17:38       ` Gustavo Pimentel
2018-04-24  7:19       ` Kishon Vijay Abraham I
2018-04-24  7:19         ` Kishon Vijay Abraham I
2018-04-24 10:57         ` Gustavo Pimentel
2018-04-24 10:57           ` Gustavo Pimentel
2018-04-24 11:43           ` Kishon Vijay Abraham I
2018-04-24 11:43             ` Kishon Vijay Abraham I
2018-04-26 15:36             ` Gustavo Pimentel
2018-04-26 15:36               ` Gustavo Pimentel
2018-04-24  6:59   ` Alan Douglas
2018-04-24  6:59     ` Alan Douglas
2018-04-24  6:59     ` Alan Douglas
2018-04-24 11:11     ` Gustavo Pimentel
2018-04-24 11:11       ` Gustavo Pimentel
2018-04-10 17:14 ` [RFC 07/10] misc: pci_endpoint_test: Replace lower into upper case characters Gustavo Pimentel
2018-04-10 17:14   ` Gustavo Pimentel
2018-04-10 17:14 ` [RFC 08/10] PCI: endpoint: functions/pci-epf-test: Add MSI-X support Gustavo Pimentel
2018-04-10 17:14   ` Gustavo Pimentel
2018-04-10 17:14 ` [RFC 09/10] PCI: endpoint: functions/pci-epf-test: Replace lower into upper case characters Gustavo Pimentel
2018-04-10 17:14   ` Gustavo Pimentel
2018-04-10 17:14 ` Gustavo Pimentel [this message]
2018-04-10 17:14   ` [RFC 10/10] tools: PCI: Add MSI-X support Gustavo Pimentel
2018-04-24  9:57   ` Alan Douglas
2018-04-24  9:57     ` Alan Douglas
2018-04-24  9:57     ` Alan Douglas
2018-04-24 17:18     ` Gustavo Pimentel
2018-04-24 17:18       ` Gustavo Pimentel
2018-04-24  6:48 ` [RFC 00/10] Adds pcitest tool support for MSI-X Alan Douglas
2018-04-24  6:48   ` Alan Douglas
2018-04-24  6:48   ` Alan Douglas
2018-04-24  8:49   ` Gustavo Pimentel
2018-04-24  8:49     ` Gustavo Pimentel
2018-04-24  9:28     ` Alan Douglas
2018-04-24  9:28       ` Alan Douglas

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=9865822fb89ea84cb55fe93e151295afcd5c96b3.1523379766.git.gustavo.pimentel@synopsys.com \
    --to=gustavo.pimentel@synopsys.com \
    --cc=Joao.Pinto@synopsys.com \
    --cc=adouglas@cadence.com \
    --cc=bhelgaas@google.com \
    --cc=jesper.nilsson@axis.com \
    --cc=jingoohan1@gmail.com \
    --cc=kishon@ti.com \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=lorenzo.pieralisi@arm.com \
    --cc=niklas.cassel@axis.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.