Received: by 10.213.65.68 with SMTP id h4csp3558965imn; Tue, 3 Apr 2018 07:05:47 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+cpzJ2/OgtIv0EGLYTl8zAS0C9aD196X4o8G0imV+xZ7bPLkjDc9j/u5P+V0SGVmHwjVYF X-Received: by 2002:a17:902:30a3:: with SMTP id v32-v6mr14333237plb.123.1522764347246; Tue, 03 Apr 2018 07:05:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522764347; cv=none; d=google.com; s=arc-20160816; b=LAcorW3oQywSV8p1K7F1R1dG3me9l6i+pfjG5LvwBZ4HCScF02e+zqEWMUFyqtMBM5 PcxV67z5poo4gPvxdZ6Xpa+apZpviWDLWK0vzyceJeBWaiqDg4mpJULJPFP7k7ocei/P F8yR8OKsOrtL21K+CXJ5I6ue086+gqJn8IUBMABRBOj7nQhJE1gX41jg5clLOkmzVVBl 793Eqz8kE5SxU4YFHgG8aBwilhnXAfWHh9mXd7vqZdXpFINaTtdnpSiXBir2hQkAP8Es MVXGr3o9Ffxjk8CTG8ReURQd5BjjSYg7G6836rcJZlnwtRd+ycPtjvj+gndrvL68dYX3 Z7pg== 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:dkim-signature:arc-authentication-results; bh=ho5JDUrQPqucRcIGeR1SzH/7yFXaK+bKHaohJlxzIW8=; b=WnpIjyVl9E2zDJG/WmcBr1jn+0bvz7CVRtc6mFR7PEkhKvElsivrrn0BSnyBVqB8OG ZXCdJtrJSo7uTIwdOSPWU1JGhepXOpY4lgx34yKD2NFdLzQcZX069eH2XI5265DxrTC6 3k79Lf/gBErWriJutQbCJtHERR/3RtiosZKRdy8+DtxjSWekObUGJQfj90PZUDLseWo2 kETxRyvvzed/PfSX0z5s2qEc0uEe8J3pUqTjN2VxdtOnh8vp3HlTgBadEL/jC1hz/ba+ i1w67j/qXEOKQcIebvF1nwvTQhX/0U7CI3TEd/bufpckI9h5kCenJTIr2Vw0MhhJjP91 fFrw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass (test mode) header.i=@flawful.org header.s=mail header.b=pBv2w/mt; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a14-v6si2987009plt.341.2018.04.03.07.05.25; Tue, 03 Apr 2018 07:05:47 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass (test mode) header.i=@flawful.org header.s=mail header.b=pBv2w/mt; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751432AbeDCODR (ORCPT + 99 others); Tue, 3 Apr 2018 10:03:17 -0400 Received: from pio-pvt-msa1.bahnhof.se ([79.136.2.40]:34266 "EHLO pio-pvt-msa1.bahnhof.se" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750722AbeDCODQ (ORCPT ); Tue, 3 Apr 2018 10:03:16 -0400 Received: from localhost (localhost [127.0.0.1]) by pio-pvt-msa1.bahnhof.se (Postfix) with ESMTP id 554013F57B; Tue, 3 Apr 2018 16:03:13 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at bahnhof.se Authentication-Results: pio-pvt-msa1.bahnhof.se (amavisd-new); dkim=pass (1024-bit key) header.d=flawful.org Received: from pio-pvt-msa1.bahnhof.se ([127.0.0.1]) by localhost (pio-pvt-msa1.bahnhof.se [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id SDut8lAEjKnE; Tue, 3 Apr 2018 16:03:12 +0200 (CEST) Received: from flawful.org (h-184-10.A323.priv.bahnhof.se [155.4.184.10]) (Authenticated sender: mb274189) by pio-pvt-msa1.bahnhof.se (Postfix) with ESMTPA id 933983F512; Tue, 3 Apr 2018 16:03:11 +0200 (CEST) Received: by flawful.org (Postfix, from userid 1001) id BB90CC9A4; Tue, 3 Apr 2018 16:03:10 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=flawful.org; s=mail; t=1522764190; bh=ho5JDUrQPqucRcIGeR1SzH/7yFXaK+bKHaohJlxzIW8=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=pBv2w/mtCzaodIYDpV9Yb/bbxdpQS3R6GdjtvPcGLqZE+jvzbCDamlF6k/VScfe4G LSypgc1h46uY8/nHJtp40YwRYzbSpVVucQ2TAJ95uVwJRSzs0i5/nM/vd2Sn+GF4hI EYNtt/6AAJ1nw9xdVWC0HS30ELdURYZp+sgPlYs8= Date: Tue, 3 Apr 2018 16:03:10 +0200 From: Niklas Cassel To: Lorenzo Pieralisi Cc: Kishon Vijay Abraham I , Niklas Cassel , cyrille.pitchen@free-electrons.com, Jingoo Han , Joao Pinto , Bjorn Helgaas , Niklas Cassel , linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v5 06/12] PCI: designware-ep: Make dw_pcie_ep_set_bar() handle 64-bit BARs properly Message-ID: <20180403140310.GA28539@flawful.org> References: <20180328115018.31921-1-niklas.cassel@axis.com> <20180328115018.31921-7-niklas.cassel@axis.com> <45971780-3a46-061d-bb76-2f450401c797@ti.com> <20180402193703.GB23587@flawful.org> <20180403125312.GA18128@e107981-ln.cambridge.arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180403125312.GA18128@e107981-ln.cambridge.arm.com> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Apr 03, 2018 at 01:53:12PM +0100, Lorenzo Pieralisi wrote: > On Mon, Apr 02, 2018 at 09:37:03PM +0200, Niklas Cassel wrote: > > On Thu, Mar 29, 2018 at 03:17:11PM +0530, Kishon Vijay Abraham I wrote: > > > Hi, > > > > > > On Wednesday 28 March 2018 05:20 PM, Niklas Cassel wrote: > > > > Since a 64-bit BAR consists of a BAR pair, we need to write to both > > > > BARs in the BAR pair to setup the BAR properly. > > > > > > > > Signed-off-by: Niklas Cassel > > > > --- > > > > drivers/pci/dwc/pcie-designware-ep.c | 11 +++++++++-- > > > > 1 file changed, 9 insertions(+), 2 deletions(-) > > > > > > > > diff --git a/drivers/pci/dwc/pcie-designware-ep.c b/drivers/pci/dwc/pcie-designware-ep.c > > > > index 5a0bb53c795c..571b90f88d84 100644 > > > > --- a/drivers/pci/dwc/pcie-designware-ep.c > > > > +++ b/drivers/pci/dwc/pcie-designware-ep.c > > > > @@ -138,8 +138,15 @@ static int dw_pcie_ep_set_bar(struct pci_epc *epc, u8 func_no, > > > > return ret; > > > > > > > > dw_pcie_dbi_ro_wr_en(pci); > > > > - dw_pcie_writel_dbi2(pci, reg, size - 1); > > > > - dw_pcie_writel_dbi(pci, reg, flags); > > > > + if (flags & PCI_BASE_ADDRESS_MEM_TYPE_64) { > > > > + dw_pcie_writel_dbi2(pci, reg, lower_32_bits(size - 1)); > > > > + dw_pcie_writel_dbi(pci, reg, flags); > > > > + dw_pcie_writel_dbi2(pci, reg + 4, upper_32_bits(size - 1)); > > > > + dw_pcie_writel_dbi(pci, reg + 4, 0); > > > > + } else { > > > > + dw_pcie_writel_dbi2(pci, reg, size - 1); > > > > + dw_pcie_writel_dbi(pci, reg, flags); > > > > + } > > > > > > > > > I think this should work too? > > > dw_pcie_writel_dbi2(pci, reg, lower_32_bits(size - 1)); > > > dw_pcie_writel_dbi(pci, reg, flags); > > > > > > if (flags & PCI_BASE_ADDRESS_MEM_TYPE_64) { > > > dw_pcie_writel_dbi2(pci, reg + 4, upper_32_bits(size - 1)); > > > dw_pcie_writel_dbi(pci, reg + 4, 0); > > > } > > > > > > > Hello Kishon, > > > > I agree, your suggestion is more neat. > > > > > > Kishon, please tell me if you insist that the long if-statement > > in pci_epc_set_bar() should be split, since there are 5 different > > conditions. Because imho, having 5 succeeding if-statements isn't > > clearer than having 1 long if-statement. > > > > If Kishon agrees with me, then the review comment in this mail > > seems to be the only review comment. > > And in that case, perhaps Lorenzo wouldn't mind fixing this up. > > Or perhaps Lorenzo prefers if I reroll the whole patch series? > > I updated it myself in my pci/endpoint branch, please have a look, I > can't guarantee we can merge this for this cycle though, I will ask > Bjorn; apologies I could not be online for a while. Hello Lorenzo, your pci/endpoint branch looks good. There is no rush, merge it whenever you think is best. Have in mind that there is EP support @ patchwork for Rockchip and for pcie-designware-plat, so make sure to juggle all the branches with care :) Kind regards, Niklas