Received: by 2002:ab2:6c55:0:b0:1fd:c486:4f03 with SMTP id v21csp372024lqp; Wed, 12 Jun 2024 04:24:07 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVWe9voIqR4uoZZBsJw4vUHINWrn+1osmzE+GyK+FdpIwy7VXpWVg+SxPANctHFktD15PFpz9ixkrOe0WYJXeMVWqjHiHJl4dI+YS2ogQ== X-Google-Smtp-Source: AGHT+IFwJ8meE3pJjHuQR0pnB23lvgcdCBUhiO9VVdTMaenzcLC+VhuY3zQgLW3AfRQTl99af4qT X-Received: by 2002:a05:6a21:999a:b0:1ac:dead:68 with SMTP id adf61e73a8af0-1b8a9c54bb5mr2844485637.24.1718191447680; Wed, 12 Jun 2024 04:24:07 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718191447; cv=pass; d=google.com; s=arc-20160816; b=dezgad7wKbDqpOTRZawrvy2RWWf4ze5Du3ORprXWknNb4kYRpKKenrrrg5BpF7G1ju yaHs5opkzpXjGTgBJ8s19yjLkE5TXsizYek3BTj3yge+Si0qV8FJT8o4GxJ5MP886DxG 6IO04FAl22/jKZ4aNo+srZkrReJ7ox8hO1pvnTWrGNX9Qusn2VkjtGQp9cyvTcqKMcMd eRHJNZ3PpmP/F0N8CQ3zzbyKQlVizM/krfMy/je5f2x1SJqh6pdEW95E6hgNJW5IV9Pa 9ZvE7FykFNL7Shbt2iHMBUUXp8BSoCTwvHRrmfDc46Q98SHsfejffdKuwqdkt3x3lQ/o Jmrg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=xk1/2Atp4Xq/01OxO9MYCAW7U+WqJmjmJpCbybcd4ZY=; fh=7q+1ouAX1wSZkCoOmYujuIF07kmFIC+4p5OHrkjCON8=; b=WVrOL2tuoOjJ2oJqtBR/UfCZlBrpzK/LP/htX29kZk6qhkFMeJCgRg9h5m2IQ5thOM BJP51hMwALsS0zNTfpePpxFOkpOeOHFChQSBv6d4RVvdG3v9zJKEt4I+UOrkpzUScguv sYjHKtoVf0Phrucg2ZAJ8RiBFkrx8bgp2IRQM2OvR3+wzFFqB044cZPYqmUGxk3sscAg c4/EkU6IXyhgG7W5aIC8sxKhVUdVQ5ApnbgIPYLAnYN7c8iy+CI6IbXCkJpOhXQN9YOs V5x8EmH78tMsi8mqdOce5qTKIQK0c+PJiZn7CdD5oFYauh2cvKbzkZq9V/LV59KQ041E hLow==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@microchip.com header.s=mchp header.b=a+3gS9zI; arc=pass (i=1 spf=pass spfdomain=microchip.com dkim=pass dkdomain=microchip.com dmarc=pass fromdomain=microchip.com); spf=pass (google.com: domain of linux-kernel+bounces-211411-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-211411-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=microchip.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id 41be03b00d2f7-6e4a5e65e43si7792979a12.358.2024.06.12.04.24.07 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Jun 2024 04:24:07 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-211411-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@microchip.com header.s=mchp header.b=a+3gS9zI; arc=pass (i=1 spf=pass spfdomain=microchip.com dkim=pass dkdomain=microchip.com dmarc=pass fromdomain=microchip.com); spf=pass (google.com: domain of linux-kernel+bounces-211411-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-211411-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=microchip.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 529332877F1 for ; Wed, 12 Jun 2024 11:24:07 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 69BA316F0FD; Wed, 12 Jun 2024 11:23:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b="a+3gS9zI" 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 7D9B216F0E1; Wed, 12 Jun 2024 11:23:28 +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=1718191410; cv=none; b=GkbAlBHiFYZ6P6bnj5BPUkF1rF6QnFILl2NCfJ4ywNRKU+1IfbU3pP2SQldXR/hyXKoMOcYDZzn9o1NHjn4Gy/AR/yRxbTfvtvqdXoLaCgspmAcwyKO+ZfC8P9o0/x28ctje2TVYIWCv9TrJtHpBikcIN6PAbMg9TYGeo41HdoU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718191410; c=relaxed/simple; bh=se7f+d0GSXWtsNYbOTjloWfdd1VeakxeFcefGN+ydGc=; h=From:To:CC:Subject:Date:Message-ID:MIME-Version:Content-Type; b=VxSWecDcFnP1Ts+Au7dMiJuxinYYU6aC4v0yXbvO7LS13wA1DyPNGadRHC1Y3WoFeD9kU84W63cynXXBNXT6rm2rL/psPsCslW9IeR1kt5BwAv3WY1NzFTB2CnRW80a6UfUIRhahqk2ZS+YreY8MTuNOwbkRJc5s1GBbJ07loKE= 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=a+3gS9zI; 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 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1718191408; x=1749727408; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=se7f+d0GSXWtsNYbOTjloWfdd1VeakxeFcefGN+ydGc=; b=a+3gS9zIwYVtq7BCPTCTs4+FAkmorQBI40RYvAeKr0o3MWxXWcvjTlHE o4TPrj9mblRkvNvwRqm6Rpu+DZ67PUqCfmdAKh0hshje6RYS5EXQyWSOW LoVCKdQKW1bGlKvvZUR9TTiSFO/q3g3ziC+2iQMcngRGAxLU62ECMsMdo azusKsdTPhtflgGCH6fAWtbfaQnP0WcFGrmgUkxA2n2Y8okeZubK4U7UK 2T1DEspQUABzZt/N9lNtC32SR3B5OlyUT4g84iAz/o/FJT2WI3tjuRr0l jNdxoqOT/NUK8pEio86UC7WvrPgrRLrtBKSHpuKoOfA6FVzYrIA6++p9Q w==; X-CSE-ConnectionGUID: hzPuRHFvRM+Wy8rrRTyffQ== X-CSE-MsgGUID: hGPkAvY2QcmND2RgQJnH6Q== X-IronPort-AV: E=Sophos;i="6.08,233,1712646000"; d="scan'208";a="29761704" X-Amp-Result: SKIPPED(no attachment in message) Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa1.microchip.iphmx.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 12 Jun 2024 04:23:22 -0700 Received: from chn-vm-ex01.mchp-main.com (10.10.85.143) by chn-vm-ex04.mchp-main.com (10.10.85.152) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Wed, 12 Jun 2024 04:22:41 -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, 12 Jun 2024 04:22:39 -0700 From: To: , CC: , , , , , , , , , Subject: [PATCH v3 0/3] Fix address translations on MPFS PCIe controller Date: Wed, 12 Jun 2024 12:22:10 +0100 Message-ID: <20240612112213.2734748-1-daire.mcnamara@microchip.com> X-Mailer: git-send-email 2.34.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain 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 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 | 107 ++++++++++++++++-- 2 files changed, 99 insertions(+), 10 deletions(-) base-commit: a38297e3fb012ddfa7ce0321a7e5a8daeb1872b6 -- 2.34.1