From patchwork Tue Dec 3 20:36:55 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 13892935 Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05on2083.outbound.protection.outlook.com [40.107.20.83]) (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 2DB1A20ADC1; Tue, 3 Dec 2024 20:37:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.20.83 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733258258; cv=fail; b=s3Y8Dmvgiao6nNQt+xRiOVsI1vJHCAlSjg6JbuNk0EmSZubnvfeclg8w8UfUvOQAtQKc4xbisDZVuUCP/JyPFkWVNfRCdJuujclJfzJ347UivGllhTc5kkKKFjybmRmFRNM3ixZipYxZ75Tf1ynP61AbQC+hw8dkNHSrIk2a6Z0= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733258258; c=relaxed/simple; bh=D6QS5dGBAjaAnBQe6gXEEbxTtlI1jz0FCsmMW1skoMA=; h=From:Date:Subject:Content-Type:Message-Id:References:In-Reply-To: To:Cc:MIME-Version; b=s8IujtBVDQwDmM63T/e8JBDDdXs3B11WKTalygXoroyqdHGEeqgdy6mBZz1g9Illr4tdEKctLqtiyRzFU1IFSKJNN8j25t9D90chMYWUF6hGk6PtR78CVPEFrQYU6o7gmqBJ7H+h20hz45aAiULLzwaTG/4X5l6KKpJ/8i43ssM= 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=dKDkbAYB; arc=fail smtp.client-ip=40.107.20.83 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="dKDkbAYB" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=AA7SG7/3BKQex33NxWDJzkKALxJf9yYbrBtE07RMfXBALfpu3IiEdjjpllM8P+zEHoQj8y8EIBzzfG9wMOvQPgbKCQOR+KpKEei8QuKF8d1o7aE72kxEG7jYeF3DdqSwlwdYnkUYPLKylwoFXMRMWA+cH/JXxjgr1Xq/g+5f9jrVGC6WtBDhjsJk9z2VPSTP1HTX+RArheUmyLStW9C+EVrQjwWn3lmMh/CvJl1/9E9UVz8tFxOQn5rr4bGNkexkt/vz+hFny54vWJwrwNryLRSxcMvW+LcOyT2ChAt7AbqhI9crl/qM/tCWAMfWxl/NxGpyWwLPI6Ey/fW19s4s6Q== 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=SvAWpxw8OJYRN509YqG+wyWqM/bl2CHBc0A28i8a/jU=; b=OW5JcaV0ejAmipUsjNGjaoVSOI8dGTGsGjNWSnP9aItVtywDxTYXn76jmgO7lLG9QkKa4wi6o7wvZEZ+SKy3t/udeA2wkOmbGsIz9dMcTQ+2LdOjtZTnL/6WztsGOjYfhxjml1IHM2rQDqoHxpuZjGCcUQNFydFyhIP+bZDsVFU+yOz9rmGXb/225xsNrkwop4Eb/5j5j4Ex3R10jB3mt67aX9mDq76p7SiGXq6kjscZWfN5+zQJQKfMfx/nM+a/HEG1GpGJFdi5giuUyFKhu94VZZ0dPUBC2+/CZmkiiUAM2UCxU9QF62NWnJnIXxBUkbm8qP/guAhNxUCTNYOmPg== 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=SvAWpxw8OJYRN509YqG+wyWqM/bl2CHBc0A28i8a/jU=; b=dKDkbAYBg3vERimHNPPkxff0HubrVBC8lyIVfyYTiJjUnIDAl3AIFdyzG5ttjSHYBP9tA07PKhmMymcNLnLJKYFpBapI6Zacld1E0CiARuc6nZhel0CidpGXOFYwHO1TJBC3NtReA9qL7uwxtr4ntMp4TzkSB+GyBXCXPxXBEyPU6gWh4piXKCY5+BeX7bS4bXlpWI7OTEOctVU06l3+98FugF7IFFFnxA27XmsV6Tzb4E/eSTk3xTO6kydRAZNLKBW6VidYz2PgbJ5z8ia/roYqn4kRA2+hFH8ZEQbBDUKX+U9BGt1hYKCvinCe3k/OT4GbcJ1wM2QgQDtDXiUW+w== 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 AM9PR04MB8730.eurprd04.prod.outlook.com (2603:10a6:20b:43d::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8230.10; Tue, 3 Dec 2024 20:37:34 +0000 Received: from PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::9126:a61e:341d:4b06]) by PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::9126:a61e:341d:4b06%5]) with mapi id 15.20.8207.017; Tue, 3 Dec 2024 20:37:34 +0000 From: Frank Li Date: Tue, 03 Dec 2024 15:36:55 -0500 Subject: [PATCH v9 6/6] tools: PCI: Add 'B' option for test doorbell Message-Id: <20241203-ep-msi-v9-6-a60dbc3f15dd@nxp.com> References: <20241203-ep-msi-v9-0-a60dbc3f15dd@nxp.com> In-Reply-To: <20241203-ep-msi-v9-0-a60dbc3f15dd@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 , "Rafael J. Wysocki" , Thomas Gleixner , Anup Patel Cc: linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, imx@lists.linux.dev, Niklas Cassel , dlemoal@kernel.org, maz@kernel.org, jdmason@kudzu.us, Frank Li X-Mailer: b4 0.13-dev-e586c X-Developer-Signature: v=1; a=ed25519-sha256; t=1733258225; l=1850; i=Frank.Li@nxp.com; s=20240130; h=from:subject:message-id; bh=D6QS5dGBAjaAnBQe6gXEEbxTtlI1jz0FCsmMW1skoMA=; b=TuL4mT3XQxv8A9zvPGp7Rfla4KGi1wwLYktz0aij43KJ8PB8a1t2O7AkhqWfpSQOeF0p58fe9 qGrmuI2ArjsA73bujR0EgBXjr2iBnk5S63mgSJuDTI7OJeIAnTplXlq X-Developer-Key: i=Frank.Li@nxp.com; a=ed25519; pk=I0L1sDUfPxpAkRvPKy7MdauTuSENRq+DnA+G4qcS94Q= X-ClientProxiedBy: BYAPR05CA0013.namprd05.prod.outlook.com (2603:10b6:a03:c0::26) 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_|AM9PR04MB8730:EE_ X-MS-Office365-Filtering-Correlation-Id: 2504c42b-9611-4339-0e07-08dd13da5168 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|7416014|376014|52116014|366016|38350700014; X-Microsoft-Antispam-Message-Info: =?utf-8?q?u/D7oyg76edchWytyxR5OYeRuoqop4o?= =?utf-8?q?vs+on1tI/hgEiQUK+yiwtIoEdHv2JBLuQMJvTxkI6xyh4mohb1tnOUZFc6RUzXTNU?= =?utf-8?q?Qx9VV7KvZtV28MFVFT8U5g2zMzRXf/V9wi2Tu0N4hwNdpn9jWAzpID7138H5R/4on?= =?utf-8?q?X6XPPcHK18ZnH6SI/hmVn/MLaRyru4ZGZiynENws+wWPdzQ2smoSHbQFAtMs2fWn3?= =?utf-8?q?XIbEOJF8m0yGPdGaFeh9mcdeOj+pmG8o3xva0SDSkDOvGTEtIqnzLWYQcM2Ig5sql?= =?utf-8?q?AKYjbzGQ6ko5YYp4NlV5vcJ2r6VGugDONSQ6GNJbUNScgl77M5BYXHgmfPCe7G3b+?= =?utf-8?q?A6hKIqiB+b/Y/BsJrdMPDy1yI0ONx6ZThvVxyXc3M2DwFo54WXopn+FLHfvF1JFji?= =?utf-8?q?Fu6lWiMc1caKSPLuDTEVLGnr5z/EAatCSGT8k+nWnC2zQ0n61Sc76mB7sMH78pikh?= =?utf-8?q?IpuPdgnn9OZZFwIuCubL8vhTZTDKWGNE8KLLTZ4JoE6slPEddFHiNSJw1DlYfLa4e?= =?utf-8?q?k2+Jjdevf94BPMMQyCjtzA2+JmXRJcQviZWDqwxr3Z6vYm83YpObbwAh3GdVTKEv+?= =?utf-8?q?eyYzWa1bDYF4F0cPg0VlYss/ixPIwaxVCukA1zJEPbDS6a1WFMIjGwE536cJdnu6G?= =?utf-8?q?q4HutRRU4nCxrVYj8iG+99W4SWWnX74seXJokX5AhPQlVO7FYuSuj3X70Tunon4Wl?= =?utf-8?q?RvNCianP6i6EZxJfA//03iR0ZZl+q+v7jVNL2metdwtYS1pzLIOQu40ZwxUaPefpY?= =?utf-8?q?X/KuoDJBD9Xr7kXuft0HN3dMQYasxbybxdCs/jvGKLO4PM0UbFMKKeUlviJRBUIUT?= =?utf-8?q?zKgU8o8ZBoOrQoObC47dtn2ejWIVa05v5jJ8oHXWn/q9y1bNsN+dNS3W8gWXXcdwK?= =?utf-8?q?POlVCg1jI6UvWGbQ5huwc/2eOYyD+/bw3/MKkMjgnPR481hVmFAMWEUHCkaP5PNxf?= =?utf-8?q?FtWYyrL1N8ikBJTvN8j2MJmenrSW/fDpCGG4zyCm4ZHhKoQyDa72vWEIKfIpuH6i4?= =?utf-8?q?1PnIjDVjLT5KH1HpFXbFQ0I0OGS4LtY6dSg5WqiePRLe4k3oMncynRXR48tlyD99U?= =?utf-8?q?O/Lsfh/IkQ1HIkE9TrGea9d7WC7bJC6zP13gJ7w0pC2UIhjsimRPyn0rA0zdynbBr?= =?utf-8?q?vfiqcx2Dvf5kbBe45P6qDqmSVnaPvi70KmJoUB0CSVFmmtpM6y9cGsL68FB4dpFYu?= =?utf-8?q?+mrR6Lg2QhA/G0/aZd1EhihkbnbAtg4iDlokJPMQ6YtOYLtXO3pRQVcyMY9qheTds?= =?utf-8?q?ob4PwWYH43jQg6sAoAU7RuMLkfvRWHmxU2Q7KM3zIpBbf9YjiN2hiVSwD/hUEFNQh?= =?utf-8?q?2Vjtc1K/d1gB1W878NdHd4GwFYZ6gTj5oQ=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)(1800799024)(7416014)(376014)(52116014)(366016)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?4UPWswDt9J4hCzYJQeY0CQfr1Ir4?= =?utf-8?q?eza8T3OjU9BLuSAhozrbNXOuuy2WPPHULm1WmhyYpEO7vNKsAFN/+cldaMYt5pmb/?= =?utf-8?q?gbprBviP4WGLmZgwCM0z0a7WqQNqoC3XT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/rEa9ccY5qGt6US+UPhbRN5Fh?= =?utf-8?q?j31Am9AqGr4MLHq4f7z6Tt3Sfiz2914urEXcF7/xO5VYl3qnjAV6v5s7DhZ3h/y7y?= =?utf-8?q?CiDbsXyPH0IweGjvLokE4uHGErsvLO2X+ZSdDbzY/6j0hhDt6wcYpwnfiUkndsZhp?= =?utf-8?q?qX6/8Ng+mgkKeya/9x3qbJC+jb5v+hPlmyZMtZEE0NRnusE46EFf5lKyM9+1GE2iP?= =?utf-8?q?I64v6LUBTDfaye4xPMgB6SYXqxPSAKm69WP8t8fH4JnpB19/Kgp/Q5FPFpSek1scC?= =?utf-8?q?oi0eMuTP+x6l6+bESDO8lyONAMCuNDFo3fy8R8KMAwFAS+86yQertjTlD9JqY07la?= =?utf-8?q?77YxS64mgTLPga45dmqdQMhJZR4bQnJPxJxkp3G5YonOTjJXaQKabktE2gTawsC80?= =?utf-8?q?K+Pal2zXUMffGLpEOSEmLpUAcMBUstbsVOaXcJd0Z82t0Hiy+Mx8QCJ/hyCVH7ELi?= =?utf-8?q?uqKFjBy8cLVnopL2VkcpDzUjYEf3aJjJ2GFszVNiqsf2DzRhbsBKOjsM=3D?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2504c42b-9611-4339-0e07-08dd13da5168 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9642.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Dec 2024 20:37:34.7249 (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: DrMI0qoemBFV1Mseq4rwLCM1iul79zO+m6l7r3xGyiolNDjHmDO/XjKjplgh8C8pMAkYusPYQhLTGHXRII9aYA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM9PR04MB8730 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 7b530d838d408..fcff0224a3381 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;