Received: by 10.213.65.68 with SMTP id h4csp345392imn; Wed, 28 Mar 2018 04:52:34 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+tY3RRpqbmhN4uaHASwEWn36x9hJjlHFq5VvV1skSXfu7gEFOp5shzIHgjm8T8Ij3nuULb X-Received: by 10.98.171.25 with SMTP id p25mr2732313pff.227.1522237954192; Wed, 28 Mar 2018 04:52:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522237954; cv=none; d=google.com; s=arc-20160816; b=Adpp+9tLz2yP2jI3g5y71Eby9ZjY7kLRUYLcf4UudGLHIrxTyd5MMqnpUTwUr2aiAq pjYAoPXMrhF0l7HteFl1GWRBiCRCzY8Xr7HZd/EvQMtNpkfeq7dyjMG2fa4cleEeBYc2 CAopaNFLGq65j4Ygdstko2BVLtMKN6v8zD13vChXm05zEt/EXB2DRfsqCeKZbOxbxiQ+ mgwYnEGvaGeuMLz2CEqwBBDzfDT4ZZQCOACyXLWAdyv3aUGmfc9d3/ITe7SGn8zQ/sQe 3LBGbmVT/g9jft+mkGqMNqQNOodnOdNP6POiGgQTibuNoL+/qQi0JXiNcoSh1SP+Gyvm 9Jng== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=ulFMULqFt3iIkOEzo+IiZMHUP6MRjl8EUPhXu/2iZD8=; b=IyF9jpOWDy4lSMlUY6vnQ+mbMgm3itB1mAp0EnUYIpVrY8NlkvVkrjaQpnPXWFb5uZ Z70Beuqqm/fdvrSodxQH496nVmECDd7Gp3vuDoIk4gn6OizsCqIFm2DXKdVCl3hukW5E yuiR/DELBbO1dcZLs7CeR94u3K64zZ+6E9yypSws7Y1iV1+kTxgOt2eBjEBpr/vYeHyG y6jQqULs566HX50c1MnK8naKv5x6GWYeYJOZ834vV/mCvgHW/S+OUZwfMX0WBG/wPyH3 R5jrDoHmdapdKxrltDiMwuk8f1IXKVb/XwPaVluMkpbUSUiMbKfr0yEKPEcUjVTRRvMS bizQ== ARC-Authentication-Results: i=1; mx.google.com; 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 m39-v6si3475024plg.151.2018.03.28.04.52.20; Wed, 28 Mar 2018 04:52:34 -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; 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 S1753008AbeC1LvJ (ORCPT + 99 others); Wed, 28 Mar 2018 07:51:09 -0400 Received: from bastet.se.axis.com ([195.60.68.11]:53987 "EHLO bastet.se.axis.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752969AbeC1LvG (ORCPT ); Wed, 28 Mar 2018 07:51:06 -0400 Received: from localhost (localhost [127.0.0.1]) by bastet.se.axis.com (Postfix) with ESMTP id C4D0C1842F; Wed, 28 Mar 2018 13:51:04 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at bastet.se.axis.com Received: from bastet.se.axis.com ([IPv6:::ffff:127.0.0.1]) by localhost (bastet.se.axis.com [::ffff:127.0.0.1]) (amavisd-new, port 10024) with LMTP id w-jk46skZekR; Wed, 28 Mar 2018 13:51:04 +0200 (CEST) Received: from boulder02.se.axis.com (boulder02.se.axis.com [10.0.8.16]) by bastet.se.axis.com (Postfix) with ESMTPS id 455BE1832D; Wed, 28 Mar 2018 13:51:04 +0200 (CEST) Received: from boulder02.se.axis.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 31BF01A077; Wed, 28 Mar 2018 13:51:04 +0200 (CEST) Received: from boulder02.se.axis.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 263331A06D; Wed, 28 Mar 2018 13:51:04 +0200 (CEST) Received: from thoth.se.axis.com (unknown [10.0.2.173]) by boulder02.se.axis.com (Postfix) with ESMTP; Wed, 28 Mar 2018 13:51:04 +0200 (CEST) Received: from lnxartpec1.se.axis.com (lnxartpec1.se.axis.com [10.88.4.10]) by thoth.se.axis.com (Postfix) with ESMTP id 19C0B412; Wed, 28 Mar 2018 13:51:04 +0200 (CEST) Received: by lnxartpec1.se.axis.com (Postfix, from userid 20283) id 14E0B40197; Wed, 28 Mar 2018 13:51:03 +0200 (CEST) From: Niklas Cassel To: kishon@ti.com, cyrille.pitchen@free-electrons.com, Lorenzo Pieralisi , Bjorn Helgaas , Sekhar Nori , John Keeping , Niklas Cassel , Shawn Lin Cc: Niklas Cassel , linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v5 08/12] PCI: endpoint: Handle 64-bit BARs properly Date: Wed, 28 Mar 2018 13:50:13 +0200 Message-Id: <20180328115018.31921-9-niklas.cassel@axis.com> X-Mailer: git-send-email 2.14.2 In-Reply-To: <20180328115018.31921-1-niklas.cassel@axis.com> References: <20180328115018.31921-1-niklas.cassel@axis.com> X-TM-AS-GCONF: 00 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org If a 64-bit BAR was set-up, we need to skip a BAR, since a 64-bit BAR consists of a BAR pair. We need to check what BAR width the epc->ops->set_bar() specific implementation actually did set-up, since some drivers, like the Cadence EP controller, sometimes sets up a 64-bit BAR, even though a 32-bit BAR was requested. Signed-off-by: Niklas Cassel --- drivers/pci/endpoint/functions/pci-epf-test.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/pci/endpoint/functions/pci-epf-test.c b/drivers/pci/endpoint/functions/pci-epf-test.c index 91274779e59f..d46e3ebabb8e 100644 --- a/drivers/pci/endpoint/functions/pci-epf-test.c +++ b/drivers/pci/endpoint/functions/pci-epf-test.c @@ -380,6 +380,13 @@ static int pci_epf_test_set_bar(struct pci_epf *epf) if (bar == test_reg_bar) return ret; } + /* + * pci_epc_set_bar() sets PCI_BASE_ADDRESS_MEM_TYPE_64 + * if the specific implementation required a 64-bit BAR, + * even if we only requested a 32-bit BAR. + */ + if (epf_bar->flags & PCI_BASE_ADDRESS_MEM_TYPE_64) + bar++; } return 0; -- 2.14.2