Received: by 10.213.65.68 with SMTP id h4csp3138260imn; Mon, 2 Apr 2018 22:41:20 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+S1MMcB5Q754L2Liu6dQR08PhbtCKXo9gKGTxtHUgUDNcie51BlElAq5M8KJcoCyZQq1fE X-Received: by 10.98.89.200 with SMTP id k69mr9601553pfj.100.1522734080600; Mon, 02 Apr 2018 22:41:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522734080; cv=none; d=google.com; s=arc-20160816; b=QmUhT6shdt2g4q+PKXuFRVw98ffCA0xjJVN0euU4POi33ZAEYeFhWUVIg5eN49YgYt 7bqHNTm6UQeglqY3+irPgYZJB/imkXLHQVDGcUT8Kz6w5PfnGv2jeqYjU6dXjZ5t4HKP avVUpF1UTd/LAD/rZMYtpQD2TSGkhDba4okvxBei38LOjT8ZzE78St4TFZLoolWav1DD EbAEkAHyJd6IabufzeWxK98TxgRU1mj00/m27zm8TxrHHmz/4fpB5crFdKLBSWP9iQgL owICv010eV2CpVfjmxoWL42bT6NVHDuIYBCE4Aw5iR7II51n+uxQjghatwkMhvqGjEkx n9xA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:in-reply-to :mime-version:user-agent:date:message-id:from:cc:references:to :subject:dkim-signature:arc-authentication-results; bh=ztszfZyDCFC4/Qnqq1K8sAeXVAnYKwKC757vwVQI2GU=; b=HfEtbjvEUZIEwGgls52gQQEKT7rxm12Rwrha4Vwz6UfNQXvBjPte9crfgvz7N0tJiX 8iCCxVMYQcc7Bn9di3KbZZobrafKMdeRRGvbj8o/x9UFKhdkkIKCbkyr3c7TqkKFh6gQ tr8N7AzzoXC35N7/Zn7X6r84x8ux0biLGC0xTrqVOvmmyIV3ol4bzsGz0GW/JfnEwZme DxQ2vVjB/o/tt8q2F2xQDEXwZ0v96DW0dpADITFKWW/NMYHMbE8WtZWL9w5zR2+DFkeP ZdJC14iEcw306AIS9wF0sIh0xCAMZmlUTSnd1+gJbg30WeueBjlYa2tf8/8d6TlUBBxe jqkA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=k7KyjOrf; 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; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m18si1385869pgu.352.2018.04.02.22.41.06; Mon, 02 Apr 2018 22:41:20 -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 header.i=@ti.com header.s=ti-com-17Q1 header.b=k7KyjOrf; 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; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754782AbeDCFj7 (ORCPT + 99 others); Tue, 3 Apr 2018 01:39:59 -0400 Received: from fllnx210.ext.ti.com ([198.47.19.17]:16450 "EHLO fllnx210.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754305AbeDCFj5 (ORCPT ); Tue, 3 Apr 2018 01:39:57 -0400 Received: from dflxv15.itg.ti.com ([128.247.5.124]) by fllnx210.ext.ti.com (8.15.1/8.15.1) with ESMTP id w335df1o015951; Tue, 3 Apr 2018 00:39:41 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ti.com; s=ti-com-17Q1; t=1522733981; bh=IkLGji1shkHA+fDA1oX/XqIAuvy30vE6r6sRZNw0U9M=; h=Subject:To:References:CC:From:Date:In-Reply-To; b=k7KyjOrf+uhfDKKpaC4nlLEp9D+0KLwmBj4CkVvZQvxJ5UAYpDbSMBotam5Ffpjuo fIt92msAEAwHE5oXudtjcFu9TNY6CsuXgx3DKHuwoEeEtMwyG2/0HgYia4MzJI3V2f aT6lGOE/yk4PvHw3i9aj4dSiK/z3OrrwNeS9x7dE= Received: from DFLE104.ent.ti.com (dfle104.ent.ti.com [10.64.6.25]) by dflxv15.itg.ti.com (8.14.3/8.13.8) with ESMTP id w335df3f013303; Tue, 3 Apr 2018 00:39:41 -0500 Received: from DFLE105.ent.ti.com (10.64.6.26) by DFLE104.ent.ti.com (10.64.6.25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1261.35; Tue, 3 Apr 2018 00:39:40 -0500 Received: from dlep33.itg.ti.com (157.170.170.75) by DFLE105.ent.ti.com (10.64.6.26) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.1261.35 via Frontend Transport; Tue, 3 Apr 2018 00:39:40 -0500 Received: from [172.24.190.233] (ileax41-snat.itg.ti.com [10.172.224.153]) by dlep33.itg.ti.com (8.14.3/8.13.8) with ESMTP id w335dbBl014094; Tue, 3 Apr 2018 00:39:38 -0500 Subject: Re: [PATCH v5 06/12] PCI: designware-ep: Make dw_pcie_ep_set_bar() handle 64-bit BARs properly To: Niklas Cassel 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> CC: Niklas Cassel , , Jingoo Han , Joao Pinto , Lorenzo Pieralisi , Bjorn Helgaas , Niklas Cassel , , From: Kishon Vijay Abraham I Message-ID: Date: Tue, 3 Apr 2018 11:09:37 +0530 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 MIME-Version: 1.0 In-Reply-To: <20180402193703.GB23587@flawful.org> Content-Type: text/plain; charset="windows-1252" Content-Transfer-Encoding: 7bit X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tuesday 03 April 2018 01:07 AM, 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 I'm okay as it is as well if Lorenzo/Bjorn is also fine with it. Thanks Kishon