Received: by 2002:ab2:784b:0:b0:1fd:adc2:8405 with SMTP id m11csp316243lqp; Mon, 10 Jun 2024 05:19:17 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXLq3d0tUcb/p9LBACcJuXyMlg3zigCbelzNmDlWAdFMOa74RAE3GhIKLRcM4xCtNTOoLcjsfxqaEYWalyOXwmnKLkzOlU8TY2E5ssOQA== X-Google-Smtp-Source: AGHT+IE4TZXYY+FxW7lU3LdKB7F8uiRehzC/j0NZzxM0+XXq5vn5CwIqeDT3oOIv7Mz3wHZZTPHN X-Received: by 2002:a05:6e02:1d03:b0:374:b044:6b4f with SMTP id e9e14a558f8ab-375803a2f39mr104412655ab.21.1718021957179; Mon, 10 Jun 2024 05:19:17 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718021957; cv=pass; d=google.com; s=arc-20160816; b=E8oF+mbYKvABPgA/9lbAfplwZgwjWYLIpCyxhqx0OsYkeRvNU+ZhRV0+pfFWg1xp16 9NWm9NdF4sA3cQzHQZB9FOJ1f9g5TpO8zERiprpviYIAR5pF9vllx4VHWUjcbWMKi6a0 0nmLCNfNrpJoQccgFoOYDrx22WG0LUDUw/onN3GFu5zG+tCt7IKRJqrs3NKPtPDt+Z5W CnkjvtWdweONfDJMY+1Vz3aezaMlgZ/ra8nPXG6uWHngogu3T5qDEHmCTMJ6HZHzv0F8 /Idc2PzYW4T7C1/+UtQ7xAB4I1TLRYGhMILNinKTHgloUQzT7wyQkjDQ+87od6bfWuWe RSRw== 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=QbESB85K5R2FK5WyuOcGbQEODnM0JL4Aj8H+8twrmME=; fh=M2VYh5EQA6y+fe0WwpRBy28Qhmn/wvf7ZDl318K4GAs=; b=E6KrR4Hjn5CFcHWGtC1pA9ZlYZDtb9SzP6pOhGwH+tDtdfRR/6zc6/HfurrQh3wGE5 dogwdFmV4UODC8IjQzfCNazD+XobNKQ7c6KxOTGKw4YdD8gEZOJHHRCy8wMQHY6Hlbrt 08Qq2muN00EpTj0kiYS/zWWAMxwnU7TSlSnppXOXMO/6XP6nmT/VaIdEfIqgIaFKGoKY UMilbMuWhpvB4hwWL5B5lYDeNRfOmkurX4yZUkF7lMnoFlT+G8omR6iKgN+wf7eSnsXE Nj9hEMKxGJFMFPxRqjxWHU50n0cf/SVIK7oO5Iiz3qvvAooYwZz7Rm3xOOQ22tdUErpM Lzgw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@microchip.com header.s=mchp header.b=g1irS06u; 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-208145-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-208145-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. [139.178.88.99]) by mx.google.com with ESMTPS id 41be03b00d2f7-6de29db0df8si3175570a12.779.2024.06.10.05.19.16 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 10 Jun 2024 05:19:17 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-208145-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@microchip.com header.s=mchp header.b=g1irS06u; 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-208145-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-208145-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 C3C21280E12 for ; Mon, 10 Jun 2024 12:19:16 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E26077F7E3; Mon, 10 Jun 2024 12:19:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b="g1irS06u" Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.154.123]) (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 DE9343C30; Mon, 10 Jun 2024 12:18:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=68.232.154.123 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718021941; cv=none; b=Wf33JoJ3DNcEK+dQGI7u6xOuCtS+LRX3+t5H0QbKrafVUUtuFpZEV2ZHfM0knsLncUdpp1lkJXfXjU1Po8VhKMExegIdo+RE1NliwNOp9V156sMpDT9DFcwwvtw4IMrQcD05tdc356mYZZaefr7TDHcvGJF+5Sx5k8Q8uzmYEv4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718021941; c=relaxed/simple; bh=8QGfO1kpileAbWe+k5ZoqBC+il685KZRmiU82v1PFcc=; h=From:To:CC:Subject:Date:Message-ID:MIME-Version:Content-Type; b=m8rL/3iZFU21qWvBuyF7Oh7pPbTBlaM8dyLMPmpV9iZYKfVIC2pVdlmgvhu+Vhmi36p8Cj3C6ccfwG8Cp+enSkjELEHwR1M3riJzhaQ3hYUTqpQBVHIViGYKGUX26WNe7cykJk6gmFz9OoJeoxPv2l1GXWCuy6+7/pLh7JlyDWc= 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=g1irS06u; arc=none smtp.client-ip=68.232.154.123 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=1718021938; x=1749557938; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=8QGfO1kpileAbWe+k5ZoqBC+il685KZRmiU82v1PFcc=; b=g1irS06udcN/lFgNksXVrlmOOLmCPeHKectL+yOt2Oa/hsbrKRKLGYGK kAjzv9k7xYO9BVsw89GFNY/8zWsrDD9rMSqtIPxwGOkRnDm8KjORIGcRq 2U80a1NWJb0EvhCR6LtCFlqM0Esh3ltSf3Xot/qiIMnC+4rXqMsnmZN/z 8c79cb3EYXXKW1si1tsubkiKclV827AZKJtU5Gsr1KxzPC3iMyfN8Beod 9u/w4IwOWKlmLtnWtndKDaMBrk8UzBgA90PAYxfjZsqEHKSDAJ1J8aq2V D81ZOsUO1C6XcYyJakhQFvP93KGcs/crBSy6ox/JmIHMvYziigvKoW1Sz A==; X-CSE-ConnectionGUID: u7u6WKyJQDeU5N8FYDOsMw== X-CSE-MsgGUID: hs5RZVbqRMGHXn4v/hTSUA== X-IronPort-AV: E=Sophos;i="6.08,227,1712646000"; d="scan'208";a="194605096" X-Amp-Result: SKIPPED(no attachment in message) Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa6.microchip.iphmx.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 10 Jun 2024 05:18:57 -0700 Received: from chn-vm-ex03.mchp-main.com (10.10.85.151) 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; Mon, 10 Jun 2024 05:18:26 -0700 Received: from daire-X570.microchip.com (10.10.85.11) by chn-vm-ex03.mchp-main.com (10.10.85.151) with Microsoft SMTP Server id 15.1.2507.35 via Frontend Transport; Mon, 10 Jun 2024 05:18:24 -0700 From: To: CC: , , , , , , , Subject: [PATCH v2 0/3] Fix address translations on MPFS PCIe controller Date: Mon, 10 Jun 2024 13:18:19 +0100 Message-ID: <20240610121822.2636971-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 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 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