From: Linus Torvalds <torvalds@linux-foundation.org>
Date: Fri, 22 Oct 2010 01:52:11 +0000 (-0700)
Subject: Merge branch 'core-memblock-for-linus' of git://git.kernel.org/pub/scm/linux/kernel... 
X-Git-Tag: firefly_0821_release~7613^2~3706
X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=3044100e58c84e133791c8b60a2f5bef69d732e4;p=firefly-linux-kernel-4.4.55.git

Merge branch 'core-memblock-for-linus' of git://git./linux/kernel/git/tip/linux-2.6-tip

* 'core-memblock-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip: (74 commits)
  x86-64: Only set max_pfn_mapped to 512 MiB if we enter via head_64.S
  xen: Cope with unmapped pages when initializing kernel pagetable
  memblock, bootmem: Round pfn properly for memory and reserved regions
  memblock: Annotate memblock functions with __init_memblock
  memblock: Allow memblock_init to be called early
  memblock/arm: Fix memblock_region_is_memory() typo
  x86, memblock: Remove __memblock_x86_find_in_range_size()
  memblock: Fix wraparound in find_region()
  x86-32, memblock: Make add_highpages honor early reserved ranges
  x86, memblock: Fix crashkernel allocation
  arm, memblock: Fix the sparsemem build
  memblock: Fix section mismatch warnings
  powerpc, memblock: Fix memblock API change fallout
  memblock, microblaze: Fix memblock API change fallout
  x86: Remove old bootmem code
  x86, memblock: Use memblock_memory_size()/memblock_free_memory_size() to get correct dma_reserve
  x86: Remove not used early_res code
  x86, memblock: Replace e820_/_early string with memblock_
  x86: Use memblock to replace early_res
  x86, memblock: Use memblock_debug to control debug message print out
  ...

Fix up trivial conflicts in arch/x86/kernel/setup.c and kernel/Makefile
---

3044100e58c84e133791c8b60a2f5bef69d732e4
diff --cc arch/x86/Kconfig
index 7ab9db88ab6a,01a572992fa0..dfabfefc21c4
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@@ -25,9 -25,9 +25,10 @@@ config X8
  	select HAVE_IDE
  	select HAVE_OPROFILE
  	select HAVE_PERF_EVENTS if (!M386 && !M486)
 +	select HAVE_IRQ_WORK
  	select HAVE_IOREMAP_PROT
  	select HAVE_KPROBES
+ 	select HAVE_MEMBLOCK
  	select ARCH_WANT_OPTIONAL_GPIOLIB
  	select ARCH_WANT_FRAME_POINTERS
  	select HAVE_DMA_ATTRS
diff --cc arch/x86/kernel/setup.c
index a59f6a6df5e2,c3cebfe7bfc9..420e64197850
--- a/arch/x86/kernel/setup.c
+++ b/arch/x86/kernel/setup.c
@@@ -614,10 -620,82 +619,10 @@@ static __init void reserve_ibft_region(
  	addr = find_ibft_region(&size);
  
  	if (size)
- 		reserve_early_overlap_ok(addr, addr + size, "ibft");
+ 		memblock_x86_reserve_range(addr, addr + size, "* ibft");
  }
  
 -#ifdef CONFIG_X86_RESERVE_LOW_64K
 -static int __init dmi_low_memory_corruption(const struct dmi_system_id *d)
 -{
 -	printk(KERN_NOTICE
 -		"%s detected: BIOS may corrupt low RAM, working around it.\n",
 -		d->ident);
 -
 -	e820_update_range(0, 0x10000, E820_RAM, E820_RESERVED);
 -	sanitize_e820_map(e820.map, ARRAY_SIZE(e820.map), &e820.nr_map);
 -
 -	return 0;
 -}
 -#endif
 -
 -/* List of systems that have known low memory corruption BIOS problems */
 -static struct dmi_system_id __initdata bad_bios_dmi_table[] = {
 -#ifdef CONFIG_X86_RESERVE_LOW_64K
 -	{
 -		.callback = dmi_low_memory_corruption,
 -		.ident = "AMI BIOS",
 -		.matches = {
 -			DMI_MATCH(DMI_BIOS_VENDOR, "American Megatrends Inc."),
 -		},
 -	},
 -	{
 -		.callback = dmi_low_memory_corruption,
 -		.ident = "Phoenix BIOS",
 -		.matches = {
 -			DMI_MATCH(DMI_BIOS_VENDOR, "Phoenix Technologies"),
 -		},
 -	},
 -	{
 -		.callback = dmi_low_memory_corruption,
 -		.ident = "Phoenix/MSC BIOS",
 -		.matches = {
 -			DMI_MATCH(DMI_BIOS_VENDOR, "Phoenix/MSC"),
 -		},
 -	},
 -	/*
 -	 * AMI BIOS with low memory corruption was found on Intel DG45ID and
 -	 * DG45FC boards.
 -	 * It has a different DMI_BIOS_VENDOR = "Intel Corp.", for now we will
 -	 * match only DMI_BOARD_NAME and see if there is more bad products
 -	 * with this vendor.
 -	 */
 -	{
 -		.callback = dmi_low_memory_corruption,
 -		.ident = "AMI BIOS",
 -		.matches = {
 -			DMI_MATCH(DMI_BOARD_NAME, "DG45ID"),
 -		},
 -	},
 -	{
 -		.callback = dmi_low_memory_corruption,
 -		.ident = "AMI BIOS",
 -		.matches = {
 -			DMI_MATCH(DMI_BOARD_NAME, "DG45FC"),
 -		},
 -	},
 -	/*
 -	 * The Dell Inspiron Mini 1012 has DMI_BIOS_VENDOR = "Dell Inc.", so
 -	 * match on the product name.
 -	 */
 -	{
 -		.callback = dmi_low_memory_corruption,
 -		.ident = "Phoenix BIOS",
 -		.matches = {
 -			DMI_MATCH(DMI_PRODUCT_NAME, "Inspiron 1012"),
 -		},
 -	},
 -#endif
 -	{}
 -};
 +static unsigned reserve_low = CONFIG_X86_RESERVE_LOW << 10;
  
  static void __init trim_bios_range(void)
  {
@@@ -642,28 -714,15 +647,37 @@@
  	sanitize_e820_map(e820.map, ARRAY_SIZE(e820.map), &e820.nr_map);
  }
  
 +static int __init parse_reservelow(char *p)
 +{
 +	unsigned long long size;
 +
 +	if (!p)
 +		return -EINVAL;
 +
 +	size = memparse(p, &p);
 +
 +	if (size < 4096)
 +		size = 4096;
 +
 +	if (size > 640*1024)
 +		size = 640*1024;
 +
 +	reserve_low = size;
 +
 +	return 0;
 +}
 +
 +early_param("reservelow", parse_reservelow);
 +
+ static u64 __init get_max_mapped(void)
+ {
+ 	u64 end = max_pfn_mapped;
+ 
+ 	end <<= PAGE_SHIFT;
+ 
+ 	return end;
+ }
+ 
  /*
   * Determine if we were loaded by an EFI loader.  If so, then we have also been
   * passed the efi memmap, systab, etc., so we should use these data structures
@@@ -794,8 -852,11 +808,8 @@@ void __init setup_arch(char **cmdline_p
  
  	x86_report_nx();
  
 -	/* Must be before kernel pagetables are setup */
 -	vmi_activate();
 -
  	/* after early param, so could get panic from serial */
- 	reserve_early_setup_data();
+ 	memblock_x86_reserve_range_setup_data();
  
  	if (acpi_mps_check()) {
  #ifdef CONFIG_X86_LOCAL_APIC
diff --cc arch/x86/xen/mmu.c
index b2363fcbcd0f,7d55e9ee3a76..f72d18c69221
--- a/arch/x86/xen/mmu.c
+++ b/arch/x86/xen/mmu.c
@@@ -1969,13 -1984,10 +1984,9 @@@ static const struct pv_mmu_ops xen_mmu_
  	.alloc_pte = xen_alloc_pte_init,
  	.release_pte = xen_release_pte_init,
  	.alloc_pmd = xen_alloc_pmd_init,
 -	.alloc_pmd_clone = paravirt_nop,
  	.release_pmd = xen_release_pmd_init,
  
- #ifdef CONFIG_X86_64
- 	.set_pte = xen_set_pte,
- #else
  	.set_pte = xen_set_pte_init,
- #endif
  	.set_pte_at = xen_set_pte_at,
  	.set_pmd = xen_set_pmd_hyper,
  
diff --cc kernel/Makefile
index e2c9d52cfe9e,4c19ebe9053c..0b5ff083fa22
--- a/kernel/Makefile
+++ b/kernel/Makefile
@@@ -10,8 -10,7 +10,7 @@@ obj-y     = sched.o fork.o exec_domain.
  	    kthread.o wait.o kfifo.o sys_ni.o posix-cpu-timers.o mutex.o \
  	    hrtimer.o rwsem.o nsproxy.o srcu.o semaphore.o \
  	    notifier.o ksysfs.o pm_qos_params.o sched_clock.o cred.o \
 -	    async.o range.o
 +	    async.o range.o jump_label.o
- obj-$(CONFIG_HAVE_EARLY_RES) += early_res.o
  obj-y += groups.o
  
  ifdef CONFIG_FUNCTION_TRACER