aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorBjorn Helgaas <bhelgaas@google.com>2018-08-15 15:59:11 -0400
committerBjorn Helgaas <bhelgaas@google.com>2018-08-15 15:59:11 -0400
commit0c38011aba35b2cdca263c0ba4d28e2e727b5acb (patch)
treea16ebcc1edc74087fb074368f00f23cb25c99508 /tools
parent37f0e311bca66e9fe74703887c9bb4965914cabf (diff)
parent15c972dfb3954569e7d17ebadf1b10d0a0c3baa3 (diff)
Merge branch 'remotes/lorenzo/pci/dwc'
- Add Kirin MSI support (Xiaowei Song) - Drop unnecessary root_bus_nr setting from exynos, imx6, keystone, armada8k, artpec6, designware-plat, histb, qcom, spear13xx (Shawn Guo) - Move link notification settings from DesignWare core to individual drivers (Gustavo Pimentel) - Add endpoint library MSI-X interfaces (Gustavo Pimentel) - Correct signature of endpoint library IRQ interfaces (Gustavo Pimentel) - Add DesignWare endpoint library MSI-X callbacks (Gustavo Pimentel) - Add endpoint library MSI-X test support (Gustavo Pimentel) * remotes/lorenzo/pci/dwc: PCI: endpoint: Add MSI set maximum restriction tools: PCI: Add MSI-X support pci_endpoint_test: Add 2 ioctl commands pci-epf-test/pci_endpoint_test: Add MSI-X support pci-epf-test/pci_endpoint_test: Use irq_type module parameter pci-epf-test/pci_endpoint_test: Cleanup PCI_ENDPOINT_TEST memspace PCI: dwc: Add legacy interrupt callback handler PCI: dwc: Rework MSI callbacks handler PCI: dwc: Add MSI-X callbacks handler PCI: Update xxx_pcie_ep_raise_irq() and pci_epc_raise_irq() signatures PCI: endpoint: Add MSI-X interfaces PCI: dwc: Fix EP link notification implementation PCI: spear13xx: Drop unnecessary root_bus_nr setting PCI: qcom: Drop unnecessary root_bus_nr setting PCI: histb: Drop unnecessary root_bus_nr setting PCI: designware-plat: Drop unnecessary root_bus_nr setting PCI: artpec6: Drop unnecessary root_bus_nr setting PCI: armada8k: Drop unnecessary root_bus_nr setting PCI: keystone: Drop unnecessary root_bus_nr setting PCI: imx6: Drop unnecessary root_bus_nr setting PCI: exynos: Drop unnecessary root_bus_nr setting PCI: kirin: Add MSI support
Diffstat (limited to 'tools')
-rw-r--r--tools/pci/pcitest.c51
-rw-r--r--tools/pci/pcitest.sh15
2 files changed, 65 insertions, 1 deletions
diff --git a/tools/pci/pcitest.c b/tools/pci/pcitest.c
index 9074b477bff0..af146bb03b4d 100644
--- a/tools/pci/pcitest.c
+++ b/tools/pci/pcitest.c
@@ -31,12 +31,17 @@
31#define BILLION 1E9 31#define BILLION 1E9
32 32
33static char *result[] = { "NOT OKAY", "OKAY" }; 33static char *result[] = { "NOT OKAY", "OKAY" };
34static char *irq[] = { "LEGACY", "MSI", "MSI-X" };
34 35
35struct pci_test { 36struct pci_test {
36 char *device; 37 char *device;
37 char barnum; 38 char barnum;
38 bool legacyirq; 39 bool legacyirq;
39 unsigned int msinum; 40 unsigned int msinum;
41 unsigned int msixnum;
42 int irqtype;
43 bool set_irqtype;
44 bool get_irqtype;
40 bool read; 45 bool read;
41 bool write; 46 bool write;
42 bool copy; 47 bool copy;
@@ -65,6 +70,24 @@ static int run_test(struct pci_test *test)
65 fprintf(stdout, "%s\n", result[ret]); 70 fprintf(stdout, "%s\n", result[ret]);
66 } 71 }
67 72
73 if (test->set_irqtype) {
74 ret = ioctl(fd, PCITEST_SET_IRQTYPE, test->irqtype);
75 fprintf(stdout, "SET IRQ TYPE TO %s:\t\t", irq[test->irqtype]);
76 if (ret < 0)
77 fprintf(stdout, "FAILED\n");
78 else
79 fprintf(stdout, "%s\n", result[ret]);
80 }
81
82 if (test->get_irqtype) {
83 ret = ioctl(fd, PCITEST_GET_IRQTYPE);
84 fprintf(stdout, "GET IRQ TYPE:\t\t");
85 if (ret < 0)
86 fprintf(stdout, "FAILED\n");
87 else
88 fprintf(stdout, "%s\n", irq[ret]);
89 }
90
68 if (test->legacyirq) { 91 if (test->legacyirq) {
69 ret = ioctl(fd, PCITEST_LEGACY_IRQ, 0); 92 ret = ioctl(fd, PCITEST_LEGACY_IRQ, 0);
70 fprintf(stdout, "LEGACY IRQ:\t"); 93 fprintf(stdout, "LEGACY IRQ:\t");
@@ -83,6 +106,15 @@ static int run_test(struct pci_test *test)
83 fprintf(stdout, "%s\n", result[ret]); 106 fprintf(stdout, "%s\n", result[ret]);
84 } 107 }
85 108
109 if (test->msixnum > 0 && test->msixnum <= 2048) {
110 ret = ioctl(fd, PCITEST_MSIX, test->msixnum);
111 fprintf(stdout, "MSI-X%d:\t\t", test->msixnum);
112 if (ret < 0)
113 fprintf(stdout, "TEST FAILED\n");
114 else
115 fprintf(stdout, "%s\n", result[ret]);
116 }
117
86 if (test->write) { 118 if (test->write) {
87 ret = ioctl(fd, PCITEST_WRITE, test->size); 119 ret = ioctl(fd, PCITEST_WRITE, test->size);
88 fprintf(stdout, "WRITE (%7ld bytes):\t\t", test->size); 120 fprintf(stdout, "WRITE (%7ld bytes):\t\t", test->size);
@@ -133,7 +165,7 @@ int main(int argc, char **argv)
133 /* set default endpoint device */ 165 /* set default endpoint device */
134 test->device = "/dev/pci-endpoint-test.0"; 166 test->device = "/dev/pci-endpoint-test.0";
135 167
136 while ((c = getopt(argc, argv, "D:b:m:lrwcs:")) != EOF) 168 while ((c = getopt(argc, argv, "D:b:m:x:i:Ilrwcs:")) != EOF)
137 switch (c) { 169 switch (c) {
138 case 'D': 170 case 'D':
139 test->device = optarg; 171 test->device = optarg;
@@ -151,6 +183,20 @@ int main(int argc, char **argv)
151 if (test->msinum < 1 || test->msinum > 32) 183 if (test->msinum < 1 || test->msinum > 32)
152 goto usage; 184 goto usage;
153 continue; 185 continue;
186 case 'x':
187 test->msixnum = atoi(optarg);
188 if (test->msixnum < 1 || test->msixnum > 2048)
189 goto usage;
190 continue;
191 case 'i':
192 test->irqtype = atoi(optarg);
193 if (test->irqtype < 0 || test->irqtype > 2)
194 goto usage;
195 test->set_irqtype = true;
196 continue;
197 case 'I':
198 test->get_irqtype = true;
199 continue;
154 case 'r': 200 case 'r':
155 test->read = true; 201 test->read = true;
156 continue; 202 continue;
@@ -173,6 +219,9 @@ usage:
173 "\t-D <dev> PCI endpoint test device {default: /dev/pci-endpoint-test.0}\n" 219 "\t-D <dev> PCI endpoint test device {default: /dev/pci-endpoint-test.0}\n"
174 "\t-b <bar num> BAR test (bar number between 0..5)\n" 220 "\t-b <bar num> BAR test (bar number between 0..5)\n"
175 "\t-m <msi num> MSI test (msi number between 1..32)\n" 221 "\t-m <msi num> MSI test (msi number between 1..32)\n"
222 "\t-x <msix num> \tMSI-X test (msix number between 1..2048)\n"
223 "\t-i <irq type> \tSet IRQ type (0 - Legacy, 1 - MSI, 2 - MSI-X)\n"
224 "\t-I Get current IRQ type configured\n"
176 "\t-l Legacy IRQ test\n" 225 "\t-l Legacy IRQ test\n"
177 "\t-r Read buffer test\n" 226 "\t-r Read buffer test\n"
178 "\t-w Write buffer test\n" 227 "\t-w Write buffer test\n"
diff --git a/tools/pci/pcitest.sh b/tools/pci/pcitest.sh
index 77e8c85ef744..75ed48ff2990 100644
--- a/tools/pci/pcitest.sh
+++ b/tools/pci/pcitest.sh
@@ -16,7 +16,10 @@ echo
16echo "Interrupt tests" 16echo "Interrupt tests"
17echo 17echo
18 18
19pcitest -i 0
19pcitest -l 20pcitest -l
21
22pcitest -i 1
20msi=1 23msi=1
21 24
22while [ $msi -lt 33 ] 25while [ $msi -lt 33 ]
@@ -26,9 +29,21 @@ do
26done 29done
27echo 30echo
28 31
32pcitest -i 2
33msix=1
34
35while [ $msix -lt 2049 ]
36do
37 pcitest -x $msix
38 msix=`expr $msix + 1`
39done
40echo
41
29echo "Read Tests" 42echo "Read Tests"
30echo 43echo
31 44
45pcitest -i 1
46
32pcitest -r -s 1 47pcitest -r -s 1
33pcitest -r -s 1024 48pcitest -r -s 1024
34pcitest -r -s 1025 49pcitest -r -s 1025