From patchwork Fri Apr 4 19:01:09 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 14038795 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 065B3C36010 for ; Fri, 4 Apr 2025 19:18:36 +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=1IZAfUVaAOa7chBgO8REmAJsb14Zp8lXTUd7dS+omz0=; b=BnqFxI2blfSKTq/vi1c1RBYvS/ 4MyZgqwBYeXLmdz7m3nXkliQlr3es8Eg195mst4aFmsmU/CYRPDS+PgVZQRRRDgRxmp78AChmwp1E dVWOPcH7a/ot98bSfXp+d8r7OKRnP9MUTk7EPDCfPpTz2pH5eo1qWJEcTdVeFFL04zZoReVd8zUgX rgElu8lXFpKJo5Ada/zrOw4+TWz9wrSd77XIcqTSpDMYMgrPmgiQotSp4RTnyNWLDLHovVTUl4Wpx H4e3aBqCEVgm8GyZRUsq7dXo58hH6EfhMrw84s7FwfCtQR69f8GFJq5RGJruLhLjRsUZmV3INnqQb Ltw+WQEA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98.1 #2 (Red Hat Linux)) id 1u0mYd-0000000CcD7-3RJ8; Fri, 04 Apr 2025 19:18:27 +0000 Received: from mail-am6eur05on2061c.outbound.protection.outlook.com ([2a01:111:f403:2612::61c] helo=EUR05-AM6-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.98.1 #2 (Red Hat Linux)) id 1u0mJ9-0000000Ca4N-00FV for linux-arm-kernel@lists.infradead.org; Fri, 04 Apr 2025 19:02:28 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=QD81Vc6vngu33xjhk9+i5u2QC4o9WBydXamZecb8J51KCwnSsCiuceOMX1W4F70xfgscSl6MTxrPDvyAIWRWx6IrHyKW0VLzs3TQrK7Lu8OZM3rZw6ttQxljuc5rGi3zIV62F3oDrJyn82tZCmZtUILXWDrFrjeQ4Ef4e82HM5m2MFhM/DOE/oAGBJi7KpIfp95pk81IXXu58yE/+1KxeHDrtWk0nzYChmCvnypqOq670M4Cy/Vv13EX1CpurGDGiTxm0gZI0oAcq4p7+CjBTPqjub7p16SQRwdjFRd2rI1YszQTMiRDGptf8muo4ov0ARCJjBiyVrDUozCT6303TA== 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=1IZAfUVaAOa7chBgO8REmAJsb14Zp8lXTUd7dS+omz0=; b=YDNrprgKn6PiTIeCvf6BfNB/H9OKFHT2UZuGmbrbUrgPlaUOy8sNGpVisYts78OvJ8L4H3nJq0k/R7V5t6RvNpmWNMSfOdYIMYL/VcQYpimYm+MRA+G8DD3VcUkMg4tw5YPcJRGTedpU6dItj1iWS6nO+Be4VmGCpIFE3ABlJf38F9NJmlP00Qn00i9SgJmwYpl8cLG323Rw26kpsdYSoyaBZhuG33tZ62zG8ouG3UITJzIFjpOC5Dlpd2fwrF6aiOEcWLqRuHiKHlZhHzSkBD1q2jPkure+dmOKibnmZdu43VeX9/3O9s+PPQdOYF/4wBdple5tpVQjbDp2GYNmjQ== 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=1IZAfUVaAOa7chBgO8REmAJsb14Zp8lXTUd7dS+omz0=; b=aKtepLbTZFHKqgR5Eb9nrXKXwTGsCw6NFRmfyH2/grD8mixgfCN4k9Jvva3M6NYoMyrWprqcw5/tIyvXnyaUajOjCT3D0wxLujLx6Gx1CEfpFb2hMrnJPdUVIQu+6jre2Uj0pUT7QXBW7wZqe+eflyupC1BJL1FhfsF/Gh7mEc+cpy1JGQBG+BbuC7w9d90S/Hd9FJaT0EZilb/ir1OXTjJ1XGeQHoLxG6+izTcCkkrWfQCCD+QUk4jTNePWiVrKxuI2aGeCwYLjByIivbpq6tQzKicm2EoAHMSctucvB/Mklo+5N3+bKEytHY99YGxV/HAoTXjED0ZzwUz92WhhhA== 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:02:24 +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:02:24 +0000 From: Frank Li Date: Fri, 04 Apr 2025 15:01:09 -0400 Subject: [PATCH v16 08/15] PCI: endpoint: pci-ep-msi: Add MSI address/data pair mutable check Message-Id: <20250404-ep-msi-v16-8-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=1143; i=Frank.Li@nxp.com; s=20240130; h=from:subject:message-id; bh=N/Rcdz4WASrCVzB40i3dK6NDhujmvhnmUfU9wknM7Kw=; b=l7PF6H3Th9cGiq46HdUyeFG6OzFlTPz3QQTzNdCgKmZ7lLApCVYxKmrQyEDodWNDeI2ojOMQF UVIjZJ8SiSrC1It+ZwS+wRK/6+jcwVVp+Trzx/ajyIP2P4ROo8QFWKX 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: 1b3fe2f6-3a69-4c1b-6912-08dd73ab3c29 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?H48uMZd9CcETXk7XVu1wX91C1TqJVz5?= =?utf-8?q?eeKaghWSKqeIicpyFALVrj8A/JjiyVgiRNOhMZ3QnALExu+OG9j3bphXVnn1Actv3?= =?utf-8?q?X9uSZWS5bRfUV4oGg8hhvH29I7kmVkzYpTSDKfblK43Wa8FluYj87vtrsedxYLajI?= =?utf-8?q?TDJWuRfmaQtukI9C0kcflX4Z3zGpxTqhOWRYAjLdrISSh9WKfltIOLMR8BbavzfbC?= =?utf-8?q?5HqiisktTnXUZ8n4j8II3JAnsoCD9pPBBcu7E7uLWjbgTcZuUn0gM0qOxqwPIDQAe?= =?utf-8?q?Jo5DhWkWZwAawKUSh1WCs7WISJa5AoYjIf0eztL8rc35tZ0+6P5yVCAMuJ8hPgfBb?= =?utf-8?q?v9LlfEYgFMsFPA0lXLnYfTtFxusXBDPavtaqA/yv54tKcsi2/54i1A3t8q71GD3VY?= =?utf-8?q?GVL0qfYQ9Eq8Vfzp9g+yl2L7ZGg+sFputI5QMhTQnyphkpqwGwSpRY603Yy+W6eEy?= =?utf-8?q?FZEZ4OfkMtpJ7mwQvapmll/+Medl9iCqp4Zm7tNKrMXHo0aW8nUmOmzujZRxrFaP+?= =?utf-8?q?JEC3StjgUkpOZbxex+kyyCNUb3SCr6fnQGIewCmxz+CtYAYLxjhovfLvMQ+h7Y71q?= =?utf-8?q?7zVpmOAVlexPWcIHVgHou4GCn+W5NURtUQpfuottf9uQrfq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: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?LftrnBNDQN3PWBr7kJwUAt/JigTG?= =?utf-8?q?iKA4SQcK1VUzbmolMVMn9+d4s/g372VgmqLGmwc2pgvYBLAr5n4HYMiM6Nvs2tnCU?= =?utf-8?q?HkVxG4ndwKgXK/7sXsPx36w8Rd++NreWpz9fvV1FouJ+eU/Jp52rNnuNEvxl13Xzf?= =?utf-8?q?H+yOjBFC6bAl2Xd0mLamoNUHADavpa5sgXNeuxwIIN29yKvTRxHvopGIiWWZXWW68?= =?utf-8?q?DAm3AO5cmJXdM/MMFRyB1hVGYJmLkWAMKOWuHHHhaGgDkqN4JUNGyfV+Xb+nLF+4F?= =?utf-8?q?zr5AF+7QNhzxW7tNnMo/U8INBVv/skLGLAFiypU9Hxyx5HoES2K6Ucg0e4idI5XTG?= =?utf-8?q?bzogWf5+aUXj+ntG6GbG4ecv0bCq1L6WmJ1AAFZXEMI6+raeyHeYRmGLeB9jhXyZW?= =?utf-8?q?u+W40YDBwT2J3A+zbORsMSaZWkthdWP8hSpsEkT59WM98V1HT8pTGVUxXjK4GgADz?= =?utf-8?q?qqi9/7k5XbiCLuaof4W94kZr/2mX7PrRG53Sh83lw0pIvXJRdeqSrfxWe0JgUFsJo?= =?utf-8?q?AYrrMg/HaaZHP39ddX0Z7PLl4ptG7fifELogH+ROmnWh1ajXJBM0fpMuRUylajpg+?= =?utf-8?q?SG/xuNKhD8bWwj0IXJDlfiP99ZCiypugHCgpK3+7s9MbbPO3bbgv3NxiA2hAgubHi?= =?utf-8?q?uVxnEnvz+gm89dyQzsszjAh7XuhgEdoODAMMIlpvoUy9qBJwLomU8D+JlUoyom3UD?= =?utf-8?q?EKoJ9toAsY8E+eeBd1Ff5dFjcgorTVpzJ8ol/kAK+vpvgyRqGPxJPoADzOig+cd5/?= =?utf-8?q?/hz6o3M9UdchKThMwrFE1I1bsmeHAR7G5TNAfU4U2sKaaIe0YqwMMlD5LtVnK5fLY?= =?utf-8?q?B1kr3vXkIpT+bQqbJorRXo+rkx/4hw2FcnNawlCeYyhHdnuQVaGs00fQNkD7IHo8O?= =?utf-8?q?4QYCXaViZSr1ypGZvcSpNPyMaTYjDLAxSk5mrAdUKEiriSTrh+H+ykAy0XTerLPmF?= =?utf-8?q?Fw0qo8kCdyqK5P0EyKlRTIw9sVfBJYnig8CY48pDw8D7wotoD3n/xwVyupzXs5Pt3?= =?utf-8?q?m5V9MPMx3cN20rHYGMxpQtO2aEyAVDCXxwwD0FhJxRJCO8NRUvvMxBnnTd8dybOag?= =?utf-8?q?lKOG/WldK7ptHHw4ixuWgWCnjItMg0VNcxTfDSp8frSMzyZ3laZzAZB7zRPoFZGi4?= =?utf-8?q?yyAJtGrT4s4qKaH3UejIs6OwWFfqTMswmHqBZlmfK0zjZXFw1AdZDa+sbg5Ruw/M4?= =?utf-8?q?vsOHIqTvV4iYrlQs1sKY822pLGRoONGt4pozKupHSGnO8XY0rzMsW0qPIpSgAb5L2?= =?utf-8?q?j02tkfYxDUSc7Kv7x3ooDbPWXeOYtSkWSgWfhhSG1fo5K5347CgwtqE/toTJ4Oe48?= =?utf-8?q?94miAkpr6qlwHM4VB+3SQJabDzeI/J9ezQKh0xZYBIBvZFMuZ46jRnkSKiElhfGnv?= =?utf-8?q?XSTyN5ckRArGM5wq6DnZajnAmw9GowRGfcdr9zWObBHRF4siGvc3wFkM/Vi2k/QsN?= =?utf-8?q?4PnpJfXtySDIED4+MMlk4HpeZUP23TxbCC/9Py63PISX/T3AVFFS+DvA=3D?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1b3fe2f6-3a69-4c1b-6912-08dd73ab3c29 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:02:24.3558 (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: Zmdsmnf/o4Kx3RWpJQD7urwuVQiX2AaiQPeps+IcOFb6iMWQDZqL32/NHBOdlB0I6YjUKdrA1KAbsbEcWNwbKw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB6957 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250404_120227_052700_F1C7C3E9 X-CRM114-Status: GOOD ( 11.49 ) 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 Some MSI controller change address/data pair when irq_set_affinity(). Current PCI endpoint can't support this type MSI controller. So add flag MSI_FLAG_MUTABLE in include/linux/msi.h and check it when allocate doorbell. Signed-off-by: Frank Li --- change from v14 to v16 - none change from v13 to v14 - bring v10 back Change from v9 to v10 - new patch --- drivers/pci/endpoint/pci-ep-msi.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/pci/endpoint/pci-ep-msi.c b/drivers/pci/endpoint/pci-ep-msi.c index 549b55b864d0e..c0e2d806ee658 100644 --- a/drivers/pci/endpoint/pci-ep-msi.c +++ b/drivers/pci/endpoint/pci-ep-msi.c @@ -44,6 +44,14 @@ int pci_epf_alloc_doorbell(struct pci_epf *epf, u16 num_db) dev_set_msi_domain(dev, dom); + if (!irq_domain_is_msi_parent(dom)) + return -EINVAL; + + if (!irq_domain_is_msi_immutable(dom)) { + dev_err(dev, "Can't support mutable address/data pair MSI controller\n"); + return -EINVAL; + } + msg = kcalloc(num_db, sizeof(struct pci_epf_doorbell_msg), GFP_KERNEL); if (!msg) return -ENOMEM;