Skip to content

Commit

Permalink
xen/setup: Fix for incorrect xen_extra_mem_start.
Browse files Browse the repository at this point in the history
The earlier attempts (24bdb0b)
at fixing this problem caused other problems to surface (PV guests
with no PCI passthrough would have SWIOTLB turned on - which meant
64MB of precious contingous DMA32 memory being eaten up per guest).
The problem was: "on xen we add an extra memory region at the end of
the e820, and on this particular machine this extra memory region
would start below 4g and cross over the 4g boundary:

[0xfee01000-0x192655000)

Unfortunately e820_end_of_low_ram_pfn does not expect an
e820 layout like that so it returns 4g, therefore initial_memory_mapping
will map [0 - 0x100000000), that is a memory range that includes some
reserved memory regions."

The memory range was the IOAPIC regions, and with the 1-1 mapping
turned on, it would map them as RAM, not as MMIO regions. This caused
the hypervisor to complain. Fortunately this is experienced only under
the initial domain so we guard for it.

Acked-by: Stefano Stabellini <[email protected]>
Signed-off-by: Konrad Rzeszutek Wilk <[email protected]>
  • Loading branch information
konradwilk committed Jun 16, 2011
1 parent b2abe50 commit acd049c
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions arch/x86/xen/setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -227,11 +227,7 @@ char * __init xen_memory_setup(void)

memcpy(map_raw, map, sizeof(map));
e820.nr_map = 0;
#ifdef CONFIG_X86_32
xen_extra_mem_start = mem_end;
#else
xen_extra_mem_start = max((1ULL << 32), mem_end);
#endif
for (i = 0; i < memmap.nr_entries; i++) {
unsigned long long end;

Expand Down Expand Up @@ -266,6 +262,12 @@ char * __init xen_memory_setup(void)
if (map[i].size > 0)
e820_add_region(map[i].addr, map[i].size, map[i].type);
}
/* Align the balloon area so that max_low_pfn does not get set
* to be at the _end_ of the PCI gap at the far end (fee01000).
* Note that xen_extra_mem_start gets set in the loop above to be
* past the last E820 region. */
if (xen_initial_domain() && (xen_extra_mem_start < (1ULL<<32)))
xen_extra_mem_start = (1ULL<<32);

/*
* In domU, the ISA region is normal, usable memory, but we
Expand Down

0 comments on commit acd049c

Please sign in to comment.