From patchwork Wed Dec 11 20:57:31 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 13904205 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 27D7EE7717D for ; Wed, 11 Dec 2024 21:06:17 +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=8rHiESil2o4GbVOYFQ7zKfqjJLUUmLHnPeQkTukgKiA=; b=MZgi0hN5pWNbu1lvltMbnKfJ6v XV5+ownn3yc3LRnbt5DdwvNGPOaXPjqrponYxKdKxTHQjtQno+KU2/fDhvjYcZZ8XKT340YwswboK aGfx4mxFSYGFn6haPflz5EB1HTFXVI3VYC1J7e3T1tVAZ/Kh07d/HunIjUlviQ0mli1ljhNttTp/a icvplNJyrIn97r3ERt0kVr1pgMDs0QRZMnwwmsiCI0EechkB4FMW38UWm6lFReNKoJ2Gc+yX7kClq BOfVHV3kt/nuG1/uQDr7aXIr5FuSqLOLm9r6hnGj3y0R/UzNMj+qs4mMEWpEOuS2Gph8Gv2y1v2SP NvD609Ig==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tLTuI-0000000G7i0-2O46; Wed, 11 Dec 2024 21:06:06 +0000 Received: from mail-vi1eur03on2062e.outbound.protection.outlook.com ([2a01:111:f403:260c::62e] helo=EUR03-VI1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tLTmX-0000000G5bt-05cR for linux-arm-kernel@lists.infradead.org; Wed, 11 Dec 2024 20:58:06 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=CgebTg1x7Qh3Ks2Pn/T45WngaC0EoinTlC0ZeVcYR6RZhOZHazoSVdsKemKEXvNfAUVA8ZlR2h8nE/qufWsI5oFowG/XeF8Fki2C9x9UuMT9zfgNbsVtcz1zk4+tPECP9lvqTb4ZcOjVBs3SEVHb6g3nqOXmMvNgBHdR25VJL1jqVKcnN1oMMoE4KovAO7D8Kok/172whRF/Ywq98yfJHluDXs0GOk9jrOHfDZLYtWMm1V1v6c/HyNSMh4RO7LTQdOFHbJQa3z6rPgroRaZtXpouyhu3ha2eW0+Vxv5bcaSuKx5SDiUpAbvP+ZoEMg0LGGqkOgH4XPEHyImC+vn3Sw== 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=8rHiESil2o4GbVOYFQ7zKfqjJLUUmLHnPeQkTukgKiA=; b=mPi97jM5rQPQNlkZD9evyAcuGOBxBN4SAv3v6khQbiTQQdJNPCT4tyM0JSdhP6YzKKI+dMaiiMA1KE8s/rFB5nTWPvfD3bztSZeYMcFr/wTkIK5PsgFzXSMXAiGwHVsoDJoeid+EazzazazrY/M6+KDEj0RQVZGyqy7YNSu3AWURDq8tM/pHA2QJrIHJWiK3G3PP+JdWl/zups3wBihSPOhHzWZf3qCX3So1sWWZKZ4hIXbu1RUsn2IF3ngI+STNOXzn3/fwHJnzOROURjIVSkcx8zVRh9IDRDbwq7YE4w+N5n6Er5/H6YSikkGq/HvCSgKl3R8pU1x1Vul4AdcNxQ== 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=8rHiESil2o4GbVOYFQ7zKfqjJLUUmLHnPeQkTukgKiA=; b=k4UczbtzKHIZL4xBCfilESkWLAkrGJS/dceN1TH0ZbbgpHrj4V/UqYFtmXA3p0ApYzskETtYJhZ5KRq0Uj52ecI3svFXC/j9/i9/47ZfpGS/dllcfdmrpRl6fj2/2WCSKiRREc8c3B4112BjDZksHnN12NT0vjzBa16x9B2F9HG2KDxM0eKLr0WXB1vmASYraGb3PnCpXfTkTLr7CylKVh6DzMCbKmPgVh4kVBrzWlYiM29C/jyPbbFOFTfiKPp37F3VczFMd5HVwgvBVQxAqwB52+dx7LqgmPEavCX8LS2KOqT9P5whCenG3EixanKJUuD5QNYSgVT/cwzpMxXTZw== 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:58:00 +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:58:00 +0000 From: Frank Li Date: Wed, 11 Dec 2024 15:57:31 -0500 Subject: [PATCH v12 3/9] irqdomain: Add IRQ_DOMAIN_FLAG_MSI_IMMUTABLE and irq_domain_is_msi_immutable() Message-Id: <20241211-ep-msi-v12-3-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=1853; i=Frank.Li@nxp.com; s=20240130; h=from:subject:message-id; bh=9MukYG83d9aOMQcFVfHOi1d9Wyi9uvJG5YjZivBzTwY=; b=Fb3dWhQjs0wMRJeR9Rgmc45PlhjuOYIJ98UBQhBCRcCQwpCXcrxFdvXuy5IhZ7UCjV+3pggm4 1hN/K69HGbzDZAhCIqalLf9rskSXVUh53UX25n8DdMf5TublZOJTE38 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) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB9642:EE_|AM0PR04MB7139:EE_ X-MS-Office365-Filtering-Correlation-Id: b5c96464-778e-4563-e086-08dd1a267f84 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?Say5jcyGMDebQ7vl4J9sAVWQ6XmXZK4?= =?utf-8?q?c4hzklJYc51lWra8OFEBoMHwfWhBpoOEq14vzYPtWrWrEtVMMmc7MfVLhoemNdxET?= =?utf-8?q?SQzoQunLECL9xtC8UTOuCBzLEXz3BytrGb60ielpMYGspcK8FP9kRkdkf6DuxfviR?= =?utf-8?q?efljlLtby5TguiiLu4ZhH8gCze9e8tsouj2xJiaOoEtPqbOre32fEoj3zuS7lkeqM?= =?utf-8?q?J7aZvZ1c/FbGlxVHxN/guqex8jXw6eFvwrsUC6xTPbvEXZvTwx1VJK+esXibLZtqg?= =?utf-8?q?fN/zMIownmuXJwICRUbMRClriuhi1IaSqdbl3gGkcSoGAbLmr1hPlHeG/lMyX+c+D?= =?utf-8?q?+kmFc3a2Dd1VleS6MHDsA3SgGwy5ymG3qnojHDBIq3OiKPd31Dm/8HwvBeHjcnM6b?= =?utf-8?q?WZTMme1wdwsO6eDVJNl9Z06NI0ijBpNaCp6ZrsvehZ+71/JtcS6Zmf+5Z3sDdNbW+?= =?utf-8?q?HP5G5zitWn00JF+6bC2AwNi6SUrOPZdEKBEdbZzVqcJV2A1T1Bu5RQ5w19m9x6gbP?= =?utf-8?q?CLQF91zurYIe4Y6b8U1HsZweU0YcWOFXZ/DYtOabeI43dsPa4SD9iqoS2k2n2gNol?= =?utf-8?q?0a2e1HSq9TFNIH78qpA7O00HH9Aq8xSs0SrFAbPRqLtUMdmJkUm2d70NhSQEJ6lhN?= =?utf-8?q?G74z1M1QpcxvRBpz0hChCKDss12V7fO5K9M6Rp/+qyUIIy67uu6ZsOVQE4YViK9JG?= =?utf-8?q?mYnW53FstGfkiaMS3NzZRE23CxlaGzRqC5wUF86Ehb7S4bm4IO9QJqRlUR+BRlh5q?= =?utf-8?q?Qfk80CJ8O5JZfmvp18p7YHjqurMBKfn0dN7AmiuWwQs7ySuuuBX8Oc9vsRTI7hpt6?= =?utf-8?q?qAnnes+ZckgxPN685oB+39CDamlG+ZPCzLM5nn+cuC29dxL0tPRfT7f4042HQTJ+c?= =?utf-8?q?1ckJhKbS/1yBxLfZLIXBh8JaC85+EC5t3pDJpcqPxGixAHa8Ffn32WmwOpRogCdJn?= =?utf-8?q?DhQuSMT6cdiDECvCNG1zdOHPsy5YczW4Ms/zAD38mCw+Wjtljk1N1ba4EodxxgRlz?= =?utf-8?q?17wp3oKx2bO50IFUcYzB8MqG8SKH0S++aQRWQH0zNh8gSR3IgFaOmu0+KFa5jRScK?= =?utf-8?q?8JwBwym6j6A39F0XeTjToy3EVNzubQaqeRzxM/IKbv+e6OKaM4JLJuk4B158clvME?= =?utf-8?q?uPUoCCIObc2Z1HjPTRo4tJcOY9hfWmvolDPUZDxIakwVo0d4Jc1YA16LQADln0jI2?= =?utf-8?q?6fz6Nag4xqF5nGXWaaHYZrrDnZBeBAuNkjeTt299BFdJbYUp+NeRuLQaxLlpe2jKA?= =?utf-8?q?w+nNoWDmdmgMZc/XAGX8SdyGzZzaV3z/IDXXyrvzgV+Nu/+SjPFa8EuXKj0+O40jn?= =?utf-8?q?U3apfarszuVFzC/+PFRULG8zrXaCaZfSj6r8ly3Aw3rB2lyVut+w5jI=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?zYG0exypmTWg7/Mv0ynePr8Szb7v?= =?utf-8?q?3l0yMex+a1JLy/Lpyb5W3is7MmeMbedfKVkO0JlakfyEVHGdOAn+tXnT7hDNS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?q?bMNBjSi2RgiKaxcHMgN4yoBBk0fOSp3nVrmpPqn51W+YxmeQPT31awb3YgHPNufDT?= =?utf-8?q?bxq+mVe42FfrCgvrqhvN4Z0SP4jqfWXSp4e5TN4GqRBf0YGxsuFzJz/XYNp8/rWKj?= =?utf-8?q?mIcyh+mbfwnt9bVHBr9NqD979myHxsZLp5dnwoDObKDi1vqIeqb8AIVJpf7Y8VFGX?= =?utf-8?q?wuuHdAPD+ls5AVOHPOxKZxS6KZWFWlvOV1vffdt5+OiWnAOAUexmEVtKRXeb8HmBR?= =?utf-8?q?Rt1754FudDYbFXhH+07hJXSdoxv1dcJ75k0EupUHJen/t/oXuJTMPJdp5WsPLLIvc?= =?utf-8?q?t6VXsWWZj/3u70EWS2byTZc0uiKe16GzK8CrXanJfsK8dqlVo4LPEqKr7z5zKLNXB?= =?utf-8?q?hyLRVSDfPwQGT25MQTOkOhBb95gWC4cMv0dIIo+n83goKqNhGVtn0hoGSAe4liYCj?= =?utf-8?q?WP7HT4oFKou1wDwK7S1ITYOj8SACIR2ugDaSt64cjRuzSP5t5Wzkl7pzCVtvGogi8?= =?utf-8?q?NmS69FELHv6bq4r645cymmYrhmUNRRHL1fBFNbxVgrZ6kA/Ov793aUQx8Q4A5vBVR?= =?utf-8?q?5OIzYa8dCFAl?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: b5c96464-778e-4563-e086-08dd1a267f84 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:58:00.8211 (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: 1lOlnrQ6Rew14b5qaCep7jMOVKiOcCji09xhkIV2XiM6h7iMlb564UYTqyHFerdhtPvD4BsoiwLaUJ/jhP6H8A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR04MB7139 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241211_125805_069380_B24988F3 X-CRM114-Status: GOOD ( 14.57 ) 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 v11 to v12 - change to IRQ_DOMAIN_FLAG_MSI_IMMUTABLE to minimized the code change. Thomas Gleixner: I move IRQ_DOMAIN_FLAG_MSI_IMMUTABLE to irqdomain.h to simplify helper function's implement. But I am not sure if it is reasonable. If you have any concern, let me know. --- include/linux/irqdomain.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/include/linux/irqdomain.h b/include/linux/irqdomain.h index e432b6a12a32f..e63652604b621 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 @@ -692,6 +695,11 @@ 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)