From patchwork Tue Oct 15 22:07:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 13837321 Received: from DUZPR83CU001.outbound.protection.outlook.com (mail-northeuropeazon11013057.outbound.protection.outlook.com [52.101.67.57]) (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 202671F80C9 for ; Tue, 15 Oct 2024 22:08:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.67.57 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729030102; cv=fail; b=VFDTFGPmTDn2QDTem0CHVlgz96euZRzg+0xCEFNQf5rrAvGQDSmwkGHpJoFr87mzDaST5XWkhBotGaGwaFkFOx8AZ/4vmn8yyiQzShWmCvKZFsx5U3xt8GNT8V1wlaSEnOcu9aiSg5TED3bHUxUK96+dXlx7wgD+HqIKNPEl9Rw= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729030102; c=relaxed/simple; bh=OuA7849U5QN+fJd6KNFSJXtAX3g+s+58VR7NcMSn4OE=; h=From:Date:Subject:Content-Type:Message-Id:References:In-Reply-To: To:Cc:MIME-Version; b=t+4PlHTvp4DORXS7K52s9PzU6afdF9mDlvcDpIaCixDZG7LLs18YivT9hRSVjYy4cz164uiXX12GXQ4N+I7mlGeVyJht9wPew5CYWrFeUz+o5a7of1TZ8hV6psfjz3Rl9YtOib7QV0RqFiX/5MNYHMZpeTPm/jRInUNGfe9RCkE= 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=Q5V1lNrS; arc=fail smtp.client-ip=52.101.67.57 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="Q5V1lNrS" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=x+agtq6LJB2DLR2oa9SdP6zwIGr7ms7jhKfLlEF6xv/sdS97jYtYyOWTAxVMV+1zymPfsPE/klzzAO6ysIp8xoxWzZrUFvGfVx6nL85j6Odu+cHEs5W7qfqH1MCO/iaoefpYmvZ6UDugQHrpufKIW5GJ3+Sh7uY/dXhfhNPbDthy+qt3lKoGCytLf8K+Tqy9EetWNP4N+Q/8+pBlXoFdqIjmVSSFhjoA//+YXIAAVwNzB6GOQXRGNLT+IODqH13AzLCT/GUbXEPYO3jpwTSA7ZE/StBkfZef750JyiuEH7vxvzM5Jv/9Q6382MJDtCq9BoqR1R1i5ssf/MFWhSOluQ== 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=ixq2N5yHgGG9SsucChG7MqayQqlFRic7PqHLPs/ALyU=; b=HM3w8Hq/n9aX4+WKJfAS9ua7y2qucXbhthlCLWPtcj0RDfBj9dcyRaxQ36zNDcW0/KH6N4gswmOl1eL3R1TcCflCl412GuewjELAWrjopK2ivDTDs9giicmQEzgmcN1d+IUK0qm4YcAPqz0xJ8pc8dKS90SWVu3BOOd/W104nKjvinnvkDlz3F5w+sO/eyKnKMS1QywgbC1qx7pXyDo9j6dtb3PBXiZ75Av7TGnIbsc2v1LhAA5IFL40T+04sEBPdpY36eP1Vt+XkRjdbdgvGcVsHpsK8GDRP7DEIDR8+NIUYhZotoazksCIfdHKiR3pKAV1EQzvxKRjohma/q+6gg== 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=ixq2N5yHgGG9SsucChG7MqayQqlFRic7PqHLPs/ALyU=; b=Q5V1lNrSX4oNbEuHHoSU04km2Hl4uMGmlnc8c7gkKrVv9IpNRBXmoy6Iu3Vk5Y+5FixBu7qFdS/gKVkpMWicmuXgH21JjkglUTgBzvaYb44qwhAknEq7R+aop5+tX5KfUtMAAv4mmeh5o+VcNXjABp6XhlXbJTRWK3c9K8U4j1hX+rkx9fjdX+3iuPuf176MRkLPx4JwJuia2J9hgENfUbDURUKOOi/zyljmH1fv0ZPp4IK9+xclr77U/3eF5/OQ15sROiGxg0ENhE6Jn2sQcHzU0QkUgVG5JnocBkjz5bCAXambwGl6p5yVzIMLfch5KOLrosiM6VXNGJk/52BQkw== 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 DBBPR04MB7788.eurprd04.prod.outlook.com (2603:10a6:10:1e4::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8048.27; Tue, 15 Oct 2024 22:08:17 +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.8069.016; Tue, 15 Oct 2024 22:08:17 +0000 From: Frank Li Date: Tue, 15 Oct 2024 18:07:18 -0400 Subject: [PATCH v3 5/6] misc: pci_endpoint_test: Add doorbell test case Message-Id: <20241015-ep-msi-v3-5-cedc89a16c1a@nxp.com> References: <20241015-ep-msi-v3-0-cedc89a16c1a@nxp.com> In-Reply-To: <20241015-ep-msi-v3-0-cedc89a16c1a@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=1729030073; l=5945; i=Frank.Li@nxp.com; s=20240130; h=from:subject:message-id; bh=OuA7849U5QN+fJd6KNFSJXtAX3g+s+58VR7NcMSn4OE=; b=JbkbUIvfNJmmZ7raOw1+A1Z4SuUrr/aGfwbaAuZ/xPbrKJdgX6iMQpL/iBlWXizVtcUl0k9OI 0fQd4gtDHJdBBBbYWkyyODK2hc16aW8plmTNr8OFbzr2IslxI7WdapG X-Developer-Key: i=Frank.Li@nxp.com; a=ed25519; pk=I0L1sDUfPxpAkRvPKy7MdauTuSENRq+DnA+G4qcS94Q= X-ClientProxiedBy: SJ0PR13CA0059.namprd13.prod.outlook.com (2603:10b6:a03:2c2::34) 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_|DBBPR04MB7788:EE_ X-MS-Office365-Filtering-Correlation-Id: 5f5d52a3-6ec6-48de-3ec8-08dced65df28 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|7416014|376014|52116014|366016|1800799024|38350700014; X-Microsoft-Antispam-Message-Info: =?utf-8?q?JfvcU33vG9BxCZmMG1A0GQkeI1mbeDm?= =?utf-8?q?17ClnA/qezcgK0nqPWcUYNYiNfwV5wtPbLa3kcXmRirnB+4b86/PHpMk0fYrCHsyS?= =?utf-8?q?nN3K3NfrpHU/wfle5FSvYTwB8IU5AUN4axB1APdQsdFnfp2n7hCQ3w6E0PJZ3Euss?= =?utf-8?q?htZ2mtppazCgo2EKhDmB6EslcWChkefDnlPxbrEEdBrq3pRSxbFG3nYOBZE+RCGIA?= =?utf-8?q?nKlrnvSjEPvjHeTblpU0fzKMw47DZ85ii+r3/Hgiee6HdZM3h+925TkA46dz004Nu?= =?utf-8?q?nMrSialjkbBCQYbSWqnEA07rdPe1mqcVWhHTCDnixCUI1Lqy1kWRxA/nfgktcSgAq?= =?utf-8?q?PWze4dlqP9HkSazjzf6B4nTka+oCcfaHgZPFLIp73Sb+9RXwkPQbB0yxDwX0N8Kfj?= =?utf-8?q?JsxuvZja/csEaUXsgP05IZcr0JfEVbbk++k66StFeblFcnXm0e1hJ9fdZxEDL/ZIX?= =?utf-8?q?a033jiByADr3Xm+2KWaywWgrxw09053hFBdgciaN+oB1P0GixikknAPFX9wBeFiNW?= =?utf-8?q?cnd1podwyNSUF1kvUYwv3y/j2VkrUu+v3PIKd5XfJE6vA+zsUy8hkL5ygNR3ftRd5?= =?utf-8?q?ZA8/rAjPF1JcnTOexK3klrcUnWfrQ+n9WbNKMhPNrWhyTgXk9m0ZLnuRUQx1uMzGX?= =?utf-8?q?Wa6LE0uejS8tEZamKJJ5UyZYbU96tSI1xUsP4dd0yX+D2JzejYPokL9aRVpdPv9gj?= =?utf-8?q?xjpXXcswc1MSP+FqGBwiEl6XbjNklwOiB0i647HzkAz+pqgSVCDs7dRiMCe9mv2gP?= =?utf-8?q?w29PHL3HOTYF2qF3r0G6vgLzpCKhSZ54onP3SHt+0fdoJ9c5OPr2UaEeU94ATK8wN?= =?utf-8?q?kSnfu41+ta7tlHnhzVgaBPbJ9XAtFJDBO41pbnaV3aYyAuBpUTUyavxyYu4ocyIjz?= =?utf-8?q?+bSWKbT0GzM9/LQsv1028WTXTybwtoUslEcByI5h6W3H83iRCLdxAZANqnFcgP2QM?= =?utf-8?q?IZOwbfTZ1Gi69pWWuBnJRYLyZ+kgUH7Jv/1jHQ+eA9jLMBeKyOKCkY4ZI1IlMtUWf?= =?utf-8?q?VOSP20SJO+3F0n0ECVB4j44UQev6meWGKXYwoDndz235l7iiAFiAjP1sPw+W/bSH0?= =?utf-8?q?GgqfIaCA+RIbVY8YOspA43T0Q4FC/dSLr6zSUPzgnKsor0c2gM/G7t/8WyvdMU6sP?= =?utf-8?q?eWYZvZ10XHagEQVVZbG8MllefpQlHdT9/p/EyWqsOk99BBqy8APHj6KgJMSSTbBTY?= =?utf-8?q?Rlq06k+7e4jvD0Fu2ySjyMZBwCR0l0skbwXPtpAL/AZ1S3RiA3Xbt6YAR+HWx6GA9?= =?utf-8?q?V5LgqssbFLsuvIDBuw3lJSG+EpqbUZHTe1g=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)(7416014)(376014)(52116014)(366016)(1800799024)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?bklggGjlVECMcTVH9x4LjdugN2D7?= =?utf-8?q?3uZgVBoDa4SUHeydcGLJ33Nx/Gdn0741UzaB/kKcr1wknBzsQAMElTKFYSE65qtbX?= =?utf-8?q?fYwTOptm8Z6OhFt+zdRBsrPhqYFXaMm5LYivjkQmjrz6J+UBOkuhW+xZNT8XVCEP7?= =?utf-8?q?kFOqR7n9r28UF3/AqixbmqGoXOxSA/YiNa3spE5xP6PD7eN+NTURLgYkqXryeq7m/?= =?utf-8?q?BG7iWiFja5BxSISE7Lzll/AZ5neGXotv+6xqoWKAH2Z1xxwvpe36nQgli8FQ+OqD1?= =?utf-8?q?PGAO66uIwacB24nBrZFYddZ2JBhP5i96a+U4IrEtXO4IgOTCU6hL8A686b0NuhbJn?= =?utf-8?q?0c3c4bJfNvDyCHWzdsx5YQVM4LSqlDqS5yQQ3KCTQv4KgO73T3V+73EfAOdbyKozP?= =?utf-8?q?2l5kR0JwVeRI6erftCNxfURpWGn8Hvsm8ztumnMkoxJs/BsxY2Vtyb1G5cagaTe0t?= =?utf-8?q?7jSNXqQm2nmL8ZWLINjUS75XmftTPEKV6yqF6GhpDZRqj6yagKURVkF9VbGCKWO0S?= =?utf-8?q?LsBkUrm366Pjev3X2J7Ydqj9SAT5DaAvg7RbPpKn1dBX56mOorl0AX0HFRgte9zEG?= =?utf-8?q?QFtJZu6wmnfZXUqycWQgEBCE6JucRFooh94gFqaX9NMOtXpNi/kW8xEN/gSaH53SV?= =?utf-8?q?kZm64uAhfmKy2zBINHO4Ctdp7uRBFpRnckiadgbl6zd370ljLIoJKOAEMXF6/9qAa?= =?utf-8?q?n+K75OrDODzT2C/JH3X8phK7oMESXj3lRCYs/gR3MvdbJgH16HjyZ2bYOu1fsULft?= =?utf-8?q?B+5LAtPXoPw5TldB5WKskEWaC6QLbwJfNXj20HyUFKtx8+0ZNk66j6cz4o7mNrFAu?= =?utf-8?q?sdl7Rhu2SOvvDWAQkILysEU5fKFa9ukX6K3ao6lfsN9Eych2x0acY5BN70I5R6vET?= =?utf-8?q?dtzc3MNOYfdb2qAhRSreo74AgfhwMmHB+QMtEQMh6vLZ6e2rGalp78Nqtj/IT9Itx?= =?utf-8?q?BOuxSVTd5+D870Hruv6/rjL6zhEgqIs9cnbsRcpVAp3rAGkPln25MFqkC5k+hPGOa?= =?utf-8?q?qpyCuz6syDbrN+2xymGTSE2p3zVbRBBAcfqcFU5ByzqXIkMPsFwUSaoLWyhcmMEQa?= =?utf-8?q?V7D+rJkcI2CFcYHTLMkmGu8AMru7AA5S5ZaFRA7t8kzLYvkjsob+vOGtR9wSbQltA?= =?utf-8?q?BDM2M3ATh8IwJf4PJbR7iY+MPUepdi4GXQTrO+MVxekjUoJvb02yvHLAH6iVO531c?= =?utf-8?q?fw8BpXT2F135pFxub33OjnJC2ADDb+Y8KygrA4Q5kmcI/zVa3w1I9dL8pM/pD+Ac+?= =?utf-8?q?hK6YpG6zOEDNJARZHUs3d169IP6Xy3zF0BDnFL4tnxM7hauqgq5ge/3++xDkcWMa4?= =?utf-8?q?caFkKslbS58jSAHnZlnpPB8MiEIlcK6QlB6SNrzWZ0LbrWfNxGrzZxyLze2T8mAdT?= =?utf-8?q?UtMNz6LfkxDhV17oSiWwEvvd4iMORjqJiUedALn8FDNEHwOXmQdrjg8L2Kz3cZ2LK?= =?utf-8?q?Xh69INr2wy1GHFnh7dxUwK/AU7N8WHUI7b787d68gMr/T5Q1NaFk49xw=3D?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5f5d52a3-6ec6-48de-3ec8-08dced65df28 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9642.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Oct 2024 22:08:17.2277 (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: msbM90+ebZPYKQpHhFvXvvFiHlDHm6HDjPCZA9PSUeKkGxGbp58DvKoBto9eF7Fz2BWUmCWPUAqHYpw+JDWavQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBBPR04MB7788 Add three registers: PCIE_ENDPOINT_TEST_DB_BAR, PCIE_ENDPOINT_TEST_DB_ADDR, and PCIE_ENDPOINT_TEST_DB_DATA. Trigger the doorbell by writing data from PCI_ENDPOINT_TEST_DB_DATA to the address provided by PCI_ENDPOINT_TEST_DB_ADDR and wait for endpoint feedback. Enable doorbell support only for PCI_DEVICE_ID_IMX8_DB, while other devices keep the same behavior as before. EP side RC with old driver RC with new driver PCI_DEVICE_ID_IMX8_DB no probe doorbell enabled Other device ID doorbell disabled* doorbell disabled* * Behavior remains unchanged. Return failure if pcitest try to test doorbell bar. Signed-off-by: Frank Li --- drivers/misc/pci_endpoint_test.c | 60 ++++++++++++++++++++++++++++++++++++++++ include/uapi/linux/pcitest.h | 1 + 2 files changed, 61 insertions(+) diff --git a/drivers/misc/pci_endpoint_test.c b/drivers/misc/pci_endpoint_test.c index 3aaaf47fa4ee2..a2b68c613c782 100644 --- a/drivers/misc/pci_endpoint_test.c +++ b/drivers/misc/pci_endpoint_test.c @@ -53,6 +53,7 @@ #define STATUS_IRQ_RAISED BIT(6) #define STATUS_SRC_ADDR_INVALID BIT(7) #define STATUS_DST_ADDR_INVALID BIT(8) +#define STATUS_DOORBELL_SUCCESS BIT(9) #define PCI_ENDPOINT_TEST_LOWER_SRC_ADDR 0x0c #define PCI_ENDPOINT_TEST_UPPER_SRC_ADDR 0x10 @@ -67,7 +68,12 @@ #define PCI_ENDPOINT_TEST_IRQ_NUMBER 0x28 #define PCI_ENDPOINT_TEST_FLAGS 0x2c +#define PCI_ENDPOINT_TEST_DB_BAR 0x30 +#define PCI_ENDPOINT_TEST_DB_ADDR 0x34 +#define PCI_ENDPOINT_TEST_DB_DATA 0x38 + #define FLAG_USE_DMA BIT(0) +#define FLAG_SUPPORT_DOORBELL BIT(1) #define PCI_DEVICE_ID_TI_AM654 0xb00c #define PCI_DEVICE_ID_TI_J7200 0xb00f @@ -75,6 +81,7 @@ #define PCI_DEVICE_ID_TI_J721S2 0xb013 #define PCI_DEVICE_ID_LS1088A 0x80c0 #define PCI_DEVICE_ID_IMX8 0x0808 +#define PCI_DEVICE_ID_IMX8_DB 0x080c #define is_am654_pci_dev(pdev) \ ((pdev)->device == PCI_DEVICE_ID_TI_AM654) @@ -108,6 +115,7 @@ enum pci_barno { BAR_3, BAR_4, BAR_5, + NO_BAR = -1, }; struct pci_endpoint_test { @@ -124,12 +132,14 @@ struct pci_endpoint_test { enum pci_barno test_reg_bar; size_t alignment; const char *name; + bool support_db; }; struct pci_endpoint_test_data { enum pci_barno test_reg_bar; size_t alignment; int irq_type; + bool support_db; }; static inline u32 pci_endpoint_test_readl(struct pci_endpoint_test *test, @@ -746,6 +756,39 @@ static bool pci_endpoint_test_set_irq(struct pci_endpoint_test *test, return false; } +static bool pci_endpoint_test_doorbell(struct pci_endpoint_test *test) +{ + enum pci_barno bar; + u32 data, status; + u32 addr; + + if (!test->support_db) + return false; + + bar = pci_endpoint_test_readl(test, PCI_ENDPOINT_TEST_DB_BAR); + if (bar == NO_BAR) + return false; + + data = pci_endpoint_test_readl(test, PCI_ENDPOINT_TEST_DB_DATA); + addr = pci_endpoint_test_readl(test, PCI_ENDPOINT_TEST_DB_ADDR); + bar = pci_endpoint_test_readl(test, PCI_ENDPOINT_TEST_DB_BAR); + + pci_endpoint_test_writel(test, PCI_ENDPOINT_TEST_IRQ_TYPE, irq_type); + pci_endpoint_test_writel(test, PCI_ENDPOINT_TEST_IRQ_NUMBER, 1); + + pci_endpoint_test_writel(test, PCI_ENDPOINT_TEST_STATUS, 0); + + writel(data, test->bar[bar] + addr); + + wait_for_completion_timeout(&test->irq_raised, msecs_to_jiffies(1000)); + + status = pci_endpoint_test_readl(test, PCI_ENDPOINT_TEST_STATUS); + if (status & STATUS_DOORBELL_SUCCESS) + return true; + + return false; +} + static long pci_endpoint_test_ioctl(struct file *file, unsigned int cmd, unsigned long arg) { @@ -762,6 +805,9 @@ static long pci_endpoint_test_ioctl(struct file *file, unsigned int cmd, switch (cmd) { case PCITEST_BAR: bar = arg; + if (test->support_db && + bar == pci_endpoint_test_readl(test, PCI_ENDPOINT_TEST_DB_BAR)) + goto ret; if (bar > BAR_5) goto ret; if (is_am654_pci_dev(pdev) && bar == BAR_0) @@ -793,6 +839,9 @@ static long pci_endpoint_test_ioctl(struct file *file, unsigned int cmd, case PCITEST_CLEAR_IRQ: ret = pci_endpoint_test_clear_irq(test); break; + case PCITEST_DOORBELL: + ret = pci_endpoint_test_doorbell(test); + break; } ret: @@ -839,6 +888,7 @@ static int pci_endpoint_test_probe(struct pci_dev *pdev, test_reg_bar = data->test_reg_bar; test->test_reg_bar = test_reg_bar; test->alignment = data->alignment; + test->support_db = data->support_db; irq_type = data->irq_type; } @@ -986,6 +1036,13 @@ static const struct pci_endpoint_test_data default_data = { .irq_type = IRQ_TYPE_MSI, }; +static const struct pci_endpoint_test_data default_data_db = { + .test_reg_bar = BAR_0, + .alignment = SZ_4K, + .irq_type = IRQ_TYPE_MSI, + .support_db = true, +}; + static const struct pci_endpoint_test_data am654_data = { .test_reg_bar = BAR_2, .alignment = SZ_64K, @@ -1017,6 +1074,9 @@ static const struct pci_device_id pci_endpoint_test_tbl[] = { .driver_data = (kernel_ulong_t)&default_data, }, { PCI_DEVICE(PCI_VENDOR_ID_FREESCALE, PCI_DEVICE_ID_IMX8),}, + { PCI_DEVICE(PCI_VENDOR_ID_FREESCALE, PCI_DEVICE_ID_IMX8_DB), + .driver_data = (kernel_ulong_t)&default_data_db, + }, { PCI_DEVICE(PCI_VENDOR_ID_FREESCALE, PCI_DEVICE_ID_LS1088A), .driver_data = (kernel_ulong_t)&default_data, }, diff --git a/include/uapi/linux/pcitest.h b/include/uapi/linux/pcitest.h index 94b46b043b536..06d9f548b510e 100644 --- a/include/uapi/linux/pcitest.h +++ b/include/uapi/linux/pcitest.h @@ -21,6 +21,7 @@ #define PCITEST_SET_IRQTYPE _IOW('P', 0x8, int) #define PCITEST_GET_IRQTYPE _IO('P', 0x9) #define PCITEST_CLEAR_IRQ _IO('P', 0x10) +#define PCITEST_DOORBELL _IO('P', 0x11) #define PCITEST_FLAGS_USE_DMA 0x00000001