From patchwork Wed Dec 18 23:08:38 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 13914255 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 BBBC5E77188 for ; Wed, 18 Dec 2024 23:13:46 +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=kimtkzi0tQgW2H+hE5yDJkVcjZYWfJxLal/759/AiPY=; b=38enIj+XIImExaN7xQvwvSd9F2 FgXjQKd5IpRpk9cDwuhle1ULCyH4YqGKdlt/on+J62pQ07j5XF4sWwiy+wX2Sny4sHV6d4rsow18S KQfz17GvEH8NzOOSLOty1jdoqt9cihx64lc4SjwidL1/2/QWJg2GE4aGUmPksSS21ZcaoceNsuy8L jDdts1wE/yy+MjEE3/A7Pmg8UBCjR/GevNcBPEvOn1HWGFja2WUQUeXacwNnCxlBku7R44VjLo4cV gRbpDUjUYcsSm97Nmm8MLh3RZ9YUsYQupz1nIl1H6lqgcMa+phgI/HDYOMl0RLKzE6M7k1e3L/TEv XDSjTdJQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tO3EV-00000000Imr-2KuN; Wed, 18 Dec 2024 23:13:35 +0000 Received: from mail-db8eur05on20615.outbound.protection.outlook.com ([2a01:111:f403:2614::615] helo=EUR05-DB8-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tO3AN-00000000HuG-1ibx for linux-arm-kernel@lists.infradead.org; Wed, 18 Dec 2024 23:09:20 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=m02Bt6HKJucz5NSqWFUrMq+txOZxRCnMxbjB5VTz/rNguQcqVIhJiO714/RDpSfdnbXgnYnEIaJPbbYT7e9FxSkuqBxU2qrQsiM8GfFOl4obkPRT6KzzfIqqH/aznW8C3uecvv0gHuEw6pkB3khdgEVw435j3nEt5RHV6QdbLCdy/IQntViivit1hTiWkGNTCSMz0jMNCPOSss9rd9eZ8FdQ8TazKgTeQnBa0b0GQoijerAfC0hUS7CSmTmjfC1ox+5ZImoBIKmH9ska08iMrFMo5sAWq+lkIZ0lHAnR9ktQDWvNk5TDr4VToqxdutEor01Ih6yQGOp99C3+t731xg== 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=kimtkzi0tQgW2H+hE5yDJkVcjZYWfJxLal/759/AiPY=; b=hguFu45yDcR1mprgdW9yzTbQERw/Y+r3k5lzxMMGoW9ivCMHcVJaXbzLVWFPwKBppWqWyfI1K/VNEuGYHhqQk8/JEqZF9Cey8zanU9aQeAqSEw6EIOALyhmjayDdCaK8TmBCqGv64COL67BvNNNv/ix1VoA8qmVhaG8vsj/cfcU2nTQnAYfUcT0ngnse60WT36GyBwxC+OhONo6NKl9nWdBqebc6iwCPWDukY3PZ7J7+DYQTAHXouzcmtMc1N+MRr8Xmhtr67kVGbo1KVitWIbGWHggT5L380HJAP4nl4g+7pvSnuQAvGBozM0C3xyzDJIOnU+8WsHNVAD0y/Ntq2A== 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=kimtkzi0tQgW2H+hE5yDJkVcjZYWfJxLal/759/AiPY=; b=Qv4q/OUutkuW8cqI69xv+IAhgjc3Kq7qGUNvARpFlS3kiRwa1wmwmhyd++xIIJ8TEXjoHHKNDASbWoOmVZs93suNOYPKFyw6Pvya/bp/9AU1PVglx6D43EtKkWqVbt4NIIIn1UFwAWigMrxB6i9G5OzgVlxdghWGo6lQj1y0LV058fHuDx+4kOmH6JOrLQpemnkp2EsaJLUUhEgXPsaUtYmTdub16LNj8N1ZfAMHDRzW8BHf/vHGVJI9EOjWuX2/HUTuiGL+2JOv2Z9G5GmHXZLN6C5x50SmO7fFZ1eTxLP9Y2tBqUFB5fGGooI8j5kcmTRkrFASUT68SJzj/qo3hw== 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 DB9PR04MB9939.eurprd04.prod.outlook.com (2603:10a6:10:4c4::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8251.22; Wed, 18 Dec 2024 23:09:16 +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.8272.005; Wed, 18 Dec 2024 23:09:16 +0000 From: Frank Li Date: Wed, 18 Dec 2024 18:08:38 -0500 Subject: [PATCH v13 3/9] irqchip/gic-v3-its: Add helper function its_pmsi_prepare_devid() Message-Id: <20241218-ep-msi-v13-3-646e2192dc24@nxp.com> References: <20241218-ep-msi-v13-0-646e2192dc24@nxp.com> In-Reply-To: <20241218-ep-msi-v13-0-646e2192dc24@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=1734563338; l=2002; i=Frank.Li@nxp.com; s=20240130; h=from:subject:message-id; bh=mH/HfWSB72ELMEfQcYQ6cyfemrKZKDjtNGbdbaIdvQY=; b=eNl/J8BE9Qsa2PmKzqDaaOiXIGwP1SfQYeNr8M/BU/MKJno+0cBLI1ItCfZwl5sepybqrdD+4 1YTX89sSZheAgmKru98XpDEQ+sdJ/UIoZzjFPMJ2MaFMPVpGO9TtiQI X-Developer-Key: i=Frank.Li@nxp.com; a=ed25519; pk=I0L1sDUfPxpAkRvPKy7MdauTuSENRq+DnA+G4qcS94Q= X-ClientProxiedBy: SJ0PR13CA0075.namprd13.prod.outlook.com (2603:10b6:a03:2c4::20) To PAXPR04MB9642.eurprd04.prod.outlook.com (2603:10a6:102:240::14) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB9642:EE_|DB9PR04MB9939:EE_ X-MS-Office365-Filtering-Correlation-Id: d19b22af-ee4d-4ccd-b705-08dd1fb8feca X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|7416014|1800799024|366016|52116014|38350700014|921020; X-Microsoft-Antispam-Message-Info: =?utf-8?q?4dkQqfWE0Ffm+5sGz33YeB4QaoylKdi?= =?utf-8?q?GKKNTgrYaVK1yf3GUiXfAUvsG9X53QzU7Ry19q7YqmDSDGVLW0Nl4l8pTQ4aosLYI?= =?utf-8?q?ffUjz5PxX5FcIb/YPSp8Z1GljnlprMtQgDRf/f6VhqHa0sO7JFzmh1OAMDCUdixNN?= =?utf-8?q?Gb88t/NWCZJ9uFNORREffH8RlUVeHffhLni8SAKC6Hhk9azXCJVo7DFEmnDNsLLVM?= =?utf-8?q?NXUD0H387utznDAFKIv/ddHa4O4yTfJ+2jKUb9Ozv07uEczZqkN95mAUCha0ASvs2?= =?utf-8?q?cuw7UyUIRXzIV3ZIVY0yTxid0fUbvOIJXPEZnHsrH902jT1IV9MysZLX67gLXyei8?= =?utf-8?q?AVm5ilEE3JbngtaIvF2+E5Mrw2fbc3gXUJdEzaDy/cGnGCOKigPYZ2UdH4oIU7/z2?= =?utf-8?q?8vGsbgrZc1cF1I28k84SBezt+Wpp95pdjDlWDFEPa9onDlAwQFJdEJD7GSGmkNdkF?= =?utf-8?q?6hqGmPBx4VqDUk7cRMM7IuWhwDIoTVxRoLju14dkyntcFaoeikJ8a5XWcgIn+7P9k?= =?utf-8?q?CzdezizjwhfeduMDvYN+AW38xLbl8CfVx6arqAJACll3WC0s91aXHFM/sD6TsFXhL?= =?utf-8?q?amQy3HDK+Q+op9eW1d0HkE7khxx7wZXL7ykNCeaVZF781EySnqyAjIkQwdeFpXDGC?= =?utf-8?q?BUvTfWUDa8jpJMBgRd7sjayzORoQtJfmfbeqYMUcOySh8iXxCbax4KcCYdjTjRfon?= =?utf-8?q?tLq/FgDFtxYhU2rBCqknNY+51KmgM/Sm2IKnm5FEsmqggS9eciTUSBHM7qCWddIgO?= =?utf-8?q?uzvwKfa++EV+nSGYyFhP2TRhflf/EFtm52vfW/u3CVJwhtvJFiykgfs/1QfAIuWn1?= =?utf-8?q?CCdpVb4vIepUD+8AxogDFJRIYHbikcM6AI1CHcjf3oEhujlh0fpbazC/pGC+6z7Gr?= =?utf-8?q?FVKDFsdvLBCns813A+jnqE1VX/QOn3HYlnLVDfYKspgOMatl+Xesk4oZcNz9bt1ve?= =?utf-8?q?OdZBgk+y31Valuqa6qc6b7lsjcPgwS6oocX67eq7wxYKfuboP+n/hCATKSWdCEEir?= =?utf-8?q?bLh37SU4i4ZP/VoD+N0kdvsOH9O2wn85KiN1JIQz+hp7nupBAmLA6qphdjI02lSc2?= =?utf-8?q?fLdeiwMcPSlpTCFj8Aja5UX5C+vNYV67VqZF91rweXDIxBML2DWMHKxgj6T/n20H1?= =?utf-8?q?pDCpiuipwVlOfs2ATDSNewEW9dtZsk6f0ZjxlIMeAnqpflytOD+9mLmbFQ5/Q9WF5?= =?utf-8?q?s+37pgrQRsDytd2Zt2RrgUCczyorEUwXfTKqaqtPx98S9WVINLVu03URQ/gZqj7ft?= =?utf-8?q?TdwxCTc1HcDJNjYPU7oKzc2AAMgqNmQADaZfABudOHVP44cSWWmpccFbOPcaJTNCj?= =?utf-8?q?5GWodBvgAI0R+xaIEx+6PIV81OiHZFhOLYgy5Ou5bsjqi7KqyZE4V8/yni6rE0mB1?= =?utf-8?q?rOVNVoLvS6gVHfP1/3J4TXtwZEx1bpbag=3D=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)(376014)(7416014)(1800799024)(366016)(52116014)(38350700014)(921020);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?WiYNKGMRLI72Lzs6s7eVcW1tHdQW?= =?utf-8?q?yGEgMTitQ5z/EpOLh0+DIHCcaFNpw2LxS3zZoNF4OmG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utf-8?q?ScsLcUTWfENUqzqyMQjfZOmS0Plegtoqnlt3GoWf1BNGEMTIUn7Ycwqed1n5S1Oa7?= =?utf-8?q?xRgv1fR3+zT6sCyAHd5OJpk6kEfNamKn58AsAGi3MnXlpPchDFgKsUv6YQtgvusVi?= =?utf-8?q?VaGLMQ0b9S88EJyo2AD1QEl9bZKe7p4frV9Uq8x4FPewE0g6r7fpPpEtzWHnOrC0W?= =?utf-8?q?wfwu5kf5jYj2VlNWT88WoAD+bdOmWkdWpA/o9OIuQFBAHP3vPM75ML+bSiQZVMCdt?= =?utf-8?q?tdH1mUBjJ6rE90h5g8DQYQJzEDUXEYU/vXPa0YmIBu49q9odnfgFUi214xbOelpUd?= =?utf-8?q?+JGl/35ZZdH/QbffS6nrw62Icut1QYAClOb6tCm7hRcBVo2pvZ6fbtIFIN+on1Uwu?= =?utf-8?q?jTGetFELvNQk7uzI1R9j3L3GR0u1q5J1kO+BU5kkL1zyoAlFJ0hdTy6q3avDjT50k?= =?utf-8?q?NQ8KMpugCA+7jLv3WkGD4N4dcrv+1uAmG/lCB/JBNfVU4elp/txQFU4Mrxq3Buz89?= =?utf-8?q?YAcXaGO5TTdi+6HamtqpZ8nTfXE8Zkk2fwm8mGaNu+UCOPC0NhrQEACr/K0EDotlB?= =?utf-8?q?/iPyr7o+f3H/?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: d19b22af-ee4d-4ccd-b705-08dd1fb8feca X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9642.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Dec 2024 23:09:16.6526 (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: D2jJZPCe/OO7WB+dhZTT8jrvnkQozxZ5YV+J8/MYC9xX/HesApvUaL5wEmEvINhTY5b57oMgOLIV3ERnuVbMIA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB9PR04MB9939 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241218_150919_452245_15046EE4 X-CRM114-Status: GOOD ( 13.10 ) 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 helper function its_pmsi_prepare_devid() to pave road to support new DOMAIN_BUS_DEVICE_PCI_EP_MSI. No function change. Signed-off-by: Frank Li --- change from v12 to v13 - new patch --- drivers/irqchip/irq-gic-v3-its-msi-parent.c | 30 ++++++++++++++++++----------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/drivers/irqchip/irq-gic-v3-its-msi-parent.c b/drivers/irqchip/irq-gic-v3-its-msi-parent.c index 75aa0d4bd1346..b2a4b67545b82 100644 --- a/drivers/irqchip/irq-gic-v3-its-msi-parent.c +++ b/drivers/irqchip/irq-gic-v3-its-msi-parent.c @@ -132,19 +132,10 @@ int __weak iort_pmsi_get_dev_id(struct device *dev, u32 *dev_id) return -1; } -static int its_pmsi_prepare(struct irq_domain *domain, struct device *dev, - int nvec, msi_alloc_info_t *info) +static int its_pmsi_prepare_devid(struct irq_domain *domain, struct device *dev, + int nvec, msi_alloc_info_t *info, u32 dev_id) { struct msi_domain_info *msi_info; - u32 dev_id; - int ret; - - if (dev->of_node) - ret = of_pmsi_get_dev_id(domain->parent, dev, &dev_id); - else - ret = iort_pmsi_get_dev_id(dev, &dev_id); - if (ret) - return ret; /* ITS specific DeviceID, as the core ITS ignores dev. */ info->scratchpad[0].ul = dev_id; @@ -165,6 +156,23 @@ static int its_pmsi_prepare(struct irq_domain *domain, struct device *dev, dev, nvec, info); } +static int its_pmsi_prepare(struct irq_domain *domain, struct device *dev, + int nvec, msi_alloc_info_t *info) +{ + u32 dev_id; + int ret; + + if (dev->of_node) + ret = of_pmsi_get_dev_id(domain->parent, dev, &dev_id); + else + ret = iort_pmsi_get_dev_id(dev, &dev_id); + + if (ret) + return ret; + + return its_pmsi_prepare_devid(domain, dev, nvec, info, dev_id); +} + static bool its_init_dev_msi_info(struct device *dev, struct irq_domain *domain, struct irq_domain *real_parent, struct msi_domain_info *info) {