From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752334AbeC2JvW (ORCPT ); Thu, 29 Mar 2018 05:51:22 -0400 Received: from lelnx193.ext.ti.com ([198.47.27.77]:53817 "EHLO lelnx193.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751249AbeC2JvU (ORCPT ); Thu, 29 Mar 2018 05:51:20 -0400 Subject: Re: [PATCH v5 08/12] PCI: endpoint: Handle 64-bit BARs properly To: Niklas Cassel , , Lorenzo Pieralisi , Bjorn Helgaas , Sekhar Nori , John Keeping , Niklas Cassel , Shawn Lin References: <20180328115018.31921-1-niklas.cassel@axis.com> <20180328115018.31921-9-niklas.cassel@axis.com> CC: , From: Kishon Vijay Abraham I Message-ID: <390035dc-7e33-184f-a2eb-909c09e2c455@ti.com> Date: Thu, 29 Mar 2018 15:20:51 +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: <20180328115018.31921-9-niklas.cassel@axis.com> 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 List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wednesday 28 March 2018 05:20 PM, Niklas Cassel wrote: > 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 Acked-by: Kishon Vijay Abraham I > --- > 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; >