From patchwork Tue Oct 15 19:17:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 13837021 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 9E475D1F9C2 for ; Tue, 15 Oct 2024 19:34:35 +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=OPYi6nf5hF87bcZhksCeSoE7DI1/Kxlduip+Pl9A+ME=; b=oMDQhN5eTYU1rO/64KN/aoS4PF GZwvQ/OLRJWzfXbZ2rOerkVYeA0iIh/F/PW8PsrLczrccOe5o2hAZ/Bf5e8MsYTrXBQwQW3ln6Na1 L6uY39zo6vqnNoUEIelLZaF0k+6e2BrJBwIeVH8FQDrlQIAy6PCuq/Ka5+5+XAS+DpFHkUqPTg+Mp whdD8B7ygR97gsd102n2kzCycJ46P+Q/+3TuKsXUCiBqWOxyKoeCt8w42jiJ/kLGyW7S8o/VhG8KJ JaerWZ/+7dh2VY9+RdqNf/qOyQnfrZw3guyX9p8Bj1bHuckvBacqGBTU2wTSrD8TNXmX57gHQql/V VgP9JCKQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1t0nJH-00000009PGz-2wwK; Tue, 15 Oct 2024 19:34:23 +0000 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1t0n3O-00000009Me0-0UsJ for linux-arm-kernel@bombadil.infradead.org; Tue, 15 Oct 2024 19:17:58 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=MIME-Version:Cc:To:In-Reply-To: References:Message-Id:Content-Transfer-Encoding:Content-Type:Subject:Date: From:Sender:Reply-To:Content-ID:Content-Description; bh=OPYi6nf5hF87bcZhksCeSoE7DI1/Kxlduip+Pl9A+ME=; b=emeiA7eQg1y1jpXt9RL+gHU9xr ADdu72oJ9X110yfd0d/gaisQfsHytCs1bg1DVLd00xdmrRHNUu1+n1/aIayyYJVC23atm40gJZzLL lmnzpm5EQnxC0mcnro2ZKykLOXbwqr/fWljjJBEWo108E95IpyhejPac3i7NVilfjvBZADtns7P3i HhaEww6p/7qym9kdk40e/JYVKZZORh9ZYcT7odMUGZpNBL+pnBFdyh96VaJDi4G6vY0+0Nlyvt0hC x8hP+kt6XHhFdZBAuOAVCgYwwfn07C3Op8Lvusj7gOEcLjgvmRdnLy3EfB7NYNpa5YUNfjhV/1+cL Hy45ik9Q==; Received: from mail-dbaeur03on2060b.outbound.protection.outlook.com ([2a01:111:f403:260d::60b] helo=EUR03-DBA-obe.outbound.protection.outlook.com) by desiato.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1t0n3J-00000006dkw-2X6R for linux-arm-kernel@lists.infradead.org; Tue, 15 Oct 2024 19:17:56 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=hFNUhd8schFXsNX9Aok39fvhPNg2K1Xndn34PFp+aP9zKYjgoC/m67qBVZjhhHjNh97Es36YOiOb1qkyorMdnqF1fP6nlI9ID1fT9iAt8eVJFnDDSe2QNvqewsmp3AqGdWo3jeuf8Buge1wnKEnzekyUGH7o7J5XYP8po2M/mHWzVcaPEXygW+dIX+JWiJkYXfCGe7inaPywM5vJapfLnqkd4xdKNRGfFKN2mgmOicgM57azTk4Zuv983SqiUh13CgenvwisXRTOhM2vohTIhQphK4MiYbpLNalWiNmjc2cjDlNdmzV07BNeogWzZ5k/hpPnRZSHuJMys3S84y1G3A== 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=OPYi6nf5hF87bcZhksCeSoE7DI1/Kxlduip+Pl9A+ME=; b=VX23sYR/7NHPDDTppcgEOGc3aybw8mTTpDvwwgBQV1p/HNU+u7GH1sIoYAGpnLlear/ahLiHvJNiyWoKp4L1yGXEV7+Q0X7/hp3ci0sZqHd4afUlC8vzJ6iLhUidB+Jtdu5jQ0Bmp6jfvlueWVaP9HtJLN+nby8kUY2B40oF1jV3dnCZ1i/nb8lEpwo9hUi+EXbqcjyKLL75kSe5wGq+k0XoIplC35G7HyeiLk0mWKasSghpklZcnCJCgul/ZdierAZCQtdMu7L6JQi4G8chK/Y01zkuLGKsggDK93xWINz0QIc5w4V3J40RyUS0pXcNCnmTFg4NS8mujwbYIfkC6A== 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=OPYi6nf5hF87bcZhksCeSoE7DI1/Kxlduip+Pl9A+ME=; b=jolDNz6h3bWC+zrFaswi3C5hIy9dA/w52JXm7z1pzw17upGaNEvkNsbZ8/toKh4SRnIBCP/eqmsv/L6IzDuB4/P0P5XE3l50v3i8QiGzHzogaRv7BvaoGVCyyge6PsFma+kugGITWn2mZyCZg3lq5JCS88MaS3Ikyacu5VgNnBlrNMoREoj0SVUfifPimgP4hEY98NhPAH+C0cByq23meq87TqNEMetSyD/oJCsLit1zEjHszPB9ZYU3zdzWFK4Xz43BLyXhoe/ajelVhvP8vWmEXI/Cpwv+JnK4bN9Pt20Bh2hD24mPoorjiiO5WhfCcVXaAwtsDgopK9TAeGfIyg== 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 VI2PR04MB11002.eurprd04.prod.outlook.com (2603:10a6:800:280::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8048.26; Tue, 15 Oct 2024 19:17:44 +0000 Received: from PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::9126:a61e:341d:4b06]) by PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::9126:a61e:341d:4b06%4]) with mapi id 15.20.8069.016; Tue, 15 Oct 2024 19:17:44 +0000 From: Frank Li Date: Tue, 15 Oct 2024 15:17:17 -0400 Subject: [PATCH v5 1/3] of: address: Add parent_bus_addr to struct of_pci_range Message-Id: <20241015-pci_fixup_addr-v5-1-ced556c85270@nxp.com> References: <20241015-pci_fixup_addr-v5-0-ced556c85270@nxp.com> In-Reply-To: <20241015-pci_fixup_addr-v5-0-ced556c85270@nxp.com> To: Rob Herring , Saravana Kannan , Jingoo Han , Manivannan Sadhasivam , Lorenzo Pieralisi , =?utf-8?q?Krzysztof_Wilczy?= =?utf-8?q?=C5=84ski?= , Bjorn Helgaas , Richard Zhu , Lucas Stach , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam Cc: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, linux-arm-kernel@lists.infradead.org, imx@lists.linux.dev, Frank Li X-Mailer: b4 0.13-dev-e586c X-Developer-Signature: v=1; a=ed25519-sha256; t=1729019855; l=4731; i=Frank.Li@nxp.com; s=20240130; h=from:subject:message-id; bh=mpQkyAmcMxPoQ2LNPaVnnXkLHMMBxJM2cbPN+52/6qM=; b=yAk0aYUD19q9Mz9u5tenR1MnHu79q4JNoA+Uict2jX/ebVbxgfGNePvLdPw+Dmrui9Xt5LDxE RrjPRxJultiApLREyohOc57Zaa5aTq4ocyaDO8YLNHXlagw7siqVO44 X-Developer-Key: i=Frank.Li@nxp.com; a=ed25519; pk=I0L1sDUfPxpAkRvPKy7MdauTuSENRq+DnA+G4qcS94Q= X-ClientProxiedBy: SJ0PR05CA0117.namprd05.prod.outlook.com (2603:10b6:a03:334::32) To PAXPR04MB9642.eurprd04.prod.outlook.com (2603:10a6:102:240::14) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB9642:EE_|VI2PR04MB11002:EE_ X-MS-Office365-Filtering-Correlation-Id: 915ca2cc-1e15-44c2-35a7-08dced4e0bdb X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|52116014|366016|7416014|376014|38350700014|921020; X-Microsoft-Antispam-Message-Info: =?utf-8?q?BEOnK+P6hHhhhrShmF86/L0gRPsuLb4?= =?utf-8?q?Qrmn4ZdV0R+SiA3JVT8+0OfHbfSuZtyVzFsYU3s42yB+ES6sIbrJRxqUGgbjwqfGT?= =?utf-8?q?D6gzpzhYifQftS1BNeeognm9wqwB7HppDE7Hm/tTL4Da3lADpbhC5SFaZJ97+xH3n?= =?utf-8?q?HbOF+TLX4jQDTKaw+TIBBoah/Ad+2TkSNoMDeqQIhsPCAY9O6R69xOObxRXR073iS?= =?utf-8?q?6Hz56aAM47XuXD+lk7l53QPGJBV8S4bbHspicN+Y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+IBOX7AJXtDDFP6J8bVbT+BWJlIA7CZ4SU?= =?utf-8?q?ME/B7qF9X12zvvqO4hrpeF0y89Ip1H82o7VoBQeybf25S+TQd3zR6QTB/b0Wqt6AO?= =?utf-8?q?OI2bxvytkEkUHb75w9mBvp0HZS4ymZgiQY+V4xZ6prOnf5SBap6UH+YV74xGKxGs3?= =?utf-8?q?UH/dbA+u/KmQfr7rgRMJg0bVt789HLWHTtidjpuM309gsSL2eBPBTDpc=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)(1800799024)(52116014)(366016)(7416014)(376014)(38350700014)(921020);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?5otXx9Uz3x8G7qE/HfjbUZ0zBb2q?= =?utf-8?q?2HIMCqnt3DdSmmlbsAypt20+MNPff0nHHrYKNBoe84LtFPHC/Jsdlhi7XpJdoQj6F?= =?utf-8?q?tsZPzXpMvmA2ELjHIQ8Fl+/TIJ1iZPwzaU6aYzpqej1dFjwC74SLLdt7vpMRNhgfp?= =?utf-8?q?2AgrOlLJ2k9ZJqGGT2k+iXw/7EcTK7lU+hZf33ab+0I1DbiTuhuPBitG0bdYgKGpT?= =?utf-8?q?Jhg2jef2oeseuKMp6aRi/NAcBXcUkeYErsbI3jGbUhD1dWPhBRVAcCpwUzXs789CV?= =?utf-8?q?LXYG9YBYXNuXuDJUJtFvWwMmCyKtI/CYC6qJaztKlMN0Kn7agw8y6naMkfmqMu/+3?= =?utf-8?q?H/9co6gEXxDDfYe5bq+069oCd2cWxUHGDVMpm5VZxeI6ou0Ql18A222PDoEIR8LuE?= =?utf-8?q?61A1Xc2HeO6FJTh1DeUwedNEiIQfmaIpbzUeZQy56F50RZs5WxtS9/hUIRH6EgOWp?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4rLg?= =?utf-8?q?4pIuGemKiMaMxiYbkR5DVqjzEhzjcuZl6rGWVDMVwzqKQmYnOVEvaf14vJxELLpgm?= =?utf-8?q?S5UVCAYyw6XleMSip3neW6mE8PPBKQpkK1GeXPV4phi3HoYpwFA9Dp2qEsa6zDE6l?= =?utf-8?q?8ZIaES7zwNMwThZSt2/pExWXAFn+vyjCarDjrwHY8Kfkf/6TksNp+8kE=3D?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 915ca2cc-1e15-44c2-35a7-08dced4e0bdb X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9642.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Oct 2024 19:17:44.2821 (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: xc2rtHGTlkrULzy6w6+XBXq3IupCZLahZWyt0jCUb4sfBblRJtFlPJlYKENjTCMHbknPcTy8H4GZpBR38yxb6Q== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI2PR04MB11002 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241015_201754_027613_861816C4 X-CRM114-Status: GOOD ( 12.67 ) 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 Introduce field 'parent_bus_addr' in struct of_pci_range to retrieve parent bus address information. Refer to the diagram below to understand that the bus fabric in some systems (like i.MX8QXP) does not use a 1:1 address map between input and output. Currently, many controller drivers use .cpu_addr_fixup() callback hardcodes that translation in the code, e.g., "cpu_addr & CDNS_PLAT_CPU_TO_BUS_ADDR" (drivers/pci/controller/cadence/pcie-cadence-plat.c), "cpu_addr + BUS_IATU_OFFSET"(drivers/pci/controller/dwc/pcie-intel-gw.c), etc, even though those translations *should* be described via DT. The .cpu_addr_fixup() can be eliminated if DT correct reflect hardware behavior and driver use 'parent_bus_addr' in struct of_pci_range. ┌─────────┐ ┌────────────┐ ┌─────┐ │ │ IA: 0x8ff8_0000 │ │ │ CPU ├───►│ ┌────►├─────────────────┐ │ PCI │ └─────┘ │ │ │ IA: 0x8ff0_0000 │ │ │ CPU Addr │ │ ┌─►├─────────────┐ │ │ Controller │ 0x7ff8_0000─┼───┘ │ │ │ │ │ │ │ │ │ │ │ │ │ PCI Addr 0x7ff0_0000─┼──────┘ │ │ └──► IOSpace ─┼────────────► │ │ │ │ │ 0 0x7000_0000─┼────────►├─────────┐ │ │ │ └─────────┘ │ └──────► CfgSpace ─┼────────────► BUS Fabric │ │ │ 0 │ │ │ └──────────► MemSpace ─┼────────────► IA: 0x8000_0000 │ │ 0x8000_0000 └────────────┘ bus@5f000000 { compatible = "simple-bus"; #address-cells = <1>; #size-cells = <1>; ranges = <0x80000000 0x0 0x70000000 0x10000000>; pcie@5f010000 { compatible = "fsl,imx8q-pcie"; reg = <0x5f010000 0x10000>, <0x8ff00000 0x80000>; reg-names = "dbi", "config"; #address-cells = <3>; #size-cells = <2>; device_type = "pci"; bus-range = <0x00 0xff>; ranges = <0x81000000 0 0x00000000 0x8ff80000 0 0x00010000>, <0x82000000 0 0x80000000 0x80000000 0 0x0ff00000>; ... }; }; 'parent_bus_addr' in struct of_pci_range can indicate above diagram internal address (IA) address information. Reviewed-by: Rob Herring (Arm) Signed-off-by: Frank Li --- Change from v4 to v5 - remove confused <0x5f000000 0x0 0x5f000000 0x21000000> - change address order to 7ff8_0000, 7ff0_0000, 7000_0000 - In commit message use parent bus addres Change from v3 to v4 - improve commit message by driver source code path. Change from v2 to v3 - cpu_untranslate_addr -> parent_bus_addr - Add Rob's review tag I changed commit message base on Bjorn, if you have concern about review added tag, let me know. Change from v1 to v2 - add parent_bus_addr in struct of_pci_range, instead adding new API. --- drivers/of/address.c | 2 ++ include/linux/of_address.h | 1 + 2 files changed, 3 insertions(+) diff --git a/drivers/of/address.c b/drivers/of/address.c index 824bb449e0079..38db2074494b0 100644 --- a/drivers/of/address.c +++ b/drivers/of/address.c @@ -811,6 +811,8 @@ struct of_pci_range *of_pci_range_parser_one(struct of_pci_range_parser *parser, else range->cpu_addr = of_translate_address(parser->node, parser->range + na); + + range->parent_bus_addr = of_read_number(parser->range + na, parser->pna); range->size = of_read_number(parser->range + parser->pna + na, ns); parser->range += np; diff --git a/include/linux/of_address.h b/include/linux/of_address.h index 9e034363788ac..0cff903653916 100644 --- a/include/linux/of_address.h +++ b/include/linux/of_address.h @@ -26,6 +26,7 @@ struct of_pci_range { u64 bus_addr; }; u64 cpu_addr; + u64 parent_bus_addr; u64 size; u32 flags; }; From patchwork Tue Oct 15 19:17:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 13837022 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 3D5BAD1F9C2 for ; Tue, 15 Oct 2024 19:35:59 +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=fL3UKGvdWP+KFjAwQhRXw53UwJq+kOcQRY6+VijyXiM=; b=HfeczALAwytmjsIriq11GdSZtR AYg9xVWkRqexFM0Y65munjLFt4d16IuX66ESDmL9/QkVaoMpfJNXmgBBmOqYnUbehIx6cTG9x2Q0f bWuZI8DUMmIJMIc1/pFN2T3fR+RW+uFoYGuV6OrbvWa+t1LY2iM89XRHRYJMXqeaDkZRUYpN2tQiw Wk4hrFtisNYLmqJSYlcBZnMF+EP7XDSJvQcz5yqwqwQeriWrCCVEaZ0TWBPQTNpO8aNhbtNcX3K7A D3W/OTnDdu/X3rnlDeS5Z++kL5O94INVU6o74O0uPp0iAqC+IHqKkTGJ0CSJw+JwBXPs9rc4MAVNH vC9CzHLg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1t0nKe-00000009PQc-1rT6; Tue, 15 Oct 2024 19:35:48 +0000 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1t0n3Q-00000009Meh-3ili for linux-arm-kernel@bombadil.infradead.org; Tue, 15 Oct 2024 19:18:01 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=MIME-Version:Cc:To:In-Reply-To: References:Message-Id:Content-Transfer-Encoding:Content-Type:Subject:Date: From:Sender:Reply-To:Content-ID:Content-Description; bh=fL3UKGvdWP+KFjAwQhRXw53UwJq+kOcQRY6+VijyXiM=; b=lEgFpvAtxJCWDzLNscX9j6KHY1 18m+enbXcxXlP6s5wt/Y17wWfsX8BephgFL5lQK9F9W+tbOujIuY7iHnVFNvyeBK5ZzY3d0M8Sdg3 P/emJ8+sqaVS2ZaZKeY78rGl/Zxn5XqV0oyYu0U+2t66sb/5GsIH+j1Gb7paZvy8j0Qz6MbAL0dk1 eFKBBiU2mkEOcI0djAbUYtiG4DRUrQ0vRCjiQ8fY2yALZaLwsn7rKaNvGz3SqyRPninzD1Mh/l1qj +HAlQe4/OL+8XcWxcrPzcJtkSCCux0iivSKeMBMRWAbo1UljApsik84djs6ihnR/0KIO5wBsQQXKK +TBWQtNw==; Received: from mail-dbaeur03on2060b.outbound.protection.outlook.com ([2a01:111:f403:260d::60b] helo=EUR03-DBA-obe.outbound.protection.outlook.com) by desiato.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1t0n3N-00000006dkw-0wy5 for linux-arm-kernel@lists.infradead.org; Tue, 15 Oct 2024 19:17:59 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=vM8R+d/LfoZGuLYyngUyDupJ3aO/O4wV8vmVEtu83yOvevgg+P9Ltp1ds3e4/a3Q/bE3+cmtg8DzbvWplwsJUMLCEUAx5puhLuxrR9hRV6zWW4GeErW6Qa1xiWZiRaepLAMCdeew2tC9wqvnwzg2F824Bu9k7UDr63UgEXVKW0BjVZhDD/UERtYkq+FnvxXqOJFV0QGcCOa+nx6IXPuaUdgqMoJTcN/wxyt9xNOGG4EEvkacth1eNnJlbO0vX/+b4wLi6/6K+Lsv7IKLgVwh/XTvMOch8mmNHNpvwuJVTz3eNy5jJYtn+WVD2xmuN2ztqeP64Rf+oOACZT8fMYxd3g== 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=fL3UKGvdWP+KFjAwQhRXw53UwJq+kOcQRY6+VijyXiM=; b=k4VEdOcQNdZwvInN5iIFh469wpD5CL7Xbq/yvZdtBHmD59ebkKmsEjb7/1tTyDDt7Mzu02Soi0PNvVdLBMMb1Sel0Q2aFapEvcN6yfj6pGwdTkT9+6HJVQt13cmAxCd10N4lVtKFF+LRWlPk1fu7XCNGW1gclvlIV2ypcyLe7oiduW7a1BwUbTvKwK2rx/kPPEGh9xyeApQQkQ3oB6Hjx9M3MvyLPurWD6v/99dvAULohSvuEvSoAJOnAziGfoS+HpphZidu3mw9l7U8EdND2fC2MLsirsj9Mveh+3b/OUsydYlxMf48Py3UuOyxeMTXkCRjgTQFqu97HZQAFja4sA== 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=fL3UKGvdWP+KFjAwQhRXw53UwJq+kOcQRY6+VijyXiM=; b=kD6QIQGE6DhlVjt7VzLe8SYXFu1/rbs/BIOd1a7ryeKgMklakfEt5Vv6YQse0UlHOjO+dmLXDfF+T2IwK+7zykFhN/p1r+XISr7/dgYssNQjl6QQUJKMcixplAStf7Blr0SNN0+YdNb5xNKsp2oLyPG5ZLnbU7rQVJlyZdIbQiyEgBpTuHbcwAp4hBYwgiMgY850r4GiZJLUAJsBYsCBGdiiWDlXtZl3Fp2q8plY/3cCmglSoPNv2ABCy2mrkfw2cuSbjeUDJqeAZ08+a4OEtMX7eE0RqVbkbRi4745SyRbezhbMP3M/zJgj1lJlalu5vxF18LOOJmHwT6Qmkp0VIw== 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 VI2PR04MB11002.eurprd04.prod.outlook.com (2603:10a6:800:280::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8048.26; Tue, 15 Oct 2024 19:17:49 +0000 Received: from PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::9126:a61e:341d:4b06]) by PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::9126:a61e:341d:4b06%4]) with mapi id 15.20.8069.016; Tue, 15 Oct 2024 19:17:49 +0000 From: Frank Li Date: Tue, 15 Oct 2024 15:17:18 -0400 Subject: [PATCH v5 2/3] PCI: dwc: Using parent_bus_addr in of_range to eliminate cpu_addr_fixup() Message-Id: <20241015-pci_fixup_addr-v5-2-ced556c85270@nxp.com> References: <20241015-pci_fixup_addr-v5-0-ced556c85270@nxp.com> In-Reply-To: <20241015-pci_fixup_addr-v5-0-ced556c85270@nxp.com> To: Rob Herring , Saravana Kannan , Jingoo Han , Manivannan Sadhasivam , Lorenzo Pieralisi , =?utf-8?q?Krzysztof_Wilczy?= =?utf-8?q?=C5=84ski?= , Bjorn Helgaas , Richard Zhu , Lucas Stach , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam Cc: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, linux-arm-kernel@lists.infradead.org, imx@lists.linux.dev, Frank Li X-Mailer: b4 0.13-dev-e586c X-Developer-Signature: v=1; a=ed25519-sha256; t=1729019855; l=6561; i=Frank.Li@nxp.com; s=20240130; h=from:subject:message-id; bh=mxnXQtsQ9r/Ji6o5AXb2owHgaiMSnmyNmFBnlNFd3kM=; b=hCXFkStAglAgicEerZg0T9vjbjZOfT2D6EApXOSIqlVLvUcP9FLTbnekzA8GqCTVnl6JiHKeh 93wW59KQVo5AvoqIVG0mHxDp4xZOBJdwVOFC0RUTEyiZBKNbGLA9Q9V X-Developer-Key: i=Frank.Li@nxp.com; a=ed25519; pk=I0L1sDUfPxpAkRvPKy7MdauTuSENRq+DnA+G4qcS94Q= X-ClientProxiedBy: SJ0PR05CA0117.namprd05.prod.outlook.com (2603:10b6:a03:334::32) To PAXPR04MB9642.eurprd04.prod.outlook.com (2603:10a6:102:240::14) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB9642:EE_|VI2PR04MB11002:EE_ X-MS-Office365-Filtering-Correlation-Id: 8a7990a5-dbca-4741-e6b6-08dced4e0eef X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|52116014|366016|7416014|376014|38350700014|921020; X-Microsoft-Antispam-Message-Info: =?utf-8?q?EoOZaUTMFidn1kfxM2BEfwLkBa+aZiO?= =?utf-8?q?wYIzzvGd8jpdfyUdOZBT47EV9wYdt3uyU4zZzrZtAn3ChCRxbzRIVujcStKcyY7hr?= =?utf-8?q?fEWlHnsDOpKTOAu45FIpUW7UTnbANNJlD2qlKQGreqkKUwNHA74mCBDy5B2uuQTS8?= =?utf-8?q?CTZYVSPV3l5frvJbDR7umcL5b0KJy7X2K5QcNzUOOBxylg3mN8Z/XguroYVb8CcAu?= =?utf-8?q?j7v4yTXgejs9iVKqPgQg7bBq8obfX5w6rZY1zYuc1ge9j1km7AyEnyGJ6D5FytuIw?= =?utf-8?q?EELIOfGQ2I5Ne6jbvoeLIgpb8hvdlnbl9N+5GuledX2LDY/IR4whkMb+aYR/frQsj?= =?utf-8?q?HixEjMYQjmRUPSq1PsiwtZPJBoUTS9S9s0B3OvnnQu/c7KB3t1xybjtrSxFjptmbe?= =?utf-8?q?zxyjQft4NYJBRlL+ddQ/9LO85MXyXmBnInU6VMTM46EuPd5Z6QqyfmKTNLrMH4Swa?= =?utf-8?q?nYk+0G02gi1Is3/wJpOvhpkUrwoQXJo4p4ARACgtzvk8FLvTNZsCIsegw2RoMWwaX?= =?utf-8?q?CfVv8F9u8qILvCymQ4mZJ4RilhFSkUp5djAnDBZlumBbZiCUd4Xp9RCCT0/oxM0cQ?= =?utf-8?q?xA8K1sIJHFpko0HSexrKh7HC8oa49ddkGlHMxKWSqJeS160RhDQkf8LFyTnom2XC9?= =?utf-8?q?KjgqpJadlAL/CeK+sgwGzPb8qCJm3tx05CCBbFERdiSFMPIsJUeixYbVDP+SGpoBo?= =?utf-8?q?wPnmBsxif7flPgT+dhHTlNTJDtlxJ9NHnOqP28+xHeDYfLjFMPjF9hgUcZevSSafW?= =?utf-8?q?KVe/fbDsxb8B49aC4nEJsD7PvUDA+TVF216C3NL5BdXU68+y9l9lcDaVxErV70Ehq?= =?utf-8?q?elIIEso7Y/p1C4x9qKAYo4uZ2QXm+IU145fbVoTF2/r4EFDRvg1PTYzWioVthbGd7?= =?utf-8?q?dQYam0oMwQgB4hfcZVogiZly6fuqQKgsS6Qg1e4wiPHCvq5e9VE9x6PpJz8dt9Ods?= =?utf-8?q?t4nWGuDBqyoZpYsenurr11wgR8I97LcFyKL5x6xgZQSzcTwWX+WtcsVPEc4hSUznc?= =?utf-8?q?k9JjblBJ6T8BDvAyd9C5TqZqFwrE8wSrksHw3SQZpUX8QrZakTA0LwfNpRAbWWs/q?= =?utf-8?q?jA0ag2KucCDe+2UrPivYG43cYDInTM+SHTyMgHuWU7LrJlzqA0jXZbM2BmWumd1/m?= =?utf-8?q?PAiMYUz+XcrA7v3qVWB9N0/zCPxTzMwfhdwQDx4DRafIayURYVZ9IPAcPgq4MqQBE?= =?utf-8?q?qeehrIDbQuF/eqDrEMlg554II12hsWPd1YezjY7VtNgoYTXqqUMep3d+MpjevpVMU?= =?utf-8?q?qe5eF4s9cowGocPh97xVs0AQAVyGJ4PPMVUncf/c3+i4bDSlcY0uuWEA=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)(1800799024)(52116014)(366016)(7416014)(376014)(38350700014)(921020);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-Mess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PUAaucb/PMQborIXGr/cOlzhoYvr61M2im9G?= =?utf-8?q?PjLvtyLgkUuuzKBEoPkBv3V+rcCm1W+UHkSDDvJdXXrp7J+a0DPKAiyG1YEd3mjTu?= =?utf-8?q?zev3Lkqt+9ObWa9nrfFUQKLeWLiNdki1I/FEW+dsUkgHUm7ciO04/hkCBFG347Nq8?= =?utf-8?q?IinPzBnSRCB5g9Y1AjJxvh/c/PrAsBqgD6AvLKLgHuQMVyBQX7G8Zz+n3wullA7qQ?= =?utf-8?q?lznA5po/T8ICLgIm9n/IaQmoTkXn+7tcwF2kR6V/nEknbgFJAQNMiHoWG6uVC78e/?= =?utf-8?q?5cdoypX8cXKOWHpBZRss0A7jKqqw0O3GS04uYM1d5QALMC/HnAIk6wVwKQos9k+J0?= =?utf-8?q?ezMvcUTEE5bJPCoIm7aT57fetJbpQUObI5Dj/w/ogzR8SIJ85I3VhLJucVVb2QGdW?= =?utf-8?q?LOTXhHgIdlkulNjH3fkdN58x+kfc9ni4KSNavpM0TaoP0wM68gpqHEJp3pIJe73Ab?= =?utf-8?q?/j3ae82TsTYeFDmXkkSIEttNEPGg+B5G6BdwzKj7S9Y7Ho4EkT+FwPsWDaQKFyrsY?= =?utf-8?q?YEJvgPnoo2ScTAW46ZcePXQKgVAMfA9FetMLZm3RfE73r/fJrvC6Dns4L1j+ALiPc?= =?utf-8?q?UDodmEAtxpGvPvQgd63oE4twOig7cwx0WDR+lIkZlXNjoxvoOqy1Stbs=3D?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8a7990a5-dbca-4741-e6b6-08dced4e0eef X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9642.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Oct 2024 19:17:49.4657 (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: NduNIf2tDf0Rls1GonXUCjvlSzQyN/oWuMJ+6eRhxvTkhsk/CS0PKj+hTH9oJeR4M0R/AOuoqP1/LgkuV5WpWg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI2PR04MB11002 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241015_201757_468726_22575C60 X-CRM114-Status: GOOD ( 14.70 ) 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 parent_bus_addr in struct of_range can indicate address information just ahead of PCIe controller. Most system's bus fabric use 1:1 map between input and output address. but some hardware like i.MX8QXP doesn't use 1:1 map. See below diagram: ┌─────────┐ ┌────────────┐ ┌─────┐ │ │ IA: 0x8ff8_0000 │ │ │ CPU ├───►│ ┌────►├─────────────────┐ │ PCI │ └─────┘ │ │ │ IA: 0x8ff0_0000 │ │ │ CPU Addr │ │ ┌─►├─────────────┐ │ │ Controller │ 0x7ff8_0000─┼───┘ │ │ │ │ │ │ │ │ │ │ │ │ │ PCI Addr 0x7ff0_0000─┼──────┘ │ │ └──► IOSpace ─┼────────────► │ │ │ │ │ 0 0x7000_0000─┼────────►├─────────┐ │ │ │ └─────────┘ │ └──────► CfgSpace ─┼────────────► BUS Fabric │ │ │ 0 │ │ │ └──────────► MemSpace ─┼────────────► IA: 0x8000_0000 │ │ 0x8000_0000 └────────────┘ bus@5f000000 { compatible = "simple-bus"; #address-cells = <1>; #size-cells = <1>; ranges = <0x80000000 0x0 0x70000000 0x10000000>; pcie@5f010000 { compatible = "fsl,imx8q-pcie"; reg = <0x5f010000 0x10000>, <0x8ff00000 0x80000>; reg-names = "dbi", "config"; #address-cells = <3>; #size-cells = <2>; device_type = "pci"; bus-range = <0x00 0xff>; ranges = <0x81000000 0 0x00000000 0x8ff80000 0 0x00010000>, <0x82000000 0 0x80000000 0x80000000 0 0x0ff00000>; ... }; }; Term internal address (IA) here means the address just before PCIe controller. After ATU use this IA instead CPU address, cpu_addr_fixup() can be removed. Signed-off-by: Frank Li --- Change from v4 to v5 - remove confused 0x5f00_0000 range in sample dts. - reorder address at above diagram. Change from v3 to v4 - none Change from v2 to v3 - %s/cpu_untranslate_addr/parent_bus_addr/g - update diagram. - improve commit message. Change from v1 to v2 - update because patch1 change get untranslate address method. - add using_dtbus_info in case break back compatibility for exited platform. --- drivers/pci/controller/dwc/pcie-designware-host.c | 42 +++++++++++++++++++++++ drivers/pci/controller/dwc/pcie-designware.h | 8 +++++ 2 files changed, 50 insertions(+) diff --git a/drivers/pci/controller/dwc/pcie-designware-host.c b/drivers/pci/controller/dwc/pcie-designware-host.c index 3e41865c72904..823ff42c2e2c9 100644 --- a/drivers/pci/controller/dwc/pcie-designware-host.c +++ b/drivers/pci/controller/dwc/pcie-designware-host.c @@ -418,6 +418,34 @@ static void dw_pcie_host_request_msg_tlp_res(struct dw_pcie_rp *pp) } } +static int dw_pcie_get_untranslate_addr(struct dw_pcie *pci, resource_size_t pci_addr, + resource_size_t *i_addr) +{ + struct device *dev = pci->dev; + struct device_node *np = dev->of_node; + struct of_range_parser parser; + struct of_range range; + int ret; + + if (!pci->using_dtbus_info) { + *i_addr = pci_addr; + return 0; + } + + ret = of_range_parser_init(&parser, np); + if (ret) + return ret; + + for_each_of_pci_range(&parser, &range) { + if (pci_addr == range.bus_addr) { + *i_addr = range.parent_bus_addr; + break; + } + } + + return 0; +} + int dw_pcie_host_init(struct dw_pcie_rp *pp) { struct dw_pcie *pci = to_dw_pcie_from_pp(pp); @@ -427,6 +455,7 @@ int dw_pcie_host_init(struct dw_pcie_rp *pp) struct resource_entry *win; struct pci_host_bridge *bridge; struct resource *res; + int index; int ret; raw_spin_lock_init(&pp->lock); @@ -440,6 +469,13 @@ int dw_pcie_host_init(struct dw_pcie_rp *pp) pp->cfg0_size = resource_size(res); pp->cfg0_base = res->start; + if (pci->using_dtbus_info) { + index = of_property_match_string(np, "reg-names", "config"); + if (index < 0) + return -EINVAL; + of_property_read_reg(np, index, &pp->cfg0_base, NULL); + } + pp->va_cfg0_base = devm_pci_remap_cfg_resource(dev, res); if (IS_ERR(pp->va_cfg0_base)) return PTR_ERR(pp->va_cfg0_base); @@ -462,6 +498,9 @@ int dw_pcie_host_init(struct dw_pcie_rp *pp) pp->io_base = pci_pio_to_address(win->res->start); } + if (dw_pcie_get_untranslate_addr(pci, pp->io_bus_addr, &pp->io_base)) + return -ENODEV; + /* Set default bus ops */ bridge->ops = &dw_pcie_ops; bridge->child_ops = &dw_child_pcie_ops; @@ -733,6 +772,9 @@ static int dw_pcie_iatu_setup(struct dw_pcie_rp *pp) atu.cpu_addr = entry->res->start; atu.pci_addr = entry->res->start - entry->offset; + if (dw_pcie_get_untranslate_addr(pci, atu.pci_addr, &atu.cpu_addr)) + return -EINVAL; + /* Adjust iATU size if MSG TLP region was allocated before */ if (pp->msg_res && pp->msg_res->parent == entry->res) atu.size = resource_size(entry->res) - diff --git a/drivers/pci/controller/dwc/pcie-designware.h b/drivers/pci/controller/dwc/pcie-designware.h index 347ab74ac35aa..f8067393ad35a 100644 --- a/drivers/pci/controller/dwc/pcie-designware.h +++ b/drivers/pci/controller/dwc/pcie-designware.h @@ -463,6 +463,14 @@ struct dw_pcie { struct reset_control_bulk_data core_rsts[DW_PCIE_NUM_CORE_RSTS]; struct gpio_desc *pe_rst; bool suspended; + /* + * Use device tree 'ranges' property of bus node instead using + * cpu_addr_fixup(). Some old platform dts 'ranges' in bus node may not + * reflect real hardware's behavior. In case break these platform back + * compatibility, add below flags. Set it true if dts already correct + * indicate bus fabric address convert. + */ + bool using_dtbus_info; }; #define to_dw_pcie_from_pp(port) container_of((port), struct dw_pcie, pp) From patchwork Tue Oct 15 19:17:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 13837034 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 C9D95D1F9C6 for ; Tue, 15 Oct 2024 19:43:03 +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=kFdkiX44EjkJj3LAqVwNHMJG8BXqkLT7bhkwcmGyI8Y=; b=Xc7mYzY5RnPORxj5F4nsq0giW/ 8CQXLRijw2W415ATM+KNDCOqQ///Pi4451lMOq/PSlfGjEdJ11I7BsmkvuY+qnyWJTMzezTksHzaH grrAsfc3UXZ78hemVQWl+jGjusduA1Bwfr0jrsP/Tk8Z4dEAnl5jnXkWfJL0ME15ie7JhCw+6Il4c HenMJLGTcTdNDY+x4CZ9bMOQ+bqeBsHAGSt9HkA3pLHnxFVRfOf8MN/RALXx0/eR0x19yUhDYNG4O CFthRRgx/iY1O3v7sf7azFoI7/E/7V+zdXiehUl7nvIOURLCxJ7+u1o/46+y40SrwnLY7e7Lmo6R2 bJzyXKcw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1t0nRW-00000009QWe-0761; Tue, 15 Oct 2024 19:42:54 +0000 Received: from mail-am6eur05on20600.outbound.protection.outlook.com ([2a01:111:f403:2612::600] helo=EUR05-AM6-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1t0nI6-00000009P9f-2z3q for linux-arm-kernel@lists.infradead.org; Tue, 15 Oct 2024 19:33:12 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=PjKX9s4C8O+HNEZVFwkQz/zBdXvgt/lmg0b+rWZ+gvgubkNFw4BcvB+Y0h0B72rJSPBG4wCOFNAedvvVj3CZF7C5b7Qo0D3HJ/oQDBN7ffeW7gAYFWaXJvLSBsDTZiJFgDreXUJDUNFc4vWrKrdINpiIB1VYC0SLwEQJBfhYzyLAHpv+66qiRXeP7NJjOshrHQNKecwCBa1DJZnrpvHvtd6XLNWXBkW4gdeKeyAPDdBSwinMrKict7BjVD6vGLf5AD889RESxfTWKKSgm25SPkCOxKeA+bbEJ+jgVdSmMMeekJW1r+LrlsX1q5cc1YgyMq5dnRYh3TVEkeYUodnSTw== 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=kFdkiX44EjkJj3LAqVwNHMJG8BXqkLT7bhkwcmGyI8Y=; b=Tjsz/dFsnwJ6eqZisRBYthZLvWzz9PphxCzlap/ISEM6oMroMgikkS69nWWuTmHKa0irkoZCIhG3OUSd0OXRt/HlotBprRhRXbXF8I7nLLMunauXgraSTSJoyiFlme7QKHoKltS+7xOeEfG1LP6QjfKscYpXEsoeRRa783WCSzPREkHiojMt344Fsdhz5Q3DDqhgCVGkbMMWg9JZiqQqBG4QzJq09jKLXbl1UXAL5GwTYER3JtqOp7xB+mmqx41E2zTW8soe8Baj6FdAInZ/AH7A98UaNmo6GO7F52FUnZ+l3g2lnxrAbJG/L37VzasNVMmw1vJHJeyAHxvI+pXdRQ== 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=kFdkiX44EjkJj3LAqVwNHMJG8BXqkLT7bhkwcmGyI8Y=; b=Ig9KZhvoxxBtKwaq9W6Dpl2i3KHO+TmXIVq0gKGEiG5iw+LXqO1yl0fOj8MYsqEsW9UI4VciRGnVR5UZUHl+ZQskiw0oqe+hqSj4DGYZPy7P1su4+Tw02Rw/6lupquhIqMAEJ0ljYHJcHmi+Z5wQWPN/94RWPRnq65LQLvRUs3APdpRL2zMETojAHdTqYvURd5mCVjE2i5g1Nywv6/g0yRUsxxEZNdPIK9Z1onWUjShZ6luYj75oiAhQQ4K9mJldjLB7BXo9t5dy2KvCgE4Tf8afg+5BIxk32uI2q04weMm9r47mz1YE3IsE6fIdFRM0idnaaEd32QWoLb/CP3cLkg== 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 AM9PR04MB8826.eurprd04.prod.outlook.com (2603:10a6:20b:409::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8048.27; Tue, 15 Oct 2024 19:17:54 +0000 Received: from PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::9126:a61e:341d:4b06]) by PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::9126:a61e:341d:4b06%4]) with mapi id 15.20.8069.016; Tue, 15 Oct 2024 19:17:54 +0000 From: Frank Li Date: Tue, 15 Oct 2024 15:17:19 -0400 Subject: [PATCH v5 3/3] PCI: imx6: Remove cpu_addr_fixup() Message-Id: <20241015-pci_fixup_addr-v5-3-ced556c85270@nxp.com> References: <20241015-pci_fixup_addr-v5-0-ced556c85270@nxp.com> In-Reply-To: <20241015-pci_fixup_addr-v5-0-ced556c85270@nxp.com> To: Rob Herring , Saravana Kannan , Jingoo Han , Manivannan Sadhasivam , Lorenzo Pieralisi , =?utf-8?q?Krzysztof_Wilczy?= =?utf-8?q?=C5=84ski?= , Bjorn Helgaas , Richard Zhu , Lucas Stach , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam Cc: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, linux-arm-kernel@lists.infradead.org, imx@lists.linux.dev, Frank Li X-Mailer: b4 0.13-dev-e586c X-Developer-Signature: v=1; a=ed25519-sha256; t=1729019855; l=2455; i=Frank.Li@nxp.com; s=20240130; h=from:subject:message-id; bh=Xur3w88Prm2U9ti80meGJLxIu6InmfTZAzjgILmrVU0=; b=CfiwpnLOP6TFyvQ9YuQRyjLyR4VWCIAxMb01L2DT4ROCDyrMXEuNW+7QF1uF9bn8Yoc5jn3/o McSsd5Uo+9mAC590Kk5w+kk6T1xmuiHJ+h7yGdod53WsPHxri9YwBXv X-Developer-Key: i=Frank.Li@nxp.com; a=ed25519; pk=I0L1sDUfPxpAkRvPKy7MdauTuSENRq+DnA+G4qcS94Q= X-ClientProxiedBy: SJ0PR05CA0117.namprd05.prod.outlook.com (2603:10b6:a03:334::32) To PAXPR04MB9642.eurprd04.prod.outlook.com (2603:10a6:102:240::14) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB9642:EE_|AM9PR04MB8826:EE_ X-MS-Office365-Filtering-Correlation-Id: 5232c217-a128-4570-3cee-08dced4e11aa X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|7416014|52116014|376014|1800799024|38350700014|921020; X-Microsoft-Antispam-Message-Info: =?utf-8?q?9nUDTJI526gKveFuN3d1ocBGJJ77apv?= =?utf-8?q?IWuEnwK7zrSmxGrWzSXkfYsoqQhwwqbPboh7R0Tk3Ay/VnVqWrX8ixIv8hxynatKc?= =?utf-8?q?hjVkFqbGpBavIOLhMrbajXx70y3Mb4bnFEqFFyOXr3XiJ2ztcy2rL+ePiu3yTKRm0?= =?utf-8?q?PYiNAWWvpjOj3sU8lg5AXuFgI8YeQEyRqTq7r1TiultKOQFIg4eG0EpJgca07dsXu?= =?utf-8?q?zZ2vcGpfZTgSfuZMzFeRDJkayTkz6+Tx7Ft5EzdvuSwnXpmw3SrNMCbkDSDozyll1?= =?utf-8?q?84yjsqNRJsq7r7KWLVgP+vXBKfdYDtI9VDy8B/mW+21NXmqpIcMDTvMyml5AgJQhA?= =?utf-8?q?tc3DnooUGnRwumhCX9bs3gaw7VZaC6dg2ZirVaOxEyyZCjHN8HPCIAi7W6cH0z+Tf?= =?utf-8?q?LsYCfop+xuVW/t9qVJSnemyRzqK3+QDkiAdBAADyss9q/+KzeGZ4zw6Z2nLqGYYxG?= =?utf-8?q?TObAJARY5CyXaZbj225qQxRY3JPCLZiHv5fnNiliahKaM8YvVT12c9b0IHT9jnyqM?= =?utf-8?q?/Cam+b3LOPVEDq1X7rG6+vC9vABjrfIEd/khAQbi4gh79mf9vz8euG6Lu4YQs1q89?= =?utf-8?q?lEos7tcCbYXkkZJJHTk0ydsYP20+bEfjsP/hBo2fgXusAdYHVvs33berjThbNb1iQ?= =?utf-8?q?4CupM1MDHC77xkhWedvWOL7NLo/yJhdvWVduTzNP61myiYCtruKRmRFeMxWsHvffT?= =?utf-8?q?2+PzNNmXwi113ROwr9ekgS22mwNW8MPEi4SqRVzP1cduc1uyxcVNK0xJ63aD0ljR3?= =?utf-8?q?2p5M9Az2nIoKFFsFZh7BHon/b3VywD2g/9x1hB3ZwL3JDZn3BGx+hDofaxl48BU5u?= =?utf-8?q?8Zx3lKTORHsQcyD6przHTijbaaee0zLxURx8YUeBJGLmxy9563KWbkg4/0U0oKB2f?= =?utf-8?q?LO7rsVwMhXiwg911CHwtw4n8vfFxmDM5k10a9ijKuOhRjACvdAcL4vcUTjzwG4bId?= =?utf-8?q?pwrnja99YI5yyyZ7aPFx8YlD0u2hX/Bz3/AuMw6l0wCGQGm0utAhDEkfhnSRbkH01?= =?utf-8?q?Y8Olv6mZKHxIYr3x4/YlxsAX2OWogtgo4+eTXgaw3BsS7AxwOYpBgCSGJDCe7f77F?= =?utf-8?q?c5W/t+AltH0vc/a34ZQj/70d3qA+HaRZ/Rmc792EyafkOwJl0DDg53fBQm2aara4F?= =?utf-8?q?M1PkD9/5OP+Kmu3V/v0WNrgv3KWaAeYwmJRGIAYSFSl8l7LmpxWej74MlncoIRlrn?= =?utf-8?q?SQ+aBVriZcQmch0ymg2+swY6P0U0OAaP5qpj6Q5Xy87d5+9aTs7h8FqZRZGUYsXz5?= =?utf-8?q?1T0k7BH7I7LSD9nkPoeyX7c5eFa+DZ1M7X7C2STt6slcpLOKG65fKRQ0=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)(366016)(7416014)(52116014)(376014)(1800799024)(38350700014)(921020);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?eA+RIcCihjiLxeaTJoeNn/JBIV1G?= =?utf-8?q?p7IM2F2h26muTTR9UZBZeW43UIBp6Px09xxyQNAsV4ac665jVapyDpHAv47rDtLqo?= =?utf-8?q?0HHeNpjHUEvEHN1Zgqkm7uE7gkAcvaNrgKXAgOyFWB0Tm2YxnuzUFtQLgvjF4AZxR?= =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q?Ai8ttt1VA/qVNPZplhrhEYO5G0J6jxLccKWYCq3ry2u7N+s9jxSV1tAnk8KiK8xrP?= =?utf-8?q?sPS5sAY9P3mraBSFjEwqT4r7rZ+vy01gf+Zw9dnFCw7rgRM8l7PAsXFQg5ZM2ShNm?= =?utf-8?q?P86BiwyFTa357K7CdAOkf364lVn7yIE9HDLqWe2eqlUAIQGFr8gr73UOskRIWoJeT?= =?utf-8?q?+4DnbQ7wt8IqrVVOOs98RV/PYTZ1uVAd7rBRVGpDa0w720E51b4JVrVKsBD7kmRaP?= =?utf-8?q?u94BuJ8pVk4WK/WT0cZOT/P2fgkEJKVQz8l3XdboiopC8ggbZBKB9Z9Qo/VjJWlmp?= =?utf-8?q?2thYjGiGWwJQ1L4IxAol20jla0Ap0Gz35rDcWx6MnF58VOsJHL5Vh4eTBTNS11+CF?= =?utf-8?q?VZc+ggxegVh6hd3bJJN+QuEZv63uKuO7WrYEzLtfwvzwlSVCNVhON6oONAxL7H5xm?= =?utf-8?q?xDzrMlWsxcB1GhdXBN5YBYgBBhUOrIPVMbuMLksmHgn3bLYTwsAsMs3Y=3D?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5232c217-a128-4570-3cee-08dced4e11aa X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9642.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Oct 2024 19:17:54.0391 (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: LwDgHXVUwOZ8uwmSt3jy8jYtO8nSQVFA4wzLJa7wepfIW2708qFbtqR5ICUT5v65zVkaAZ9Z05GUVJYxqqO2uA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM9PR04MB8826 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241015_123310_770640_A4A223AB X-CRM114-Status: GOOD ( 14.22 ) 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 Remove cpu_addr_fixup() because dwc common driver already handle address translate. Signed-off-by: Frank Li --- Change from v2 to v5 - none Change from v1 to v2 - set using_dtbus_info true --- drivers/pci/controller/dwc/pci-imx6.c | 22 ++-------------------- 1 file changed, 2 insertions(+), 20 deletions(-) diff --git a/drivers/pci/controller/dwc/pci-imx6.c b/drivers/pci/controller/dwc/pci-imx6.c index 808d1f1054173..533905b3942a1 100644 --- a/drivers/pci/controller/dwc/pci-imx6.c +++ b/drivers/pci/controller/dwc/pci-imx6.c @@ -81,7 +81,6 @@ enum imx_pcie_variants { #define IMX_PCIE_FLAG_HAS_PHY_RESET BIT(5) #define IMX_PCIE_FLAG_HAS_SERDES BIT(6) #define IMX_PCIE_FLAG_SUPPORT_64BIT BIT(7) -#define IMX_PCIE_FLAG_CPU_ADDR_FIXUP BIT(8) #define imx_check_flag(pci, val) (pci->drvdata->flags & val) @@ -1012,22 +1011,6 @@ static void imx_pcie_host_exit(struct dw_pcie_rp *pp) regulator_disable(imx_pcie->vpcie); } -static u64 imx_pcie_cpu_addr_fixup(struct dw_pcie *pcie, u64 cpu_addr) -{ - struct imx_pcie *imx_pcie = to_imx_pcie(pcie); - struct dw_pcie_rp *pp = &pcie->pp; - struct resource_entry *entry; - - if (!(imx_pcie->drvdata->flags & IMX_PCIE_FLAG_CPU_ADDR_FIXUP)) - return cpu_addr; - - entry = resource_list_first_type(&pp->bridge->windows, IORESOURCE_MEM); - if (!entry) - return cpu_addr; - - return cpu_addr - entry->offset; -} - static const struct dw_pcie_host_ops imx_pcie_host_ops = { .init = imx_pcie_host_init, .deinit = imx_pcie_host_exit, @@ -1036,7 +1019,6 @@ static const struct dw_pcie_host_ops imx_pcie_host_ops = { static const struct dw_pcie_ops dw_pcie_ops = { .start_link = imx_pcie_start_link, .stop_link = imx_pcie_stop_link, - .cpu_addr_fixup = imx_pcie_cpu_addr_fixup, }; static void imx_pcie_ep_init(struct dw_pcie_ep *ep) @@ -1446,6 +1428,7 @@ static int imx_pcie_probe(struct platform_device *pdev) if (ret) return ret; + pci->using_dtbus_info = true; if (imx_pcie->drvdata->mode == DW_PCIE_EP_TYPE) { ret = imx_add_pcie_ep(imx_pcie, pdev); if (ret < 0) @@ -1585,8 +1568,7 @@ static const struct imx_pcie_drvdata drvdata[] = { }, [IMX8Q] = { .variant = IMX8Q, - .flags = IMX_PCIE_FLAG_HAS_PHYDRV | - IMX_PCIE_FLAG_CPU_ADDR_FIXUP, + .flags = IMX_PCIE_FLAG_HAS_PHYDRV, .clk_names = imx8q_clks, .clks_cnt = ARRAY_SIZE(imx8q_clks), },