From: "Jan Beulich" Subject: Re: [PATCH v3 6/8] hvmloader: Load large devices into high MMIO space as needed Date: Fri, 21 Jun 2013 08:12:17 +0100 Message-ID: <51C418F102000078000DF825@nat28.tlf.novell.com> References: <1371746007-19073-1-git-send-email-george.dunlap@eu.citrix.com> <1371746007-19073-7-git-send-email-george.dunlap@eu.citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1371746007-19073-7-git-send-email-george.dunlap@eu.citrix.com> Content-Disposition: inline List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: George Dunlap Cc: Keir Fraser , Ian Campbell , Hanweidong , xen-devel@lists.xen.org, StefanoStabellini , Ian Jackson List-Id: xen-devel@lists.xenproject.org >>> On 20.06.13 at 18:33, George Dunlap wrote: > Keep track of how much mmio space is left total, as well as the amount > of "low" MMIO space (<4GiB), and only load devices into high memory > if there is not enough low memory for the rest of the devices to fit. > > Because devices are processed by size in order from large to small, > this should preferentially relocate devices with large BARs to 64-bit > space. > > v3: > - Just use mmio_total rather than introducing a new variable. > - Port to using mem_resource directly rather than low_mmio_left > > Signed-off-by: George Dunlap Reviewed-by: Jan Beulich > CC: Ian Jackson > CC: Ian Campbell > CC: Stefano Stabellini > CC: Hanweidong > CC: Keir Fraser > --- > tools/firmware/hvmloader/pci.c | 7 ++++++- > 1 file changed, 6 insertions(+), 1 deletion(-) > > diff --git a/tools/firmware/hvmloader/pci.c b/tools/firmware/hvmloader/pci.c > index 606ccca..ac55d3e 100644 > --- a/tools/firmware/hvmloader/pci.c > +++ b/tools/firmware/hvmloader/pci.c > @@ -264,8 +264,12 @@ void pci_setup(void) > bar_reg = bars[i].bar_reg; > bar_sz = bars[i].bar_sz; > > + /* Relocate to high memory if the total amount of MMIO needed > + * is more than the low MMIO available. Because devices are > + * processed in order of bar_sz, this will preferentially > + * relocate larger devices to high memory first. */ > using_64bar = bars[i].is_64bar && bar64_relocate > - && (bar_sz > (mem_resource.max - mem_resource.base)); > + && (mmio_total > (mem_resource.max - mem_resource.base)); > bar_data = pci_readl(devfn, bar_reg); > > if ( (bar_data & PCI_BASE_ADDRESS_SPACE) == > @@ -287,6 +291,7 @@ void pci_setup(void) > resource = &mem_resource; > bar_data &= ~PCI_BASE_ADDRESS_MEM_MASK; > } > + mmio_total -= bar_sz; > } > else > { > -- > 1.7.9.5 > > > _______________________________________________ > Xen-devel mailing list > Xen-devel@lists.xen.org > http://lists.xen.org/xen-devel