From patchwork Fri Apr 4 19:01:05 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 14038791 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 96E91C36010 for ; Fri, 4 Apr 2025 19:11:16 +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: In-Reply-To:References:Message-Id:Content-Transfer-Encoding:Content-Type: Subject:Date:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=mtWTeooM8CqBue1hpkVfKMqyxGo7QdxdI526bind1kc=; b=uxs17Pf39MVbh8Q7E8eTXIBX4C CVXv+xHGNCjM+3M+f+UN6A79dhNDzCfoB7Zh2tTKxxlfPXC2MAF9rBbqpzqtx21Q0r7cZgRJeGQ3W DEIZC1uJ6stUaR2X5tjwXjXQEO+HCs7SGsAtdgZy8eSwlC65MJ8IytNTI5YPkYRS4GY8IqXv3fFhO Oimy3TSjPIiP4kKrk0QlQn6UmoeXUZezxaXbR6j+StXxrskNVSAwcaAdGxqY6heri5GJgP94UvFke Hh2PyvBdEbJ7C76Am74qxVqzmqrC4F+wqejGqOkEWyzVT4cezDldYA2PZkKw883P2UJlDq7koOV7U g4jU+4hg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98.1 #2 (Red Hat Linux)) id 1u0mRX-0000000CbVY-3dDN; Fri, 04 Apr 2025 19:11:07 +0000 Received: from mail-am6eur05on2060f.outbound.protection.outlook.com ([2a01:111:f403:2612::60f] helo=EUR05-AM6-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.98.1 #2 (Red Hat Linux)) id 1u0mIk-0000000CZuP-29DF for linux-arm-kernel@lists.infradead.org; Fri, 04 Apr 2025 19:02:03 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=ukVQReMiqEWDw03eE2hSMzh8IJoB/5lsyx9EKSkVsNszr738nzw6gBDQ73Vo7k6Cj3gg9lKg+5DL+CMd9F0hcWf7UZ4VGDYXsqnNON6On95//AeYmvE2SvmlpwDDvTsZ4ZrEo/3ilBESrVl2ETo+QpLCFf4OzeJUrEsiUv8HmF1eIfqv1GZfgjsSeLhP5R6cV8kEorLprRN8LEWiWSnHJKGxdngSucKweGa8xzuciqzXszJMpCm8uQD2JqaR1IQMmoK2yzNOyJjev3SUwBwHw1Vyh+W5Nm9pKsr0yTMrvUM6hTlEVQH0oZ+7jpedRaAOpf+DiIe6AJ//UwI2105pSQ== 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=mtWTeooM8CqBue1hpkVfKMqyxGo7QdxdI526bind1kc=; b=n5J0LqlZiYQ8BX/m3wpFOQGbjZl0yTI9XTi9QA89zcfE/dM3FTQG+l4Q27X8KJGnicXr43fCP4uwvdORj32M2W7uU+DO2y2bTRS/Wgj37GhtiBOSPqTuoF6CoHW28mqviFbxaYd3kXxAf0ngweqPP6bQqoxFX6fvKui0rkMj5sAYikT6tqpUTfyk/gtosnVHNr7v8W855qJz26K4tDMI6Sydku6oDX90rQoXKX5LdXAQx0YDRuiaI34gWQZcyHxr4ugdJNyb3YNi/9A/t8V0ZAETUBPOw0fTZ1b4tdUvtPP9ASEM0LX00G+sDXQ1Oj5FFQr5QQGUuP+XdUOwSQ8aZw== 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=mtWTeooM8CqBue1hpkVfKMqyxGo7QdxdI526bind1kc=; b=ac8AHJRqmHgC+rfZsKChsFBnHTSFzIxkADs2Mr4bHky7+DavMbO3WBJW6tumrHLvpF7vFYaTfuP/XbmcgngvgUuisf2myLxwogYJtNhOJbh2dUzY0APGNBb99fDphi1GsAJD9XXQIc1Y1odpVZ7dVbkI+OfQRMqnXElwrDf2VnF3X/7O0hBMUTDwQevzfdNIZYbrEOLzDxqaHjrCqlOvc2b3eCYhFWFou5mA4Dj6EIzYfiZm35cw8uW799GdRiGtXat71j/ul1dDPp+bJu15JH4kbbG5MbzH+f9bYfK921dHPXW+A9TqnHZgF1OIDCA7mW3p/shaO1ueI6Y62wtrLg== 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:59 +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:59 +0000 From: Frank Li Date: Fri, 04 Apr 2025 15:01:05 -0400 Subject: [PATCH v16 04/15] dt-bindings: pci: pci-msi: Add support for PCI Endpoint msi-map Message-Id: <20250404-ep-msi-v16-4-d4919d68c0d0@nxp.com> References: <20250404-ep-msi-v16-0-d4919d68c0d0@nxp.com> In-Reply-To: <20250404-ep-msi-v16-0-d4919d68c0d0@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=1743793288; l=2774; i=Frank.Li@nxp.com; s=20240130; h=from:subject:message-id; bh=EDCkhLlbHI2hFy+q2eIJrdZAgXhyMONM9CzZZ/faG6A=; b=JLLABNk6sN/MeZvbGiTPCiRlSC/oxrSatmV5K6rYIREPsIl1QnEB0KGaBhTApl7I2UA7ikcUr zVXJ3Sew8mSC+snKpJFtUoJUdCI3UG341gi8bXWGmiTLsW96UyTf0tE 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: c43d8927-2443-4d6c-c784-08dd73ab2d40 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?Gfu50W/x+4kxZgHpPfy25dzCtknT4Nj?= =?utf-8?q?ErR34+Gsthvj9huSzCbicuO9+EjfGU5en2MFz4PkKgzLk2P0DqoKewHWjM3/WXTeN?= =?utf-8?q?saAyOQ6NxCi8WiLRA6yY+RO5HAVLEf+D1X7HOqyyKstoyVLYCEGdgZIV9moEopXLb?= =?utf-8?q?44+uUFBb7+M/UothDraWezHME9YLhyYay9XxymJfYoE58uhKZrdq90xbK6Qb5yDUa?= =?utf-8?q?3le+DFSEkutR8zFCnPnkeVozzPNgse75jeKpW4kZetyCwWW6sn01YzjxFy6FjY4S1?= =?utf-8?q?nb/chS0MoWmHYEJYSkgxPHvhq7Ay2xvvylCpb3rKnrJ0KC+b7GV9SB0b2p9WOCLGG?= =?utf-8?q?E9ImCo6TT5ofx4mJiQ4inBFfp3flU7WG00j9PUdFzY0OO95h73hthH46KC/eTHlQL?= =?utf-8?q?lBLKibaGP5rzYRhokmDAAyZDb59hOiKizAh+UC7lZrkccwvg1Ouc6sMTLmtjDSXq4?= =?utf-8?q?mBIHh2oNBcMFpTV2do5Hl5tnIfwSJL2W9exdpS+9bwm8hO8jt7/2BOewqX6cPUP/m?= =?utf-8?q?d1DLETgO7GEZ1ugqBWxlhwxxuitD4eWlXfRNn2W8N4ble6NVNvVnvssK/k2Nygr51?= =?utf-8?q?4hd735KsXjKaeCv8KhRwzjeLvewmDi30g7MLT98phtucKvejO1n7jBfH3zOnISgVQ?= =?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AT: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?XZCjHwBfNXHrf5jYUjtLtrdMjFwq?= =?utf-8?q?zinGnHZET5zcjWOpCedkcyaibM7iFtQ6x6z8H0yIOWGMQGNQ9wMy4Yyr5/kS2QmUE?= =?utf-8?q?ILzhJPkhNzd+9KWeIMaX3ohRIp5+gt44o0m4KP/bvlMuoyKlsCg52QohauedINbwj?= =?utf-8?q?Y7lD5EzPgbRZFN9xPT5NG6XIzbcD2vGTGbSwwkgmFaTdx3bIW8cVltgu2/yT+JXkX?= =?utf-8?q?V6ghACd53yY3PYKfRs4lRPtOsYaJjRfG/6VikxDXjiIlbPo1u4aJDEoPkkod/Lp7m?= =?utf-8?q?nVD8H6IEOXsf+FOfGoV8xzor1rTASpLoDcn6/jURqPPIr9GeAn2YPMdprG8DYI70d?= =?utf-8?q?cj+bFDmOE4gxk2F8Gul95vS0BkMMMClT2ZnCbQt+d4nZCmIHUc4QO4FTBpfz9MRn7?= =?utf-8?q?pckDzWWZuO1iQ41WHRLEH6v/J7MgcvPn/biCYg5P7xt2xH8I5gDcDSvwcD/oDkdEK?= =?utf-8?q?wW4ri6tbJI14zwGQdSvHlJy6OuHTnFeCGh6PlZnDrTskT4TUbenP/cOoY5Wkpx9iT?= =?utf-8?q?6M9oalDzHdL5TiTX29ipSwVCMReM2lP2b87icMAvxaD6D5OjjqdBu3asyZg2eGDGq?= =?utf-8?q?nwNmnXT1WWxdl8VQfEcldqP9aHQIDckeQm3TzGzbiA08qAyiEuvzE/p78pG1R1qei?= =?utf-8?q?YoSgWcS8ncucGBKYIW0NVsPjlGuHlGbeUt0iSLXs1i0EcjEP/NaLm23J511YST0fc?= =?utf-8?q?FRzQUO/U7d61xw/mqkmy+A25/OBjCKyVC/Pngq+NyMKM4mcXSC4S6EeNX7/4SOdJ1?= =?utf-8?q?5/8xcpehEy+jtdsytnP+96XrkMNji7YG1JeVe+ywWcaLSIaf2AC71K8psbdckg2fE?= =?utf-8?q?kmH/ZMpHx9aVnqIKkEQ1msNpuTPkH/7kawjT46VHtrCbA9vC3XOTu93tzy2SsY14J?= =?utf-8?q?gFD7ixSHm7CtVlayd74uNfdf2oRr0WkS8YRfJig0wCYbMDCFzvl6kwqYsR0JBFfwq?= =?utf-8?q?PfSxUwFtqeG02z+GB2G5F3j/YedgcT4uTa5SrtWhweDpJ+5S0d/0S5tVv+JmBsK5j?= =?utf-8?q?5Z1aqsnqQCclIXnXK4sNR77+x23FviEp4hj/bM9ZrAB62d0JxYNVhWOfOU+oEElrI?= =?utf-8?q?i3mz2K3JE2yoxFe/UiX4kB7qN27oOGPh1i4qdHItvmyD57yuAX+EQARz20NbnaNW9?= =?utf-8?q?AFIV7supjG65O+6ngrMwBVhVKb4QgB7Q/cbro2noHEAHB+qcQWMxlAEAowHuHgdO0?= =?utf-8?q?uwWRE2TasdxZZS3FWMhj0q7rblHzzIdXuPzNSqRsUET+qEKmx7XMlhKQVRpsYuNX2?= =?utf-8?q?AoIEbpZVgBGW/FVvd2jLEjOLuYarbk3F0lI6OBzC5QaPPYHww6wUgaobAgMqsufLq?= =?utf-8?q?YOTZQW1+3yqO1v487euUkJop8onlL9+vvVZSitrEloCUJZk66e2wkfnHmwZnPbVwt?= =?utf-8?q?b0ZT1rImq3WLcNOVr+XaATa7NRnHYrmjFss9GbgAtf/iDGc541Gr4uuoSEIgd1Bg8?= =?utf-8?q?tTn6b4yuQNiWEDXMzzydNxKUTePHfxvTRVwDD6FRj5zan8lvonpp8Paw=3D?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: c43d8927-2443-4d6c-c784-08dd73ab2d40 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:59.3925 (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: hFblLU2HtAW9DK8cMLl/H1BwJEXBMtcC3d6d5qIQ/wgUKY36c+MeRIGfKukgbO5i9FfvfFi8lJ06qVyYZIICWQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB6957 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250404_120202_570646_EDD89DAE X-CRM114-Status: GOOD ( 14.91 ) 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 Document the use of msi-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-map to associate each child device with a specific msi-specifier. Include a device tree example illustrating this configuration. Signed-off-by: Frank Li --- change from v15 to v16 - new patch --- Documentation/devicetree/bindings/pci/pci-msi.txt | 51 +++++++++++++++++++++++ 1 file changed, 51 insertions(+) diff --git a/Documentation/devicetree/bindings/pci/pci-msi.txt b/Documentation/devicetree/bindings/pci/pci-msi.txt index b73d839657b66..6a356707d01fc 100644 --- a/Documentation/devicetree/bindings/pci/pci-msi.txt +++ b/Documentation/devicetree/bindings/pci/pci-msi.txt @@ -218,3 +218,54 @@ Example (5) <0x0000 &msi_b 0x0000 0x10000>; }; }; + +PCI Endpoint +============ + +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 [31:3] for the virtual function index (vfunc) + +The resulting device ID is computed as: + + (func & 0x7) | (vfunc << 3) + +msi-map can map it to an MSI controller and associated msi-specifier data. + +Example EP +========== +/ { + #address-cells = <1>; + #size-cells = <1>; + + msi: msi-controller@a { + reg = <0xa 0x1>; + compatible = "vendor,some-controller"; + msi-controller; + #msi-cells = <1>; + }; + + pci_ep: pci-ep@f { + reg = <0xf 0x1>; + compatible = "vendor,pcie-ep"; + + /* + * The sideband data provided to the MSI controller is + * the device id, function maps to 0x80 + n. + */ + msi-map = <0x0 &msi_a 0x80 0x8>, + }; +};