Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp2600751pxb; Mon, 19 Apr 2021 09:17:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzphTDFhpQ3I3/0THk4wpKvtHB75oKF2kLgoY3NCdlLG9uI+mqmQ6AUsJ1OHv7YdLrThvdI X-Received: by 2002:a17:906:4a90:: with SMTP id x16mr22900138eju.44.1618849032182; Mon, 19 Apr 2021 09:17:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618849032; cv=none; d=google.com; s=arc-20160816; b=g3ujF9RXRJrLynUwGDqvt2FICh3XPcpM2f8AnrRC91bDCcbEispuXs2agMJMH0zOWp fUYe+m5WAda9qDjHJNHkCIGjoJTK1FGQKxBJYh9pqf/C6jYa0CpaET4u9HJqKi9lnCPw D2kwPM4KzFeyGznJldbJ4czxxHefir8eiYSnmbUIrYkJlExd7tJjKW3g/H19w41UA9j3 iZVXvoB5iCOSZ1Ckc008gqTt56osgWa9mPwsvWrYYyNsmho4bJHaEneoheBCGIDLKFWM f++PekEtSsZ9LLJvc6bPqBvDU1+KFCdSd3pWiuvBdojyFdtkdeAB6yds7UNvB9IfzeEv gPow== 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=1hglvV4GjA2advCM06OW1Eit/4/3I8x0HflbVk4wpuY=; b=E3zBE3evSAbfb1O2MYvKseRJBUHNfzBt7m6E7IKv24ORMndBL9yi+EYLLNuwquIKGb uDjobVO8B7SyUunxau6Tt51IVQwNtwJOzW5KqwJXdzwM51XgLvOV2/ip7nPrIvhlGk6C lucC7B5RuSRHoI5wUXsijpoGyuCsD0uGXyTdRAj0wKrOgnZAOrNo15pnTgyFQ1yNAuJI wcOLtqR4rd5WxBPViXeC3qFtMPYNLXtunazHAGgsGviVaJ9v6cdcPHHELDvrSNHmmO38 xAEoTgkS3UnkESFbLj3r2PxJjXPkPiOSRAGneSRwptHgejwrAtZvy/SUQiO9P6y6oW0v m1uQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=WNizhiRq; 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 k1si12590100ejj.10.2021.04.19.09.16.48; Mon, 19 Apr 2021 09:17:12 -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=WNizhiRq; 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 S241570AbhDSPpP (ORCPT + 99 others); Mon, 19 Apr 2021 11:45:15 -0400 Received: from mail.kernel.org ([198.145.29.99]:33942 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241127AbhDSPpO (ORCPT ); Mon, 19 Apr 2021 11:45:14 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 0D9D7611F0; Mon, 19 Apr 2021 15:44:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1618847085; bh=1hglvV4GjA2advCM06OW1Eit/4/3I8x0HflbVk4wpuY=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=WNizhiRqZajO+MiOARISqtKtGpPmaO3wBUEXBYaZcF6e7reYd0/YMFWwxNeUTgfe5 N0tLt+LESGZ0BdkDW3AuEDpdlHVeG7V2YZc2pw1QfKfGNHfgkp27nLA+HX2gYT/PlF jjwDuzd486c9+/Ek2R9WiHAh1F83drMgZjVy6M5HwtRkmYgbUgIZFHsKtDfO6a2rfA +4bBRNSkFbnMxtKkhdWLWX/zAHKy0j8hPIOlI2tARuJQBD9r8jCYQv7fwWP70ews22 4xF7qVIGlwcnhnZhLcuSOudwPys6pA43cQdtZi4ARk833UdG1HnVntK56j4MBHe2Os Gkj2cUSl0uVVQ== Received: by mail-ej1-f52.google.com with SMTP id sd23so44997192ejb.12; Mon, 19 Apr 2021 08:44:44 -0700 (PDT) X-Gm-Message-State: AOAM531EDZPieClMq1AR16vC2Kr3e/9IcnBq58qRl2APCcTPrylkvjrY kVa9dZzh7lT60OtCy5yxf8wyW3rueNksBt9ooA== X-Received: by 2002:a17:906:9ac5:: with SMTP id ah5mr22189976ejc.360.1618847083667; Mon, 19 Apr 2021 08:44:43 -0700 (PDT) MIME-Version: 1.0 References: <20210415180050.373791-1-leobras.c@gmail.com> <7b089cd48b90f2445c7cb80da1ce8638607c46fc.camel@gmail.com> In-Reply-To: <7b089cd48b90f2445c7cb80da1ce8638607c46fc.camel@gmail.com> From: Rob Herring Date: Mon, 19 Apr 2021 10:44:31 -0500 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 1/1] of/pci: Add IORESOURCE_MEM_64 to resource flags for 64-bit memory addresses To: Leonardo Bras Cc: Frank Rowand , Alexey Kardashevskiy , devicetree@vger.kernel.org, "linux-kernel@vger.kernel.org" , PCI , linuxppc-dev Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Apr 16, 2021 at 3:58 PM Leonardo Bras wrote: > > Hello Rob, thanks for this feedback! > > On Thu, 2021-04-15 at 13:59 -0500, Rob Herring wrote: > > +PPC and PCI lists > > > > On Thu, Apr 15, 2021 at 1:01 PM Leonardo Bras wrote: > > > > > > Many other resource flag parsers already add this flag when the input > > > has bits 24 & 25 set, so update this one to do the same. > > > > Many others? Looks like sparc and powerpc to me. > > > > s390 also does that, but it look like it comes from a device-tree. I'm only looking at DT based platforms, and s390 doesn't use DT. > > Those would be the > > ones I worry about breaking. Sparc doesn't use of/address.c so it's > > fine. Powerpc version of the flags code was only fixed in 2019, so I > > don't think powerpc will care either. > > In powerpc I reach this function with this stack, while configuring a > virtio-net device for a qemu/KVM pseries guest: > > pci_process_bridge_OF_ranges+0xac/0x2d4 > pSeries_discover_phbs+0xc4/0x158 > discover_phbs+0x40/0x60 > do_one_initcall+0x60/0x2d0 > kernel_init_freeable+0x308/0x3a8 > kernel_init+0x2c/0x168 > ret_from_kernel_thread+0x5c/0x70 > > For this, both MMIO32 and MMIO64 resources will have flags 0x200. Oh good, powerpc has 2 possible flags parsing functions. So in the above path, do we need to set PCI_BASE_ADDRESS_MEM_TYPE_64? Does pci_parse_of_flags() get called in your case? > > I noticed both sparc and powerpc set PCI_BASE_ADDRESS_MEM_TYPE_64 in > > the flags. AFAICT, that's not set anywhere outside of arch code. So > > never for riscv, arm and arm64 at least. That leads me to > > pci_std_update_resource() which is where the PCI code sets BARs and > > just copies the flags in PCI_BASE_ADDRESS_MEM_MASK ignoring > > IORESOURCE_* flags. So it seems like 64-bit is still not handled and > > neither is prefetch. > > > > I am not sure if you mean here: > a) it's ok to add IORESOURCE_MEM_64 here, because it does not affect > anything else, or > b) it should be using PCI_BASE_ADDRESS_MEM_TYPE_64 > (or IORESOURCE_MEM_64 | PCI_BASE_ADDRESS_MEM_TYPE_64) instead, since > it's how it's added in powerpc/sparc, and else there is no point. I'm wondering if a) is incomplete and PCI_BASE_ADDRESS_MEM_TYPE_64 also needs to be set. The question is ultimately are BARs getting set correctly for 64-bit? It looks to me like they aren't. Rob