From patchwork Wed Dec 11 20:57:37 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 13904212 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 79E8DE7717D for ; Wed, 11 Dec 2024 21:12:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:MIME-Version:Cc:To: In-Reply-To:References:Message-Id:Content-Transfer-Encoding:Content-Type: Subject:Date:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=MQ34FODL+rWvjEXX2BjWCcNtXyZaoeDOc5977Me123c=; b=klORyufT+WdwxAVSTSECeCanUY koV/f0pBqd6xKe5i5SVi0yY6gDDQW9nslFbFGKYR+GpTgoqScZnWFz7tGwSOxtSNGjPmtRpdHsk+b fEaZXUbzl1x+CE1edqkGdN6M6MdgbmqgnN1QiI+f71gHq4i/bCrivtBMWXzpb0AzHcTkApIgHnSvj eZmnkIdGtAxrTPYY1JnfDhe9Z+guUfUiiOPQHp42D6gwTI+Ib48Ym7WEiBhpmvBWNqbV29nrmno8/ N62V+gtOWnSk9s6d1gYXIRzoWUSurDIzM6Ttvj6JkAS6xYHuK76pW0CshQFRFb9XA65YeHHaT3g0o aCuE2/cg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tLU0V-0000000G8ta-1aMu; Wed, 11 Dec 2024 21:12:31 +0000 Received: from mail-dbaeur03on2060c.outbound.protection.outlook.com ([2a01:111:f403:260d::60c] helo=EUR03-DBA-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tLTmv-0000000G5n5-3MZ7 for linux-arm-kernel@lists.infradead.org; Wed, 11 Dec 2024 20:58:30 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=ogpN0wttNWCz5UQFWsjrq73gWObgToDadaTKTQfrS2mYPAFkXY15I1LLrdHhllhOVWtNyi6GhRaPZd5RS/eDwxXSgKUGI9jsi9GMKUUb7M+UMVNg+RS/B7X1AYijs1gmrTrWM1VrHpD8Kpj6xw6S4XONH0w806AS2DO+IzCcV++ULB95jk8Ipla7ERaLEVi+8HmDcURLRx/2IsWcbh/C8O+K9XdSUAUbbOKyX7CoVNbN2pnWNxS8VdoaR3xZPTWyKGz48l58PGeSmt3WH6pcz1RmKmTp6cPk4e/13QIC9VtIiVIer3R4+w6e5uuJ77iq/i/RGPuq4p64Q5hdp7Hktg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=MQ34FODL+rWvjEXX2BjWCcNtXyZaoeDOc5977Me123c=; b=sMnXMwAvjNR+QWA1x0aDUGzcj+cYparvKTQENJ0ACnv9muExQHt9tlVPsh50j/68n4Dmjes6IsE2W9gOmH6O7pKYJnlPco9To6U8XeXNKmo+ARxp8+HTcmARM7MqnOdzY8a2RR6Wyonu9FjpmKjfBMSRDymXdhEQFai7GOtjHFmWdcoxVc+PHksSuC8Y0k72wfO7loKI+A5PLPHXd1DJF4T7nNisZZuhRrOnla+FESwNnZ6lFsqEAYJvdxm/3aGUO18oZFW1W6/sTwakYjLfeQHEAsFbD/FdZm/6iQKmxwlg9vjk/EQrux96BVXvu7PvSEHtp+sxLn+dYcYnoyBuiw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=MQ34FODL+rWvjEXX2BjWCcNtXyZaoeDOc5977Me123c=; b=mL1ASNKso2qgrThMujzMRmg+cHSGlTax23hthvA3EiC9T2qwR7H6c3hl6t4/RBdkQ5ZYo4kbndtP4Jm+coknIwOV6F8gGuCcrDwawGg3VGXLYXl6dPAtN11gNdo4m7Aa3GTECQI4QS9KSjDOYPFRt9nRLo7oiyQekGmZ58ALZt4MFKDH3IB0BGLgqtsQitmAPLOJWmc8YogLN6YMdYLQrSoToAnsTplcobE5A7KYn09H7Q1JICHpRaCV3ifyRKONYBzOwrTVGFN7J/B50OYh8DiK2PN/PsvwXYwIO4NW4tjCkU+HtV6V/6Qth+QCtxhmMEhKJyZllOXuObXcmw3NNg== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from PAXPR04MB9642.eurprd04.prod.outlook.com (2603:10a6:102:240::14) by AM0PR04MB7139.eurprd04.prod.outlook.com (2603:10a6:208:19d::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8251.16; Wed, 11 Dec 2024 20:58:26 +0000 Received: from PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::9126:a61e:341d:4b06]) by PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::9126:a61e:341d:4b06%5]) with mapi id 15.20.8230.010; Wed, 11 Dec 2024 20:58:26 +0000 From: Frank Li Date: Wed, 11 Dec 2024 15:57:37 -0500 Subject: [PATCH v12 9/9] tools: PCI: Add 'B' option for test doorbell Message-Id: <20241211-ep-msi-v12-9-33d4532fa520@nxp.com> References: <20241211-ep-msi-v12-0-33d4532fa520@nxp.com> In-Reply-To: <20241211-ep-msi-v12-0-33d4532fa520@nxp.com> To: Manivannan Sadhasivam , =?utf-8?q?Krzy?= =?utf-8?q?sztof_Wilczy=C5=84ski?= , Kishon Vijay Abraham I , Bjorn Helgaas , Arnd Bergmann , Greg Kroah-Hartman , "Rafael J. Wysocki" , Thomas Gleixner , Anup Patel , Marc Zyngier Cc: linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, imx@lists.linux.dev, Niklas Cassel , dlemoal@kernel.org, jdmason@kudzu.us, linux-arm-kernel@lists.infradead.org, Frank Li X-Mailer: b4 0.13-dev-e586c X-Developer-Signature: v=1; a=ed25519-sha256; t=1733950663; l=1851; i=Frank.Li@nxp.com; s=20240130; h=from:subject:message-id; bh=mJBGb3x/IT3kU6QxbS0pDIxty8JwWoRws5fh7D2yIVI=; b=QFLvfupamU6j1m6GC7+ti6gAF9Lji2I/ymk1eSE3p5fzudCDf3+vupHDN3ZmLnRNTbtBXTsSI 3K+V2/zfZ5zBNOmUiQmemeCheOGXGKqBO+y2GZeNxfCCsQtQZgB5XU9 X-Developer-Key: i=Frank.Li@nxp.com; a=ed25519; pk=I0L1sDUfPxpAkRvPKy7MdauTuSENRq+DnA+G4qcS94Q= X-ClientProxiedBy: BYAPR01CA0037.prod.exchangelabs.com (2603:10b6:a03:94::14) To PAXPR04MB9642.eurprd04.prod.outlook.com (2603:10a6:102:240::14) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB9642:EE_|AM0PR04MB7139:EE_ X-MS-Office365-Filtering-Correlation-Id: 83310109-7cd7-4036-3e4d-08dd1a268edb X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|52116014|376014|1800799024|7416014|366016|921020|38350700014; X-Microsoft-Antispam-Message-Info: =?utf-8?q?vFVV0o9Hq1dLMOrQwLLHRfrHMUou7vN?= =?utf-8?q?bAZYJjjyVUpr5YQ+I1T8PYGw+T+ZofQ3bpb/pDcHe96gcmiLwhPPu9DEIoZXH4b4l?= =?utf-8?q?kqt16F6WrZibm76WUw+Fq0jQOPdg0orde6Osm2zZSdH6ACriaB9aI1r3S49I/phWr?= =?utf-8?q?aVzPaIwoyqr2rzNijwEoxGaXb/zW5oxm5tiAzyEwVlPBDVEdPKDpqzS7eXkexhgFd?= =?utf-8?q?MXaqANa59M4UAhtq75UKRbjcMati2Mer2QoHqlgGdR8da6ZSnO56SjbH68WyaeEdE?= =?utf-8?q?3rK8L3w0ItLfMkXPNDP3um3Lzzz4ilSEWk9BqGkrsMgFWXxmWi7pQnVVHYgB7Ox3M?= =?utf-8?q?UcPqdpaSGD51T6dCU4IytjGuzvzGEOWFucwBkTHL/GzhfJ9jvLBN4hcPl4mOLsnth?= =?utf-8?q?eNLip1BkUjjGgMV7XJ38rhNlzumF/IWNhsyj4Ucnf8LTlQMew/YDuqK3iXLLLOIwT?= =?utf-8?q?rGmXQk4CBCX4kfotC8+Xds0KBF12EmU268eods5B/HbiGat2JOQY1hNKS8wBg/Scl?= =?utf-8?q?XiT7aHuzP3Tk1sZ8XdRl1WCApgVos35t1s5PldPWg9S7KP0NYLEQX4uu12lc00+hi?= =?utf-8?q?ZbMuDd0dGcTttcs1tX7jWlFY1zaw8zYJTCAu/hT2slGcLWPyorfZL5LnMvy+qcszn?= =?utf-8?q?pGqY7pr2olrpvwa8t2c2PITcahlvrU+LGh5y43+9F+cUKldYoiZdWU0LP77sbMPnQ?= =?utf-8?q?s/ldv5c/i1SAhUoEioiXJXsCdz7c3I7kmILb0M0scBeiUk6HBQY7oyClI+sug07gi?= =?utf-8?q?atb92s/Zcrp0p0ZJ0qRSl9bYPWqqAwLLkPMLiRBIyo5+MeCGxYqvpfn5tn3NurCj7?= =?utf-8?q?QGQQ+Ci9mYubl3XIct2ctco2JwKqsFr84Woujp/yZZ5st/kciDOCidsRNmDFTishn?= =?utf-8?q?Pw+v75Ol/5icdKWrYba6yX/ZmZ5AdwfieFXTGYAZaieCkQ4bWtgdaCFDXg1yLcXeg?= =?utf-8?q?2jsDTiMkvX111SxiTc69q8lva2+T8VGJ4DlR9iBWFmCKlFXkdw/O8oSc0LBoSV/Qp?= =?utf-8?q?25Iwtniic9eFqLw80WGTD2Woyt+32O1L4MgsKEkNU+AR+oSO5p6qx9cJ8Jgyw1cV1?= =?utf-8?q?0tQrVxb54yResq8tvJFGa77vI6Q/IU/5Fad3Sw5nZ23/RO+V54pdRKqATHBVHlrvF?= =?utf-8?q?2B5csI18CiVV+Mj09+TLYZ+cIcp8wgZx3XHAF2sXtF0ZWMCNk5geazahvQS1ZnEVf?= =?utf-8?q?T3Jb65txYH/zHpNmcrsIeSNCDhjM+WSfKh0CJGnFMSxrTa1xhzQCHjsf8jhzA8RrW?= =?utf-8?q?RACRi53sN85YDsLsAFKyES10UGnpmtceEHVmWK5m5D/DlbPzuovG4WYanBq0ljVRb?= =?utf-8?q?Qjo3RnHpKvRzaGlQlJUBhg6ij/STgz6IWhxk+2dsml0xkfmKhjRFLT4=3D?= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PAXPR04MB9642.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(52116014)(376014)(1800799024)(7416014)(366016)(921020)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?xQbjasFv14VNZhM9quxPQR2qAwxs?= =?utf-8?q?ZBcRYx42I7qLwjnu+rYxNxzVjRYOg7E7w++SBJ5SN4viitu6fSTAN95XRBIm5Ucha?= =?utf-8?q?Rrdyq0sIPnzFvsttcqtJ8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UAM0a0wftgTPCd97fIlt+EtXLV?= =?utf-8?q?x0+SGMCE8f4kJAfNjDb4Odtx+jrrMHuDPpeAx8epjM/hNBxtB305H1DhkgRI/76Oy?= =?utf-8?q?4N1hcnjCj19bZQd0hDg3qt4B5O/jAOUn9vd1oioE0voXvQK0yzTA4jcVUvlFOMhpP?= =?utf-8?q?kpR/YRon+zg+ALxJySRHkZjSGS+uNWGN5bNGS+nvin8OdmpVq7ftYiX9l+UrTUDkI?= =?utf-8?q?DyQPgPqC1n+ECZ4kF1QJYRQ83xIRp4pel/vLTwFxfXqtnRwB3Ccna/vMHMZ6BJLBs?= =?utf-8?q?ssildWnbSpRrUTF2o/wneeWkw1GzyHfUsEUikcwTMrnnCU70cFK0h3IguEOcFMiX9?= =?utf-8?q?/zbz8DbV5hK3wiCevuLSm0dDNlaQUPInQ1RxS/hQkz1oS+lBnwy+b0+64B4lTPjr1?= =?utf-8?q?1RwsS0UtsIR0ijpsbsU35Ne/Qzdletlyn+yg9kpsVibgM2vF+PvlIR8LhKjFyQx+X?= =?utf-8?q?9owiG/m+XnmHh5jT45kA0hch7SE9OMYhx/7IGxxrgL3QYhh/f3lUWvVraTNsV7uA5?= =?utf-8?q?o19gN/9cL2gz?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 83310109-7cd7-4036-3e4d-08dd1a268edb X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9642.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Dec 2024 20:58:26.6438 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 1mlrP60UE2o5Qo0UxGw6QTaE2cUh1weyHkujOFprdYB/Gh5oHGN2aI1ypgSurTzsokoymrsBfiUUQwmBvana6g== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR04MB7139 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241211_125829_845590_D423F617 X-CRM114-Status: GOOD ( 13.87 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Add doorbell test support. Tested-by: Niklas Cassel Signed-off-by: Frank Li --- Change from v3 to v12 - none --- 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 7b530d838d408..fcff0224a3381 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 of buffer {default: 100KB}\n" + "\t-B Doorbell test\n" "\t-h Print this help message\n", argv[0]); return -EINVAL;