Re: [RFC 10/10] tools: PCI: Add MSI-X support
Hi Alan, On 24/04/2018 10:57, Alan Douglas wrote: > Hi Gustavo, > > On 10 April 2018 18:15, Gustavo Pimentel wrote: >> 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 >> --- >> include/uapi/linux/pcitest.h | 1 + >> tools/pci/pcitest.c | 18 +- >> tools/pci/pcitest.sh | 25 + >> 3 files changed, 43 insertions(+), 1 deletion(-) > I found some possible problems when testing with the Cadence EP driver. The > problem > is that pcitest uses the BARs for tests, but we also use one for the MSI-X > tables > > In Cadence core the MSI-X table is in BAR0 by default, but this is configured > to a size > of 0x80 in the test driver, since it is used as the test_reg_bar. So, I > changed the > configuration to use BAR4 instead, which is configured to a size of 131072 > in pci-efp-test.c, and this gives me enough space. > > However, if I run the BAR tests in pcitest before running the MSI-X tests, the > MSI-X tests fail, since the BAR content is overwritten. It's not a problem > with the > scenario in pcitest.sh, but it would be if the module wasn't re-loaded. > > So, wondering if we need to come up with some mechanism to specify that a > specific > BAR will be used for MSI-X, and that its size and content shouldn't be > modified by > pcitest? I see your point. I have bypassed the problem by doing the module load/unload (to avoid having to fight on multiple fronts). I like your suggestion. Maybe we could have a bool variable for each BARs that could be set to false if a resource have intent to use it. However this change must be accepted by Kishon. > > Regards, > Alan > Regards, Gustavo -- To unsubscribe from this list: send the line "unsubscribe linux-doc" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
RE: [RFC 10/10] tools: PCI: Add MSI-X support
Hi Gustavo, On 10 April 2018 18:15, Gustavo Pimentel wrote: > 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 > --- > include/uapi/linux/pcitest.h | 1 + > tools/pci/pcitest.c | 18 +- > tools/pci/pcitest.sh | 25 + > 3 files changed, 43 insertions(+), 1 deletion(-) I found some possible problems when testing with the Cadence EP driver. The problem is that pcitest uses the BARs for tests, but we also use one for the MSI-X tables In Cadence core the MSI-X table is in BAR0 by default, but this is configured to a size of 0x80 in the test driver, since it is used as the test_reg_bar. So, I changed the configuration to use BAR4 instead, which is configured to a size of 131072 in pci-efp-test.c, and this gives me enough space. However, if I run the BAR tests in pcitest before running the MSI-X tests, the MSI-X tests fail, since the BAR content is overwritten. It's not a problem with the scenario in pcitest.sh, but it would be if the module wasn't re-loaded. So, wondering if we need to come up with some mechanism to specify that a specific BAR will be used for MSI-X, and that its size and content shouldn't be modified by pcitest? Regards, Alan -- To unsubscribe from this list: send the line "unsubscribe linux-doc" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[RFC 10/10] tools: PCI: Add MSI-X support
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 --- 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 { charbarnum; boollegacyirq; unsigned intmsinum; + unsigned intmsixnum; boolread; boolwrite; boolcopy; @@ -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 PCI endpoint test device {default: /dev/pci-endpoint-test.0}\n" "\t-b BAR test (bar number between 0..5)\n" "\t-m MSI test (msi number between 1..32)\n" + "\t-x 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 majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html