# HG changeset patch
# User awilliam@xxxxxxxxxxxx
# Date 1167948725 25200
# Node ID 98f48cf14d9842ae5b17266ede0231b88699ffea
# Parent 613ccf4ca46bbc3a75b0414eb54aed6c5e40cabf
[IA64] Fix dom0 builder so that xen doesn't assign memory on I/O area.
Signed-off-by: Alex Williamson <alex.williamson@xxxxxx>
Signed-off-by: Isaku Yamahata <yamahata@xxxxxxxxxxxxx>
---
xen/arch/ia64/xen/dom_fw.c | 83 ++++++---------------------------------------
1 files changed, 12 insertions(+), 71 deletions(-)
diff -r 613ccf4ca46b -r 98f48cf14d98 xen/arch/ia64/xen/dom_fw.c
--- a/xen/arch/ia64/xen/dom_fw.c Thu Jan 04 14:50:26 2007 -0700
+++ b/xen/arch/ia64/xen/dom_fw.c Thu Jan 04 15:12:05 2007 -0700
@@ -516,10 +516,10 @@ complete_dom0_memmap(struct domain *d,
{
efi_memory_desc_t *md;
u64 addr;
- int j;
void *efi_map_start, *efi_map_end, *p;
u64 efi_desc_size;
int i;
+ unsigned long dom_mem = maxmem - (d->tot_pages << PAGE_SHIFT);
/* Walk through all MDT entries.
Copy all interesting entries. */
@@ -566,26 +566,22 @@ complete_dom0_memmap(struct domain *d,
case EFI_LOADER_DATA:
case EFI_BOOT_SERVICES_CODE:
case EFI_BOOT_SERVICES_DATA:
- /* Create dom0 MDT entries for conventional memory
- below 1MB. Without this Linux will assume VGA is
- present because 0xA0000 will always be either a hole
- in the MDT or an I/O region via the passthrough. */
-
- end = min(ONE_MB, end);
-
- /* Avoid firmware and hypercall area.
- We know they are 0-based. */
- if (end < FW_END_PADDR || start >= ONE_MB)
+ if (!(md->attribute & EFI_MEMORY_WB))
break;
- if (start < FW_END_PADDR)
- start = FW_END_PADDR;
-
+
+ start = max(FW_END_PADDR, start);
+ end = min(start + dom_mem, end);
+ if (end <= start)
+ break;
+
dom_md->type = EFI_CONVENTIONAL_MEMORY;
dom_md->phys_addr = start;
dom_md->virt_addr = 0;
dom_md->num_pages = (end - start) >> EFI_PAGE_SHIFT;
- dom_md->attribute = md->attribute;
+ dom_md->attribute = EFI_MEMORY_WB;
num_mds++;
+
+ dom_mem -= dom_md->num_pages << EFI_PAGE_SHIFT;
break;
case EFI_UNUSABLE_MEMORY:
@@ -601,57 +597,6 @@ complete_dom0_memmap(struct domain *d,
}
BUG_ON(num_mds > NUM_MEM_DESCS);
- sort(tables->efi_memmap, num_mds, sizeof(efi_memory_desc_t),
- efi_mdt_cmp, NULL);
-
- /* find gaps and fill them with conventional memory */
- i = num_mds;
- for (j = 0; j < num_mds; j++) {
- unsigned long end;
- unsigned long next_start;
-
- md = &tables->efi_memmap[j];
- end = md->phys_addr + (md->num_pages << EFI_PAGE_SHIFT);
-
- if (j + 1 < num_mds) {
- efi_memory_desc_t* next_md;
- next_md = &tables->efi_memmap[j + 1];
- next_start = next_md->phys_addr;
-
- /* Have just been sorted. */
- BUG_ON(end > next_start);
-
- /* No room for memory! */
- if (end == next_start)
- continue;
-
- if (next_start > maxmem)
- next_start = maxmem;
- }
- else
- next_start = maxmem;
-
- /* Avoid "legacy" low memory addresses
- and the HYPERCALL area. */
- if (end < ONE_MB)
- end = ONE_MB;
-
- // clip the range and align to PAGE_SIZE
- next_start = next_start & PAGE_MASK;
- end = PAGE_ALIGN(end);
-
- /* No room for memory. */
- if (end >= next_start)
- continue;
-
- MAKE_MD(EFI_CONVENTIONAL_MEMORY, EFI_MEMORY_WB,
- end, next_start);
-
- if (next_start >= maxmem)
- break;
- }
- num_mds = i;
- BUG_ON(num_mds > NUM_MEM_DESCS);
sort(tables->efi_memmap, num_mds, sizeof(efi_memory_desc_t),
efi_mdt_cmp, NULL);
@@ -661,9 +606,7 @@ complete_dom0_memmap(struct domain *d,
*/
for (i = 0; i < num_mds; i++) {
md = &tables->efi_memmap[i];
- if (md->phys_addr > maxmem)
- break;
-
+
if (md->type == EFI_LOADER_DATA ||
md->type == EFI_PAL_CODE ||
md->type == EFI_CONVENTIONAL_MEMORY) {
@@ -675,8 +618,6 @@ complete_dom0_memmap(struct domain *d,
/* md->num_pages = 0 is allowed. */
continue;
}
- if (end > (max_page << PAGE_SHIFT))
- end = (max_page << PAGE_SHIFT);
for (addr = start; addr < end; addr += PAGE_SIZE)
assign_new_domain0_page(d, addr);
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog
|