From patchwork Fri Apr 4 19:01:02 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 878344 Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05on2086.outbound.protection.outlook.com [40.107.20.86]) (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 2DEC321B9DE; Fri, 4 Apr 2025 19:01:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.20.86 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743793305; cv=fail; b=N+8W+3AhSSe2EdcPGKk2lzcDMajxwM+DFdeXaKTetSgYfppiw8jSrvBKRsbYswdjcbklCAygIj/eGHCYL1FJfW6irOUt1UglC4/uwCSAHh52RAMBHVXmBZzHu3UPuhbi0tLFFG8x9pfslSK39jz04eVY8575CXC7WdWOElfQtqQ= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743793305; c=relaxed/simple; bh=ThyZOhwaDsp4V1j223U0prTZIbMrn8Rf6YEorwRizOA=; h=From:Date:Subject:Content-Type:Message-Id:References:In-Reply-To: To:Cc:MIME-Version; b=ENyofM6x8JdzGl+8dpdqV2LWkiHF4j6Ug+iQdelzf9OE3GzNYKanrspTJPj2QboJQI9ukhdWqs8KQfLvok2Ca4liTjJHPjwFeSM5w1edQbz5eCY7TKVQ3AMCRIrLnTsLrQNJzx7sW6J7dHZ/UJOdeILPFpUVbWZL6Sec2M07gyE= 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=Yx1sPAyH; arc=fail smtp.client-ip=40.107.20.86 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="Yx1sPAyH" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=uxGEEq8yF8LAVbOqGMNp5rCrTTu6wmxQOUpQ0fkULJ97uMcF2vRtUI29KZLNVq3BEe04OGdeDqD5vGLnuXVUrv0hw1JO4iXjKEpxxY+lvRtWY0nEoZUxNkf7OZAkx32LX3a1LUfJdTkJbAaoguvkR+qB/s+clzyr9KsY8mmvkk5jGirfmn56a3fdP0Gh9ZB7LCYSOkBXf/8T1LrlRzgV8MQ7zWAukYwv+wPXa3fTEHABn/5DSxEt+AmrFiXU54FlAmH9JNd+0IV84488hOkKzQ5MaFUmUrWcUuLDZCilzGu90H4Mw71UOp6j/wbiLbUVq+49yQQ8fw2KBxJ80i89sQ== 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=fBhEmQ+5keqgx7M1lTMSB3Zen5LLbLZOcXbwQxpRbuU=; b=VbSmI0aOeeQsGSgl1caEKRjyDmtfTr1MwEA8XQb0PPLsI47JwSFuoMrlTcKHIFowIyvkJ3Ue0FD1ZaecMpf6raG6xSo6zvIRux6K+o/W7Oj7QG423JaP8pye7zgoysxqcb2PSkpc/gAoTjvulHS6otBuwWXb9AbJ6FLSOZKAn6EUKQUZaULLtxXehD0pJ70DWQEFOEfYNCgYbRe8B2fb61UlxWJ6hy9Z2e9gxGBem2CbRU8eO6RhTNNopGbCA52PR2dx5bR41YdvK6AtonJ7T0XsxkIHTj+hEDdGH1D3uKyldkSUYC/5b22SAVCaYy65MetCfqauJOSG2ACLVomJ+Q== 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=fBhEmQ+5keqgx7M1lTMSB3Zen5LLbLZOcXbwQxpRbuU=; b=Yx1sPAyHntizRq+nveSNCdV1IlsspPAb52/4WArtNxpJLIrR1ipPRJxkGsvWmaH6A0OHVCTwxMleY1058jr7EyHUdu4ivc5nIYxF5wIwPU7sdL1KoRI/0vyS/GAzlUK6JKtRYQUnWDLtv+Z4WIDW2qgM5i21Xo95DtiKX+q49my0cWnNEWDBfRVbUF5Ye6h1GhA6h6viT9vHHX+JebJf1x+HqRRUjlOZxTJvcAuOoPQ0EMw0L0Y6yk/gedtF2ew7HYrZ+vfgalpg+RyClg/OKtF/5o99snEeWYsWjheT8eW3kfAWgkGg81WVOy9cQ6z60o3jAAkZfIyOhx3VEYYlcg== 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:40 +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:40 +0000 From: Frank Li Date: Fri, 04 Apr 2025 15:01:02 -0400 Subject: [PATCH v16 01/15] platform-msi: Add msi_remove_device_irq_domain() in platform_device_msi_free_irqs_all() Message-Id: <20250404-ep-msi-v16-1-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=1529; i=Frank.Li@nxp.com; s=20240130; h=from:subject:message-id; bh=ThyZOhwaDsp4V1j223U0prTZIbMrn8Rf6YEorwRizOA=; b=B6zKGe8sGXesVcqUDauE2TytW17eF8afP3JuSmZtZWTTSKyKwuQCN9XQkzOX3VlK+1azNZv9i GFGwe/h1HIkAW5zhtNXkZcymgrtszqKhvAbaDEAldP8lfP0p5lreAkG 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) Precedence: bulk X-Mailing-List: linux-kselftest@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB9642:EE_|VI1PR04MB6957:EE_ X-MS-Office365-Filtering-Correlation-Id: 8d568149-482e-43c8-9e5e-08dd73ab2235 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?i6It6uLQoEHQfQAJr0WkKMXPkM5AVLt?= =?utf-8?q?4SmCleRD6rr0+h8IgS0viI0jqzDXYhMUX/8EKYIJ8PQtBbI/QKRPotgzh7ld1aPHD?= =?utf-8?q?vav7S8U8eAzhEmlf9o/a6VEWjoM0XvQrfbxnHbpC9Qg2U3BX2Rcb1+5n1ToCJZ/EY?= =?utf-8?q?yc3SZ+yS/HFMLVFX2QXYNF/c8WTg9Zmg2+dvsKmpX0TklmOf5NVBSPGq2gNGrcO9N?= =?utf-8?q?Bt3o9wUY3MvUmMUqC10hg0DI3pD9C9f7eAcRRi+i3BRHW6bf/a7uS/oHQkl/PU1cK?= =?utf-8?q?m6Qyx859QYPBO7L4uku5s45HpmxtbGg2X85BalNu0ZaFRqlpS6OK/dVta+Gfa+H5X?= =?utf-8?q?9oiMY7Y1BvCaeSuwhArQvTcQNNhMiAjolmRLKjjktgtTwcIobsUbk+dxFjj+LmxfX?= =?utf-8?q?UYkcSes24B/Y2NbtTNOPuNjVqGPEKuq0LKwcl3fD10SF117uIMagSieJGX4YYrKEK?= =?utf-8?q?HDjMq3DKMwo2/E4RkSZkBlYK2IFeLB9j4BrENHwVdH6gZYWg/8ZPJnPgF3xKPOyj9?= =?utf-8?q?r2N8NistkwEN1Mz6b6JXlk01/PJiDOEKBnKPWfXQ+J4rgcegGBy9Rmy1IVIhETjbl?= =?utf-8?q?gJARoH/C3WnjTJXDCsVPNs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RV:; IPV:NLI; SFV:NSPM; H:PAXPR04MB9642.eurprd04.prod.outlook.com; PTR:; CAT: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?r9plPGR64/lT6mWjyBx4tmXMtVCb?= =?utf-8?q?aiASPDJSX0SCzry6bfuDAmAhmr4Cf3vdufDdLAJqe9EDgBvJ1xwHd6p9wB0Ny+GgY?= =?utf-8?q?dzmqOhnA+xexGPTpaCzJ7qagQtBpU9EH33jBH5DvTHcanaRrCcs9sxg6A4dvymsQf?= =?utf-8?q?D/tqJXd9S5/TD7dMf38VCTe/9cTQlWp4f7st/fdyHUiq5z9cK2BBPSK5KdSc9e+02?= =?utf-8?q?+9gOnNSrdiMiLan7hqkj3+RSM6I4t9aniae6PVgPbQ9CdVRn2zs3FAf4d2soEDREh?= =?utf-8?q?pNB1wbKgeHY8PI4L2jzykSCt46ZWvCz0gohFGJiQZYhGVt9RtFFiYJK8oBic09eTx?= =?utf-8?q?IC4YxVgoXn9C+u+WNlZOCGgHbjh7ABlKDrb3o6Bp9wIfHtXrlFm1hbV8g7G6LkSNX?= =?utf-8?q?B837iMGoHSZFuddynrw4CcRHwG5DTDVc3eVbRHsUyYYOw1FM4vc4fOrLmTqcrrCBK?= =?utf-8?q?mXG+kcSPHsOnwu+84rwuLHfijg/TBlfjx7a240kiDDXWfu7fCV31e6WqNyaEEoQ+l?= =?utf-8?q?kZSbm6HTIsQiMcGjFihHtZ+P59CmyTfUauL7E2A8isOUQUfLG3IWogvcoQssgjJAJ?= =?utf-8?q?h/M7BtLVMgEa5Gz21j/gQdbxInNwx21G+9DxzN8G+/NkLhYTGp7oJQBlIAZKFW/TC?= =?utf-8?q?rYV44CKC9UAiv5CLQ2SA26Wb8GT1UiyChyITeUxUg25BlEu7C6mllOn370PhtUGk9?= =?utf-8?q?cjCM26Ij9DT32nPrcVXXudytwa9oX9rdxni3hl7+acW2VIxR3eyirLmB5XQEanW2L?= =?utf-8?q?SdAtDHbrTQ5/jCG8qZB5u/5yqc2aGmCeyjVAAPDrbSgAPHmqMtahzwvl2/a8rzVAk?= =?utf-8?q?NBX5IEpcffvdROa1TVsnenj3rCaeAJOXouKF3zgh7F4o/f4VH8kslpkZ9tVWRtwsh?= =?utf-8?q?O7Js/EKJvAY9PpwASev1tWTDpwYb9fP1LjLbuYbsJtuS3ghDS6fRwB/JcjqTy9n93?= =?utf-8?q?DIX7qBza+XmVBn1oL3G9zBoyrstKRh2evhz+FUgxa/Qb3iSPqUu9pkcyng6KMddeh?= =?utf-8?q?/77ez7YnjVkY+r4sidMTdOTyMEqE0BHbT689HUk9PV/NlhSINBK9Hf9rpPGtHLq6W?= =?utf-8?q?UKeYbeJ/IonTfQta6IAovNDaQQaalfVWv9OjYDLzmMoSLWLdS0E2rAcBqmm8uaj49?= =?utf-8?q?/izY1Wg8IxJ7CBlqOQHsMhgLQIscLUJ5qZ1wnIVReWnN7HWbWpuptw/RjsvD4uvXX?= =?utf-8?q?sNI8oPouL/y0Bpdcns+w1CZteRVI/ngiZqWUeoEI3hQeYbGp2sx89AQ/sFZ/t4jn5?= =?utf-8?q?K4SfmsrXIdTpF2+sgix17hOzbGZGf7bEu3Rr8408AJe5jvG4XgysdYnrFWcjWE75b?= =?utf-8?q?WgxFl7yWE72z8OUDKkNip3cTNCd4UEg9N+RFmn3eRQGboPgRhO5bG4UFTtxRtgRNr?= =?utf-8?q?JHtRk3Mvl9A0EnjLSr4dJpiVMky9glw6kAgWHrTDGvfdw4FBbQH3f9cNEmFwm3WRC?= =?utf-8?q?OUMhp+S4otQbhiUwvjIqWfyuUQi5uZERjLWkd/5M1MIbxZStkSEVZlFc=3D?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8d568149-482e-43c8-9e5e-08dd73ab2235 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:40.8062 (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: XiaLS+5lDOHRQo1lLOKfXBFzLX5W+WyAB2J9nMEcCabTZB6Mif0NK1gAiYPyQLtYni1vvoUJ6FRuO8YcvPaiBQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB6957 platform_device_msi_init_and_alloc_irqs() performs two tasks: allocating the MSI domain for a platform device, and allocate a number of MSIs in that domain. platform_device_msi_free_irqs_all() only frees the MSIs, and leaves the MSI domain alive. Given that platform_device_msi_init_and_alloc_irqs() is the sole tool a platform device has to allocate platform MSIs, it would make sense for platform_device_msi_free_irqs_all() to teardown the MSI domain at the same time as the MSIs. This also avoids warnings and unexpected behaviours when a driver repeatedly allocates and frees MSIs. Acked-by: Marc Zyngier Signed-off-by: Frank Li --- Change from v14 to v16 - use Marc Zyngier's suggested commit message - Add Marc Zyngier's ack tag change from v14 to v15 - none change from v13 to v14 - bring back from v9 and remove fixup and cc stable before it is new use case. --- drivers/base/platform-msi.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/base/platform-msi.c b/drivers/base/platform-msi.c index 0e60dd650b5e0..70db08f3ac6fa 100644 --- a/drivers/base/platform-msi.c +++ b/drivers/base/platform-msi.c @@ -95,5 +95,6 @@ EXPORT_SYMBOL_GPL(platform_device_msi_init_and_alloc_irqs); void platform_device_msi_free_irqs_all(struct device *dev) { msi_domain_free_irqs_all(dev, MSI_DEFAULT_DOMAIN); + msi_remove_device_irq_domain(dev, MSI_DEFAULT_DOMAIN); } EXPORT_SYMBOL_GPL(platform_device_msi_free_irqs_all);