public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] x86: move saving e820_saved to setup_memory_map
@ 2008-07-03 18:35 Yinghai Lu
  2008-07-03 18:37 ` [PATCH] x86: make e820_saved have update from setup_data Yinghai Lu
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Yinghai Lu @ 2008-07-03 18:35 UTC (permalink / raw)
  To: Ingo Molnar, Thomas Gleixner, H. Peter Anvin, Jeremy Fitzhardinge,
	Bernhard Walle
  Cc: LKML


so other path that will override memory_setup or machine_specific_memory_setup could
have e820_saved too

Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>

---
 arch/x86/kernel/e820.c |    8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

Index: linux-2.6/arch/x86/kernel/e820.c
===================================================================
--- linux-2.6.orig/arch/x86/kernel/e820.c
+++ linux-2.6/arch/x86/kernel/e820.c
@@ -1294,8 +1294,6 @@ char *__init default_machine_specific_me
 		e820_add_region(HIGH_MEMORY, mem_size << 10, E820_RAM);
 	}
 
-	memcpy(&e820_saved, &e820, sizeof(struct e820map));
-
 	/* In case someone cares... */
 	return who;
 }
@@ -1313,8 +1311,12 @@ char * __init __attribute__((weak)) memo
 
 void __init setup_memory_map(void)
 {
+	char *who;
+
+	who = memory_setup();
+	memcpy(&e820_saved, &e820, sizeof(struct e820map));
 	printk(KERN_INFO "BIOS-provided physical RAM map:\n");
-	e820_print_map(memory_setup());
+	e820_print_map(who);
 }
 
 #ifdef CONFIG_X86_64

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH] x86: make e820_saved have update from setup_data
  2008-07-03 18:35 [PATCH] x86: move saving e820_saved to setup_memory_map Yinghai Lu
@ 2008-07-03 18:37 ` Yinghai Lu
  2008-07-03 21:01   ` Bernhard Walle
  2008-07-03 18:39 ` [PATCH] x86: let early_reserve_e820 update e820_saved too Yinghai Lu
  2008-07-09  5:50 ` [PATCH] x86: move saving e820_saved to setup_memory_map Ingo Molnar
  2 siblings, 1 reply; 8+ messages in thread
From: Yinghai Lu @ 2008-07-03 18:37 UTC (permalink / raw)
  To: Ingo Molnar, Thomas Gleixner, H. Peter Anvin, Bernhard Walle,
	Ying Huang
  Cc: LKML


seperate reserve_setup_data into e820_reserved_setup_data,
and reserve_early_setup_data.

So could use e820_reserved_setup_data to backup e820 with setup_data

Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>

---
 arch/x86/kernel/setup.c |   28 +++++++++++++++++++++++-----
 1 file changed, 23 insertions(+), 5 deletions(-)

Index: linux-2.6/arch/x86/kernel/setup.c
===================================================================
--- linux-2.6.orig/arch/x86/kernel/setup.c
+++ linux-2.6/arch/x86/kernel/setup.c
@@ -394,11 +394,10 @@ static void __init parse_setup_data(void
 	}
 }
 
-static void __init reserve_setup_data(void)
+static void __init e820_reserve_setup_data(void)
 {
 	struct setup_data *data;
 	u64 pa_data;
-	char buf[32];
 	int found = 0;
 
 	if (boot_params.hdr.version < 0x0209)
@@ -406,8 +405,6 @@ static void __init reserve_setup_data(vo
 	pa_data = boot_params.hdr.setup_data;
 	while (pa_data) {
 		data = early_ioremap(pa_data, sizeof(*data));
-		sprintf(buf, "setup data %x", data->type);
-		reserve_early(pa_data, pa_data+sizeof(*data)+data->len, buf);
 		e820_update_range(pa_data, sizeof(*data)+data->len,
 			 E820_RAM, E820_RESERVED_KERN);
 		found = 1;
@@ -418,10 +415,29 @@ static void __init reserve_setup_data(vo
 		return;
 
 	sanitize_e820_map(e820.map, ARRAY_SIZE(e820.map), &e820.nr_map);
+	memcpy(&e820_saved, &e820, sizeof(struct e820map));
 	printk(KERN_INFO "extended physical RAM map:\n");
 	e820_print_map("reserve setup_data");
 }
 
+static void __init reserve_early_setup_data(void)
+{
+	struct setup_data *data;
+	u64 pa_data;
+	char buf[32];
+
+	if (boot_params.hdr.version < 0x0209)
+		return;
+	pa_data = boot_params.hdr.setup_data;
+	while (pa_data) {
+		data = early_ioremap(pa_data, sizeof(*data));
+		sprintf(buf, "setup data %x", data->type);
+		reserve_early(pa_data, pa_data+sizeof(*data)+data->len, buf);
+		pa_data = data->next;
+		early_iounmap(data, sizeof(*data));
+	}
+}
+
 /*
  * --------- Crashkernel reservation ------------------------------
  */
@@ -626,6 +642,8 @@ void __init setup_arch(char **cmdline_p)
 
 	setup_memory_map();
 	parse_setup_data();
+	/* update the e820_saved too */
+	e820_reserve_setup_data();
 
 	copy_edd();
 
@@ -656,7 +674,7 @@ void __init setup_arch(char **cmdline_p)
 	parse_early_param();
 
 	/* after early param, so could get panic from serial */
-	reserve_setup_data();
+	reserve_early_setup_data();
 
 	if (acpi_mps_check()) {
 #ifdef CONFIG_X86_LOCAL_APIC

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH] x86: let early_reserve_e820 update e820_saved too
  2008-07-03 18:35 [PATCH] x86: move saving e820_saved to setup_memory_map Yinghai Lu
  2008-07-03 18:37 ` [PATCH] x86: make e820_saved have update from setup_data Yinghai Lu
@ 2008-07-03 18:39 ` Yinghai Lu
  2008-07-09  5:51   ` Ingo Molnar
  2008-07-09  5:50 ` [PATCH] x86: move saving e820_saved to setup_memory_map Ingo Molnar
  2 siblings, 1 reply; 8+ messages in thread
From: Yinghai Lu @ 2008-07-03 18:39 UTC (permalink / raw)
  To: Ingo Molnar, Thomas Gleixner, H. Peter Anvin, Bernhard Walle; +Cc: LKML


so when it is called after early_param, e820_saved get updated too.
esp for mpc update.

Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>

---
 arch/x86/kernel/e820.c |   31 ++++++++++++++++++++++++++++---
 1 file changed, 28 insertions(+), 3 deletions(-)

Index: linux-2.6/arch/x86/kernel/e820.c
===================================================================
--- linux-2.6.orig/arch/x86/kernel/e820.c
+++ linux-2.6/arch/x86/kernel/e820.c
@@ -414,8 +414,9 @@ static int __init append_e820_map(struct
 	return __append_e820_map(biosmap, nr_map);
 }
 
-u64 __init e820_update_range(u64 start, u64 size, unsigned old_type,
-				unsigned new_type)
+static u64 __init e820_update_range_map(struct e820map *e820x, u64 start,
+					u64 size, unsigned old_type,
+					unsigned new_type)
 {
 	int i;
 	u64 real_updated_size = 0;
@@ -426,7 +427,7 @@ u64 __init e820_update_range(u64 start,
 		size = ULLONG_MAX - start;
 
 	for (i = 0; i < e820.nr_map; i++) {
-		struct e820entry *ei = &e820.map[i];
+		struct e820entry *ei = &e820x->map[i];
 		u64 final_start, final_end;
 		if (ei->type != old_type)
 			continue;
@@ -454,6 +455,19 @@ u64 __init e820_update_range(u64 start,
 	return real_updated_size;
 }
 
+u64 __init e820_update_range(u64 start, u64 size, unsigned old_type,
+			     unsigned new_type)
+{
+	return e820_update_range_map(&e820, start, size, old_type, new_type);
+}
+
+static u64 __init e820_update_range_saved(u64 start, u64 size,
+					  unsigned old_type, unsigned new_type)
+{
+	return e820_update_range_map(&e820_saved, start, size, old_type,
+				     new_type);
+}
+
 /* make e820 not cover the range */
 u64 __init e820_remove_range(u64 start, u64 size, unsigned old_type,
 			     int checktype)
@@ -503,6 +517,15 @@ void __init update_e820(void)
 	printk(KERN_INFO "modified physical RAM map:\n");
 	e820_print_map("modified");
 }
+static void __init update_e820_saved(void)
+{
+	int nr_map;
+
+	nr_map = e820_saved.nr_map;
+	if (sanitize_e820_map(e820_saved.map, ARRAY_SIZE(e820_saved.map), &nr_map))
+		return;
+	e820_saved.nr_map = nr_map;
+}
 #define MAX_GAP_END 0x100000000ull
 /*
  * Search for a gap in the e820 memory space from start_addr to end_addr.
@@ -1007,8 +1030,10 @@ u64 __init early_reserve_e820(u64 startt
 
 	addr = round_down(start + size - sizet, align);
 	e820_update_range(addr, sizet, E820_RAM, E820_RESERVED);
+	e820_update_range_saved(addr, sizet, E820_RAM, E820_RESERVED);
 	printk(KERN_INFO "update e820 for early_reserve_e820\n");
 	update_e820();
+	update_e820_saved();
 
 	return addr;
 }

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] x86: make e820_saved have update from setup_data
  2008-07-03 18:37 ` [PATCH] x86: make e820_saved have update from setup_data Yinghai Lu
@ 2008-07-03 21:01   ` Bernhard Walle
  2008-07-03 21:32     ` Yinghai Lu
  2008-07-03 22:49     ` H. Peter Anvin
  0 siblings, 2 replies; 8+ messages in thread
From: Bernhard Walle @ 2008-07-03 21:01 UTC (permalink / raw)
  To: Yinghai Lu; +Cc: Ingo Molnar, Thomas Gleixner, H. Peter Anvin, Ying Huang, LKML

* Yinghai Lu <yhlu.kernel@gmail.com> [2008-07-03 11:37]:
>
> +	/* update the e820_saved too */
> +	e820_reserve_setup_data();

Why do you want to update the e820_saved here? /sys/firmware/memmap
should provide the real BIOS-provided memory map, IMO ...



Bernhard
-- 
Bernhard Walle, SUSE LINUX Products GmbH, Architecture Development

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] x86: make e820_saved have update from setup_data
  2008-07-03 21:01   ` Bernhard Walle
@ 2008-07-03 21:32     ` Yinghai Lu
  2008-07-03 22:49     ` H. Peter Anvin
  1 sibling, 0 replies; 8+ messages in thread
From: Yinghai Lu @ 2008-07-03 21:32 UTC (permalink / raw)
  To: Bernhard Walle
  Cc: Ingo Molnar, Thomas Gleixner, H. Peter Anvin, Ying Huang, LKML

On Thu, Jul 3, 2008 at 2:01 PM, Bernhard Walle <bwalle@suse.de> wrote:
> * Yinghai Lu <yhlu.kernel@gmail.com> [2008-07-03 11:37]:
>>
>> +     /* update the e820_saved too */
>> +     e820_reserve_setup_data();
>
> Why do you want to update the e820_saved here? /sys/firmware/memmap
> should provide the real BIOS-provided memory map, IMO ...

that setup_data is another half memmap for efi.

YH

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] x86: make e820_saved have update from setup_data
  2008-07-03 21:01   ` Bernhard Walle
  2008-07-03 21:32     ` Yinghai Lu
@ 2008-07-03 22:49     ` H. Peter Anvin
  1 sibling, 0 replies; 8+ messages in thread
From: H. Peter Anvin @ 2008-07-03 22:49 UTC (permalink / raw)
  To: Bernhard Walle; +Cc: Yinghai Lu, Ingo Molnar, Thomas Gleixner, Ying Huang, LKML

Bernhard Walle wrote:
> * Yinghai Lu <yhlu.kernel@gmail.com> [2008-07-03 11:37]:
>> +	/* update the e820_saved too */
>> +	e820_reserve_setup_data();
> 
> Why do you want to update the e820_saved here? /sys/firmware/memmap
> should provide the real BIOS-provided memory map, IMO ...

I would concur with that.

	-hpa

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] x86: move saving e820_saved to setup_memory_map
  2008-07-03 18:35 [PATCH] x86: move saving e820_saved to setup_memory_map Yinghai Lu
  2008-07-03 18:37 ` [PATCH] x86: make e820_saved have update from setup_data Yinghai Lu
  2008-07-03 18:39 ` [PATCH] x86: let early_reserve_e820 update e820_saved too Yinghai Lu
@ 2008-07-09  5:50 ` Ingo Molnar
  2 siblings, 0 replies; 8+ messages in thread
From: Ingo Molnar @ 2008-07-09  5:50 UTC (permalink / raw)
  To: Yinghai Lu
  Cc: Thomas Gleixner, H. Peter Anvin, Jeremy Fitzhardinge,
	Bernhard Walle, LKML


* Yinghai Lu <yhlu.kernel@gmail.com> wrote:

> so other path that will override memory_setup or 
> machine_specific_memory_setup could have e820_saved too

applied to tip/x86/core, thanks Yinghai.

	Ingo

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] x86: let early_reserve_e820 update e820_saved too
  2008-07-03 18:39 ` [PATCH] x86: let early_reserve_e820 update e820_saved too Yinghai Lu
@ 2008-07-09  5:51   ` Ingo Molnar
  0 siblings, 0 replies; 8+ messages in thread
From: Ingo Molnar @ 2008-07-09  5:51 UTC (permalink / raw)
  To: Yinghai Lu; +Cc: Thomas Gleixner, H. Peter Anvin, Bernhard Walle, LKML


* Yinghai Lu <yhlu.kernel@gmail.com> wrote:

> so when it is called after early_param, e820_saved get updated too. 
> esp for mpc update.

applied to tip/x86/core, thanks Yinghai.

	Ingo

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2008-07-09  5:51 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-07-03 18:35 [PATCH] x86: move saving e820_saved to setup_memory_map Yinghai Lu
2008-07-03 18:37 ` [PATCH] x86: make e820_saved have update from setup_data Yinghai Lu
2008-07-03 21:01   ` Bernhard Walle
2008-07-03 21:32     ` Yinghai Lu
2008-07-03 22:49     ` H. Peter Anvin
2008-07-03 18:39 ` [PATCH] x86: let early_reserve_e820 update e820_saved too Yinghai Lu
2008-07-09  5:51   ` Ingo Molnar
2008-07-09  5:50 ` [PATCH] x86: move saving e820_saved to setup_memory_map Ingo Molnar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox