direct-io.hg

changeset 10299:fe35ddc5fd38

[LINUX] Set up /proc/iomem in a sensibel way to indicate
code & data resources, and a RAM area on domU.
From: Gerd Hoffmann <kraxel@suse.de>
Signed-off-by: Keir Fraser <keir@xensource.com>
author kaf24@firebug.cl.cam.ac.uk
date Thu Jun 08 10:24:48 2006 +0100 (2006-06-08)
parents 6fb0d5ad63d7
children a1b83fedc4ed
files linux-2.6-xen-sparse/arch/i386/kernel/setup-xen.c linux-2.6-xen-sparse/arch/x86_64/kernel/e820-xen.c linux-2.6-xen-sparse/arch/x86_64/kernel/setup-xen.c
line diff
     1.1 --- a/linux-2.6-xen-sparse/arch/i386/kernel/setup-xen.c	Thu Jun 08 10:11:04 2006 +0100
     1.2 +++ b/linux-2.6-xen-sparse/arch/i386/kernel/setup-xen.c	Thu Jun 08 10:24:48 2006 +0100
     1.3 @@ -1378,7 +1378,6 @@ legacy_init_iomem_resources(struct e820e
     1.4  		res->end = res->start + e820[i].size - 1;
     1.5  		res->flags = IORESOURCE_MEM | IORESOURCE_BUSY;
     1.6  		request_resource(&iomem_resource, res);
     1.7 -#ifndef CONFIG_XEN
     1.8  		if (e820[i].type == E820_RAM) {
     1.9  			/*
    1.10  			 *  We don't know which RAM region contains kernel data,
    1.11 @@ -1391,7 +1390,6 @@ legacy_init_iomem_resources(struct e820e
    1.12  			request_resource(res, &crashk_res);
    1.13  #endif
    1.14  		}
    1.15 -#endif
    1.16  	}
    1.17  }
    1.18  
    1.19 @@ -1460,8 +1458,16 @@ static void __init register_memory(void)
    1.20  	int	      i;
    1.21  
    1.22  	/* Nothing to do if not running in dom0. */
    1.23 -	if (!(xen_start_info->flags & SIF_INITDOMAIN))
    1.24 +	if (!(xen_start_info->flags & SIF_INITDOMAIN)) {
    1.25 +		struct e820entry domU_e820 = {
    1.26 +			.addr = 0,
    1.27 +			.size = max_pfn << PAGE_SHIFT,
    1.28 +			.type = E820_RAM,
    1.29 +		};
    1.30 +		legacy_init_iomem_resources(&domU_e820, 1,
    1.31 +					    &code_resource, &data_resource);
    1.32  		return;
    1.33 +	}
    1.34  
    1.35  #ifdef CONFIG_XEN
    1.36  	machine_e820 = alloc_bootmem_low_pages(PAGE_SIZE);
    1.37 @@ -1698,11 +1704,10 @@ void __init setup_arch(char **cmdline_p)
    1.38  	init_mm.brk = (PFN_UP(__pa(xen_start_info->pt_base)) +
    1.39  		       xen_start_info->nr_pt_frames) << PAGE_SHIFT;
    1.40  
    1.41 -	/* XEN: This is nonsense: kernel may not even be contiguous in RAM. */
    1.42 -	/*code_resource.start = virt_to_phys(_text);*/
    1.43 -	/*code_resource.end = virt_to_phys(_etext)-1;*/
    1.44 -	/*data_resource.start = virt_to_phys(_etext);*/
    1.45 -	/*data_resource.end = virt_to_phys(_edata)-1;*/
    1.46 +	code_resource.start = virt_to_phys(_text);
    1.47 +	code_resource.end = virt_to_phys(_etext)-1;
    1.48 +	data_resource.start = virt_to_phys(_etext);
    1.49 +	data_resource.end = virt_to_phys(_edata)-1;
    1.50  
    1.51  	parse_cmdline_early(cmdline_p);
    1.52  
     2.1 --- a/linux-2.6-xen-sparse/arch/x86_64/kernel/e820-xen.c	Thu Jun 08 10:11:04 2006 +0100
     2.2 +++ b/linux-2.6-xen-sparse/arch/x86_64/kernel/e820-xen.c	Thu Jun 08 10:24:48 2006 +0100
     2.3 @@ -44,9 +44,7 @@ unsigned long end_pfn_map;
     2.4   */
     2.5  unsigned long end_user_pfn = MAXMEM>>PAGE_SHIFT;  
     2.6  
     2.7 -#ifndef CONFIG_XEN
     2.8  extern struct resource code_resource, data_resource;
     2.9 -#endif
    2.10  
    2.11  /* Check for some hardcoded bad areas that early boot is not allowed to touch */ 
    2.12  static inline int bad_addr(unsigned long *addrp, unsigned long size)
    2.13 @@ -251,8 +249,7 @@ void __init e820_reserve_resources(struc
    2.14  		res->end = res->start + e820[i].size - 1;
    2.15  		res->flags = IORESOURCE_MEM | IORESOURCE_BUSY;
    2.16  		request_resource(&iomem_resource, res);
    2.17 -#ifndef CONFIG_XEN
    2.18 -		if (e820.map[i].type == E820_RAM) {
    2.19 +		if (e820[i].type == E820_RAM) {
    2.20  			/*
    2.21  			 *  We don't know which RAM region contains kernel data,
    2.22  			 *  so we try it repeatedly and let the resource manager
    2.23 @@ -264,7 +261,6 @@ void __init e820_reserve_resources(struc
    2.24  			request_resource(res, &crashk_res);
    2.25  #endif
    2.26  		}
    2.27 -#endif
    2.28  	}
    2.29  }
    2.30  
     3.1 --- a/linux-2.6-xen-sparse/arch/x86_64/kernel/setup-xen.c	Thu Jun 08 10:11:04 2006 +0100
     3.2 +++ b/linux-2.6-xen-sparse/arch/x86_64/kernel/setup-xen.c	Thu Jun 08 10:24:48 2006 +0100
     3.3 @@ -692,12 +692,10 @@ void __init setup_arch(char **cmdline_p)
     3.4  	init_mm.end_data = (unsigned long) &_edata;
     3.5  	init_mm.brk = (unsigned long) &_end;
     3.6  
     3.7 -#ifndef CONFIG_XEN
     3.8  	code_resource.start = virt_to_phys(&_text);
     3.9  	code_resource.end = virt_to_phys(&_etext)-1;
    3.10  	data_resource.start = virt_to_phys(&_etext);
    3.11  	data_resource.end = virt_to_phys(&_edata)-1;
    3.12 -#endif
    3.13  
    3.14  	parse_cmdline_early(cmdline_p);
    3.15  
    3.16 @@ -921,6 +919,13 @@ void __init setup_arch(char **cmdline_p)
    3.17  		BUG_ON(HYPERVISOR_memory_op(XENMEM_machine_memory_map, &memmap));
    3.18  
    3.19  		e820_reserve_resources(machine_e820, memmap.nr_entries);
    3.20 +	} else {
    3.21 +		struct e820entry domU_e820 = {
    3.22 +			.addr = 0,
    3.23 +			.size = max_pfn << PAGE_SHIFT,
    3.24 +			.type = E820_RAM,
    3.25 +		};
    3.26 +		e820_reserve_resources(&domU_e820, 1);
    3.27  	}
    3.28  #elif !defined(CONFIG_XEN)
    3.29  	probe_roms();