From patchwork Fri Apr 4 19:01:03 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 14038789 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 61E28C36010 for ; Fri, 4 Apr 2025 19:07:38 +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=GR0Z1iTOQebA6NDkRDEaFkcBL+OLXn2bv7Llb/KWBuc=; b=l0czW7k2IDxofQp3Pe2FCLy2Gg NWSkOUJgWyzP+YrZGbD22zAaATfM79x/AHuGfNDppuDuTbFOzzLALUtL63+tZoRaAf6yr6gFXJSyY +q/JpJ+h2qYxudIxWv5S7eCbQDmekEWupmNCsGRHNOwP9JOBPoElJqcu2Ha9LzDu2d2sTGljzEsJg pkHi38Eom+47oVylJ78StUKoBcwKVSRMRwfqOsRftpYYTbtneYU6O74H1s1mKObqYBiHGgo/DDVy2 BQSRH6X2VBrBxb/hu46bUK7o/z91F2zbABscJy1pXW9LIUkjzYi2L4XEMhqUSkvmK0s9QQ4YFVokS rzVfgWWA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98.1 #2 (Red Hat Linux)) id 1u0mNz-0000000Cb95-1z56; Fri, 04 Apr 2025 19:07:27 +0000 Received: from mail-vi1eur05on20604.outbound.protection.outlook.com ([2a01:111:f403:2613::604] helo=EUR05-VI1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.98.1 #2 (Red Hat Linux)) id 1u0mIa-0000000CZps-0eaO for linux-arm-kernel@lists.infradead.org; Fri, 04 Apr 2025 19:01:53 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=IC6gxA+anBcP5YQrHqQuqcnvgr3gEyTm7i6z1m3xj7UGCiF/RjP3uFqEUm/RpylSVQTpWVj3C+DoSHiCFqz8SZLqPz8HUlaB6u3L8JEHV5iaBWJYNd6UdAmRkzrmiBok8S1ZHCX5YHcOR5gV0aqI4qtRCZTlDUR47L4HzoNT0ihAqTuEKQDDBd5pmaBnrf22LHRUWehf392Oec/V/OfmivezhI7N+ag0o6GAdCFT5Vk1whH+lDi9ncQhyTW3Rk6fWBPLThbB44yADraRJd+SzdX8d8YQ7NkinOZekD/8KDe6vQzGOPxJCqVMjfEkTezAtrWPXx7pePkgC4GS2Mf/Mw== 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=GR0Z1iTOQebA6NDkRDEaFkcBL+OLXn2bv7Llb/KWBuc=; b=mnaEiNJyB2zgA8k506Q7U1ipIu9+sx4RVRjLXDeduML7gqTFr18rcI2IrKT8YhayOC5+HNccwTRmQzxU+lwQNoLD3QXSMvY2CN2onSL2BEgTfGSXCWT8WYTiLp6Y+T5xcWjQkCxfN2STZ2ff3ImJRbR2/hT0dCWSU4v126/h4rIYLoLdZWa9s93if8NNd4EQizsUJV/v5D1NAW2VQxNZcU/8/OVEwH/D8t2Vmyjdk0lrDLXNt8CFUzF14flrNak6PGkrmB618Rj0A2SDXhNN5p6w641CYXr03AZs+XLIRnRt+HHPn0AMFou0LpWEqFc9Ue5No6XybhKMJLB4vUP/SQ== 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=GR0Z1iTOQebA6NDkRDEaFkcBL+OLXn2bv7Llb/KWBuc=; b=cuQI5wNzWyHLK7ZQyLe+762KunPRHRjwdAqhSg8nt/Z9vm2OqLnczAVamUZGf104o2z+FaGUlRiBiOa4CAJBMUm/c83Rv3+M6AxuzL9xQXGKmQOLGGO1SjnAsey73oDmRnUD76rqu7PyPJ8r8y/OyuylvD2FPKRtbpZJ18KNDFXQOx4/t6PWXXG0z0cWEBqn5nGz54nUbxqB42Eqd9TpJm8TEbU6RkgMSbRFQ9xy//hKOtPtTBpZPAgiIy5INpZaWq1+WhTtcte2N04Q4LgtNWDWf/BgkD1pfUDY4fD3sAE2VSchxg5zxaFiJ4Ho3HA680qFIe0NfI/dCcKIpS33Ig== 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:47 +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:47 +0000 From: Frank Li Date: Fri, 04 Apr 2025 15:01:03 -0400 Subject: [PATCH v16 02/15] irqdomain: Add IRQ_DOMAIN_FLAG_MSI_IMMUTABLE and irq_domain_is_msi_immutable() Message-Id: <20250404-ep-msi-v16-2-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=1874; i=Frank.Li@nxp.com; s=20240130; h=from:subject:message-id; bh=p7gntWoxGh4gHuQtzBxv9euNYS3wHZIeRIkw2TEkLdk=; b=y4w7VRuSwy4uE/iTIdWKXZJaFYEqE7mC6CDssUsXgAmOn/vhXnkudrvMX72kkHEZauJIs+6dR 110ye3GJ79qBo5yNBFgBLRvSIf7lV5uRKkPnzcevfO7arfOWk7uv5H9 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) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB9642:EE_|VI1PR04MB6957:EE_ X-MS-Office365-Filtering-Correlation-Id: 04343fea-8ec2-4890-1923-08dd73ab25e2 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?2nq7IvKZHAgmgyvTkIzDOllyqUeWdCS?= =?utf-8?q?O8kl1UghA9yH08PlvxAJ1GC+IHrh3s8IMCoSf1xxY6tZFkJ0xSFL34XWBOQjUCo60?= =?utf-8?q?53XXsnJTpzPkC9YoNGq7L6NArOnGHF84pfJnqMGJZ6EHUBL3clwQVuOdV63OeL5q/?= =?utf-8?q?Dy92ohOE7Zmtr/cwXugkBBAp/dGmJrRbLrg6hzs4xUMLFbCrhz25QvQffRDa50Fhr?= =?utf-8?q?dR0Ab+3YQPKoSlx5lFshsz3lOtzCVDecOhwIh7EGThJ5RIpmQ5z+6YVTo/xIIlW/d?= =?utf-8?q?0nxppsVcgsGeSBIJYOGBWU7F5RYJqQTChj+9ANFkYni+twFMhEBOUEu858Hct73OR?= =?utf-8?q?guDRdXrI9WzRmCi1AlMLdDFh+kjyN/+hjPp/wnPINmDVql+0mU08KRav82EqCyaw4?= =?utf-8?q?rMsHfHaDK7l7tfV5Nkb5vx8z+pHIhCYT5sNATB36gn6NhV39HZN5+kI/DeAzkCTxZ?= =?utf-8?q?LRUfQx+oKxCq/DU10A8I1r9dSV+3N1RRuG/ztTpAgTGnyA939MwEcAhHAyStyMLm4?= =?utf-8?q?m3bzXx/wqLA9AOmysxV1AcGtLte2fbpFomv3zgPIj9mCBqppIyJma9au80eWmZbv2?= =?utf-8?q?5uFWMczZpHP6sMeMKTDK90w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;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?HNU5ySyNsfi2ZZ/TXTVheSDP/XhY?= =?utf-8?q?2fuXfXIJ7L1on6hfnJ4qW8OphV//ikMDWmYJjr+qDh6fuMTu2cGcgp5HrzWc5zlvy?= =?utf-8?q?bS1tUxRb3ATy8Rq0M8WpMcP3AVTPxwkehiDhwZ76Lh6MzAjjPZOAOTiltVE0X/ei2?= =?utf-8?q?CI2c3pTWjwcEkGdmIBOCDLjkpsM2Cv6RBJZt2cEkNwqXgiuJ8apzwEpU6ghnIOnRL?= =?utf-8?q?sRR0MJIh/l1qZsPOXG905RnqQcJCxC1aBHHciWlnyLvKTZnZR1SICg9rC0gPXftYr?= =?utf-8?q?66co41/XaJIKBilLtu7NLKmZmdrZj+RuT7dYVqsgqXcgWWvAadxnlvUPOCB3gv/kh?= =?utf-8?q?Em9xGPDbmRc7wCvHLh91V9NCsKJyPeyWMEsIfmnIACQIGUH/OwKLqavFJlN8Al4C5?= =?utf-8?q?/v5B0WKZs5PCMMBDFvyGPvTcLD69uBj0ZWyPEg69vMW0/UR4K8dBrIIXyQAyv6ckg?= =?utf-8?q?Bt4tKn8B0k2pUaLz/Fa/YOo4+m9xfK605JsMJCRexOTXUnokmDuuABoyRk5M21Uha?= =?utf-8?q?LmBGNg9O+moiJvrygaDSrGcFYjALQ9P+PMV3h4D1lSFifR4Y6Gr1K99qJc1I+QoG8?= =?utf-8?q?7xkuEEoN5ZZnNlqTchECpj5eCE1YRxhs/x0BqJS/FoT5F6eicVqqmLiV703Q3x9lB?= =?utf-8?q?NMX0uHlVJJsxExm0qtJcgHdQryR6AFj1Lr9O55wuNiZKD/gUqqdUZIS9SivGk+L47?= =?utf-8?q?+cSdreLVLJG8m/m6R5hq7g/nXOL/ZpbX0YplvH+nC9haEjMvFfA508/eDyU/42ks2?= =?utf-8?q?V2+FWJDi/+VKQBU5sXUEP9KrrZp5Co60bSkFCbnNTi7sVh8DdVyFtCmhTrsyct64d?= =?utf-8?q?NpXNMSQ5Ly+I2CTqwWKJjnpOiPDkgm66AmPjIhud/dpugdsZzAhB/DiKQrnm4wWdF?= =?utf-8?q?NSFen376kCe9AAz2zPr0Dl6/PurVNVyYc3aIFc4rVREAbi6xiMtSvC9IWDousINyL?= =?utf-8?q?CfPRxiz/Ja4lLtia4WruUBNe5KA8P17+95ENPXV0g2SZmU31GN9tB7l2++vh9f7KQ?= =?utf-8?q?Lo8ppFE35YxjlGiNX8CK5LSXettLsK4iZeDHa+lPPjAPwXbgqtemxGWKzGpAmdaRk?= =?utf-8?q?uVPEPhZE6U4KJRbw/lHsfFtz0l78QIWFwkNemspLAj3MUBboCJUFixWIzA5cpgypB?= =?utf-8?q?p3/fdRvs56wxds4Lm9FLk8DtqT9euB3sUledXNDL/yudTij4jepyEhPYUjF87nGsW?= =?utf-8?q?dSLSZgYDFE+9dK270VR2kSmgeEgXRkAe6XyfS7yxfUTF8bfCTvp7S9l2segnzChFK?= =?utf-8?q?Sy8lJAQK7Rj9DYAers42vFg83hBr+UkWqvtmq5PmYA9Ptgn/7cJwehw6nfRQbrPIZ?= =?utf-8?q?drVmpLnCSvqR1aseA/iLxJAcvnzGgHQBVGNs0TgsvYIu1moMV4B8NdqBObiczZTwm?= =?utf-8?q?ZWnS3px56ixlgSwNEJNzLDBkd3Rr5o20B1FGMnArvmtMeIvNukBCITYy9MElNgGD7?= =?utf-8?q?4bf88ZRoXL+Fd0PVIVJgPfsVCo64bEdfVr6STnMgMS5bPtLMogfvlzTg=3D?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 04343fea-8ec2-4890-1923-08dd73ab25e2 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:46.9835 (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: GbZ0wKN9H1wKZIyYTb+KfICYc2LFJc2LbAA/2HmqlNDMAuFAfGQ4RaDGccGBZYJPInsXD71d/boxrI1rNNAQGA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB6957 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250404_120152_203894_7396F3A2 X-CRM114-Status: GOOD ( 13.52 ) 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 Add the flag IRQ_DOMAIN_FLAG_MSI_IMMUTABLE and the API function irq_domain_is_msi_immutable() to check if the MSI controller retains an immutable address/data pair during irq_set_affinity(). Ensure compatibility with MSI users like PCIe Endpoint Doorbell, which require the address/data pair to remain unchanged after setup. Use this function to verify if the MSI controller is immutable. Signed-off-by: Frank Li --- change from v14 to v16 - none change from v13 to v14 - Roll back to v12 version because Marc Zyngier have concern about add DOMAIN_BUS_DEVICE_PCI_EP_MSI. https://lore.kernel.org/imx/861pxfq315.wl-maz@kernel.org/ Change from v11 to v12 - change to IRQ_DOMAIN_FLAG_MSI_IMMUTABLE to minimized the code change. --- include/linux/irqdomain.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/include/linux/irqdomain.h b/include/linux/irqdomain.h index 33ff41eef8f73..86222602744e9 100644 --- a/include/linux/irqdomain.h +++ b/include/linux/irqdomain.h @@ -231,6 +231,9 @@ enum { /* Irq domain must destroy generic chips when removed */ IRQ_DOMAIN_FLAG_DESTROY_GC = (1 << 10), + /* Address and data pair is mutable when irq_set_affinity() */ + IRQ_DOMAIN_FLAG_MSI_IMMUTABLE = (1 << 11), + /* * Flags starting from IRQ_DOMAIN_FLAG_NONCORE are reserved * for implementation specific purposes and ignored by the @@ -691,6 +694,10 @@ static inline bool irq_domain_is_msi_device(struct irq_domain *domain) return domain->flags & IRQ_DOMAIN_FLAG_MSI_DEVICE; } +static inline bool irq_domain_is_msi_immutable(struct irq_domain *domain) +{ + return domain->flags & IRQ_DOMAIN_FLAG_MSI_IMMUTABLE; +} #else /* CONFIG_IRQ_DOMAIN_HIERARCHY */ static inline int irq_domain_alloc_irqs(struct irq_domain *domain, unsigned int nr_irqs, int node, void *arg)