From patchwork Mon Apr 7 19:50:54 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 14041710 X-Patchwork-Delegate: kw@linux.com Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05on2087.outbound.protection.outlook.com [40.107.20.87]) (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 6E104253F14; Mon, 7 Apr 2025 19:51:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.20.87 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744055499; cv=fail; b=Y7O0YyCY9tbxCq8z2dOmkPOxQFJW2LfrB9ulOU+9OM4gqmNq0j31LmVUgZ+vYXp9o66ZvrEKAqrYJmqbaNMx2NX46xrjo9GHX4HV5r2ftP2sGopjXlEYSPBaxDKPul6LDvVoGe/5YMrSMBjDNUZvCod5IRt9MyShuLILhH5+1O4= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744055499; c=relaxed/simple; bh=lx8wFQA410Ulvs80/pKL4VcApSvR4ds/sEngpDV8Kd4=; h=From:Date:Subject:Content-Type:Message-Id:References:In-Reply-To: To:Cc:MIME-Version; b=pNA8cLNaT7+SwYW4AP/0BFIs7hLUA7t5uE5NqS1lmN7U37XTfQpZi75FjbDM4pWWOAjyRNeHqs8r/MPHXZc9eXr6VEUIYhXzTnkygUcxIGQlMKl4h/qXx5R2lIoV78npbSiZ5xdfsvBzrAPYrdw1WNHDrUm4Mdhu1hgIcDlpwPg= 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=QiT+i9k/; arc=fail smtp.client-ip=40.107.20.87 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="QiT+i9k/" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=YfLvh87chlf20+02gN2m+yEPyWkQXjv6QgT0rza9uE9Rd8gU7PGQhx97vYEygWR12e6hKjRiw8Cr4w7jxyAOiQmurluHcnBP6ixm7kfKPwQIrjbHg7ZVNO5c9uxeI1HWe+pIN9MAR+nYL/5mydNpogTsAEPHQyOld5bpg3nVgTk5vRNdD4wjDodIKfJNUEycfbEWlJ1GVmHe7Pqjiw0URflpiyfekpckVn9QHqsgfJ+N1KIv1iKqVGmS7h7PijayXYa2r1PthRbcIOEEbjHVstiuqLAEd8aXEif0aXdhZwrQ7kzQmHQS8EHf9OwSNG2tr992qOZkYh22DwCNiGXsOQ== 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=4JrBsZtAlcOj29e5c0bW2M2CW0PWqPaa73Lwja/s/W0=; b=frKH0fV1DMZ3ANgEgJAB7hUoyEKPhIEhi0qdWrPoUWkTByBaIvUG7T/CDCdKfr6Q4ashGrBXm9nCt1/mCxgh7nqHHkhsj1h7jZ6ttj+Nd/C/iheYDYU/dFiznr+u8I80+YjuBd56o0AeTmXPE/nTOEbAbR+q+5CtyW2kqbhzf5YQy09BDETayDqV0URFhFLVFlVpRGPyOIxhC/uYYBi265DAcw/1/K8rfeSD1p1+P5zs3csIbqkEUnmOxGuxXR/+qUU1mMCVd1SQBt4F53M83+zYOIe4v8ap+Wk7R7LQfBLMbvn3UzsojNGbtBqaZatl68W/z+mdXDJUZ0JdRyU7mw== 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=4JrBsZtAlcOj29e5c0bW2M2CW0PWqPaa73Lwja/s/W0=; b=QiT+i9k/NZat/FKX+8XOeCWJUL7z4WTgqGvy6NhVgsiVpKTyt7azj6hD1Wd63TQ5DL3HooYFo6MypUSCDmbcqowDfbcRO/he43y5tXPSEeC5r4kZ1Si7Q2AjS22MjReGYdbXP8Ejj9yiUR/t2wkqAuHacl2tKPAFkNw1YpapOn2EpMZY5Jxk9P/IAyfQetDC7+pKyP/R4AVzypnLfsq/m/GZFGBwV2+5VCUeHywWb7DYJD9+EIanLKXvMrMHhpz4SPyUESjeGIZEcNbZqxnSKkBCaSxVyn+n54O8I67++U7xfGcRqczwevRtS1P3vJ+KJHxJByTbLxt/+M4x6zRzOA== 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 PR3PR04MB7452.eurprd04.prod.outlook.com (2603:10a6:102:80::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8606.34; Mon, 7 Apr 2025 19:51:35 +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.8606.029; Mon, 7 Apr 2025 19:51:35 +0000 From: Frank Li Date: Mon, 07 Apr 2025 15:50:54 -0400 Subject: [PATCH v17 04/15] dt-bindings: PCI: pci-ep: Add support for iommu-map and msi-map Message-Id: <20250407-ep-msi-v17-4-633ab45a31d0@nxp.com> References: <20250407-ep-msi-v17-0-633ab45a31d0@nxp.com> In-Reply-To: <20250407-ep-msi-v17-0-633ab45a31d0@nxp.com> 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=1744055467; l=4116; i=Frank.Li@nxp.com; s=20240130; h=from:subject:message-id; bh=lx8wFQA410Ulvs80/pKL4VcApSvR4ds/sEngpDV8Kd4=; b=I1R+jDG3YY35ycOben6Uf+GFMbs3NADfpUIB+/Lejqv8MZQ/THhseBoBuWYYBlww5NEQQEie7 tQ6xWc5mfZFCVpG8bw+bLzee6GopcdR0M+ULD+7pbLa7z6SCCOF5exP X-Developer-Key: i=Frank.Li@nxp.com; a=ed25519; pk=I0L1sDUfPxpAkRvPKy7MdauTuSENRq+DnA+G4qcS94Q= X-ClientProxiedBy: AS4P189CA0041.EURP189.PROD.OUTLOOK.COM (2603:10a6:20b:5dd::15) 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_|PR3PR04MB7452:EE_ X-MS-Office365-Filtering-Correlation-Id: 913b0e73-9d4a-480d-9298-08dd760d9a14 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|7416014|52116014|366016|1800799024|38350700014|921020; X-Microsoft-Antispam-Message-Info: =?utf-8?q?Hs3qbIkZrNEG/FD6gCltV7TZJFYcxtd?= =?utf-8?q?1h8H64Rqt0vUn5JS6DRPWhbJP4cdlzO7z4CBN4SWLYckJ0mQzjd1LJMZuMIqWhP9R?= =?utf-8?q?TSyD6HL2J3EH5FQSE5Kimmtxcx+RwwMVby3rWN/73SpX+MEgjDXnRi1QrWFspnavN?= =?utf-8?q?2NoCiecCwRE59Ot6oicagbWNY2uwoQY8a5/44i1opKGTMMsIb6PxrKU44eo363rnC?= =?utf-8?q?kC3A6vwYbcu+oeEyzKZ5pWqB+ngXaRdd7z+jWlEjMokn4SR1wzB/kAe6TGjux/Ran?= =?utf-8?q?vra1H8FCjjiSbxTUiPpmIjve+yu17NSKkuol8JuEZ2e9sAcI/UW1IAUIEy3FFigy4?= =?utf-8?q?DfwSm/DJ90S8sQh3FNq2/KERfQvxfFyoqlhw6u7vsaj9T1yVjqyYhw+v1na1Dvwt9?= =?utf-8?q?TJUfOjImiut1FSyNT3Zoa45BR8hk1xx38crFT9/7YgMti0/L55JxNUUIlLuD2R+2w?= =?utf-8?q?URmbjo22LyctShZ79buCvXRisClrbE1DCJtCoCzrzMybLVmca/VfNKHd6P6bVTYfk?= =?utf-8?q?FkkGRZjuZBLP3I4iPRYXUkSIXwiXoQxyn5Bq9i4Ow9+/wAQdBJ2BBsiK4oXChALuk?= =?utf-8?q?rejqNgAJOlTbm9yOiHMxeFpqAzJj8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AXPR04MB9642.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(376014)(7416014)(52116014)(366016)(1800799024)(38350700014)(921020);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?vlPXQ5043uQxmYjhafVA8DSGAseK?= =?utf-8?q?Q0114HgyikCxDlrs4DSsiUv5x3cpgeqt+HvWam14PXZyHhiWay+8dJOe06HeyJ5ud?= =?utf-8?q?svlua1N6vT+X6EXHWURuvs6CF2yfWWxCeyV+lXWkwxtnsg0W1h++zyuUZpHU9aRDm?= =?utf-8?q?Fkfp5VR+8ZG5IKncsRE3QJffdCNSQDI+GFTwd9p7iUcclGtwdeu9CS/BaDUaGCV2J?= =?utf-8?q?l6ykssjzZXu6XCiitut1jE7BOS7FElzXETsX5yj/YZ+0AkdIeVJaPPEdi2fNFD9pk?= =?utf-8?q?Q3NytyXwTZvY9TSjNwLmQY6GbCAU57Ps78bVGQS/hQ8yiovRzoANrusNa+vR+ICe3?= =?utf-8?q?NjlqPqSSRfeYBt9KeGGuV/obYbYFykkHBeAaVlvIBccaBaA6q8qbqyx2QI0hOHdNL?= =?utf-8?q?78z5wY/TPem5LYsevB9HhtSoaWuDAAuz1pBAsqjhhGh6Q1CTSs69sG/DRtj8lXKfT?= =?utf-8?q?NULFzmE97GjpFH16HcGuYyo0v/USpj0x13fvxkB16BnmTZoR1XZJ23R+Ia2vNHmWr?= =?utf-8?q?WPDiJZyd9JHihEc6CvpIp3U+ap7+izrTjg8S5ptljbUNZA0HQjq1Br80cgE/Uw2Pq?= =?utf-8?q?tHyYVIq4bXWdf/zXPzV2DYE5vGnsn7N2/FSXmfbGTpqnaoLf7vS/7ny6ik2Scqq0G?= =?utf-8?q?0fpZqtBOBCsA/zsTyYIY6VYYB9wKk0b0t8jH8pa3Dj2Gw2vZrw+nbP5fcSfMG2/Xy?= =?utf-8?q?tbJMqAL4bfYLABELABTucPkrCrjFSdFDiWpkAOHK2v3azppuM8UJ44XBEDufiPoAP?= =?utf-8?q?0WeZ5WucyMYCKuNOkgfZQLuz+T5d29yj6gZmDy4kYxmht0i0pyz8U/qqnCDDZCfq3?= =?utf-8?q?Rxp0cKFUMcO79BPxDdfVsE9fkvnDGOFD1Kx4bId7wBpp5VkZY3IiNaqvhxdBVpPNR?= =?utf-8?q?MapPTyRjfa5VY5wxCbK3/9cm2n76izz1NMsxeDuuEgfIo8NwIPVsBG8+jd05h8vCa?= =?utf-8?q?bcW24emQ0eIQA07wUFc8AyvQGGBYDo92c2yv1eDYDd286MlzpIP+Ut3W/b8rJQ9U5?= =?utf-8?q?2yyCC93jYOgSNnFgctpbLlFBH4MYTl/Z7VyPcGh0Jph99FJZbiyGselgHgUErjeMD?= =?utf-8?q?wXP02DBrcOJL/Rhg+b/3k0GZ7cSlww/HtKHRMkt2RLGEYRNb46OmbGWLYdeoO+FIS?= =?utf-8?q?XSbgU4a1D3KUU8jKES27OQiMUc0KKdutGUXnOXpNvnAjpnLwE/P/ZttVgoJoFVNCT?= =?utf-8?q?+eNCNb6O+NfeV9BmV0sf0CQ81V/SytTSuS+BP8qdN+VYE9u4OoO7pKNhIkmS+XLxx?= =?utf-8?q?Vp3443VA6diCEp6sB35zO29aEqPZSm6t9/KBg8i5lr9o62g8CQXMmKd9ojObRReNo?= =?utf-8?q?kFnSTDcFFX67ogItA05FrnvNnf7CcZOuEK7/+vhMq7b4XKBBSVTrQ3UdCw1wyB1i/?= =?utf-8?q?82MeLy88DMINGgnvupSw1F99++OKRys3NuzYU1ApahxQ0x5ysLe3eB3GvwWTg/9Gs?= =?utf-8?q?BY1HO+i8AycVVzmB02O88hcHhfJliTUJNzSpxMZvuC44aEjzd7e/j9jRxhP1Vc2LT?= =?utf-8?q?h/dql0+Mku+W?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 913b0e73-9d4a-480d-9298-08dd760d9a14 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9642.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Apr 2025 19:51:34.9618 (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: P8AE2vEpby+mbjoIk8nfaOBf58IET3EClHbSxvwli/RBIYRKXIz62qIXuo2OoWJD6FCZcQ1awx67CkpnmH4BWA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PR3PR04MB7452 Document the use of (msi|iommu)-map for PCI Endpoint (EP) controllers, which can use MSI as a doorbell mechanism. Each EP controller can support up to 8 physical functions and 65,536 virtual functions. Define how to construct device IDs using function bits [2:0] and virtual function index bits [31:3], enabling (msi|iommu)-map to associate each child device with a specific (msi|iommu)-specifier. The EP cannot rely on PCI Requester ID (RID) because the RID is determined by the PCI topology of the host system. Since the EP may be connected to different PCI hosts, the RID can vary between systems and is therefore not a reliable identifier. Signed-off-by: Frank Li --- Change from v16 to v17 - new patch --- Documentation/devicetree/bindings/pci/pci-ep.yaml | 67 +++++++++++++++++++++++ 1 file changed, 67 insertions(+) diff --git a/Documentation/devicetree/bindings/pci/pci-ep.yaml b/Documentation/devicetree/bindings/pci/pci-ep.yaml index f75000e3093db..a1a5b9b8ef859 100644 --- a/Documentation/devicetree/bindings/pci/pci-ep.yaml +++ b/Documentation/devicetree/bindings/pci/pci-ep.yaml @@ -53,6 +53,73 @@ properties: must be unique. $ref: /schemas/types.yaml#/definitions/uint32 + msi-map: + description: | + Maps a Device ID to an MSI and associated MSI specifier data. + + A PCI Endpoint (EP) can use MSI as a doorbell function. This is achieved by + mapping the MSI controller's address into PCI BAR. The PCI Root Complex + can write to this BAR, triggering the EP to generate IRQ. This notifies + the EP-side driver of an event, eliminating the need for the driver to + continuously poll for status changes. + + However, the EP cannot rely on Requester ID (RID) because the RID is + determined by the PCI topology of the host system. Since the EP may be + connected to different PCI hosts, the RID can vary between systems and is + therefore not a reliable identifier. + + Each EP can support up to 8 physical functions and up to 65,536 virtual + functions. To uniquely identify each child device, a device ID is defined + as + - Bits [2:0] for the function number (func) + - Bits [18:3] for the virtual function index (vfunc) + + The resulting device ID is computed as: + + (func & 0x7) | (vfunc << 3) + + The property is an arbitrary number of tuples of + (device-id-base, msi, msi-base,length). + + Any Device ID id in the interval [id-base, id-base + length) is + associated with the listed MSI, with the MSI specifier + (id - id-base + msi-base). + $ref: /schemas/types.yaml#/definitions/uint32-matrix + items: + items: + - description: The Device ID base matched by the entry + maximum: 0x7ffff + - description: phandle to msi-controller node + - description: (optional) The msi-specifier produced for the first + Device ID matched by the entry. Currently, msi-specifier is 0 or + 1 cells. + - description: The length of consecutive Device IDs following the + Device ID base + maximum: 0x80000 + + msi-map-mask: + description: A mask to be applied to each Device ID prior to being + mapped to an msi-specifier per the msi-map property. + $ref: /schemas/types.yaml#/definitions/uint32 + + iommu-map: + $ref: /schemas/types.yaml#/definitions/uint32-matrix + items: + items: + - description: Device ID (see msi-map) base + maximum: 0x7ffff + - description: phandle to IOMMU + - description: IOMMU specifier base (currently always 1 cell) + - description: Number of Device IDs + maximum: 0x80000 + + iommu-map-mask: + description: + A mask to be applied to each Device ID prior to being mapped to an + IOMMU specifier per the iommu-map property. + $ref: /schemas/types.yaml#/definitions/uint32 + maximum: 0xffff + required: - compatible