From patchwork Wed Dec 18 23:08:44 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 13914251 Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2071.outbound.protection.outlook.com [40.107.21.71]) (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 373961FD7A4 for ; Wed, 18 Dec 2024 23:09:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.21.71 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734563388; cv=fail; b=gpXylzTTz3rkdtAhtbFB90T0wrqENw/YSOwhZsibSkE0yI5hDL4p5K63JWiu29jZx8AHtRFWwoE3CiMwIM1MP7LMZU4pWS9ZzcrlvnE+3yv7KB086qeXJPi2T/RMx+9WRkHOAspgAimYYcvDJ+QA/91+SLHY7yZXhrrD4ya7zHQ= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734563388; c=relaxed/simple; bh=XbEugLgmvGxvNIdnJ6oC4l02fBY7NXWQcWS+O1eGi8g=; h=From:Date:Subject:Content-Type:Message-Id:References:In-Reply-To: To:Cc:MIME-Version; b=UZnBAjc/KK3CgkdLPcuEnjeqVv4LKAnVdZx9lOnb3DdJ/Ud9XlfAOpt41EAyCuetBlupR/81wxC09q7DBj/opNpxgze9RQZLd7JfewKnrgJxLMn1Bm946ACFvA6eDLh4Ksppot4W7za2aZv99RSmXlp+psFDellLcGg+JSQX71I= 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=Gn2r9Z1o; arc=fail smtp.client-ip=40.107.21.71 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="Gn2r9Z1o" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=gEEfZP6YRt292ER38JoR5047gIIPdRqJ5n1c4EBk3Sk45m7r1HvuuCclqxBVVFERefV6gCsnAIz3QCGDilyjfUiFmuqPkCwqNlCkuuv0P8nsrin2onUYwd+bVNjRIxWnJtwaBBXzlOaR3MC5ChGospo149R1GQ98f0Iv6Wjk3pwxjmJ2kuMhlBhQUNASSzWq5euyO44AGjwWN+O1Dm2ghRSFtkCPyatH4hFtCMMQttlGXHj0b6HYx+nlIfj1m7K8UoYFfHJqNy6rIloiBozmhnsI5qzHgTJdve0QaYlscJuL5rmJMUlIbswNJ0QvMRQuD3Jsh/gIVFRkXU3E5wAJmw== 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=+mzp2Bo8HWoNWJlsXVMdq+48BQWLo31kyjde7J1Sd90=; b=l5nLquMZ/L1Sr2XFNClL5TT63TFHP9Ogjci/HEDxSk1ZFojw7b9ucgwdNJ/VBXVpB3gvq7ayVH7NBhmicE5MwxTHauHg0oPMxmG+4BvO8dt6pvoHSF3hyTRD+mYvK8P5zdrNOYNoxom7uMc58oQN5QvuNoTugvPDIT+xy+VzjZSEijbL1EkKH7HCbQwBE59q6nX3vAQuR1q/Wn/STz9DQbncItx1RT6f/i0ZLTEyHog/qoA+mipezYv8FLXybOVYzjNDpLqqw30J0lBVJho2ADMwYdo9UwbWjuocjgTIQ+CxQyNMSOhOtHQtP3Z9VJmYDxyNs+rwOxaffC2pDgaKwA== 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=+mzp2Bo8HWoNWJlsXVMdq+48BQWLo31kyjde7J1Sd90=; b=Gn2r9Z1oOrSYoSNtnMQ0F1kjE5JEHjPWcDaMp7Sw+WsMRLsZrWcmcCG+RM3vzgER4SLZelVqos0FZT4UD3k0aISdYKOFJ3a66cODnQ0j1UG5TMK2AMP7+wnjdoU16zUvBcFkO4ZhxRfLz7V6l3+eNZqF7g/aPMVhZM226OLOJlMbPFR+IKpRSsH8jZTtlhOEy1tKIb1rx6CCQjKwMeUbPGpAvluNlsBvuUBE8838fLv1s4WZlc19h46o+bhRGVKsI+ZFyVlZCoHMfMurE0mj9R7WeaHtWFimPO4N7XwYCMVK3ezoqFGha1QQbxwN45owweKBlTeezwy+SeVAA2oEdQ== 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 DB9PR04MB9939.eurprd04.prod.outlook.com (2603:10a6:10:4c4::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8251.22; Wed, 18 Dec 2024 23:09:43 +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.8272.005; Wed, 18 Dec 2024 23:09:43 +0000 From: Frank Li Date: Wed, 18 Dec 2024 18:08:44 -0500 Subject: [PATCH v13 9/9] tools: PCI: Add 'B' option for test doorbell Message-Id: <20241218-ep-msi-v13-9-646e2192dc24@nxp.com> References: <20241218-ep-msi-v13-0-646e2192dc24@nxp.com> In-Reply-To: <20241218-ep-msi-v13-0-646e2192dc24@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=1734563339; l=1851; i=Frank.Li@nxp.com; s=20240130; h=from:subject:message-id; bh=XbEugLgmvGxvNIdnJ6oC4l02fBY7NXWQcWS+O1eGi8g=; b=81AcSMGeFlxfUHquQMk7Fg7MeC1faazKrYD5j8kpN0H3MYmxZsXa70fmnVx9A7kvHwfdm4OsW TMLtqgFVYcBB1vz7Y03kl4pAs7ZepKqfVBPN9zKKSsUyzcBBPR+sAua X-Developer-Key: i=Frank.Li@nxp.com; a=ed25519; pk=I0L1sDUfPxpAkRvPKy7MdauTuSENRq+DnA+G4qcS94Q= X-ClientProxiedBy: SJ0PR13CA0075.namprd13.prod.outlook.com (2603:10b6:a03:2c4::20) 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_|DB9PR04MB9939:EE_ X-MS-Office365-Filtering-Correlation-Id: d4ada4fa-9cb3-4f1a-b49a-08dd1fb90ea2 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|7416014|1800799024|366016|52116014|38350700014|921020; X-Microsoft-Antispam-Message-Info: =?utf-8?q?W0FApkig5edrjnomyGjaBZqyendADio?= =?utf-8?q?7lq0tARUziazNhRBcq1HQ308zONHOTYexPBvvx0d6aRM5MAe/QTwss4bDOCyrbwjS?= =?utf-8?q?QKyWQ7BOtZBhlYsnMYR4GFagvcVf0Zh+N45FWd3LwNpft7LIhXteDXDQE/sn1QkdT?= =?utf-8?q?ker0tkTHO0U/65K6mYskYgi2Q442yxyT618iSOqQ2Vl7npwdmhyzSQ+d6YTwpVn+y?= =?utf-8?q?MZaQE7rh63BgRL2jbv6EANW/+yHbmu4Vm7ClhtlMXrV+MYXTHTwzK3Mxjaa15lGMH?= =?utf-8?q?EQp2nGEAEXin0U2tyUTppugcbyC31ZHe9APH7XngJ+lwvyGa5U3oMBlAmWNU/f6h6?= =?utf-8?q?hIQY/rnt8Z9erg6in2YEUeAkNdT6JEnwoVdux8/t6e7wUuRVT+fa+9H+49wHoL+jq?= =?utf-8?q?NDdmjztCkFmbtbPP2rcH9ddzF8kYVGbmI0J+fmTRRNKTyF9MKAptWkKu5nn3qmtIt?= =?utf-8?q?LmE0qupd83hTjF2cPVic8NIC4yV1I91N1nXbidhA3ylUVGRDsk6LU+6APC8AK68/H?= =?utf-8?q?3g3aNi9xXmRO6fQZmzn86+ohOIfzaCuJ7tS+HJrA4Ff3GGsdnQjsCp0h3+0v1zGnf?= =?utf-8?q?aQlVGsJy0iTXVdNJPNwXP361prnmHY8fwYbLo53CSJ9A45AJpfjxM0FsbG7kk8NXY?= =?utf-8?q?ZM0bpAegYXlpJHfFoKMnmf8hfnVRa4g5qGMsHtbafAjYaatS2/KaP4P944rhJYCoZ?= =?utf-8?q?MArSB6xvPeUOmHzIW485dYmoK8n4xP3pIE4kQ5JeNmcBuyqDoV6SxOBZzQsXz9uIL?= =?utf-8?q?W7r6C20oO4sDx6aneeVgS1ZzWEQROttgBao7RtIPzCrarRMki+yWnBlgQtXkOt4/M?= =?utf-8?q?FKfMEOEGKBqQF3RFFtTHNS1kA33aAcaIwuuSBEi1T9WZZnGtVWmCPcOux0onOWnBj?= =?utf-8?q?KCGKM7ATw6Ac3AgiYhSaGTGORz5QaphoQ8pmn3eEuR+Otj0QpOzCh7+HgoUoNtryS?= =?utf-8?q?ZWj0dfdGVytAEFi57qSD/zY8MA1+ufyjfxIQeQ2AEe7eJKj7FKWZaI8eXKnGBnnEL?= =?utf-8?q?TLhcRAjfmdOtS8fVzBs69F2AbexTt7iwCLBFgZdxWtKqo4IuNEjFUL+Zdkv36wasi?= =?utf-8?q?vXYGfYYwGMiuP9VklymSDyXvX6CGfJarcImhwhNX5BDv5o+4TTMWphLZgBQlqYUKx?= =?utf-8?q?oAARv61Evu80/E4CvcktwBpHMdioF7sdPO9tluzh0Y90zLjwPlxIVdetJIs3shdmb?= =?utf-8?q?A2mUiNoSrwXaXw4Uh7sc8nWDTXHE0vbzGL27fgV0Wue3NOrjWSNmKq1Xp5SttAYZX?= =?utf-8?q?t/ZSb5JEdtgcFCkoPGG4KXpQ442l0YuahsFc8Kf4VqIWlxPCk9aeVMZv216oFz+5/?= =?utf-8?q?ZYpwCUK8Q6O3GxXXpwVrciwImtNwqHbvAIE7VmP56aGojCEkalxT9ndNc+VFKkaXD?= =?utf-8?q?50YNgQ2vTg9QPxq7YCrsHohO7GXAWgkzQ=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)(376014)(7416014)(1800799024)(366016)(52116014)(38350700014)(921020);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?SQ3l8lWo6GN0FSS0QMSDl3AEMTl2?= =?utf-8?q?ddf0Wb7MSf+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?q?twK7vlgO1+jYlYG0Jt18tmfFkyg59k5uMuzfe6je2Y83emuouNBgfM0wbGHMSoVIC?= =?utf-8?q?8yJthTX6ui9uk8ACpQo9xf4fngUeAo8L9Z5d0xWSFGWIOOuEZtKKNgYuVIowWnNDU?= =?utf-8?q?Tt0t9PZ4Az9BaWNCyiPSLYelxm20XXuVRtBCmQmmuBNkeYabtEXImA7VW6IvYIwP/?= =?utf-8?q?2vk0oN9Wxz/Ctolsp+lUbI99164fQC8iaIi1aEoFbAaGasyxHld2kOxMr5etyEbTG?= =?utf-8?q?/7PkhdMNqLymlGCIeE6LN4Z2QMLG8/9PsDHzdTGMFwjCWpenQRviO4tVGSQo05HZH?= =?utf-8?q?d4zI7eGC706WJEPtXyQp0L0TOZ44JVwQOumBVszgK3TOi8zmNUBohg0VcLsjmDzmT?= =?utf-8?q?pDbABUnFLiJ2pjfUd5bMqOX7kZcf3l5sfRjVYWLI0wSKj70HB3h9ZUGE5svqVgxJi?= =?utf-8?q?qxLcg17SD0FAVrgA76eJNArhVHMYMyFcLLekoMTApm7+iUccGQkdBnl3uDK/nhBru?= =?utf-8?q?+EM1/XJbe7Jv6meww7E7MK3t9HoLOauCWwPmdl53P+nfZeFbf8S/bDMmKjiB2rG+/?= =?utf-8?q?nJUaw0nEP6WxEQf3M0yNlpt5M2+kiFGwQ2tdjzLJSnl0tw78sXB+Zh9s=3D?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: d4ada4fa-9cb3-4f1a-b49a-08dd1fb90ea2 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9642.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Dec 2024 23:09:43.2164 (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: nJZTYQL2gyBaNYzeAj9nov/0qtEXJP8j+V9zwTdOc1zQOdmEDJAv6xcBHu/5kAwV4XwIGyqmf0UGDY2L01JSnw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB9PR04MB9939 Add doorbell test support. Tested-by: Niklas Cassel Signed-off-by: Frank Li --- Change from v3 to v13 - 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;