Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp4048253pxj; Tue, 15 Jun 2021 14:20:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzDjyjMrE5zvg7+Iflghs39ZQTOoFtaoVb3IaPm16zqXpHoyJcIHy5pMiZmsokTVXk2mWmJ X-Received: by 2002:a5d:8e13:: with SMTP id e19mr1026628iod.28.1623792010556; Tue, 15 Jun 2021 14:20:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623792010; cv=none; d=google.com; s=arc-20160816; b=DS17FnZRsXYgegSm5saGv9l2YiHl/hibeUV8MtOeFMzHjCuXjUFJ2vanz9fVLxU8QF 2xx/vxzdNB4azV3yb/RFuA0WBaE8xBZY5pdUk4rTDmgATfpRaNtNK29apIgBVdE+2x4E 01UibqcokmEHawf5cAcO2DZphh4OZThTNuh7sG+UVIsLeMULc4Ac6iDbT5qpRzMDg1Tv IuGJ/Wh2ugp2Y2rwI5U2ublHiemmsI41h0SGNr3M/1AwZV8J8N0asqedkx3ZZpBn9OYk Omrs3ZEhxWNwLedeL27nNA9QyEYtzn6UFLlgR/1v/5214wJPqEa3eZzR8R055CPp74P5 G9HA== 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=/eyU/L2hAzTGaPnJnz5heTIpa49q39xtlkerBIksSxM=; b=fyjMNngiOSPbLl54cTuzBJX9gHGaw4IPj+wqZVEeMC5XeZsu4ojHsWIcpHAkzoXpGt jqnB5aly4pzOts8NbQ7NPpIWfTTS7/BlYfi3kVUBXbNYJaJM6HR1o8FjRDWOJZ5FIaG7 IugxRRwwwSMTKFL5/tXU37lt4rKCRh5pyZxlbLd2sKXChv68+5P5ee3Rho1eouun2M9J TKq4hf7GXoPQPT42sOzrApyoo1n4jBSYZM2fo6pZ7+ba7r3uPwOLz20rVpNsPEPNm3+4 Tf/r+Pl7qza9/1P1xgNktDGw/Qs9pQb6ukoTPaEt0IptsxzNQBlf6V1sg30YH6VvuC2f hqng== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=iTryfXvN; 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 k7si339623jad.43.2021.06.15.14.19.45; Tue, 15 Jun 2021 14:20:10 -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=iTryfXvN; 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 S230045AbhFOVUg (ORCPT + 99 others); Tue, 15 Jun 2021 17:20:36 -0400 Received: from mail.kernel.org ([198.145.29.99]:51620 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229992AbhFOVUe (ORCPT ); Tue, 15 Jun 2021 17:20:34 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 520DD613B1; Tue, 15 Jun 2021 21:18:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1623791909; bh=HvzPcdHo85fJo2BuQWKIos2eC9Gp+mz4aSYW3NOFLvY=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=iTryfXvN1dqS0YOr65+sQbfAeQ+Hk+TOZQ7ajsfbPem1YDIfNacvRQBtSIW+/EKJF kbYHskVsqrDD45K+xqPXn4UEWPrn8q/VvZFkPh6Swrnc8I0M5ID6LB2ldSL4nI2qFH XcJE506v09LOpTJZyCF1T+Y4Qi4KyTRD+7GHhQhl7dljH2Jt0ZBYleKFIPMVtfNqoK RF8hOkZH+/4ZgeijRy130qy0NGXSF/6pauO4kkbZIyqCtTH6mRBhqM6M9n6JDnMHfR GmDGyISJdX6IPssI5wnCkin5BWgXHYQpp7BojjQoCgv10tzpzrs5ybMGi56sU1iwb8 vz0ui0A19SeCQ== Received: by mail-ed1-f50.google.com with SMTP id s15so12076620edt.13; Tue, 15 Jun 2021 14:18:29 -0700 (PDT) X-Gm-Message-State: AOAM530iAPIVP7hZGwHwVOyJ5z9pXneF3OVufXg8FUje4Dc2V6nnnaja ulOepFg/15HDYEfgAGdORE0l1idmi85EfzF6aA== X-Received: by 2002:a05:6402:cb0:: with SMTP id cn16mr163687edb.165.1623791907827; Tue, 15 Jun 2021 14:18:27 -0700 (PDT) MIME-Version: 1.0 References: <20210614230457.752811-1-punitagrawal@gmail.com> In-Reply-To: <20210614230457.752811-1-punitagrawal@gmail.com> From: Rob Herring Date: Tue, 15 Jun 2021 15:18:15 -0600 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v4] PCI: of: Clear 64-bit flag for non-prefetchable memory below 4GB To: Punit Agrawal 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 Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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