From patchwork Mon Apr 14 18:30:58 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 881131 Received: from AS8PR03CU001.outbound.protection.outlook.com (mail-westeuropeazon11012043.outbound.protection.outlook.com [52.101.71.43]) (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 4D09528F52B; Mon, 14 Apr 2025 18:31:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.71.43 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744655502; cv=fail; b=dPeWRFtmTQy00Vc2haCoQCzemclh/GbvVeAVn5I16ZqHkHPuh7n3rMzpqeJaAWNyuFy/kEMCqnNBOjeatYo5CG/fmstI/cdz2RzdQW/R8JeKAgjqkfAs7FjBHOgXKDZOA4MoUZDaQmZ6T/JYpuX71g2133bj5qKDgmdb9Tptplc= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744655502; c=relaxed/simple; bh=DICYXBAwY6+u/JnFgOyQ63yT+g3nHSDoM8gnluX1F38=; h=From:Date:Subject:Content-Type:Message-Id:References:In-Reply-To: To:Cc:MIME-Version; b=gOJNKR3KwrNOnhQwYtwpjRG4RbI0AFGC63vfTa9u29H40xw28ckUoQ4jkJErMZ9ZasZpQK2PNkenw1Rm5HMvJHJUD7bOQ6MJ9tIs7m8sCMHIT1wKDL6wI5sw98qzTs4ejewimdwyrsjtUfHoi4iReXwbP7+sNwWLM5YTHBSljuk= 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=k+eVNDOK; arc=fail smtp.client-ip=52.101.71.43 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="k+eVNDOK" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=qWq50Gx2v4ceURt3imtQwKV6gaEzGOj+NvVdT5m6u8q4PiGpQT91ha56TCuKnkeSpTdpKQ1QDitYygVwwQKHaA9IMON8jYcMGFZxeJrYGpeZXrnSjlYNyUsvYezl7eyt8s0311PxbUn0bCoU8tBBasWuBaVzXKA4aqwuieozoVwZNIZbhhIK5QvoxBcPVlUqQPyNkYgGi7vak5wzXvU2Ma/BhPzPclRtrsm8cWXiMoYZA+mCiuqBoXceGDCNzbDgNviO/TQiYH85nujF2rc5esYFVb5SJYLHg4zcAJblWy6augoXu/tXRfY223lA0dbK9uLPzFLkxPznYaQ5NcKpbA== 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=eqFvcCRVkNjL1DXRoG9nvtjK9q1aouH/vJtmLYrjJy8=; b=CW4ITh3mdI32sCgqaGAHnCQDnruLmjEKERTk7yPgcK/8xxK2mqeMu3VIjBUnnkKni4gr/TWNEf+lfJtXIMMzgtkAAuIwu6SAiF9+lD26I0laA+5HRvLP9L6P1rthVZyTQG5rGHM4nJvRoPIR4jlZRoxna/Emw7mcmb5Z+Z0Eli7AqrFnBCP8lVljY5bf/3fpmJr2O21xxot8dz7VHVIl9MowUCMKJgYzPHWHUKLQPm8gA+8fn1jrTPDv6BCZCOfKqjmHWMDNtH8FZbN2rDQWFUPPAr0ghr0nksu6sAb6VdvTrPu9Lyw+cHj8HFuOxgDSok6jAWOQbEsXdE324P7WYw== 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=eqFvcCRVkNjL1DXRoG9nvtjK9q1aouH/vJtmLYrjJy8=; b=k+eVNDOKIMaUgr6ImKK4pwCEF+4KKTZccRMaAM1h9rAp4XS+4tqIYGZYO/OGmtqX+ifwYk0cJlJ2n8afVLleAUN6Z1nDlu1wylBzb2hfy/Jprd+b+AX80+ey7wAWUSdiM3vofMSfv/4VJiDercCg/Q+AuhPlkoHQ768W2dmKGVmws4rXj1WJlSsQFUYFsDml96sj1YF7oiDG+WMJzB8OLLvc+X51XJHUl1aPuoBLIZ9/lRWq2Q02o+T0mxgXW+14HJUJLZRwv7p/UDUpVfYMBETyaT4M1vdcTNyQ7DPFxKsdBMqOBOEsv6wrxRfi8OExdG7vyPBKOidrSdwLWm5XGA== 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 GVXPR04MB10245.eurprd04.prod.outlook.com (2603:10a6:150:1bb::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8632.33; Mon, 14 Apr 2025 18:31:37 +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.8632.030; Mon, 14 Apr 2025 18:31:37 +0000 From: Frank Li Date: Mon, 14 Apr 2025 14:30:58 -0400 Subject: [PATCH v18 04/15] dt-bindings: PCI: pci-ep: Add support for iommu-map and msi-map Message-Id: <20250414-ep-msi-v18-4-f69b49917464@nxp.com> References: <20250414-ep-msi-v18-0-f69b49917464@nxp.com> In-Reply-To: <20250414-ep-msi-v18-0-f69b49917464@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=1744655465; l=4533; i=Frank.Li@nxp.com; s=20240130; h=from:subject:message-id; bh=DICYXBAwY6+u/JnFgOyQ63yT+g3nHSDoM8gnluX1F38=; b=cMqoO0DB3vUMnMnxEnoUyMJIbe2ztPJfIJbuPaYC0B1rm15/aESG9ZqyU7+ioL1F++ozn4o0W f9uZ6PrwCwMCoPZb1aGzioxU+5qwEgtw28D+lhyAEUwUSNfssKbHM2L X-Developer-Key: i=Frank.Li@nxp.com; a=ed25519; pk=I0L1sDUfPxpAkRvPKy7MdauTuSENRq+DnA+G4qcS94Q= X-ClientProxiedBy: PH7PR17CA0021.namprd17.prod.outlook.com (2603:10b6:510:324::27) To PAXPR04MB9642.eurprd04.prod.outlook.com (2603:10a6:102:240::14) Precedence: bulk X-Mailing-List: linux-kselftest@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB9642:EE_|GVXPR04MB10245:EE_ X-MS-Office365-Filtering-Correlation-Id: 180b9db7-889e-4e6b-9e3d-08dd7b829751 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|7416014|376014|52116014|1800799024|366016|38350700014|921020; X-Microsoft-Antispam-Message-Info: =?utf-8?q?dWB+iByTLoSxQBRc22fT7duWKmPcdnt?= =?utf-8?q?b8RfxYdB72dqvLovXF3jt5CySb6QDl7fvCMT+xJW1GX5WH0zQVLcWgQrPN5iL6Uaa?= =?utf-8?q?/4nDmYJEldh2G4c0WuJAPUrWaVnjNb/IaXXJluETaUQT1CXgMVxTXxt2IX+c+nfzP?= =?utf-8?q?KZ1vbHfHiEVLXYCHk8yIFCJUzSNqCdi5NrEXdEtieCJFssgG5AT0JX3fgrQn8Snnt?= =?utf-8?q?NIqYLuv9d2S1kQN+pnksyiq945wyajdFBVfKlHQhOMUw1lRQGSCK5mF+hwYq9+3S1?= =?utf-8?q?4HScBSxvoSYEIStIKWnycppqWcncKvbjbifjRDkD72hGhoLxanHomfU54SXRwsVyf?= =?utf-8?q?0tJa6qpOZkplaAqMfn2kqadRG3xC0M1g7yFyBMhO4/bN/BIZx1p+umUpBMQ4UPPmi?= =?utf-8?q?RysTi0vC7EttuxJ12a6sSHJWG6OoDhu4lOkMbeQ3G8nO8WuENCa9ppT74QRzIuQ7G?= =?utf-8?q?PeOEML8t2KkRvHaEQlls50s1iqYB6KZ0JeN8Ir7j7u2BY8VDGDHHB/ncfpANMdHHT?= =?utf-8?q?f7BsMrdZm+ZW4IBN2V7Pq2/xdr9KzoTpofcYoyu4NDlmAwIrRzlq3uO3TTHteW7F2?= =?utf-8?q?4F0QeKp45nu7lWW2IW2Q3PXXEVmsazueOhQw56b1MpaorVesuv5ULBSnERjblg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.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(7416014)(376014)(52116014)(1800799024)(366016)(38350700014)(921020); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?nKTiRJYoJWhva5BTsfK8U3zP+Mvs?= =?utf-8?q?R7966YrNSYrdiozSP8wiMASZTdyryb0MxF7XMXg0NhNY3fHl8wyBiM6MhZfbI44cm?= =?utf-8?q?NI2Ym+zXqdajEruUARwiPDDUvDD9KUml1c176+bl5d15BtnzjdkxEpEm2X9Y5GtIS?= =?utf-8?q?QHowVt83CiMJBwrATegb39erhXqGeFb0M7CqUuU4AKC6QAZ1+/iYPlM8FU10f+ETS?= =?utf-8?q?t6fpwQ+OKDGSX4pCuyGZT1OjRvCcTKUcjXDE7aULR1YtbKINuDPT4oWcpuNsynCk6?= =?utf-8?q?oXv9q/A+ic6RwtKBt+5ndV7zEASqFjMu9VMIV3KklOjYpu1u4s4PkpFDFYhGNrN2F?= =?utf-8?q?DSjYfkKbECE5i/8q6putxbbT1I+3/UEvozHgy9uYPvBk2X5J7pDPUHg93vO72bgrt?= =?utf-8?q?6LwYhaCJ9aFUaNM3S+ONqPdiaE08QpshvePRZmx6uNI5D6tX6uNuHX+zGdqBnbHdx?= =?utf-8?q?x+8Jx1dKYH0BeyVg6f6snYQ3WakBtVaFsGcSnOu8aG/y3VwQWPXh1Ni++8zn/QJ+r?= =?utf-8?q?uoJUwsXOUEJNgF3lMIIhj+9d2xuHudmu3ya660j98puQZCZEmMNRCFhGuOS1z2qz+?= =?utf-8?q?OnwayfQj0EqTgEnHHVDMjgodj1NLFdM1QtiG3I5MHG3RXhFrALZC/B8nVdv37TrKY?= =?utf-8?q?/EP+Gw39Kp+Iu9l1rkqFifLC6AQBvdEEEs1AxAgrjHX8v8WnLVEEwTKInTOjDpevE?= =?utf-8?q?1uPtZ3lm4ujfWX3s3LjNpYtKT3eHWjy9ujnqA/GlCGMfnWJoyeyjTUxWYh9bzDtLs?= =?utf-8?q?o0Wil2n2VimAM6spsCL/1Xutd04An1qIzpXQ2GPGF+BPFyfYriXbvyRIXKpmi0NGa?= =?utf-8?q?UX6cDtC/jkbAQbz8TatjY+nGlPe4oiB02TOySDdRd/NVju0Z1zJqeBDqIDvZVtmcJ?= =?utf-8?q?y3FgqvJz9dbvJBeyYLiDWr8/gRpqgb1hPFzb6ovad3IZX+xApjZXP21OHeP2R1L9E?= =?utf-8?q?w7yAzEVOegkMQble32NFdxeoXHVlikGHYcRtSVdYe+9LsEQbThekIQ8J42avmeaCD?= =?utf-8?q?p/8hnSyC1aTBoDn46BVZjI/xDbVUuPAQP3y+iB8XnkT8dYJi1/MwfXu/X+rhEcxIe?= =?utf-8?q?Ja4drntaIU6fd87FcB0wydhqRr/PrdEXjSRXRTkJgxVDTLCvshXSKCIAsWPjMz7zf?= =?utf-8?q?A7S9dC8pB4yE7Fyg5VfQLhpTLCW3/T/LxKqWPUjxrfxdbOC6KrLG8VX8kNfEuK4fa?= =?utf-8?q?GSZ54H7Sqjm+kZAuSVkcBePqns2wntKMoZkQAnbIxc92ObJLlLZI7uoBV5DFAAclv?= =?utf-8?q?c5m2H19cdOpLpSuVAHnLvQGjDMgncgp7E74dsvSyJapOPr4nm1ivDzow/msos/6W+?= =?utf-8?q?SzOllS7IInj7rwMrnaEXR4uKMOX0E2SecKyruQfi6dXRitTFg0I0Y3TT2s9qO9aEK?= =?utf-8?q?5qmXWve8iIFaQWG2Z4vQd1oAZbVLQ5J68eEFoHw8AsWJFBldioq7qNXt62ye7TCPP?= =?utf-8?q?0IpLKFG3w0J8Y/iv11PKnXQ5z6Td9IDIkaDSsgmmit+F1DV02wsF2vV8=3D?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 180b9db7-889e-4e6b-9e3d-08dd7b829751 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9642.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Apr 2025 18:31:37.2743 (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: L3/HZf18u8qytUbtU0ubK6EhI+I6bHQZM5gvq4t/u/NaoXRWCkCRUs9swNFyPtE2EmmeAupX0+MdrJ2uFi+OvA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: GVXPR04MB10245 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 v17 to v18 - mask max value should 0x7ffff - order according to property name Change from v16 to v17 - new patch --- Documentation/devicetree/bindings/pci/pci-ep.yaml | 68 +++++++++++++++++++++++ 1 file changed, 68 insertions(+) diff --git a/Documentation/devicetree/bindings/pci/pci-ep.yaml b/Documentation/devicetree/bindings/pci/pci-ep.yaml index f75000e3093db..214caa4ec3d51 100644 --- a/Documentation/devicetree/bindings/pci/pci-ep.yaml +++ b/Documentation/devicetree/bindings/pci/pci-ep.yaml @@ -17,6 +17,24 @@ properties: $nodename: pattern: "^pcie-ep@" + 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: 0x7ffff + max-functions: description: Maximum number of functions that can be configured $ref: /schemas/types.yaml#/definitions/uint8 @@ -35,6 +53,56 @@ properties: $ref: /schemas/types.yaml#/definitions/uint32 enum: [ 1, 2, 3, 4 ] + 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 + maximum: 0x7ffff + num-lanes: description: maximum number of lanes $ref: /schemas/types.yaml#/definitions/uint32