From patchwork Wed Dec 18 23:08:36 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 13914253 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 15C13E77188 for ; Wed, 18 Dec 2024 23:11:32 +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=Pf/oi8vmEOUmPTe7wYXgmKpdXfPYSmq7cIctdRdF074=; b=ztuXt2VHnCg6k6DXps5pjMRvZM 21rugLG4vkjCmecck8SuWLFVLMQj8/xTh1+fn2RV3iFNCFPTCX0zLSpVEBGerwhanTV9JXB/JpaRA a7i0IzpiKQ1cOi+xqQHXKgXajE5xDG4evBxlCbonaucRdZA7JQ4Lumj5uqztJSr3Sz8Ez2vI7tfOA NjUiN3vMvBpdSbA1kL9u18gIJRBPuqad47VrguTGgYV3H+EeO7G3S70XoDzh4I0zNQoy2/4rEmRWu VK90W3VeVZBHUHQw1Cmd+d/OQmpwz+w9BuFx9AK5NBcWZfCQwumTbCrjf9ZX6/QJ4laU+9gLkgW+f N2CJS3Aw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tO3CM-00000000ILE-0hUc; Wed, 18 Dec 2024 23:11:22 +0000 Received: from mail-db8eur05on20600.outbound.protection.outlook.com ([2a01:111:f403:2614::600] helo=EUR05-DB8-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tO3AE-00000000Ht8-3n1M for linux-arm-kernel@lists.infradead.org; Wed, 18 Dec 2024 23:09:11 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=tTPCMXdEzpd7dJv3fxJoOIpZggpwoWiPPZvysOU1SexVRZRTSP6DIENwuxs6CRWpqGzzJ39GO/GhkICA5ZCIdDctDiWsPNnAxcAQDqbRaWJ6obn9vx1yb0Fb3JcTjeKcjQvnx89ETF+8dBfbs1P3D4MrDjhOwAYPwKhMt89q4pnbt3Bbw3AuQyJKpDofMOB7jgBR15UEifJRvwpoVju/TOKbNwIZ7USiAXxtRmzHtoWrtdIxC+0TCOeC35IIaDX6elqEC/gpgfwZFee8dXQ+RkFw/UALMryLzqHmcLBHy7BvduDYkyP47De5X9L6Yf87HLhdD+V+g4N6lapWqJ7N0g== 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=Pf/oi8vmEOUmPTe7wYXgmKpdXfPYSmq7cIctdRdF074=; b=ezpesn+qj9TlNoARNIBIGNbPcQ8eUz1jS/Oz4bquWXAVG63UqpmCM9asfnkGulY4GA8CGkB2FsemEWzwXyS7cEy0ltwa72OUYuG7OLX0dh8hGHn8arkd7MWWMIrbbnIycjKXydKA4mR8G/SImNl7tSCjDcXjY5I02JZx7z6mo6O0xoflvY9QcEySpSK2Swi54B6Q5qCb/qmOjt4l+lPAc+v5yue8ZgPacIRWTc1TI7uXpM8iPVIFXPWd1D8zoYwBc/IuoAFSncmp+BwQRVRD/mUzBNVMmgwJytq4swHNRjPURjfgbT+Lz/y976Iz3LJMExGrpF5ibKFHhyAlMqEqDw== 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=Pf/oi8vmEOUmPTe7wYXgmKpdXfPYSmq7cIctdRdF074=; b=ML7XN7tryuuhkW1RlMZvxZW7vSj3mRHTizY81xXBuD8O3eBsHZeUc6qVjIVKxuvPyKPfiuE0zjwsrs8EYDlBXHuu5/ZAG95QkZnu0WZ8+6ey+ncTx6osPrjgM6SUQSL6Zz52tvtOdtfFD8+ZVsftYUfhI8lku+2VwMxEY0ME8ilzSmKrP6zltEj46htQ+ZvdSzc0DD/Q6OaFxevCxda0q68fjO5qo+Lbnl/foPo+e2uo2+DtNyCtP3atQ57k+IAqsSymjr8JVzZEjSIfQ3HmMupvyQP5BAp158AiHP0oPEojumIjnFGLIYwnPDITxOFuK8+4He+0drbp0j5a1OwOOQ== 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 DB9PR04MB9939.eurprd04.prod.outlook.com (2603:10a6:10:4c4::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8251.22; Wed, 18 Dec 2024 23:09:07 +0000 Received: from PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::9126:a61e:341d:4b06]) by PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::9126:a61e:341d:4b06%5]) with mapi id 15.20.8272.005; Wed, 18 Dec 2024 23:09:07 +0000 From: Frank Li Date: Wed, 18 Dec 2024 18:08:36 -0500 Subject: [PATCH v13 1/9] genirq/msi: Provide DOMAIN_BUS_PLATFORM_PCI_EP_MSI Message-Id: <20241218-ep-msi-v13-1-646e2192dc24@nxp.com> References: <20241218-ep-msi-v13-0-646e2192dc24@nxp.com> In-Reply-To: <20241218-ep-msi-v13-0-646e2192dc24@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 , "Rafael J. Wysocki" , Thomas Gleixner , Anup Patel , Marc Zyngier Cc: linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, imx@lists.linux.dev, Niklas Cassel , dlemoal@kernel.org, jdmason@kudzu.us, linux-arm-kernel@lists.infradead.org, Frank Li X-Mailer: b4 0.13-dev-e586c X-Developer-Signature: v=1; a=ed25519-sha256; t=1734563338; l=3489; i=Frank.Li@nxp.com; s=20240130; h=from:subject:message-id; bh=CjpdDETOi2VIxmLfWYm/yAsNYvD4NkW7aNy1uWn3fGs=; b=MyLtN5Xnebvp0UjV1seHBr/iqAA/dHH6fsYXDWuHyp3lb2ig+UkGEU44nLIpoyKvuPIKdOijh 0I0mj1vsg5eBKrxgVWB95Q3e6idWqosEfYo1NhVwZw7832xUyzr1xBg X-Developer-Key: i=Frank.Li@nxp.com; a=ed25519; pk=I0L1sDUfPxpAkRvPKy7MdauTuSENRq+DnA+G4qcS94Q= X-ClientProxiedBy: SJ0PR13CA0075.namprd13.prod.outlook.com (2603:10b6:a03:2c4::20) To PAXPR04MB9642.eurprd04.prod.outlook.com (2603:10a6:102:240::14) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB9642:EE_|DB9PR04MB9939:EE_ X-MS-Office365-Filtering-Correlation-Id: 7f858bc7-828f-4e3e-cbee-08dd1fb8f984 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|7416014|1800799024|366016|52116014|38350700014|921020; X-Microsoft-Antispam-Message-Info: =?utf-8?q?mmIW5BPfoF/WqSjjiu2XdgmqV+WlToX?= =?utf-8?q?Yb/JhLewB+7jSj5VqMsBnIGF6bDIhQbxwuvfTf26vYPfe+Z905age3TlKBZSrfhG/?= =?utf-8?q?cg1qCv8Ts0q3tdD/Lrh/fQz3D/9GA9mys2Tu387SZB2t/USbJ30cVmks8BUZ4gRwZ?= =?utf-8?q?LsWr3oJJ7OkerGwvEUzng5ITK+IDDHfMLbPWk3wEkCbQjv2fDIKl9Gr+KUgDUbTuc?= =?utf-8?q?bbJYXQYQKRbeXwnN/7AoQ4uY1zYASIFmQCVg9WONmpZ3hc/Obp8th5ET9cZgPs2/r?= =?utf-8?q?x4IEtmxLLcMBUZUpCEvPJbFRFWf/8k0nt3Azyxol9UPxgbsxhw5Wy3Z7GXEAXAkEf?= =?utf-8?q?o8/WKHvLKnN9arrhcuW8dyIvpHDzA3yCBtUVYWeGc49bMNrtIUL42UHUJYS1B6j5U?= =?utf-8?q?TAlNca0U1yiIXBCY6b25MS+K4wfgC7jUqFnS6olW4LBnOR7qiiD0J0Z7YRujaAOaa?= =?utf-8?q?uoknyOciLNV+KE6vyz5DwZPMGWN3QUVj71MGyP0naFIZYLx2wHMhGdeweAGF04qU+?= =?utf-8?q?BBzHuPibm7ltbaNVTwyUqfyRZQ4YB1L80EeuCdmTw+dYXoq5O1usaGPjLTCPTUxdj?= =?utf-8?q?ipwSJ5UFQoHOeMWM7CuNfy3ygyEAsy8AU/lymcN1/rLJ1Kf6pvnd0bAlNgbKn85aR?= =?utf-8?q?LTauj7oMUFFzgD7uSP9AfP5G3eC7uKbUvv462cJJXuvxyGGNzPfPxqhQPQYx1Frau?= =?utf-8?q?AnZ5aasCo55aVEUaS1pWfaHO8rQe1q5jSU5jrhmv2JKmx5LAeo+BAqn+NklOmlY1k?= =?utf-8?q?bG6JpHfR2hSpJEmRhl5RhxJsgBOG8tcRcuuwGN0sEg0NFv53SPEJ2oO3D041QIHfM?= =?utf-8?q?5Ym7gkZTM7tIoeQJVxVw/eTkEULV32WwIbKakXZB9wnoRzOiEWriHeVzbWpzSRC+3?= =?utf-8?q?tlAcnUfW4fWdaVxkdxZ+kopSOTkypYL7SdQGMgjYj9JSOn0aVQNQKI0txWAUdKBQn?= =?utf-8?q?ToRhIFxyLpDXT88Bdla+skmNIQoNy7MhcUTMPn/nWDAKqGnN4DiD+Lm1sHFaFjzOw?= =?utf-8?q?yi3IsbKkpcDL/Axn7vXThPkMQ4JwvRdDoNnPwtBrqFArCcV2BwWUq813i6RoeqCta?= =?utf-8?q?VSZPf3xJZrOwDT1ymp76VcwNTmwyjQH9it3S5wYIZuZpBHA1g9KNRt4g8OjzQsqiJ?= =?utf-8?q?VU8mRK66ow+6dF5npH+Up28HcuEfeB8v5BjzZW20aeMVaqZq3BJguLW74ulsODpqI?= =?utf-8?q?mI334LElzLv9ZiyxL8PMkefkZC+frPXzWuL+rirocXl1+FT1s33DusmXKpY7qsO8p?= =?utf-8?q?tUjmv7Cdhot15pqy7Xocw9WXBUcK0PR0t6dHLjwu5IwmZtGcUP5Cr1cCCUSIsFE3d?= =?utf-8?q?M1RbR/CQ9mFC8XrWl5tF4WVMt41RbxTmh7PIebmdjvZr3BQGyVyk7PdsmGla+tvrZ?= =?utf-8?q?mWCrTdjUo4cef2bM9a/Z+uOe7I+ylwOqg=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)(376014)(7416014)(1800799024)(366016)(52116014)(38350700014)(921020);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?NIJyoTfFKNSldNKddVdo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jl5?= =?utf-8?q?0cqOXS42iuhNaSfVjysH7kPQN6jpF/YaH9HXUP27z9E6KGE9HIml3dYqGDGK/hz5o?= =?utf-8?q?LSNFrLWAy/Rkfa3lGbrCUtnMiiFBUKGPoI6oQoIhIdlh2ESH1Uf6E9NezQyfxcVLX?= =?utf-8?q?6cMWW3cXcQDTMMYoohoirR84IpYpOws8XfIfSO1YRQStG1yTNAISL/AfbAgMEZBdK?= =?utf-8?q?uhAxtFICiS5TYnTXe5depDWs4EV55FtEhN7CChmG2KY7k74yeKMwKIzcGiFBI5qF5?= =?utf-8?q?8PETZfKZyU4VzHBhjQAOyr+YjkI03jd7gu8y6P1iVp5Sl6+amtUw0PjfvfujiYO2P?= =?utf-8?q?GA9SS9A1wNmBMWkqHus5Q2vw2CsEdtC2WPrg015EI98k8DD2c+6mUNt1FaKdXosXK?= =?utf-8?q?7HqKCIFTv9IXExGy9udUlbmc+xOckvMtnAuDp4K7I6mykAZ4uOhRf0egLndsZ/UQK?= =?utf-8?q?mYf+zQL2mLqQwsMF/KYkECcup0U7ZpQyZ/PrrU7B0BsGNK+Jvrrwe8u1Yprvbi5wj?= =?utf-8?q?Usnrvn91EX3Ru6H5ldNB7kLgScgNudxgY04EMSr++oUstAYrF4TgjlxSeTvXL9STt?= =?utf-8?q?G4hKnqHVlPgdd5Neh8xhvU3oFA8HI0pvlMRWcyi0jcCQA8zU6iOoF0brVRWpNRuTh?= =?utf-8?q?U4mmJz0XqLnR?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7f858bc7-828f-4e3e-cbee-08dd1fb8f984 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9642.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Dec 2024 23:09:07.7969 (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: PAxs/fLh5AqOgBgcnhBQKhp/YLgYFjsffk5pOGvLOkEsJY0aMRbDMdDiG1IpAvZd7UrhV+QTle1kXZyKuaJYbg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB9PR04MB9939 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241218_150910_943671_4ED1C549 X-CRM114-Status: GOOD ( 10.81 ) 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 Controller │ │ │ │ ┌─────┐ ┌─────┐ ┌─────┐ │ PCI Bus │ │ │ │ │ │ │ │ ─────────► │ │Func1│ │Func2│ ... │Func │ │ Doorbell │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ └──┬──┘ └──┬──┘ └──┬──┘ │ │ │ │ │ │ └──────┼────────┼───────────┼────┘ │ │ │ ▼ ▼ ▼ ┌────────────────────────┐ │ MSI Controller │ └────────────────────────┘ Add domain BUS_PLATFORM_PCI_EP_MSI to allocate MSI domain for Endpoint function in PCI Endpoint (EP) controller, So PCI Root Complex (RC) can write MSI message to MSI controller to trigger doorbell IRQ for difference EP functions. Signed-off-by: Frank Li --- change from v12 to v13 - new patch --- drivers/irqchip/irq-msi-lib.c | 4 ++++ drivers/irqchip/irq-msi-lib.h | 6 ++++++ include/linux/irqdomain_defs.h | 2 ++ 3 files changed, 12 insertions(+) diff --git a/drivers/irqchip/irq-msi-lib.c b/drivers/irqchip/irq-msi-lib.c index d8e29fc0d4068..cf39f2e481477 100644 --- a/drivers/irqchip/irq-msi-lib.c +++ b/drivers/irqchip/irq-msi-lib.c @@ -57,6 +57,10 @@ bool msi_lib_init_dev_msi_info(struct device *dev, struct irq_domain *domain, return false; break; + case DOMAIN_BUS_DEVICE_PCI_EP_MSI: + if (WARN_ON_ONCE(!IS_ENABLED(CONFIG_PCI_ENDPOINT))) + return false; + fallthrough; case DOMAIN_BUS_DEVICE_MSI: /* * Per device MSI should never have any MSI feature bits diff --git a/drivers/irqchip/irq-msi-lib.h b/drivers/irqchip/irq-msi-lib.h index 681ceabb7bc74..5ccfdb14fce1d 100644 --- a/drivers/irqchip/irq-msi-lib.h +++ b/drivers/irqchip/irq-msi-lib.h @@ -17,6 +17,12 @@ #define MATCH_PLATFORM_MSI BIT(DOMAIN_BUS_PLATFORM_MSI) +#ifdef CONFIG_PCI_ENDPOINT +#define MATCH_PLATFORM_PCI_EP_MSI BIT(DOMAIN_BUS_PLATFORM_PCI_EP_MSI) +#else +#define MATCH_PLATFORM_PCI_EP_MSI (0) +#endif + int msi_lib_irq_domain_select(struct irq_domain *d, struct irq_fwspec *fwspec, enum irq_domain_bus_token bus_token); diff --git a/include/linux/irqdomain_defs.h b/include/linux/irqdomain_defs.h index 36653e2ee1c92..feecbc27c2575 100644 --- a/include/linux/irqdomain_defs.h +++ b/include/linux/irqdomain_defs.h @@ -15,6 +15,7 @@ enum irq_domain_bus_token { DOMAIN_BUS_GENERIC_MSI, DOMAIN_BUS_PCI_MSI, DOMAIN_BUS_PLATFORM_MSI, + DOMAIN_BUS_PLATFORM_PCI_EP_MSI, DOMAIN_BUS_NEXUS, DOMAIN_BUS_IPI, DOMAIN_BUS_FSL_MC_MSI, @@ -27,6 +28,7 @@ enum irq_domain_bus_token { DOMAIN_BUS_AMDVI, DOMAIN_BUS_DEVICE_MSI, DOMAIN_BUS_WIRED_TO_MSI, + DOMAIN_BUS_DEVICE_PCI_EP_MSI, }; #endif /* _LINUX_IRQDOMAIN_DEFS_H */