diff options
author | Yinghai Lu <Yinghai.Lu@Sun.COM> | 2008-02-22 16:37:26 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-04-17 11:40:49 -0400 |
commit | 1e934dda0c77c8ad13fdda02074f2cfcea118a56 (patch) | |
tree | 83c149b09859f143eb81e2447bcdd78e54e311f1 /arch/x86/kernel/apic_64.c | |
parent | 3def3d6ddf43dbe20c00c3cbc38dfacc8586998f (diff) |
x86: insert_resorce for lapic addr after e820_reserve_resources
when comparing the e820 direct from BIOS, and the one by kexec:
BIOS-provided physical RAM map:
- BIOS-e820: 0000000000000000 - 0000000000097400 (usable)
+ BIOS-e820: 0000000000000100 - 0000000000097400 (usable)
BIOS-e820: 0000000000097400 - 00000000000a0000 (reserved)
BIOS-e820: 00000000000e6000 - 0000000000100000 (reserved)
BIOS-e820: 0000000000100000 - 00000000dffa0000 (usable)
- BIOS-e820: 00000000dffae000 - 00000000dffb0000 type 9
+ BIOS-e820: 00000000dffae000 - 00000000dffb0000 (reserved)
BIOS-e820: 00000000dffb0000 - 00000000dffbe000 (ACPI data)
BIOS-e820: 00000000dffbe000 - 00000000dfff0000 (ACPI NVS)
BIOS-e820: 00000000dfff0000 - 00000000e0000000 (reserved)
BIOS-e820: 00000000fec00000 - 00000000fec01000 (reserved)
- BIOS-e820: 00000000fee00000 - 00000000fee01000 (reserved)
=======> that is the local apic address... somewhere we lost it
BIOS-e820: 00000000ff700000 - 0000000100000000 (reserved)
BIOS-e820: 0000000100000000 - 0000004020000000 (usable)
found one entry about reserved is missing for the kernel by kexec.
it turns out init_apic_mappings is called before e820_reserve_resources
in setup_arch. but e820_reserve_resources is using request_resource.
it will not handle the conflicts.
there are three ways to fix it:
1. change request_resource in e820_reserve_resources to to insert_resource
2. move init_apic_mappings after e820_reserve_resources
3. use late_initcall to insert lapic resource.
this patch is using method 3, that is less intrusive.
in later version could consider to use method 1.
before patch
fed20000-ffffffff : PCI Bus #00
fee00000-fee00fff : Local APIC
fefff000-feffffff : pnp 00:09
ff700000-ffffffff : reserved
with patch will get map in first kernel
fed20000-ffffffff : PCI Bus #00
fee00000-fee00fff : Local APIC
fee00000-fee00fff : reserved
fefff000-feffffff : pnp 00:09
ff700000-ffffffff : reserved
Signed-off-by: Yinghai Lu <yinghai.lu@sun.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch/x86/kernel/apic_64.c')
-rw-r--r-- | arch/x86/kernel/apic_64.c | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/arch/x86/kernel/apic_64.c b/arch/x86/kernel/apic_64.c index 7d8ffdaa0ab3..ac2405ed504d 100644 --- a/arch/x86/kernel/apic_64.c +++ b/arch/x86/kernel/apic_64.c | |||
@@ -881,11 +881,6 @@ void __init init_apic_mappings(void) | |||
881 | apic_printk(APIC_VERBOSE, "mapped APIC to %16lx (%16lx)\n", | 881 | apic_printk(APIC_VERBOSE, "mapped APIC to %16lx (%16lx)\n", |
882 | APIC_BASE, apic_phys); | 882 | APIC_BASE, apic_phys); |
883 | 883 | ||
884 | /* Put local APIC into the resource map. */ | ||
885 | lapic_resource.start = apic_phys; | ||
886 | lapic_resource.end = lapic_resource.start + PAGE_SIZE - 1; | ||
887 | insert_resource(&iomem_resource, &lapic_resource); | ||
888 | |||
889 | /* | 884 | /* |
890 | * Fetch the APIC ID of the BSP in case we have a | 885 | * Fetch the APIC ID of the BSP in case we have a |
891 | * default configuration (or the MP table is broken). | 886 | * default configuration (or the MP table is broken). |
@@ -1300,3 +1295,21 @@ static __init int setup_apicpmtimer(char *s) | |||
1300 | } | 1295 | } |
1301 | __setup("apicpmtimer", setup_apicpmtimer); | 1296 | __setup("apicpmtimer", setup_apicpmtimer); |
1302 | 1297 | ||
1298 | static int __init lapic_insert_resource(void) | ||
1299 | { | ||
1300 | if (!apic_phys) | ||
1301 | return -1; | ||
1302 | |||
1303 | /* Put local APIC into the resource map. */ | ||
1304 | lapic_resource.start = apic_phys; | ||
1305 | lapic_resource.end = lapic_resource.start + PAGE_SIZE - 1; | ||
1306 | insert_resource(&iomem_resource, &lapic_resource); | ||
1307 | |||
1308 | return 0; | ||
1309 | } | ||
1310 | |||
1311 | /* | ||
1312 | * need call insert after e820_reserve_resources() | ||
1313 | * that is using request_resource | ||
1314 | */ | ||
1315 | late_initcall(lapic_insert_resource); | ||