linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Frank Li <Frank.Li@nxp.com>
To: "Manivannan Sadhasivam" <manivannan.sadhasivam@linaro.org>,
	"Krzysztof Wilczyński" <kw@linux.com>,
	"Kishon Vijay Abraham I" <kishon@kernel.org>,
	"Bjorn Helgaas" <bhelgaas@google.com>,
	"Arnd Bergmann" <arnd@arndb.de>,
	"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>
Cc: linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org,
	 imx@lists.linux.dev, Niklas Cassel <cassel@kernel.org>,
	dlemoal@kernel.org,  maz@kernel.org, tglx@linutronix.de,
	jdmason@kudzu.us,  Frank Li <Frank.Li@nxp.com>
Subject: [PATCH v3 6/6] tools: PCI: Add 'B' option for test doorbell
Date: Tue, 15 Oct 2024 18:07:19 -0400	[thread overview]
Message-ID: <20241015-ep-msi-v3-6-cedc89a16c1a@nxp.com> (raw)
In-Reply-To: <20241015-ep-msi-v3-0-cedc89a16c1a@nxp.com>

Add doorbell test support.

Signed-off-by: Frank Li <Frank.Li@nxp.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 470258009ddc2..bbe26ebbfd945 100644
--- a/tools/pci/pcitest.c
+++ b/tools/pci/pcitest.c
@@ -34,6 +34,7 @@ struct pci_test {
 	bool		copy;
 	unsigned long	size;
 	bool		use_dma;
+	bool		doorbell;
 };
 
 static int run_test(struct pci_test *test)
@@ -147,6 +148,15 @@ static int run_test(struct pci_test *test)
 			fprintf(stdout, "%s\n", result[ret]);
 	}
 
+	if (test->doorbell) {
+		ret = ioctl(fd, PCITEST_DOORBELL, 0);
+		fprintf(stdout, "Ringing doorbell on the EP\t\t");
+		if (ret < 0)
+			fprintf(stdout, "TEST FAILED\n");
+		else
+			fprintf(stdout, "%s\n", result[ret]);
+	}
+
 	fflush(stdout);
 	close(fd);
 	return (ret < 0) ? ret : 1 - ret; /* return 0 if test succeeded */
@@ -172,7 +182,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:deIlhrwcs:")) != EOF)
+	while ((c = getopt(argc, argv, "D:b:m:x:i:BdeIlhrwcs:")) != EOF)
 	switch (c) {
 	case 'D':
 		test->device = optarg;
@@ -222,6 +232,9 @@ int main(int argc, char **argv)
 	case 'd':
 		test->use_dma = true;
 		continue;
+	case 'B':
+		test->doorbell = true;
+		continue;
 	case 'h':
 	default:
 usage:
@@ -241,6 +254,7 @@ int main(int argc, char **argv)
 			"\t-w			Write buffer test\n"
 			"\t-c			Copy buffer test\n"
 			"\t-s <size>		Size of buffer {default: 100KB}\n"
+			"\t-B			Doorbell test\n"
 			"\t-h			Print this help message\n",
 			argv[0]);
 		return -EINVAL;

-- 
2.34.1


      parent reply	other threads:[~2024-10-15 22:08 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-15 22:07 [PATCH v3 0/6] PCI: EP: Add RC-to-EP doorbell with platform MSI controller Frank Li
2024-10-15 22:07 ` [PATCH v3 1/6] genirq/msi: Add cleanup guard define for msi_lock_descs()/msi_unlock_descs() Frank Li
2024-10-16  1:12   ` Damien Le Moal
2024-10-16 16:21   ` Thomas Gleixner
2024-10-16 16:33     ` Frank Li
2024-10-15 22:07 ` [PATCH v3 2/6] PCI: endpoint: Add pci_epc_get_fn() API for customizable filtering Frank Li
2024-10-15 22:07 ` [PATCH v3 3/6] PCI: endpoint: Add RC-to-EP doorbell support using platform MSI controller Frank Li
2024-10-16  1:36   ` Damien Le Moal
2024-10-16 15:03     ` Frank Li
2024-10-16 16:30   ` Thomas Gleixner
2024-10-16 16:54     ` Frank Li
2024-10-16 17:35       ` Thomas Gleixner
2024-10-15 22:07 ` [PATCH v3 4/6] PCI: endpoint: pci-epf-test: Add doorbell test support Frank Li
2024-10-18 14:01   ` Niklas Cassel
2024-10-18 14:05     ` Niklas Cassel
2024-10-18 15:13     ` Frank Li
2024-10-20 14:41       ` Niklas Cassel
2024-10-21  6:55         ` Niklas Cassel
2024-10-21 16:17           ` Frank Li
2024-10-15 22:07 ` [PATCH v3 5/6] misc: pci_endpoint_test: Add doorbell test case Frank Li
2024-10-15 22:07 ` Frank Li [this message]

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=20241015-ep-msi-v3-6-cedc89a16c1a@nxp.com \
    --to=frank.li@nxp.com \
    --cc=arnd@arndb.de \
    --cc=bhelgaas@google.com \
    --cc=cassel@kernel.org \
    --cc=dlemoal@kernel.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=imx@lists.linux.dev \
    --cc=jdmason@kudzu.us \
    --cc=kishon@kernel.org \
    --cc=kw@linux.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=manivannan.sadhasivam@linaro.org \
    --cc=maz@kernel.org \
    --cc=tglx@linutronix.de \
    /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 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).