Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp4735897pxj; Tue, 25 May 2021 15:20:51 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxEN6dtSZAf1Z9PeiRLYmmt30vSiYMpKmHT45tOdjbwmfw47W9obhzgXYKMHXpgb9LLjnbI X-Received: by 2002:a17:907:3f8a:: with SMTP id hr10mr30170994ejc.137.1621981251524; Tue, 25 May 2021 15:20:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621981251; cv=none; d=google.com; s=arc-20160816; b=ryIb2jwjxjTpPlmxpDlxQ4XodJf7tYdPq4XCDP2aUOxp0nvzHfOTwBuNrzX5P3WnoJ t7LT3AqbPmoeFvh6zOBQA2BmMIR4NpA0pXU3XBVpvOgUs8dO7pFhBTjHbSmy+o9zenyT Slb4bKl4CfP5V32OSPdZk45/RGBsiu8piCHbp0FSuTghaGVVtsel4u0xI9ZjOHvCV3Jr VoN5HNeAkeCgfxvj9DPMuXImxQ07ahsZGo/x+127jjiK4yaAScpHA4V/irl39I66sjMR n+zmim5FZCQeumU0B6SuCn3GXVThxS6IlDrp0T0LzKNprEDbCatRULEsljtrU2nr1GhY EEuQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=Gy0pwbcTfeV54c3HZ6Q+OvGmiKZGmAVKFwn7I0K4E+I=; b=Zkt5rcsnJTU8g+H/8Q7o1gBRa80pHTEkkbk8+f7bhVMAfwX5i0BT/kslM1W/+lgvWu 9MfPuaJBQ6ZhioIfMbH8TrPxkEElSKZ8X3eBhgqA4tm3Juj0J+prz9Wa69FTBKUKMC8K CXzLOseEjbK86jQMFcoxWKJt8jnil/Fycjq6VPTrg6r9+lpqjIKvkoEiz999NcIeWFhN fWOKVJX/+M59a5dFUjlKliqk4ZuCyqobTln0KkDlokDeWYMQbwLvaYR+iP4cdecsa3+Z MHMr5/EwM92UCxrTN7igye4TpMTKqb11eSqN47O7O88J7YKVRFfm63SvPrgOM9Q4Spn5 QM2w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=nQSg8+ll; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ay17si17189930edb.128.2021.05.25.15.20.28; Tue, 25 May 2021 15:20:51 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=nQSg8+ll; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232690AbhEYTpJ (ORCPT + 99 others); Tue, 25 May 2021 15:45:09 -0400 Received: from mail.kernel.org ([198.145.29.99]:51412 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229962AbhEYTpJ (ORCPT ); Tue, 25 May 2021 15:45:09 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id E641761417; Tue, 25 May 2021 19:43:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1621971818; bh=94VagTEu48UpZc/HQAm4Qi4WJ4Ve2nnq3jm9uSJgJlI=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=nQSg8+llIYt2L1WNiLKYOUWq9hC6BkoO4vLAWSQUIdPzfOkcdlK/8fPALOb75GS5R Cl7/lTXtFNDxdSVUxzoeAicp+tDSy/MJnu705Wn4zYI8czlarfviFPoRmoqjNWASVc FexY8qml3oWTEiGdQCBDdrCzFdbPsW/zFWw5oOkg/+c2C7QklTRLirKblTHQ4nBRoL DO3Quddv9ADFcfQGlUGXluycFSlrfw+cTK2fJzF4Ij2mcq+OaD/3dpeNXDWkrFp/eN jMypASCctagTk2LoCJVlnQcLTypBFJBiHhUdQNVnW5Gyf++xAh3eg1HJUiTQYBXdb4 3nl1bTKwkmBDg== Received: by mail-oi1-f181.google.com with SMTP id v22so31403192oic.2; Tue, 25 May 2021 12:43:38 -0700 (PDT) X-Gm-Message-State: AOAM533RjJhvTILIkz/a9uai3elQfNrGyWMWhVbUKJRogU53zuta2YHk RXEiF2MQoihknXXtrJh9VWMLNTnMpwOCxdbxsHQ= X-Received: by 2002:aca:1b14:: with SMTP id b20mr3336448oib.174.1621971818275; Tue, 25 May 2021 12:43:38 -0700 (PDT) MIME-Version: 1.0 References: <20210525191556.GA1220872@bjorn-Precision-5520> In-Reply-To: <20210525191556.GA1220872@bjorn-Precision-5520> From: Ard Biesheuvel Date: Tue, 25 May 2021 21:43:26 +0200 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [BUG] rockpro64: PCI BAR reassignment broken by commit 9d57e61bf723 ("of/pci: Add IORESOURCE_MEM_64 to resource flags for 64-bit memory addresses") To: Bjorn Helgaas Cc: Peter Geis , Punit Agrawal , Robin Murphy , Alexandru Elisei , Linux Kernel Mailing List , "open list:ARM/Rockchip SoC..." , arm-mail-list , Heiko Stuebner , Leonardo Bras , Rob Herring , PCI , =?UTF-8?Q?Christian_K=C3=B6nig?= Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 25 May 2021 at 21:15, Bjorn Helgaas wrote: > > On Tue, May 25, 2021 at 05:54:56PM +0200, Ard Biesheuvel wrote: > > On Tue, 25 May 2021 at 17:34, Peter Geis wrote: > > > > > > >> > On 2021-05-18 10:09, Alexandru Elisei wrote: > > > > > >> >> [..] > > > > > >> >> [ 0.305183] rockchip-pcie f8000000.pcie: host bridge /pcie@f8000000 ranges: > > > > > >> >> [ 0.305248] rockchip-pcie f8000000.pcie: MEM 0x00fa000000..0x00fbdfffff -> 0x00fa000000 > > > > > >> >> [ 0.305285] rockchip-pcie f8000000.pcie: IO 0x00fbe00000..0x00fbefffff -> 0x00fbe00000 > > > > > >> >> [ 0.373705] rockchip-pcie f8000000.pcie: PCI host bridge to bus 0000:00 > > > > > >> >> [ 0.373730] pci_bus 0000:00: root bus resource [bus 00-1f] > > > > > >> >> [ 0.373751] pci_bus 0000:00: root bus resource [mem 0xfa000000-0xfbdfffff 64bit] > > > > > >> >> [ 0.373777] pci_bus 0000:00: root bus resource [io 0x0000-0xfffff] (bus address [0xfbe00000-0xfbefffff]) > > > ... For some reason, lspci translates the BAR values to CPU > > addresses, but the PCI side addresses are within 32-bits. > > lspci shows BARs as CPU physical addresses by default. These are the > same addresses you would see in pdev->resource[n] and the same as BAR > values you would see in dmesg. > > A 64-bit CPU physical address can certainly be translated by the host > bridge to a 32-bit PCI address. But that's not happening here because > this host bridge applies no translation (CPU physical 0xfa000000 maps > to bus address 0xfa000000). > > "lspci -b" shows the PCI bus addresses. Ah, thanks. It does seem, though, that the information overload in this thread is causing confusion now. Peter shared some log output where there is definitely MMIO translation being applied. > > [ 6.673497] pci_bus 0000:00: root bus resource [io 0x0000-0xfffff] > > (bus address [0x3f700000-0x3f7fffff]) > > [ 6.674642] pci_bus 0000:00: root bus resource [mem > > 0x300000000-0x33f6fffff] (bus address [0x00000000-0x3f6fffff]) In this case, the I/O translation definitely looks wrong. On a typical ARM DT system, you will see something like [ 1.500324] Remapped I/O 0x0000000067f00000 to [io 0x0000-0xffff window] [ 1.500522] pci_bus 0000:00: root bus resource [io 0x0000-0xffff window] The MMIO window looks correct, but I suspect that both 0x82000000 and 0x83000000 in the DT ranges are describing the resource window as prefetchable, preventing the allocation of non-prefetchable BARs in this window. Peter, for the configuration listed here, could you try something like ranges = <0x1000000 0x0 0x0 [IO base in the CPU address map] [IO size]>, <0x2000000 0x0 0x0 [MMIO base in the CPU address map] [MMIO size]>;