Commit 042be38e6106ed70b42d096ab4a1ed4187e510e6
Committed by
H. Peter Anvin
1 parent
b4a5e8a1de
Exists in
master
and in
39 other branches
ibft, x86: Change reserve_ibft_region() to find_ibft_region()
This allows arch code could decide the way to reserve the ibft. And we should reserve ibft as early as possible, instead of BOOTMEM stage, in case the table is in RAM range and is not reserved by BIOS (this will often be the case.) Move to just after find_smp_config(). Also when CONFIG_NO_BOOTMEM=y, We will not have reserve_bootmem() anymore. -v2: fix typo about ibft pointed by Konrad Rzeszutek Wilk <konrad@darnok.org> Signed-off-by: Yinghai Lu <yinghai@kernel.org> LKML-Reference: <4BB510FB.80601@kernel.org> Cc: Pekka Enberg <penberg@cs.helsinki.fi> Cc: Peter Jones <pjones@redhat.com> Cc: Konrad Rzeszutek Wilk <konrad@kernel.org> CC: Jan Beulich <jbeulich@novell.com> Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Showing 3 changed files with 26 additions and 7 deletions Side-by-side Diff
arch/x86/kernel/setup.c
... | ... | @@ -608,6 +608,16 @@ |
608 | 608 | early_param("elfcorehdr", setup_elfcorehdr); |
609 | 609 | #endif |
610 | 610 | |
611 | +static __init void reserve_ibft_region(void) | |
612 | +{ | |
613 | + unsigned long addr, size = 0; | |
614 | + | |
615 | + addr = find_ibft_region(&size); | |
616 | + | |
617 | + if (size) | |
618 | + reserve_early_overlap_ok(addr, addr + size, "ibft"); | |
619 | +} | |
620 | + | |
611 | 621 | #ifdef CONFIG_X86_RESERVE_LOW_64K |
612 | 622 | static int __init dmi_low_memory_corruption(const struct dmi_system_id *d) |
613 | 623 | { |
... | ... | @@ -910,6 +920,8 @@ |
910 | 920 | */ |
911 | 921 | find_smp_config(); |
912 | 922 | |
923 | + reserve_ibft_region(); | |
924 | + | |
913 | 925 | reserve_trampoline_memory(); |
914 | 926 | |
915 | 927 | #ifdef CONFIG_ACPI_SLEEP |
... | ... | @@ -976,8 +988,6 @@ |
976 | 988 | #endif |
977 | 989 | |
978 | 990 | dma32_reserve_bootmem(); |
979 | - | |
980 | - reserve_ibft_region(); | |
981 | 991 | |
982 | 992 | #ifdef CONFIG_KVM_CLOCK |
983 | 993 | kvmclock_init(); |
drivers/firmware/iscsi_ibft_find.c
... | ... | @@ -52,7 +52,7 @@ |
52 | 52 | * Routine used to find the iSCSI Boot Format Table. The logical |
53 | 53 | * kernel address is set in the ibft_addr global variable. |
54 | 54 | */ |
55 | -void __init reserve_ibft_region(void) | |
55 | +unsigned long __init find_ibft_region(unsigned long *sizep) | |
56 | 56 | { |
57 | 57 | unsigned long pos; |
58 | 58 | unsigned int len = 0; |
... | ... | @@ -78,7 +78,12 @@ |
78 | 78 | } |
79 | 79 | } |
80 | 80 | } |
81 | - if (ibft_addr) | |
82 | - reserve_bootmem(pos, PAGE_ALIGN(len), BOOTMEM_DEFAULT); | |
81 | + if (ibft_addr) { | |
82 | + *sizep = PAGE_ALIGN(len); | |
83 | + return pos; | |
84 | + } | |
85 | + | |
86 | + *sizep = 0; | |
87 | + return 0; | |
83 | 88 | } |
include/linux/iscsi_ibft.h
... | ... | @@ -42,9 +42,13 @@ |
42 | 42 | * mapped address is set in the ibft_addr variable. |
43 | 43 | */ |
44 | 44 | #ifdef CONFIG_ISCSI_IBFT_FIND |
45 | -extern void __init reserve_ibft_region(void); | |
45 | +unsigned long find_ibft_region(unsigned long *sizep); | |
46 | 46 | #else |
47 | -static inline void reserve_ibft_region(void) { } | |
47 | +static inline unsigned long find_ibft_region(unsigned long *sizep) | |
48 | +{ | |
49 | + *sizep = 0; | |
50 | + return 0; | |
51 | +} | |
48 | 52 | #endif |
49 | 53 | |
50 | 54 | #endif /* ISCSI_IBFT_H */ |