From patchwork Mon Dec 9 17:48:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 13900131 Received: from EUR02-AM0-obe.outbound.protection.outlook.com (mail-am0eur02on2046.outbound.protection.outlook.com [40.107.247.46]) (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 95B111BEF73; Mon, 9 Dec 2024 17:49:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.247.46 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733766550; cv=fail; b=nIIC5H8TvEUqu8MAWgLddq1K5N7zjmHi4x89vGYDPGHedLzm/bLjmZug7RO1yrpKTwZNr/+MAIy9C/TGNWWHMPyF7DJyCR/dtMXN6O0XvUED+Q8XKeg2tCoXOUdMdHsFfFMdOXKNzj/m8xP2ls4VUBv5i5kSLIPJw85owhfDYSc= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733766550; c=relaxed/simple; bh=nOdTcGsplP67pe89t/lWexxXwRfnbNq0CbahLICCrsE=; h=From:Date:Subject:Content-Type:Message-Id:References:In-Reply-To: To:Cc:MIME-Version; b=l/vOkECBCyWqZSC6HbuL6Bfrxjo1fEx4lwNL9wWCBLSQJKkUafxpoDG6A21k0mDj/5gHSC+mL7Klo2ComN25mFL2YCGZwURQ8an1D+NKwGqMACa0c4GHy61fGBqrZc/I47ALAKLCFyq5GK0D2IzTzsoqvN0PY4La/eQY11Gmgio= 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=l9Yio8FF; arc=fail smtp.client-ip=40.107.247.46 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="l9Yio8FF" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=yFpd5+NAQMmFCP+pzEOSu7DJZ7aqa75pKDJGJlfqgmhMgtGTPUWppC0JcD57S03q8miulXn1O0DYNGawiqMbRGIJs1FwhAGnMz509EXD+lwu2DfrKaENqX48tJWTgIoPeoofka7YUeh2vdjZ+EYz/ZbqwX+pP2oa13Vnl0W0ydBruEFaW5j0Z1wJ3QzPT/tctY8C+W68mLPePKjiE0DJo03L/8pNiqj16VIvmmz9EWfK+j3oP1ULTUVIR88HU3jAAfFwD7L4nwVXq8rzeSGyeMXEYtidGBnGTORMis8KZcqrF7MkwXTjY5hZG7g+Ia7gEoo9A+M/9gycWpiwrKmMzw== 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=WrbcNtRasZ3J5xRN5xIPVWVszaYiQrxyw0UpP2GGNOs=; b=RrxOOgzFCReW5qbvZ0J2sD7OPZcH+sRP3L6hfV2Juj7HFQi9D726kgR0Ka0mZ6ur/TEOW1BUO5vyE777HybBhX146wy5WdERHJ4C0Opt7bYne3sBRnDBSzY2JMq6C+s0PSqI0Bck+mVuXZFPRWXb7rDhhscZvY/JklLm9oKv1CfxkgGL9zsxncKPNGYP6BvpC8GT0fH9AdU/+j2P4mNN0CHzA5s3rSl5BuBF2ePUi6E48ACKVyz1wvG8QDgm1n+ozcFIjUbcNf8lralprr9ZJBwcJXe3JzAGCVclXdNraU8enw3IS9W+2U/VctDoyTgPUAuu91mprNHg4wNw2XyCLA== 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=WrbcNtRasZ3J5xRN5xIPVWVszaYiQrxyw0UpP2GGNOs=; b=l9Yio8FFW3tv6e049eSbpVxfwMtVgPtDu44nLaMDX8evtAlewSr5aJdejPUe/oL7EC+Lx9z/L6QaIouZCZQC2Yi8HSnB71HBA45B/zDnPt4n0ITlHjTZ4SAg6ausjcXh0/ujsq/PfQUPHa6PVDn6liJajBQ9sEI/OvE6lOmzuUdEfkQ+Qhri4VQeOxoleiuxUcENUgJlxiOJNymrBChScpIpyrDqlA2uF3UZbi0pOWYcz92MPVokh1RlsADKKS+sqTvxMD8l3EbZl5ZEWC04Z7lziMheGNy+Qi+wW8dQczX87KnJPuHUSL2T4q54baod+9JinT3D8RCOLJXb+DfgrA== 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 PA4PR04MB9485.eurprd04.prod.outlook.com (2603:10a6:102:27d::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8230.11; Mon, 9 Dec 2024 17:49:05 +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.8230.010; Mon, 9 Dec 2024 17:49:04 +0000 From: Frank Li Date: Mon, 09 Dec 2024 12:48:20 -0500 Subject: [PATCH v11 7/7] tools: PCI: Add 'B' option for test doorbell Message-Id: <20241209-ep-msi-v11-7-7434fa8397bd@nxp.com> References: <20241209-ep-msi-v11-0-7434fa8397bd@nxp.com> In-Reply-To: <20241209-ep-msi-v11-0-7434fa8397bd@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 , Marc Zyngier Cc: linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, imx@lists.linux.dev, Niklas Cassel , dlemoal@kernel.org, jdmason@kudzu.us, linux-arm-kernel@lists.infradead.org, Frank Li X-Mailer: b4 0.13-dev-e586c X-Developer-Signature: v=1; a=ed25519-sha256; t=1733766511; l=1851; i=Frank.Li@nxp.com; s=20240130; h=from:subject:message-id; bh=nOdTcGsplP67pe89t/lWexxXwRfnbNq0CbahLICCrsE=; b=ZEtULO/MfiNHjiByrLc2lg/EpZTMdmcewapzhTVji0QmZrEurBIs+ciwtyS7UwcMz5AYau0yy kQ2vCkYBLeSAJ//UecOCZEPhcZ4pg8bBJJnNHqtfs6u9rjwGJIVJ2GU X-Developer-Key: i=Frank.Li@nxp.com; a=ed25519; pk=I0L1sDUfPxpAkRvPKy7MdauTuSENRq+DnA+G4qcS94Q= X-ClientProxiedBy: BY5PR17CA0070.namprd17.prod.outlook.com (2603:10b6:a03:167::47) 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_|PA4PR04MB9485:EE_ X-MS-Office365-Filtering-Correlation-Id: 1493b9dd-235d-4bcc-df46-08dd1879c5fd X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|7416014|52116014|376014|1800799024|366016|38350700014|921020; X-Microsoft-Antispam-Message-Info: =?utf-8?q?wTQ7CW28+gJTpdjMZRz8G+ZB+T2qfey?= =?utf-8?q?nAxLhLAHtNBz+pX8SFrOv1CALxMePZWXkPuzH6Z0GGFIoIvkRIUqCtO9mshpHj0FM?= =?utf-8?q?ImCW1R5KUhkggqAA+VOKtg79ISGEl42d1HFJV3NL4u+yGd3fHdvb1XTQU5vlzdPPK?= =?utf-8?q?gHlz3a6LyAwuI1D8L12T/zHumHcu77DrHx+2XGWMfhkXetjQlBF57Mq7du0pcwFgg?= =?utf-8?q?TKiJL/XAphwaL2WWNziF0rDaw6Y4gz9TzNH4D8ItiVh2eQNapYzbCGzyKvUZbSh4c?= =?utf-8?q?oLKNmMrzag+ZkddP1zXcaqzNdaP0L/HFfzNX8rjgQypUlj9FXizsHkyU6cygLgDr9?= =?utf-8?q?uopqUNZdnSfJK3Su0S3Q6sK5TJ+0oTQTA31P/uGlH3Wyjc/E2Hk8XecnvUlLiOFUF?= =?utf-8?q?jKl/Pn1vtSeAi46Pn1TKw2gw0h2T3l7HwS3wN7wxrnJqbaVuCmHOn6LP6BVy+//wm?= =?utf-8?q?QIqkTbjWy0rcfh6ohLAqz68IEhZXGgWz+XrlIe0irQEsGddJQP08UOP44+HUIqe7Z?= =?utf-8?q?0wnzYZnitUogJyzvv3LXtgD7EoZsSPyTZ8jeG7A0S1laJoJOFlo9KHdgJD/b57qjI?= =?utf-8?q?1whHfzDdHGwD0BVDxttEEWnd/ZZgrWuycBpaCAgttUdjR1qSWTQLdxTM59cUIdASd?= =?utf-8?q?QfE362yABsQgpXlRGFzXHpAPy+4r8q3ARukCFYJxB9bU5dQtPfOH5ndpxfxId7uEi?= =?utf-8?q?fQcladZCJV8or6HysNFhFkx4/U+CzSJ6ITGPizLCE55VGkAsifK8qbTdleigD3OWO?= =?utf-8?q?4VUQv+Z1VB1nk73AeuRb+H4KP+Asqiz6GgWE9owJyby71hQf/pW2lTlIqygCINiJ9?= =?utf-8?q?v44835tH1T9UPZmQ2iMdhFoojKof6vcVCmwS9M7qVqcD3L5TyvQUU3fLuQ3C62J/b?= =?utf-8?q?16dBDT0iCfQMs/3iL2jyunHhZ8ZSBDMTaK7u33hwfiaYB7I08ZisD15B34DylD+Me?= =?utf-8?q?uwaUXxSGh89siAayJrFdwjcM0TX7KdopHfb7ELG3xxl1FotjDha+lvLVD+OUoBnwu?= =?utf-8?q?0IKTNraG6bMBtqYkup73CyanBGOQqm/oYko9y1xfpXsAf7JWhhG5C7QP1KuSVJr9y?= =?utf-8?q?XezEIG8JPtFC6Y2jcB3nwf6/PHNlQDLMoAvHMWRIU4Hkl1K6xsmAh3/vZVkSmTyek?= =?utf-8?q?ntOYZ0gj4PBSQYEQDRWVAfAL5HfAE/9P/uIt9sZjK0sHqRMMkwvKZVtyiDH87GRwp?= =?utf-8?q?Ibw1DS3AiRd57q7HoQn90fV8Nubcq3+vgolE3nprmFfvZSye69wZS7Zvq2wQzZuEW?= =?utf-8?q?M8WqT2qq30qthtxgIwuooB08V8kDK4suDUuc8g7B4cpiUZmJ5+UJzyaI5R2oEoOg7?= =?utf-8?q?Tuxj+EpHBr7vkMlzKjQ9dOd3SUXrHgOOsnU257/dL21Q2LTfTTK4QQA=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)(52116014)(376014)(1800799024)(366016)(38350700014)(921020);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?KUbyx/x3oqrmt7+5FzFiGMZk7F9p?= =?utf-8?q?P23MUIVYQwwwBG/p8RfAL/4QoK6o6+/NQ3gf0k0OoE0ca5HdGQlHBVfluAhIdQSL2?= =?utf-8?q?gD2ZW6qURZNdQ5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bQt9PTELGGvFBPvbzGZZx8thuRx2jI8kLjtEoHH57GRonMi2OZ?= =?utf-8?q?3AWtBZfC/+9/tEV687F4f9DzdZOf7GjVynbSxrUYou5XRGcoIv6key5jbZbqGp/Rn?= =?utf-8?q?oCXWsjkhcVf3fcWH0U9nBTK+X+KPI695s4kRGgy3bq5CRqgq+Ofzkl5HBOY4EFAsk?= =?utf-8?q?GTCK4fYYhGPWNvNKLv2qkTTbRa8PDgC+wTfTQgk+2DEwJZgn3Xz92dggLHs8ITwdd?= =?utf-8?q?G39ehtyO3y/KYoZtTsQ1qCWASqjoXEYuUPX+m78lraQvw/2wK376K6+WRnznb/jVy?= =?utf-8?q?SNHa2y/mFD+p3PHvrj67f2QXapyCAgKaL79Z6Io9ZfE9USGzuLQZ7IGwzIYObU2D7?= =?utf-8?q?VnojQkm9inKhSEnIDpyh/5JO1dGThTR/hgq0Ozk1lTw9kv9e4lLNUZ02SkYkT/wRy?= =?utf-8?q?ykYgqI5zeJo138OFkiOS3wJN2F76DC6hCiBRBw5gIknhKWmq4febrEYFWsZEmvOHo?= =?utf-8?q?rHHh4OaijU4EXsypf7dv04cy97R92EYgaN5tVpjuYd4TOdFYPL87Au5kPHxrzxBcF?= =?utf-8?q?eVXnne5z1/eZ?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1493b9dd-235d-4bcc-df46-08dd1879c5fd X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9642.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Dec 2024 17:49:04.9225 (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: E5P8YhVr0KwH2q1mONUdgTvElUDke2V6Pg3ZFIh+oQAhiJdAGoZp95baBHQB5+z+gZwxeeDKQYElXA8ntI+Isw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PA4PR04MB9485 Add doorbell test support. Tested-by: Niklas Cassel Signed-off-by: Frank Li --- Change from v3 to v11 - 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;