Message ID | 20240821130217.957424-1-daire.mcnamara@microchip.com (mailing list archive) |
---|---|
Headers | show
Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.153.233]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 46861161936; Wed, 21 Aug 2024 13:02:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=68.232.153.233 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724245376; cv=none; b=KcPY724p0gfu08rQ+VQrE5MP4FlCevB9sXMsUBjTcLFz3Y47R0fvCTwWLlMwineqHczm91oQr2mynbTsZHswcrueR3RlcqO7XWHYf/iUN/DEm9Zh7KftBm4vkITEekCOP7VyR9dhzoqFgCJE5rEM6/th6tnpJv2r636XeGj2Li4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724245376; c=relaxed/simple; bh=x6LQnN6SDzjn/rxoZUZ1RPLYVFe7KbXlQWQUWbXyAaw=; h=From:To:CC:Subject:Date:Message-ID:MIME-Version:Content-Type; b=DwqTea4lGoQRJbLXLs8uJEmu1oIHQalWtiGViDc1tRacF/yQcjecOnDz90+J6qJ5ZyEk3nYYlxxRNyKzkIRN2jV1r12zB4VUdMk10ha6H/Fm8gZ/nyNg77EaHUXWMpemHnzcLv/ygrUBujepGMTcnbGPx63EQsUU+6PGN+cogO4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=microchip.com; spf=pass smtp.mailfrom=microchip.com; dkim=pass (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b=QPWlPep5; arc=none smtp.client-ip=68.232.153.233 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=microchip.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=microchip.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b="QPWlPep5" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1724245373; x=1755781373; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=x6LQnN6SDzjn/rxoZUZ1RPLYVFe7KbXlQWQUWbXyAaw=; b=QPWlPep5KG4oQ8hz46h4Ofa+h2EtVm67WVv7bN6KO1KwO2MGj61c32A+ 401ZudSwMpDkz1PfZbFifzvJJefWepSjJ2SFDW6N2IdzOKmxf39unTnJ9 qS1F6tFQPbooSadT1egpEbS1bFDSL6LpO9r3OgKMfjnS7SWxfp27MggZH WWgH8iAj+k6b6qbpizTPCk/G3Qg14sM6Goz7lWp93I43t6ZcQXWqu7m25 T4Z+NV/wmag0pZP3tWjjkXH4tGAfLf8QnDaor5f5NVPsfQtetv/+qFMKe BqNtQ+cjTWcl0E5srrK2dG99EpRkRF12iSrwIydmGzjr9UwpHozg/Et4S Q==; X-CSE-ConnectionGUID: hYt9Btb/Rtq04w/yiOUfIw== X-CSE-MsgGUID: LBQgrfELS8GSDRRnRIlW3w== X-IronPort-AV: E=Sophos;i="6.10,164,1719903600"; d="scan'208";a="30743849" X-Amp-Result: SKIPPED(no attachment in message) Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa3.microchip.iphmx.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 21 Aug 2024 06:02:52 -0700 Received: from chn-vm-ex01.mchp-main.com (10.10.85.143) by chn-vm-ex01.mchp-main.com (10.10.85.143) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Wed, 21 Aug 2024 06:02:29 -0700 Received: from daire-X570.microchip.com (10.10.85.11) by chn-vm-ex01.mchp-main.com (10.10.85.143) with Microsoft SMTP Server id 15.1.2507.35 via Frontend Transport; Wed, 21 Aug 2024 06:02:25 -0700 From: <daire.mcnamara@microchip.com> To: <linux-pci@vger.kernel.org>, <devicetree@vger.kernel.org> CC: <conor.dooley@microchip.com>, <lpieralisi@kernel.org>, <kw@linux.com>, <robh@kernel.org>, <bhelgaas@google.com>, <linux-kernel@vger.kernel.org>, <linux-riscv@lists.infradead.org>, <krzk+dt@kernel.org>, <conor+dt@kernel.org>, <daire.mcnamara@microchip.com>, <ilpo.jarvinen@linux.intel.com> Subject: [PATCH v8 0/3] Fix address translations on MPFS PCIe controller Date: Wed, 21 Aug 2024 14:02:14 +0100 Message-ID: <20240821130217.957424-1-daire.mcnamara@microchip.com> X-Mailer: git-send-email 2.34.1 Precedence: bulk X-Mailing-List: linux-pci@vger.kernel.org List-Id: <linux-pci.vger.kernel.org> List-Subscribe: <mailto:linux-pci+subscribe@vger.kernel.org> List-Unsubscribe: <mailto:linux-pci+unsubscribe@vger.kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain |
Series |
Fix address translations on MPFS PCIe controller
|
expand
|
From: Daire McNamara <daire.mcnamara@microchip.com> 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 v7: - Rebased on top of 6.11rc1 Changes since v6: - Added Reviewed-by: Ilpo tag to outbound patch - Fixed typos/capitalisation/etc as suggested by Ilpo Changes since v5: - Reverted setup_inbound_atr size parameter to u64 as ci system reported SZ_4G getting truncated to 0 on mips when I try to use size_t or resource_size_t. Added Acked-by tags 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 <Signed-off-by: tag> 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 + .../pci/controller/plda/pcie-microchip-host.c | 120 +++++++++++++++++- drivers/pci/controller/plda/pcie-plda-host.c | 17 ++- drivers/pci/controller/plda/pcie-plda.h | 6 +- drivers/pci/controller/plda/pcie-starfive.c | 5 + 5 files changed, 141 insertions(+), 9 deletions(-) base-commit: 8400291e289ee6b2bf9779ff1c83a291501f017b