Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp701729pxj; Wed, 16 Jun 2021 11:32:15 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy6HzwewTCLuiQhLsWQUxBtL78mEFgX40I/swtMn9vs6rPlT440cXE3SB57G9/S+ZHsT3F1 X-Received: by 2002:a05:6e02:1ca8:: with SMTP id x8mr675261ill.163.1623868335692; Wed, 16 Jun 2021 11:32:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623868335; cv=none; d=google.com; s=arc-20160816; b=BXdOad2H2E3or70QL4D0Edb91rhmXnbVHQIgqxp1URP96dMFDdjjiDlRH72YTHqU4m lnlxx8bH8C5YBFBViFSoZnioXLd/JCj8k2j1S0/LQrAKN17R2w23yiSvrJnh7Q6dae10 /ZVpJetqm4Osc/c+VEUEIhnY3oiyzLG53oZ/9MycdCPjaLFO43Crkh9YHEz1uCgPcmcq buQ6vHU/SjV7WbN/Ivfr2dnlBCaYgzd4tlMDOT7YxLFrnpGpSLFPDmMcHIbLeRlSp4GL T42wyHDjJ6iKZejVHkgaD5uQTaSP4/owO1QGub/DBlbfH+8feY4qRDu/4F6+v8Oz7ewY hKUg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent:message-id:in-reply-to :date:references:subject:cc:to:from:dkim-signature; bh=f4MrgwtY3/W6oCFjtro8tz651lyRS/Kv4xgNCHNchVM=; b=0yUDvEvyghH20T3m2/ViDw20Qy1XXdeeCTEV7z7BHDcptRPR7zn3lJwFvZp9wgY+uL N8LH/u9bFTXAgvdmZFbANk6ZnDmiSCKguOVRxlDEaEiQ0UYubaHeTcUNqXjTXCnJZmlc uvrPtcwlkMK5oM/Lb84m8GRwtEtM4eLSzsAn378L/cNiYSWtjyrEjMUHAGRpsv11FX8Y TjXIWC8iNk+iu462gPwQGiF8nveQIgI37VLGzXaQR++QvAWLXj0ffGz2+TdgJxQbu5cx 6OyuSODX1c/dup7a7WgxdId69BFMbzjWx6Fv2iZvDNtorI1RG0N1kejxMpfovU9pcgme C2aQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Y4T9AA0W; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id c1si3128618jap.106.2021.06.16.11.32.03; Wed, 16 Jun 2021 11:32:15 -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=@gmail.com header.s=20161025 header.b=Y4T9AA0W; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232762AbhFPMzy (ORCPT + 99 others); Wed, 16 Jun 2021 08:55:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59942 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229560AbhFPMzy (ORCPT ); Wed, 16 Jun 2021 08:55:54 -0400 Received: from mail-pg1-x52f.google.com (mail-pg1-x52f.google.com [IPv6:2607:f8b0:4864:20::52f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 60A6EC061574; Wed, 16 Jun 2021 05:53:48 -0700 (PDT) Received: by mail-pg1-x52f.google.com with SMTP id n12so1854276pgs.13; Wed, 16 Jun 2021 05:53:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=f4MrgwtY3/W6oCFjtro8tz651lyRS/Kv4xgNCHNchVM=; b=Y4T9AA0WWUCuyhxDCOgE0074vUGHK/oRcYfNE1lHhkqrxCLP9BCCNT973sEJMyUb9w kwm+iM8/CpAT43FscZpF68Z3La9iKUPax7GnLBJiTOQVqGnMk2Tw9CR/OYqqiScNehHB sFVjcZ5yZRqfiD6PK7VGeuWGvzqQ9vKvEQ5vtv3JJoAuijyu1ZpgWeFbr1OrHIoQGfFa wmpV2H/29r0Pe67NLDzzQujobRGpAKW+SkupLPS/j98HxB4t+7h5aikyl4RDyBMlDGT5 vuRmPeI2Kwb5x+6l0HLTBUnKoenhLKIIsvu8sp1YuP6VQgRqiJ4DaIz3qiiMTXKVJYrR 0yzQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version; bh=f4MrgwtY3/W6oCFjtro8tz651lyRS/Kv4xgNCHNchVM=; b=M/einl4UjFPvg8VRE9xTdlWrTzPudJ/3UulmNIqeIpojVrk1NYikgy5O8OdxywzTdJ wkBYGm7gRAo1U4HPrynPWTDDDKdRbXGOzC2qkxPnIHuZhzTn8dPC67VjyLR5YSbKsZFr FFYPN4rMf6HWNziIh+6Bfee0XHlW+fY4ZwPSUbz0cuSYMmZQuVETzZxV32TIjJ8IOmPm edb8G1Hj2lPcfdjhQ2ky3Hur10MTJy/U/XWXkQCUx7KfteAIkuwKuL3YQqJdpaduR7Ux 2qncnPRHu3eDBWWYyj41bhUZIgHPc7oew1u4pleoIYZjjh3IhTlNvy3SVTWRdpO9sQLs ge9A== X-Gm-Message-State: AOAM53220969T55HEC4ULtCGc5InnnsPB9+JBCLpx/w81/s1VrsBdpHd ZfO91sIL+PxpkVqIy4np/CA= X-Received: by 2002:aa7:9ecd:0:b029:2fc:779:b187 with SMTP id r13-20020aa79ecd0000b02902fc0779b187mr7716240pfq.28.1623848027861; Wed, 16 Jun 2021 05:53:47 -0700 (PDT) Received: from localhost (122x211x248x161.ap122.ftth.ucom.ne.jp. [122.211.248.161]) by smtp.gmail.com with ESMTPSA id p9sm2211326pfo.106.2021.06.16.05.53.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Jun 2021 05:53:47 -0700 (PDT) From: Punit Agrawal To: Rob Herring Cc: Bjorn Helgaas , Marc Zyngier , Leonardo Bras , "open list:ARM/Rockchip SoC..." , linux-arm-kernel , "linux-kernel@vger.kernel.org" , PCI , Alexandru Elisei , wqu@suse.com, Robin Murphy , Peter Geis , Ard Biesheuvel , Brian Norris , Shawn Lin , Bjorn Helgaas Subject: Re: [PATCH v4] PCI: of: Clear 64-bit flag for non-prefetchable memory below 4GB References: <20210614230457.752811-1-punitagrawal@gmail.com> Date: Wed, 16 Jun 2021 21:53:45 +0900 In-Reply-To: (Rob Herring's message of "Tue, 15 Jun 2021 15:18:15 -0600") Message-ID: <878s3at1gm.fsf@stealth> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Rob, Rob Herring writes: > On Mon, Jun 14, 2021 at 5:05 PM Punit Agrawal wrote: >> >> Alexandru and Qu reported this resource allocation failure on >> ROCKPro64 v2 and ROCK Pi 4B, both based on the RK3399: >> >> pci_bus 0000:00: root bus resource [mem 0xfa000000-0xfbdfffff 64bit] >> pci 0000:00:00.0: PCI bridge to [bus 01] >> pci 0000:00:00.0: BAR 14: no space for [mem size 0x00100000] >> pci 0000:01:00.0: reg 0x10: [mem 0x00000000-0x00003fff 64bit] >> >> "BAR 14" is the PCI bridge's 32-bit non-prefetchable window, and our >> PCI allocation code isn't smart enough to allocate it in a host >> bridge window marked as 64-bit, even though this should work fine. >> >> A DT host bridge description includes the windows from the CPU >> address space to the PCI bus space. On a few architectures >> (microblaze, powerpc, sparc), the DT may also describe PCI devices >> themselves, including their BARs. >> >> Before 9d57e61bf723 ("of/pci: Add IORESOURCE_MEM_64 to resource >> flags for 64-bit memory addresses"), of_bus_pci_get_flags() ignored >> the fact that some DT addresses described 64-bit windows and BARs. >> That was a problem because the virtio virtual NIC has a 32-bit BAR >> and a 64-bit BAR, and the driver couldn't distinguish them. >> >> 9d57e61bf723 set IORESOURCE_MEM_64 for those 64-bit DT ranges, which >> fixed the virtio driver. But it also set IORESOURCE_MEM_64 for host >> bridge windows, which exposed the fact that the PCI allocator isn't >> smart enough to put 32-bit resources in those 64-bit windows. >> >> Clear IORESOURCE_MEM_64 from host bridge windows since we don't need >> that information. >> >> Fixes: 9d57e61bf723 ("of/pci: Add IORESOURCE_MEM_64 to resource flags for 64-bit memory addresses") >> Reported-at: https://lore.kernel.org/lkml/7a1e2ebc-f7d8-8431-d844-41a9c36a8911@arm.com/ >> Reported-by: Alexandru Elisei >> Reported-by: Qu Wenruo >> Suggested-by: Bjorn Helgaas >> Signed-off-by: Punit Agrawal >> Cc: Bjorn Helgaas >> Cc: Rob Herring > > I think we've beat this one to death. > > Reviewed-by: Rob Herring Thanks for taking a look. Hopefully everybody is happy with this version and the patch can get merged soon. I assume Bjorn will pick this up as a fix with Alex's Tested-by tag. Let me know if any other steps are needed. Thanks, Punit [...]