From patchwork Tue Jun 25 12:38:42 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daire McNamara X-Patchwork-Id: 13711082 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 DBF98C30658 for ; Tue, 25 Jun 2024 12:39:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-ID:Date:Subject:CC :To: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=/UEYj+Kgfso60F3fffURvwIzrpDsQw3fR1g+Hf3AhF4=; b=ZLUDDyMd0uvRlf CLRNTCh/PLwrc/t1ZddXgh7LuTHaCW80CcG2lxInq0qvm/zlM+OULYpclp0722rDZwcMH87sTDzps QSBO8tZNLB6XzDL8lOcUCpUt6Y63JeEH4f0J+hQQ8/byBU0CFcwXDy08MLM7aw/S+G+9bMg4DyRw4 hEskSb7OtY//VxKV3tKY2/HPGq7/CnTJZFsu83w0bPs9rXzOcYiReO21N9dRQTE3cTJTcncTODV2q Hjpm7mCAMAkFiWvTD2SKz/nhO4geguJ2j2rzf+EC87sM3bD0L3sJrFeuSC+5Q7+SD91AmfnMfL+pX 8ppGOCKcJZn2wsAGMlAg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sM5SB-00000002oXC-19GN; Tue, 25 Jun 2024 12:39:19 +0000 Received: from esa.microchip.iphmx.com ([68.232.154.123]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sM5S7-00000002oTz-2hSt for linux-riscv@lists.infradead.org; Tue, 25 Jun 2024 12:39:17 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1719319155; x=1750855155; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=2rOP1q+19mNvV2pPa905bRuywjshTepkMg4BN7Tkopg=; b=rzKbqF+8TmIcNVGxKB3xZsgJAXNmnJgJHInIa/MoGjDFewR/ExBF3UpD EEvr2ZFH3Ya4ZwCe2UPrRt2Avd3yFvF0FQQrMFnu+cmdkOz1pHvGOPLaW 4VTVeObnlg6okTrEvZUwOBIB9W3kDl+KT3zqgyCs0z6nWtQYEJ38P4pDp 9oI6AFU0DNwNI8/sgKlSYLfOQW+Rsy/bIaL/9vvVOa9juOMs2YEIYL2I6 g0VxLIU0dBfnZJKmbWX1lA61R0ZX38Z1r0OfNnVU8dhB+x4mKn2tsNmpT iB+uI7FMl8mXm+2BJFLxaS1P5ZoWZRP0UjR2VvoUkD/lnlYutqAojHTZ+ w==; X-CSE-ConnectionGUID: XIY+Guk0QYqx1NrauK55gg== X-CSE-MsgGUID: 3I+77c/wTei5KNm1Uv3qAA== X-IronPort-AV: E=Sophos;i="6.08,264,1712646000"; d="scan'208";a="29103139" X-Amp-Result: SKIPPED(no attachment in message) Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa2.microchip.iphmx.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 25 Jun 2024 05:39:13 -0700 Received: from chn-vm-ex02.mchp-main.com (10.10.87.72) by chn-vm-ex02.mchp-main.com (10.10.87.72) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Tue, 25 Jun 2024 05:38:39 -0700 Received: from daire-X570.microchip.com (10.10.85.11) by chn-vm-ex02.mchp-main.com (10.10.85.144) with Microsoft SMTP Server id 15.1.2507.35 via Frontend Transport; Tue, 25 Jun 2024 05:38:36 -0700 From: To: , CC: , , , , , , , , , , Subject: [PATCH v5 0/3] Fix address translations on MPFS PCIe controller Date: Tue, 25 Jun 2024 13:38:42 +0100 Message-ID: <20240625123845.3747764-1-daire.mcnamara@microchip.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240625_053915_816621_D53BBFEB X-CRM114-Status: GOOD ( 10.79 ) X-BeenThere: linux-riscv@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-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org From: Daire McNamara Hi all, On Microchip PolarFire SoC (MPFS), the PCIe controller is connected to the CPU via one of three Fabric Interface Connectors (FICs). Each FIC present to the CPU complex as 64-bit AXI-M and 64-bit AXI-S. To preserve compatibility with other PolarFire family members, the PCIe controller is connected to its encapsulating FIC via a 32-bit AXI-M and 32-bit AXI-S interface. Each FIC is implemented in FPGA logic and can incorporate logic along its 64-bit AXI-M to 32-bit AXI-M chain (including address translation) and, likewise, along its 32-bit AXI-S to 64-bit AXI-S chain (again including address translation). In order to reduce the potential support space for the PCIe controller in this environment, MPFS supports certain reference designs for these address translations: reference designs for cache-coherent memory accesses and reference designs for non-cache-coherent memory accesses. The precise details of these reference designs and associated customer guidelines recommending that customers adhere to the addressing schemes used in those reference designs are available from Microchip, but the implication for the PCIe controller address translation between CPU-space and PCIe-space are: For outbound address translation, the PCIe controller address translation tables are treated as if they are 32-bit only. Any further address translation must be done in FPGA fabric. For inbound address translation, the PCIe controller is configurable for two cases: * In the case of cache-coherent designs, the base of the AXI-S side of the address translation must be set to 0 and the size should be 4 GiB wide. The FPGA fabric must complete any address translations based on that 0-based address translation. * In the case of non-cache coherent designs, the base of AXI-S side of the address translation must be set to 0x8000'0000 and the size shall be 2 GiB wide. The FPGA fabric must complete any address translation based on that 0x80000000 base. So, for example, in the non-cache-coherent case, with a device tree property that maps an inbound range from 0x10'0000'0000 in PCIe space to 0x10'0000'0000 in CPU space, the PCIe rootport will translate a PCIe address of 0x10'0000'0000 to an intermediate 32-bit AXI-S address of 0x8000'0000 and the FIC is responsible for translating that intermediate 32-bit AXI-S address of 0x8000'0000 to a 64-bit AXI-S address of 0x10'0000'0000. And similarly, for example, in the cache-coherent case, with a device tree property that maps an inbound range from 0x10'0000'0000 in PCIe space to 0x10'0000'0000 in CPU space, the PCIe rootport will translate a PCIe address of 0x10'0000'0000 to an intermediate 32-bit AXI-S address of 0x0000'0000 and the FIC is responsible for translating that intermediate 32-bit AXI-S address of 0x0000'0000 to a 64-bit AXI-S address of 0x10'0000'0000. See https://lore.kernel.org/all/20220902142202.2437658-1-daire.mcnamara@microchip.com/T/ for backstory. Changes since v4: - Added more cleanups suggested by Ilpo Jarvinen Added cleanups for inbound v4 and outbound v3. Changes since v3: - Added nice cleanups suggested by Ilpo Jarvinen Changes since v2: - Added Changes since v1: - added bindings patch to allow dma-noncoherent - changed a size_t to u64 to pass 32-bit compile tests - allowed 64-bit outbound pcie translations - tied PCIe side of eCAM translation table to 0 Conor Dooley (1): dt-bindings: PCI: microchip,pcie-host: allow dma-noncoherent Daire McNamara (2): PCI: microchip: Fix outbound address translation tables PCI: microchip: Fix inbound address translation tables .../bindings/pci/microchip,pcie-host.yaml | 2 + drivers/pci/controller/pcie-microchip-host.c | 118 +++++++++++++++--- 2 files changed, 106 insertions(+), 14 deletions(-) base-commit: a38297e3fb012ddfa7ce0321a7e5a8daeb1872b6 prerequisite-patch-id: 18ffa3e9b0f8886d8d173845165d49d7a4a9f1cd prerequisite-patch-id: 9fc9d99faa001c3cfb2b6617656d186f609d4cb8 prerequisite-patch-id: 29f2d8291454d817b2266bedd343b3126ad2fdfa prerequisite-patch-id: bde5836bc0d45aac5f4d03e002e560cdb1333c49 prerequisite-patch-id: 632616001dfa9bdd48afc912c694d1111a7e0df8