From patchwork Sat Nov 16 14:40:46 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 13877602 Received: from DUZPR83CU001.outbound.protection.outlook.com (mail-northeuropeazon11013021.outbound.protection.outlook.com [52.101.67.21]) (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 AC85D44C6C; Sat, 16 Nov 2024 14:41:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.67.21 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731768088; cv=fail; b=vCyU4dUILQXzbCHoTA7zkqtZsOHx89ehMucXYuwY/K3EMcHSllZxk1lH+EuQwsLGKdU6dQfU402Dd9JcULii1hwGr6j0ypSd21y+khLzz8cZyhVsPailP60APskuIVlZneO0hu8XZ5vfM2dfhJ3VA7Gnx+cQ45jb9HVZPAQKn5g= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731768088; c=relaxed/simple; bh=PMPeULWcd9APEf5NgSWWzp7T5Vx20NKWDiBCjH7nCZ0=; h=From:Date:Subject:Content-Type:Message-Id:References:In-Reply-To: To:Cc:MIME-Version; b=rVswaRo56SJbG5cV4lKEwZUEQvncUFDeO4Jxn7j99SpxMEdEpNbZIesiRNLbEQjkLAxDHSriyYhxeoiHLXIUzVA+YufDM2HKNVzsIOFv9y9U2qiedvzfJovScXyTnURH7CB195WFe4BK4pZpnA48ZmrDTt7qVJ90QC0ZX2IaZ74= 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=n0nd+Anm; arc=fail smtp.client-ip=52.101.67.21 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="n0nd+Anm" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=okmLCxSWKzH8j6tXc4JjsdkY4D2xEN1qPAMFnahjRyfjjq9R1IoRxyXxe8NO683tpygD8fr5XnEUf2L78vf2vNC4v2DbTr4Cj6TzweF6cya+jF8W1KjyRyZvSDGueZ2N+ZPnXkz65KrEPJAd6ffA5VxQzBosl85B9VnZxFiVpPRLUPUSwbf9NkAc3MRrYqfPoBRKP02PN/y3pzEhdAAW7IGyudwlwYW6IEgk10hvgli1j4EaGdxIfNJC4EntOLAWAVBiDNNH2e6frTSa/Qj11edQUlwbF7CWwD8dV5nxwEDFHzPTv06ldrzoAD7i0DPFpOWSa4RV62kXl4B+bQdsag== 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=uwKvm2PFG7IelxAqz673F2KybERhxfLWfXM1E5u8duU=; b=WyRVkUZ2VV2axrfoEnddbli0XSQIrsvFLA1yiLPyxjC3mkyv4g3ulVraj7ZPGGkeZcCb/8iglwwtI0sOatD96VpuSacemWx4s4oh0VQJAoPWdXvLbttprD2rL51wucUyPpy/MdJDXhtA8pOdNU1bD6WSHKYi2wrEbth7L453ormnaXHS8EpCr8WOsge9i+u5jAEJ1bBw6mG4sU9hH7Kbt/F3ymTdF+PvicYnXmzFyzZ6CC3WlzwCGLvxzn//rQJCphOYpP6LKNzbhITrwjSCCgjHrP/f8zpdpVgZlQDgjdiyd6Yx/0CzDHoM905yvkADGRB7ZsDY8W3grBujjVwQSw== 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=uwKvm2PFG7IelxAqz673F2KybERhxfLWfXM1E5u8duU=; b=n0nd+AnmNV4NoF2TeffY6DIcIICa7zUKLfRbvWO7m3T4556v7Vu7DYzk54QgErlD/E9tsq04VsCOs2xyhH+Aezm3ZK2WHH435uXnkq0IwyyUtSP8NVN6X/jtHlh3ZDBVZicpDjQBeF1sFAgqYO6J9hoD5GMBVeHrzX5LrDUtUk3ONEk26W+KXwySHyvEJ4k9n/YRHw9TmWpqt00v1/ouktoxetEtxqEQNbdubVjv76WU2yMmKRPiskKtCk+O6jvrtI+K0YFuouwhFudZTZVP/pYwLpvCMQ7NKpI/WKdAkbtMfgem3O3PWiYx/iz+x3pSC9/jRzRsqGp+7+K++/XKtg== 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 AM8PR04MB7265.eurprd04.prod.outlook.com (2603:10a6:20b:1d8::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8158.21; Sat, 16 Nov 2024 14:41:24 +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.8158.017; Sat, 16 Nov 2024 14:41:24 +0000 From: Frank Li Date: Sat, 16 Nov 2024 09:40:46 -0500 Subject: [PATCH v8 6/6] tools: PCI: Add 'B' option for test doorbell Message-Id: <20241116-ep-msi-v8-6-6f1f68ffd1bb@nxp.com> References: <20241116-ep-msi-v8-0-6f1f68ffd1bb@nxp.com> In-Reply-To: <20241116-ep-msi-v8-0-6f1f68ffd1bb@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=1731768057; l=1850; i=Frank.Li@nxp.com; s=20240130; h=from:subject:message-id; bh=PMPeULWcd9APEf5NgSWWzp7T5Vx20NKWDiBCjH7nCZ0=; b=SoKGk63GaV3YU7XiowdjYlWsuvNkLChxn7Ujnh30C8YKXF7nI7eRONMoL0yKyljgwCpeCUpOw yZegV3FcFcDAFCoLusTbNUlZtnKt+uzTUf1Mz0hvgLd7K5cj4ajccFx X-Developer-Key: i=Frank.Li@nxp.com; a=ed25519; pk=I0L1sDUfPxpAkRvPKy7MdauTuSENRq+DnA+G4qcS94Q= X-ClientProxiedBy: SJ0PR13CA0210.namprd13.prod.outlook.com (2603:10b6:a03:2c3::35) 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_|AM8PR04MB7265:EE_ X-MS-Office365-Filtering-Correlation-Id: d54d38f2-020f-4751-2b97-08dd064cbe86 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-Micros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yj0yN9esWMA0LyuDEofWKnaQx2iQGyRFos4LwLHSEB/I+ZN++ydXqIyb?= =?utf-8?q?2MLb98/Kuxq4AsjhiKIY4KvsnWtTksR67AZh7j/XOjKx/kW9DfhyX55ZKcya3tCRD?= =?utf-8?q?3qDXcaBZrJCvnuCb2lh6Epq3frpJEcv84WhsUgQmAammpE1N+vBomOD2R2qLr26nE?= =?utf-8?q?OXscCCB1vv9cOyD4n5EliohILYxzBIun0bF5TClhee37GWGeZfn27gcT1wEiq6dhd?= =?utf-8?q?d2YeQt8GTAARHaO6EMbMZVu4bX1j1wjY1KRFIphX16MJhkLC579ZSP0hsJqYZmu4+?= =?utf-8?q?LWAdCS8hRI0Lmm8PiG0+LoYXvyVeiBM9+ny2RLnqoxIpy6wJifEmloh4/X+qeaKGf?= =?utf-8?q?vcyEV9DCc+DzkECH2A0mogVJcf3yNdsQ2cJOQBnxPGp3zaC3BWg9XAaqzzXz3Q057?= =?utf-8?q?cVBGKTRJMIBu8HLohpHZ8FHrUdPogZP8rIlg2QUG/H1QusQPJyz6UXc4=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?f3ZFFATHV1bVk9xKrm0+aNccZ0AC?= =?utf-8?q?Q6mZJsLcJ0iBTkTCCjhKAAQUoN851bB7LqbSZoVMi1XVv47Zc8Dt8pULJOrraobwS?= =?utf-8?q?mXp79s0lD5SBROySjG9ccj7KU5Uy5gkJDaHRE9iUCbzYPbgzVGMriY6OZIpGzpb28?= =?utf-8?q?vY34kOL1Vk4U/dPeRkKjjYSnFV45a+xWiEsnHF7XGm7x+lZVNzapp9m1fzzx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f-8?q?WO7VCCinWw828Bb17Q5IVcWKHhChnUdtdCcTAD12RN0zjv60kdWbe3a/3nYButKfr?= =?utf-8?q?YBHNpk0ligMG6TihBk4H5ZLFNIsc6N1K8bgR+Y3nsG2uFNcUfbCI4gwn/LQZEi74M?= =?utf-8?q?YXmo3bBA0M4QW5WBeONYUxG3SuVZeH55wHFQFGCPpJb/o2Y4gBWSi+k1uUABS96kM?= =?utf-8?q?ptZMf7JB7DK+fMWQpD91yqf0WmhmND4EoC0Yp2m39P6fYQgpQ19GehDfgcQIJz4f+?= =?utf-8?q?fvMjyKE++nyxSYSJUs6dnLRanhf1Lee0gbblY6kT3SvMvJGVR8QEmzfrP7QP83fiT?= =?utf-8?q?OZf/JOY8HfQ/SndQJ0u7SsvxeqVqOmddqeMR3wbKemAb5DtpYvvP5v/sDJHPbpCZ9?= =?utf-8?q?sPNyRT46dfrRS9FMbSdyjuPD/nqgJ15FzHnlgfAdfb2OLpk6abFmHjcY=3D?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: d54d38f2-020f-4751-2b97-08dd064cbe86 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9642.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Nov 2024 14:41:24.1365 (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: 2pigb8NQxYoKCEgvM8rdYRamBcYtymuuZQ6BKIP3N0ojMg3D2FwR9z9GqUo8ZB7suBSzSPLEMbOPLowFZ8X6YQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM8PR04MB7265 Add doorbell test support. Tested-by: Niklas Cassel Signed-off-by: Frank Li --- Change from v3 to v8 - 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;