Received: by 2002:ac0:a591:0:0:0:0:0 with SMTP id m17-v6csp1571521imm; Fri, 6 Jul 2018 02:32:38 -0700 (PDT) X-Google-Smtp-Source: AAOMgpcO/+X+Qd84WAyO6Vvc3EktS8ZciGmV/4Y/EbwG8s0jPvGsGKIqDhpmlP5yscMnDn7ObjaK X-Received: by 2002:a63:b95c:: with SMTP id v28-v6mr2648821pgo.162.1530869558626; Fri, 06 Jul 2018 02:32:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530869558; cv=none; d=google.com; s=arc-20160816; b=mRWNMtmNyCUBovDHDmvRdZfz2ZjW5tcGE2+jtS3N0nQmgqwvToZG0fQlVckvZ9U/qn BPt0ov7x/OSbGGwoyOya78k9yggKrdUsUV/egZdoLnOk0K6nhhKsfPTXr3PpbvPOb3Me XR4InBR4ZgUq74c+8luwesd69Q+++4967iuqnolvl3UGHbY+ibTbtJ0puWz4C5c9gury dQ4Ke1tbD0tMvCv0kpptxnwUikTTzlap3ZEz22kp32bgtsUHdwPek7Lw1zpKLBaharfD 9fypoi+LgIwY5U4GoUFvgZyYDEhi0MxbfVS6sKEHWH7o6TOYWFQFH6Xho5X6GCWKTJgG eXhg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:in-reply-to :mime-version:user-agent:date:message-id:from:cc:references:to :subject:dkim-signature:arc-authentication-results; bh=WuQBGwKhJVWVJnEFkK0vHiHT+SH//QsytdFQS5H5wCg=; b=kljKE6wX6752scK59qaIOv543iES5+ZTYlKMpZsriBWRAbNwGMkHjAbQzP2DwlQnhD MKHzp50dNu5ZT3mpmgzbxZHU+Ixa0jUYPngnOy1d7qg83I2VgpbMofN9FwBfsDG+lHrQ geApXAtsW6h+ntERQV4Y3LoB26blrMnWFEjdfahwY/8li0FKDGXWDkEm+bYT4jXQnKkv HkEiBnmVAiuiQTUl5UW+0TbcrPxj8WOLQNI+gL+BxwEmu9MN1OnwUb0JdgiHbFHgl0ik Gwp2KHPcyRWk8C96oPwljwJgS5kkp+Az+8hYofvRwYjRwlIqP7mvS6reEmGCS8lJKb2R olkQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=wSweh9rG; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 70-v6si2059866pfz.72.2018.07.06.02.32.23; Fri, 06 Jul 2018 02:32:38 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=wSweh9rG; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753455AbeGFJbn (ORCPT + 99 others); Fri, 6 Jul 2018 05:31:43 -0400 Received: from fllv0015.ext.ti.com ([198.47.19.141]:51824 "EHLO fllv0015.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751659AbeGFJbk (ORCPT ); Fri, 6 Jul 2018 05:31:40 -0400 Received: from dlelxv90.itg.ti.com ([172.17.2.17]) by fllv0015.ext.ti.com (8.15.2/8.15.2) with ESMTP id w669VRl3119551; Fri, 6 Jul 2018 04:31:27 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1530869487; bh=WuQBGwKhJVWVJnEFkK0vHiHT+SH//QsytdFQS5H5wCg=; h=Subject:To:References:CC:From:Date:In-Reply-To; b=wSweh9rGYF94nSzxjyZFyIE7zD8iXmuW2urw8EWl54cVmgf7SZruISafua8PAGWEr w5R5LcMpa9zGR+SJMK252bW6Dm8hW+hI1w9yTBjqS3w9yVcvBwKTfLGPnD0Q8dzwyf NLYOuiJlm3LYOwl2n42jshv1TteNxs8J71vlblAY= Received: from DFLE106.ent.ti.com (dfle106.ent.ti.com [10.64.6.27]) by dlelxv90.itg.ti.com (8.14.3/8.13.8) with ESMTP id w669VQpQ026861; Fri, 6 Jul 2018 04:31:26 -0500 Received: from DFLE107.ent.ti.com (10.64.6.28) by DFLE106.ent.ti.com (10.64.6.27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1466.3; Fri, 6 Jul 2018 04:31:26 -0500 Received: from dlep33.itg.ti.com (157.170.170.75) by DFLE107.ent.ti.com (10.64.6.28) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.1466.3 via Frontend Transport; Fri, 6 Jul 2018 04:31:26 -0500 Received: from [172.24.190.233] (ileax41-snat.itg.ti.com [10.172.224.153]) by dlep33.itg.ti.com (8.14.3/8.13.8) with ESMTP id w669VMsT009715; Fri, 6 Jul 2018 04:31:23 -0500 Subject: Re: [PATCH v6 10/11] tools: PCI: Add MSI-X support To: Gustavo Pimentel , , , , , , , References: <67e6549e9d872b53406aeec86bdd78d6d29e036d.1529595907.git.gustavo.pimentel@synopsys.com> CC: , , From: Kishon Vijay Abraham I Message-ID: Date: Fri, 6 Jul 2018 15:01:22 +0530 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 MIME-Version: 1.0 In-Reply-To: <67e6549e9d872b53406aeec86bdd78d6d29e036d.1529595907.git.gustavo.pimentel@synopsys.com> Content-Type: text/plain; charset="windows-1252" Content-Transfer-Encoding: 7bit X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thursday 21 June 2018 09:31 PM, Gustavo Pimentel wrote: > Add MSI-X support to pcitest tool. > > Modify pcitest.sh script to accommodate MSI-X interrupt tests. > > Signed-off-by: Gustavo Pimentel Acked-by: Kishon Vijay Abraham I > --- > Change v1->v2: > - Allow IRQ type driver reconfiguring in runtime, follwing Kishon's > suggestion. > Change v2->v3: > - Nothing changed, just to follow the patch set version. > Change v3->v4: > - Rebased to Lorenzo's master branch v4.18-rc1. > Change v4->v5: > - Nothing changed, just to follow the patch set version. > Change v5->v6: > - Moved PCITEST_MSIX ioctl entry to patch #8. > - Moved PCITEST_SET_IRQTYPE and PCITEST_GET_IRQTYPE ioctl entries > to patch #9. > > tools/pci/pcitest.c | 51 ++++++++++++++++++++++++++++++++++++++++++++++++++- > tools/pci/pcitest.sh | 15 +++++++++++++++ > 2 files changed, 65 insertions(+), 1 deletion(-) > > diff --git a/tools/pci/pcitest.c b/tools/pci/pcitest.c > index 9074b47..af146bb 100644 > --- a/tools/pci/pcitest.c > +++ b/tools/pci/pcitest.c > @@ -31,12 +31,17 @@ > #define BILLION 1E9 > > static char *result[] = { "NOT OKAY", "OKAY" }; > +static char *irq[] = { "LEGACY", "MSI", "MSI-X" }; > > struct pci_test { > char *device; > char barnum; > bool legacyirq; > unsigned int msinum; > + unsigned int msixnum; > + int irqtype; > + bool set_irqtype; > + bool get_irqtype; > bool read; > bool write; > bool copy; > @@ -65,6 +70,24 @@ static int run_test(struct pci_test *test) > fprintf(stdout, "%s\n", result[ret]); > } > > + if (test->set_irqtype) { > + ret = ioctl(fd, PCITEST_SET_IRQTYPE, test->irqtype); > + fprintf(stdout, "SET IRQ TYPE TO %s:\t\t", irq[test->irqtype]); > + if (ret < 0) > + fprintf(stdout, "FAILED\n"); > + else > + fprintf(stdout, "%s\n", result[ret]); > + } > + > + if (test->get_irqtype) { > + ret = ioctl(fd, PCITEST_GET_IRQTYPE); > + fprintf(stdout, "GET IRQ TYPE:\t\t"); > + if (ret < 0) > + fprintf(stdout, "FAILED\n"); > + else > + fprintf(stdout, "%s\n", irq[ret]); > + } > + > if (test->legacyirq) { > ret = ioctl(fd, PCITEST_LEGACY_IRQ, 0); > fprintf(stdout, "LEGACY IRQ:\t"); > @@ -83,6 +106,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 +165,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:i:Ilrwcs:")) != EOF) > switch (c) { > case 'D': > test->device = optarg; > @@ -151,6 +183,20 @@ 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 'i': > + test->irqtype = atoi(optarg); > + if (test->irqtype < 0 || test->irqtype > 2) > + goto usage; > + test->set_irqtype = true; > + continue; > + case 'I': > + test->get_irqtype = true; > + continue; > case 'r': > test->read = true; > continue; > @@ -173,6 +219,9 @@ 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 \tMSI-X test (msix number between 1..2048)\n" > + "\t-i \tSet IRQ type (0 - Legacy, 1 - MSI, 2 - MSI-X)\n" > + "\t-I Get current IRQ type configured\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..75ed48f 100644 > --- a/tools/pci/pcitest.sh > +++ b/tools/pci/pcitest.sh > @@ -16,7 +16,10 @@ echo > echo "Interrupt tests" > echo > > +pcitest -i 0 > pcitest -l > + > +pcitest -i 1 > msi=1 > > while [ $msi -lt 33 ] > @@ -26,9 +29,21 @@ do > done > echo > > +pcitest -i 2 > +msix=1 > + > +while [ $msix -lt 2049 ] > +do > + pcitest -x $msix > + msix=`expr $msix + 1` > +done > +echo > + > echo "Read Tests" > echo > > +pcitest -i 1 > + > pcitest -r -s 1 > pcitest -r -s 1024 > pcitest -r -s 1025 >