From patchwork Thu Nov 14 22:52:42 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 13875717 Received: from OSPPR02CU001.outbound.protection.outlook.com (mail-norwayeastazon11013054.outbound.protection.outlook.com [40.107.159.54]) (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 C51661B532F for ; Thu, 14 Nov 2024 22:53:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.159.54 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731624799; cv=fail; b=ZXK3hiSJDwUCbLtFVtQ+BDYwtyd5b74hf1QFieg3fI8E4EdrsegQGcuLhGp6f9DQWRVKT6C26MjGPY5/AsKNit5klEy5vlwrnPf72m0pzVcXmuj63iKJ/WILwmQdjjcmJXPegdo/S5gChiQGKl6XmBf1Q6I3yDikXSelfg+YtCs= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731624799; c=relaxed/simple; bh=oknEewV2xVMtzJTDODMiOCPDBkOTwQAdC4P3/r2BxdI=; h=From:Date:Subject:Content-Type:Message-Id:References:In-Reply-To: To:Cc:MIME-Version; b=P6Xy03srh7doo2vnSYwGKIynn/FxYLNZAopdUes45hiOSyhjpqg8AgrSSl96j6rJxdQRvPSxTkDFLumH5qDy0IH7i1B2AluNTfA5i1TqeZozxvqKGVxAAaJmovu1t3h30mBRBfTXzE7oy2buA7ctD/YFvy7vl8Ru27dCnj1il30= 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=M/q3eAz5; arc=fail smtp.client-ip=40.107.159.54 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="M/q3eAz5" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=Bim/R/MIQz3nQD+OPU6mZEsrHczy/f2NNb5+5/g55MNV9dN70P1WZTELW1Dmfp0sv2Kgu+lzeECL7kjWpVP2STQtiXW0mLqyKDUpLHiEC4Z3jiPJfRsy0BZ2+DwdqI5OAQATHfl0E5bXD9STY0XbfTTuZu4QZh/0QUjq3oszqX/PCVg5NZsWSyg8Y/fb15MEhAwWzA6ErdZ2LXbQA2nm5y6/laqFrn+qFtyQCC2WcBUtbWqnhDJ6lLwFW0CXuDzhtPDOoOgauHf19tV22GnrwWX/0FKCLBGqU6r6bbAzn4nk9h1DbTie4D/IbT8RGO9fzt072GDBIuIlhzjKmB8CgQ== 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=S0okuXE5bsrRrOlA41c2rexmWqw6sMQqJ3MoKe+r0Ws=; b=JdwaH6aogcLvESBeaAM25AWtLfkINg3ySUAq8AEFjD2V12lNvqNbCb7hL3hZq4bGeT+pv+U0z6FRO1vJwXgJ5RY0Xry7OS2YpKt6p9mInrlDS6kOu2u3s28y3EbsoFCufmM1kChktjk6nA3ozEs1BRokiJV2sAAkp/unp8uVn+OCqsBCX2QVo645g4lu++/O5vr7uKbn9e3uBIcGdVjXuNz7xJsBzxaITuqDUT8lYlz/LBPyw5ZRTzPvjCHQKOSC3NgU/eS3R8ZSFff5NyndKKk5x1BQvG7nervZw4CjppWY3bwp+io/iX9TEYJXyUEOvDJ0paJQQ94s8vTvmDn+pA== 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=S0okuXE5bsrRrOlA41c2rexmWqw6sMQqJ3MoKe+r0Ws=; b=M/q3eAz5CMimhbmjhfobDajo0uxzV2UlLUikN9RyLJ+COn2pOvivLi6e3rEpNDHF/RvwoXYgfpr4XpMUfBAQXqx0Y0mqHMeKBB5OI+aF2oLbKA1qQaZmQHxrx+zBiivOusl7RFANlAF1SN7DyRhHMgoDje2upyDoP7oZNPchUtYq5RNoOPPaLdm5BEBKj3fmBChGEjR1CQxaBrjV/mYk8xIE4Mfk+Mv3tojHCds71NwpWhCOaK7rnJmm3IoJ9po97+z4qlKnAFcxtrVdN5RwmVYxvJjFWmqI1/ckEhqbmr4qWF0mwOkWifPN2zyvrK/eqi/UWwjIA15NjjFPoOBEXQ== 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 DUZPR04MB9967.eurprd04.prod.outlook.com (2603:10a6:10:4dd::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8158.17; Thu, 14 Nov 2024 22:53:14 +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; Thu, 14 Nov 2024 22:53:14 +0000 From: Frank Li Date: Thu, 14 Nov 2024 17:52:42 -0500 Subject: [PATCH v7 6/6] tools: PCI: Add 'B' option for test doorbell Message-Id: <20241114-ep-msi-v7-6-d4ac7aafbd2c@nxp.com> References: <20241114-ep-msi-v7-0-d4ac7aafbd2c@nxp.com> In-Reply-To: <20241114-ep-msi-v7-0-d4ac7aafbd2c@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=1731624768; l=1850; i=Frank.Li@nxp.com; s=20240130; h=from:subject:message-id; bh=oknEewV2xVMtzJTDODMiOCPDBkOTwQAdC4P3/r2BxdI=; b=9k/vJr6UUB9pNZzPDpHLHIM0mezAXfMKXbugs9YpjsSgJjN+MFI/oSSFlf5lys+74e3Jkh3q9 k9Yx5SJu2KlBdklaDsa/tIv++BjhbR3QETAJ6uEYExaTrc2CCHrhExi X-Developer-Key: i=Frank.Li@nxp.com; a=ed25519; pk=I0L1sDUfPxpAkRvPKy7MdauTuSENRq+DnA+G4qcS94Q= X-ClientProxiedBy: SJ0PR03CA0166.namprd03.prod.outlook.com (2603:10b6:a03:338::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_|DUZPR04MB9967:EE_ X-MS-Office365-Filtering-Correlation-Id: dd25aa24-1480-4fb6-0de7-08dd04ff1f5c X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|52116014|7416014|376014|366016|38350700014; X-Microsoft-Antispam-Message-Info: =?utf-8?q?NxNBqN3OCqQyK7yqc0Sk90k+dosjTp6?= =?utf-8?q?bOr9db2gGvufRJjUqxPg90VP3KIuxl20WnvDs/DqfPgz/C823bqMeTsXavW0cC2Fu?= =?utf-8?q?ZgwKK4ZkwnnKWORQIw+8OkLFcvUkEoMH7mRMsIyqqyWnIwAgllSTmD3DpsFWvx6N4?= =?utf-8?q?QnGffK3sdrtEAFtRsV+9hBDhE2qUf/Dahv93lhCk/biIhYUkZD54j+4bY/2yJMbrf?= =?utf-8?q?33a8C6E9QmXL7lfDDK5U37vFpPJxQjb7gS0myVwPqPdMFju02YC6D3KtGrfYfQwNs?= =?utf-8?q?aGr0moxfrU5qZoDUz5Q70gsCdCEk0A5Ppi/lvAOV/SHHK9N0MpMc6sJpk0TbYNcOf?= =?utf-8?q?GyPOcpk4rMkjCYANT/Q+oMUNJbgicrxuLMS4negG7W+9py9vCt4zqfr+LhT71nBKb?= =?utf-8?q?6oTHy8Nk4oE92KrzIL+SiNGxCIOGA3EUadfsF+cF1qZmkdA9v2UaeIm36rwyvo+fB?= =?utf-8?q?Lrp9OsavkKMhK5CT/CzfD7NpiPecx2sPhUxRZhiGqh0FbF7B4oiJXtepUKog8BFzP?= =?utf-8?q?OCkyIbdIkgl8KrssL9SYh8h3zZe1x8/ovi+DJbreScaIzTqZg0BGkf3wXYG/SmE4R?= =?utf-8?q?igX7ySAyrdKsoxAjwbgvluczO4nnbMYuqBPvrZXp+0nO6oj/M13ds7aQC8NBPP++r?= =?utf-8?q?1l51T/OzABDPaof+rAlmRdQmGxepS1knVXDzpocEkEJeYD91mOtLQ0hQTdKyujMoH?= =?utf-8?q?WJGzlOTkIfBEJwdTKlKXw1BOYKPbpUm1tOBOzKGtWnXYwWS2fmDj3CZj6f96DeT3v?= =?utf-8?q?85a8mK+2cNRUDiyMIkUZXqVoQK7wDVumGyqH4TxkmQGQzIA8bXW+ZfwSv7bLo86NL?= =?utf-8?q?cInf8lx7+Gt5XOjelvgpgblmNlEsQK62d7YpKok5qNcZU66YA+ZBTB22ryOY1XWhj?= =?utf-8?q?q5IkppLJFe/YHgvi8WVXokg9N8SqpYA3vcGn7EjDyXWKV1RdZWIp57TjzeE3Ri46C?= =?utf-8?q?kNzeQoEzX0klfR8dLi5VrJ/mBv8IJbFhYe6Ywusb/vSsR5ESBOJb5paeRxZvcGg3Y?= =?utf-8?q?/E/T2swLUMr1QKf/sXKfYkh2q8bKMeN6z3ZoQaraRd8/fh+oiJ2U7tfr4/p64FB2Y?= =?utf-8?q?22jqMFJybu91s/mJVFlFUaHPhZFZbmjVGAxMA2I5+LbXOaX3Fcpdn1qS5DLItG6Cg?= =?utf-8?q?vfFNRZTNaci02jirojvgQGPHQWaADY2YngKccDQ90cjttyS9J3qOnd0j38KZRzmmS?= =?utf-8?q?sCdQqCWTsnqJgF4GbNzJa77D5xz6rpirvVRG6IDmmprhFF+fGA+XndVes9DhPNuHS?= =?utf-8?q?yGOlkDbRr+XxaBccuZBHL/ALBUtWfoOj7vQrhBg/Ub56HiHVP52PKba4=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)(52116014)(7416014)(376014)(366016)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?Iv2oDxDhX6x6V9IdxZzJ4ODr1ibX?= =?utf-8?q?FDJi91XbynN7azXvjO88hq0r/Rz1I2QFEpKw+70Yjoxcteu7a1ZsNxsFpK4sEMkC0?= =?utf-8?q?BFe8reR9urdfgHizuH4oVUZYADxpJvbXf4m0aB4xPEBgqnKi/zKC7CAkuGLWAlX6N?= =?utf-8?q?sNwZZ1wgK5BaMjcVcCQE/rJUTlkzoFrRw98wUbRo8P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+fxu6X3yjqVPtANgPEdx?= =?utf-8?q?j44iSOxPoHemiEXzA3gcdQeSPfMnvblQUcXgcKPzqG0sVxPbdiPsFMYdB1qZ1Jn7Y?= =?utf-8?q?C5l8wUu5/A1+uvAvwlFOsw1439sjP0LFBoA1a2Vf8CtlSvn5OkEkWd7jE4X06T0rE?= =?utf-8?q?G9pU/CWSZbKxV3IXApo6RHGG3PM64UoYPwEQ7qExysqC/7BMVpiAc4bSRaxPoO9sp?= =?utf-8?q?WPRXzJffhUebJ2QiG+Ax/rwdn7GC9RqVp2jHUKY1SvxTSfVriStC/MkiQYmTFK6kH?= =?utf-8?q?2zNSJusFmoOkSOFY3sdfaP65FuB/+0JBDqEeR+U6bjFuzaaLpfF3LLhiV4+UC5rKw?= =?utf-8?q?7ag3Sk2GQblQD7R3Vo7NZ2kF7VZZ0Xrh1+/wJeSXqPKzmqn35krXT7FUeddiUq50F?= =?utf-8?q?GKMJgzAO+6rkjkyQSLl8FVmwmN4Sr+tf+/bL/Lu/CoS25GuYI+gdPnZc=3D?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: dd25aa24-1480-4fb6-0de7-08dd04ff1f5c X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9642.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Nov 2024 22:53:14.6983 (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: fzELQ5OxVBQ+sNN5x6IdbyW3SK/GY8pkAy+pficpgLFMmkux3sy+bBMYljvJcWCVqeBtin3/3hJp0xRd+C/0Aw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DUZPR04MB9967 Add doorbell test support. Tested-by: Niklas Cassel Signed-off-by: Frank Li --- Change from v3 to v7 - 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;