From patchwork Wed Dec 18 23:08:39 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 13914256 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 14855E77188 for ; Wed, 18 Dec 2024 23:14:56 +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=o3FjoyRz3SjkhMK8MORPoSjLFnPjDhKj+yUIz4mwf6s=; b=2xhP0+qxJC7mMmG7dnt/RpcmVt YPAT/evUqWotGbHxU4Tb1pMYrVadqaDm4WTpyCHYpeyysVDHp5NhBvpm0KYzI6WXSPgIkwpuM7Dv5 LZR42B+VQXLMwPq1l2AWpz96IWQ3aaHYirjuLFNC8Q7Az0HBV1xMiVdBquihBieoeHIPybXM6Wuf5 JItPfmzm1apMSbWSq+zT4g7z70aCObbZO25B/238EUTTk0Bgi8nPvoJhrVRV+5Kd0E+qpOYTiviDj xvpvCjQgpECIIY6+2Q+bZqNkc3iuJnNkT3J2E/rXPvuWBShLij9UyoFf30ye90Bmt5BteDZxTftYZ x6+byMDg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tO3FZ-00000000Isy-0jyT; Wed, 18 Dec 2024 23:14:41 +0000 Received: from mail-vi1eur05on20612.outbound.protection.outlook.com ([2a01:111:f403:2613::612] helo=EUR05-VI1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tO3AT-00000000HvD-0NMq for linux-arm-kernel@lists.infradead.org; Wed, 18 Dec 2024 23:09:26 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=xcewkx4zqwRui28rgSoFK2Tnm3svSa+UJhTIVx7mlMFs/ppY+TpwIFrhMrAlyGJZIKMq6TFH0IeGDNPZAr3+1LmCPT/Y+pEbwk4gDP/d+ye3Azkc85qUIdLnX5NyDWkX1ISF3qVuU4z27ZU/aa4YaF4hu5UZpP5Qfw/mxwurVZOIwPevC8rdFGJW3Ne60PNwXrV9Q9x8+3ahlPAT1JgAvjncSHAeFauQ8vqY6eYfj0Ngm6MKIx4G3EhlF8GFU85mUY73AikWdZ1ty4gg6eBxPhp9M3mfqHn/AybQoFcCOJS073E98u9rzcpAULZmdmiRBGZoUM2aqfDNmLPD8/R2aQ== 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=o3FjoyRz3SjkhMK8MORPoSjLFnPjDhKj+yUIz4mwf6s=; b=M7i1zrpCtAVtXOLWlotReZGc773qtNZxBS3UYR81BwhtlgKGE9j+lKDpCE04+pyokJoZiwaTKGpxWqPAjRnnWPMg3JnIkKZ5JuC7kENjOrvRvkpXS8O7JmzpFdoO8kOX3WRmh+eOQZ9r/a1xb8+SNbX0Mlghw+gbE8+W7sszVWlNWWxupNb6tWpkr6XAJf8kEymzSsLAHv0Au10VnaOSUXMkXvaztLA0ABLxqR95QYlrSXnJveVxqwQeBoIP4NKPEzrbRE4SbLCLYXd8Q3TTjdvwaJ9cQhAT7cu3c/cHxB97SYVyjC3qcBjBfT2wPXg9IChV1j3VwrOaxOuFLKUzmw== 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=o3FjoyRz3SjkhMK8MORPoSjLFnPjDhKj+yUIz4mwf6s=; b=hVJnwl2zwYvih5KGR6HoF5kNITia0jIAB0unx6f/ndM8pOplQURwF2nOc7DwwlrMbe5tusYNhZSAhag+ZXYQHuom1kDVuJ3/mgNEpJu9Vcys/uVDrU3EMA/IKslJiJq9eo8JPhslE90l0Us9FpU4RUnCjC9SJxpp2iMlrgHS0c66J/SvH9d0XFvxRBZshUsz4dElB/rZRizcHrodGXd5rB5+trK7zMu+79ySpUcEYZm9IcsFVNMztNOWK6nd/uxZ/8Nr9sKWeevjOYDf9shuo6v+f/1uTUsHYGSuIMml4up8KA+NwMHWganOP13BOsz+8lR/lcwZ1xB0BjcMFzA7kQ== 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:21 +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:21 +0000 From: Frank Li Date: Wed, 18 Dec 2024 18:08:39 -0500 Subject: [PATCH v13 4/9] irqchip/gic-v3-its: Add DOMAIN_BUS_DEVICE_PCI_EP_MSI support Message-Id: <20241218-ep-msi-v13-4-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=3555; i=Frank.Li@nxp.com; s=20240130; h=from:subject:message-id; bh=4WwkstL35KhL3qhGUlXubFCz9/fgciZTvqmYrG8rlZw=; b=nzwsc8/qZUuzDYm+GQxGjDUKpheDTKeoYWbKwVPnApomjR+n6TZNUIS6Bqo+80gxDr8rTYBSu Sp1XHabTldFC+iFxgIO+gpSeHK93A5PiIrfk6hIghkofGzJE2nwCFyT 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: 97b9c9e9-75ac-4805-c8ed-08dd1fb90174 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?b1y/2NlElL8Xgv0F0kf1r8RiHSZM3jX?= =?utf-8?q?rBgU0eQxdn8MJDwAVsz9vxLoSM1RUozKCZbsQfqIMwJ1274a4nCQElr4hJoivQC+0?= =?utf-8?q?ejbDNebDfdSGnRZnrLQysvA8pQlIGIsV2xTV1EzK2Pj/hyAMC/LhIRcRVtZHfKGTy?= =?utf-8?q?6zgkZjbfAuhh7kYi6WngLM9c2TpfNfvuxHH3TKsUz1OP6kl+A/yos3WdkiwR2/l6m?= =?utf-8?q?863i7+HzVZE/5AxyW8fGIjsacZ7CSHjrmL+sjVbliFNijbQZxQYBvxK/pd1hJvbqU?= =?utf-8?q?dEa+v8M82iieJa++YFs1xS8Wp3nLMbv0UqVOBXGndXOhIY8jV3Sos5mRccv/8rDmd?= =?utf-8?q?lEKnYSgOEuEqQ/CrIyRLYg2KtBtudySha1ZUoklSVx8w2e6fSdliZ774tTXs6T68x?= =?utf-8?q?JmMQmw9WNxvZGGxHAo8RMogkJnq92tYAIfsXtmMJg7N5z9irzFqxxW5EriKbSUKeF?= =?utf-8?q?BhSTLlhIBCwLpGCXA91WfiDTfY1hvJ0WMYiHYjziSmsdGO/Tap8BUgOJg6mvHx6HV?= =?utf-8?q?RiZL4vttS9GrYuZR45KNQaB8tvpkCysRIjel1A9Jc6eT67nd8xGg3GGYUp5i88eu2?= =?utf-8?q?KM7ZbrPYBcYVI8O8NvLz5gOsfXV7pjRBPy+TST/wknk7Q71k7gXAuHxMRjHQcxrC/?= =?utf-8?q?7MMUJcxFGEOHMSAofVZoI4wW7iw6UtjBj2tIsQ+S2ovncFyrIoay72I0LxtXUWtLF?= =?utf-8?q?S2z2dksOFBpmfnmimkKyeOREOLG0c8EYa4tNGexJmjeH4Md8WwP1QLhCtnRFMz4JM?= =?utf-8?q?wre7EsHCYHWsrI8qshSaotBSDn4qHkHRU4oIbIvuyCePreD/V9RAm6WSgrO+uNJN9?= =?utf-8?q?4kSIGgzgwUzSVrXlSkQyO39P1gTR4cCsXE/zFt2j843XZmo5a8iioZRP53upcs4Ic?= =?utf-8?q?2lXrITxIMh2rl6KTEpoNUj4121Boi9DbPNr2vmTunz12DixH4xUcIM7/Micavs07B?= =?utf-8?q?k+QvE35dH0PP3AwtgV+NbmM5fXKagt5xhJCfiQy5XSJQ48uBHm31xvjLjz3uf7FPQ?= =?utf-8?q?M4Y8OhE5zwwkBWJMwFp/uMNARqBgGHHYe29fkwkHOfTwJyuY2niJjlaZbU/msm+Y1?= =?utf-8?q?IM3kWP5GmUh++4MC0KXUZHoldNd0xWbA7G4O34xj9uvj2993NUozsAjwNsjGGQp54?= =?utf-8?q?f0NeMwreF6JZDuADQnJRsw7NcxtpYovF6iaRoJ7c4LJh3pTpI24aS0UjpB0B4KtF+?= =?utf-8?q?IxgZ9C9HrDtlZ9XbLf0dBoSAV0qLs8byIS6G0Lt1DK6m44AMwClOCv4X6kXKXtdSV?= =?utf-8?q?WUXQ6loawfaLl+Z1PZQg4IB+eoYK9bFIYLGQOyRJmVi2MOK5Y9Ft4qxI7pOZ6b72t?= =?utf-8?q?U0g8XcM179XU9pgcvAZpENPs0LboKH/ux+FBCh68Fa1O+h/gqPMWPmqZZx20kB87R?= =?utf-8?q?ex8beXaPU+r3+27/hT9WvTa72CJ9CfmPA=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?HMzVtKr2gfMu/IGNqLugg4CeIJi8?= =?utf-8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WduK5NPhmWy9C0JTB+9bJnK/7/EgsaWEqRvYqbaxXgtJkzuXUjDI4P8VkkTfVM?= =?utf-8?q?k/2oTHpdH9OmHM/ZoOOU6mcJUyEqWlWPIVrHbRK5VCADQxWi/YcMKTgkSK1ewR2f1?= =?utf-8?q?7LYjjg82yknkJfl4cOYemrw33x7hUwN5bTPcm7yf/6bdGiqpUyohIRVYPFOl0NwDp?= =?utf-8?q?E1F5r+4aZL7vM4cuNbNlRLQBnyu2G0mdpwpFQcuIlzYntL1NwfTtBpyzofqh4j8ar?= =?utf-8?q?ZhJclCnVUZ/DrIyOflFgBBEp6RoWZCIFLGBfMmjxjhG8WD8yTUyXY4+gN3cYCQv8t?= =?utf-8?q?T05Z4bPPJcg4bSdOLetXcuJY2mWpi5gh03YydSfaQkvHbfbZdHBJK9wA60O1XXJip?= =?utf-8?q?EVws3HdUxKXABaVvkfANXRN3RLDZebkgrXMdsUtpJgK04PRBGcJVX0o8FIsQC8MiH?= =?utf-8?q?pwqJFIzaJdqT6CuLabFbAkdxT7ntNirc+Gsq+t88Ndcc0zeVWSxjvgOZyKc46gxSf?= =?utf-8?q?bJnqBQKBnC4a1haChmuiP53mq3dPMMxfDwk12GMydMASAW401rd4Qq/quH9TuzyZu?= =?utf-8?q?Z7OKV8AxUfloTpqL5A9UkCA0Yq5Jh6bTm2nXtBUozx/CsGhxa+1THSWYaB4yLc61j?= =?utf-8?q?PpZnYF6Cw63S?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 97b9c9e9-75ac-4805-c8ed-08dd1fb90174 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:21.1077 (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: dfHcn2FxTiEQy7lOhYBCIoXzBgoSHTLPajp9kPs+EjJ5IspD++cNw50rQ9hRdWyL03b6f8l/wlM0146tqUSgUg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB9PR04MB9939 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241218_150925_128969_5CCFB42D X-CRM114-Status: GOOD ( 14.73 ) 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 DOMAIN_BUS_DEVICE_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-gic-v3-its-msi-parent.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/drivers/irqchip/irq-gic-v3-its-msi-parent.c b/drivers/irqchip/irq-gic-v3-its-msi-parent.c index b2a4b67545b82..16e7d53f0b133 100644 --- a/drivers/irqchip/irq-gic-v3-its-msi-parent.c +++ b/drivers/irqchip/irq-gic-v3-its-msi-parent.c @@ -5,6 +5,7 @@ // Copyright (C) 2022 Intel #include +#include #include #include "irq-gic-common.h" @@ -173,6 +174,19 @@ static int its_pmsi_prepare(struct irq_domain *domain, struct device *dev, return its_pmsi_prepare_devid(domain, dev, nvec, info, dev_id); } +static int its_pci_ep_msi_prepare(struct irq_domain *domain, struct device *dev, + int nvec, msi_alloc_info_t *info) +{ + u32 dev_id; + int ret; + + ret = pci_epf_msi_domain_get_msi_rid(dev, &dev_id); + if (ret) + return ret; + + return its_pmsi_prepare_devid(domain, dev, nvec, info, dev_id); +} + static bool its_init_dev_msi_info(struct device *dev, struct irq_domain *domain, struct irq_domain *real_parent, struct msi_domain_info *info) { @@ -205,6 +219,9 @@ static bool its_init_dev_msi_info(struct device *dev, struct irq_domain *domain, */ info->ops->msi_prepare = its_pmsi_prepare; break; + case DOMAIN_BUS_DEVICE_PCI_EP_MSI: + info->ops->msi_prepare = its_pci_ep_msi_prepare; + break; default: /* Confused. How did the lib return true? */ WARN_ON_ONCE(1); @@ -218,7 +235,7 @@ const struct msi_parent_ops gic_v3_its_msi_parent_ops = { .supported_flags = ITS_MSI_FLAGS_SUPPORTED, .required_flags = ITS_MSI_FLAGS_REQUIRED, .bus_select_token = DOMAIN_BUS_NEXUS, - .bus_select_mask = MATCH_PCI_MSI | MATCH_PLATFORM_MSI, + .bus_select_mask = MATCH_PCI_MSI | MATCH_PLATFORM_MSI | MATCH_PLATFORM_PCI_EP_MSI, .prefix = "ITS-", .init_dev_msi_info = its_init_dev_msi_info, };