From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga09.intel.com ([134.134.136.24]:61744 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753235AbbJGQEW (ORCPT ); Wed, 7 Oct 2015 12:04:22 -0400 Date: Wed, 7 Oct 2015 16:04:07 +0000 (UTC) From: Keith Busch To: Keith Busch cc: Bjorn Helgaas , LKML , x86@kernel.org, linux-pci@vger.kernel.org, Jiang Liu , Thomas Gleixner , Dan Williams , Bjorn Helgaas , Bryan Veal , Ingo Molnar , "H. Peter Anvin" Subject: Re: [RFC PATCHv2] x86/pci: Initial commit for new VMD device driver In-Reply-To: Message-ID: References: <1443721454-25467-1-git-send-email-keith.busch@intel.com> <20151006231412.GF29420@localhost> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Sender: linux-pci-owner@vger.kernel.org List-ID: On Tue, 6 Oct 2015, Keith Busch wrote: > On Tue, 6 Oct 2015, Bjorn Helgaas wrote: >>> + resource_list_for_each_entry(entry, &resources) { >>> + struct resource *source, *resource = entry->res; >>> + >>> + if (!i) { >>> + resource->start = 0; >>> + resource->end = (resource_size( >>> + &vmd->dev->resource[0]) >> 20) - 1; >>> + resource->flags = IORESOURCE_BUS | >>> IORESOURCE_PCI_FIXED; >> >> I thought BAR0 was CFGBAR. I missed the connection to a bus number >> aperture. > > Right, BAR0 is the CFGBAR and is the device's aperture to access its > domain's config space. It's a new day, I'll try a new explanation on what this is about. The size of the CFGBAR determines how many bus numbers can be reached through the device's config space aperture. We are not setting the bus resource to BAR0; just determining the bus resource ending based on BAR0's size. We expect the bar to be 256M to access config space for 256 buses: 8 functions * 32 devices * 256 buses * 4k config space per function = 256M If the BAR wasn't provided 256M for any reason, we reduce the number of bus resources this domain can provide.