From patchwork Thu Oct 31 16:27:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 2004745 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=nxp.com header.i=@nxp.com header.a=rsa-sha256 header.s=selector1 header.b=MPVfBtPv; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=2604:1380:40f1:3f00::1; helo=sy.mirrors.kernel.org; envelope-from=linux-pci+bounces-15736-incoming=patchwork.ozlabs.org@vger.kernel.org; receiver=patchwork.ozlabs.org) Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org [IPv6:2604:1380:40f1:3f00::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4XfTwX2rZYz1xwF for ; Fri, 1 Nov 2024 03:29:32 +1100 (AEDT) Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id C5DC4B211AD for ; Thu, 31 Oct 2024 16:29:31 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 339281C9EDD; Thu, 31 Oct 2024 16:27:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b="MPVfBtPv" X-Original-To: linux-pci@vger.kernel.org Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2045.outbound.protection.outlook.com [40.107.21.45]) (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 C92671C9EC6; Thu, 31 Oct 2024 16:27:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.21.45 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730392063; cv=fail; b=AIxQ6xcI3JlYLQJ8IxFwh88U0AAqf+/0OISBBfbfrbTLJG+CWZ4y7QBYJVNWRE314LpqFZNkZxAkbL5DL4UrvOQTYGzyOPoe44iJSj9GsjQHst30PtthvuS9iXU6PuPN0CUHBVQauVQQd5FPIlCn3PE3ICnnMNsP6mC1jXVG0E0= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730392063; c=relaxed/simple; bh=QXAZUTo25wHxfm2hPmZ2UTgDrVKcvTZyNirR6BThLKo=; h=From:Date:Subject:Content-Type:Message-Id:References:In-Reply-To: To:Cc:MIME-Version; b=K8w40xb2v3Yn96LLK/w44L5Cvl1WaGneav04vHlQJch+SCcjrqXSVyKsR0LqX6JpPnjIfbF97qoEpR4uvue8Gv6wYEkK1KFSZRj+xk07qWGJ19qEtn7N+bu09znMeBgYAUzBaU6T8InQLzAUdHjxK0CKAJkqNEBfwL6GoDhIrDs= 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=MPVfBtPv; arc=fail smtp.client-ip=40.107.21.45 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 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=PUxCIuKqdmCDTModtyCkmeEz2bnXhTbBBsIcfio1iyA8hTZS7PPGJuXe7WMJiff6Fas17ecGSpOgypYlTHG3Srp2txVyV8MBwVI2iP47262I/ztsB3mQlzA7m8J3J6/oLmqDo/1t3K4eKtghwBK2RtMS3v0jMG44I1jof6YiTWzE6LvBwLt7VJZ+mViMilpsvrUsraDKTsVbtMakKVykFRHgFUvxQm6PvVU4xnQBRx65KQutqEV4ohQbMtRejof/37mF4tbqOWMTJpUkVm7gnDThI58VT4MtBUCcFSoSmGbapTAjW07fNLvjPBVZXCRsbcKE0xHg9XcT6FwL0J0v+g== 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=3XsfDMu3OuLSSl5vBa2X1Qbhd1a7N+LYSe23dI9037Y=; b=PI1CHFsL3qF4WTopF3MlBfYI0/Fuz93szg/Ura9QW4JzcENEqyrjHrkbkj4XTK6Dj7JVMMqljvAmt1PzqHj9EPysH4Lkym2fPKO3BlN7FoxL7JGo6zuRzgvMD31rN1BpfUVHI7j8Iglzon4KY12CxGgW5A8V9c60WY0ZFupZ+5gdvashc+FahN3FASGAaI78dAhL6vWSKGYDR6CROOahyqyKpsfsTf6Vrw3ANdASXKXS0iwIRXV9ck4dqyvOMoOXnpstwLvWNacRMqRAmriJ/B8UfDaEflhY3VZCO7zhlgu5JD9f9Tk44480HiGqABs/oZuSh/rJ7ib6ARwr/4fFiw== 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=3XsfDMu3OuLSSl5vBa2X1Qbhd1a7N+LYSe23dI9037Y=; b=MPVfBtPvQyXmC1OCKcgIjhxQ+3e3lZMkNCXPjTEF2gxDH1zOD/xRr7be/u0ZJAWo+GkD0ZmHJDLwrElXIsGafqYi0V+1nyWep0O8UIBPwZKW5+VKC4cEq/66S++8Qot62ivihejNAmCuUENHeZeYFU3PYvO/xh3szpkncqx4PksbdgpES4h8yiOg2YRx25YmW38GmlIoBNLALk/hn1veIULG2gMqpbJgCJn02j+Vca4mocBlyaNn9SZPJjT1NKWGgo1M9ZBPzbWtMUrxneeSaESP6edH00TN75eWW5p0UG7+JezSfeb9Wq486AxAgxuc8Pbe7ycOWESYyhHh3O5KGA== 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 PA1PR04MB11081.eurprd04.prod.outlook.com (2603:10a6:102:485::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.25; Thu, 31 Oct 2024 16:27:31 +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.8093.027; Thu, 31 Oct 2024 16:27:31 +0000 From: Frank Li Date: Thu, 31 Oct 2024 12:27:04 -0400 Subject: [PATCH v4 5/5] tools: PCI: Add 'B' option for test doorbell Message-Id: <20241031-ep-msi-v4-5-717da2d99b28@nxp.com> References: <20241031-ep-msi-v4-0-717da2d99b28@nxp.com> In-Reply-To: <20241031-ep-msi-v4-0-717da2d99b28@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=1730392028; l=1804; i=Frank.Li@nxp.com; s=20240130; h=from:subject:message-id; bh=QXAZUTo25wHxfm2hPmZ2UTgDrVKcvTZyNirR6BThLKo=; b=BQijpRRjBWhkiRVjXCG9igHmC6uR8sz0/GFvhgRsJ8HN54IWhy9aDPakxpCM3SJFG892FIb6I iQgBv1l3WBqBuS4OdfyuX4I+xZ2jOX9dUmetDCRJ3QQKjqqe4LkrSfi X-Developer-Key: i=Frank.Li@nxp.com; a=ed25519; pk=I0L1sDUfPxpAkRvPKy7MdauTuSENRq+DnA+G4qcS94Q= X-ClientProxiedBy: BYAPR08CA0056.namprd08.prod.outlook.com (2603:10b6:a03:117::33) To PAXPR04MB9642.eurprd04.prod.outlook.com (2603:10a6:102:240::14) Precedence: bulk X-Mailing-List: linux-pci@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB9642:EE_|PA1PR04MB11081:EE_ X-MS-Office365-Filtering-Correlation-Id: 345de0ef-540f-42a2-754f-08dcf9c8eafb 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-Antispam-Message-Info: =?utf-8?q?uRrQnHbfcka7Lvvr/gJlexPLtJrxS9p?= =?utf-8?q?gP9t+RO+hrjeGIv79T9xAbQ87jM/pEzNpyJFYbxGWo7P6uu0KVkq31JwhXdWVkF58?= =?utf-8?q?SPR5Yxg0DnAwCIprcqszn76lQiX9oltfDdiqX0g71+KQtF2gmcwLgK5efA8ySgcOb?= =?utf-8?q?zSp1jeyBzSodP9/MdBCCHE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sVmWy59tZeIsk0rCRa0+4hylwfvAI//3abXQF6QEa6?= =?utf-8?q?b/XYpPm6baXeOLSx/bgXMtKXeMa9+Qm8npiRJ5d/2uEWMZ7G303Iefepg3slzSEKE?= =?utf-8?q?4JT2c0XeYxZTyd3mVO20RT6sQkeXcmmHz3PTTBRRPOxDfjg73HzIj3Uq2UDpiwstf?= =?utf-8?q?KKMrUW4pQrsUHJT+EpeqT25QJdAxXMWUJCUSWpsCDWy43ooX5VfqZaRsFvP/PXwc7?= =?utf-8?q?eiHHRlYFO8nooSA7Eld9N25jCC4rfen0jOa0lFzBZsCp+vfqJUsM1EBA=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?nL+jXGIKtFP/5xbyuxMy1bMqeiUu?= =?utf-8?q?YfN/nvCLF9ELGFNxBv/DOh6p3FnAd5RAKJwSwsn5e0CdwdaQAykVq6Rq0ZfX1PaGc?= =?utf-8?q?AlJOVQs8GwnfreqkC0BF2zkC/d90p6z+dpy46wBrvb4MKphajHxvh1fcXMhaIbb7Y?= =?utf-8?q?mv/AvhITmD/agTRyLdQo/5jRsYxgQZt2PTDOc5tI6HadkUoz56MBQEHSz7Kd9eDvb?= =?utf-8?q?N+EVfTYI95lCeBqq4Rr9739PtDJToSkfvtOBiPlT0hZQI/OHgn9GfJIdvxBeclP+y?= =?utf-8?q?/DxIRxVArX/SILa1L37c+koW387ne1WqavwdFB14pvus0+XJQcte7hkcLrwAJMRFk?= =?utf-8?q?53kiPhR520msy8p7R9dpzHcIdAc9oIW2HVmB9+2jaNSn2QaqQLqrNtt9uCDV2Pu6W?= =?utf-8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H/8yat96d5pQ7zLu+fgnEiDTBKHcPEBgghl4+otJdJEzB5zLz+F3ORfCgM9qpO?= =?utf-8?q?Rx62CKwHvehYrqD26vAGxLmNZ87nYuPoMtBo60GhRQ9io9f1CRrcfFp6Gvsj7pbx/?= =?utf-8?q?Sct0iIww1r/tTkVgcWpSUWqIQJbKTtC+oSH5jawttwZnoEjjbqt6242GdctwTFvAe?= =?utf-8?q?3bLZJEdt5sXb8BNhqhN9hOD2zxvuGucUexUqz9Eyr6Q5AzTmP629csFI=3D?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 345de0ef-540f-42a2-754f-08dcf9c8eafb X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9642.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 31 Oct 2024 16:27:31.1832 (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: oFGAb8Ivl5lUQGVialAs8G0BY+IwyQ2FWqlS3p48nGxmhyL/aYCtND+8lBvErXyt4LxDzWS0+zOdfUs2KMwlkg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PA1PR04MB11081 Add doorbell test support. Signed-off-by: Frank Li --- Change from v3 to v4 - 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;