From patchwork Wed Dec 11 20:57:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 13904169 Received: from EUR03-DBA-obe.outbound.protection.outlook.com (mail-dbaeur03on2064.outbound.protection.outlook.com [40.107.104.64]) (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 7215A23236C for ; Wed, 11 Dec 2024 20:57:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.104.64 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733950680; cv=fail; b=qMosR81AdGO33b/kUU8z3saNyts9Kbk+cZS8iDrN5kMkjqFA8PMmuz4IMdFANz/mopDVmZv6S0bUkQgB4jRMtx1CFhfsooWqJ1F3/44WjHwI1ZjXyxNfglnDD6T0s1RMTUAg8YuhOyzc+gQ9xKr1iOBqmHKyaXYhD0MqDaahJUg= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733950680; c=relaxed/simple; bh=h9rTyIw7JBTy1EJzxkuF1XAJdSITdDV9rguxRpQSuCE=; h=From:Date:Subject:Content-Type:Message-Id:References:In-Reply-To: To:Cc:MIME-Version; b=iwEDw3tYulLtpRTJ/HYeoKyjtTGkjP27x+YpLdJ+8sKlAe2LqxJobhBe9f73amYSmcZ6sOHtkJrbWuTTnCAN5FcUpwcNa6nEqvqiUGxjJAEMFG/OUmJlzMruUUVs1GZaOydRP0tF8RBKaF1FuwUwvnMUizXN+P4QikyeNoLyy0I= 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=XkuOxkTm; arc=fail smtp.client-ip=40.107.104.64 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="XkuOxkTm" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=JutavMd2AbjR7Al0Z6/mYaqOwXP/wG87mNQOd6mWs1mCOELekf0Adl/bQzcUPrfMDs56Uql7YqTYpFWOQ62rN0Th7a0YdiAyMKzCxPWSE75avHsmT+BmBUaeKo6WxtwdH+eYXBv51wto98G6Ic9WxX+CEjvKDTH9yWs/4bCrs7gptwQNy/RfrXdAQoKhgW2m6qUn/32fJcdxUEhbwO8bIiSrBjI3gDoBYGzxNTjLb0AAvQnrFdmBDcjZ1mY2KWuuQ73eK75xEGQ9cXRBVhYlRIjY8L0VLRttXRQHaF6/tX02qLmGRM0bDSCMEfHVjnDGHAWUhRjKF0nUo63N2+Yq/Q== 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=Zg17DPPYOTuadjG+VkqD69CJqHyQvuSbj4mlECIwRQQ=; b=h397yoB125+bEMC0nmOP2p43mXrs/cmMRyf2wadW3rUo+U3P2QMSC0V0HNX59UMdlerbZYURgu/BZcwq041azthZT4aZStc4whIyUVaZfukjdqKqV0tjperKSeRN1x8fa8Q/rMwEuzbhYHBFV2UdxJdIpPIzROS1/DhI7ira37ivTe7EtA6GKAdyaNJ03Cg/lhYvp8Y1WBs0NYHmZ0QvnZwxVgv7LqINj3FxQ5e1jd4TsypcOwE8lq6+pCBjQv0NSbybcHi6W87OBV3o43PVOTptUQTR/wmLnjp4JGN4iTzPKIeA6BJ2pP3dp6PfPYiNlUj92UBEznC6HyoKPIa0fw== 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=Zg17DPPYOTuadjG+VkqD69CJqHyQvuSbj4mlECIwRQQ=; b=XkuOxkTmzRSjcu1arez24AsI9ewQVEPvV5RLGP3boUpHuMDJ0xfqF7a3ohMnsk1taBt9JBWP5Q9wTHImvraOdoIuRs0mW6AO/uW/hi8XoqugBIdMNjGDjaOkrzNf7PPMsEpT4DqIFoIbCTOQiF3qOVm33kCrxr5HMV8u04ytF3lu2Qht8+daLjB8p+sFHhjZgQM0y1pywLuwNJf8GFBsNBqrxFfZ86F7sJ8nmkWJfWxmdB+xcejTYujSmYNmTr9Gzw3s0D3fUrEgFJfSpltNn/yY0nhtFcd6zb4NuylvM0AGnIJxfuoqjCwnNwZo+KQXz2R6f1IpY2eGA7el1+smPg== 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 AM0PR04MB7139.eurprd04.prod.outlook.com (2603:10a6:208:19d::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8251.16; Wed, 11 Dec 2024 20:57:54 +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.8230.010; Wed, 11 Dec 2024 20:57:52 +0000 From: Frank Li Date: Wed, 11 Dec 2024 15:57:29 -0500 Subject: [PATCH v12 1/9] irqchip/gic-v3-its: Avoid overwriting msi_prepare callback if provided by msi_domain_info Message-Id: <20241211-ep-msi-v12-1-33d4532fa520@nxp.com> References: <20241211-ep-msi-v12-0-33d4532fa520@nxp.com> In-Reply-To: <20241211-ep-msi-v12-0-33d4532fa520@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=1733950663; l=2559; i=Frank.Li@nxp.com; s=20240130; h=from:subject:message-id; bh=h9rTyIw7JBTy1EJzxkuF1XAJdSITdDV9rguxRpQSuCE=; b=2aRlvWumyidpf84WG24Qliz1Q9qLqiUdSsjcTrwNvTPPY3x2ktuzFuXMSb/6iwZFHnNVfmnUt yv9QILwBLtcCSGExXA40qui42uvNU/gexQNhy4K0gsrsaeSO/LvPRhG X-Developer-Key: i=Frank.Li@nxp.com; a=ed25519; pk=I0L1sDUfPxpAkRvPKy7MdauTuSENRq+DnA+G4qcS94Q= X-ClientProxiedBy: BYAPR01CA0037.prod.exchangelabs.com (2603:10b6:a03:94::14) To PAXPR04MB9642.eurprd04.prod.outlook.com (2603:10a6:102:240::14) Precedence: bulk X-Mailing-List: imx@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB9642:EE_|AM0PR04MB7139:EE_ X-MS-Office365-Filtering-Correlation-Id: a224c0da-b0f9-4ac6-2aaa-08dd1a267a66 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|52116014|376014|1800799024|7416014|366016|921020|38350700014; X-Microsoft-Antispam-Message-Info: =?utf-8?q?WqZHC0vJV9mJKVKLj3JUVLQ5nYbdd6e?= =?utf-8?q?+tFrYHzhvRr5XD9Tfx2606bG5DP2lY6gdxZFJYxCKl4i6KrZR4SD+xxKgySGHpnGi?= =?utf-8?q?C+oGptY4GTc2Y3Dpqf3pndV8OSsFq6CcxM2bNELJcPvKqXSdC+TFy6oADmZUH0/S2?= =?utf-8?q?7uQt720eL6KzwItYR0JQJ4rPtOSlPOI0WbP182HRHt/uS+EsQwr8kTLBAYrkMv1gA?= =?utf-8?q?ri6gJPQy4qRs+NxECPTwjPsAwq9DlhkMKfOtt2LYXuyldSLQOvp3t9beR+SiksuL4?= =?utf-8?q?4U8iVetH/hSoQzd6bFID90E4N4v4Z8jan0UO8wmGBOfy4jb1ObNxCN1kmOBFcakLq?= =?utf-8?q?19+KqNQ3/PjRppnWjv71thoGMvTTVujExTUseJOkxOSnOtgAvdrww7d9WsqZr65eT?= =?utf-8?q?GeVTEH11DL1/+eSmh75r8L1HkAP1VMZBwZ886xsIAhCWFpK63BXDnfdJ46i7swC1w?= =?utf-8?q?QZ3AkgHQFm/LJ825aArWMo4gdwe/F2mHpahIz+uwyqbJzOHzHaI0adpTxBEGSmTVk?= =?utf-8?q?M8AKjtt1cUiJ/IARTR+xqEJpUDN5d3Aw7tK2Qs/Mo2FrXYBPPcIBj2slF0UhWuGjq?= =?utf-8?q?4q2abJyWoxy5G8FKB9ywnErY7Y3qETrCxDLGzhfg8astOqqf48iUkeKau1tQihuIc?= =?utf-8?q?/1wFuw6U8wPfN4PZtBgAqWllEOfSpeYWZ3D5t+rBz109ncVNvLNu1JfdDV+SduOAQ?= =?utf-8?q?z1OctnOF4acTi4TQV+0zdVEHD7Rrwsa4J01GE7jzKCfHXWjc6TAutvTJqlRcGKTlV?= =?utf-8?q?NTJTRmocjXdO3Nbic2PK62Oq5GgSUXZCceaOk0mfIYajocYhChX14axgyEXNuhZt5?= =?utf-8?q?hNJpDdisz2Tg102jkKADIzlh5MKq5ITttY/Cxtdd62lz/0y7nWPJ7f37fBKGcRD5v?= =?utf-8?q?LUc2XSV4Komk6IexhHr7xgWdvwzRo6gRTxZeFPNagtPgN/m+L48g7JdNkTLkOrF/t?= =?utf-8?q?DckoJ+tBGjjta1/6Uz0TYjFoS98JbaC8FxuAHSfk+KKJVN2pXlitaGSjLQ9cJ+ncP?= =?utf-8?q?ILg6xiod2I3ZqYvR54yFkS1uFAzb8zIqJbjbGl7HTXPW3OVc51yHokJgsFpH4edh1?= =?utf-8?q?wDRv1gW9exgojDdTWUjvRXzs3MmK2ziXLg+V851yci21M/a9ABty2dEHS84Ckztdx?= =?utf-8?q?Y4AbZ851J3PJY65wwbaz2iET6hFZmSGgcF7pzIJdm5x1cRyG6q8a2Up11r7ecvMh9?= =?utf-8?q?LmO1k4IIfn08KabsefIfyJmyizg0iIjCf2PkPcxNQYQy94jbJ4pD1UfdMEnVcnKEn?= =?utf-8?q?JLKnSvfdg2u63xMUYuWvlv/eS/aGDtPdbsH+eC2HNgeuSM4SRFUQ3HzMnWebSX9x7?= =?utf-8?q?pu9ubK8mmc9/sUdHm8ZF91olwW9Hjhp+qWQwahzB+1v2PPXRtb5hPzU=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)(52116014)(376014)(1800799024)(7416014)(366016)(921020)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?iXGL35JdSaGUeTfBGK67vND1HG4b?= =?utf-8?q?fGVNKIrTw833a8sf1dZaB0UbDBIVXdK1FEu5jlHcDt+92LsY0UYOB18I2Hsop5/9u?= =?utf-8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zJVaCcSoM1YmAr8kIUaYOjSa3y+4bwjqK/xzyDPT64bkz?= =?utf-8?q?3Sqh+VFwrLpLMLrKhv7JIaVAqf/ifigRd1zKa+743MF5ahm0NHVIs6AYJ0ggT1SFk?= =?utf-8?q?cATMRJOOaYWV6KS/aV2aoS++BqUiPReMM/KT8j0ViOkFc+Zl/1B6x/W7D30TqZyNl?= =?utf-8?q?qcW0EWhLGhDfh0qZ7J9YWRv3paFpBvKlXuKct75CjXLEtRj6Nzk1afntX00mAr7Pn?= =?utf-8?q?W4BUkE9Uudl3NhZ6h+jPtxh0cjGUlHpPmtXxcOYlClAnKPbi1Bj/6Jsk1hyDq5A6V?= =?utf-8?q?obRtJimtwMfvDZAhjupi8gRjcsR2ipGOnFU2q5VgLJw2dpcQdCXCj0cKEyijmNvc2?= =?utf-8?q?wGgF2wyUe956pnZZJpXk0cRDZ+OQ3GIIZ99rIs5+ARoIN9KvgeMOe8QP9pxiAn0zI?= =?utf-8?q?7Cmnlq3atgnzCcGzX2XAKEAy0Ear5gHVKigltuYvSsKTByg4Tu7O4qlLMTdknBOlZ?= =?utf-8?q?yT1Ie/fX8zW4RKL7B0IpAePjvgQmQacGzw2NKtWt5mAw7WP8SXW38EEAFvu3nskxR?= =?utf-8?q?LpgeJ8Ab2ARQ?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: a224c0da-b0f9-4ac6-2aaa-08dd1a267a66 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9642.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Dec 2024 20:57:52.2212 (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: u9k7tLyGnIuJkTWZacOAhkqmg/m7GLDV35alYdLgRrOSZ2NO36vd0Gt54vH+RTAXGIOnPX8fABa/KRltnejoLA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR04MB7139 ┌───────────────────────────────┐ ┌───────┐ │ │ │ │ │ PCI Endpoint Controller (1) ├───►│ ITS │ │ │ │ │ └───────────────────────────────┘ └───────┘ ▲ ▲ │ │ ┌───┴──┐ ┌──┴───┐ │ │ │ │ │Func1 │ │Func2 │ │ (2) │ │ │ └──────┘ └──────┘ ▲ ▲ │ │ └─────────┴─────────────── PCIe Bus (1) is platform device, which is generally descripted by Device Tree(DT). (2) Func1 and Func2 is created by configfs The current platform MSI API supports only a single device. For instance, a platform device (e.g., PCI Endpoint Controller) calls platform_device_msi_init_and_alloc_irqs() to allocate MSI IRQs. Child devices (e.g., function devices created by configfs) require individual MSI domains, with the same MSI parent domain as the parent device. These individual domains need specialized msi_prepare callbacks to set msi_alloc_info_t. However, the current ITS implementation overwrites the msi_prepare callback with its_pmsi_prepare(). Modify the implementation to assign its_pmsi_prepare() only if msi_domain_info::msi_prepare is NULL, allowing customized callbacks where needed. Signed-off-by: Frank Li --- Change from v11 to v12 - none Change from v9 to v11 - new patch --- drivers/irqchip/irq-gic-v3-its-msi-parent.c | 3 ++- 1 file changed, 2 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 75aa0d4bd1346..33e94cfc4d506 100644 --- a/drivers/irqchip/irq-gic-v3-its-msi-parent.c +++ b/drivers/irqchip/irq-gic-v3-its-msi-parent.c @@ -195,7 +195,8 @@ static bool its_init_dev_msi_info(struct device *dev, struct irq_domain *domain, * FIXME: See the above PCI prepare comment. The domain * size is also known at domain creation time. */ - info->ops->msi_prepare = its_pmsi_prepare; + if (!info->ops->msi_prepare) + info->ops->msi_prepare = its_pmsi_prepare; break; default: /* Confused. How did the lib return true? */