Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp432572pxj; Fri, 28 May 2021 07:17:34 -0700 (PDT) X-Google-Smtp-Source: ABdhPJydDA6FW6hM+W5rDAsi+v5q5/cy2LM/btoWP2D2lQjN2zzq5CRBLT44qqpzeIpBhMPQYPgD X-Received: by 2002:a05:6e02:1c82:: with SMTP id w2mr7800904ill.15.1622211454063; Fri, 28 May 2021 07:17:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622211454; cv=none; d=google.com; s=arc-20160816; b=Hdj8KJp4M/opDFCFQXwPKQ2O5L04z+bgbre0RvS9ldW/rtsU4BgaOo2OTXldN1AFZ9 fjDw57/psCNVYhd8ax1qNzq1ZZh4YkO+Clhl9nsM6g5yDC0WMmFAplQCqgiPY0hv9lzR 3bHRJpgrNDUXeSjrQqOYUXRSG/l84kj7dd1Djf+s8C1DL631JUYesviDHuTu/E8cg9ec jeXPOr9/dNWrH97o9e0wtJQBUD7L3aU9GrpX7RQUksbTYF500eA27tupw+wXFXA0dEN0 vdL9q4pSnUmf6v8EMyMrI8A3oLSTbBD0zNrTHL/VXuUfW/t/7o/6O3DU9qIXZ68W2fsf SPjQ== 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=XZxKZYYhRdMgsx3AaVQx5MeKzRXu4NQ7JSlA+sHAgEs=; b=wYToqfQqdJjKHIq9C128m+f1OvFdhd6t5w0UkfVbzvUkl2mt+GLBBgTpMOwv7PcPhX oOgWtws6eaAENfDLgNf5GpDtd6Bs69y25yGUGyaFzgFrBT29pjESmnqh7oxlda3T4+yM UBH1bgpc4sFyQVKBYXjdcWtF8muaWWLyq5adzV2bbk4tHbsTJ8zZGfTEzLcv1Zfr/GoS 7KkChQuNFs6NuCZUn9u+I2T4Eqk6RPD5QdEuerWUfMuwa1MhRFYNztCHqu2ulwyAvZA0 5AKCkzR+A3MLS/RF5YvsHJNGJHTw8UCJAjTvDfUQQUL+Fv9zdqJbsMOK4pJf2pgBu3YB Qdwg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=mraF9r98; 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 p9si5981378iov.92.2021.05.28.07.17.17; Fri, 28 May 2021 07:17:34 -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=mraF9r98; 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 S234085AbhE1NZu (ORCPT + 99 others); Fri, 28 May 2021 09:25:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46858 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229653AbhE1NZt (ORCPT ); Fri, 28 May 2021 09:25:49 -0400 Received: from mail-pj1-x1035.google.com (mail-pj1-x1035.google.com [IPv6:2607:f8b0:4864:20::1035]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1BB4DC061574; Fri, 28 May 2021 06:24:14 -0700 (PDT) Received: by mail-pj1-x1035.google.com with SMTP id gb21-20020a17090b0615b029015d1a863a91so4480981pjb.2; Fri, 28 May 2021 06:24:14 -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=XZxKZYYhRdMgsx3AaVQx5MeKzRXu4NQ7JSlA+sHAgEs=; b=mraF9r984dsIkQsxnqkpHQWbcKxx1tEtELRMjGqQfqtAk6RBlxC13YGn+Txg+G1YqV nZxiCy59j+fiJlpYQbRrXUg+RlTxmBkb5JaloSa1rJpqMWntbBnadkhO5JSZIP8NyzXL 3oMjfgDJknWcM5R/QbJAujRH/3WH04xUaxacX4OQwIkTk9kyrdBcGb/nYJjT2YQS0Udy MK3hYsVa0YCyQDYhfWPS6FzNxQmaEtQjw6yzK/gt5+wKXwkbIRhpQFOS9KzJXL3/5wd6 DgLWspHyey/dMBdhO6taaK66EM4x4jHqnNPVRiorUcGKBCg85zLc2Or9y6e29MR156No +8gA== 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=XZxKZYYhRdMgsx3AaVQx5MeKzRXu4NQ7JSlA+sHAgEs=; b=CN3ct7vT4qdD7WuXIik41sfosHduNGzB9/bl97gNKjw/B70rxQq8a6khRJg2GXqnD1 AnMPdHUaiDulhvWsrUrjhkW8V1yyOkga3+mmAkrwJ9ehfCHMDGyHccnI1VPTRkyDffRz htnXFWDU7q8kF1Lb4m8C6UKKXpam5w8GUfX3bN+fqVUrdEPNvEv6lVdD3OG/PW5NGKoy 4vfMbhiyOPQP7sl5McEB9BsNGR9mlGwDlYOYJRRK5kRnECfg1iT4bows+LE0TmVzKLs0 sK9JTCiwjSDevg3neTBSo5BjC5SUcCGhb/0zzKwcn1+/tVNuUAyUOIaOoCUYg79XDeW2 qH6w== X-Gm-Message-State: AOAM531bwqDg/HYBtpEUcE0VFS1LZYE4ljvOw0HHlOIKGf25wXC9Jnus T7VU+jTLP4YK0pKlfCaLPPk+u/zmJ1p0xA== X-Received: by 2002:a17:90b:1955:: with SMTP id nk21mr4494591pjb.208.1622208252425; Fri, 28 May 2021 06:24:12 -0700 (PDT) Received: from localhost (122x211x248x161.ap122.ftth.ucom.ne.jp. [122.211.248.161]) by smtp.gmail.com with ESMTPSA id t24sm4397544pji.56.2021.05.28.06.24.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 28 May 2021 06:24:11 -0700 (PDT) From: Punit Agrawal To: Rob Herring Cc: "open list:ARM/Rockchip SoC..." , PCI , linux-arm-kernel , "linux-kernel@vger.kernel.org" , Alexandru Elisei , wqu@suse.com, Robin Murphy , Peter Geis , Ard Biesheuvel , Brian Norris , Shawn Lin , Bjorn Helgaas , Bjorn Helgaas Subject: Re: [PATCH 1/2] PCI: of: Override 64-bit flag for non-prefetchable memory below 4GB References: <20210527150541.3130505-1-punitagrawal@gmail.com> <20210527150541.3130505-2-punitagrawal@gmail.com> Date: Fri, 28 May 2021 22:24:06 +0900 In-Reply-To: (Rob Herring's message of "Thu, 27 May 2021 11:38:46 -0500") Message-ID: <87h7inm1op.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 Rob Herring writes: > On Thu, May 27, 2021 at 10:06 AM Punit Agrawal wrote: >> >> Some host bridges advertise non-prefetable memory windows that are >> entirely located below 4GB but are marked as 64-bit address memory. >> >> Since commit 9d57e61bf723 ("of/pci: Add IORESOURCE_MEM_64 to resource >> flags for 64-bit memory addresses"), the OF PCI range parser takes a >> stricter view and treats 64-bit address ranges as advertised while >> before such ranges were treated as 32-bit. >> >> A PCI-to-PCI bridges cannot forward 64-bit non-prefetchable memory >> ranges. As a result, the change in behaviour due to the commit causes >> allocation failure for devices that are connected behind PCI host >> bridges modelled as PCI-to-PCI bridge and require non-prefetchable bus >> addresses. >> >> In order to not break platforms, override the 64-bit flag for >> non-prefetchable memory ranges that lie entirely below 4GB. >> >> Suggested-by: Ard Biesheuvel >> Link: https://lore.kernel.org/r/7a1e2ebc-f7d8-8431-d844-41a9c36a8911@arm.com >> Signed-off-by: Punit Agrawal >> Cc: Bjorn Helgaas >> Cc: Rob Herring >> --- >> drivers/pci/of.c | 8 ++++++-- >> 1 file changed, 6 insertions(+), 2 deletions(-) >> >> diff --git a/drivers/pci/of.c b/drivers/pci/of.c >> index da5b414d585a..b9d0bee5a088 100644 >> --- a/drivers/pci/of.c >> +++ b/drivers/pci/of.c >> @@ -565,10 +565,14 @@ static int pci_parse_request_of_pci_ranges(struct device *dev, >> case IORESOURCE_MEM: >> res_valid |= !(res->flags & IORESOURCE_PREFETCH); >> >> - if (!(res->flags & IORESOURCE_PREFETCH)) >> + if (!(res->flags & IORESOURCE_PREFETCH)) { >> if (upper_32_bits(resource_size(res))) >> dev_warn(dev, "Memory resource size exceeds max for 32 bits\n"); > > Based on Ard's explanation, doesn't this need to also check for > !IORESOURCE_MEM_64? Right - I was too focussed on the below case. > >> - >> + if ((res->flags & IORESOURCE_MEM_64) && !upper_32_bits(res->end)) { > > res->end is the CPU address space. Isn't it the PCI address space we > care about? Indeed. I suspect the easiest way to check PCI addresses would be to move the check to where the range property is being parsed. I'll address both the comments with the next update. Thanks, Punit > >> + dev_warn(dev, "Overriding 64-bit flag for non-prefetchable memory below 4GB\n"); >> + res->flags &= ~IORESOURCE_MEM_64; >> + } >> + } >> break; >> } >> } >> -- >> 2.30.2 >> > > _______________________________________________ > Linux-rockchip mailing list > Linux-rockchip@lists.infradead.org > http://lists.infradead.org/mailman/listinfo/linux-rockchip