Message ID | 20241028-pci_fixup_addr-v6-0-ebebcd8fd4ff@nxp.com (mailing list archive) |
---|---|
Headers | show
Return-Path: <linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org> 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 1FC53D3E2BA for <linux-arm-kernel@archiver.kernel.org>; Mon, 28 Oct 2024 19:23:41 +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=9tBRfIekk94DetId1/L6u4TFTEvgLVVmyFl3H+t/D4g=; b=g0yEQNtebuayZWxhPBl8EyVe9T gXkqtlGcqzHV90cYkVH5EKSHHu7z2MIoVLMYDrL96Su+ZidTCYco2aVu5S0sr0Oc8o5/buSsurmWc eM0HgFfLpUEnN39VkNG2wrUqofXyP5RxIQ1d6j7kjG/4AA1FL6rbNtyG85ym+O0i2DyJv32zGjjwz 2XZ25T158GgLw92aREdzkYGioJZMzZo53TcCzn7x8tIJJe0XRdm0oLXc243OUIfXjoiG12EhLjGQb i/wUNhsXKXqpqOZNelNiQMx+d7AuGe99LmaNrZMwGMwjg9edtfsV5m0lQExTOCQrQ8MrYZK6HXaaY /Gavct6w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1t5VKq-0000000Bzg6-012s; Mon, 28 Oct 2024 19:23:28 +0000 Received: from mail-vi1eur05on2060f.outbound.protection.outlook.com ([2a01:111:f403:2613::60f] helo=EUR05-VI1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1t5V4F-0000000BwcZ-1KWy for linux-arm-kernel@lists.infradead.org; Mon, 28 Oct 2024 19:06:21 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=EDgxOLDLRKKYZMKri3J1+bQgc7qmG+aQCHNa9oWzTjkjBHCQIKInQHpiFx2py+Pjvp4s0j40ERTkRA5TUVxIq01YpODILsahOA5pEri5Rm+akrL1akDmA+lMddzae2xckObVkCTt0BtFjTPKDAsPpEvMqDcjgYsJF/GQtKIq7fK85JVsZkzk711ZRApeLNwdnu7xKr5CJb4MYfnt+EahAXuJbcH44vw0vHcdmPqqUEKVV5B5aH92t6GTvl8m3V4u9MaARTQKTbYon5fCPBPABydcVKTs1Dc5VufCmYPGGGRvUO8w2g3IV6pvZDwH/Pys2BmS1j3siKgE6qi71N7xWg== 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=9tBRfIekk94DetId1/L6u4TFTEvgLVVmyFl3H+t/D4g=; b=dfRvTW6yO8kN6BXDURSpM29uRtsLfSNAsE/vkT2mntvMBmDMnLSolifTCdZ0twN4i0Zq8o1zq86EASIH3RKXpjvnvAN3KDayL/cLwSTnmNCR4kbl8aAtjQn88m0KgqIcVVSV7GnaNHLmTObr2a6elVpzo36FfuAT2KZzbUk5H6u+8wAb7Wf0EQh6eq6uhc3y8wUNkhZRBO331oTrQ7K72cVXrCwKXMNA6xSzYBw3ezLVuM1MC3rt2+7xrg3DKH8W59jn5KHBw+Q0Ph1BxhvVFZ7vERkDSisqzKFpZG0225GAMJKUDFQbyivwub2bTXV5IXCbPtKsy+oE/u4CgXDXTQ== 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=9tBRfIekk94DetId1/L6u4TFTEvgLVVmyFl3H+t/D4g=; b=RyRpOYmdoS4dKhflw+8BW0/AxDqU6hWWbS1rHoFVrm6xOnohiZPsYnCbvqcShXxRgaZvoAUFe04zwDpzIncM5qCIwzD9Lcn0lJ+R4Xr5xCtZGYx2iJSdpHYyVOYzG0KSrJ5z4+VX8HCs5SuvdQinEjKz4Fc68HRJHiuTrAxDsrAkXH0QpXfQwYpEEjSoVohoO/UnVUJSyfZcyvWVBE3QbS/Bm/Ui4pQUKqZb6boUI1LElYkKIhkxkPhX/anNB7kwAfrscYMdny4W8DHmLQlJuXWxlKYOCIueKlMyKgRu7RFeVuR1Lv5I/5CgBX00agSkBtT+YvWNoTLqJnhGgC6pwg== 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 PAWPR04MB9718.eurprd04.prod.outlook.com (2603:10a6:102:381::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.25; Mon, 28 Oct 2024 19:06:08 +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.8093.021; Mon, 28 Oct 2024 19:06:08 +0000 From: Frank Li <Frank.Li@nxp.com> Subject: [PATCH v6 0/7] PCI: dwc: opitimaze RC Host/EP pci_fixup_addr() Date: Mon, 28 Oct 2024 15:05:54 -0400 Message-Id: <20241028-pci_fixup_addr-v6-0-ebebcd8fd4ff@nxp.com> Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit X-B4-Tracking: v=1; b=H4sIAJLgH2cC/3XMQW7DIBCF4atErEs1wAzgrHqPqIpsGBoWtS3cW Kki370ki9aW1eWb0fffxcQl8ySOh7soPOcpD30d9uUgwqXtP1jmWLfQoBEajXIM+Zzy7Tqe2xi LbD1Zn5qu6wyKisbC9fsMnt7rvuTpayjfz/6sHtd/U7OSIMlFhW2jOGB662/jaxg+xSM06zW2O 6wrZiSNhIpjwi02K2xgh03FHpgdGNIpuC3GX6wA/A5jxZqYNIAl14UtphVWtMNUceBIZIMn7eA PL8vyAwSUJQ+eAQAA To: Rob Herring <robh@kernel.org>, Saravana Kannan <saravanak@google.com>, Jingoo Han <jingoohan1@gmail.com>, Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>, Lorenzo Pieralisi <lpieralisi@kernel.org>, =?utf-8?q?Krzysztof_Wilczy?= =?utf-8?q?=C5=84ski?= <kw@linux.com>, Bjorn Helgaas <bhelgaas@google.com>, Richard Zhu <hongxing.zhu@nxp.com>, Lucas Stach <l.stach@pengutronix.de>, Shawn Guo <shawnguo@kernel.org>, Sascha Hauer <s.hauer@pengutronix.de>, Pengutronix Kernel Team <kernel@pengutronix.de>, Fabio Estevam <festevam@gmail.com> 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 <Frank.Li@nxp.com>, Conor Dooley <conor.dooley@microchip.com> X-Mailer: b4 0.13-dev-e586c X-Developer-Signature: v=1; a=ed25519-sha256; t=1730142363; l=7655; i=Frank.Li@nxp.com; s=20240130; h=from:subject:message-id; bh=iuSQq7Mw93AFN7aqGRy3fNroxbvP+2q0TneS7rqN/TQ=; b=k3xeGYsLF59FTMWpMlu1AvT1woldZKo/77BcU9XanTNpsX7trI/H1vsd3f5YcAnAXbjfQDa0E EgApPByDTrLDpRJ5vlhhG6STZuuuxexx1y1JsoeOZ02pRJA7UhswFCy X-Developer-Key: i=Frank.Li@nxp.com; a=ed25519; pk=I0L1sDUfPxpAkRvPKy7MdauTuSENRq+DnA+G4qcS94Q= X-ClientProxiedBy: BYAPR03CA0005.namprd03.prod.outlook.com (2603:10b6:a02:a8::18) To PAXPR04MB9642.eurprd04.prod.outlook.com (2603:10a6:102:240::14) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB9642:EE_|PAWPR04MB9718:EE_ X-MS-Office365-Filtering-Correlation-Id: aecc68e7-bb46-485d-17f5-08dcf7839453 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|52116014|7416014|376014|366016|1800799024|921020|38350700014; X-Microsoft-Antispam-Message-Info: =?utf-8?q?wV3GvRaJUT4uGcCYBYsGh51xG1BTxTu?= =?utf-8?q?66kXlskGa5WR9SdYUEyo1XrLHWYcsna0VHrf+tbplz0GRIUl7xiuI3u+9EaD7a7SN?= =?utf-8?q?oH/id+uqFD3ilHXB9SMh35Ec5YPuodxjsE7f+icNdP3udx1nER6h+0Id3wwHqpAqF?= =?utf-8?q?PCG0H8AQ6+1q1GptKah0ZLKPAwLx9cWmgRwOfD7gT/YpbmRZGuk/Odt8PZhhHo0sj?= =?utf-8?q?Z3OcMP+aj4+cQ25icQeXy8GwvcbNtLYDib1lwvi5TelD2PepxDjVSsGqA65onb75Y?= =?utf-8?q?A7VUdnCwy0vj4M4gAQueVgexjqTodADkYSdHKYzuaHkkhea8asO5dH29I/7MeWRqp?= =?utf-8?q?/9UZvANl4HVI/qzAbzVMd1Ym/SqpyK2qV5oUNrGoychFQurAxG1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?= =?utf-8?q?MP4K7VDVO9sFDXou/uuCfqL54MAOGJJAO0HbR9n26UAf41/1ZASKLQ325m4vM+Zah?= =?utf-8?q?t1gcSA8EYBYi?= 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)(7416014)(376014)(366016)(1800799024)(921020)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?2tdWVVuhx6yDV8sLfJd8zki59EVP?= =?utf-8?q?cXRGClgN+nomtVSwopoBUd+oEitbyYgOV9o6nJGEwn7swdt49MfEZRNkG7gBVCwHi?= =?utf-8?q?iLsn07Ds9fv4+oqFKpIykdByf8wWTdB/0L2apWNwPeSyedFeg4U788UtBMXCS4FzD?= =?utf-8?q?KNG3yKLcEzcWV6/haEeoLI0Ee90t+mWbT41uM0N+Q40j5WR6kGxavOWVLQx+ltn0R?= =?utf-8?q?qMM6lGm6uLwWg+G5cuT6mks1sQGx/Q/utV7+p6KHf3rjmtuO7F4GV55yr/6Rd84FA?= =?utf-8?q?sTIAUDj2UITZzla//YVWhzBSRDuUpFSX0K8NLa+FkmqJ+QWlXpBYq/6BaXc9h++C7?= =?utf-8?q?7J2nd3yAGkeP7WuIembaE85UYf8nkr81I9js0IPdfukrHn6IhKe/xwTKYMKW1Roj0?= =?utf-8?q?KIkVq35zi2ECpYlem9OjWYVOPnRElE3lzoFFIq8HVm+b05YLsvyHLN+iVtc4Ri6/3?= =?utf-8?q?p5+64/niB74m18sChvfZJ0YFnFGCpvz343COggYjuPadAQD2wy6l8/9r/QAZ+jtmI?= =?utf-8?q?E8VrlfTE6gV1dyG/7zUmAcVHF0Z86X8NB3cCutCYJkU850Gx05T5PW1dnfuIfpBpf?= =?utf-8?q?EeoBWYAVCG1rVhArk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zfUOPr/OI1OFHAj7zmENI9WoJ43yTXZrlcrpE4D?= =?utf-8?q?DeajZC9GVC1k?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: aecc68e7-bb46-485d-17f5-08dcf7839453 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9642.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Oct 2024 19:06:08.2318 (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: jS25ULJc/CVIQ8i85K7TDgba2v9U6biy2fixnzX+NU3R961s7GzMqLplMXadPwm7qtmMVkbYYSpJmgl5tZ7VVA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAWPR04MB9718 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241028_120619_554766_3B45CBAC X-CRM114-Status: UNSURE ( 6.15 ) 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: <linux-arm-kernel.lists.infradead.org> List-Unsubscribe: <http://lists.infradead.org/mailman/options/linux-arm-kernel>, <mailto:linux-arm-kernel-request@lists.infradead.org?subject=unsubscribe> List-Archive: <http://lists.infradead.org/pipermail/linux-arm-kernel/> List-Post: <mailto:linux-arm-kernel@lists.infradead.org> List-Help: <mailto:linux-arm-kernel-request@lists.infradead.org?subject=help> List-Subscribe: <http://lists.infradead.org/mailman/listinfo/linux-arm-kernel>, <mailto:linux-arm-kernel-request@lists.infradead.org?subject=subscribe> Sender: "linux-arm-kernel" <linux-arm-kernel-bounces@lists.infradead.org> Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org |
Series |
PCI: dwc: opitimaze RC Host/EP pci_fixup_addr()
|
expand
|
== 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 <Frank.Li@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: Using parent_bus_addr in of_range to eliminate cpu_addr_fixup() 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 | 21 +++++++++- drivers/pci/controller/dwc/pcie-designware-host.c | 49 ++++++++++++++++++++++ drivers/pci/controller/dwc/pcie-designware.h | 9 ++++ include/linux/of_address.h | 1 + 7 files changed, 143 insertions(+), 23 deletions(-) --- base-commit: 9852d85ec9d492ebef56dc5f229416c925758edc change-id: 20240924-pci_fixup_addr-a8568f9bbb34 Best regards, --- Frank Li <Frank.Li@nxp.com>