x86/trampoline: fallback to fixed trampoline address if no e820 map is provided
PATCH 1/1 x86/trampoline: fallback to fixed trampoline address if no e820 map is provided
From: Florian Fainelli <[email protected]>
Since 893f38d1 (x86: Use find_e820() instead of hard coded trampoline address), the trampoline base address should be provided by the BIOS as an e820 area. Some minimalistic BIOSes (like CEFDK on CE4100) may not provide any e820 area, still we should fallback to a fixed trampoline base address for SMP to work correctly.
---
arch/x86/include/asm/trampoline.h +1 -0
@@ -16,6 +16,7 @@ extern unsigned long initial_code;extern unsigned long initial_gs;#define TRAMPOLINE_SIZE roundup(trampoline_end - trampoline_data, PAGE_SIZE) +#define TRAMPOLINE_BASE 0x6000extern unsigned long setup_trampoline (void );extern void __init reserve_trampoline_memory (void );
arch/x86/kernel/trampoline.c +5 -2
@@ -21,8 +21,11 @@ void __init reserve_trampoline_memory(void)/* Has to be in very low memory so we can execute real-mode AP code. */ mem =find_e820_area (0 ,1 <<20 ,TRAMPOLINE_SIZE ,PAGE_SIZE ); -if (mem ==-1L ) -panic ("Cannot allocate trampoline\n" ); +if (mem ==-1L ) { +printk (KERN_INFO "BIOS did not provide e820 area for trampoline" +" ,using static trampoline address\n" ); + mem =TRAMPOLINE_BASE ; + } trampoline_base =__va (mem);reserve_early (mem, mem +TRAMPOLINE_SIZE ,"TRAMPOLINE" );
Signature · 1 line
1.7.1
Quoted 8 lines · On Tuesday 14 December 2010 22:19:39 Florian Fainelli wrote:
From: Florian Fainelli <[email protected]>
Since
893f38d1(x86: Usefind_e820()instead of hard coded trampoline address), the trampoline base address should be provided by the BIOS as an e820 area. Some minimalistic BIOSes (like CEFDK on CE4100) may not provide any e820 area, still we should fallback to a fixed trampoline base address for SMP to work correctly.
Quoted 5 lines
Cc Dirk Brandewie <[email protected]>Cc Ingo Molnar <[email protected]>Cc Yinghai Lu <[email protected]>Signed-off-by Florian Fainelli <[email protected]>
Ingo, Yinghai, anything wrong with that patch? Thank you.
Quoted 31 lines
---
(quoted diff) +0
-0
b/arch/x86/include/asm/trampoline.hindex f4500fb..908b395 100644arch/x86/include/asm/trampoline.h +0
-0@@ -16,6 +16,7 @@ extern unsigned long initial_code;extern unsigned long initial_gs;#define TRAMPOLINE_SIZE roundup(trampoline_end - trampoline_data,
PAGE_SIZE) +#defineTRAMPOLINE_BASE0x6000extern unsigned long
setup_trampoline(void); extern void__initreserve_trampoline_memory(void);arch/x86/kernel/trampoline.c +5
-2@@ -21,8 +21,11 @@ void __init reserve_trampoline_memory(void)/* Has to be in very low memory so we can execute real-mode AP code. */ mem =find_e820_area (0 ,1 <<20 ,TRAMPOLINE_SIZE ,PAGE_SIZE ); -if (mem ==-1L ) -panic ("Cannot allocate trampoline\n" ); +if (mem ==-1L ) { +printk (KERN_INFO "BIOS did not provide e820 area for trampoline" +" ,using static trampoline address\n" ); + mem =TRAMPOLINE_BASE ; + } trampoline_base =__va (mem);reserve_early (mem, mem +TRAMPOLINE_SIZE ,"TRAMPOLINE" );
Quoted 8 lines · Florian Fainelli
Quoted 7 lines · On Tuesday 14 December 2010 22:19:39 Florian Fainelli wrote:
From: Florian Fainelli <[email protected]>
Since
893f38d1(x86: Usefind_e820()instead of hard coded trampoline address), the trampoline base address should be provided by the BIOS as an e820 area. Some minimalistic BIOSes (like CEFDK on CE4100) may not provide any e820 area, still we should fallback to a fixed trampoline base address for SMP to work correctly.
No e820 memmap ?
Not sure how does it work
Do you have boot log with debug ?
Also recent kernel is using memblock already for finding free area.
Thanks
Quoted 40 lines
Quoted 6 lines
Cc Dirk Brandewie <[email protected]>Cc Ingo Molnar <[email protected]>Cc Yinghai Lu <[email protected]>Signed-off-by Florian Fainelli <[email protected]>Ingo, Yinghai, anything wrong with that patch? Thank you.
Quoted 31 lines
---
(quoted diff) +0
-0
b/arch/x86/include/asm/trampoline.hindex f4500fb..908b395 100644arch/x86/include/asm/trampoline.h +0
-0@@ -16,6 +16,7 @@ extern unsigned long initial_code;extern unsigned long initial_gs;#define TRAMPOLINE_SIZE roundup(trampoline_end - trampoline_data,
PAGE_SIZE) +#defineTRAMPOLINE_BASE0x6000extern unsigned long
setup_trampoline(void); extern void__initreserve_trampoline_memory(void);arch/x86/kernel/trampoline.c +5
-2@@ -21,8 +21,11 @@ void __init reserve_trampoline_memory(void)/* Has to be in very low memory so we can execute real-mode AP code. */ mem =find_e820_area (0 ,1 <<20 ,TRAMPOLINE_SIZE ,PAGE_SIZE ); -if (mem ==-1L ) -panic ("Cannot allocate trampoline\n" ); +if (mem ==-1L ) { +printk (KERN_INFO "BIOS did not provide e820 area for trampoline" +" ,using static trampoline address\n" ); + mem =TRAMPOLINE_BASE ; + } trampoline_base =__va (mem);reserve_early (mem, mem +TRAMPOLINE_SIZE ,"TRAMPOLINE" );
Quoted 9 lines · ----- "Yinghai
Quoted 4 lines · Florian Fainelli
Quoted 3 lines · On Tuesday 14 December 2010 22:19:39 Florian Fainelli wrote:
From: Florian Fainelli <[email protected]>
Since
893f38d1(x86: Usefind_e820()instead of hard codedtrampoline
Quoted 1 line
Quoted 1 line
address), the trampoline base address should be provided by the
Quoted 8 lines
BIOS as an
Quoted 1 line
Quoted 1 line
e820 area. Some minimalistic BIOSes (like CEFDK on CE4100) may not
provide
Quoted 1 line
Quoted 1 line
any e820 area, still we should fallback to a fixed trampoline base
address
Quoted 1 line
Quoted 1 line
for SMP to work correctly.
No e820 memmap ?
Yes, the BIOS is only doing the very minimal setup to get a kernel in real-mode booting.
Quoted 4 lines
Not sure how does it work
Do you have boot log with debug ?
I would need to produce one for you, give me a couple days to be in sync.
Quoted 50 lines
Also recent kernel is using memblock already for finding free area.
Thanks
Quoted 17 lines
Quoted 6 lines
Cc Dirk Brandewie <[email protected]>Cc Ingo Molnar <[email protected]>Cc Yinghai Lu <[email protected]>Signed-off-by Florian Fainelli <[email protected]>Ingo, Yinghai, anything wrong with that patch? Thank you.
Quoted 8 lines
---
(quoted diff) +0
-0
b/arch/x86/include/asm/trampoline.hindex f4500fb..908b395 100644arch/x86/include/asm/trampoline.h +0
-0@@ -16,6 +16,7 @@ extern unsigned long initial_code;extern unsigned long initial_gs;Quoted 6 lines
Review
Quoted 6 lines
arch/x86/include/asm/trampoline.h +0
-0#define TRAMPOLINE_SIZE roundup(trampoline_end - trampoline_data,
PAGE_SIZE) +#defineTRAMPOLINE_BASE0x6000extern unsigned long
setup_trampoline(void); extern void__initreserve_trampoline_memory(void);(quoted diff) +0
-0
b/arch/x86/kernel/trampoline.cQuoted 6 lines
arch/x86/kernel/trampoline.c void __init reserve_trampoline_memory(void) · line 22
Quoted 6 lines
index f1488a3..d025aae 100644
arch/x86/kernel/trampoline.c +0
-0@@ -21,8 +21,11 @@ void __init reserve_trampoline_memory(void)/* Has to be in very low memory so we can execute real-mode AP code. */
Quoted 5 lines
arch/x86/kernel/trampoline.c void __init reserve_trampoline_memory(void)
Quoted 5 lines
arch/x86/kernel/trampoline.c +2
-2mem =find_e820_area (0 ,1 <<20 ,TRAMPOLINE_SIZE ,PAGE_SIZE ); -if (mem ==-1L ) -panic ("Cannot allocate trampoline\n" ); + if (mem == -1L) { + printk(KERN_INFO "BIOS did not provide e820 area fortrampoline"
Quoted 6 lines
Quoted 6 lines
arch/x86/kernel/trampoline.c +3
-0+ " ,using static trampoline address\n"); + mem =TRAMPOLINE_BASE ; + } trampoline_base =__va (mem);reserve_early (mem, mem +TRAMPOLINE_SIZE ,"TRAMPOLINE" );
Can you check if you can add ce4100 own memory_setup() and install it into x86_init.resources.memory_setup in x86_ce4100_early_setup?
Thanks
Quoted 80 lines · Florian Fainelli
Quoted 9 lines · ----- "Yinghai
Quoted 4 lines · Florian Fainelli
Quoted 3 lines · On Tuesday 14 December 2010 22:19:39 Florian Fainelli wrote:
From: Florian Fainelli <[email protected]>
Since
893f38d1(x86: Usefind_e820()instead of hard codedtrampoline
Quoted 1 line
Quoted 1 line
address), the trampoline base address should be provided by the
Quoted 8 lines
BIOS as an
Quoted 1 line
Quoted 1 line
e820 area. Some minimalistic BIOSes (like CEFDK on CE4100) may not
provide
Quoted 1 line
Quoted 1 line
any e820 area, still we should fallback to a fixed trampoline base
address
Quoted 1 line
Quoted 1 line
for SMP to work correctly.
No e820 memmap ?
Yes, the BIOS is only doing the very minimal setup to get a kernel in real-mode booting.
Quoted 4 lines
Not sure how does it work
Do you have boot log with debug ?
I would need to produce one for you, give me a couple days to be in sync.
Quoted 50 lines
Also recent kernel is using memblock already for finding free area.
Thanks
Quoted 17 lines
Quoted 6 lines
Cc Dirk Brandewie <[email protected]>Cc Ingo Molnar <[email protected]>Cc Yinghai Lu <[email protected]>Signed-off-by Florian Fainelli <[email protected]>Ingo, Yinghai, anything wrong with that patch? Thank you.
Quoted 8 lines
---
(quoted diff) +0
-0
b/arch/x86/include/asm/trampoline.hindex f4500fb..908b395 100644arch/x86/include/asm/trampoline.h +0
-0@@ -16,6 +16,7 @@ extern unsigned long initial_code;extern unsigned long initial_gs;Quoted 6 lines
Review
Quoted 6 lines
arch/x86/include/asm/trampoline.h +0
-0#define TRAMPOLINE_SIZE roundup(trampoline_end - trampoline_data,
PAGE_SIZE) +#defineTRAMPOLINE_BASE0x6000extern unsigned long
setup_trampoline(void); extern void__initreserve_trampoline_memory(void);(quoted diff) +0
-0
b/arch/x86/kernel/trampoline.cQuoted 6 lines
arch/x86/kernel/trampoline.c void __init reserve_trampoline_memory(void) · line 22
Quoted 6 lines
index f1488a3..d025aae 100644
arch/x86/kernel/trampoline.c +0
-0@@ -21,8 +21,11 @@ void __init reserve_trampoline_memory(void)/* Has to be in very low memory so we can execute real-mode AP code. */
Quoted 5 lines
arch/x86/kernel/trampoline.c void __init reserve_trampoline_memory(void)
Quoted 5 lines
arch/x86/kernel/trampoline.c +2
-2mem =find_e820_area (0 ,1 <<20 ,TRAMPOLINE_SIZE ,PAGE_SIZE ); -if (mem ==-1L ) -panic ("Cannot allocate trampoline\n" ); + if (mem == -1L) { + printk(KERN_INFO "BIOS did not provide e820 area fortrampoline"
Quoted 6 lines
Quoted 6 lines
arch/x86/kernel/trampoline.c +3
-0+ " ,using static trampoline address\n"); + mem =TRAMPOLINE_BASE ; + } trampoline_base =__va (mem);reserve_early (mem, mem +TRAMPOLINE_SIZE ,"TRAMPOLINE" );
Quoted 12 lines · Yinghai
Quoted 8 lines · Florian Fainelli
Quoted 7 lines · On Tuesday 14 December 2010 22:19:39 Florian Fainelli wrote:
From: Florian Fainelli <[email protected]>
Since
893f38d1(x86: Usefind_e820()instead of hard coded trampoline address), the trampoline base address should be provided by the BIOS as an e820 area. Some minimalistic BIOSes (like CEFDK on CE4100) may not provide any e820 area, still we should fallback to a fixed trampoline base address for SMP to work correctly.
Quoted 8 lines
No e820 memmap ?
Not sure how does it work
Do you have boot log with debug ?
Also recent kernel is using memblock already for finding free area.
OK, this deeply troubles me. This is clearly not the right approach here... the memory map should be fed to the kernel, this has been a requirement all along, and Linus has very deliberately not agreed to exceptions (and I agree with that stance.)
So this patch is a non-starter... I presume the memory map is being provided in through the device (which means it should be fed into memblock in current kernels, although the ordering may need to be tweaked?)
-hpa