Received: by 10.223.176.5 with SMTP id f5csp2425238wra; Thu, 8 Feb 2018 13:59:32 -0800 (PST) X-Google-Smtp-Source: AH8x226UTYAGHct6HR1DZ9ZJH1q2XeaDZRj2X4lQbjHBX9GqJbf/7E7hxeJg09E2F8eI2otjz31P X-Received: by 10.98.34.139 with SMTP id p11mr471571pfj.119.1518127172615; Thu, 08 Feb 2018 13:59:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518127172; cv=none; d=google.com; s=arc-20160816; b=DkJgtXbk/PnF8CJeDhFXnkKhW+KDD0SbFzWX0pzm7cFwpguqZe5Z0U7W60QvdHqgqK Kxum/ra2XXpP1dj7UkXdI/CcoMsDplvGiv12Gte7JIPXx16/8GZVeHUjkHCxgI2mwUoJ EA9eAjVriUhqtBYbjqBnTi6LHwtXUalxDBqO8Xyzd1jyV9BSY+oeu9V4usxqXMVCzK5s rc9JO4u5cPvZzhO228AJRCTIoECoQD1tasBiASRheRpP8oxl/0x+W6yOncmZ0VB19e/O bDBA+u6UsHyzyYurt4kTjN3j19DyuxEvN/1S4rLC8q6g3Nv4GNufPKkoC8O29xXuj8A/ THNg== 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:dmarc-filter:arc-authentication-results; bh=F1WD5HDRkxJb0Bl1N+BRZTqPQpcY5S5NHSmG3m4X34k=; b=zIBL3pdB0B5vFvbI+VDb6CAV7xZh5+mis30HT/IYvM+ZE0hdiHbIN1WE62cPUCYrqP IvWKOsaAV2+eYTxfw2bzGdkC3McuqMBeZvqzxk+bQ4lxfS2d+CRHfQZYlIAz+AYtMqaP y0EIcIqRvN7ru5vQtsWIAadODcbY8VBExFP/H0r97hDIOSsneIr7Cbr2WjaLhQvryZ8v 1rCwl2GWYhcwWO2jHQonkCDLSmYiKEFgnupgN68v+Bduuh85IktM9Yc1LEdyMPOc6I/g kwGS5w6i1dSYAO4lQyLDwalWTOzn6EioeYW7aFtR40s+U5t9FpiiVTobUPh8B5lR0kQR 9vSQ== 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 k66si474826pgk.539.2018.02.08.13.59.11; Thu, 08 Feb 2018 13:59:32 -0800 (PST) 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 S1752574AbeBHV5l (ORCPT + 99 others); Thu, 8 Feb 2018 16:57:41 -0500 Received: from mail.kernel.org ([198.145.29.99]:54462 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752514AbeBHV5i (ORCPT ); Thu, 8 Feb 2018 16:57:38 -0500 Received: from localhost (unknown [69.71.4.159]) (using TLSv1.2 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 69F2121796; Thu, 8 Feb 2018 21:57:37 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 69F2121796 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=helgaas@kernel.org Date: Thu, 8 Feb 2018 15:57:35 -0600 From: Bjorn Helgaas To: Kishon Vijay Abraham I Cc: Niklas Cassel , Lorenzo Pieralisi , Bjorn Helgaas , Sekhar Nori , Cyrille Pitchen , Niklas Cassel , Shawn Lin , John Keeping , linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2 1/3] PCI: endpoint: Handle 64-bit BARs properly Message-ID: <20180208215735.GD98765@bhelgaas-glaptop.roam.corp.google.com> References: <20180208123346.20784-1-niklas.cassel@axis.com> <20180208123346.20784-2-niklas.cassel@axis.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Feb 08, 2018 at 06:17:32PM +0530, Kishon Vijay Abraham I wrote: > Hi, > > On Thursday 08 February 2018 06:03 PM, Niklas Cassel wrote: > > A 64-bit BAR uses the succeeding BAR for the upper bits, therefore > > we cannot call pci_epc_set_bar() on a BAR that follows a 64-bit BAR. > > > > If pci_epc_set_bar() is called with flag PCI_BASE_ADDRESS_MEM_TYPE_64, > > Not related to $patch. But I have a query on when > PCI_BASE_ADDRESS_MEM_TYPE_64 should be set. Whether if the size is > > 4G or if the address can be mapped anywhere in the 64-bit PCIe > address space or both? In general, PCI_BASE_ADDRESS_MEM_TYPE_64 should be set if the BAR is 64 bits wide. IORESOURCE_MEM_64 is similar. It doesn't matter what the current value of the BAR is. It's easy to look at the current address or size of a resource if we need to know where it is or how big it is. But if we lose track of the width of the BAR register, we have no way to know whether it's *capable* of holding a 64-bit value. > > it has to be up to the controller driver to write both BAR[x] and BAR[x+1] > > (and BAR_mask[x] and BAR_mask[x+1]). > > > > Signed-off-by: Niklas Cassel > > --- > > drivers/pci/endpoint/functions/pci-epf-test.c | 2 ++ > > 1 file changed, 2 insertions(+) > > > > diff --git a/drivers/pci/endpoint/functions/pci-epf-test.c b/drivers/pci/endpoint/functions/pci-epf-test.c > > index 800da09d9005..eef85820f59e 100644 > > --- a/drivers/pci/endpoint/functions/pci-epf-test.c > > +++ b/drivers/pci/endpoint/functions/pci-epf-test.c > > @@ -382,6 +382,8 @@ static int pci_epf_test_set_bar(struct pci_epf *epf) > > if (bar == test_reg_bar) > > return ret; > > } > > + if (flags & PCI_BASE_ADDRESS_MEM_TYPE_64) > > + bar++; > > } > > > > return 0; > >