From patchwork Fri Nov 8 19:43:32 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 13868880 Received: from EUR03-VI1-obe.outbound.protection.outlook.com (mail-vi1eur03on2073.outbound.protection.outlook.com [40.107.103.73]) (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 8CBF01F26EF for ; Fri, 8 Nov 2024 19:44:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.103.73 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731095050; cv=fail; b=SOaQwCxjQ7o9/wMd5ONrdKqKmHps2/vdAkPGhvSWX7kTFi1GQwuyaixGToTf4np0W+JJbeWeXqm4cZDXqcZAfzc6t5utd2hqcQKeTzmBZKtluD+BvdaFal5oBmiu7YGP3mT4J1lEdZBhzaIAKPwfucHKOg+2Upek+/ZKn8UwPrw= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731095050; c=relaxed/simple; bh=G/yY4CrPOouB+dXrLHUGTnxa+S7MToMCeY+wZ3vMPxk=; h=From:Date:Subject:Content-Type:Message-Id:References:In-Reply-To: To:Cc:MIME-Version; b=eXhrVZXTySf60qUPJJTv7WvjJ06koUGKtHBaPe5GNXCn8V8capBzltgtj1ELfYjZJ0OQDy+TpLSwr+93MsJQIJxztAtQJbojxnNkBeeg0yBKqJRpXQg4+38A9V6K4+mOnwarp/PMfhZfLsTne8dtm8X4SYswZyl/WA5tcuIOLzI= 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=oWno+ry7; arc=fail smtp.client-ip=40.107.103.73 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="oWno+ry7" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=Mm03sEtGVGeklBftXm/q+3KW71YQfG541i8vTv09+d4vERxFfnDHvFiA6W1r6EQnytMjLXVSlrixfp4op0TWpAtLno+QROPNu2WXSY51QU0smsH2LUNGGLb87uG6k2bqNLJ+9mhZmHK+fadaw7d3iEmxu2agd4zLkeR4VMnXOa7e1q1fKH9n3dVqFo5dqV7ARBAA03IJw1YlpMPA7ZMUG2GCBBFV63ChzpqOjeXDVHjlciBtBSXUmXyaPGaB143eTj1X1YYK69E+BUDeq7IMPQmVBL5C68/b/T8GpE7f32qnJzDFCc2a2BTzYYEkw1htTb/hrNr8hJNPCv51MC3iHg== 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=2yCmUQdPdUzzzBlVi0xn7vIIg3JeouJV/1R9GlTHoTA=; b=LRW3jSELVWlslW3ieYXmjJtGkCxuVJiskafB+th8HgnnC/VEK6zN1ufDY1+/akO7YtU6eOpT6MHDprMjWOOfSaLRi3QbDyss44z4l8ErVeNzmxgXG9Q2Nd6/ZglYvnogfjjmX6Ea0cZ1+tFrtcsvXDE8v16x8b7PLxvXaHkfpLTe2h1iXyppCX5RTytd3gSCFrQZIgu9xDnVaEulGHcogPw/P8tsre4wimRn7axry2gM1hFdatU/YU87DtBYiupndXvd7cmaWNFHqj2/+mJJFEh91FzJysbBKt/YtKvA2iqF/ql++RRcI3elrEK+t22l0McCGN91IIyeXp/SbAN2/g== 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=2yCmUQdPdUzzzBlVi0xn7vIIg3JeouJV/1R9GlTHoTA=; b=oWno+ry7vAoottUGg9OsdTp+0+zZ6aIZFd6Hef9YGDjw9D65ZRL8/6HppWK+NnT4P6i6V8A2AM21hySAr9h8RYgLqe5ikaAkO525wlJ4rfDebwdzxf3kMXVElOfdMc5ee9X5SXrWSVq8RN6whJDQ2jyBL1RqOPV9LwyUHR6ArTreOZ/YmwYBkMKQ84GaH11QaGG/2tsmowFQWKO8wAsvVp+BeqrCfrkBeulYWr7FQhkhIQNOXdmjnlk+bZI8gcO5DPqqWvf6pW2j1rgGnjqCnU2JiTXe8M5xeJDxL8HKWpbbcWFg3IKJhRsKrU2MZLA2kRsOyMO6/lL/q2IvqUhjXQ== 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 PAXPR04MB8669.eurprd04.prod.outlook.com (2603:10a6:102:21c::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8137.21; Fri, 8 Nov 2024 19:44:04 +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.021; Fri, 8 Nov 2024 19:44:04 +0000 From: Frank Li Date: Fri, 08 Nov 2024 14:43:32 -0500 Subject: [PATCH v5 5/5] tools: PCI: Add 'B' option for test doorbell Message-Id: <20241108-ep-msi-v5-5-a14951c0d007@nxp.com> References: <20241108-ep-msi-v5-0-a14951c0d007@nxp.com> In-Reply-To: <20241108-ep-msi-v5-0-a14951c0d007@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=1731095022; l=1804; i=Frank.Li@nxp.com; s=20240130; h=from:subject:message-id; bh=G/yY4CrPOouB+dXrLHUGTnxa+S7MToMCeY+wZ3vMPxk=; b=+BhbJy4Ltv91y3dtRF93z9RGWMXDturZTVKFbeWeCay8qN8bl7APkDApsgn4wGR6dSZAFf8xK hQwumJJCiUNCchn/1qHoOPLg/W6EBLKvnqdcEuxkNO6sjA4H6JPUR49 X-Developer-Key: i=Frank.Li@nxp.com; a=ed25519; pk=I0L1sDUfPxpAkRvPKy7MdauTuSENRq+DnA+G4qcS94Q= X-ClientProxiedBy: BY1P220CA0026.NAMP220.PROD.OUTLOOK.COM (2603:10b6:a03:5c3::17) 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_|PAXPR04MB8669:EE_ X-MS-Office365-Filtering-Correlation-Id: b17fa552-e258-4918-d419-08dd002db3bf X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|366016|376014|52116014|7416014|38350700014; X-Microsoft-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dVQOPpb7hkbI47wCaeD4YEmEcip0C+owkLmKfwUA/YZ7bh4mCc?= =?utf-8?q?Xa6M78V/+actNMWG24xDtWDSL4aJ/Y1L+VaYYeWgZQobnp5Ujvn5201z8cl8J0o1F?= =?utf-8?q?uRdNweUssofClty+UIihKo8KK1Q9QvqpDRSJuDorQGFhn2BZch21fT+2/dCKFwtog?= =?utf-8?q?4J9B+WfcvzoBoDI/3U/PW1o+NDNTj14Rae6KpbahJDNlw4q3LLzjOQ8AFxv7UGZzL?= =?utf-8?q?sjxwxlizu1BDcWiyJ9p88hW14c/Pb68Pr70vsr7JRUf2kLkY92MmWD/hZggJXbdq4?= =?utf-8?q?39fkdtYxEVbMzFyc8bxI5aoI0FILUKAbGui8jG/TxFuAFy4fZ7CbWHI85RkcTlhCD?= =?utf-8?q?4P0kw+7bWVGPtoH9DapdQT1WLelSLhNYWry+bnATGbsf8H2IRiDv5k7eOnwHLpA3Z?= =?utf-8?q?/QrE7m2uMb3CSUyyUZ6wh4culCuRYQV89Yh2fe0Q5YJ6fp2DzzsdbA3o=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)(366016)(376014)(52116014)(7416014)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?j2fFNVQ+3tA4axfYxJ6+n8fu5YEf?= =?utf-8?q?lZzi9pfZNjZIVTRPRsFwC6XoKE/em3i0bJnG4zR2u+0OsBSwZC+9F7WieMDb0a+cE?= =?utf-8?q?5vsG+367AHW4QCTTEsiPlecw9Ns7Gu53SD0WfveFMrnlM+5JMsKgWwqYmzAWCuI0i?= =?utf-8?q?JB/JmnEatVJQkaVJZ66E+krRp/Keki0WWRSZXOaFRWUCqKB62F2Y3kK2eOK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=?utf-8?q?Ptb6WDThE5zRUAPy5FGPznSecbmu3mwAaQKVHJLLr2iWr6nkyijbQBuWysakGzEL0?= =?utf-8?q?yJ7iPhWfki3X2qapuGEQQYgs435ziVYBZzLSGKdS5MstBHKR58r0aTdgb+SaRUc5F?= =?utf-8?q?vhOL3IabLhhgsMhvtZMabhgkgbcXWUhwyn4Vjknps3lJHnTZVf1e2dTXgzqHYySlD?= =?utf-8?q?0z6Fel04zAWXYCMRBZ0BaRyh5cNlSsIVBCCDnZqe17jTqKoocCI+wEWOqBYKbLhKb?= =?utf-8?q?nwbYjtuyq8mRY+9wOACtOiJKqPfBgHsQzgN46x4SnUppZJK5dkooZ3q4hGJECC77n?= =?utf-8?q?yY7cnzmQuo68cmi6j71UEps/uWQZB6Yb0MBmmMPTbqN59kOHbiP3uT6uOjMa7bSgG?= =?utf-8?q?0zYe715Rv2aMBU0+VUCRpIORyUFLW+qaLtMV2gRLhrxAjBZWRdsVFTaXL+7AY4Hrn?= =?utf-8?q?uZ/L6lDqsUBZ?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: b17fa552-e258-4918-d419-08dd002db3bf X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9642.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Nov 2024 19:44:04.6595 (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: 4WmUqmDSjMStBqWL9GDTSb81J5kbpd8lNFdLQxbHWttfzR7HfcBNS7nIV/lbYsjHtcQ3zlHMeRC1lO0BKUVWoQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAXPR04MB8669 Add doorbell test support. Signed-off-by: Frank Li --- Change from v3 to v5 - 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;