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: 13914236 Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05on2069.outbound.protection.outlook.com [40.107.20.69]) (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 5157E1FDE26; Wed, 18 Dec 2024 23:09:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.20.69 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734563365; cv=fail; b=GUT1dTHh1zrxzZFdYuEcJZZTuFDjsybEWXW0Y4vgltkYUxHSnLbdGtc4ra314DhiAfbNJIb38GB4dlGEAMc1YFJherBCt6dUgF4DzcmBX6IXbtjTQgIsk1nbP03KnqBufwQ5l8Uhsdv88l41pZ+Od3HWZ2QzIfYBq2uuDD4JWiM= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734563365; c=relaxed/simple; bh=4WwkstL35KhL3qhGUlXubFCz9/fgciZTvqmYrG8rlZw=; h=From:Date:Subject:Content-Type:Message-Id:References:In-Reply-To: To:Cc:MIME-Version; b=Df49Qt8zVBeBDg6sRzg1BYG7AL5cY52EB8mJhdQDoWtYlbwfyMBtlM+WyU7dnd2RU4Jvf8pJzUJWZR1ghPwrKH7QPcATrXw84H/44aFG2dzKZJNoAKNL40+KrkZQ5hrALDNWKzztSs+zr0gGjIcJzrizrJvioxYH6gFr0kg9Xvg= 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=hVJnwl2z; arc=fail smtp.client-ip=40.107.20.69 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="hVJnwl2z" 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) 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_|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?= =?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?lZUWduK5NPhmWy9C0JTB+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 ┌────────────────────────────────┐ │ │ │ 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, };