From patchwork Fri Apr 4 19:01:01 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 14038787 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id D9EEAC3601E for ; Fri, 4 Apr 2025 19:03:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:MIME-Version:Cc:To: Content-Transfer-Encoding:Content-Type:Message-Id:Date:Subject:From:Reply-To: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=s9rWME1fHcdRCa7nqHfamWv+Nn1xkbdNmVYnUkJi1Jw=; b=QZ/qnQStOF8qlM2U42PSJXwAnK 2kAkDUb50ALY8JYKDT856WrzBdwU+RF4BG31jyoI8groOxYWl9aNljVbxdXCiJWVgizKaOFx0gKgH rCcCz0d2FEQwEtDpXE0d5gxwvltPFuZ4fzTW25Whvv1JlivH49CLXx/KIbuXakZDl/BlVfckiuvHN BwiZoVSyrLhxj4M3CvkHIXK6dg/7gynh6qnsI4juJIEsMtODtUUyluVXYbI6YStfFtAp92GVlMLMS 4hxo9KTYg2To8G+EK78ZHVNP+eA76HUECNc+wzJbtn1DIztgGsSLHqouQWPVkywmDRhvOjX9+MikW 7NrX0Pfg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98.1 #2 (Red Hat Linux)) id 1u0mKP-0000000CaOz-48PB; Fri, 04 Apr 2025 19:03:45 +0000 Received: from mail-am6eur05on20609.outbound.protection.outlook.com ([2a01:111:f403:2612::609] helo=EUR05-AM6-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.98.1 #2 (Red Hat Linux)) id 1u0mIS-0000000CZo6-14AH for linux-arm-kernel@lists.infradead.org; Fri, 04 Apr 2025 19:01:45 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=mhjHP4bnNQT3M17rhtkzZo1shksj1dyH2/YRjdcjqv1PDt9HF7rUYwDiumXVw93tqL+XhWEuE47Zbxs8vZs+1l6rCTUGBkdeMKw5db8TuXdRhx8P5dcAkd9py/Yf4wk4k5NDIa8JkN1JMGALCwbxNLIF+Lv7Kb/AldtpKWrHFQYn37hgsW2Qsi9UsQUu9cRZjhx1PLFgU/BAKUBbxKZuFi3as8JybIILzuuadfEOwTAbBzi0w16zjkgqL1hCmaWnUfAWlzz9cF2QB/GYiVbslBsrNSTlX4oTPl3t/hch1mCJOvnKaOSt3+id8oULOaRQ7xvpUEaOiWMOTamMs7EEmw== 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=s9rWME1fHcdRCa7nqHfamWv+Nn1xkbdNmVYnUkJi1Jw=; b=DQxSB49gi0CzqN48Nbfynui4rRyNLQr0tqWlkw42Py+dZeY/rvxKe8J9jKu/zIQYZfxiJPINJiOfoow949kZIFc6Ma6gLey6n8PGF0Lc+lXtt3YnjRye4Y7FHfGLZonwUV8NE1S6EY3C5DWSX/N6rOtZAc5ZxiVmhnhp7uA/qBu+6kDpbzKpRzmZrwVAaM7aT7mQDP6uI6RZeb3s4+mERDIvbAaWuAvBS2EqMOkIWslz64Br/IitgE6yPVdK424UB1TddolSwh3i1vsI40zwuxbBd9L0AbKcXeQitGrRFfIh4Mj4Gak64BHemC0ORORCkKvFzbZZBjprIZTgpzyEUg== 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=s9rWME1fHcdRCa7nqHfamWv+Nn1xkbdNmVYnUkJi1Jw=; b=A6onMtYoVkCIE6LHYXAlx9oky8Bx9QLs9OZfWBdLCKEFZDlOxZL1ZoVXIhWKahPR39dZJw+Phe3kx7qo/5uDm2pKCCxtzfJJL+7/rE2PI7O1n3LKlwKMrCIqNh9cl/fmW5GFx2zvirfTkKXQ0qBTUlTLGDb+Amz5zouiIR4E1n8vs69ctlPkdqlsp2MzB9y0iwb/JUuYawIVrRQu2nYSl6foTQKE9lp6dSth2ukjVVh1dypYO5AnFp+Qw7InuXcVzYss86N9CGdS8tuuwfja4VEQp1stTS1EA/XU+CXk5zUKBMPd9WSI5fzHV5B5B6rBi83+g7ARzA21vkjfwH5rrQ== 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 VI1PR04MB6957.eurprd04.prod.outlook.com (2603:10a6:803:135::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8534.49; Fri, 4 Apr 2025 19:01: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%2]) with mapi id 15.20.8534.048; Fri, 4 Apr 2025 19:01:34 +0000 From: Frank Li Subject: [PATCH v16 00/15] PCI: EP: Add RC-to-EP doorbell with platform MSI controller Date: Fri, 04 Apr 2025 15:01:01 -0400 Message-Id: <20250404-ep-msi-v16-0-d4919d68c0d0@nxp.com> X-B4-Tracking: v=1; b=H4sIAG0s8GcC/13Sy27DIBAF0F+JvK4rZoZnV/2PqgsYoPEiD9mVl SrKvxdHisFegnyuxsy9d1MahzR1H4d7N6Z5mIbLuRxAvx06PvrzT+qHWC46FChBgOjTtT9NQ2+ DZB+IAoTUlY+vY8rD7Zn09V3Ox2H6vYx/z+CZlttXhHpFzNSLnlNk6zxoBv95vl3f+XLqloBZN ohgRbIgAyZ6jM4FtFukKgJhV6QK8iCdAhZRCLNFukGAK9IFSZWdQUzEuBvPtEiuyBQUpWfjfQ4 ReYtsi/SKbEE6Q9Y25wghbJGrCAWtyC3/pEUMTBlUjFsEolV1vrJB0VvDZGyRUe8ZtMxVBsuzS 5LZW3Im7Bk2DOqyymuKnihKRZi9QrFj1LK6LliaoaVOCA4jo9yxtRpKoDCVLd1w2kAA0hnDrhu gGtYOubQjsGeGgsC7yh6Pxz+uqlXbIwMAAA== To: Kishon Vijay Abraham I , "Rafael J. Wysocki" , Thomas Gleixner , Anup Patel , Kishon Vijay Abraham I , Marc Zyngier , Greg Kroah-Hartman , "Rafael J. Wysocki" , Danilo Krummrich , Manivannan Sadhasivam , =?utf-8?q?Krzysz?= =?utf-8?q?tof_Wilczy=C5=84ski?= , Kishon Vijay Abraham I , Bjorn Helgaas , Arnd Bergmann , Shuah Khan , Richard Zhu , Lucas Stach , Lorenzo Pieralisi , Rob Herring , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , Krzysztof Kozlowski , Conor Dooley Cc: Niklas Cassel , dlemoal@kernel.org, jdmason@kudzu.us, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-pci@vger.kernel.org, linux-kselftest@vger.kernel.org, imx@lists.linux.dev, devicetree@vger.kernel.org, Frank Li X-Mailer: b4 0.13-dev-e586c X-Developer-Signature: v=1; a=ed25519-sha256; t=1743793288; l=12126; i=Frank.Li@nxp.com; s=20240130; h=from:subject:message-id; bh=eNJfyotzDvdW+GxhJmn0oIbs6GUBdCfXtVFciRKR1U0=; b=PVcn8ylqnd9JaE/y6Lpm66QPZPomTZ0Xx/BnwNku2zAfuvvaZtuB0Hi2uFdMur/B8KAcrKjdN NiSJY9tlv+hCCoOtASnZ6cgS9hNvrQA3BtK3WU0q9CpAiZ8P/F4AWFA X-Developer-Key: i=Frank.Li@nxp.com; a=ed25519; pk=I0L1sDUfPxpAkRvPKy7MdauTuSENRq+DnA+G4qcS94Q= X-ClientProxiedBy: PH8P222CA0011.NAMP222.PROD.OUTLOOK.COM (2603:10b6:510:2d7::35) To PAXPR04MB9642.eurprd04.prod.outlook.com (2603:10a6:102:240::14) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB9642:EE_|VI1PR04MB6957:EE_ X-MS-Office365-Filtering-Correlation-Id: 7b2e0044-5272-4922-a135-08dd73ab1e73 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|52116014|1800799024|366016|7416014|376014|921020|38350700014; X-Microsoft-Antispam-Message-Info: =?utf-8?q?IfHPuPlHQ8ARyzdcqRQ37VXnPAFeOPm?= =?utf-8?q?mEISW5RJutOYDeigUXFJeoSHlwoAd3RR93BUc0P6mu7Qx8eeH96cinlJcifncwzQV?= =?utf-8?q?mzzOMX1RK5SMg0SxJKRLEPro5ZTwqH0LamGlBbM8K21Y2af+qQRBr2m30Vuoqps9s?= =?utf-8?q?4D0ow4cPTuChFTfSJSQpXILyoM3caD8r8QaqKq95cUijMZ5bn0g20sx3SHbSuF/md?= =?utf-8?q?pTkyol1VSXFxC0UaSZCZF6+S5QxnAphLRbSLuE2NqliiRNFOenF/jBIH61cYHz/H1?= =?utf-8?q?vs0yZ0LA8gSG30EDQn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iWzg60bqldv0ppxnbrBhEOgpFvzc8HgiMCXIoECm?= =?utf-8?q?sctRoQuUITLwzq4bSaTCeu7jUEoIFtG48l/u07Yap47hcXlbPHXJjpAlFPwafRfOV?= =?utf-8?q?lPfgywaK853hLGlu9i/R/FsHjHCCXogD91OMVCx/EGIwGVkVaBJQqQiHsLw503Q/2?= =?utf-8?q?thxf++WEXilPeRdcj5+ectCqFJED13adtjnE/KKGX0j7jJ/22sTjK9oISVwTuQnP2?= =?utf-8?q?hhya4ZWli2rE+Wh4/BDxWAjWHDf+Q9KBw=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)(52116014)(1800799024)(366016)(7416014)(376014)(921020)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?RTviZ2bQHyZVwEnla+DCpUqIwrbk?= =?utf-8?q?Z9JabLOO41y+MSJ5jw2ALUWjwWpLWnKRx9ihPdBhmauBMcfzi429qfHEjwPblrt+M?= =?utf-8?q?4iJalZk8ZMna8ueJDFpNmcu56XSKikT5BmXO4EjRTBQaAHmQ1I4T3aaEv5pC/5i53?= =?utf-8?q?+yMGU3rMYtUjh5seN16r+ZsZzMAPBxJRLTiYgX+ZqhfropIBov8Q44xh3ctiRDvCA?= =?utf-8?q?Cjs1r5GbWlvlmN+gjX+m85kTQ1j6E1Om/WS9vos1JbdDylsuDpGVFOmvK1iz+TMR4?= =?utf-8?q?5EJ+NvyoBO/Kbttld9erkKuvKKH1LnQy3bFD8d4EfItxjKfHZWblrSEU2H1Qq8dxz?= =?utf-8?q?5sCcMAH/idKFga1PBlAvCRxllLl2G1vxWLjolU+VAkNjyJUOmIszhXSJQ3aiRPWJV?= =?utf-8?q?f3DAB8S9AxsdSiFnhd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pz3AXG8Q/hw1UrpQkDsuE9+G1QIJMrLYeC+aurNKK1AFTRR1sHwHtqRovc?= =?utf-8?q?AMorbOykDb31A5qPJ9fdIRfPyVz3X38RewPztHPQYKCar7eWmCtz6+YjzHpO2o7rv?= =?utf-8?q?Jnow01lBNqyPS9U+oVvj272JoBF0u65IraTiTyHtEc9nZGV5DRSobrPQhnvgTeDVF?= =?utf-8?q?aUxSP6dr3RrWUU9LamVUg6zaQYIRZM1VCXU6h75yM8T2xGUeZlFV9n+8=3D?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7b2e0044-5272-4922-a135-08dd73ab1e73 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9642.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Apr 2025 19:01:34.6104 (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: ZoJ/rauNIYZk1FlIfD3xAVdWWEbyvzvuvC2VKrCennG1AIJznQunfqi1QK+CFfZVz8+OKmB0Zb8M38tP8uCu0w== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB6957 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250404_120144_465950_EB8A0EA1 X-CRM114-Status: GOOD ( 13.13 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org ┌────────────┐ ┌───────────────────────────────────┐ ┌────────────────┐ │ │ │ │ │ │ │ │ │ PCI Endpoint │ │ PCI Host │ │ │ │ │ │ │ │ │◄──┤ 1.platform_msi_domain_alloc_irqs()│ │ │ │ │ │ │ │ │ │ MSI ├──►│ 2.write_msi_msg() ├──►├─BAR │ │ Controller │ │ update doorbell register address│ │ │ │ │ │ for BAR │ │ │ │ │ │ │ │ 3. Write BAR│ │ │◄──┼───────────────────────────────────┼───┤ │ │ │ │ │ │ │ │ ├──►│ 4.Irq Handle │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ └────────────┘ └───────────────────────────────────┘ └────────────────┘ This patches based on old https://lore.kernel.org/imx/20221124055036.1630573-1-Frank.Li@nxp.com/ Original patch only target to vntb driver. But actually it is common method. This patches add new API to pci-epf-core, so any EP driver can use it. Previous v2 discussion here. https://lore.kernel.org/imx/20230911220920.1817033-1-Frank.Li@nxp.com/ Changes in v16: - remove arm64: dts: imx95-19x19-evk: Add PCIe1 endpoint function overlay file because there are better patches, which under review. - Add document for pcie-ep msi-map usage - other change to see each patch's change log About IMMUTABLE (No change for this part, tglx provide feedback) > - This IMMUTABLE thing serves no purpose, because you don't randomly > plug this end-point block on any MSI controller. They come as part > of an SoC. "Yes and no. The problem is that the EP implementation is meant to be a generic library and while GIC-ITS guarantees immutability of the address/data pair after setup, there are architectures (x86, loongson, riscv) where the base MSI controller does not and immutability is only achieved when interrupt remapping is enabled. The latter can be disabled at boot-time and then the EP implementation becomes a lottery across affinity changes. That was my concern about this library implementation and that's why I asked for a mechanism to ensure that the underlying irqdomain provides a immutable address/data pair. So it does not matter for GIC-ITS, but in the larger picture it matters. Thanks, tglx " So it does not matter for GIC-ITS, but in the larger picture it matters. - Link to v15: https://lore.kernel.org/r/20250211-ep-msi-v15-0-bcacc1f2b1a9@nxp.com Changes in v15: - rebase to v6.14-rc1 - fix build issue find by kernel test robot - Link to v14: https://lore.kernel.org/r/20250207-ep-msi-v14-0-9671b136f2b8@nxp.com Changes in v14: Marc Zyngier raised concerns about adding DOMAIN_BUS_DEVICE_PCI_EP_MSI. As a result, the approach has been reverted to the v9 method. However, there are several improvements: MSI now supports msi-map in addition to msi-parent. - The struct device: id is used as the endpoint function (EPF) device identity to map to the stream ID (sideband information). - The EPC device tree source (DTS) utilizes msi-map to provide such information. - The EPF device's of_node is set to the EPC controller’s node. This approach is commonly used for multi-function device (MFD) platform child devices, allowing them to inherit properties from the MFD device’s DTS, such as reset-cells and gpio-cells. This method is well-suited for the current case, as the EPF is inherently created/binded to the EPC and should inherit the EPC’s DTS node properties. Additionally: Since the basic IMX95 LUT support has already been merged into the mainline, a DTS and driver increment patch is added to complete the solution. The patch is rebased onto the latest linux-next tree and aligned with the new pcitest framework. - Link to v13: https://lore.kernel.org/r/20241218-ep-msi-v13-0-646e2192dc24@nxp.com Changes in v13: - Change to use DOMAIN_BUS_PCI_DEVICE_EP_MSI - Change request id as func | vfunc << 3 - Remove IRQ_DOMAIN_MSI_IMMUTABLE Thomas Gleixner: I hope capture all your points in review comments. If missed, let me know. - Link to v12: https://lore.kernel.org/r/20241211-ep-msi-v12-0-33d4532fa520@nxp.com Changes in v12: - Change to use IRQ_DOMAIN_MSI_IMMUTABLE and add help function irq_domain_msi_is_immuatble(). - split PCI: endpoint: pci-ep-msi: Add MSI address/data pair mutable check to 3 patches - Link to v11: https://lore.kernel.org/r/20241209-ep-msi-v11-0-7434fa8397bd@nxp.com Changes in v11: - Change to use MSI_FLAG_MSG_IMMUTABLE - Link to v10: https://lore.kernel.org/r/20241204-ep-msi-v10-0-87c378dbcd6d@nxp.com Changes in v10: Thomas Gleixner: There are big change in pci-ep-msi.c. I am sure if go on the corrent path. The key improvement is remove only 1 function devices's limitation. I use new patch for imutable check, which relative additional feature compared to base enablement patch. - Remove patch Add msi_remove_device_irq_domain() in platform_device_msi_free_irqs_all() - Add new patch irqchip/gic-v3-its: Avoid overwriting msi_prepare callback if provided by msi_domain_info - Remove only support 1 endpoint function limiation. - Create one MSI domain for each endpoint function devices. - Use "msi-map" in pci ep controler node, instead of of msi-parent. first argument is (func_no << 8 | vfunc_no) - Link to v9: https://lore.kernel.org/r/20241203-ep-msi-v9-0-a60dbc3f15dd@nxp.com Changes in v9 - Add patch platform-msi: Add msi_remove_device_irq_domain() in platform_device_msi_free_irqs_all() - Remove patch PCI: endpoint: Add pci_epc_get_fn() API for customizable filtering - Remove API pci_epf_align_inbound_addr_lo_hi - Move doorbell_alloc in to doorbell_enable function. - Link to v8: https://lore.kernel.org/r/20241116-ep-msi-v8-0-6f1f68ffd1bb@nxp.com Changes in v8: - update helper function name to pci_epf_align_inbound_addr() - Link to v7: https://lore.kernel.org/r/20241114-ep-msi-v7-0-d4ac7aafbd2c@nxp.com Changes in v7: - Add helper function pci_epf_align_addr(); - Link to v6: https://lore.kernel.org/r/20241112-ep-msi-v6-0-45f9722e3c2a@nxp.com Changes in v6: - change doorbell_addr to doorbell_offset - use round_down() - add Niklas's test by tag - rebase to pci/endpoint - Link to v5: https://lore.kernel.org/r/20241108-ep-msi-v5-0-a14951c0d007@nxp.com Changes in v5: - Move request_irq to epf test function driver for more flexiable user case - Add fixed size bar handler - Some minor improvememtn to see each patches's changelog. - Link to v4: https://lore.kernel.org/r/20241031-ep-msi-v4-0-717da2d99b28@nxp.com Changes in v4: - Remove patch genirq/msi: Add cleanup guard define for msi_lock_descs()/msi_unlock_descs() - Use new method to avoid compatible problem. Add new command DOORBELL_ENABLE and DOORBELL_DISABLE. pcitest -B send DOORBELL_ENABLE first, EP test function driver try to remap one of BAR_N (except test register bar) to ITS MSI MMIO space. Old driver don't support new command, so failure return, not side effect. After test, DOORBELL_DISABLE command send out to recover original map, so pcitest bar test can pass as normal. - Other detail change see each patches's change log - Link to v3: https://lore.kernel.org/r/20241015-ep-msi-v3-0-cedc89a16c1a@nxp.com Change from v2 to v3 - Fixed manivannan's comments - Move common part to pci-ep-msi.c and pci-ep-msi.h - rebase to 6.12-rc1 - use RevID to distingiush old version mkdir /sys/kernel/config/pci_ep/functions/pci_epf_test/func1 echo 16 > /sys/kernel/config/pci_ep/functions/pci_epf_test/func1/msi_interrupts echo 0x080c > /sys/kernel/config/pci_ep/functions/pci_epf_test/func1/deviceid echo 0x1957 > /sys/kernel/config/pci_ep/functions/pci_epf_test/func1/vendorid echo 1 > /sys/kernel/config/pci_ep/functions/pci_epf_test/func1/revid ^^^^^^ to enable platform msi support. ln -s /sys/kernel/config/pci_ep/functions/pci_epf_test/func1 /sys/kernel/config/pci_ep/controllers/4c380000.pcie-ep - use new device ID, which identify support doorbell to avoid broken compatility. 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. Change from v1 to v2 - Add missed patch for endpont/pci-epf-test.c - Move alloc and free to epc driver from epf. - Provide general help function for EPC driver to alloc platform msi irq. - Fixed manivannan's comments. Signed-off-by: Frank Li --- Frank Li (15): platform-msi: Add msi_remove_device_irq_domain() in platform_device_msi_free_irqs_all() irqdomain: Add IRQ_DOMAIN_FLAG_MSI_IMMUTABLE and irq_domain_is_msi_immutable() irqchip/gic-v3-its: Set IRQ_DOMAIN_FLAG_MSI_IMMUTABLE for ITS dt-bindings: pci: pci-msi: Add support for PCI Endpoint msi-map irqchip/gic-v3-its: Add support for device tree msi-map and msi-mask PCI: endpoint: Set ID and of_node for function driver PCI: endpoint: Add RC-to-EP doorbell support using platform MSI controller PCI: endpoint: pci-ep-msi: Add MSI address/data pair mutable check PCI: endpoint: Add pci_epf_align_inbound_addr() helper for address alignment PCI: endpoint: pci-epf-test: Add doorbell test support misc: pci_endpoint_test: Add doorbell test case selftests: pci_endpoint: Add doorbell test case pci: imx6: Add helper function imx_pcie_add_lut_by_rid() pci: imx6: Add LUT setting for MSI/IOMMU in Endpoint mode arm64: dts: imx95: Add msi-map for pci-ep device Documentation/devicetree/bindings/pci/pci-msi.txt | 51 ++++++++ arch/arm64/boot/dts/freescale/imx95.dtsi | 1 + drivers/base/platform-msi.c | 1 + drivers/irqchip/irq-gic-v3-its-msi-parent.c | 8 ++ drivers/irqchip/irq-gic-v3-its.c | 2 +- drivers/misc/pci_endpoint_test.c | 82 ++++++++++++ drivers/pci/controller/dwc/pci-imx6.c | 25 ++-- drivers/pci/endpoint/Makefile | 1 + drivers/pci/endpoint/functions/pci-epf-test.c | 142 +++++++++++++++++++++ drivers/pci/endpoint/pci-ep-msi.c | 90 +++++++++++++ drivers/pci/endpoint/pci-epf-core.c | 48 +++++++ include/linux/irqdomain.h | 7 + include/linux/pci-ep-msi.h | 28 ++++ include/linux/pci-epf.h | 21 +++ include/uapi/linux/pcitest.h | 1 + .../selftests/pci_endpoint/pci_endpoint_test.c | 28 ++++ 16 files changed, 527 insertions(+), 9 deletions(-) --- base-commit: a4949bd40778aa9beac77c89e4c6a1da52875c8b change-id: 20241010-ep-msi-8b4cab33b1be Best regards, --- Frank Li