From patchwork Tue Nov 19 19:44: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: 13880493 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 0DB90D6C287 for ; Tue, 19 Nov 2024 19:45:55 +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: Content-Transfer-Encoding:Content-Type:Message-Id:Date:Subject:From:Reply-To: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=DfdzY+3TdLFWlO+OUTtsUU+jP1elxIXTvN0R+8efR3U=; b=2IfGZBfnvJ3+VbiInfpZyaqpMb mM6+cVbDPzYKRWzSY2SfJOHWWRf00by6V9jC2hpcPTPwFqQtqW3u5QhY6IQUX82Thfm2tpMGVgHRB 5KU6epY2OtO9FQFmIo2PtcUSrRwGt4SlF1+t0ht+mxfQVhsbzSLDnITG9FJrZ5bPeBgMFYIXWqBDk ytk0Y/BbbYrE7FaP5Df740DD0ykHKauFtB88Fn4g3n1/OgtX5cwSy77jkAUGhsGOSooGdrFam5D9q wstS9sxIPEeTcd53GzpVsUmEXuVtoi1q8rvwhYuSmeAqoUljRXtk/9iyqA5bPz2Efo9n3Uxx7Td5T 51xlC9xg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tDUAO-0000000DZgS-3I8q; Tue, 19 Nov 2024 19:45:40 +0000 Received: from mail-db8eur05on20630.outbound.protection.outlook.com ([2a01:111:f403:2614::630] helo=EUR05-DB8-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tDU9R-0000000DZQ5-473N for linux-arm-kernel@lists.infradead.org; Tue, 19 Nov 2024 19:44:43 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=qqOJBwiOzWNyfbyvNPq13BM83RfZIQwb4pbpoawnnQl1eZarbviVk+7m3lSwgYKkwmUp8TJ5/v2laUxvkJLnvFJvAmK6Ds9zGGz1IR4xwwlrKSObKi22QIEjVzSKngfoUOsFtItIVSbDMHSHdlL1L5Rv7t+5UxX75N8VLVQV1auHeZxtmEyy/2oTN+0cUBtp06HMZf8TQa42hwUdI9CzMmMXVuVHXTw/ug9H4KJRJrlwWlohcOcLnztpIvlCwdYKYC0NlpP93mMQmtCqzgBBlPoJK0Ts0ZHKYMdlb+JfjpJNTgJeO8DWRXOr629QdFHlQR2sHXLxj30jgDRws1mI6w== 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=DfdzY+3TdLFWlO+OUTtsUU+jP1elxIXTvN0R+8efR3U=; b=wgrwsxTEaguujDthQD6mZNH7BFvQ8+Et6NZe5/Eiogviq+R3ecvsDw4yPsZQxyGbwn4dAXzoNlpouXG5wugifUIi14hQE3RxAoNJbhkxcUs7aUum8x0Kpyq8fKJIZwjl4RekOeLnlUb90QlFhUi/rXNCGelK1aXVbrbDzlvwDeBCHv/NUnFwrC7lVraGdlxjGuTya2rnKAZAS4O5wGhRoDGrWP8ogRjBxvK7Z7C1/8fQPg3zuHCKpgO5LH/m2JxeivxfuYuf81cXSKJrOqFOB1DLOx4/HVMT6PZS/pMBRHUzM/pGpBNvjam3vgSQfm6J18vM3pnYh8PbG2iIgCOPQQ== 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=DfdzY+3TdLFWlO+OUTtsUU+jP1elxIXTvN0R+8efR3U=; b=Ywpjj4y57mGYM4QMZx9NSfU5xUgmMkuHtHbWTjMNYBvDXI5bd7HVuJpLuEC46D3/cgYvM7fk7w1MaYpLjruZXAssXjJOtoEwqdcSUC+Q2aZy5UkRYa8GlUovR6F69qrQdBKoTLHBN5qT8CrFyDT7yAGDDxfFzOI7QO24R2NCt9+JaP9mirx8zhvHDRapY0dqVuP7bABRD0s58BtQPZYJsKSzxCa8sNDB4IcWppnyra9sLdzlR0cRiKQLxfHDSySJt9zxKX04//jryERDTy1KQyqEamLPdBaxNnNqlamJL0IpOLOPikrS411Lp9RfME0nZCyULUVPLs2swkIlMNgrHg== 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 GVXPR04MB11068.eurprd04.prod.outlook.com (2603:10a6:150:215::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8158.22; Tue, 19 Nov 2024 19:44:34 +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.8158.021; Tue, 19 Nov 2024 19:44:34 +0000 From: Frank Li Subject: [PATCH v8 0/7] PCI: dwc: opitimaze RC Host/EP pci_fixup_addr() Date: Tue, 19 Nov 2024 14:44:18 -0500 Message-Id: <20241119-pci_fixup_addr-v8-0-c4bfa5193288@nxp.com> X-B4-Tracking: v=1; b=H4sIAJLqPGcC/3XQwU7EIBAG4FfZcLZmgBmge/I9jNkUGFwOtk2rz ZpN3126B9NKPP6Q74eZu5h5yjyL8+kuJl7ynIe+BPd0EuHa9e/c5FiyUKAQWoXNGPIl5dvXeOl inJrOkXGp9d5rFAWNE5fbR+HrW8nXPH8O0/ejf5Hb6b9Vi2ygIRsldq3kgOmlv43PYfgQW9Gi9 thUWBXMSAoJJceER6x3WEOFdcEOmC1oUinYI8ZfLAFchbFgRUwKwJD14YhphyVVmAoOHIlMcKQ sHLHZYVW/bLaZPfsQXYqY/izM7nFbYbvNrCXEoDB5u/v2uq4/GvtSqBgCAAA= 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 , Conor Dooley X-Mailer: b4 0.13-dev-e586c X-Developer-Signature: v=1; a=ed25519-sha256; t=1732045469; l=8321; i=Frank.Li@nxp.com; s=20240130; h=from:subject:message-id; bh=ZHfAqHp2FUc8L0ahnN6zqGKA8d6SniNCeP/YcqMxWMU=; b=JXrwzs+UuA2n/sYPhUOVhreK1Z9pZNKE86g8AFm5wT5PpqldU9MsxIgmm6e8ljubN9dKTpQLJ cxU4LCKA9CcCG7veElSZzfGwEYPUk9p2m85T43rOh6Nv4eS4bItqw7j X-Developer-Key: i=Frank.Li@nxp.com; a=ed25519; pk=I0L1sDUfPxpAkRvPKy7MdauTuSENRq+DnA+G4qcS94Q= X-ClientProxiedBy: SJ0PR05CA0009.namprd05.prod.outlook.com (2603:10b6:a03:33b::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_|GVXPR04MB11068:EE_ X-MS-Office365-Filtering-Correlation-Id: 25271a61-b9a1-45b8-0ea1-08dd08d297b7 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|366016|52116014|376014|7416014|921020|38350700014; X-Microsoft-Antispam-Message-Info: =?utf-8?q?vdP5btKgS1djAPOuNxShs/xCAZ+/dl7?= =?utf-8?q?SaXMbndDBIblmgk4hCJzr5cTULXfxbiSvTg41FUOrEpQj/0l/kQfa2HBYzsIsyx7J?= =?utf-8?q?+2U0lJ6uA+I5UYqOhRh8757YpKtkjqivnMXA1iNxz8A1vvSLkU2/5jow5lAO7ax/C?= =?utf-8?q?FNLrvY9KraHoqDnaTwlX9wAAIyhFgUSJ9GeNmHMwezrWNoG50J2KTSijpCXvvbcOj?= =?utf-8?q?ITOiYVbnQDp82AXY8kcgFtrJ3sn6PAbryVDAHsz/QP54q8QBsf5H5TFUdctk0OlmE?= =?utf-8?q?6HDWyMlcH8Lzfx57BqGAlCJohc4D+8GoNIyyVDkzoxwKSoTstu/F0PkzKNX4cp7yr?= =?utf-8?q?jp0G8YUlTvB2vcpEiDi+JEA6WZ3P5dZJROfdI7FvWfpE3SRX4fY+AsjHTdVBrSO0a?= =?utf-8?q?lG66lwekOTl0FQZS7ayIivhaqFn+dptjKKF6hTxE4G9woGypJ3YsJQZhb0GfcVEv9?= =?utf-8?q?rAJFjH/YZOY8GSaGhhM4eh2mSeg29yJKI6POQXgWM48iod34t1w/K2b/FM8HclldO?= =?utf-8?q?EC18kxOYsa56345oBdEm+yIYowDnl9Wv482XYyi/6kkCeMPXMh/KSK2pVKcA0JLAm?= =?utf-8?q?/TvY5x7QbDily3CJ3QRCCaF4B1eWuu9Bo4lBMVbe96uFh5fickb01tm7tt92QNzys?= =?utf-8?q?PXmr6cVzL9GhO0qAIlcpJN3QuHSz7SEz5nvaQHLal0Gtwy1Cb6TRI4Xmsd5WlDf4N?= =?utf-8?q?6hOj9LPYpo4dMjI7Narr0zYZirtOws+5ZQyjXXpYC8cmfWGR0Z8Phh3zKH0J4jYau?= =?utf-8?q?Hnd6rnvy8u0XfOzdpmY5/vpkb23v1Q2b4OOVwFHMgQJY8zSkgs+8eh2YW029JFZYT?= =?utf-8?q?PNHVEesY6ifNR38tPT8pYe36+p8xhftniUOoWzCWwno4jl7kss06QXGYWUQlg9c9c?= =?utf-8?q?i17cG8Qerffyy2n8xF4GhcyDqsi4Qd10qhy42KFw3DftGgViWc8fhqN68Az92a9A0?= =?utf-8?q?sdM1P5++DoiZJiAq6YY/fea21/iASAZFlt1BLXxXTxvhLC/BZhIziyl+hinQJGHeb?= =?utf-8?q?zV+Z3mCzOdxb+ZjP+qxDX7lrg71T/JwUN22cG2kXFy/12S/ApoeCVxm8K7k2Hy1CO?= =?utf-8?q?ixTv9Ll6OZ64OeCmFHRt2lUZXoXX9Md3O1DZQM3lKr2iC72VRg5egP/fDDDaxzWc7?= =?utf-8?q?xbjCm9IaJDx86/NPZXzIbyuYGUUoNPdsVOM8yaWQVXo7zMW+mqhOLj3ZByM7XN880?= =?utf-8?q?55yfPDuadnc30jMrQwVHe53flcletjYAvFs7a4sexD4+ylB7CDQ8VzJ+/sdGQ11jX?= =?utf-8?q?pDC4HXyU9GfjawfIOMRQoemHHnzTnbnIdqowTIxaUcKEv42ScjCtCrPmx0JWaA586?= =?utf-8?q?71dDnRsfWoHH?= 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)(366016)(52116014)(376014)(7416014)(921020)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?OXvjKkeH1DnT8qU9do7hqJSWbcB8?= =?utf-8?q?ZZuNJ4/9RmuDo+WxCkgErOT6lCLTOwV3Q23qVnRx/kT4ZxIlTRKU3tUIDozw4M0GM?= =?utf-8?q?3wi583xwbJnCSU5lFwzEWz0SYrgqAOmhvAneqNxnZQVdomfudFCbmDDyWaADa0ZTy?= =?utf-8?q?SQTeBB1gAfO300hF4xXKmIaA1hvUbOzXe+RHIKO++3QBAhw/pJ9GzBm9vlqzjF0z9?= =?utf-8?q?NgjQ6kaojkqSnBxu8FmIHtgc7VbhEiKRbTBRqWbls++MT+90JeQ6IviOmYgKXrfjT?= =?utf-8?q?kvBwxI0yTJJFbpXp0kUzLOqQ2/UQqCqdnOX1EBGbydR++juHB8JzU/phnFAxUhN/p?= =?utf-8?q?RQNb0a7AZRBtmbUop6XfFBE+cMvdtmKqx7YJujOcDln4yGE+YLG6XtBv2EMaPHJOJ?= =?utf-8?q?CLD4R3KfQbWNGpd6J2UtdijXTCCjIW6og2i1NeJnsoLTun0r0l9x/852YmKHVvO/h?= =?utf-8?q?L9MYdrZek6PXw+9GfempvKDsdpBrVsqx+0ea2UdssLT6fFP1nnWabmqJ89KLvpkB5?= =?utf-8?q?0LAAQhOCjcFnG57SGr/M8EYaE1zp1QauUTjbRVvB6vFMgPQoEfa1P9lUN6kxbmlRP?= =?utf-8?q?1eZ8K4UGqyFPe3fbbkgbmXLHBdADyNq8hKB3pHbPI05VVUcCG2t8ZPzS7k06Dacuf?= =?utf-8?q?OepCgj3/8kvBC0XJzYCweNifgcd+02A1VLaotmK+5NpN9j9phwgvSAucYIavJTLFE?= =?utf-8?q?SUCZIpSgSKXSffHh+Jc9iygnnSQV78ZbCJf552Y9h6bdc6wFefkujHzfP2Zqh/H93?= =?utf-8?q?qBfnec3iwrqQrnQ/mA5BKC4PHE6vtVlA/94Q5NzXaZ7q1048JS/Daa4vbhAVSW03p?= =?utf-8?q?wESZs2hCOtN6AjH0Ln0vQ6c3RNQgR9j/JwiTaCPav3WbqhC0xb12WVKcmW+gaEK+t?= =?utf-8?q?FicrSj6VRNFvSKVblhVb9hHn/CN+e2iFM8zGN6u2QdnUflFGWJCOz5qqzO6+MIKs+?= =?utf-8?q?15yL1M0weFv0ENzVMF3dH0M5BGGnFg7cLqXpKgTWOwsK7zP43CazYMPO33F+l/Q2E?= =?utf-8?q?fDNdugzDEBLe8pOSKjfAcg9itkF+kd5VIkZtC+Bf3c9C8yuevoG1mqMRsoRVyEP89?= =?utf-8?q?gaP8FSEw2ct/sPc5+ZxpgncEHzc5SzrxULDhjkOEoheOaoKutH2osBglZ3oegxDfa?= =?utf-8?q?DjADDA6MAH1rwCCnaT4+9tBspZwSRSPiT0M3wecCZ8cY2Z86rsUy7RymnsXHTT9vt?= =?utf-8?q?oRDYeYbyZXImunW6kiESg7/SV534XzCeoPfmQp90ePJQFMvZrTenCJJiLO2OvYwGZ?= =?utf-8?q?FuOHsidQhNPcQzJIrhlOE2cx6Tqin6QDUxiZnNMpmOTAGlt3DBZ0wD0I5lSvbp/Q8?= =?utf-8?q?DXP9zPW12pVjQCGX8M+dO/0eZprju8NSReIXOEqS4jI+FT98iD9xiUvGxc0a3n+Ja?= =?utf-8?q?eSPTIB0pDVySXXOcpxKFRx9lRGSGHxDvwTEAUzHRP/4FlFh8lk7d51ZrgVzR8NvCH?= =?utf-8?q?8zk8i7wyO1eJH0K/6Fg1dwm+7pRs0qAcvr0w9HTS6yvUkKk1vD+u2HXs=3D?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 25271a61-b9a1-45b8-0ea1-08dd08d297b7 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9642.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Nov 2024 19:44:33.9571 (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: 6E7G7ZgDVEfvEZrU1hNDAB2IYd6xkktQHbpgFT9Qv6b/oB6sgNgXybgN/Zpto+BJXCQ8numCYHMRp/u3bVVi3w== X-MS-Exchange-Transport-CrossTenantHeadersStamped: GVXPR04MB11068 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241119_114442_172383_2FC28860 X-CRM114-Status: UNSURE ( 6.34 ) X-CRM114-Notice: Please train this message. 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 == RC side: ┌─────────┐ ┌────────────┐ ┌─────┐ │ │ 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 └────────────┘ Current dwc implimemnt, pci_fixup_addr() call back is needed when bus fabric convert cpu address before send to PCIe controller. 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>; ... }; }; Device tree already can descript all address translate. Some hardware driver implement fixup function by mask some bits of cpu address. Last pci-imx6.c are little bit better by fetch memory resource's offset to do fixup. static u64 imx_pcie_cpu_addr_fixup(struct dw_pcie *pcie, u64 cpu_addr) { ... entry = resource_list_first_type(&pp->bridge->windows, IORESOURCE_MEM); return cpu_addr - entry->offset; } But it is not good by using IORESOURCE_MEM to fix up io/cfg address map although address translate is the same as IORESOURCE_MEM. This patches to fetch untranslate range information for PCIe controller (pcie@5f010000: ranges). So current config ATU without cpu_fixup_addr(). == EP side: Endpoint ┌───────────────────────────────────────────────┐ │ pcie-ep@5f010000 │ │ ┌────────────────┐│ │ │ Endpoint ││ │ │ PCIe ││ │ │ Controller ││ │ bus@5f000000 │ ││ │ ┌──────────┐ │ ││ │ │ │ Outbound Transfer ││ │┌─────┐ │ Bus ┼─────►│ ATU ──────────┬┬─────► ││ │ │ Fabric │Bus │ ││PCI Addr ││ CPU ├───►│ │Addr │ ││0xA000_0000 ││ │CPU │ │0x8000_0000 ││ │└─────┘Addr└──────────┘ │ ││ │ 0x7000_0000 └────────────────┘│ └───────────────────────────────────────────────┘ bus@5f000000 { compatible = "simple-bus"; ranges = <0x80000000 0x0 0x70000000 0x10000000>; pcie-ep@5f010000 { reg = <0x5f010000 0x00010000>, <0x80000000 0x10000000>; reg-names = "dbi", "addr_space"; ... ^^^^ }; ... }; Add `bus_addr_base` to configure the outbound window address for CPU write. The BUS fabric generally passes the same address to the PCIe EP controller, but some BUS fabrics convert the address before sending it to the PCIe EP controller. Above diagram, CPU write data to outbound windows address 0x7000_0000, Bus fabric convert it to 0x8000_0000. ATU should use BUS address 0x8000_0000 as input address and convert to PCI address 0xA000_0000. Previously, `cpu_addr_fixup()` was used to handle address conversion. Now, the device tree provides this information. The both pave the road to eliminate ugle cpu_fixup_addr() callback function. Signed-off-by: Frank Li --- Changes in v8: - Add mani's review tages - use rename use_dt_ranges to use_parent_dt_ranges - Add dev_warn_once to reminder to fix their dt file and remove cpu_fixup_addr() callback. - rename dw_pcie_get_untranslate_addr() to dw_pcie_get_parent_addr() - Link to v7: https://lore.kernel.org/r/20241029-pci_fixup_addr-v7-0-8310dc24fb7c@nxp.com Changes in v7: - fix | Reported-by: kernel test robot | Closes: https://lore.kernel.org/oe-kbuild-all/202410291546.kvgEWJv7-lkp@intel.com/ - Link to v6: https://lore.kernel.org/r/20241028-pci_fixup_addr-v6-0-ebebcd8fd4ff@nxp.com Changes in v6: - merge RC and EP to one thread! - Link to v5: https://lore.kernel.org/r/20241015-pci_fixup_addr-v5-0-ced556c85270@nxp.com Changes in v5: - update address order in diagram patches. - remove confused 0x5f00_0000 range - update patch1's commit message. - Link to v4: https://lore.kernel.org/r/20241008-pci_fixup_addr-v4-0-25e5200657bc@nxp.com Changes in v4: - Improve commit message by add driver source code path. - Link to v3: https://lore.kernel.org/r/20240930-pci_fixup_addr-v3-0-80ee70352fc7@nxp.com Changes in v3: - see each patch - Link to v2: https://lore.kernel.org/r/20240926-pci_fixup_addr-v2-0-e4524541edf4@nxp.com Changes in v2: - see each patch - Link to v1: https://lore.kernel.org/r/20240924-pci_fixup_addr-v1-0-57d14a91ec4f@nxp.com --- Frank Li (7): of: address: Add parent_bus_addr to struct of_pci_range PCI: dwc: Use devicetree 'ranges' property to get rid of cpu_addr_fixup() callback PCI: dwc: ep: Add bus_addr_base for outbound window PCI: imx6: Remove cpu_addr_fixup() dt-bindings: PCI: fsl,imx6q-pcie-ep: Add compatible string fsl,imx8q-pcie-ep PCI: imx6: Pass correct sub mode when calling phy_set_mode_ext() PCI: imx6: Add i.MX8Q PCIe Endpoint (EP) support .../devicetree/bindings/pci/fsl,imx6q-pcie-ep.yaml | 38 ++++++++++++++- drivers/of/address.c | 2 + drivers/pci/controller/dwc/pci-imx6.c | 46 +++++++++-------- drivers/pci/controller/dwc/pcie-designware-ep.c | 18 ++++++- drivers/pci/controller/dwc/pcie-designware-host.c | 57 +++++++++++++++++++++- drivers/pci/controller/dwc/pcie-designware.c | 9 ++++ drivers/pci/controller/dwc/pcie-designware.h | 8 +++ include/linux/of_address.h | 1 + 8 files changed, 155 insertions(+), 24 deletions(-) --- base-commit: 9852d85ec9d492ebef56dc5f229416c925758edc change-id: 20240924-pci_fixup_addr-a8568f9bbb34 Best regards, --- Frank Li