direct-io.hg

changeset 13452:98f48cf14d98

[IA64] Fix dom0 builder so that xen doesn't assign memory on I/O area.

Signed-off-by: Alex Williamson <alex.williamson@hp.com>
Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
author awilliam@xenbuild2.aw
date Thu Jan 04 15:12:05 2007 -0700 (2007-01-04)
parents 613ccf4ca46b
children d9b2dd57fdc4
files xen/arch/ia64/xen/dom_fw.c
line diff
     1.1 --- a/xen/arch/ia64/xen/dom_fw.c	Thu Jan 04 14:50:26 2007 -0700
     1.2 +++ b/xen/arch/ia64/xen/dom_fw.c	Thu Jan 04 15:12:05 2007 -0700
     1.3 @@ -516,10 +516,10 @@ complete_dom0_memmap(struct domain *d,
     1.4  {
     1.5  	efi_memory_desc_t *md;
     1.6  	u64 addr;
     1.7 -	int j;
     1.8  	void *efi_map_start, *efi_map_end, *p;
     1.9  	u64 efi_desc_size;
    1.10  	int i;
    1.11 +	unsigned long dom_mem = maxmem - (d->tot_pages << PAGE_SHIFT);
    1.12  
    1.13  	/* Walk through all MDT entries.
    1.14  	   Copy all interesting entries.  */
    1.15 @@ -566,26 +566,22 @@ complete_dom0_memmap(struct domain *d,
    1.16  		case EFI_LOADER_DATA:
    1.17  		case EFI_BOOT_SERVICES_CODE:
    1.18  		case EFI_BOOT_SERVICES_DATA:
    1.19 -			/* Create dom0 MDT entries for conventional memory
    1.20 -			   below 1MB.  Without this Linux will assume VGA is
    1.21 -			   present because 0xA0000 will always be either a hole
    1.22 -			   in the MDT or an I/O region via the passthrough.  */
    1.23 -
    1.24 -			end = min(ONE_MB, end);
    1.25 +			if (!(md->attribute & EFI_MEMORY_WB))
    1.26 +				break;
    1.27  
    1.28 -			/* Avoid firmware and hypercall area.
    1.29 -			   We know they are 0-based.  */
    1.30 -			if (end < FW_END_PADDR || start >= ONE_MB)
    1.31 +			start = max(FW_END_PADDR, start);
    1.32 +			end = min(start + dom_mem, end);
    1.33 +			if (end <= start)
    1.34  				break;
    1.35 -			if (start < FW_END_PADDR)
    1.36 -				start = FW_END_PADDR;
    1.37 -			
    1.38 +
    1.39  			dom_md->type = EFI_CONVENTIONAL_MEMORY;
    1.40  			dom_md->phys_addr = start;
    1.41  			dom_md->virt_addr = 0;
    1.42  			dom_md->num_pages = (end - start) >> EFI_PAGE_SHIFT;
    1.43 -			dom_md->attribute = md->attribute;
    1.44 +			dom_md->attribute = EFI_MEMORY_WB;
    1.45  			num_mds++;
    1.46 +
    1.47 +			dom_mem -= dom_md->num_pages << EFI_PAGE_SHIFT;
    1.48  			break;
    1.49  
    1.50  		case EFI_UNUSABLE_MEMORY:
    1.51 @@ -604,66 +600,13 @@ complete_dom0_memmap(struct domain *d,
    1.52  	sort(tables->efi_memmap, num_mds, sizeof(efi_memory_desc_t),
    1.53  	     efi_mdt_cmp, NULL);
    1.54  
    1.55 -	/* find gaps and fill them with conventional memory */
    1.56 -	i = num_mds;
    1.57 -	for (j = 0; j < num_mds; j++) {
    1.58 -		unsigned long end;
    1.59 -		unsigned long next_start;
    1.60 -		
    1.61 -		md = &tables->efi_memmap[j];
    1.62 -		end = md->phys_addr + (md->num_pages << EFI_PAGE_SHIFT);
    1.63 -		
    1.64 -		if (j + 1 < num_mds) {
    1.65 -			efi_memory_desc_t* next_md;
    1.66 -			next_md = &tables->efi_memmap[j + 1];
    1.67 -			next_start = next_md->phys_addr;
    1.68 -			
    1.69 -			/* Have just been sorted.  */
    1.70 -			BUG_ON(end > next_start);
    1.71 -			
    1.72 -			/* No room for memory!  */
    1.73 -			if (end == next_start)
    1.74 -				continue;
    1.75 -			
    1.76 -			if (next_start > maxmem)
    1.77 -				next_start = maxmem;
    1.78 -		}
    1.79 -		else
    1.80 -			next_start = maxmem;
    1.81 -		
    1.82 -		/* Avoid "legacy" low memory addresses 
    1.83 -		   and the HYPERCALL area.  */
    1.84 -		if (end < ONE_MB)
    1.85 -			end = ONE_MB;
    1.86 -						      
    1.87 -		// clip the range and align to PAGE_SIZE
    1.88 -		next_start = next_start & PAGE_MASK;
    1.89 -		end = PAGE_ALIGN(end);
    1.90 -		
    1.91 -		/* No room for memory.  */
    1.92 -		if (end >= next_start)
    1.93 -			continue;
    1.94 -		
    1.95 -		MAKE_MD(EFI_CONVENTIONAL_MEMORY, EFI_MEMORY_WB,
    1.96 -		        end, next_start);
    1.97 -
    1.98 -		if (next_start >= maxmem)
    1.99 -			break;
   1.100 -	}
   1.101 -	num_mds = i;
   1.102 -	BUG_ON(num_mds > NUM_MEM_DESCS);
   1.103 -	sort(tables->efi_memmap, num_mds, sizeof(efi_memory_desc_t),
   1.104 -	     efi_mdt_cmp, NULL);
   1.105 -
   1.106  	/* setup_guest() @ libxc/xc_linux_build() arranges memory for domU.
   1.107  	 * however no one arranges memory for dom0,
   1.108  	 * instead we allocate pages manually.
   1.109  	 */
   1.110  	for (i = 0; i < num_mds; i++) {
   1.111  		md = &tables->efi_memmap[i];
   1.112 -		if (md->phys_addr > maxmem)
   1.113 -			break;
   1.114 -		
   1.115 +
   1.116  		if (md->type == EFI_LOADER_DATA ||
   1.117  		    md->type == EFI_PAL_CODE ||
   1.118  		    md->type == EFI_CONVENTIONAL_MEMORY) {
   1.119 @@ -675,8 +618,6 @@ complete_dom0_memmap(struct domain *d,
   1.120  				/* md->num_pages = 0 is allowed. */
   1.121  				continue;
   1.122  			}
   1.123 -			if (end > (max_page << PAGE_SHIFT))
   1.124 -				end = (max_page << PAGE_SHIFT);
   1.125  			
   1.126  			for (addr = start; addr < end; addr += PAGE_SIZE)
   1.127  				assign_new_domain0_page(d, addr);