Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp460160ybk; Wed, 20 May 2020 04:09:04 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxbSKEmMaxhHC8m5NPOsnR/Qn9L6S5ZNE1DyoK8G2SQxSqRdFPK+438XRR94K9EGwDVwQlp X-Received: by 2002:a50:9e48:: with SMTP id z66mr2771231ede.388.1589972944062; Wed, 20 May 2020 04:09:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589972944; cv=none; d=google.com; s=arc-20160816; b=0by7Dqi44c39a4o2s8hU89gsw+U290J7DAPhNNTnO0frIo3vrLoD3EzC7Frh64+Vc2 jHcpEUZzFbiOYbRs2X5ksj3NSIQBBqXckC4Qkl0oXGPJp+SAcCNg5ODLkgfPyK7sQP8t arqLN6yXn0pOmfYu7jRsK9aHFl/NGbRDqeCyxEG1NXoWNR+SsPswYHKfxn+EBLJH5glL wbGJR/W++RAQylj8JUGdG9w2mUnN3niUT/XB1hyME0iBuERWK8i0emDImjf5a1B6AVHd VuMmdqN4ku1bAvvBqFf5dKp2bl+INE8w6d5tkoNfP/Wws39MWu7yv9AOHpFlfzJhpC8d gzZw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=mQRhG5TfmNTpCUxDvExkOyBnsPEh/FycnGea4vhKmS8=; b=m6eAmp8vKTy8em7+hS+KwaTBjLwQKWRUg+eSRljwvGgqILDhRhmfG/dfM09/OX5CqI SqdGOkDSuu8YE9vniqR3NC1bswLx6CydTFBmuWBDxjxUjJ54UtCmF1ZQq9y/Zf2GiJhy TP76Kl2iPg8dC6LAZBWAYB3RnoSGvcYN+osayuneTkpzw+fAlLhNpcvhAwnjRDDuepDS CsYt5iw6lkkmGpowoaYsYSQm64VxflF7kQtAd106QoOKZG5KUj+1Ar0lX1q8pP3sN3q8 787RF2AsVQKV4Ki3dZqqw20mEhWNHM4i3jHEII/qaBrSrUk5ArtmdKTEvOW8Vc4eCliC qLzw== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id sb26si1645850ejb.196.2020.05.20.04.08.41; Wed, 20 May 2020 04:09:04 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726790AbgETLGw (ORCPT + 99 others); Wed, 20 May 2020 07:06:52 -0400 Received: from foss.arm.com ([217.140.110.172]:53228 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726403AbgETLGu (ORCPT ); Wed, 20 May 2020 07:06:50 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 86DA431B; Wed, 20 May 2020 04:06:47 -0700 (PDT) Received: from e121166-lin.cambridge.arm.com (e121166-lin.cambridge.arm.com [10.1.196.255]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id BFF0A3F68F; Wed, 20 May 2020 04:06:45 -0700 (PDT) Date: Wed, 20 May 2020 12:06:40 +0100 From: Lorenzo Pieralisi To: Gustavo Pimentel Cc: Vidya Sagar , Bjorn Helgaas , "jingoohan1@gmail.com" , Andrew Murray , "bhelgaas@google.com" , "thierry.reding@gmail.com" , "jonathanh@nvidia.com" , "linux-pci@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "kthota@nvidia.com" , "mmaddireddy@nvidia.com" , "sagar.tv@gmail.com" , Alan Mikhak Subject: Re: [PATCH] PCI: dwc: Warn only for non-prefetchable memory resource size >4GB Message-ID: <20200520110640.GA5300@e121166-lin.cambridge.arm.com> References: <20200513190855.23318-1-vidyas@nvidia.com> <20200513223508.GA352288@bjorn-Precision-5520> <20200518155435.GA2299@e121166-lin.cambridge.arm.com> <20200519145816.GB21261@e121166-lin.cambridge.arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, May 19, 2020 at 10:08:54PM +0000, Gustavo Pimentel wrote: [...] > > > > > > diff --git a/drivers/pci/controller/dwc/pcie-designware-host.c b/drivers/pci/controller/dwc/pcie-designware-host.c > > > > > > index 42fbfe2a1b8f..a29396529ea4 100644 > > > > > > --- a/drivers/pci/controller/dwc/pcie-designware-host.c > > > > > > +++ b/drivers/pci/controller/dwc/pcie-designware-host.c > > > > > > @@ -366,7 +366,8 @@ int dw_pcie_host_init(struct pcie_port *pp) > > > > > > pp->mem = win->res; > > > > > > pp->mem->name = "MEM"; > > > > > > mem_size = resource_size(pp->mem); > > > > > > - if (upper_32_bits(mem_size)) > > > > > > + if (upper_32_bits(mem_size) && > > > > > > + !(win->res->flags & IORESOURCE_PREFETCH)) > > > > > > dev_warn(dev, "MEM resource size exceeds max for 32 bits\n"); > > > > > > pp->mem_size = mem_size; > > > > > > pp->mem_bus_addr = pp->mem->start - win->offset; > > > > > > > > That warning was added for a reason - why should not we log legitimate > > > > warnings ? AFAIU having resources larger than 4GB can lead to undefined > > > > behaviour given the current ATU programming API. > > > Yeah. I'm all for a warning if the size is larger than 4GB in case of > > > non-prefetchable window as one of the ATU outbound translation > > > channels is being used, > > > > Is it true for all DWC host controllers ? Or there may be another > > exception whereby we would be forced to disable this warning altogether > > ? > > > > > but, we are not employing any ATU outbound translation channel for > > > > What does this mean ? "we are not employing any ATU outbound...", is > > this the tegra driver ? And what guarantees that this warning is not > > legitimate on DWC host controllers that do use the ATU outbound > > translation for prefetchable windows ? > > > > Can DWC maintainers chime in and clarify please ? > > Before this code section, there is the following function call > pci_parse_request_of_pci_ranges(), which performs a simple validation for > the IORESOURCE_MEM resource type. > This validation checks if the resource is marked as prefetchable, if so, > an error message "non-prefetchable memory resource required" is given and > a return code with the -EINVAL value. That code checks if there is *at least* a non-prefetchable resource, that's all it does. > In other words, to reach the code that Vidya is changing, it can be only > if the resource is a non-prefetchable, any prefetchable resource will be > blocked by the previous call, if I'm not mistaken. I think you are mistaken sorry. > Having this in mind, Vidya's change will not make the expected result > aimed by him. I think Vidya's patch does what he expects, the question is whether it is widely applicable to ALL DWC hosts, that's what I want to know. > I don't see any problem by having resources larger than 4GB, from what > I'm seeing in the databook there isn't any restricting related to that as > long they don't consume the maximum space that is addressable by the > system (depending on if they are 32-bit or 64-bit system address). > > To be honest, I'm not seeing a system that could have this resource > larger than 4GB, but it might exist some exception that I don't know of, > that's why I accepted Alan's patch to warn the user that the resource > exceeds the maximum for the 32 bits so that he can be aware that he > *might* be consuming the maximum space addressable. I think it is most certainly a possibility to have > 4GB prefetchable address spaces so we ought to fix this for good. I still have to understand how the DWC host detects the memory region to be programmed into the ATU given that there is more than one but only 1 ATU memory region AFAICS. Lorenzo