ia64/xen-unstable

changeset 14265:59c066e8007d

linux: scan DMI early

While shuffling quite a few things around, this gets us closer to
native, which clearly had a reason to do the DMI scan early.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
author kfraser@localhost.localdomain
date Mon Mar 05 15:46:33 2007 +0000 (2007-03-05)
parents fe3fa645835f
children 5dfad62b7a70
files linux-2.6-xen-sparse/arch/i386/mm/ioremap-xen.c linux-2.6-xen-sparse/arch/x86_64/kernel/setup-xen.c linux-2.6-xen-sparse/arch/x86_64/mm/init-xen.c linux-2.6-xen-sparse/include/asm-x86_64/mach-xen/asm/fixmap.h linux-2.6-xen-sparse/include/asm-x86_64/mach-xen/asm/io.h
line diff
     1.1 --- a/linux-2.6-xen-sparse/arch/i386/mm/ioremap-xen.c	Mon Mar 05 15:08:17 2007 +0000
     1.2 +++ b/linux-2.6-xen-sparse/arch/i386/mm/ioremap-xen.c	Mon Mar 05 15:46:33 2007 +0000
     1.3 @@ -374,8 +374,6 @@ void iounmap(volatile void __iomem *addr
     1.4  }
     1.5  EXPORT_SYMBOL(iounmap);
     1.6  
     1.7 -#ifdef __i386__
     1.8 -
     1.9  void __init *bt_ioremap(unsigned long phys_addr, unsigned long size)
    1.10  {
    1.11  	unsigned long offset, last_addr;
    1.12 @@ -443,5 +441,3 @@ void __init bt_iounmap(void *addr, unsig
    1.13  		--nrpages;
    1.14  	}
    1.15  }
    1.16 -
    1.17 -#endif /* __i386__ */
     2.1 --- a/linux-2.6-xen-sparse/arch/x86_64/kernel/setup-xen.c	Mon Mar 05 15:08:17 2007 +0000
     2.2 +++ b/linux-2.6-xen-sparse/arch/x86_64/kernel/setup-xen.c	Mon Mar 05 15:46:33 2007 +0000
     2.3 @@ -676,7 +676,8 @@ void __init setup_arch(char **cmdline_p)
     2.4  
     2.5  	init_memory_mapping(0, (end_pfn_map << PAGE_SHIFT));
     2.6  
     2.7 -	/* dmi_scan_machine(); */
     2.8 +	if (is_initial_xendomain())
     2.9 +		dmi_scan_machine();
    2.10  
    2.11  #ifdef CONFIG_ACPI_NUMA
    2.12  	/*
    2.13 @@ -1627,13 +1628,6 @@ struct seq_operations cpuinfo_op = {
    2.14  	.show =	show_cpuinfo,
    2.15  };
    2.16  
    2.17 -static int __init run_dmi_scan(void)
    2.18 -{
    2.19 -	dmi_scan_machine();
    2.20 -	return 0;
    2.21 -}
    2.22 -core_initcall(run_dmi_scan);
    2.23 -
    2.24  #if defined(CONFIG_INPUT_PCSPKR) || defined(CONFIG_INPUT_PCSPKR_MODULE)
    2.25  #include <linux/platform_device.h>
    2.26  static __init int add_pcspkr(void)
     3.1 --- a/linux-2.6-xen-sparse/arch/x86_64/mm/init-xen.c	Mon Mar 05 15:08:17 2007 +0000
     3.2 +++ b/linux-2.6-xen-sparse/arch/x86_64/mm/init-xen.c	Mon Mar 05 15:46:33 2007 +0000
     3.3 @@ -214,7 +214,11 @@ static __init void *spp_getpage(void)
     3.4  	void *ptr;
     3.5  	if (after_bootmem)
     3.6  		ptr = (void *) get_zeroed_page(GFP_ATOMIC); 
     3.7 -	else
     3.8 +	else if (start_pfn < table_end) {
     3.9 +		ptr = __va(start_pfn << PAGE_SHIFT);
    3.10 +		start_pfn++;
    3.11 +		memset(ptr, 0, PAGE_SIZE);
    3.12 +	} else
    3.13  		ptr = alloc_bootmem_pages(PAGE_SIZE);
    3.14  	if (!ptr || ((unsigned long)ptr & ~PAGE_MASK))
    3.15  		panic("set_pte_phys: cannot allocate page data %s\n", after_bootmem?"after bootmem":"");
    3.16 @@ -438,17 +442,34 @@ static inline int make_readonly(unsigned
    3.17  	return readonly;
    3.18  }
    3.19  
    3.20 +#ifndef CONFIG_XEN
    3.21  /* Must run before zap_low_mappings */
    3.22  __init void *early_ioremap(unsigned long addr, unsigned long size)
    3.23  {
    3.24 -	return ioremap(addr, size);
    3.25 +	unsigned long map = round_down(addr, LARGE_PAGE_SIZE);
    3.26 +
    3.27 +	/* actually usually some more */
    3.28 +	if (size >= LARGE_PAGE_SIZE) {
    3.29 +		printk("SMBIOS area too long %lu\n", size);
    3.30 +		return NULL;
    3.31 +	}
    3.32 +	set_pmd(temp_mappings[0].pmd,  __pmd(map | _KERNPG_TABLE | _PAGE_PSE));
    3.33 +	map += LARGE_PAGE_SIZE;
    3.34 +	set_pmd(temp_mappings[1].pmd,  __pmd(map | _KERNPG_TABLE | _PAGE_PSE));
    3.35 +	__flush_tlb();
    3.36 +	return temp_mappings[0].address + (addr & (LARGE_PAGE_SIZE-1));
    3.37  }
    3.38  
    3.39  /* To avoid virtual aliases later */
    3.40  __init void early_iounmap(void *addr, unsigned long size)
    3.41  {
    3.42 -	iounmap(addr);
    3.43 +	if ((void *)round_down((unsigned long)addr, LARGE_PAGE_SIZE) != temp_mappings[0].address)
    3.44 +		printk("early_iounmap: bad address %p\n", addr);
    3.45 +	set_pmd(temp_mappings[0].pmd, __pmd(0));
    3.46 +	set_pmd(temp_mappings[1].pmd, __pmd(0));
    3.47 +	__flush_tlb();
    3.48  }
    3.49 +#endif
    3.50  
    3.51  static void __meminit
    3.52  phys_pmd_init(pmd_t *pmd, unsigned long address, unsigned long end)
    3.53 @@ -646,9 +667,9 @@ static void __init extend_init_mapping(u
    3.54  	}
    3.55  }
    3.56  
    3.57 -static void __init find_early_table_space(unsigned long end)
    3.58 +static unsigned long __init find_early_table_space(unsigned long end)
    3.59  {
    3.60 -	unsigned long puds, pmds, ptes, tables; 
    3.61 +	unsigned long puds, pmds, ptes, tables, fixmap_tables;
    3.62  
    3.63  	puds = (end + PUD_SIZE - 1) >> PUD_SHIFT;
    3.64  	pmds = (end + PMD_SIZE - 1) >> PMD_SHIFT;
    3.65 @@ -658,7 +679,16 @@ static void __init find_early_table_spac
    3.66  		round_up(pmds * 8, PAGE_SIZE) + 
    3.67  		round_up(ptes * 8, PAGE_SIZE); 
    3.68  
    3.69 -	extend_init_mapping(tables);
    3.70 +	/* Also reserve pages for fixmaps that need to be set up early.
    3.71 +	 * Their pud is shared with the kernel pud.
    3.72 +	 */
    3.73 +	pmds = (PMD_SIZE - 1 - FIXADDR_START) >> PMD_SHIFT;
    3.74 +	ptes = (PTE_SIZE - 1 - FIXADDR_START) >> PAGE_SHIFT;
    3.75 +
    3.76 +	fixmap_tables = round_up(pmds * 8, PAGE_SIZE) +
    3.77 +		round_up(ptes * 8, PAGE_SIZE);
    3.78 +
    3.79 +	extend_init_mapping(tables + fixmap_tables);
    3.80  
    3.81  	table_start = start_pfn;
    3.82  	table_end = table_start + (tables>>PAGE_SHIFT);
    3.83 @@ -666,6 +696,8 @@ static void __init find_early_table_spac
    3.84  	early_printk("kernel direct mapping tables up to %lx @ %lx-%lx\n",
    3.85  		end, table_start << PAGE_SHIFT,
    3.86  		(table_start << PAGE_SHIFT) + tables);
    3.87 +
    3.88 +	return table_end + (fixmap_tables>>PAGE_SHIFT);
    3.89  }
    3.90  
    3.91  /* Setup the direct mapping of the physical memory at PAGE_OFFSET.
    3.92 @@ -673,7 +705,7 @@ static void __init find_early_table_spac
    3.93     physical memory. To access them they are temporarily mapped. */
    3.94  void __meminit init_memory_mapping(unsigned long start, unsigned long end)
    3.95  { 
    3.96 -	unsigned long next; 
    3.97 +	unsigned long next, table_rsrv_end = 0;
    3.98  
    3.99  	Dprintk("init_memory_mapping\n");
   3.100  
   3.101 @@ -684,7 +716,7 @@ void __meminit init_memory_mapping(unsig
   3.102  	 * discovered.
   3.103  	 */
   3.104  	if (!after_bootmem)
   3.105 -		find_early_table_space(end);
   3.106 +		table_rsrv_end = find_early_table_space(end);
   3.107  
   3.108  	start = (unsigned long)__va(start);
   3.109  	end = (unsigned long)__va(end);
   3.110 @@ -712,6 +744,7 @@ void __meminit init_memory_mapping(unsig
   3.111  
   3.112  	if (!after_bootmem) {
   3.113  		BUG_ON(start_pfn != table_end);
   3.114 +		table_end = table_rsrv_end;
   3.115  
   3.116  		/* Re-vector virtual addresses pointing into the initial
   3.117  		   mapping to the just-established permanent ones. */
   3.118 @@ -737,6 +770,24 @@ void __meminit init_memory_mapping(unsig
   3.119  		for (; start < end; start += PAGE_SIZE)
   3.120  			WARN_ON(HYPERVISOR_update_va_mapping(
   3.121  				start, __pte_ma(0), 0));
   3.122 +
   3.123 +		/* Switch to the real shared_info page, and clear the
   3.124 +		 * dummy page. */
   3.125 +		set_fixmap(FIX_SHARED_INFO, xen_start_info->shared_info);
   3.126 +		HYPERVISOR_shared_info = (shared_info_t *)fix_to_virt(FIX_SHARED_INFO);
   3.127 +		memset(empty_zero_page, 0, sizeof(empty_zero_page));
   3.128 +
   3.129 +		/* Setup mapping of lower 1st MB */
   3.130 +		for (next = 0; next < NR_FIX_ISAMAPS; next++)
   3.131 +			if (is_initial_xendomain())
   3.132 +				set_fixmap(FIX_ISAMAP_BEGIN - next, next * PAGE_SIZE);
   3.133 +			else
   3.134 +				__set_fixmap(FIX_ISAMAP_BEGIN - next,
   3.135 +					     virt_to_mfn(empty_zero_page) << PAGE_SHIFT,
   3.136 +					     PAGE_KERNEL_RO);
   3.137 +
   3.138 +		BUG_ON(start_pfn > table_end);
   3.139 +		table_end = start_pfn;
   3.140  	}
   3.141  
   3.142  	__flush_tlb_all();
   3.143 @@ -815,7 +866,6 @@ size_zones(unsigned long *z, unsigned lo
   3.144  void __init paging_init(void)
   3.145  {
   3.146  	unsigned long zones[MAX_NR_ZONES], holes[MAX_NR_ZONES];
   3.147 -	int i;
   3.148  
   3.149  	memory_present(0, 0, end_pfn);
   3.150  	sparse_init();
   3.151 @@ -823,22 +873,7 @@ void __init paging_init(void)
   3.152  	free_area_init_node(0, NODE_DATA(0), zones,
   3.153  			    __pa(PAGE_OFFSET) >> PAGE_SHIFT, holes);
   3.154  
   3.155 -	/* Switch to the real shared_info page, and clear the
   3.156 -	 * dummy page. */
   3.157 -	set_fixmap(FIX_SHARED_INFO, xen_start_info->shared_info);
   3.158 -	HYPERVISOR_shared_info = (shared_info_t *)fix_to_virt(FIX_SHARED_INFO);
   3.159 -	memset(empty_zero_page, 0, sizeof(empty_zero_page));
   3.160 -
   3.161  	init_mm.context.pinned = 1;
   3.162 -
   3.163 -	/* Setup mapping of lower 1st MB */
   3.164 -	for (i = 0; i < NR_FIX_ISAMAPS; i++)
   3.165 -		if (is_initial_xendomain())
   3.166 -			set_fixmap(FIX_ISAMAP_BEGIN - i, i * PAGE_SIZE);
   3.167 -		else
   3.168 -			__set_fixmap(FIX_ISAMAP_BEGIN - i,
   3.169 -				     virt_to_mfn(empty_zero_page) << PAGE_SHIFT,
   3.170 -				     PAGE_KERNEL_RO);
   3.171  }
   3.172  #endif
   3.173  
     4.1 --- a/linux-2.6-xen-sparse/include/asm-x86_64/mach-xen/asm/fixmap.h	Mon Mar 05 15:08:17 2007 +0000
     4.2 +++ b/linux-2.6-xen-sparse/include/asm-x86_64/mach-xen/asm/fixmap.h	Mon Mar 05 15:46:33 2007 +0000
     4.3 @@ -53,6 +53,11 @@ enum fixed_addresses {
     4.4  #define NR_FIX_ISAMAPS	256
     4.5  	FIX_ISAMAP_END,
     4.6  	FIX_ISAMAP_BEGIN = FIX_ISAMAP_END + NR_FIX_ISAMAPS - 1,
     4.7 +	__end_of_permanent_fixed_addresses,
     4.8 +	/* temporary boot-time mappings, used before ioremap() is functional */
     4.9 +#define NR_FIX_BTMAPS	16
    4.10 +	FIX_BTMAP_END = __end_of_permanent_fixed_addresses,
    4.11 +	FIX_BTMAP_BEGIN = FIX_BTMAP_END + NR_FIX_BTMAPS - 1,
    4.12  	__end_of_fixed_addresses
    4.13  };
    4.14  
     5.1 --- a/linux-2.6-xen-sparse/include/asm-x86_64/mach-xen/asm/io.h	Mon Mar 05 15:08:17 2007 +0000
     5.2 +++ b/linux-2.6-xen-sparse/include/asm-x86_64/mach-xen/asm/io.h	Mon Mar 05 15:46:33 2007 +0000
     5.3 @@ -150,8 +150,10 @@ static inline void __iomem * ioremap (un
     5.4  	return __ioremap(offset, size, 0);
     5.5  }
     5.6  
     5.7 -extern void *early_ioremap(unsigned long addr, unsigned long size);
     5.8 -extern void early_iounmap(void *addr, unsigned long size);
     5.9 +extern void *bt_ioremap(unsigned long addr, unsigned long size);
    5.10 +extern void bt_iounmap(void *addr, unsigned long size);
    5.11 +#define early_ioremap bt_ioremap
    5.12 +#define early_iounmap bt_iounmap
    5.13  
    5.14  /*
    5.15   * This one maps high address device memory and turns off caching for that area.