From patchwork Tue Oct 15 22:07:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 13837322 Received: from DUZPR83CU001.outbound.protection.outlook.com (mail-northeuropeazon11013057.outbound.protection.outlook.com [52.101.67.57]) (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 6C5001B0F3C for ; Tue, 15 Oct 2024 22:08:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.67.57 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729030104; cv=fail; b=FGoM90cJQ4qNyxz3GF12gXdllYS8rZAhjPy/yTH4iphNTBPgQrBYjEHf/T05wjxZ72bKfsefFd/eBVjm07caIuhYH5CpGJf978Q366O8NqyEpwDcVbKDnQJK5u5mJSp0ab0zaZ+50SJGKvhrhGW6CLXUiB3zz1J4mnHelbyXOgw= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729030104; c=relaxed/simple; bh=oLfeRG2JJa/EVak0ZqRbgfNgEQ6xhDK04ybgk4QBnh0=; h=From:Date:Subject:Content-Type:Message-Id:References:In-Reply-To: To:Cc:MIME-Version; b=cLrrJ36LvMGMaaNTZZXXaFAV/pOHD/bXkEgTGscFeju7fbIoRnJr4eJYEaGQEuQkzWyUvrJp146eQIjh88N/xlEQVPqiaMqdP7PRwee/95C0AAs7S0EORWyMWtolZYJoAw6srkqe5TH+zClUJkWPvIHOOTfLagCvQhm27cXezoc= 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=KYtdnDXi; arc=fail smtp.client-ip=52.101.67.57 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="KYtdnDXi" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=s8WBViq283QXcCinzg3aplHWoRzFUnl8i3FDBhYiPtKAA9xSSxhDdmjI6DIyF7iXNpjo5MRPjpzMp8fqHSyxYspk0LnzTRM4fYBTr4IEQObc5Zo3Z5dVH4X87XtnaaVCA1mkbmcRdQCl+Z/WjnSeMuHZVI97dd68hTDUNAz8Xy39jCGt5noXY4tcAitreTSlHQw5VKqS+WXZ611lQuks8BkhppqLFg+rhCptvZ1b5sgDHOi0J5HxHoHYaQETpCiKzcbPZqbmFYuwp9g2MCdmrGsXweXdje6P8PU+aM2XBQ/jFHTeLx+Fz7qG4wXV/Yq71ubF4KtGtsN4I1or74GRqw== 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=HRw0nM+ngMAE6u8ALv623oDL1F1mp7li7piBbTWnJ98=; b=w4A3a/zZKuEeGeqz8d/W1Qx4TIbXkAtMNpBOtpd6BPzNhWiN+NEDxoT2vmZui3/cYGqify9UMilIvC3NZLV7//+vCAsvKVhS8q3KRVjcTIPKookdoDE1Ag8EggZ/Zj9YUuFdSsBftCL+ftni5kXZtg4C9Bfv78TV8kVLwyrKAIUoTk0aIJCGxMz3IbpUg0FpHjRLpgfwUCSuYKEGN4RjncaV3ayRL98bPPRElWBwi7t/n3KTn8q04mmwnJOKMJoH4lOUuPPA1sp2ad4mozlkbKHC1IUs0XDaqnYpxaEQcYtMg9RfP+gQeXoPxcZEo4DUP3xU4EtvpqdpaVe8UUEdJw== 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=HRw0nM+ngMAE6u8ALv623oDL1F1mp7li7piBbTWnJ98=; b=KYtdnDXiQaRnKJ9eb98BnsnQx/tg7iTwqStAs+4LOCVuFjsog2VSuR+2P2AwUSWtjdAqmECPATtx8I/NWWbbFU1tmGavZQKfKjaLhhKeggCQSRqJ4BARj0LGAFJICqBpYku6nKGl0976/AI/k3aYBGVhT1LXyXYV5vL68LVkQ6nfQuZPhOVnNEpo+Bv79rbX4EZ03kqpLIpTaqvJwFrB9KZmrk9uZ7+e9Duo/ypvKqFApgqG7DHsFET221fTOfPng0LyNSsdIoyC1KtJVTPMo819spBEd5Cmv69tDvuLPGyzORKxbVmRpQrEIwZyzPZYh0DnG0LTq3fe23zryhGNAQ== 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 DBBPR04MB7788.eurprd04.prod.outlook.com (2603:10a6:10:1e4::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8048.27; Tue, 15 Oct 2024 22:08:21 +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.8069.016; Tue, 15 Oct 2024 22:08:21 +0000 From: Frank Li Date: Tue, 15 Oct 2024 18:07:19 -0400 Subject: [PATCH v3 6/6] tools: PCI: Add 'B' option for test doorbell Message-Id: <20241015-ep-msi-v3-6-cedc89a16c1a@nxp.com> References: <20241015-ep-msi-v3-0-cedc89a16c1a@nxp.com> In-Reply-To: <20241015-ep-msi-v3-0-cedc89a16c1a@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=1729030073; l=1769; i=Frank.Li@nxp.com; s=20240130; h=from:subject:message-id; bh=oLfeRG2JJa/EVak0ZqRbgfNgEQ6xhDK04ybgk4QBnh0=; b=ggtUqSjG0x79ltLdbRziV+1fQMtLGonP7mytNXC8zbANXa9FirOFw5AzTBQStHed8I7eXFU4x 3OLE48THL6dDKyaXkJxOOuEoKxuWLFFdAQrxKVHBU+4XNxPUlWck2K4 X-Developer-Key: i=Frank.Li@nxp.com; a=ed25519; pk=I0L1sDUfPxpAkRvPKy7MdauTuSENRq+DnA+G4qcS94Q= X-ClientProxiedBy: SJ0PR13CA0059.namprd13.prod.outlook.com (2603:10b6:a03:2c2::34) 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_|DBBPR04MB7788:EE_ X-MS-Office365-Filtering-Correlation-Id: c910bd8f-30d0-47f0-522d-08dced65e172 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|7416014|376014|52116014|366016|1800799024|38350700014;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aRsA6PdS3KnEVW9KddvDtE2kfZv+MK9/AvYrTd1tETpY?= =?utf-8?q?GOq5Yg9/wMmKVOZvSA3f07hqpp5d0GtLOdoaGGcq1OCU3RiLDfG66kskl0ZoJWXV5?= =?utf-8?q?fRWXf4MAB+bYi5B3tobEymyqH2IZDSIJBomYF7X6XMZYJ7zBG1ySXSyR4pahMV65U?= =?utf-8?q?JUn5t47Ja1aCu5cn3exXDlbKwSj1lKKRQZNLPI7zjQGkt4zx0MT7ZtNldCk6lb4sR?= =?utf-8?q?8XWcDdutdkaQVDugBvrFcsZV5BX9S7y5xRy5jk/P9bB44T5eY9sOlPZU7mbx+R2Oj?= =?utf-8?q?r2RvFTG0l/gslMEObfJJNxVKpSE5Y9nkmrm0bJhiEedU84uuYwgcP8xMCs5NBhRNC?= =?utf-8?q?n5U6RVW5iUO2vecXk6AEH7wEUi/LqFzawKNj+8iIyYhBcbrVH2But9X+jIz3TaQst?= =?utf-8?q?KkDNdcrJedeinuzYE+DS3uXbpiO4zUT1Huw=3D=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)(7416014)(376014)(52116014)(366016)(1800799024)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?gpwmL/qlmCKXtVK0zoTbxobTWYsO?= =?utf-8?q?J8Se+Ur1UNOaDyIwlmfaiZINjs9Qkc7LObwYukzBvrYImBniRqFbzScwHCLoPw4N1?= =?utf-8?q?5lkN12pnL+flCrj9NHGonMV7ml97wE/S2SUzgszrbhjrlpeSOW161LYIxGWi9GcUs?= =?utf-8?q?MzkzIG5zE1DYSsMAgoX79gSFam5dy9hRFFd9gbra9YPaRyCJXVL4mzP/RYWZY8w54?= =?utf-8?q?kxVN/m8YZRRj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P/hwL4ua+5ptbkiSR4CDzos2BMYHdxfVrlyG9j/hesM?= =?utf-8?q?5c61ELSAyRrMd9QUhexzWRohhPqfIzZLgGMLxHz+XgJh2XMOr27CE9yqAjMoaxqdS?= =?utf-8?q?Zj+NnZrZ3pk8c6GMZQ+CkXBsfXUW/EMOmgru6iKLYkIGmjYpnmMbwZYsVdPT2rXMz?= =?utf-8?q?znv6HOz8Zf4z53FOfq3Crf2xLhN/jxDIGU4FgTJ+y6p0SQuUzmltzyrA0lLkR/N9h?= =?utf-8?q?6TkBJ5zhM0H3B8c9NUhHj1Ji9altRn7kMA/3fm6pZb+KLui7iJl73vXEzvNI08isn?= =?utf-8?q?YXSyjn/BNVgEJcrb/EzyB5IL79X76KZW4dHDYuBpoqEVjPz7DK3Ul1aGO+3ISP4FS?= =?utf-8?q?0OFeP/P2qRfsxNJMqLtuuMEHw6H81cxbu/Pl7a1G6nea1RWTfy/M42YY=3D?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: c910bd8f-30d0-47f0-522d-08dced65e172 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9642.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Oct 2024 22:08:21.0568 (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: AQhKV8F1fCrWYN3UEyX2/sm+pn1RkrqftuCWNcMDAkQqoIhbYRrQlocwHyFweNArQobKSIJNG/XEeAWtxYYAwA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBBPR04MB7788 Add doorbell test support. Signed-off-by: Frank Li --- 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;