From patchwork Tue Nov 12 17:48:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 13872704 Received: from EUR02-DB5-obe.outbound.protection.outlook.com (mail-db5eur02on2068.outbound.protection.outlook.com [40.107.249.68]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7443021764E for ; Tue, 12 Nov 2024 17:48:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.249.68 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731433740; cv=fail; b=r+Odyx/ekypnxUcjEzoDl60IBqxriJQB7HCjH+TrYQVmiF2dmyIJ2Ond+oQ0L/ZyxpZg3dCyCg8yh3JC5SP4vzDQCYeQsQ6QVLYXUKJGpzmiJaCw4o/cdhJX+ULGYspzr9sBLCb7EpUA/lI1l/DQ60MQyJ7HNTVWBS4k/enVf8E= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731433740; c=relaxed/simple; bh=rzBqaC20gv5zajeNqMjcGQwQsIkiSRC77uox8VWftBw=; h=From:Date:Subject:Content-Type:Message-Id:References:In-Reply-To: To:Cc:MIME-Version; b=BNzy2toFU0F0IMH1cnprpSeIhJ7vHaPVGrHDsfTSZ4aHuYIUKmnnViNDIbU8ve8uL8OJHM4KDiIHbrV1A827JW9F+UbxOCCb4cZ5JIzRvC604i8wlWVQXRRXRUFmBpYkC9yFc6WKWwp7WINQM4CqOcrEwoTPz3gYLavSjPNF4Yo= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com; spf=pass smtp.mailfrom=nxp.com; dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b=B+n51rI4; arc=fail smtp.client-ip=40.107.249.68 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nxp.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b="B+n51rI4" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=tDaJTbh7ig3+VMhGSjYy0AUCDQY9Gxb2HrmZ0UPd86shbs3KNg5/MVrVj5QIiKOSxyylrJQN0ZFnsogAIdk2IvhqyhpRdKOieaFPWLPoJN8XqfmHktb0Zw4hjPf7Yfpq7+nlVOXe+BFKgVWkFhi2iuy89tXSU96p8BF/nyOj5FrMEOUCMxmukYftt7W8gDYK5LyZNoA9YEAFLAZuPRmE6jJ5QUm6MhDnwKzkikIzVm8yoCWXpY1ZYQo3M8DQWMbn0At0ZMSHS9Ci4hxakVkGw2aa7+9ConcgNUT2F4RDEo8JkbRGRe45NdEZAOCn2aAF5IvBLWpQUsg4kOdnHrVXjQ== 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=kBY2RxtR8ubrdRv0IDfaOqn0Ih86F4aKaUUYok1m864=; b=UtBAsphfxsfgxHNQfVQSxPeGfUPRdye+Vb4e/EwP3gG3CsnNN09sUhFfU3vo9SirEpuu3Irdqv3+0lWcSIgfg4PvoersruE211ZrJOGm87Nmhw4/PbBSeReTvc23khGuzDzfmwn031xkeGT8svYZcKaWM9+WeKUxjI8tbKAAygAM/D9/e7oSh0DeNA4o5jGAOYAYKSmsV/wH7jVWaX25KccdWFtIfKqf51y6MjQ62yuw4sVpvrjHLIonB9Wir7EdTx92Eww/7Ar7pVJRxUv5tHRjMLJeyRcuWYo+23IMIhUgyYtixYc0mNDBgyJvWhTjTgneG1hF5hmUz0/sB9pE8Q== 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=kBY2RxtR8ubrdRv0IDfaOqn0Ih86F4aKaUUYok1m864=; b=B+n51rI4FCqYkSq35UH4v/6UT/YT8agBmql3B9vIXAjKf+eoPIMqZR9TC0HAX8osZXujAyU1R5hHBFC9V8MKYv/Xvbf46k36BGMErZzdA44CB2gLCG4odBPuCMdC4nICv8NXTrltV4xuA4GIPj17v0vbFUd295o6fNa+B7H+V2ro4+n0Qe6AmqDvHYXDc5+nSTIL7nrlgMRYNiHHAcAnQjTn8shr3KsDLhwpo/g0boV+DJpAwHbvXWeeXtp7YHvAlgAmrH7G5FCn3IgNRS5RGh5VO1Q3PKKu12vdPZr7Q3etLc2BQupd9a4Nn1M0EbAaG+sOY0meWnW0fP1FaJMJhQ== 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 AS8PR04MB9510.eurprd04.prod.outlook.com (2603:10a6:20b:44a::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8158.17; Tue, 12 Nov 2024 17:48:54 +0000 Received: from PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::9126:a61e:341d:4b06]) by PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::9126:a61e:341d:4b06%4]) with mapi id 15.20.8137.027; Tue, 12 Nov 2024 17:48:54 +0000 From: Frank Li Date: Tue, 12 Nov 2024 12:48:18 -0500 Subject: [PATCH v6 5/5] tools: PCI: Add 'B' option for test doorbell Message-Id: <20241112-ep-msi-v6-5-45f9722e3c2a@nxp.com> References: <20241112-ep-msi-v6-0-45f9722e3c2a@nxp.com> In-Reply-To: <20241112-ep-msi-v6-0-45f9722e3c2a@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 Cc: linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, imx@lists.linux.dev, Niklas Cassel , dlemoal@kernel.org, maz@kernel.org, tglx@linutronix.de, jdmason@kudzu.us, Frank Li X-Mailer: b4 0.13-dev-e586c X-Developer-Signature: v=1; a=ed25519-sha256; t=1731433711; l=1850; i=Frank.Li@nxp.com; s=20240130; h=from:subject:message-id; bh=rzBqaC20gv5zajeNqMjcGQwQsIkiSRC77uox8VWftBw=; b=5FmLkMranxnVo7GgjBazbOI4ML8SkJP0I+HYFwOFwUaNYE3Fy66ZH1fXI8Hq9cxnin7N46eBE hZZgOxH2tjhBVUHstusghXmo45HX7PbYV1p3KYRFwsCNQx97iOXMPkL X-Developer-Key: i=Frank.Li@nxp.com; a=ed25519; pk=I0L1sDUfPxpAkRvPKy7MdauTuSENRq+DnA+G4qcS94Q= X-ClientProxiedBy: SJ0PR03CA0076.namprd03.prod.outlook.com (2603:10b6:a03:331::21) To PAXPR04MB9642.eurprd04.prod.outlook.com (2603:10a6:102:240::14) Precedence: bulk X-Mailing-List: imx@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB9642:EE_|AS8PR04MB9510:EE_ X-MS-Office365-Filtering-Correlation-Id: 617b773c-ec7c-461d-8b18-08dd034246c0 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|376014|7416014|52116014|366016|38350700014; X-Microsoft-Antispam-Message-Info: =?utf-8?q?NRI6sgg7HZ3rNznoE0raLqdaNScA8Nx?= =?utf-8?q?nwbg+3N0BUO/9zdDZ2Y8ELbIZnJuziQyB82lsTvDi2gwH5lriD9EwLYC1q+A/QD5y?= =?utf-8?q?D+fh0WcxvEPeVH5n/pYYGTBe0nqVVHh4tE0D5DLEf82hwpZPArZulxNK0VUzC4zDl?= =?utf-8?q?pVjmJQxssHl0ujVY9lVP9y+tIxE6HifJYgqhCMnwQN/tqDvlolpPUilUfoGrUOmG7?= =?utf-8?q?DDqrClW44lNQ6OvuIbgaWKFUKXfv1d1TlqLpC6KUyqm00Zt5GWSj/8Uk9v4+/TX8i?= =?utf-8?q?THeH4/7tuJmhRrvSrclCAyEuvgM78SNYAVWaDTvStwKQs1mz7qZwXEUsc3rTVpIe/?= =?utf-8?q?qHF4helspPWhL0/BWs5nLxmktu/6n7B6kpnPr/8eihWAWDDS37CePiP/w5MRWnpa9?= =?utf-8?q?Y0gPG2j9RIOEccBzkuDbfWPCsKThxZQ7SqVwcfeQBHHSdR8w2IihYFnSD+NqRvjgS?= =?utf-8?q?nBVAsH63AXOSOfGiF8GfWTu71YU6aIVFnFEOPBhEiWF6kFJIOX2AywVat7mJJBp2O?= =?utf-8?q?VxVHmuhE3V5h4KXOBchFExX0eT1PwLOqyx43XTcsMbiQkL7WK2q+BbIz41otroKIO?= =?utf-8?q?RRi9xenhIydnN3ZlTz9nN7syr+Pbk/Ft078OVhpFQGCdyr0DRPM9mVAshM1bO5a7z?= =?utf-8?q?KCycmmTx2xuQwAuXMC1+0WLJH0nucwhqSqdPrT4P7PQDGcTbh7uqgut39CfNvHjnP?= =?utf-8?q?4OSXOGA1J10Lon1DvDmge8KTkp4hcCwuUE/85qWmYP2t+lJD15oG3Bw1IGkDqmgEF?= =?utf-8?q?b9SfwPOimOR/BWT52Nn8gKhrrky/ylrlXpW2M7NBcMF+78cqoJqCUh8l37E4nwVMB?= =?utf-8?q?6NzxFvGyBPrrxD+4eIJU6cbBXaxYpUStZhJY6UuJj8278RecbeOzAGunhksxCnRtu?= =?utf-8?q?x1SbLMy0QorHvJnu9E65VEfSzDZu0yjCu/IyDfML6xNeHV8FtxxdyaY+X10/Vjzb1?= =?utf-8?q?9tXtlntvMG/Ho7JlfmgyOzeSimbQdVXks5UH8vTt9nOr9rDNXoJyhiA8J+a87OL61?= =?utf-8?q?uTnCajzPk8N62hJa4ozBuST1XUXrCopM28MzJTUns78W8sXBcY2qTQXAysH0OBJ1p?= =?utf-8?q?b8/k3MG0V2mEN2E8Eeh76WACP2vosMM/Hlwl0qYqa2AVdaXYrUV1TKFswIZhT0Wok?= =?utf-8?q?IWP3QwpjHxa3p9XMhLQCX0bEJQ2WcqPxw26ESs167TGCXURBGTPdfy4hWbxaCbqTk?= =?utf-8?q?HMewh6i94GEo06la1HnVWs6AwClfM80E3EnCzZA88MeuXz2TrWO9MA/xIuQwKyOT2?= =?utf-8?q?JwKJ0494X0DJtfolglFeJoWV121mKzaCD0p68U4EdSH9UM+toazeTCBA=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)(1800799024)(376014)(7416014)(52116014)(366016)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?0RfIRLTklnFPyjw64dEu++jRbFMu?= =?utf-8?q?Pic4tNNnqsZZF4BqPii9nYK6YysSXHs5qCQBBryl1ObXfJefb8kNkoE0E1kNBYijA?= =?utf-8?q?Iau/V5SPdUm7lpqID/xCJG8nHXpNE2JqDYtHJQMUQ/LnJ9JjpAwOk9MCXZ2DSU0Ia?= =?utf-8?q?CdtU+MDfiNgJqQlFAQCWq+kdxJX5azbogCPzttQQJrb8k4cw+I7uOqu+MK6VJ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-8?q?YGGhOKEbzFWV9Z1zwiS7oWwvTkG3dGG7mrHGEoBa7hEToSH/q9f7AZUbEPvV5NnFE?= =?utf-8?q?uRKOCVO9k+pptQ3kLM5L5jrJ+nhZlKcyUmt8GOH4vkj2AiJiY7OJ/qjqw6EU2HchN?= =?utf-8?q?/K/+1sXVY/Ah084n3h8ZRNr947hXk1Qm+9Z3FO36tVeozpZNtQ5WBMouhCAWulB9Y?= =?utf-8?q?m8txSJ4XFScpqEb2aGzHs1aIlypVp+nqcfjeilriZz/dZU+mxZQs8wax07XY48rup?= =?utf-8?q?/Tfz1Svl+MBF/TZsUMe9TD2dg5mQYL3IFdC+xszbf7hSn24wJyntGiignLG4L1VE3?= =?utf-8?q?e5PVOjMIpSspg6zkUKD987um8b7s07tgIw+2uf2T6z2WjsZFnNLAGvL9jVqjOJ9gk?= =?utf-8?q?ex5+bkPTT1FwsMeMPAVGWf2VXbmHgh/HXEbM6GmX3Bw1aFij+2LxoqYc=3D?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 617b773c-ec7c-461d-8b18-08dd034246c0 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9642.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Nov 2024 17:48:54.7259 (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: k0AOf9R8RwFvzpKJ/zK0Ej/MA9jIrmsjA+HfUQfUf/x2rpVocFgS9MI9RscyAmokBTAaNl7sLKBU5sdTg/iwuQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB9510 Add doorbell test support. Tested-by: Niklas Cassel Signed-off-by: Frank Li --- Change from v3 to v6 - 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 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 of buffer {default: 100KB}\n" + "\t-B Doorbell test\n" "\t-h Print this help message\n", argv[0]); return -EINVAL;