[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH v2 2/2] hvmloader, pci: Don't try to relocate memory if 64-bit BAR is bigger than ~2GB
>>> On 29.09.16 at 01:48, <konrad.wilk@xxxxxxxxxx> wrote: > @@ -265,11 +266,30 @@ void pci_setup(void) > bars[i].devfn = devfn; > bars[i].bar_reg = bar_reg; > bars[i].bar_sz = bar_sz; > + bars[i].above_4gb = false; > > if ( ((bar_data & PCI_BASE_ADDRESS_SPACE) == > PCI_BASE_ADDRESS_SPACE_MEMORY) || > (bar_reg == PCI_ROM_ADDRESS) ) > - mmio_total += bar_sz; > + { > + /* > + * If bigger than 2GB minus emulated devices BAR space and > + * APIC space, then don't try to put under 4GB. > + */ > + if ( is_64bar && (mmio_total >= GB(2) || bar_sz >= > + (GB(2) - HVM_BELOW_4G_MMIO_LENGTH - mmio_total)) ) As mentioned in the reply to your earlier mail already, the subtraction of mmio_total here is risking wrap through zero (the >= GB(2) check doesn't fully guard against that). Furthermore you're now making behavior dependent on the order devices appear on the bus: The same device appearing early may get its BAR placed below 4Gb whereas when it appears late, it'll get placed high. IOW I think this needs further refinement: We should in a first pass place only 32-bit BARs. In a second pass we can then see which 64-bit BARs still fit (and I think we then ought to prefer small ones). Which means we should presumably account 32- and 64-bit BARs here independent of any other considerations, deferring the decision which 64-bit ones to place low until after this first pass. Jan _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx https://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |