From 66441bd3cfdcc03816b7009a296c284d70f629e1 Mon Sep 17 00:00:00 2001 From: Ingo Molnar Date: Fri, 27 Jan 2017 10:27:10 +0100 Subject: x86/boot/e820: Move asm/e820.h to asm/e820/api.h In line with asm/e820/types.h, move the e820 API declarations to asm/e820/api.h and update all usage sites. This is just a mechanical, obviously correct move & replace patch, there will be subsequent changes to clean up the code and to make better use of the new header organization. Cc: Alex Thorlton Cc: Andy Lutomirski Cc: Borislav Petkov Cc: Brian Gerst Cc: Dan Williams Cc: Denys Vlasenko Cc: H. Peter Anvin Cc: Huang, Ying Cc: Josh Poimboeuf Cc: Juergen Gross Cc: Linus Torvalds Cc: Paul Jackson Cc: Peter Zijlstra Cc: Rafael J. Wysocki Cc: Tejun Heo Cc: Thomas Gleixner Cc: Wei Yang Cc: Yinghai Lu Cc: linux-kernel@vger.kernel.org Signed-off-by: Ingo Molnar --- arch/x86/platform/efi/efi_64.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'arch/x86/platform') diff --git a/arch/x86/platform/efi/efi_64.c b/arch/x86/platform/efi/efi_64.c index 319148bd4b05..2cc992be0070 100644 --- a/arch/x86/platform/efi/efi_64.c +++ b/arch/x86/platform/efi/efi_64.c @@ -35,7 +35,7 @@ #include #include -#include +#include #include #include #include -- cgit v1.2.3 From 5520b7e7d2d20ae2ab6e07b46c42cd43df9d2799 Mon Sep 17 00:00:00 2001 From: Ingo Molnar Date: Fri, 27 Jan 2017 11:59:46 +0100 Subject: x86/boot/e820: Remove spurious asm/e820/api.h inclusions A commonly used lowlevel x86 header, asm/pgtable.h, includes asm/e820/api.h spuriously, without making direct use of it. Removing it is not simple: over the years various .c code learned to rely on this indirect inclusion. Remove the unnecessary include - this should speed up the kernel build a bit, as a large header is not included anymore in totally unrelated code. Cc: Alex Thorlton Cc: Andy Lutomirski Cc: Borislav Petkov Cc: Brian Gerst Cc: Dan Williams Cc: Denys Vlasenko Cc: H. Peter Anvin Cc: Huang, Ying Cc: Josh Poimboeuf Cc: Juergen Gross Cc: Linus Torvalds Cc: Paul Jackson Cc: Peter Zijlstra Cc: Rafael J. Wysocki Cc: Tejun Heo Cc: Thomas Gleixner Cc: Wei Yang Cc: Yinghai Lu Cc: linux-kernel@vger.kernel.org Signed-off-by: Ingo Molnar --- arch/x86/boot/compressed/eboot.c | 2 ++ arch/x86/include/asm/pci_x86.h | 2 ++ arch/x86/include/asm/pgtable.h | 2 -- arch/x86/kernel/acpi/boot.c | 1 + arch/x86/kernel/apic/x2apic_uv_x.c | 1 + arch/x86/kernel/crash.c | 1 + arch/x86/kernel/kexec-bzimage64.c | 1 + arch/x86/mm/kasan_init_64.c | 1 + arch/x86/pci/pcbios.c | 2 ++ arch/x86/platform/efi/efi.c | 1 + arch/x86/platform/efi/quirks.c | 2 ++ arch/x86/power/hibernate_64.c | 1 + 12 files changed, 15 insertions(+), 2 deletions(-) (limited to 'arch/x86/platform') diff --git a/arch/x86/boot/compressed/eboot.c b/arch/x86/boot/compressed/eboot.c index ff01c8fc76f7..2066f74cf9b2 100644 --- a/arch/x86/boot/compressed/eboot.c +++ b/arch/x86/boot/compressed/eboot.c @@ -9,7 +9,9 @@ #include #include + #include +#include #include #include diff --git a/arch/x86/include/asm/pci_x86.h b/arch/x86/include/asm/pci_x86.h index d08eacd298c2..9f1b21f372fe 100644 --- a/arch/x86/include/asm/pci_x86.h +++ b/arch/x86/include/asm/pci_x86.h @@ -4,6 +4,8 @@ * (c) 1999 Martin Mares */ +#include + #undef DEBUG #ifdef DEBUG diff --git a/arch/x86/include/asm/pgtable.h b/arch/x86/include/asm/pgtable.h index ae0b84d8ccb5..ffaefb24891c 100644 --- a/arch/x86/include/asm/pgtable.h +++ b/arch/x86/include/asm/pgtable.h @@ -2,8 +2,6 @@ #define _ASM_X86_PGTABLE_H #include -#include - #include /* diff --git a/arch/x86/kernel/acpi/boot.c b/arch/x86/kernel/acpi/boot.c index 64422f850e95..8048c76a4458 100644 --- a/arch/x86/kernel/acpi/boot.c +++ b/arch/x86/kernel/acpi/boot.c @@ -36,6 +36,7 @@ #include #include +#include #include #include #include diff --git a/arch/x86/kernel/apic/x2apic_uv_x.c b/arch/x86/kernel/apic/x2apic_uv_x.c index 35690a168cf7..c99d9333ebac 100644 --- a/arch/x86/kernel/apic/x2apic_uv_x.c +++ b/arch/x86/kernel/apic/x2apic_uv_x.c @@ -34,6 +34,7 @@ #include #include #include +#include #include #include #include diff --git a/arch/x86/kernel/crash.c b/arch/x86/kernel/crash.c index 3741461c63a0..60c018530379 100644 --- a/arch/x86/kernel/crash.c +++ b/arch/x86/kernel/crash.c @@ -29,6 +29,7 @@ #include #include #include +#include #include #include #include diff --git a/arch/x86/kernel/kexec-bzimage64.c b/arch/x86/kernel/kexec-bzimage64.c index d0a814a9d96a..2f4a3c8127f6 100644 --- a/arch/x86/kernel/kexec-bzimage64.c +++ b/arch/x86/kernel/kexec-bzimage64.c @@ -25,6 +25,7 @@ #include #include #include +#include #include #define MAX_ELFCOREHDR_STR_LEN 30 /* elfcorehdr=0x<64bit-value> */ diff --git a/arch/x86/mm/kasan_init_64.c b/arch/x86/mm/kasan_init_64.c index 0493c17b8a51..bf9a511c98f3 100644 --- a/arch/x86/mm/kasan_init_64.c +++ b/arch/x86/mm/kasan_init_64.c @@ -6,6 +6,7 @@ #include #include +#include #include #include diff --git a/arch/x86/pci/pcbios.c b/arch/x86/pci/pcbios.c index 1d97cea3b3a4..29e9ba6ace9d 100644 --- a/arch/x86/pci/pcbios.c +++ b/arch/x86/pci/pcbios.c @@ -7,7 +7,9 @@ #include #include #include + #include +#include #include #include diff --git a/arch/x86/platform/efi/efi.c b/arch/x86/platform/efi/efi.c index 274dfc481849..528f682ec640 100644 --- a/arch/x86/platform/efi/efi.c +++ b/arch/x86/platform/efi/efi.c @@ -47,6 +47,7 @@ #include #include +#include #include #include #include diff --git a/arch/x86/platform/efi/quirks.c b/arch/x86/platform/efi/quirks.c index 30031d5293c4..c6a14b11f496 100644 --- a/arch/x86/platform/efi/quirks.c +++ b/arch/x86/platform/efi/quirks.c @@ -11,6 +11,8 @@ #include #include #include + +#include #include #include diff --git a/arch/x86/power/hibernate_64.c b/arch/x86/power/hibernate_64.c index ded2e8272382..13e87bf86043 100644 --- a/arch/x86/power/hibernate_64.c +++ b/arch/x86/power/hibernate_64.c @@ -16,6 +16,7 @@ #include +#include #include #include #include -- cgit v1.2.3 From acd4c048728814505fae8e224cf9074bd1ad291e Mon Sep 17 00:00:00 2001 From: Ingo Molnar Date: Fri, 27 Jan 2017 13:20:53 +0100 Subject: x86/boot/e820: Rename 'e820_map' variables to 'e820_array' In line with the rename to 'struct e820_array', harmonize the naming of common e820 table variable names as well: e820 => e820_array e820_saved => e820_array_saved e820_map => e820_array initial_e820 => e820_array_init This makes the variable names more consistent and easier to grep for. No change in functionality. Cc: Alex Thorlton Cc: Andy Lutomirski Cc: Borislav Petkov Cc: Brian Gerst Cc: Dan Williams Cc: Denys Vlasenko Cc: H. Peter Anvin Cc: Huang, Ying Cc: Josh Poimboeuf Cc: Juergen Gross Cc: Linus Torvalds Cc: Paul Jackson Cc: Peter Zijlstra Cc: Rafael J. Wysocki Cc: Tejun Heo Cc: Thomas Gleixner Cc: Wei Yang Cc: Yinghai Lu Cc: linux-kernel@vger.kernel.org Signed-off-by: Ingo Molnar --- Documentation/x86/zero-page.txt | 4 +- arch/x86/boot/compressed/eboot.c | 22 ++--- arch/x86/boot/compressed/kaslr.c | 2 +- arch/x86/boot/memory.c | 4 +- arch/x86/include/asm/e820/api.h | 6 +- arch/x86/include/asm/e820/types.h | 2 +- arch/x86/include/uapi/asm/bootparam.h | 2 +- arch/x86/kernel/crash.c | 2 +- arch/x86/kernel/e820.c | 148 +++++++++++++++++----------------- arch/x86/kernel/early-quirks.c | 2 +- arch/x86/kernel/kexec-bzimage64.c | 10 +-- arch/x86/kernel/resource.c | 4 +- arch/x86/kernel/setup.c | 10 +-- arch/x86/kernel/tboot.c | 8 +- arch/x86/lguest/boot.c | 6 +- arch/x86/platform/efi/efi.c | 2 +- arch/x86/power/hibernate_64.c | 4 +- arch/x86/xen/setup.c | 76 ++++++++--------- tools/lguest/lguest.c | 2 +- 19 files changed, 158 insertions(+), 158 deletions(-) (limited to 'arch/x86/platform') diff --git a/Documentation/x86/zero-page.txt b/Documentation/x86/zero-page.txt index 1746ddcfa50c..b323b705f419 100644 --- a/Documentation/x86/zero-page.txt +++ b/Documentation/x86/zero-page.txt @@ -27,12 +27,12 @@ Offset Proto Name Meaning 1C0/020 ALL efi_info EFI 32 information (struct efi_info) 1E0/004 ALL alk_mem_k Alternative mem check, in KB 1E4/004 ALL scratch Scratch field for the kernel setup code -1E8/001 ALL e820_entries Number of entries in e820_map (below) +1E8/001 ALL e820_entries Number of entries in e820_array (below) 1E9/001 ALL eddbuf_entries Number of entries in eddbuf (below) 1EA/001 ALL edd_mbr_sig_buf_entries Number of entries in edd_mbr_sig_buffer (below) 1EF/001 ALL sentinel Used to detect broken bootloaders 290/040 ALL edd_mbr_sig_buffer EDD MBR signatures -2D0/A00 ALL e820_map E820 memory map table +2D0/A00 ALL e820_array E820 memory map table (array of struct e820_entry) D00/1EC ALL eddbuf EDD data (array of struct edd_info) diff --git a/arch/x86/boot/compressed/eboot.c b/arch/x86/boot/compressed/eboot.c index e1a3e2cde5cb..b5cc1e72c63a 100644 --- a/arch/x86/boot/compressed/eboot.c +++ b/arch/x86/boot/compressed/eboot.c @@ -917,7 +917,7 @@ static void add_e820ext(struct boot_params *params, static efi_status_t setup_e820(struct boot_params *params, struct setup_data *e820ext, u32 e820ext_size) { - struct e820_entry *e820_map = ¶ms->e820_map[0]; + struct e820_entry *e820_array = ¶ms->e820_array[0]; struct efi_info *efi = ¶ms->efi_info; struct e820_entry *prev = NULL; u32 nr_entries; @@ -982,7 +982,7 @@ static efi_status_t setup_e820(struct boot_params *params, continue; } - if (nr_entries == ARRAY_SIZE(params->e820_map)) { + if (nr_entries == ARRAY_SIZE(params->e820_array)) { u32 need = (nr_desc - i) * sizeof(struct e820_entry) + sizeof(struct setup_data); @@ -990,18 +990,18 @@ static efi_status_t setup_e820(struct boot_params *params, return EFI_BUFFER_TOO_SMALL; /* boot_params map full, switch to e820 extended */ - e820_map = (struct e820_entry *)e820ext->data; + e820_array = (struct e820_entry *)e820ext->data; } - e820_map->addr = d->phys_addr; - e820_map->size = d->num_pages << PAGE_SHIFT; - e820_map->type = e820_type; - prev = e820_map++; + e820_array->addr = d->phys_addr; + e820_array->size = d->num_pages << PAGE_SHIFT; + e820_array->type = e820_type; + prev = e820_array++; nr_entries++; } - if (nr_entries > ARRAY_SIZE(params->e820_map)) { - u32 nr_e820ext = nr_entries - ARRAY_SIZE(params->e820_map); + if (nr_entries > ARRAY_SIZE(params->e820_array)) { + u32 nr_e820ext = nr_entries - ARRAY_SIZE(params->e820_array); add_e820ext(params, e820ext, nr_e820ext); nr_entries -= nr_e820ext; @@ -1055,9 +1055,9 @@ static efi_status_t exit_boot_func(efi_system_table_t *sys_table_arg, if (first) { nr_desc = *map->buff_size / *map->desc_size; - if (nr_desc > ARRAY_SIZE(p->boot_params->e820_map)) { + if (nr_desc > ARRAY_SIZE(p->boot_params->e820_array)) { u32 nr_e820ext = nr_desc - - ARRAY_SIZE(p->boot_params->e820_map); + ARRAY_SIZE(p->boot_params->e820_array); status = alloc_e820ext(nr_e820ext, &p->e820ext, &p->e820ext_size); diff --git a/arch/x86/boot/compressed/kaslr.c b/arch/x86/boot/compressed/kaslr.c index 17da12e92e99..f0e37236cfe1 100644 --- a/arch/x86/boot/compressed/kaslr.c +++ b/arch/x86/boot/compressed/kaslr.c @@ -518,7 +518,7 @@ static unsigned long find_random_phys_addr(unsigned long minimum, /* Verify potential e820 positions, appending to slots list. */ for (i = 0; i < boot_params->e820_entries; i++) { - process_e820_entry(&boot_params->e820_map[i], minimum, + process_e820_entry(&boot_params->e820_array[i], minimum, image_size); if (slot_area_index == MAX_SLOT_AREA) { debug_putstr("Aborted e820 scan (slot_areas full)!\n"); diff --git a/arch/x86/boot/memory.c b/arch/x86/boot/memory.c index 331b3d831cc4..f2132b3e6880 100644 --- a/arch/x86/boot/memory.c +++ b/arch/x86/boot/memory.c @@ -21,7 +21,7 @@ static int detect_memory_e820(void) { int count = 0; struct biosregs ireg, oreg; - struct e820_entry *desc = boot_params.e820_map; + struct e820_entry *desc = boot_params.e820_array; static struct e820_entry buf; /* static so it is zeroed */ initregs(&ireg); @@ -66,7 +66,7 @@ static int detect_memory_e820(void) *desc++ = buf; count++; - } while (ireg.ebx && count < ARRAY_SIZE(boot_params.e820_map)); + } while (ireg.ebx && count < ARRAY_SIZE(boot_params.e820_array)); return boot_params.e820_entries = count; } diff --git a/arch/x86/include/asm/e820/api.h b/arch/x86/include/asm/e820/api.h index 4895544b17ab..0156532dd65a 100644 --- a/arch/x86/include/asm/e820/api.h +++ b/arch/x86/include/asm/e820/api.h @@ -4,8 +4,8 @@ #include /* see comment in arch/x86/kernel/e820.c */ -extern struct e820_array *e820; -extern struct e820_array *e820_saved; +extern struct e820_array *e820_array; +extern struct e820_array *e820_array_saved; extern unsigned long pci_mem_start; @@ -13,7 +13,7 @@ extern int e820_any_mapped(u64 start, u64 end, unsigned type); extern int e820_all_mapped(u64 start, u64 end, unsigned type); extern void e820_add_region(u64 start, u64 size, int type); extern void e820_print_map(char *who); -extern int sanitize_e820_map(struct e820_entry *biosmap, int max_nr_map, u32 *pnr_map); +extern int sanitize_e820_array(struct e820_entry *biosmap, int max_nr_map, u32 *pnr_map); extern u64 e820_update_range(u64 start, u64 size, unsigned old_type, unsigned new_type); extern u64 e820_remove_range(u64 start, u64 size, unsigned old_type, int checktype); extern void update_e820(void); diff --git a/arch/x86/include/asm/e820/types.h b/arch/x86/include/asm/e820/types.h index 05e25cabfafb..e3171867e126 100644 --- a/arch/x86/include/asm/e820/types.h +++ b/arch/x86/include/asm/e820/types.h @@ -21,7 +21,7 @@ * * This allows for bootstrap/firmware quirks such as possible duplicate * E820 entries that might need room in the same arrays, prior to the - * call to sanitize_e820_map() to remove duplicates. The allowance + * call to sanitize_e820_array() to remove duplicates. The allowance * of three memory map entries per node is "enough" entries for * the initial hardware platform motivating this mechanism to make * use of additional EFI map entries. Future platforms may want diff --git a/arch/x86/include/uapi/asm/bootparam.h b/arch/x86/include/uapi/asm/bootparam.h index f0a7170d5a9d..702f1c6d804e 100644 --- a/arch/x86/include/uapi/asm/bootparam.h +++ b/arch/x86/include/uapi/asm/bootparam.h @@ -152,7 +152,7 @@ struct boot_params { struct setup_header hdr; /* setup header */ /* 0x1f1 */ __u8 _pad7[0x290-0x1f1-sizeof(struct setup_header)]; __u32 edd_mbr_sig_buffer[EDD_MBR_SIG_MAX]; /* 0x290 */ - struct e820_entry e820_map[E820MAX]; /* 0x2d0 */ + struct e820_entry e820_array[E820MAX]; /* 0x2d0 */ __u8 _pad8[48]; /* 0xcd0 */ struct edd_info eddbuf[EDDMAXNR]; /* 0xd00 */ __u8 _pad9[276]; /* 0xeec */ diff --git a/arch/x86/kernel/crash.c b/arch/x86/kernel/crash.c index 81b67df3b52f..036d9140384d 100644 --- a/arch/x86/kernel/crash.c +++ b/arch/x86/kernel/crash.c @@ -512,7 +512,7 @@ static int add_e820_entry(struct boot_params *params, struct e820_entry *entry) if (nr_e820_entries >= E820MAX) return 1; - memcpy(¶ms->e820_map[nr_e820_entries], entry, + memcpy(¶ms->e820_array[nr_e820_entries], entry, sizeof(struct e820_entry)); params->e820_entries++; return 0; diff --git a/arch/x86/kernel/e820.c b/arch/x86/kernel/e820.c index 1f75b95185b8..49d47d6b1afe 100644 --- a/arch/x86/kernel/e820.c +++ b/arch/x86/kernel/e820.c @@ -2,7 +2,7 @@ * Handle the memory map. * The functions here do the job until bootmem takes over. * - * Getting sanitize_e820_map() in sync with i386 version by applying change: + * Getting sanitize_e820_array() in sync with i386 version by applying change: * - Provisions for empty E820 memory regions (reported by certain BIOSes). * Alex Achenbach , December 2002. * Venkatesh Pallipadi @@ -27,11 +27,11 @@ #include /* - * The e820 map is the map that gets modified e.g. with command line parameters + * The e820 table is the array that gets modified e.g. with command line parameters * and that is also registered with modifications in the kernel resource tree * with the iomem_resource as parent. * - * The e820_saved is directly saved after the BIOS-provided memory map is + * The e820_array_saved is directly saved after the BIOS-provided memory map is * copied. It doesn't get modified afterwards. It's registered for the * /sys/firmware/memmap interface. * @@ -40,10 +40,10 @@ * user can e.g. boot the original kernel with mem=1G while still booting the * next kernel with full memory. */ -static struct e820_array initial_e820 __initdata; -static struct e820_array initial_e820_saved __initdata; -struct e820_array *e820 __refdata = &initial_e820; -struct e820_array *e820_saved __refdata = &initial_e820_saved; +static struct e820_array e820_array_init __initdata; +static struct e820_array initial_e820_array_saved __initdata; +struct e820_array *e820_array __refdata = &e820_array_init; +struct e820_array *e820_array_saved __refdata = &initial_e820_array_saved; /* For PCI or other memory-mapped resources */ unsigned long pci_mem_start = 0xaeedbabe; @@ -60,8 +60,8 @@ e820_any_mapped(u64 start, u64 end, unsigned type) { int i; - for (i = 0; i < e820->nr_map; i++) { - struct e820_entry *ei = &e820->map[i]; + for (i = 0; i < e820_array->nr_map; i++) { + struct e820_entry *ei = &e820_array->map[i]; if (type && ei->type != type) continue; @@ -83,8 +83,8 @@ int __init e820_all_mapped(u64 start, u64 end, unsigned type) { int i; - for (i = 0; i < e820->nr_map; i++) { - struct e820_entry *ei = &e820->map[i]; + for (i = 0; i < e820_array->nr_map; i++) { + struct e820_entry *ei = &e820_array->map[i]; if (type && ei->type != type) continue; @@ -130,7 +130,7 @@ static void __init __e820_add_region(struct e820_array *e820x, u64 start, u64 si void __init e820_add_region(u64 start, u64 size, int type) { - __e820_add_region(e820, start, size, type); + __e820_add_region(e820_array, start, size, type); } static void __init e820_print_type(u32 type) @@ -166,12 +166,12 @@ void __init e820_print_map(char *who) { int i; - for (i = 0; i < e820->nr_map; i++) { + for (i = 0; i < e820_array->nr_map; i++) { printk(KERN_INFO "%s: [mem %#018Lx-%#018Lx] ", who, - (unsigned long long) e820->map[i].addr, + (unsigned long long) e820_array->map[i].addr, (unsigned long long) - (e820->map[i].addr + e820->map[i].size - 1)); - e820_print_type(e820->map[i].type); + (e820_array->map[i].addr + e820_array->map[i].size - 1)); + e820_print_type(e820_array->map[i].type); printk(KERN_CONT "\n"); } } @@ -195,7 +195,7 @@ void __init e820_print_map(char *who) * sanitizing succeeds the *pnr_map will be updated with the new * number of valid entries (something no more than max_nr_map). * - * The return value from sanitize_e820_map() is zero if it + * The return value from sanitize_e820_array() is zero if it * successfully 'sanitized' the map entries passed in, and is -1 * if it did nothing, which can happen if either of (1) it was * only passed one map entry, or (2) any of the input map entries @@ -259,7 +259,7 @@ static int __init cpcompare(const void *a, const void *b) return (ap->addr != ap->pbios->addr) - (bp->addr != bp->pbios->addr); } -int __init sanitize_e820_map(struct e820_entry *biosmap, int max_nr_map, +int __init sanitize_e820_array(struct e820_entry *biosmap, int max_nr_map, u32 *pnr_map) { static struct change_member change_point_list[2*E820_X_MAX] __initdata; @@ -385,7 +385,7 @@ int __init sanitize_e820_map(struct e820_entry *biosmap, int max_nr_map, return 0; } -static int __init __append_e820_map(struct e820_entry *biosmap, int nr_map) +static int __init __append_e820_array(struct e820_entry *biosmap, int nr_map) { while (nr_map) { u64 start = biosmap->addr; @@ -414,13 +414,13 @@ static int __init __append_e820_map(struct e820_entry *biosmap, int nr_map) * will have given us a memory map that we can use to properly * set up memory. If we aren't, we'll fake a memory map. */ -static int __init append_e820_map(struct e820_entry *biosmap, int nr_map) +static int __init append_e820_array(struct e820_entry *biosmap, int nr_map) { /* Only one memory region (or negative)? Ignore it */ if (nr_map < 2) return -1; - return __append_e820_map(biosmap, nr_map); + return __append_e820_array(biosmap, nr_map); } static u64 __init __e820_update_range(struct e820_array *e820x, u64 start, @@ -495,13 +495,13 @@ static u64 __init __e820_update_range(struct e820_array *e820x, u64 start, u64 __init e820_update_range(u64 start, u64 size, unsigned old_type, unsigned new_type) { - return __e820_update_range(e820, start, size, old_type, new_type); + return __e820_update_range(e820_array, 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(e820_saved, start, size, old_type, + return __e820_update_range(e820_array_saved, start, size, old_type, new_type); } @@ -523,8 +523,8 @@ u64 __init e820_remove_range(u64 start, u64 size, unsigned old_type, e820_print_type(old_type); printk(KERN_CONT "\n"); - for (i = 0; i < e820->nr_map; i++) { - struct e820_entry *ei = &e820->map[i]; + for (i = 0; i < e820_array->nr_map; i++) { + struct e820_entry *ei = &e820_array->map[i]; u64 final_start, final_end; u64 ei_end; @@ -568,15 +568,15 @@ u64 __init e820_remove_range(u64 start, u64 size, unsigned old_type, void __init update_e820(void) { - if (sanitize_e820_map(e820->map, ARRAY_SIZE(e820->map), &e820->nr_map)) + if (sanitize_e820_array(e820_array->map, ARRAY_SIZE(e820_array->map), &e820_array->nr_map)) return; printk(KERN_INFO "e820: modified physical RAM map:\n"); e820_print_map("modified"); } -static void __init update_e820_saved(void) +static void __init update_e820_array_saved(void) { - sanitize_e820_map(e820_saved->map, ARRAY_SIZE(e820_saved->map), - &e820_saved->nr_map); + sanitize_e820_array(e820_array_saved->map, ARRAY_SIZE(e820_array_saved->map), + &e820_array_saved->nr_map); } #define MAX_GAP_END 0x100000000ull /* @@ -586,12 +586,12 @@ static int __init e820_search_gap(unsigned long *gapstart, unsigned long *gapsize) { unsigned long long last = MAX_GAP_END; - int i = e820->nr_map; + int i = e820_array->nr_map; int found = 0; while (--i >= 0) { - unsigned long long start = e820->map[i].addr; - unsigned long long end = start + e820->map[i].size; + unsigned long long start = e820_array->map[i].addr; + unsigned long long end = start + e820_array->map[i].size; /* * Since "last" is at most 4GB, we know we'll @@ -650,7 +650,7 @@ __init void e820_setup_gap(void) /* * Called late during init, in free_initmem(). * - * Initial e820 and e820_saved are largish __initdata arrays. + * Initial e820 and e820_array_saved are largish __initdata arrays. * Copy them to (usually much smaller) dynamically allocated area. * This is done after all tweaks we ever do to them: * all functions which modify them are __init functions, @@ -661,23 +661,23 @@ __init void e820_reallocate_tables(void) struct e820_array *n; int size; - size = offsetof(struct e820_array, map) + sizeof(struct e820_entry) * e820->nr_map; + size = offsetof(struct e820_array, map) + sizeof(struct e820_entry) * e820_array->nr_map; n = kmalloc(size, GFP_KERNEL); BUG_ON(!n); - memcpy(n, e820, size); - e820 = n; + memcpy(n, e820_array, size); + e820_array = n; - size = offsetof(struct e820_array, map) + sizeof(struct e820_entry) * e820_saved->nr_map; + size = offsetof(struct e820_array, map) + sizeof(struct e820_entry) * e820_array_saved->nr_map; n = kmalloc(size, GFP_KERNEL); BUG_ON(!n); - memcpy(n, e820_saved, size); - e820_saved = n; + memcpy(n, e820_array_saved, size); + e820_array_saved = n; } /** * Because of the size limitation of struct boot_params, only first * 128 E820 memory entries are passed to kernel via - * boot_params.e820_map, others are passed via SETUP_E820_EXT node of + * boot_params.e820_array, others are passed via SETUP_E820_EXT node of * linked list of struct setup_data, which is parsed here. */ void __init parse_e820_ext(u64 phys_addr, u32 data_len) @@ -689,8 +689,8 @@ void __init parse_e820_ext(u64 phys_addr, u32 data_len) sdata = early_memremap(phys_addr, data_len); entries = sdata->len / sizeof(struct e820_entry); extmap = (struct e820_entry *)(sdata->data); - __append_e820_map(extmap, entries); - sanitize_e820_map(e820->map, ARRAY_SIZE(e820->map), &e820->nr_map); + __append_e820_array(extmap, entries); + sanitize_e820_array(e820_array->map, ARRAY_SIZE(e820_array->map), &e820_array->nr_map); early_memunmap(sdata, data_len); printk(KERN_INFO "e820: extended physical RAM map:\n"); e820_print_map("extended"); @@ -709,8 +709,8 @@ void __init e820_mark_nosave_regions(unsigned long limit_pfn) int i; unsigned long pfn = 0; - for (i = 0; i < e820->nr_map; i++) { - struct e820_entry *ei = &e820->map[i]; + for (i = 0; i < e820_array->nr_map; i++) { + struct e820_entry *ei = &e820_array->map[i]; if (pfn < PFN_UP(ei->addr)) register_nosave_region(pfn, PFN_UP(ei->addr)); @@ -734,8 +734,8 @@ static int __init e820_mark_nvs_memory(void) { int i; - for (i = 0; i < e820->nr_map; i++) { - struct e820_entry *ei = &e820->map[i]; + for (i = 0; i < e820_array->nr_map; i++) { + struct e820_entry *ei = &e820_array->map[i]; if (ei->type == E820_NVS) acpi_nvs_register(ei->addr, ei->size); @@ -747,7 +747,7 @@ core_initcall(e820_mark_nvs_memory); #endif /* - * pre allocated 4k and reserved it in memblock and e820_saved + * pre allocated 4k and reserved it in memblock and e820_array_saved */ u64 __init early_reserve_e820(u64 size, u64 align) { @@ -756,8 +756,8 @@ u64 __init early_reserve_e820(u64 size, u64 align) addr = __memblock_alloc_base(size, align, MEMBLOCK_ALLOC_ACCESSIBLE); if (addr) { e820_update_range_saved(addr, size, E820_RAM, E820_RESERVED); - printk(KERN_INFO "e820: update e820_saved for early_reserve_e820\n"); - update_e820_saved(); + printk(KERN_INFO "e820: update e820_array_saved for early_reserve_e820\n"); + update_e820_array_saved(); } return addr; @@ -782,8 +782,8 @@ static unsigned long __init e820_end_pfn(unsigned long limit_pfn, unsigned type) unsigned long last_pfn = 0; unsigned long max_arch_pfn = MAX_ARCH_PFN; - for (i = 0; i < e820->nr_map; i++) { - struct e820_entry *ei = &e820->map[i]; + for (i = 0; i < e820_array->nr_map; i++) { + struct e820_entry *ei = &e820_array->map[i]; unsigned long start_pfn; unsigned long end_pfn; @@ -874,7 +874,7 @@ static int __init parse_memmap_one(char *p) */ saved_max_pfn = e820_end_of_ram_pfn(); #endif - e820->nr_map = 0; + e820_array->nr_map = 0; userdef = 1; return 0; } @@ -921,8 +921,8 @@ early_param("memmap", parse_memmap_opt); void __init finish_e820_parsing(void) { if (userdef) { - if (sanitize_e820_map(e820->map, ARRAY_SIZE(e820->map), - &e820->nr_map) < 0) + if (sanitize_e820_array(e820_array->map, ARRAY_SIZE(e820_array->map), + &e820_array->nr_map) < 0) early_panic("Invalid user supplied memory map"); printk(KERN_INFO "e820: user-defined physical RAM map:\n"); @@ -1009,35 +1009,35 @@ void __init e820_reserve_resources(void) struct resource *res; u64 end; - res = alloc_bootmem(sizeof(struct resource) * e820->nr_map); + res = alloc_bootmem(sizeof(struct resource) * e820_array->nr_map); e820_res = res; - for (i = 0; i < e820->nr_map; i++) { - end = e820->map[i].addr + e820->map[i].size - 1; + for (i = 0; i < e820_array->nr_map; i++) { + end = e820_array->map[i].addr + e820_array->map[i].size - 1; if (end != (resource_size_t)end) { res++; continue; } - res->name = e820_type_to_string(e820->map[i].type); - res->start = e820->map[i].addr; + res->name = e820_type_to_string(e820_array->map[i].type); + res->start = e820_array->map[i].addr; res->end = end; - res->flags = e820_type_to_iomem_type(e820->map[i].type); - res->desc = e820_type_to_iores_desc(e820->map[i].type); + res->flags = e820_type_to_iomem_type(e820_array->map[i].type); + res->desc = e820_type_to_iores_desc(e820_array->map[i].type); /* * don't register the region that could be conflicted with * pci device BAR resource and insert them later in * pcibios_resource_survey() */ - if (do_mark_busy(e820->map[i].type, res)) { + if (do_mark_busy(e820_array->map[i].type, res)) { res->flags |= IORESOURCE_BUSY; insert_resource(&iomem_resource, res); } res++; } - for (i = 0; i < e820_saved->nr_map; i++) { - struct e820_entry *entry = &e820_saved->map[i]; + for (i = 0; i < e820_array_saved->nr_map; i++) { + struct e820_entry *entry = &e820_array_saved->map[i]; firmware_map_add_early(entry->addr, entry->addr + entry->size, e820_type_to_string(entry->type)); @@ -1069,7 +1069,7 @@ void __init e820_reserve_resources_late(void) struct resource *res; res = e820_res; - for (i = 0; i < e820->nr_map; i++) { + for (i = 0; i < e820_array->nr_map; i++) { if (!res->parent && res->end) insert_resource_expand_to_fit(&iomem_resource, res); res++; @@ -1079,8 +1079,8 @@ void __init e820_reserve_resources_late(void) * Try to bump up RAM regions to reasonable boundaries to * avoid stolen RAM: */ - for (i = 0; i < e820->nr_map; i++) { - struct e820_entry *entry = &e820->map[i]; + for (i = 0; i < e820_array->nr_map; i++) { + struct e820_entry *entry = &e820_array->map[i]; u64 start, end; if (entry->type != E820_RAM) @@ -1110,11 +1110,11 @@ char *__init default_machine_specific_memory_setup(void) * the next section from 1mb->appropriate_mem_k */ new_nr = boot_params.e820_entries; - sanitize_e820_map(boot_params.e820_map, - ARRAY_SIZE(boot_params.e820_map), + sanitize_e820_array(boot_params.e820_array, + ARRAY_SIZE(boot_params.e820_array), &new_nr); boot_params.e820_entries = new_nr; - if (append_e820_map(boot_params.e820_map, boot_params.e820_entries) + if (append_e820_array(boot_params.e820_array, boot_params.e820_entries) < 0) { u64 mem_size; @@ -1128,7 +1128,7 @@ char *__init default_machine_specific_memory_setup(void) who = "BIOS-e801"; } - e820->nr_map = 0; + e820_array->nr_map = 0; e820_add_region(0, LOWMEMSIZE(), E820_RAM); e820_add_region(HIGH_MEMORY, mem_size << 10, E820_RAM); } @@ -1142,7 +1142,7 @@ void __init setup_memory_map(void) char *who; who = x86_init.resources.memory_setup(); - memcpy(e820_saved, e820, sizeof(struct e820_array)); + memcpy(e820_array_saved, e820_array, sizeof(struct e820_array)); printk(KERN_INFO "e820: BIOS-provided physical RAM map:\n"); e820_print_map(who); } @@ -1159,8 +1159,8 @@ void __init memblock_x86_fill(void) */ memblock_allow_resize(); - for (i = 0; i < e820->nr_map; i++) { - struct e820_entry *ei = &e820->map[i]; + for (i = 0; i < e820_array->nr_map; i++) { + struct e820_entry *ei = &e820_array->map[i]; end = ei->addr + ei->size; if (end != (resource_size_t)end) diff --git a/arch/x86/kernel/early-quirks.c b/arch/x86/kernel/early-quirks.c index 6a08e25a48d8..31d755534c36 100644 --- a/arch/x86/kernel/early-quirks.c +++ b/arch/x86/kernel/early-quirks.c @@ -547,7 +547,7 @@ intel_graphics_stolen(int num, int slot, int func, /* Mark this space as reserved */ e820_add_region(base, size, E820_RESERVED); - sanitize_e820_map(e820->map, ARRAY_SIZE(e820->map), &e820->nr_map); + sanitize_e820_array(e820_array->map, ARRAY_SIZE(e820_array->map), &e820_array->nr_map); } static void __init intel_graphics_quirks(int num, int slot, int func) diff --git a/arch/x86/kernel/kexec-bzimage64.c b/arch/x86/kernel/kexec-bzimage64.c index d70e8d65cc16..6bedcb9bad1e 100644 --- a/arch/x86/kernel/kexec-bzimage64.c +++ b/arch/x86/kernel/kexec-bzimage64.c @@ -100,14 +100,14 @@ static int setup_e820_entries(struct boot_params *params) { unsigned int nr_e820_entries; - nr_e820_entries = e820_saved->nr_map; + nr_e820_entries = e820_array_saved->nr_map; /* TODO: Pass entries more than E820MAX in bootparams setup data */ if (nr_e820_entries > E820MAX) nr_e820_entries = E820MAX; params->e820_entries = nr_e820_entries; - memcpy(¶ms->e820_map, &e820_saved->map, + memcpy(¶ms->e820_array, &e820_array_saved->map, nr_e820_entries * sizeof(struct e820_entry)); return 0; @@ -233,10 +233,10 @@ setup_boot_parameters(struct kimage *image, struct boot_params *params, nr_e820_entries = params->e820_entries; for (i = 0; i < nr_e820_entries; i++) { - if (params->e820_map[i].type != E820_RAM) + if (params->e820_array[i].type != E820_RAM) continue; - start = params->e820_map[i].addr; - end = params->e820_map[i].addr + params->e820_map[i].size - 1; + start = params->e820_array[i].addr; + end = params->e820_array[i].addr + params->e820_array[i].size - 1; if ((start <= 0x100000) && end > 0x100000) { mem_k = (end >> 10) - (0x100000 >> 10); diff --git a/arch/x86/kernel/resource.c b/arch/x86/kernel/resource.c index 06a6e8049070..aeec503e0a6d 100644 --- a/arch/x86/kernel/resource.c +++ b/arch/x86/kernel/resource.c @@ -27,8 +27,8 @@ static void remove_e820_regions(struct resource *avail) int i; struct e820_entry *entry; - for (i = 0; i < e820->nr_map; i++) { - entry = &e820->map[i]; + for (i = 0; i < e820_array->nr_map; i++) { + entry = &e820_array->map[i]; resource_clip(avail, entry->addr, entry->addr + entry->size - 1); diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c index d2bdda9c3d6f..a91db2edee9e 100644 --- a/arch/x86/kernel/setup.c +++ b/arch/x86/kernel/setup.c @@ -458,8 +458,8 @@ static void __init e820_reserve_setup_data(void) early_memunmap(data, sizeof(*data)); } - sanitize_e820_map(e820->map, ARRAY_SIZE(e820->map), &e820->nr_map); - memcpy(e820_saved, e820, sizeof(struct e820_array)); + sanitize_e820_array(e820_array->map, ARRAY_SIZE(e820_array->map), &e820_array->nr_map); + memcpy(e820_array_saved, e820_array, sizeof(struct e820_array)); printk(KERN_INFO "extended physical RAM map:\n"); e820_print_map("reserve setup_data"); } @@ -763,7 +763,7 @@ static void __init trim_bios_range(void) */ e820_remove_range(BIOS_BEGIN, BIOS_END - BIOS_BEGIN, E820_RAM, 1); - sanitize_e820_map(e820->map, ARRAY_SIZE(e820->map), &e820->nr_map); + sanitize_e820_array(e820_array->map, ARRAY_SIZE(e820_array->map), &e820_array->nr_map); } /* called before trim_bios_range() to spare extra sanitize */ @@ -1026,7 +1026,7 @@ void __init setup_arch(char **cmdline_p) early_dump_pci_devices(); #endif - /* update the e820_saved too */ + /* update the e820_array_saved too */ e820_reserve_setup_data(); finish_e820_parsing(); @@ -1056,7 +1056,7 @@ void __init setup_arch(char **cmdline_p) if (ppro_with_ram_bug()) { e820_update_range(0x70000000ULL, 0x40000ULL, E820_RAM, E820_RESERVED); - sanitize_e820_map(e820->map, ARRAY_SIZE(e820->map), &e820->nr_map); + sanitize_e820_array(e820_array->map, ARRAY_SIZE(e820_array->map), &e820_array->nr_map); printk(KERN_INFO "fixed physical RAM map:\n"); e820_print_map("bad_ppro"); } diff --git a/arch/x86/kernel/tboot.c b/arch/x86/kernel/tboot.c index d047da50f2de..705f1207181a 100644 --- a/arch/x86/kernel/tboot.c +++ b/arch/x86/kernel/tboot.c @@ -188,12 +188,12 @@ static int tboot_setup_sleep(void) tboot->num_mac_regions = 0; - for (i = 0; i < e820->nr_map; i++) { - if ((e820->map[i].type != E820_RAM) - && (e820->map[i].type != E820_RESERVED_KERN)) + for (i = 0; i < e820_array->nr_map; i++) { + if ((e820_array->map[i].type != E820_RAM) + && (e820_array->map[i].type != E820_RESERVED_KERN)) continue; - add_mac_region(e820->map[i].addr, e820->map[i].size); + add_mac_region(e820_array->map[i].addr, e820_array->map[i].size); } tboot->acpi_sinfo.kernel_s3_resume_vector = diff --git a/arch/x86/lguest/boot.c b/arch/x86/lguest/boot.c index 638d997327c9..09226a33e418 100644 --- a/arch/x86/lguest/boot.c +++ b/arch/x86/lguest/boot.c @@ -1178,9 +1178,9 @@ static __init char *lguest_memory_setup(void) * The Linux bootloader header contains an "e820" memory map: the * Launcher populated the first entry with our memory limit. */ - e820_add_region(boot_params.e820_map[0].addr, - boot_params.e820_map[0].size, - boot_params.e820_map[0].type); + e820_add_region(boot_params.e820_array[0].addr, + boot_params.e820_array[0].size, + boot_params.e820_array[0].type); /* This string is for the boot messages. */ return "LGUEST"; diff --git a/arch/x86/platform/efi/efi.c b/arch/x86/platform/efi/efi.c index 528f682ec640..2543a11c9df8 100644 --- a/arch/x86/platform/efi/efi.c +++ b/arch/x86/platform/efi/efi.c @@ -167,7 +167,7 @@ static void __init do_add_efi_memmap(void) } e820_add_region(start, size, e820_type); } - sanitize_e820_map(e820->map, ARRAY_SIZE(e820->map), &e820->nr_map); + sanitize_e820_array(e820_array->map, ARRAY_SIZE(e820_array->map), &e820_array->nr_map); } int __init efi_memblock_x86_reserve_range(void) diff --git a/arch/x86/power/hibernate_64.c b/arch/x86/power/hibernate_64.c index 874aea614fcf..c1a245e64ed1 100644 --- a/arch/x86/power/hibernate_64.c +++ b/arch/x86/power/hibernate_64.c @@ -232,7 +232,7 @@ static int get_e820_md5(struct e820_array *map, void *buf) static void hibernation_e820_save(void *buf) { - get_e820_md5(e820_saved, buf); + get_e820_md5(e820_array_saved, buf); } static bool hibernation_e820_mismatch(void *buf) @@ -245,7 +245,7 @@ static bool hibernation_e820_mismatch(void *buf) if (!memcmp(result, buf, MD5_DIGEST_SIZE)) return false; - ret = get_e820_md5(e820_saved, result); + ret = get_e820_md5(e820_array_saved, result); if (ret) return true; diff --git a/arch/x86/xen/setup.c b/arch/x86/xen/setup.c index 7386a6e4c072..3cc90e902064 100644 --- a/arch/x86/xen/setup.c +++ b/arch/x86/xen/setup.c @@ -41,8 +41,8 @@ struct xen_memory_region xen_extra_mem[XEN_EXTRA_MEM_MAX_REGIONS] __initdata; unsigned long xen_released_pages; /* E820 map used during setting up memory. */ -static struct e820_entry xen_e820_map[E820_X_MAX] __initdata; -static u32 xen_e820_map_entries __initdata; +static struct e820_entry xen_e820_array[E820_X_MAX] __initdata; +static u32 xen_e820_array_entries __initdata; /* * Buffer used to remap identity mapped pages. We only need the virtual space. @@ -198,11 +198,11 @@ void __init xen_inv_extra_mem(void) */ static unsigned long __init xen_find_pfn_range(unsigned long *min_pfn) { - const struct e820_entry *entry = xen_e820_map; + const struct e820_entry *entry = xen_e820_array; unsigned int i; unsigned long done = 0; - for (i = 0; i < xen_e820_map_entries; i++, entry++) { + for (i = 0; i < xen_e820_array_entries; i++, entry++) { unsigned long s_pfn; unsigned long e_pfn; @@ -457,7 +457,7 @@ static unsigned long __init xen_foreach_remap_area(unsigned long nr_pages, { phys_addr_t start = 0; unsigned long ret_val = 0; - const struct e820_entry *entry = xen_e820_map; + const struct e820_entry *entry = xen_e820_array; int i; /* @@ -471,9 +471,9 @@ static unsigned long __init xen_foreach_remap_area(unsigned long nr_pages, * example) the DMI tables in a reserved region that begins on * a non-page boundary. */ - for (i = 0; i < xen_e820_map_entries; i++, entry++) { + for (i = 0; i < xen_e820_array_entries; i++, entry++) { phys_addr_t end = entry->addr + entry->size; - if (entry->type == E820_RAM || i == xen_e820_map_entries - 1) { + if (entry->type == E820_RAM || i == xen_e820_array_entries - 1) { unsigned long start_pfn = PFN_DOWN(start); unsigned long end_pfn = PFN_UP(end); @@ -601,10 +601,10 @@ static void __init xen_align_and_add_e820_region(phys_addr_t start, static void __init xen_ignore_unusable(void) { - struct e820_entry *entry = xen_e820_map; + struct e820_entry *entry = xen_e820_array; unsigned int i; - for (i = 0; i < xen_e820_map_entries; i++, entry++) { + for (i = 0; i < xen_e820_array_entries; i++, entry++) { if (entry->type == E820_UNUSABLE) entry->type = E820_RAM; } @@ -620,9 +620,9 @@ bool __init xen_is_e820_reserved(phys_addr_t start, phys_addr_t size) return false; end = start + size; - entry = xen_e820_map; + entry = xen_e820_array; - for (mapcnt = 0; mapcnt < xen_e820_map_entries; mapcnt++) { + for (mapcnt = 0; mapcnt < xen_e820_array_entries; mapcnt++) { if (entry->type == E820_RAM && entry->addr <= start && (entry->addr + entry->size) >= end) return false; @@ -645,9 +645,9 @@ phys_addr_t __init xen_find_free_area(phys_addr_t size) { unsigned mapcnt; phys_addr_t addr, start; - struct e820_entry *entry = xen_e820_map; + struct e820_entry *entry = xen_e820_array; - for (mapcnt = 0; mapcnt < xen_e820_map_entries; mapcnt++, entry++) { + for (mapcnt = 0; mapcnt < xen_e820_array_entries; mapcnt++, entry++) { if (entry->type != E820_RAM || entry->size < size) continue; start = entry->addr; @@ -750,8 +750,8 @@ char * __init xen_memory_setup(void) max_pfn = min(max_pfn, xen_start_info->nr_pages); mem_end = PFN_PHYS(max_pfn); - memmap.nr_entries = ARRAY_SIZE(xen_e820_map); - set_xen_guest_handle(memmap.buffer, xen_e820_map); + memmap.nr_entries = ARRAY_SIZE(xen_e820_array); + set_xen_guest_handle(memmap.buffer, xen_e820_array); op = xen_initial_domain() ? XENMEM_machine_memory_map : @@ -760,16 +760,16 @@ char * __init xen_memory_setup(void) if (rc == -ENOSYS) { BUG_ON(xen_initial_domain()); memmap.nr_entries = 1; - xen_e820_map[0].addr = 0ULL; - xen_e820_map[0].size = mem_end; + xen_e820_array[0].addr = 0ULL; + xen_e820_array[0].size = mem_end; /* 8MB slack (to balance backend allocations). */ - xen_e820_map[0].size += 8ULL << 20; - xen_e820_map[0].type = E820_RAM; + xen_e820_array[0].size += 8ULL << 20; + xen_e820_array[0].type = E820_RAM; rc = 0; } BUG_ON(rc); BUG_ON(memmap.nr_entries == 0); - xen_e820_map_entries = memmap.nr_entries; + xen_e820_array_entries = memmap.nr_entries; /* * Xen won't allow a 1:1 mapping to be created to UNUSABLE @@ -783,8 +783,8 @@ char * __init xen_memory_setup(void) xen_ignore_unusable(); /* Make sure the Xen-supplied memory map is well-ordered. */ - sanitize_e820_map(xen_e820_map, ARRAY_SIZE(xen_e820_map), - &xen_e820_map_entries); + sanitize_e820_array(xen_e820_array, ARRAY_SIZE(xen_e820_array), + &xen_e820_array_entries); max_pages = xen_get_max_pages(); @@ -811,13 +811,13 @@ char * __init xen_memory_setup(void) extra_pages = min3(EXTRA_MEM_RATIO * min(max_pfn, PFN_DOWN(MAXMEM)), extra_pages, max_pages - max_pfn); i = 0; - addr = xen_e820_map[0].addr; - size = xen_e820_map[0].size; - while (i < xen_e820_map_entries) { + addr = xen_e820_array[0].addr; + size = xen_e820_array[0].size; + while (i < xen_e820_array_entries) { bool discard = false; chunk_size = size; - type = xen_e820_map[i].type; + type = xen_e820_array[i].type; if (type == E820_RAM) { if (addr < mem_end) { @@ -840,9 +840,9 @@ char * __init xen_memory_setup(void) size -= chunk_size; if (size == 0) { i++; - if (i < xen_e820_map_entries) { - addr = xen_e820_map[i].addr; - size = xen_e820_map[i].size; + if (i < xen_e820_array_entries) { + addr = xen_e820_array[i].addr; + size = xen_e820_array[i].size; } } } @@ -861,7 +861,7 @@ char * __init xen_memory_setup(void) e820_add_region(ISA_START_ADDRESS, ISA_END_ADDRESS - ISA_START_ADDRESS, E820_RESERVED); - sanitize_e820_map(e820->map, ARRAY_SIZE(e820->map), &e820->nr_map); + sanitize_e820_array(e820_array->map, ARRAY_SIZE(e820_array->map), &e820_array->nr_map); /* * Check whether the kernel itself conflicts with the target E820 map. @@ -923,21 +923,21 @@ char * __init xen_auto_xlated_memory_setup(void) int i; int rc; - memmap.nr_entries = ARRAY_SIZE(xen_e820_map); - set_xen_guest_handle(memmap.buffer, xen_e820_map); + memmap.nr_entries = ARRAY_SIZE(xen_e820_array); + set_xen_guest_handle(memmap.buffer, xen_e820_array); rc = HYPERVISOR_memory_op(XENMEM_memory_map, &memmap); if (rc < 0) panic("No memory map (%d)\n", rc); - xen_e820_map_entries = memmap.nr_entries; + xen_e820_array_entries = memmap.nr_entries; - sanitize_e820_map(xen_e820_map, ARRAY_SIZE(xen_e820_map), - &xen_e820_map_entries); + sanitize_e820_array(xen_e820_array, ARRAY_SIZE(xen_e820_array), + &xen_e820_array_entries); - for (i = 0; i < xen_e820_map_entries; i++) - e820_add_region(xen_e820_map[i].addr, xen_e820_map[i].size, - xen_e820_map[i].type); + for (i = 0; i < xen_e820_array_entries; i++) + e820_add_region(xen_e820_array[i].addr, xen_e820_array[i].size, + xen_e820_array[i].type); /* Remove p2m info, it is not needed. */ xen_start_info->mfn_list = 0; diff --git a/tools/lguest/lguest.c b/tools/lguest/lguest.c index 7deb8d4a976e..92a1fe3c07eb 100644 --- a/tools/lguest/lguest.c +++ b/tools/lguest/lguest.c @@ -3339,7 +3339,7 @@ int main(int argc, char *argv[]) * simple, single region. */ boot->e820_entries = 1; - boot->e820_map[0] = ((struct e820_entry) { 0, mem, E820_RAM }); + boot->e820_array[0] = ((struct e820_entry) { 0, mem, E820_RAM }); /* * The boot header contains a command line pointer: we put the command * line after the boot header. -- cgit v1.2.3 From 61a50101638254d38e3f4281265b44de0f2cba4e Mon Sep 17 00:00:00 2001 From: Ingo Molnar Date: Fri, 27 Jan 2017 13:54:38 +0100 Subject: x86/boot/e820: Rename everything to e820_table No change in functionality. Cc: Alex Thorlton Cc: Andy Lutomirski Cc: Borislav Petkov Cc: Brian Gerst Cc: Dan Williams Cc: Denys Vlasenko Cc: H. Peter Anvin Cc: Huang, Ying Cc: Josh Poimboeuf Cc: Juergen Gross Cc: Linus Torvalds Cc: Paul Jackson Cc: Peter Zijlstra Cc: Rafael J. Wysocki Cc: Tejun Heo Cc: Thomas Gleixner Cc: Wei Yang Cc: Yinghai Lu Cc: linux-kernel@vger.kernel.org Signed-off-by: Ingo Molnar --- Documentation/x86/zero-page.txt | 4 +- arch/x86/boot/compressed/eboot.c | 22 ++--- arch/x86/boot/compressed/kaslr.c | 2 +- arch/x86/boot/memory.c | 4 +- arch/x86/include/asm/e820/api.h | 6 +- arch/x86/include/asm/e820/types.h | 4 +- arch/x86/include/uapi/asm/bootparam.h | 2 +- arch/x86/kernel/crash.c | 2 +- arch/x86/kernel/e820.c | 152 +++++++++++++++++----------------- arch/x86/kernel/early-quirks.c | 2 +- arch/x86/kernel/kexec-bzimage64.c | 10 +-- arch/x86/kernel/resource.c | 4 +- arch/x86/kernel/setup.c | 10 +-- arch/x86/kernel/tboot.c | 8 +- arch/x86/lguest/boot.c | 6 +- arch/x86/platform/efi/efi.c | 2 +- arch/x86/power/hibernate_64.c | 8 +- arch/x86/xen/setup.c | 76 ++++++++--------- tools/lguest/lguest.c | 2 +- 19 files changed, 163 insertions(+), 163 deletions(-) (limited to 'arch/x86/platform') diff --git a/Documentation/x86/zero-page.txt b/Documentation/x86/zero-page.txt index b323b705f419..363dca7b446b 100644 --- a/Documentation/x86/zero-page.txt +++ b/Documentation/x86/zero-page.txt @@ -27,12 +27,12 @@ Offset Proto Name Meaning 1C0/020 ALL efi_info EFI 32 information (struct efi_info) 1E0/004 ALL alk_mem_k Alternative mem check, in KB 1E4/004 ALL scratch Scratch field for the kernel setup code -1E8/001 ALL e820_entries Number of entries in e820_array (below) +1E8/001 ALL e820_entries Number of entries in e820_table (below) 1E9/001 ALL eddbuf_entries Number of entries in eddbuf (below) 1EA/001 ALL edd_mbr_sig_buf_entries Number of entries in edd_mbr_sig_buffer (below) 1EF/001 ALL sentinel Used to detect broken bootloaders 290/040 ALL edd_mbr_sig_buffer EDD MBR signatures -2D0/A00 ALL e820_array E820 memory map table +2D0/A00 ALL e820_table E820 memory map table (array of struct e820_entry) D00/1EC ALL eddbuf EDD data (array of struct edd_info) diff --git a/arch/x86/boot/compressed/eboot.c b/arch/x86/boot/compressed/eboot.c index b5cc1e72c63a..04c406f9aee3 100644 --- a/arch/x86/boot/compressed/eboot.c +++ b/arch/x86/boot/compressed/eboot.c @@ -917,7 +917,7 @@ static void add_e820ext(struct boot_params *params, static efi_status_t setup_e820(struct boot_params *params, struct setup_data *e820ext, u32 e820ext_size) { - struct e820_entry *e820_array = ¶ms->e820_array[0]; + struct e820_entry *e820_table = ¶ms->e820_table[0]; struct efi_info *efi = ¶ms->efi_info; struct e820_entry *prev = NULL; u32 nr_entries; @@ -982,7 +982,7 @@ static efi_status_t setup_e820(struct boot_params *params, continue; } - if (nr_entries == ARRAY_SIZE(params->e820_array)) { + if (nr_entries == ARRAY_SIZE(params->e820_table)) { u32 need = (nr_desc - i) * sizeof(struct e820_entry) + sizeof(struct setup_data); @@ -990,18 +990,18 @@ static efi_status_t setup_e820(struct boot_params *params, return EFI_BUFFER_TOO_SMALL; /* boot_params map full, switch to e820 extended */ - e820_array = (struct e820_entry *)e820ext->data; + e820_table = (struct e820_entry *)e820ext->data; } - e820_array->addr = d->phys_addr; - e820_array->size = d->num_pages << PAGE_SHIFT; - e820_array->type = e820_type; - prev = e820_array++; + e820_table->addr = d->phys_addr; + e820_table->size = d->num_pages << PAGE_SHIFT; + e820_table->type = e820_type; + prev = e820_table++; nr_entries++; } - if (nr_entries > ARRAY_SIZE(params->e820_array)) { - u32 nr_e820ext = nr_entries - ARRAY_SIZE(params->e820_array); + if (nr_entries > ARRAY_SIZE(params->e820_table)) { + u32 nr_e820ext = nr_entries - ARRAY_SIZE(params->e820_table); add_e820ext(params, e820ext, nr_e820ext); nr_entries -= nr_e820ext; @@ -1055,9 +1055,9 @@ static efi_status_t exit_boot_func(efi_system_table_t *sys_table_arg, if (first) { nr_desc = *map->buff_size / *map->desc_size; - if (nr_desc > ARRAY_SIZE(p->boot_params->e820_array)) { + if (nr_desc > ARRAY_SIZE(p->boot_params->e820_table)) { u32 nr_e820ext = nr_desc - - ARRAY_SIZE(p->boot_params->e820_array); + ARRAY_SIZE(p->boot_params->e820_table); status = alloc_e820ext(nr_e820ext, &p->e820ext, &p->e820ext_size); diff --git a/arch/x86/boot/compressed/kaslr.c b/arch/x86/boot/compressed/kaslr.c index f0e37236cfe1..a47f832664f2 100644 --- a/arch/x86/boot/compressed/kaslr.c +++ b/arch/x86/boot/compressed/kaslr.c @@ -518,7 +518,7 @@ static unsigned long find_random_phys_addr(unsigned long minimum, /* Verify potential e820 positions, appending to slots list. */ for (i = 0; i < boot_params->e820_entries; i++) { - process_e820_entry(&boot_params->e820_array[i], minimum, + process_e820_entry(&boot_params->e820_table[i], minimum, image_size); if (slot_area_index == MAX_SLOT_AREA) { debug_putstr("Aborted e820 scan (slot_areas full)!\n"); diff --git a/arch/x86/boot/memory.c b/arch/x86/boot/memory.c index f2132b3e6880..db62445b75aa 100644 --- a/arch/x86/boot/memory.c +++ b/arch/x86/boot/memory.c @@ -21,7 +21,7 @@ static int detect_memory_e820(void) { int count = 0; struct biosregs ireg, oreg; - struct e820_entry *desc = boot_params.e820_array; + struct e820_entry *desc = boot_params.e820_table; static struct e820_entry buf; /* static so it is zeroed */ initregs(&ireg); @@ -66,7 +66,7 @@ static int detect_memory_e820(void) *desc++ = buf; count++; - } while (ireg.ebx && count < ARRAY_SIZE(boot_params.e820_array)); + } while (ireg.ebx && count < ARRAY_SIZE(boot_params.e820_table)); return boot_params.e820_entries = count; } diff --git a/arch/x86/include/asm/e820/api.h b/arch/x86/include/asm/e820/api.h index 0156532dd65a..91a5c346f765 100644 --- a/arch/x86/include/asm/e820/api.h +++ b/arch/x86/include/asm/e820/api.h @@ -4,8 +4,8 @@ #include /* see comment in arch/x86/kernel/e820.c */ -extern struct e820_array *e820_array; -extern struct e820_array *e820_array_saved; +extern struct e820_table *e820_table; +extern struct e820_table *e820_table_saved; extern unsigned long pci_mem_start; @@ -13,7 +13,7 @@ extern int e820_any_mapped(u64 start, u64 end, unsigned type); extern int e820_all_mapped(u64 start, u64 end, unsigned type); extern void e820_add_region(u64 start, u64 size, int type); extern void e820_print_map(char *who); -extern int sanitize_e820_array(struct e820_entry *biosmap, int max_nr_map, u32 *pnr_map); +extern int sanitize_e820_table(struct e820_entry *biosmap, int max_nr_map, u32 *pnr_map); extern u64 e820_update_range(u64 start, u64 size, unsigned old_type, unsigned new_type); extern u64 e820_remove_range(u64 start, u64 size, unsigned old_type, int checktype); extern void update_e820(void); diff --git a/arch/x86/include/asm/e820/types.h b/arch/x86/include/asm/e820/types.h index e3171867e126..ae2c4e9db0d4 100644 --- a/arch/x86/include/asm/e820/types.h +++ b/arch/x86/include/asm/e820/types.h @@ -21,7 +21,7 @@ * * This allows for bootstrap/firmware quirks such as possible duplicate * E820 entries that might need room in the same arrays, prior to the - * call to sanitize_e820_array() to remove duplicates. The allowance + * call to sanitize_e820_table() to remove duplicates. The allowance * of three memory map entries per node is "enough" entries for * the initial hardware platform motivating this mechanism to make * use of additional EFI map entries. Future platforms may want @@ -68,7 +68,7 @@ /* * The whole array of E820 entries: */ -struct e820_array { +struct e820_table { __u32 nr_map; struct e820_entry map[E820_X_MAX]; }; diff --git a/arch/x86/include/uapi/asm/bootparam.h b/arch/x86/include/uapi/asm/bootparam.h index 702f1c6d804e..5f41518f7159 100644 --- a/arch/x86/include/uapi/asm/bootparam.h +++ b/arch/x86/include/uapi/asm/bootparam.h @@ -152,7 +152,7 @@ struct boot_params { struct setup_header hdr; /* setup header */ /* 0x1f1 */ __u8 _pad7[0x290-0x1f1-sizeof(struct setup_header)]; __u32 edd_mbr_sig_buffer[EDD_MBR_SIG_MAX]; /* 0x290 */ - struct e820_entry e820_array[E820MAX]; /* 0x2d0 */ + struct e820_entry e820_table[E820MAX]; /* 0x2d0 */ __u8 _pad8[48]; /* 0xcd0 */ struct edd_info eddbuf[EDDMAXNR]; /* 0xd00 */ __u8 _pad9[276]; /* 0xeec */ diff --git a/arch/x86/kernel/crash.c b/arch/x86/kernel/crash.c index 036d9140384d..11f7eb1e2506 100644 --- a/arch/x86/kernel/crash.c +++ b/arch/x86/kernel/crash.c @@ -512,7 +512,7 @@ static int add_e820_entry(struct boot_params *params, struct e820_entry *entry) if (nr_e820_entries >= E820MAX) return 1; - memcpy(¶ms->e820_array[nr_e820_entries], entry, + memcpy(¶ms->e820_table[nr_e820_entries], entry, sizeof(struct e820_entry)); params->e820_entries++; return 0; diff --git a/arch/x86/kernel/e820.c b/arch/x86/kernel/e820.c index 49d47d6b1afe..ffaf94357d15 100644 --- a/arch/x86/kernel/e820.c +++ b/arch/x86/kernel/e820.c @@ -2,7 +2,7 @@ * Handle the memory map. * The functions here do the job until bootmem takes over. * - * Getting sanitize_e820_array() in sync with i386 version by applying change: + * Getting sanitize_e820_table() in sync with i386 version by applying change: * - Provisions for empty E820 memory regions (reported by certain BIOSes). * Alex Achenbach , December 2002. * Venkatesh Pallipadi @@ -31,7 +31,7 @@ * and that is also registered with modifications in the kernel resource tree * with the iomem_resource as parent. * - * The e820_array_saved is directly saved after the BIOS-provided memory map is + * The e820_table_saved is directly saved after the BIOS-provided memory map is * copied. It doesn't get modified afterwards. It's registered for the * /sys/firmware/memmap interface. * @@ -40,10 +40,10 @@ * user can e.g. boot the original kernel with mem=1G while still booting the * next kernel with full memory. */ -static struct e820_array e820_array_init __initdata; -static struct e820_array initial_e820_array_saved __initdata; -struct e820_array *e820_array __refdata = &e820_array_init; -struct e820_array *e820_array_saved __refdata = &initial_e820_array_saved; +static struct e820_table e820_table_init __initdata; +static struct e820_table initial_e820_table_saved __initdata; +struct e820_table *e820_table __refdata = &e820_table_init; +struct e820_table *e820_table_saved __refdata = &initial_e820_table_saved; /* For PCI or other memory-mapped resources */ unsigned long pci_mem_start = 0xaeedbabe; @@ -60,8 +60,8 @@ e820_any_mapped(u64 start, u64 end, unsigned type) { int i; - for (i = 0; i < e820_array->nr_map; i++) { - struct e820_entry *ei = &e820_array->map[i]; + for (i = 0; i < e820_table->nr_map; i++) { + struct e820_entry *ei = &e820_table->map[i]; if (type && ei->type != type) continue; @@ -83,8 +83,8 @@ int __init e820_all_mapped(u64 start, u64 end, unsigned type) { int i; - for (i = 0; i < e820_array->nr_map; i++) { - struct e820_entry *ei = &e820_array->map[i]; + for (i = 0; i < e820_table->nr_map; i++) { + struct e820_entry *ei = &e820_table->map[i]; if (type && ei->type != type) continue; @@ -110,7 +110,7 @@ int __init e820_all_mapped(u64 start, u64 end, unsigned type) /* * Add a memory region to the kernel e820 map. */ -static void __init __e820_add_region(struct e820_array *e820x, u64 start, u64 size, +static void __init __e820_add_region(struct e820_table *e820x, u64 start, u64 size, int type) { int x = e820x->nr_map; @@ -130,7 +130,7 @@ static void __init __e820_add_region(struct e820_array *e820x, u64 start, u64 si void __init e820_add_region(u64 start, u64 size, int type) { - __e820_add_region(e820_array, start, size, type); + __e820_add_region(e820_table, start, size, type); } static void __init e820_print_type(u32 type) @@ -166,12 +166,12 @@ void __init e820_print_map(char *who) { int i; - for (i = 0; i < e820_array->nr_map; i++) { + for (i = 0; i < e820_table->nr_map; i++) { printk(KERN_INFO "%s: [mem %#018Lx-%#018Lx] ", who, - (unsigned long long) e820_array->map[i].addr, + (unsigned long long) e820_table->map[i].addr, (unsigned long long) - (e820_array->map[i].addr + e820_array->map[i].size - 1)); - e820_print_type(e820_array->map[i].type); + (e820_table->map[i].addr + e820_table->map[i].size - 1)); + e820_print_type(e820_table->map[i].type); printk(KERN_CONT "\n"); } } @@ -195,7 +195,7 @@ void __init e820_print_map(char *who) * sanitizing succeeds the *pnr_map will be updated with the new * number of valid entries (something no more than max_nr_map). * - * The return value from sanitize_e820_array() is zero if it + * The return value from sanitize_e820_table() is zero if it * successfully 'sanitized' the map entries passed in, and is -1 * if it did nothing, which can happen if either of (1) it was * only passed one map entry, or (2) any of the input map entries @@ -259,7 +259,7 @@ static int __init cpcompare(const void *a, const void *b) return (ap->addr != ap->pbios->addr) - (bp->addr != bp->pbios->addr); } -int __init sanitize_e820_array(struct e820_entry *biosmap, int max_nr_map, +int __init sanitize_e820_table(struct e820_entry *biosmap, int max_nr_map, u32 *pnr_map) { static struct change_member change_point_list[2*E820_X_MAX] __initdata; @@ -385,7 +385,7 @@ int __init sanitize_e820_array(struct e820_entry *biosmap, int max_nr_map, return 0; } -static int __init __append_e820_array(struct e820_entry *biosmap, int nr_map) +static int __init __append_e820_table(struct e820_entry *biosmap, int nr_map) { while (nr_map) { u64 start = biosmap->addr; @@ -414,16 +414,16 @@ static int __init __append_e820_array(struct e820_entry *biosmap, int nr_map) * will have given us a memory map that we can use to properly * set up memory. If we aren't, we'll fake a memory map. */ -static int __init append_e820_array(struct e820_entry *biosmap, int nr_map) +static int __init append_e820_table(struct e820_entry *biosmap, int nr_map) { /* Only one memory region (or negative)? Ignore it */ if (nr_map < 2) return -1; - return __append_e820_array(biosmap, nr_map); + return __append_e820_table(biosmap, nr_map); } -static u64 __init __e820_update_range(struct e820_array *e820x, u64 start, +static u64 __init __e820_update_range(struct e820_table *e820x, u64 start, u64 size, unsigned old_type, unsigned new_type) { @@ -495,13 +495,13 @@ static u64 __init __e820_update_range(struct e820_array *e820x, u64 start, u64 __init e820_update_range(u64 start, u64 size, unsigned old_type, unsigned new_type) { - return __e820_update_range(e820_array, start, size, old_type, new_type); + return __e820_update_range(e820_table, 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(e820_array_saved, start, size, old_type, + return __e820_update_range(e820_table_saved, start, size, old_type, new_type); } @@ -523,8 +523,8 @@ u64 __init e820_remove_range(u64 start, u64 size, unsigned old_type, e820_print_type(old_type); printk(KERN_CONT "\n"); - for (i = 0; i < e820_array->nr_map; i++) { - struct e820_entry *ei = &e820_array->map[i]; + for (i = 0; i < e820_table->nr_map; i++) { + struct e820_entry *ei = &e820_table->map[i]; u64 final_start, final_end; u64 ei_end; @@ -568,15 +568,15 @@ u64 __init e820_remove_range(u64 start, u64 size, unsigned old_type, void __init update_e820(void) { - if (sanitize_e820_array(e820_array->map, ARRAY_SIZE(e820_array->map), &e820_array->nr_map)) + if (sanitize_e820_table(e820_table->map, ARRAY_SIZE(e820_table->map), &e820_table->nr_map)) return; printk(KERN_INFO "e820: modified physical RAM map:\n"); e820_print_map("modified"); } -static void __init update_e820_array_saved(void) +static void __init update_e820_table_saved(void) { - sanitize_e820_array(e820_array_saved->map, ARRAY_SIZE(e820_array_saved->map), - &e820_array_saved->nr_map); + sanitize_e820_table(e820_table_saved->map, ARRAY_SIZE(e820_table_saved->map), + &e820_table_saved->nr_map); } #define MAX_GAP_END 0x100000000ull /* @@ -586,12 +586,12 @@ static int __init e820_search_gap(unsigned long *gapstart, unsigned long *gapsize) { unsigned long long last = MAX_GAP_END; - int i = e820_array->nr_map; + int i = e820_table->nr_map; int found = 0; while (--i >= 0) { - unsigned long long start = e820_array->map[i].addr; - unsigned long long end = start + e820_array->map[i].size; + unsigned long long start = e820_table->map[i].addr; + unsigned long long end = start + e820_table->map[i].size; /* * Since "last" is at most 4GB, we know we'll @@ -650,7 +650,7 @@ __init void e820_setup_gap(void) /* * Called late during init, in free_initmem(). * - * Initial e820 and e820_array_saved are largish __initdata arrays. + * Initial e820 and e820_table_saved are largish __initdata arrays. * Copy them to (usually much smaller) dynamically allocated area. * This is done after all tweaks we ever do to them: * all functions which modify them are __init functions, @@ -658,26 +658,26 @@ __init void e820_setup_gap(void) */ __init void e820_reallocate_tables(void) { - struct e820_array *n; + struct e820_table *n; int size; - size = offsetof(struct e820_array, map) + sizeof(struct e820_entry) * e820_array->nr_map; + size = offsetof(struct e820_table, map) + sizeof(struct e820_entry) * e820_table->nr_map; n = kmalloc(size, GFP_KERNEL); BUG_ON(!n); - memcpy(n, e820_array, size); - e820_array = n; + memcpy(n, e820_table, size); + e820_table = n; - size = offsetof(struct e820_array, map) + sizeof(struct e820_entry) * e820_array_saved->nr_map; + size = offsetof(struct e820_table, map) + sizeof(struct e820_entry) * e820_table_saved->nr_map; n = kmalloc(size, GFP_KERNEL); BUG_ON(!n); - memcpy(n, e820_array_saved, size); - e820_array_saved = n; + memcpy(n, e820_table_saved, size); + e820_table_saved = n; } /** * Because of the size limitation of struct boot_params, only first * 128 E820 memory entries are passed to kernel via - * boot_params.e820_array, others are passed via SETUP_E820_EXT node of + * boot_params.e820_table, others are passed via SETUP_E820_EXT node of * linked list of struct setup_data, which is parsed here. */ void __init parse_e820_ext(u64 phys_addr, u32 data_len) @@ -689,8 +689,8 @@ void __init parse_e820_ext(u64 phys_addr, u32 data_len) sdata = early_memremap(phys_addr, data_len); entries = sdata->len / sizeof(struct e820_entry); extmap = (struct e820_entry *)(sdata->data); - __append_e820_array(extmap, entries); - sanitize_e820_array(e820_array->map, ARRAY_SIZE(e820_array->map), &e820_array->nr_map); + __append_e820_table(extmap, entries); + sanitize_e820_table(e820_table->map, ARRAY_SIZE(e820_table->map), &e820_table->nr_map); early_memunmap(sdata, data_len); printk(KERN_INFO "e820: extended physical RAM map:\n"); e820_print_map("extended"); @@ -709,8 +709,8 @@ void __init e820_mark_nosave_regions(unsigned long limit_pfn) int i; unsigned long pfn = 0; - for (i = 0; i < e820_array->nr_map; i++) { - struct e820_entry *ei = &e820_array->map[i]; + for (i = 0; i < e820_table->nr_map; i++) { + struct e820_entry *ei = &e820_table->map[i]; if (pfn < PFN_UP(ei->addr)) register_nosave_region(pfn, PFN_UP(ei->addr)); @@ -734,8 +734,8 @@ static int __init e820_mark_nvs_memory(void) { int i; - for (i = 0; i < e820_array->nr_map; i++) { - struct e820_entry *ei = &e820_array->map[i]; + for (i = 0; i < e820_table->nr_map; i++) { + struct e820_entry *ei = &e820_table->map[i]; if (ei->type == E820_NVS) acpi_nvs_register(ei->addr, ei->size); @@ -747,7 +747,7 @@ core_initcall(e820_mark_nvs_memory); #endif /* - * pre allocated 4k and reserved it in memblock and e820_array_saved + * pre allocated 4k and reserved it in memblock and e820_table_saved */ u64 __init early_reserve_e820(u64 size, u64 align) { @@ -756,8 +756,8 @@ u64 __init early_reserve_e820(u64 size, u64 align) addr = __memblock_alloc_base(size, align, MEMBLOCK_ALLOC_ACCESSIBLE); if (addr) { e820_update_range_saved(addr, size, E820_RAM, E820_RESERVED); - printk(KERN_INFO "e820: update e820_array_saved for early_reserve_e820\n"); - update_e820_array_saved(); + printk(KERN_INFO "e820: update e820_table_saved for early_reserve_e820\n"); + update_e820_table_saved(); } return addr; @@ -782,8 +782,8 @@ static unsigned long __init e820_end_pfn(unsigned long limit_pfn, unsigned type) unsigned long last_pfn = 0; unsigned long max_arch_pfn = MAX_ARCH_PFN; - for (i = 0; i < e820_array->nr_map; i++) { - struct e820_entry *ei = &e820_array->map[i]; + for (i = 0; i < e820_table->nr_map; i++) { + struct e820_entry *ei = &e820_table->map[i]; unsigned long start_pfn; unsigned long end_pfn; @@ -874,7 +874,7 @@ static int __init parse_memmap_one(char *p) */ saved_max_pfn = e820_end_of_ram_pfn(); #endif - e820_array->nr_map = 0; + e820_table->nr_map = 0; userdef = 1; return 0; } @@ -921,8 +921,8 @@ early_param("memmap", parse_memmap_opt); void __init finish_e820_parsing(void) { if (userdef) { - if (sanitize_e820_array(e820_array->map, ARRAY_SIZE(e820_array->map), - &e820_array->nr_map) < 0) + if (sanitize_e820_table(e820_table->map, ARRAY_SIZE(e820_table->map), + &e820_table->nr_map) < 0) early_panic("Invalid user supplied memory map"); printk(KERN_INFO "e820: user-defined physical RAM map:\n"); @@ -1009,35 +1009,35 @@ void __init e820_reserve_resources(void) struct resource *res; u64 end; - res = alloc_bootmem(sizeof(struct resource) * e820_array->nr_map); + res = alloc_bootmem(sizeof(struct resource) * e820_table->nr_map); e820_res = res; - for (i = 0; i < e820_array->nr_map; i++) { - end = e820_array->map[i].addr + e820_array->map[i].size - 1; + for (i = 0; i < e820_table->nr_map; i++) { + end = e820_table->map[i].addr + e820_table->map[i].size - 1; if (end != (resource_size_t)end) { res++; continue; } - res->name = e820_type_to_string(e820_array->map[i].type); - res->start = e820_array->map[i].addr; + res->name = e820_type_to_string(e820_table->map[i].type); + res->start = e820_table->map[i].addr; res->end = end; - res->flags = e820_type_to_iomem_type(e820_array->map[i].type); - res->desc = e820_type_to_iores_desc(e820_array->map[i].type); + res->flags = e820_type_to_iomem_type(e820_table->map[i].type); + res->desc = e820_type_to_iores_desc(e820_table->map[i].type); /* * don't register the region that could be conflicted with * pci device BAR resource and insert them later in * pcibios_resource_survey() */ - if (do_mark_busy(e820_array->map[i].type, res)) { + if (do_mark_busy(e820_table->map[i].type, res)) { res->flags |= IORESOURCE_BUSY; insert_resource(&iomem_resource, res); } res++; } - for (i = 0; i < e820_array_saved->nr_map; i++) { - struct e820_entry *entry = &e820_array_saved->map[i]; + for (i = 0; i < e820_table_saved->nr_map; i++) { + struct e820_entry *entry = &e820_table_saved->map[i]; firmware_map_add_early(entry->addr, entry->addr + entry->size, e820_type_to_string(entry->type)); @@ -1069,7 +1069,7 @@ void __init e820_reserve_resources_late(void) struct resource *res; res = e820_res; - for (i = 0; i < e820_array->nr_map; i++) { + for (i = 0; i < e820_table->nr_map; i++) { if (!res->parent && res->end) insert_resource_expand_to_fit(&iomem_resource, res); res++; @@ -1079,8 +1079,8 @@ void __init e820_reserve_resources_late(void) * Try to bump up RAM regions to reasonable boundaries to * avoid stolen RAM: */ - for (i = 0; i < e820_array->nr_map; i++) { - struct e820_entry *entry = &e820_array->map[i]; + for (i = 0; i < e820_table->nr_map; i++) { + struct e820_entry *entry = &e820_table->map[i]; u64 start, end; if (entry->type != E820_RAM) @@ -1110,11 +1110,11 @@ char *__init default_machine_specific_memory_setup(void) * the next section from 1mb->appropriate_mem_k */ new_nr = boot_params.e820_entries; - sanitize_e820_array(boot_params.e820_array, - ARRAY_SIZE(boot_params.e820_array), + sanitize_e820_table(boot_params.e820_table, + ARRAY_SIZE(boot_params.e820_table), &new_nr); boot_params.e820_entries = new_nr; - if (append_e820_array(boot_params.e820_array, boot_params.e820_entries) + if (append_e820_table(boot_params.e820_table, boot_params.e820_entries) < 0) { u64 mem_size; @@ -1128,7 +1128,7 @@ char *__init default_machine_specific_memory_setup(void) who = "BIOS-e801"; } - e820_array->nr_map = 0; + e820_table->nr_map = 0; e820_add_region(0, LOWMEMSIZE(), E820_RAM); e820_add_region(HIGH_MEMORY, mem_size << 10, E820_RAM); } @@ -1142,7 +1142,7 @@ void __init setup_memory_map(void) char *who; who = x86_init.resources.memory_setup(); - memcpy(e820_array_saved, e820_array, sizeof(struct e820_array)); + memcpy(e820_table_saved, e820_table, sizeof(struct e820_table)); printk(KERN_INFO "e820: BIOS-provided physical RAM map:\n"); e820_print_map(who); } @@ -1159,8 +1159,8 @@ void __init memblock_x86_fill(void) */ memblock_allow_resize(); - for (i = 0; i < e820_array->nr_map; i++) { - struct e820_entry *ei = &e820_array->map[i]; + for (i = 0; i < e820_table->nr_map; i++) { + struct e820_entry *ei = &e820_table->map[i]; end = ei->addr + ei->size; if (end != (resource_size_t)end) diff --git a/arch/x86/kernel/early-quirks.c b/arch/x86/kernel/early-quirks.c index 31d755534c36..a6cdf9b9c7a9 100644 --- a/arch/x86/kernel/early-quirks.c +++ b/arch/x86/kernel/early-quirks.c @@ -547,7 +547,7 @@ intel_graphics_stolen(int num, int slot, int func, /* Mark this space as reserved */ e820_add_region(base, size, E820_RESERVED); - sanitize_e820_array(e820_array->map, ARRAY_SIZE(e820_array->map), &e820_array->nr_map); + sanitize_e820_table(e820_table->map, ARRAY_SIZE(e820_table->map), &e820_table->nr_map); } static void __init intel_graphics_quirks(int num, int slot, int func) diff --git a/arch/x86/kernel/kexec-bzimage64.c b/arch/x86/kernel/kexec-bzimage64.c index 6bedcb9bad1e..39d340ac50eb 100644 --- a/arch/x86/kernel/kexec-bzimage64.c +++ b/arch/x86/kernel/kexec-bzimage64.c @@ -100,14 +100,14 @@ static int setup_e820_entries(struct boot_params *params) { unsigned int nr_e820_entries; - nr_e820_entries = e820_array_saved->nr_map; + nr_e820_entries = e820_table_saved->nr_map; /* TODO: Pass entries more than E820MAX in bootparams setup data */ if (nr_e820_entries > E820MAX) nr_e820_entries = E820MAX; params->e820_entries = nr_e820_entries; - memcpy(¶ms->e820_array, &e820_array_saved->map, + memcpy(¶ms->e820_table, &e820_table_saved->map, nr_e820_entries * sizeof(struct e820_entry)); return 0; @@ -233,10 +233,10 @@ setup_boot_parameters(struct kimage *image, struct boot_params *params, nr_e820_entries = params->e820_entries; for (i = 0; i < nr_e820_entries; i++) { - if (params->e820_array[i].type != E820_RAM) + if (params->e820_table[i].type != E820_RAM) continue; - start = params->e820_array[i].addr; - end = params->e820_array[i].addr + params->e820_array[i].size - 1; + start = params->e820_table[i].addr; + end = params->e820_table[i].addr + params->e820_table[i].size - 1; if ((start <= 0x100000) && end > 0x100000) { mem_k = (end >> 10) - (0x100000 >> 10); diff --git a/arch/x86/kernel/resource.c b/arch/x86/kernel/resource.c index aeec503e0a6d..17b494d4bb86 100644 --- a/arch/x86/kernel/resource.c +++ b/arch/x86/kernel/resource.c @@ -27,8 +27,8 @@ static void remove_e820_regions(struct resource *avail) int i; struct e820_entry *entry; - for (i = 0; i < e820_array->nr_map; i++) { - entry = &e820_array->map[i]; + for (i = 0; i < e820_table->nr_map; i++) { + entry = &e820_table->map[i]; resource_clip(avail, entry->addr, entry->addr + entry->size - 1); diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c index a91db2edee9e..a3c1d39116b7 100644 --- a/arch/x86/kernel/setup.c +++ b/arch/x86/kernel/setup.c @@ -458,8 +458,8 @@ static void __init e820_reserve_setup_data(void) early_memunmap(data, sizeof(*data)); } - sanitize_e820_array(e820_array->map, ARRAY_SIZE(e820_array->map), &e820_array->nr_map); - memcpy(e820_array_saved, e820_array, sizeof(struct e820_array)); + sanitize_e820_table(e820_table->map, ARRAY_SIZE(e820_table->map), &e820_table->nr_map); + memcpy(e820_table_saved, e820_table, sizeof(struct e820_table)); printk(KERN_INFO "extended physical RAM map:\n"); e820_print_map("reserve setup_data"); } @@ -763,7 +763,7 @@ static void __init trim_bios_range(void) */ e820_remove_range(BIOS_BEGIN, BIOS_END - BIOS_BEGIN, E820_RAM, 1); - sanitize_e820_array(e820_array->map, ARRAY_SIZE(e820_array->map), &e820_array->nr_map); + sanitize_e820_table(e820_table->map, ARRAY_SIZE(e820_table->map), &e820_table->nr_map); } /* called before trim_bios_range() to spare extra sanitize */ @@ -1026,7 +1026,7 @@ void __init setup_arch(char **cmdline_p) early_dump_pci_devices(); #endif - /* update the e820_array_saved too */ + /* update the e820_table_saved too */ e820_reserve_setup_data(); finish_e820_parsing(); @@ -1056,7 +1056,7 @@ void __init setup_arch(char **cmdline_p) if (ppro_with_ram_bug()) { e820_update_range(0x70000000ULL, 0x40000ULL, E820_RAM, E820_RESERVED); - sanitize_e820_array(e820_array->map, ARRAY_SIZE(e820_array->map), &e820_array->nr_map); + sanitize_e820_table(e820_table->map, ARRAY_SIZE(e820_table->map), &e820_table->nr_map); printk(KERN_INFO "fixed physical RAM map:\n"); e820_print_map("bad_ppro"); } diff --git a/arch/x86/kernel/tboot.c b/arch/x86/kernel/tboot.c index 705f1207181a..825822688aa5 100644 --- a/arch/x86/kernel/tboot.c +++ b/arch/x86/kernel/tboot.c @@ -188,12 +188,12 @@ static int tboot_setup_sleep(void) tboot->num_mac_regions = 0; - for (i = 0; i < e820_array->nr_map; i++) { - if ((e820_array->map[i].type != E820_RAM) - && (e820_array->map[i].type != E820_RESERVED_KERN)) + for (i = 0; i < e820_table->nr_map; i++) { + if ((e820_table->map[i].type != E820_RAM) + && (e820_table->map[i].type != E820_RESERVED_KERN)) continue; - add_mac_region(e820_array->map[i].addr, e820_array->map[i].size); + add_mac_region(e820_table->map[i].addr, e820_table->map[i].size); } tboot->acpi_sinfo.kernel_s3_resume_vector = diff --git a/arch/x86/lguest/boot.c b/arch/x86/lguest/boot.c index 09226a33e418..fc42e9604562 100644 --- a/arch/x86/lguest/boot.c +++ b/arch/x86/lguest/boot.c @@ -1178,9 +1178,9 @@ static __init char *lguest_memory_setup(void) * The Linux bootloader header contains an "e820" memory map: the * Launcher populated the first entry with our memory limit. */ - e820_add_region(boot_params.e820_array[0].addr, - boot_params.e820_array[0].size, - boot_params.e820_array[0].type); + e820_add_region(boot_params.e820_table[0].addr, + boot_params.e820_table[0].size, + boot_params.e820_table[0].type); /* This string is for the boot messages. */ return "LGUEST"; diff --git a/arch/x86/platform/efi/efi.c b/arch/x86/platform/efi/efi.c index 2543a11c9df8..9e055f6859e5 100644 --- a/arch/x86/platform/efi/efi.c +++ b/arch/x86/platform/efi/efi.c @@ -167,7 +167,7 @@ static void __init do_add_efi_memmap(void) } e820_add_region(start, size, e820_type); } - sanitize_e820_array(e820_array->map, ARRAY_SIZE(e820_array->map), &e820_array->nr_map); + sanitize_e820_table(e820_table->map, ARRAY_SIZE(e820_table->map), &e820_table->nr_map); } int __init efi_memblock_x86_reserve_range(void) diff --git a/arch/x86/power/hibernate_64.c b/arch/x86/power/hibernate_64.c index c1a245e64ed1..8fe5be0e90b2 100644 --- a/arch/x86/power/hibernate_64.c +++ b/arch/x86/power/hibernate_64.c @@ -201,7 +201,7 @@ struct restore_data_record { * @map: the e820 map to be calculated * @buf: the md5 result to be stored to */ -static int get_e820_md5(struct e820_array *map, void *buf) +static int get_e820_md5(struct e820_table *map, void *buf) { struct scatterlist sg; struct crypto_ahash *tfm; @@ -214,7 +214,7 @@ static int get_e820_md5(struct e820_array *map, void *buf) { AHASH_REQUEST_ON_STACK(req, tfm); - size = offsetof(struct e820_array, map) + size = offsetof(struct e820_table, map) + sizeof(struct e820_entry) * map->nr_map; ahash_request_set_tfm(req, tfm); sg_init_one(&sg, (u8 *)map, size); @@ -232,7 +232,7 @@ static int get_e820_md5(struct e820_array *map, void *buf) static void hibernation_e820_save(void *buf) { - get_e820_md5(e820_array_saved, buf); + get_e820_md5(e820_table_saved, buf); } static bool hibernation_e820_mismatch(void *buf) @@ -245,7 +245,7 @@ static bool hibernation_e820_mismatch(void *buf) if (!memcmp(result, buf, MD5_DIGEST_SIZE)) return false; - ret = get_e820_md5(e820_array_saved, result); + ret = get_e820_md5(e820_table_saved, result); if (ret) return true; diff --git a/arch/x86/xen/setup.c b/arch/x86/xen/setup.c index 3cc90e902064..f98713e5a705 100644 --- a/arch/x86/xen/setup.c +++ b/arch/x86/xen/setup.c @@ -41,8 +41,8 @@ struct xen_memory_region xen_extra_mem[XEN_EXTRA_MEM_MAX_REGIONS] __initdata; unsigned long xen_released_pages; /* E820 map used during setting up memory. */ -static struct e820_entry xen_e820_array[E820_X_MAX] __initdata; -static u32 xen_e820_array_entries __initdata; +static struct e820_entry xen_e820_table[E820_X_MAX] __initdata; +static u32 xen_e820_table_entries __initdata; /* * Buffer used to remap identity mapped pages. We only need the virtual space. @@ -198,11 +198,11 @@ void __init xen_inv_extra_mem(void) */ static unsigned long __init xen_find_pfn_range(unsigned long *min_pfn) { - const struct e820_entry *entry = xen_e820_array; + const struct e820_entry *entry = xen_e820_table; unsigned int i; unsigned long done = 0; - for (i = 0; i < xen_e820_array_entries; i++, entry++) { + for (i = 0; i < xen_e820_table_entries; i++, entry++) { unsigned long s_pfn; unsigned long e_pfn; @@ -457,7 +457,7 @@ static unsigned long __init xen_foreach_remap_area(unsigned long nr_pages, { phys_addr_t start = 0; unsigned long ret_val = 0; - const struct e820_entry *entry = xen_e820_array; + const struct e820_entry *entry = xen_e820_table; int i; /* @@ -471,9 +471,9 @@ static unsigned long __init xen_foreach_remap_area(unsigned long nr_pages, * example) the DMI tables in a reserved region that begins on * a non-page boundary. */ - for (i = 0; i < xen_e820_array_entries; i++, entry++) { + for (i = 0; i < xen_e820_table_entries; i++, entry++) { phys_addr_t end = entry->addr + entry->size; - if (entry->type == E820_RAM || i == xen_e820_array_entries - 1) { + if (entry->type == E820_RAM || i == xen_e820_table_entries - 1) { unsigned long start_pfn = PFN_DOWN(start); unsigned long end_pfn = PFN_UP(end); @@ -601,10 +601,10 @@ static void __init xen_align_and_add_e820_region(phys_addr_t start, static void __init xen_ignore_unusable(void) { - struct e820_entry *entry = xen_e820_array; + struct e820_entry *entry = xen_e820_table; unsigned int i; - for (i = 0; i < xen_e820_array_entries; i++, entry++) { + for (i = 0; i < xen_e820_table_entries; i++, entry++) { if (entry->type == E820_UNUSABLE) entry->type = E820_RAM; } @@ -620,9 +620,9 @@ bool __init xen_is_e820_reserved(phys_addr_t start, phys_addr_t size) return false; end = start + size; - entry = xen_e820_array; + entry = xen_e820_table; - for (mapcnt = 0; mapcnt < xen_e820_array_entries; mapcnt++) { + for (mapcnt = 0; mapcnt < xen_e820_table_entries; mapcnt++) { if (entry->type == E820_RAM && entry->addr <= start && (entry->addr + entry->size) >= end) return false; @@ -645,9 +645,9 @@ phys_addr_t __init xen_find_free_area(phys_addr_t size) { unsigned mapcnt; phys_addr_t addr, start; - struct e820_entry *entry = xen_e820_array; + struct e820_entry *entry = xen_e820_table; - for (mapcnt = 0; mapcnt < xen_e820_array_entries; mapcnt++, entry++) { + for (mapcnt = 0; mapcnt < xen_e820_table_entries; mapcnt++, entry++) { if (entry->type != E820_RAM || entry->size < size) continue; start = entry->addr; @@ -750,8 +750,8 @@ char * __init xen_memory_setup(void) max_pfn = min(max_pfn, xen_start_info->nr_pages); mem_end = PFN_PHYS(max_pfn); - memmap.nr_entries = ARRAY_SIZE(xen_e820_array); - set_xen_guest_handle(memmap.buffer, xen_e820_array); + memmap.nr_entries = ARRAY_SIZE(xen_e820_table); + set_xen_guest_handle(memmap.buffer, xen_e820_table); op = xen_initial_domain() ? XENMEM_machine_memory_map : @@ -760,16 +760,16 @@ char * __init xen_memory_setup(void) if (rc == -ENOSYS) { BUG_ON(xen_initial_domain()); memmap.nr_entries = 1; - xen_e820_array[0].addr = 0ULL; - xen_e820_array[0].size = mem_end; + xen_e820_table[0].addr = 0ULL; + xen_e820_table[0].size = mem_end; /* 8MB slack (to balance backend allocations). */ - xen_e820_array[0].size += 8ULL << 20; - xen_e820_array[0].type = E820_RAM; + xen_e820_table[0].size += 8ULL << 20; + xen_e820_table[0].type = E820_RAM; rc = 0; } BUG_ON(rc); BUG_ON(memmap.nr_entries == 0); - xen_e820_array_entries = memmap.nr_entries; + xen_e820_table_entries = memmap.nr_entries; /* * Xen won't allow a 1:1 mapping to be created to UNUSABLE @@ -783,8 +783,8 @@ char * __init xen_memory_setup(void) xen_ignore_unusable(); /* Make sure the Xen-supplied memory map is well-ordered. */ - sanitize_e820_array(xen_e820_array, ARRAY_SIZE(xen_e820_array), - &xen_e820_array_entries); + sanitize_e820_table(xen_e820_table, ARRAY_SIZE(xen_e820_table), + &xen_e820_table_entries); max_pages = xen_get_max_pages(); @@ -811,13 +811,13 @@ char * __init xen_memory_setup(void) extra_pages = min3(EXTRA_MEM_RATIO * min(max_pfn, PFN_DOWN(MAXMEM)), extra_pages, max_pages - max_pfn); i = 0; - addr = xen_e820_array[0].addr; - size = xen_e820_array[0].size; - while (i < xen_e820_array_entries) { + addr = xen_e820_table[0].addr; + size = xen_e820_table[0].size; + while (i < xen_e820_table_entries) { bool discard = false; chunk_size = size; - type = xen_e820_array[i].type; + type = xen_e820_table[i].type; if (type == E820_RAM) { if (addr < mem_end) { @@ -840,9 +840,9 @@ char * __init xen_memory_setup(void) size -= chunk_size; if (size == 0) { i++; - if (i < xen_e820_array_entries) { - addr = xen_e820_array[i].addr; - size = xen_e820_array[i].size; + if (i < xen_e820_table_entries) { + addr = xen_e820_table[i].addr; + size = xen_e820_table[i].size; } } } @@ -861,7 +861,7 @@ char * __init xen_memory_setup(void) e820_add_region(ISA_START_ADDRESS, ISA_END_ADDRESS - ISA_START_ADDRESS, E820_RESERVED); - sanitize_e820_array(e820_array->map, ARRAY_SIZE(e820_array->map), &e820_array->nr_map); + sanitize_e820_table(e820_table->map, ARRAY_SIZE(e820_table->map), &e820_table->nr_map); /* * Check whether the kernel itself conflicts with the target E820 map. @@ -923,21 +923,21 @@ char * __init xen_auto_xlated_memory_setup(void) int i; int rc; - memmap.nr_entries = ARRAY_SIZE(xen_e820_array); - set_xen_guest_handle(memmap.buffer, xen_e820_array); + memmap.nr_entries = ARRAY_SIZE(xen_e820_table); + set_xen_guest_handle(memmap.buffer, xen_e820_table); rc = HYPERVISOR_memory_op(XENMEM_memory_map, &memmap); if (rc < 0) panic("No memory map (%d)\n", rc); - xen_e820_array_entries = memmap.nr_entries; + xen_e820_table_entries = memmap.nr_entries; - sanitize_e820_array(xen_e820_array, ARRAY_SIZE(xen_e820_array), - &xen_e820_array_entries); + sanitize_e820_table(xen_e820_table, ARRAY_SIZE(xen_e820_table), + &xen_e820_table_entries); - for (i = 0; i < xen_e820_array_entries; i++) - e820_add_region(xen_e820_array[i].addr, xen_e820_array[i].size, - xen_e820_array[i].type); + for (i = 0; i < xen_e820_table_entries; i++) + e820_add_region(xen_e820_table[i].addr, xen_e820_table[i].size, + xen_e820_table[i].type); /* Remove p2m info, it is not needed. */ xen_start_info->mfn_list = 0; diff --git a/tools/lguest/lguest.c b/tools/lguest/lguest.c index 92a1fe3c07eb..3819e23a173e 100644 --- a/tools/lguest/lguest.c +++ b/tools/lguest/lguest.c @@ -3339,7 +3339,7 @@ int main(int argc, char *argv[]) * simple, single region. */ boot->e820_entries = 1; - boot->e820_array[0] = ((struct e820_entry) { 0, mem, E820_RAM }); + boot->e820_table[0] = ((struct e820_entry) { 0, mem, E820_RAM }); /* * The boot header contains a command line pointer: we put the command * line after the boot header. -- cgit v1.2.3 From bf495573fae84451a8a26215fafb5b62e387ddaf Mon Sep 17 00:00:00 2001 From: Ingo Molnar Date: Fri, 27 Jan 2017 14:06:21 +0100 Subject: x86/boot/e820: Harmonize the 'struct e820_table' fields So the e820_table->map and e820_table->nr_map names are a bit confusing, because it's not clear what a 'map' really means (it could be a bitmap, or some other data structure), nor is it clear what nr_map means (is it a current index, or some other count). Rename the fields from: e820_table->map => e820_table->entries e820_table->nr_map => e820_table->nr_entries which makes it abundantly clear that these are entries of the table, and that the size of the table is ->nr_entries. Propagate the changes to all affected files. Where necessary, adjust local variable names to better reflect the new field names. No change in functionality. Cc: Alex Thorlton Cc: Andy Lutomirski Cc: Borislav Petkov Cc: Brian Gerst Cc: Dan Williams Cc: Denys Vlasenko Cc: H. Peter Anvin Cc: Huang, Ying Cc: Josh Poimboeuf Cc: Juergen Gross Cc: Linus Torvalds Cc: Paul Jackson Cc: Peter Zijlstra Cc: Rafael J. Wysocki Cc: Tejun Heo Cc: Thomas Gleixner Cc: Wei Yang Cc: Yinghai Lu Cc: linux-kernel@vger.kernel.org Signed-off-by: Ingo Molnar --- arch/x86/include/asm/e820/types.h | 4 +- arch/x86/kernel/e820.c | 114 +++++++++++++++++++------------------- arch/x86/kernel/early-quirks.c | 2 +- arch/x86/kernel/kexec-bzimage64.c | 5 +- arch/x86/kernel/resource.c | 4 +- arch/x86/kernel/setup.c | 6 +- arch/x86/kernel/tboot.c | 8 +-- arch/x86/platform/efi/efi.c | 2 +- arch/x86/power/hibernate_64.c | 11 ++-- arch/x86/xen/setup.c | 2 +- 10 files changed, 77 insertions(+), 81 deletions(-) (limited to 'arch/x86/platform') diff --git a/arch/x86/include/asm/e820/types.h b/arch/x86/include/asm/e820/types.h index ae2c4e9db0d4..e9d811afc123 100644 --- a/arch/x86/include/asm/e820/types.h +++ b/arch/x86/include/asm/e820/types.h @@ -69,8 +69,8 @@ * The whole array of E820 entries: */ struct e820_table { - __u32 nr_map; - struct e820_entry map[E820_X_MAX]; + __u32 nr_entries; + struct e820_entry entries[E820_X_MAX]; }; /* diff --git a/arch/x86/kernel/e820.c b/arch/x86/kernel/e820.c index ffaf94357d15..6d73ad46ab35 100644 --- a/arch/x86/kernel/e820.c +++ b/arch/x86/kernel/e820.c @@ -60,8 +60,8 @@ e820_any_mapped(u64 start, u64 end, unsigned type) { int i; - for (i = 0; i < e820_table->nr_map; i++) { - struct e820_entry *ei = &e820_table->map[i]; + for (i = 0; i < e820_table->nr_entries; i++) { + struct e820_entry *ei = &e820_table->entries[i]; if (type && ei->type != type) continue; @@ -83,8 +83,8 @@ int __init e820_all_mapped(u64 start, u64 end, unsigned type) { int i; - for (i = 0; i < e820_table->nr_map; i++) { - struct e820_entry *ei = &e820_table->map[i]; + for (i = 0; i < e820_table->nr_entries; i++) { + struct e820_entry *ei = &e820_table->entries[i]; if (type && ei->type != type) continue; @@ -110,22 +110,21 @@ int __init e820_all_mapped(u64 start, u64 end, unsigned type) /* * Add a memory region to the kernel e820 map. */ -static void __init __e820_add_region(struct e820_table *e820x, u64 start, u64 size, - int type) +static void __init __e820_add_region(struct e820_table *table, u64 start, u64 size, int type) { - int x = e820x->nr_map; + int x = table->nr_entries; - if (x >= ARRAY_SIZE(e820x->map)) { + if (x >= ARRAY_SIZE(table->entries)) { printk(KERN_ERR "e820: too many entries; ignoring [mem %#010llx-%#010llx]\n", (unsigned long long) start, (unsigned long long) (start + size - 1)); return; } - e820x->map[x].addr = start; - e820x->map[x].size = size; - e820x->map[x].type = type; - e820x->nr_map++; + table->entries[x].addr = start; + table->entries[x].size = size; + table->entries[x].type = type; + table->nr_entries++; } void __init e820_add_region(u64 start, u64 size, int type) @@ -166,12 +165,12 @@ void __init e820_print_map(char *who) { int i; - for (i = 0; i < e820_table->nr_map; i++) { + for (i = 0; i < e820_table->nr_entries; i++) { printk(KERN_INFO "%s: [mem %#018Lx-%#018Lx] ", who, - (unsigned long long) e820_table->map[i].addr, + (unsigned long long) e820_table->entries[i].addr, (unsigned long long) - (e820_table->map[i].addr + e820_table->map[i].size - 1)); - e820_print_type(e820_table->map[i].type); + (e820_table->entries[i].addr + e820_table->entries[i].size - 1)); + e820_print_type(e820_table->entries[i].type); printk(KERN_CONT "\n"); } } @@ -423,7 +422,7 @@ static int __init append_e820_table(struct e820_entry *biosmap, int nr_map) return __append_e820_table(biosmap, nr_map); } -static u64 __init __e820_update_range(struct e820_table *e820x, u64 start, +static u64 __init __e820_update_range(struct e820_table *table, u64 start, u64 size, unsigned old_type, unsigned new_type) { @@ -444,8 +443,8 @@ static u64 __init __e820_update_range(struct e820_table *e820x, u64 start, e820_print_type(new_type); printk(KERN_CONT "\n"); - for (i = 0; i < e820x->nr_map; i++) { - struct e820_entry *ei = &e820x->map[i]; + for (i = 0; i < table->nr_entries; i++) { + struct e820_entry *ei = &table->entries[i]; u64 final_start, final_end; u64 ei_end; @@ -462,8 +461,8 @@ static u64 __init __e820_update_range(struct e820_table *e820x, u64 start, /* new range is totally covered? */ if (ei->addr < start && ei_end > end) { - __e820_add_region(e820x, start, size, new_type); - __e820_add_region(e820x, end, ei_end - end, ei->type); + __e820_add_region(table, start, size, new_type); + __e820_add_region(table, end, ei_end - end, ei->type); ei->size = start - ei->addr; real_updated_size += size; continue; @@ -475,7 +474,7 @@ static u64 __init __e820_update_range(struct e820_table *e820x, u64 start, if (final_start >= final_end) continue; - __e820_add_region(e820x, final_start, final_end - final_start, + __e820_add_region(table, final_start, final_end - final_start, new_type); real_updated_size += final_end - final_start; @@ -523,8 +522,8 @@ u64 __init e820_remove_range(u64 start, u64 size, unsigned old_type, e820_print_type(old_type); printk(KERN_CONT "\n"); - for (i = 0; i < e820_table->nr_map; i++) { - struct e820_entry *ei = &e820_table->map[i]; + for (i = 0; i < e820_table->nr_entries; i++) { + struct e820_entry *ei = &e820_table->entries[i]; u64 final_start, final_end; u64 ei_end; @@ -568,15 +567,14 @@ u64 __init e820_remove_range(u64 start, u64 size, unsigned old_type, void __init update_e820(void) { - if (sanitize_e820_table(e820_table->map, ARRAY_SIZE(e820_table->map), &e820_table->nr_map)) + if (sanitize_e820_table(e820_table->entries, ARRAY_SIZE(e820_table->entries), &e820_table->nr_entries)) return; printk(KERN_INFO "e820: modified physical RAM map:\n"); e820_print_map("modified"); } static void __init update_e820_table_saved(void) { - sanitize_e820_table(e820_table_saved->map, ARRAY_SIZE(e820_table_saved->map), - &e820_table_saved->nr_map); + sanitize_e820_table(e820_table_saved->entries, ARRAY_SIZE(e820_table_saved->entries), &e820_table_saved->nr_entries); } #define MAX_GAP_END 0x100000000ull /* @@ -586,12 +584,12 @@ static int __init e820_search_gap(unsigned long *gapstart, unsigned long *gapsize) { unsigned long long last = MAX_GAP_END; - int i = e820_table->nr_map; + int i = e820_table->nr_entries; int found = 0; while (--i >= 0) { - unsigned long long start = e820_table->map[i].addr; - unsigned long long end = start + e820_table->map[i].size; + unsigned long long start = e820_table->entries[i].addr; + unsigned long long end = start + e820_table->entries[i].size; /* * Since "last" is at most 4GB, we know we'll @@ -661,13 +659,13 @@ __init void e820_reallocate_tables(void) struct e820_table *n; int size; - size = offsetof(struct e820_table, map) + sizeof(struct e820_entry) * e820_table->nr_map; + size = offsetof(struct e820_table, entries) + sizeof(struct e820_entry) * e820_table->nr_entries; n = kmalloc(size, GFP_KERNEL); BUG_ON(!n); memcpy(n, e820_table, size); e820_table = n; - size = offsetof(struct e820_table, map) + sizeof(struct e820_entry) * e820_table_saved->nr_map; + size = offsetof(struct e820_table, entries) + sizeof(struct e820_entry) * e820_table_saved->nr_entries; n = kmalloc(size, GFP_KERNEL); BUG_ON(!n); memcpy(n, e820_table_saved, size); @@ -690,7 +688,7 @@ void __init parse_e820_ext(u64 phys_addr, u32 data_len) entries = sdata->len / sizeof(struct e820_entry); extmap = (struct e820_entry *)(sdata->data); __append_e820_table(extmap, entries); - sanitize_e820_table(e820_table->map, ARRAY_SIZE(e820_table->map), &e820_table->nr_map); + sanitize_e820_table(e820_table->entries, ARRAY_SIZE(e820_table->entries), &e820_table->nr_entries); early_memunmap(sdata, data_len); printk(KERN_INFO "e820: extended physical RAM map:\n"); e820_print_map("extended"); @@ -709,8 +707,8 @@ void __init e820_mark_nosave_regions(unsigned long limit_pfn) int i; unsigned long pfn = 0; - for (i = 0; i < e820_table->nr_map; i++) { - struct e820_entry *ei = &e820_table->map[i]; + for (i = 0; i < e820_table->nr_entries; i++) { + struct e820_entry *ei = &e820_table->entries[i]; if (pfn < PFN_UP(ei->addr)) register_nosave_region(pfn, PFN_UP(ei->addr)); @@ -734,8 +732,8 @@ static int __init e820_mark_nvs_memory(void) { int i; - for (i = 0; i < e820_table->nr_map; i++) { - struct e820_entry *ei = &e820_table->map[i]; + for (i = 0; i < e820_table->nr_entries; i++) { + struct e820_entry *ei = &e820_table->entries[i]; if (ei->type == E820_NVS) acpi_nvs_register(ei->addr, ei->size); @@ -782,8 +780,8 @@ static unsigned long __init e820_end_pfn(unsigned long limit_pfn, unsigned type) unsigned long last_pfn = 0; unsigned long max_arch_pfn = MAX_ARCH_PFN; - for (i = 0; i < e820_table->nr_map; i++) { - struct e820_entry *ei = &e820_table->map[i]; + for (i = 0; i < e820_table->nr_entries; i++) { + struct e820_entry *ei = &e820_table->entries[i]; unsigned long start_pfn; unsigned long end_pfn; @@ -874,7 +872,7 @@ static int __init parse_memmap_one(char *p) */ saved_max_pfn = e820_end_of_ram_pfn(); #endif - e820_table->nr_map = 0; + e820_table->nr_entries = 0; userdef = 1; return 0; } @@ -921,8 +919,8 @@ early_param("memmap", parse_memmap_opt); void __init finish_e820_parsing(void) { if (userdef) { - if (sanitize_e820_table(e820_table->map, ARRAY_SIZE(e820_table->map), - &e820_table->nr_map) < 0) + if (sanitize_e820_table(e820_table->entries, ARRAY_SIZE(e820_table->entries), + &e820_table->nr_entries) < 0) early_panic("Invalid user supplied memory map"); printk(KERN_INFO "e820: user-defined physical RAM map:\n"); @@ -1009,35 +1007,35 @@ void __init e820_reserve_resources(void) struct resource *res; u64 end; - res = alloc_bootmem(sizeof(struct resource) * e820_table->nr_map); + res = alloc_bootmem(sizeof(struct resource) * e820_table->nr_entries); e820_res = res; - for (i = 0; i < e820_table->nr_map; i++) { - end = e820_table->map[i].addr + e820_table->map[i].size - 1; + for (i = 0; i < e820_table->nr_entries; i++) { + end = e820_table->entries[i].addr + e820_table->entries[i].size - 1; if (end != (resource_size_t)end) { res++; continue; } - res->name = e820_type_to_string(e820_table->map[i].type); - res->start = e820_table->map[i].addr; + res->name = e820_type_to_string(e820_table->entries[i].type); + res->start = e820_table->entries[i].addr; res->end = end; - res->flags = e820_type_to_iomem_type(e820_table->map[i].type); - res->desc = e820_type_to_iores_desc(e820_table->map[i].type); + res->flags = e820_type_to_iomem_type(e820_table->entries[i].type); + res->desc = e820_type_to_iores_desc(e820_table->entries[i].type); /* * don't register the region that could be conflicted with * pci device BAR resource and insert them later in * pcibios_resource_survey() */ - if (do_mark_busy(e820_table->map[i].type, res)) { + if (do_mark_busy(e820_table->entries[i].type, res)) { res->flags |= IORESOURCE_BUSY; insert_resource(&iomem_resource, res); } res++; } - for (i = 0; i < e820_table_saved->nr_map; i++) { - struct e820_entry *entry = &e820_table_saved->map[i]; + for (i = 0; i < e820_table_saved->nr_entries; i++) { + struct e820_entry *entry = &e820_table_saved->entries[i]; firmware_map_add_early(entry->addr, entry->addr + entry->size, e820_type_to_string(entry->type)); @@ -1069,7 +1067,7 @@ void __init e820_reserve_resources_late(void) struct resource *res; res = e820_res; - for (i = 0; i < e820_table->nr_map; i++) { + for (i = 0; i < e820_table->nr_entries; i++) { if (!res->parent && res->end) insert_resource_expand_to_fit(&iomem_resource, res); res++; @@ -1079,8 +1077,8 @@ void __init e820_reserve_resources_late(void) * Try to bump up RAM regions to reasonable boundaries to * avoid stolen RAM: */ - for (i = 0; i < e820_table->nr_map; i++) { - struct e820_entry *entry = &e820_table->map[i]; + for (i = 0; i < e820_table->nr_entries; i++) { + struct e820_entry *entry = &e820_table->entries[i]; u64 start, end; if (entry->type != E820_RAM) @@ -1128,7 +1126,7 @@ char *__init default_machine_specific_memory_setup(void) who = "BIOS-e801"; } - e820_table->nr_map = 0; + e820_table->nr_entries = 0; e820_add_region(0, LOWMEMSIZE(), E820_RAM); e820_add_region(HIGH_MEMORY, mem_size << 10, E820_RAM); } @@ -1159,8 +1157,8 @@ void __init memblock_x86_fill(void) */ memblock_allow_resize(); - for (i = 0; i < e820_table->nr_map; i++) { - struct e820_entry *ei = &e820_table->map[i]; + for (i = 0; i < e820_table->nr_entries; i++) { + struct e820_entry *ei = &e820_table->entries[i]; end = ei->addr + ei->size; if (end != (resource_size_t)end) diff --git a/arch/x86/kernel/early-quirks.c b/arch/x86/kernel/early-quirks.c index a6cdf9b9c7a9..4f52758accbc 100644 --- a/arch/x86/kernel/early-quirks.c +++ b/arch/x86/kernel/early-quirks.c @@ -547,7 +547,7 @@ intel_graphics_stolen(int num, int slot, int func, /* Mark this space as reserved */ e820_add_region(base, size, E820_RESERVED); - sanitize_e820_table(e820_table->map, ARRAY_SIZE(e820_table->map), &e820_table->nr_map); + sanitize_e820_table(e820_table->entries, ARRAY_SIZE(e820_table->entries), &e820_table->nr_entries); } static void __init intel_graphics_quirks(int num, int slot, int func) diff --git a/arch/x86/kernel/kexec-bzimage64.c b/arch/x86/kernel/kexec-bzimage64.c index 39d340ac50eb..3e5c995e1718 100644 --- a/arch/x86/kernel/kexec-bzimage64.c +++ b/arch/x86/kernel/kexec-bzimage64.c @@ -100,15 +100,14 @@ static int setup_e820_entries(struct boot_params *params) { unsigned int nr_e820_entries; - nr_e820_entries = e820_table_saved->nr_map; + nr_e820_entries = e820_table_saved->nr_entries; /* TODO: Pass entries more than E820MAX in bootparams setup data */ if (nr_e820_entries > E820MAX) nr_e820_entries = E820MAX; params->e820_entries = nr_e820_entries; - memcpy(¶ms->e820_table, &e820_table_saved->map, - nr_e820_entries * sizeof(struct e820_entry)); + memcpy(¶ms->e820_table, &e820_table_saved->entries, nr_e820_entries*sizeof(struct e820_entry)); return 0; } diff --git a/arch/x86/kernel/resource.c b/arch/x86/kernel/resource.c index 17b494d4bb86..5ab3895516ac 100644 --- a/arch/x86/kernel/resource.c +++ b/arch/x86/kernel/resource.c @@ -27,8 +27,8 @@ static void remove_e820_regions(struct resource *avail) int i; struct e820_entry *entry; - for (i = 0; i < e820_table->nr_map; i++) { - entry = &e820_table->map[i]; + for (i = 0; i < e820_table->nr_entries; i++) { + entry = &e820_table->entries[i]; resource_clip(avail, entry->addr, entry->addr + entry->size - 1); diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c index a3c1d39116b7..c2bb2d143d70 100644 --- a/arch/x86/kernel/setup.c +++ b/arch/x86/kernel/setup.c @@ -458,7 +458,7 @@ static void __init e820_reserve_setup_data(void) early_memunmap(data, sizeof(*data)); } - sanitize_e820_table(e820_table->map, ARRAY_SIZE(e820_table->map), &e820_table->nr_map); + sanitize_e820_table(e820_table->entries, ARRAY_SIZE(e820_table->entries), &e820_table->nr_entries); memcpy(e820_table_saved, e820_table, sizeof(struct e820_table)); printk(KERN_INFO "extended physical RAM map:\n"); e820_print_map("reserve setup_data"); @@ -763,7 +763,7 @@ static void __init trim_bios_range(void) */ e820_remove_range(BIOS_BEGIN, BIOS_END - BIOS_BEGIN, E820_RAM, 1); - sanitize_e820_table(e820_table->map, ARRAY_SIZE(e820_table->map), &e820_table->nr_map); + sanitize_e820_table(e820_table->entries, ARRAY_SIZE(e820_table->entries), &e820_table->nr_entries); } /* called before trim_bios_range() to spare extra sanitize */ @@ -1056,7 +1056,7 @@ void __init setup_arch(char **cmdline_p) if (ppro_with_ram_bug()) { e820_update_range(0x70000000ULL, 0x40000ULL, E820_RAM, E820_RESERVED); - sanitize_e820_table(e820_table->map, ARRAY_SIZE(e820_table->map), &e820_table->nr_map); + sanitize_e820_table(e820_table->entries, ARRAY_SIZE(e820_table->entries), &e820_table->nr_entries); printk(KERN_INFO "fixed physical RAM map:\n"); e820_print_map("bad_ppro"); } diff --git a/arch/x86/kernel/tboot.c b/arch/x86/kernel/tboot.c index 825822688aa5..f7cba42d7807 100644 --- a/arch/x86/kernel/tboot.c +++ b/arch/x86/kernel/tboot.c @@ -188,12 +188,12 @@ static int tboot_setup_sleep(void) tboot->num_mac_regions = 0; - for (i = 0; i < e820_table->nr_map; i++) { - if ((e820_table->map[i].type != E820_RAM) - && (e820_table->map[i].type != E820_RESERVED_KERN)) + for (i = 0; i < e820_table->nr_entries; i++) { + if ((e820_table->entries[i].type != E820_RAM) + && (e820_table->entries[i].type != E820_RESERVED_KERN)) continue; - add_mac_region(e820_table->map[i].addr, e820_table->map[i].size); + add_mac_region(e820_table->entries[i].addr, e820_table->entries[i].size); } tboot->acpi_sinfo.kernel_s3_resume_vector = diff --git a/arch/x86/platform/efi/efi.c b/arch/x86/platform/efi/efi.c index 9e055f6859e5..b69199165610 100644 --- a/arch/x86/platform/efi/efi.c +++ b/arch/x86/platform/efi/efi.c @@ -167,7 +167,7 @@ static void __init do_add_efi_memmap(void) } e820_add_region(start, size, e820_type); } - sanitize_e820_table(e820_table->map, ARRAY_SIZE(e820_table->map), &e820_table->nr_map); + sanitize_e820_table(e820_table->entries, ARRAY_SIZE(e820_table->entries), &e820_table->nr_entries); } int __init efi_memblock_x86_reserve_range(void) diff --git a/arch/x86/power/hibernate_64.c b/arch/x86/power/hibernate_64.c index 8fe5be0e90b2..1bfda425879c 100644 --- a/arch/x86/power/hibernate_64.c +++ b/arch/x86/power/hibernate_64.c @@ -196,12 +196,12 @@ struct restore_data_record { #if IS_BUILTIN(CONFIG_CRYPTO_MD5) /** - * get_e820_md5 - calculate md5 according to given e820 map + * get_e820_md5 - calculate md5 according to given e820 table * - * @map: the e820 map to be calculated + * @table: the e820 table to be calculated * @buf: the md5 result to be stored to */ -static int get_e820_md5(struct e820_table *map, void *buf) +static int get_e820_md5(struct e820_table *table, void *buf) { struct scatterlist sg; struct crypto_ahash *tfm; @@ -214,10 +214,9 @@ static int get_e820_md5(struct e820_table *map, void *buf) { AHASH_REQUEST_ON_STACK(req, tfm); - size = offsetof(struct e820_table, map) - + sizeof(struct e820_entry) * map->nr_map; + size = offsetof(struct e820_table, entries) + sizeof(struct e820_entry) * table->nr_entries; ahash_request_set_tfm(req, tfm); - sg_init_one(&sg, (u8 *)map, size); + sg_init_one(&sg, (u8 *)table, size); ahash_request_set_callback(req, 0, NULL, NULL); ahash_request_set_crypt(req, &sg, buf, size); diff --git a/arch/x86/xen/setup.c b/arch/x86/xen/setup.c index f98713e5a705..8b26b9282070 100644 --- a/arch/x86/xen/setup.c +++ b/arch/x86/xen/setup.c @@ -861,7 +861,7 @@ char * __init xen_memory_setup(void) e820_add_region(ISA_START_ADDRESS, ISA_END_ADDRESS - ISA_START_ADDRESS, E820_RESERVED); - sanitize_e820_table(e820_table->map, ARRAY_SIZE(e820_table->map), &e820_table->nr_map); + sanitize_e820_table(e820_table->entries, ARRAY_SIZE(e820_table->entries), &e820_table->nr_entries); /* * Check whether the kernel itself conflicts with the target E820 map. -- cgit v1.2.3 From f52355a99fc06f609ca6a61098d78e476d56f526 Mon Sep 17 00:00:00 2001 From: Ingo Molnar Date: Sat, 28 Jan 2017 14:09:20 +0100 Subject: x86/boot/e820: Rename sanitize_e820_table() to e820__update_table() sanitize_e820_table() is a minor misnomer in that it suggests that the E820 table requires sanitizing - which implies that it will only do anything if the E820 table is irregular (not sane). That is wrong, because sanitize_e820_table() also does a very regular sorting of the E820 table, which is a necessity in the basic append-only flow of E820 updates the kernel is allowed to perform to it. So rename it to e820__update_table() to include that purpose as well. This also lines up all the table-update functions into a coherent naming family: int e820__update_table(struct e820_entry *biosmap, int max_nr_map, u32 *pnr_map); void e820__update_table_print(void); void e820__update_table_firmware(void); No change in functionality. Cc: Alex Thorlton Cc: Andy Lutomirski Cc: Borislav Petkov Cc: Brian Gerst Cc: Dan Williams Cc: Denys Vlasenko Cc: H. Peter Anvin Cc: Huang, Ying Cc: Josh Poimboeuf Cc: Juergen Gross Cc: Linus Torvalds Cc: Paul Jackson Cc: Peter Zijlstra Cc: Rafael J. Wysocki Cc: Tejun Heo Cc: Thomas Gleixner Cc: Wei Yang Cc: Yinghai Lu Cc: linux-kernel@vger.kernel.org Signed-off-by: Ingo Molnar --- arch/x86/include/asm/e820/api.h | 2 +- arch/x86/include/asm/e820/types.h | 2 +- arch/x86/kernel/e820.c | 16 ++++++++-------- arch/x86/kernel/early-quirks.c | 2 +- arch/x86/kernel/setup.c | 4 ++-- arch/x86/platform/efi/efi.c | 2 +- arch/x86/xen/setup.c | 6 +++--- 7 files changed, 17 insertions(+), 17 deletions(-) (limited to 'arch/x86/platform') diff --git a/arch/x86/include/asm/e820/api.h b/arch/x86/include/asm/e820/api.h index 6dc8570b5553..9f3917805fc6 100644 --- a/arch/x86/include/asm/e820/api.h +++ b/arch/x86/include/asm/e820/api.h @@ -12,7 +12,7 @@ extern int e820_any_mapped(u64 start, u64 end, unsigned type); extern int e820_all_mapped(u64 start, u64 end, unsigned type); extern void e820_add_region(u64 start, u64 size, int type); extern void e820_print_map(char *who); -extern int sanitize_e820_table(struct e820_entry *biosmap, int max_nr_map, u32 *pnr_map); +extern int e820__update_table(struct e820_entry *biosmap, int max_nr_map, u32 *pnr_map); extern u64 e820_update_range(u64 start, u64 size, unsigned old_type, unsigned new_type); extern u64 e820_remove_range(u64 start, u64 size, unsigned old_type, int checktype); extern void e820__update_table_print(void); diff --git a/arch/x86/include/asm/e820/types.h b/arch/x86/include/asm/e820/types.h index e9d811afc123..da9477d78214 100644 --- a/arch/x86/include/asm/e820/types.h +++ b/arch/x86/include/asm/e820/types.h @@ -21,7 +21,7 @@ * * This allows for bootstrap/firmware quirks such as possible duplicate * E820 entries that might need room in the same arrays, prior to the - * call to sanitize_e820_table() to remove duplicates. The allowance + * call to e820__update_table() to remove duplicates. The allowance * of three memory map entries per node is "enough" entries for * the initial hardware platform motivating this mechanism to make * use of additional EFI map entries. Future platforms may want diff --git a/arch/x86/kernel/e820.c b/arch/x86/kernel/e820.c index 03af13c3c431..0053c9f1f6e2 100644 --- a/arch/x86/kernel/e820.c +++ b/arch/x86/kernel/e820.c @@ -193,7 +193,7 @@ void __init e820_print_map(char *who) * sanitizing succeeds the *pnr_map will be updated with the new * number of valid entries (something no more than max_nr_map). * - * The return value from sanitize_e820_table() is zero if it + * The return value from e820__update_table() is zero if it * successfully 'sanitized' the map entries passed in, and is -1 * if it did nothing, which can happen if either of (1) it was * only passed one map entry, or (2) any of the input map entries @@ -259,7 +259,7 @@ static int __init cpcompare(const void *a, const void *b) return (ap->addr != ap->pbios->addr) - (bp->addr != bp->pbios->addr); } -int __init sanitize_e820_table(struct e820_entry *biosmap, int max_nr_map, u32 *pnr_map) +int __init e820__update_table(struct e820_entry *biosmap, int max_nr_map, u32 *pnr_map) { static struct change_member change_point_list[2*E820_X_MAX] __initdata; static struct change_member *change_point[2*E820_X_MAX] __initdata; @@ -548,7 +548,7 @@ u64 __init e820_remove_range(u64 start, u64 size, unsigned old_type, int checkty void __init e820__update_table_print(void) { - if (sanitize_e820_table(e820_table->entries, ARRAY_SIZE(e820_table->entries), &e820_table->nr_entries)) + if (e820__update_table(e820_table->entries, ARRAY_SIZE(e820_table->entries), &e820_table->nr_entries)) return; pr_info("e820: modified physical RAM map:\n"); @@ -557,7 +557,7 @@ void __init e820__update_table_print(void) static void __init e820__update_table_firmware(void) { - sanitize_e820_table(e820_table_firmware->entries, ARRAY_SIZE(e820_table_firmware->entries), &e820_table_firmware->nr_entries); + e820__update_table(e820_table_firmware->entries, ARRAY_SIZE(e820_table_firmware->entries), &e820_table_firmware->nr_entries); } #define MAX_GAP_END 0x100000000ull @@ -676,7 +676,7 @@ void __init e820__memory_setup_extended(u64 phys_addr, u32 data_len) extmap = (struct e820_entry *)(sdata->data); __append_e820_table(extmap, entries); - sanitize_e820_table(e820_table->entries, ARRAY_SIZE(e820_table->entries), &e820_table->nr_entries); + e820__update_table(e820_table->entries, ARRAY_SIZE(e820_table->entries), &e820_table->nr_entries); early_memunmap(sdata, data_len); pr_info("e820: extended physical RAM map:\n"); @@ -931,7 +931,7 @@ void __init e820_reserve_setup_data(void) early_memunmap(data, sizeof(*data)); } - sanitize_e820_table(e820_table->entries, ARRAY_SIZE(e820_table->entries), &e820_table->nr_entries); + e820__update_table(e820_table->entries, ARRAY_SIZE(e820_table->entries), &e820_table->nr_entries); memcpy(e820_table_firmware, e820_table, sizeof(struct e820_table)); printk(KERN_INFO "extended physical RAM map:\n"); e820_print_map("reserve setup_data"); @@ -945,7 +945,7 @@ void __init e820_reserve_setup_data(void) void __init e820__finish_early_params(void) { if (userdef) { - if (sanitize_e820_table(e820_table->entries, ARRAY_SIZE(e820_table->entries), &e820_table->nr_entries) < 0) + if (e820__update_table(e820_table->entries, ARRAY_SIZE(e820_table->entries), &e820_table->nr_entries) < 0) early_panic("Invalid user supplied memory map"); pr_info("e820: user-defined physical RAM map:\n"); @@ -1130,7 +1130,7 @@ char *__init e820__memory_setup_default(void) * the next section from 1mb->appropriate_mem_k */ new_nr = boot_params.e820_entries; - sanitize_e820_table(boot_params.e820_table, ARRAY_SIZE(boot_params.e820_table), &new_nr); + e820__update_table(boot_params.e820_table, ARRAY_SIZE(boot_params.e820_table), &new_nr); boot_params.e820_entries = new_nr; if (append_e820_table(boot_params.e820_table, boot_params.e820_entries) < 0) { diff --git a/arch/x86/kernel/early-quirks.c b/arch/x86/kernel/early-quirks.c index 4f52758accbc..66722f447401 100644 --- a/arch/x86/kernel/early-quirks.c +++ b/arch/x86/kernel/early-quirks.c @@ -547,7 +547,7 @@ intel_graphics_stolen(int num, int slot, int func, /* Mark this space as reserved */ e820_add_region(base, size, E820_RESERVED); - sanitize_e820_table(e820_table->entries, ARRAY_SIZE(e820_table->entries), &e820_table->nr_entries); + e820__update_table(e820_table->entries, ARRAY_SIZE(e820_table->entries), &e820_table->nr_entries); } static void __init intel_graphics_quirks(int num, int slot, int func) diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c index a31c5bc99635..e8ec0c693a77 100644 --- a/arch/x86/kernel/setup.c +++ b/arch/x86/kernel/setup.c @@ -740,7 +740,7 @@ static void __init trim_bios_range(void) */ e820_remove_range(BIOS_BEGIN, BIOS_END - BIOS_BEGIN, E820_RAM, 1); - sanitize_e820_table(e820_table->entries, ARRAY_SIZE(e820_table->entries), &e820_table->nr_entries); + e820__update_table(e820_table->entries, ARRAY_SIZE(e820_table->entries), &e820_table->nr_entries); } /* called before trim_bios_range() to spare extra sanitize */ @@ -1033,7 +1033,7 @@ void __init setup_arch(char **cmdline_p) if (ppro_with_ram_bug()) { e820_update_range(0x70000000ULL, 0x40000ULL, E820_RAM, E820_RESERVED); - sanitize_e820_table(e820_table->entries, ARRAY_SIZE(e820_table->entries), &e820_table->nr_entries); + e820__update_table(e820_table->entries, ARRAY_SIZE(e820_table->entries), &e820_table->nr_entries); printk(KERN_INFO "fixed physical RAM map:\n"); e820_print_map("bad_ppro"); } diff --git a/arch/x86/platform/efi/efi.c b/arch/x86/platform/efi/efi.c index b69199165610..3a8f11ef6bfe 100644 --- a/arch/x86/platform/efi/efi.c +++ b/arch/x86/platform/efi/efi.c @@ -167,7 +167,7 @@ static void __init do_add_efi_memmap(void) } e820_add_region(start, size, e820_type); } - sanitize_e820_table(e820_table->entries, ARRAY_SIZE(e820_table->entries), &e820_table->nr_entries); + e820__update_table(e820_table->entries, ARRAY_SIZE(e820_table->entries), &e820_table->nr_entries); } int __init efi_memblock_x86_reserve_range(void) diff --git a/arch/x86/xen/setup.c b/arch/x86/xen/setup.c index 8b26b9282070..c2f8e4ab55bd 100644 --- a/arch/x86/xen/setup.c +++ b/arch/x86/xen/setup.c @@ -783,7 +783,7 @@ char * __init xen_memory_setup(void) xen_ignore_unusable(); /* Make sure the Xen-supplied memory map is well-ordered. */ - sanitize_e820_table(xen_e820_table, ARRAY_SIZE(xen_e820_table), + e820__update_table(xen_e820_table, ARRAY_SIZE(xen_e820_table), &xen_e820_table_entries); max_pages = xen_get_max_pages(); @@ -861,7 +861,7 @@ char * __init xen_memory_setup(void) e820_add_region(ISA_START_ADDRESS, ISA_END_ADDRESS - ISA_START_ADDRESS, E820_RESERVED); - sanitize_e820_table(e820_table->entries, ARRAY_SIZE(e820_table->entries), &e820_table->nr_entries); + e820__update_table(e820_table->entries, ARRAY_SIZE(e820_table->entries), &e820_table->nr_entries); /* * Check whether the kernel itself conflicts with the target E820 map. @@ -932,7 +932,7 @@ char * __init xen_auto_xlated_memory_setup(void) xen_e820_table_entries = memmap.nr_entries; - sanitize_e820_table(xen_e820_table, ARRAY_SIZE(xen_e820_table), + e820__update_table(xen_e820_table, ARRAY_SIZE(xen_e820_table), &xen_e820_table_entries); for (i = 0; i < xen_e820_table_entries; i++) -- cgit v1.2.3 From 3bce64f019a801f526cc38523c77ffda4e846155 Mon Sep 17 00:00:00 2001 From: Ingo Molnar Date: Sat, 28 Jan 2017 14:14:25 +0100 Subject: x86/boot/e820: Rename e820_any_mapped()/e820_all_mapped() to e820__mapped_any()/e820__mapped_all() The 'any' and 'all' are modified to the 'mapped' concept, so move them last in the name. No change in functionality. Cc: Alex Thorlton Cc: Andy Lutomirski Cc: Borislav Petkov Cc: Brian Gerst Cc: Dan Williams Cc: Denys Vlasenko Cc: H. Peter Anvin Cc: Huang, Ying Cc: Josh Poimboeuf Cc: Juergen Gross Cc: Linus Torvalds Cc: Paul Jackson Cc: Peter Zijlstra Cc: Rafael J. Wysocki Cc: Tejun Heo Cc: Thomas Gleixner Cc: Wei Yang Cc: Yinghai Lu Cc: linux-kernel@vger.kernel.org Signed-off-by: Ingo Molnar --- arch/x86/include/asm/e820/api.h | 4 ++-- arch/x86/include/asm/gart.h | 2 +- arch/x86/kernel/aperture_64.c | 2 +- arch/x86/kernel/e820.c | 6 +++--- arch/x86/kernel/setup.c | 2 +- arch/x86/kernel/tboot.c | 2 +- arch/x86/mm/init_64.c | 12 ++++++------ arch/x86/pci/mmconfig-shared.c | 4 ++-- arch/x86/platform/efi/quirks.c | 2 +- 9 files changed, 18 insertions(+), 18 deletions(-) (limited to 'arch/x86/platform') diff --git a/arch/x86/include/asm/e820/api.h b/arch/x86/include/asm/e820/api.h index 9f3917805fc6..3ba95d462bbc 100644 --- a/arch/x86/include/asm/e820/api.h +++ b/arch/x86/include/asm/e820/api.h @@ -8,8 +8,8 @@ extern struct e820_table *e820_table_firmware; extern unsigned long pci_mem_start; -extern int e820_any_mapped(u64 start, u64 end, unsigned type); -extern int e820_all_mapped(u64 start, u64 end, unsigned type); +extern int e820__mapped_any(u64 start, u64 end, unsigned type); +extern int e820__mapped_all(u64 start, u64 end, unsigned type); extern void e820_add_region(u64 start, u64 size, int type); extern void e820_print_map(char *who); extern int e820__update_table(struct e820_entry *biosmap, int max_nr_map, u32 *pnr_map); diff --git a/arch/x86/include/asm/gart.h b/arch/x86/include/asm/gart.h index e26a5d7fc368..2a3ff2ac4686 100644 --- a/arch/x86/include/asm/gart.h +++ b/arch/x86/include/asm/gart.h @@ -97,7 +97,7 @@ static inline int aperture_valid(u64 aper_base, u32 aper_size, u32 min_size) printk(KERN_INFO "Aperture beyond 4GB. Ignoring.\n"); return 0; } - if (e820_any_mapped(aper_base, aper_base + aper_size, E820_RAM)) { + if (e820__mapped_any(aper_base, aper_base + aper_size, E820_RAM)) { printk(KERN_INFO "Aperture pointing to e820 RAM. Ignoring.\n"); return 0; } diff --git a/arch/x86/kernel/aperture_64.c b/arch/x86/kernel/aperture_64.c index e21d012c557b..d027858a306e 100644 --- a/arch/x86/kernel/aperture_64.c +++ b/arch/x86/kernel/aperture_64.c @@ -306,7 +306,7 @@ void __init early_gart_iommu_check(void) fix = 1; if (gart_fix_e820 && !fix && aper_enabled) { - if (e820_any_mapped(aper_base, aper_base + aper_size, + if (e820__mapped_any(aper_base, aper_base + aper_size, E820_RAM)) { /* reserve it, so we can reuse it in second kernel */ pr_info("e820: reserve [mem %#010Lx-%#010Lx] for GART\n", diff --git a/arch/x86/kernel/e820.c b/arch/x86/kernel/e820.c index 0053c9f1f6e2..804acee76aca 100644 --- a/arch/x86/kernel/e820.c +++ b/arch/x86/kernel/e820.c @@ -68,7 +68,7 @@ EXPORT_SYMBOL(pci_mem_start); * This function checks if any part of the range is mapped * with type. */ -int e820_any_mapped(u64 start, u64 end, unsigned type) +int e820__mapped_any(u64 start, u64 end, unsigned type) { int i; @@ -83,7 +83,7 @@ int e820_any_mapped(u64 start, u64 end, unsigned type) } return 0; } -EXPORT_SYMBOL_GPL(e820_any_mapped); +EXPORT_SYMBOL_GPL(e820__mapped_any); /* * This function checks if the entire range is mapped with 'type'. @@ -91,7 +91,7 @@ EXPORT_SYMBOL_GPL(e820_any_mapped); * Note: this function only works correctly once the E820 table is sorted and * not-overlapping (at least for the range specified), which is the case normally. */ -int __init e820_all_mapped(u64 start, u64 end, unsigned type) +int __init e820__mapped_all(u64 start, u64 end, unsigned type) { int i; diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c index e8ec0c693a77..5ea90a2b3709 100644 --- a/arch/x86/kernel/setup.c +++ b/arch/x86/kernel/setup.c @@ -756,7 +756,7 @@ static void __init e820_add_kernel_range(void) * exclude kernel range. If we really are running on top non-RAM, * we will crash later anyways. */ - if (e820_all_mapped(start, start + size, E820_RAM)) + if (e820__mapped_all(start, start + size, E820_RAM)) return; pr_warn(".text .data .bss are not marked as E820_RAM!\n"); diff --git a/arch/x86/kernel/tboot.c b/arch/x86/kernel/tboot.c index f7cba42d7807..0e2dc3831970 100644 --- a/arch/x86/kernel/tboot.c +++ b/arch/x86/kernel/tboot.c @@ -68,7 +68,7 @@ void __init tboot_probe(void) * also verify that it is mapped as we expect it before calling * set_fixmap(), to reduce chance of garbage value causing crash */ - if (!e820_any_mapped(boot_params.tboot_addr, + if (!e820__mapped_any(boot_params.tboot_addr, boot_params.tboot_addr, E820_RESERVED)) { pr_warning("non-0 tboot_addr but it is not of type E820_RESERVED\n"); return; diff --git a/arch/x86/mm/init_64.c b/arch/x86/mm/init_64.c index ad7a477f3423..cfb119e4c4d1 100644 --- a/arch/x86/mm/init_64.c +++ b/arch/x86/mm/init_64.c @@ -337,9 +337,9 @@ phys_pte_init(pte_t *pte_page, unsigned long paddr, unsigned long paddr_end, paddr_next = (paddr & PAGE_MASK) + PAGE_SIZE; if (paddr >= paddr_end) { if (!after_bootmem && - !e820_any_mapped(paddr & PAGE_MASK, paddr_next, + !e820__mapped_any(paddr & PAGE_MASK, paddr_next, E820_RAM) && - !e820_any_mapped(paddr & PAGE_MASK, paddr_next, + !e820__mapped_any(paddr & PAGE_MASK, paddr_next, E820_RESERVED_KERN)) set_pte(pte, __pte(0)); continue; @@ -392,9 +392,9 @@ phys_pmd_init(pmd_t *pmd_page, unsigned long paddr, unsigned long paddr_end, paddr_next = (paddr & PMD_MASK) + PMD_SIZE; if (paddr >= paddr_end) { if (!after_bootmem && - !e820_any_mapped(paddr & PMD_MASK, paddr_next, + !e820__mapped_any(paddr & PMD_MASK, paddr_next, E820_RAM) && - !e820_any_mapped(paddr & PMD_MASK, paddr_next, + !e820__mapped_any(paddr & PMD_MASK, paddr_next, E820_RESERVED_KERN)) set_pmd(pmd, __pmd(0)); continue; @@ -478,9 +478,9 @@ phys_pud_init(pud_t *pud_page, unsigned long paddr, unsigned long paddr_end, if (paddr >= paddr_end) { if (!after_bootmem && - !e820_any_mapped(paddr & PUD_MASK, paddr_next, + !e820__mapped_any(paddr & PUD_MASK, paddr_next, E820_RAM) && - !e820_any_mapped(paddr & PUD_MASK, paddr_next, + !e820__mapped_any(paddr & PUD_MASK, paddr_next, E820_RESERVED_KERN)) set_pud(pud, __pud(0)); continue; diff --git a/arch/x86/pci/mmconfig-shared.c b/arch/x86/pci/mmconfig-shared.c index 767199edef74..696b050bdc45 100644 --- a/arch/x86/pci/mmconfig-shared.c +++ b/arch/x86/pci/mmconfig-shared.c @@ -514,7 +514,7 @@ static int __ref pci_mmcfg_check_reserved(struct device *dev, } /* - * e820_all_mapped() is marked as __init. + * e820__mapped_all() is marked as __init. * All entries from ACPI MCFG table have been checked at boot time. * For MCFG information constructed from hotpluggable host bridge's * _CBA method, just assume it's reserved. @@ -525,7 +525,7 @@ static int __ref pci_mmcfg_check_reserved(struct device *dev, /* Don't try to do this check unless configuration type 1 is available. how about type 2 ?*/ if (raw_pci_ops) - return is_mmconf_reserved(e820_all_mapped, cfg, dev, 1); + return is_mmconf_reserved(e820__mapped_all, cfg, dev, 1); return 0; } diff --git a/arch/x86/platform/efi/quirks.c b/arch/x86/platform/efi/quirks.c index c6a14b11f496..d4acd1668d36 100644 --- a/arch/x86/platform/efi/quirks.c +++ b/arch/x86/platform/efi/quirks.c @@ -249,7 +249,7 @@ static bool can_free_region(u64 start, u64 size) if (start + size > __pa_symbol(_text) && start <= __pa_symbol(_end)) return false; - if (!e820_all_mapped(start, start+size, E820_RAM)) + if (!e820__mapped_all(start, start+size, E820_RAM)) return false; return true; -- cgit v1.2.3 From ab6bc04cfdbd5da00a85909c054770a606e7c804 Mon Sep 17 00:00:00 2001 From: Ingo Molnar Date: Sat, 28 Jan 2017 14:19:36 +0100 Subject: x86/boot/e820: Create coherent API function names for E820 range operations We have these three related functions: extern void e820_add_region(u64 start, u64 size, int type); extern u64 e820_update_range(u64 start, u64 size, unsigned old_type, unsigned new_type); extern u64 e820_remove_range(u64 start, u64 size, unsigned old_type, int checktype); But it's not clear from the naming that they are 3 operations based around the same 'memory range' concept. Rename them to better signal this, and move the prototypes next to each other: extern void e820__range_add (u64 start, u64 size, int type); extern u64 e820__range_update(u64 start, u64 size, unsigned old_type, unsigned new_type); extern u64 e820__range_remove(u64 start, u64 size, unsigned old_type, int checktype); Note that this improved organization of the functions shows another problem that was easy to miss before: sometimes the E820 entry type is 'int', sometimes 'unsigned int' - but this will be fixed in a separate patch. No change in functionality. Cc: Alex Thorlton Cc: Andy Lutomirski Cc: Borislav Petkov Cc: Brian Gerst Cc: Dan Williams Cc: Denys Vlasenko Cc: H. Peter Anvin Cc: Huang, Ying Cc: Josh Poimboeuf Cc: Juergen Gross Cc: Linus Torvalds Cc: Paul Jackson Cc: Peter Zijlstra Cc: Rafael J. Wysocki Cc: Tejun Heo Cc: Thomas Gleixner Cc: Wei Yang Cc: Yinghai Lu Cc: linux-kernel@vger.kernel.org Signed-off-by: Ingo Molnar --- arch/x86/include/asm/e820/api.h | 8 ++++--- arch/x86/kernel/acpi/boot.c | 2 +- arch/x86/kernel/aperture_64.c | 2 +- arch/x86/kernel/cpu/mtrr/cleanup.c | 2 +- arch/x86/kernel/e820.c | 48 +++++++++++++++++++------------------- arch/x86/kernel/early-quirks.c | 2 +- arch/x86/kernel/setup.c | 10 ++++---- arch/x86/lguest/boot.c | 2 +- arch/x86/platform/efi/efi.c | 2 +- arch/x86/xen/setup.c | 6 ++--- drivers/acpi/tables.c | 2 +- 11 files changed, 44 insertions(+), 42 deletions(-) (limited to 'arch/x86/platform') diff --git a/arch/x86/include/asm/e820/api.h b/arch/x86/include/asm/e820/api.h index d4374ba26472..1c3615825115 100644 --- a/arch/x86/include/asm/e820/api.h +++ b/arch/x86/include/asm/e820/api.h @@ -10,11 +10,13 @@ extern unsigned long pci_mem_start; extern int e820__mapped_any(u64 start, u64 end, unsigned type); extern int e820__mapped_all(u64 start, u64 end, unsigned type); -extern void e820_add_region(u64 start, u64 size, int type); + +extern void e820__range_add (u64 start, u64 size, int type); +extern u64 e820__range_update(u64 start, u64 size, unsigned old_type, unsigned new_type); +extern u64 e820__range_remove(u64 start, u64 size, unsigned old_type, int checktype); + extern void e820_print_map(char *who); extern int e820__update_table(struct e820_entry *biosmap, int max_nr_map, u32 *pnr_map); -extern u64 e820_update_range(u64 start, u64 size, unsigned old_type, unsigned new_type); -extern u64 e820_remove_range(u64 start, u64 size, unsigned old_type, int checktype); extern void e820__update_table_print(void); extern void e820__setup_pci_gap(void); extern void e820__memory_setup_extended(u64 phys_addr, u32 data_len); diff --git a/arch/x86/kernel/acpi/boot.c b/arch/x86/kernel/acpi/boot.c index 8590f4891760..31b350c6a3b1 100644 --- a/arch/x86/kernel/acpi/boot.c +++ b/arch/x86/kernel/acpi/boot.c @@ -1715,6 +1715,6 @@ int __acpi_release_global_lock(unsigned int *lock) void __init arch_reserve_mem_area(acpi_physical_address addr, size_t size) { - e820_add_region(addr, size, E820_ACPI); + e820__range_add(addr, size, E820_ACPI); e820__update_table_print(); } diff --git a/arch/x86/kernel/aperture_64.c b/arch/x86/kernel/aperture_64.c index d027858a306e..883485684435 100644 --- a/arch/x86/kernel/aperture_64.c +++ b/arch/x86/kernel/aperture_64.c @@ -311,7 +311,7 @@ void __init early_gart_iommu_check(void) /* reserve it, so we can reuse it in second kernel */ pr_info("e820: reserve [mem %#010Lx-%#010Lx] for GART\n", aper_base, aper_base + aper_size - 1); - e820_add_region(aper_base, aper_size, E820_RESERVED); + e820__range_add(aper_base, aper_size, E820_RESERVED); e820__update_table_print(); } } diff --git a/arch/x86/kernel/cpu/mtrr/cleanup.c b/arch/x86/kernel/cpu/mtrr/cleanup.c index e201401a7ced..244aaa988ecd 100644 --- a/arch/x86/kernel/cpu/mtrr/cleanup.c +++ b/arch/x86/kernel/cpu/mtrr/cleanup.c @@ -860,7 +860,7 @@ real_trim_memory(unsigned long start_pfn, unsigned long limit_pfn) trim_size <<= PAGE_SHIFT; trim_size -= trim_start; - return e820_update_range(trim_start, trim_size, E820_RAM, E820_RESERVED); + return e820__range_update(trim_start, trim_size, E820_RAM, E820_RESERVED); } /** diff --git a/arch/x86/kernel/e820.c b/arch/x86/kernel/e820.c index cb25c7248656..f91901ab9263 100644 --- a/arch/x86/kernel/e820.c +++ b/arch/x86/kernel/e820.c @@ -125,7 +125,7 @@ int __init e820__mapped_all(u64 start, u64 end, unsigned type) /* * Add a memory region to the kernel E820 map. */ -static void __init __e820_add_region(struct e820_table *table, u64 start, u64 size, int type) +static void __init __e820__range_add(struct e820_table *table, u64 start, u64 size, int type) { int x = table->nr_entries; @@ -140,9 +140,9 @@ static void __init __e820_add_region(struct e820_table *table, u64 start, u64 si table->nr_entries++; } -void __init e820_add_region(u64 start, u64 size, int type) +void __init e820__range_add(u64 start, u64 size, int type) { - __e820_add_region(e820_table, start, size, type); + __e820__range_add(e820_table, start, size, type); } static void __init e820_print_type(u32 type) @@ -380,7 +380,7 @@ static int __init __append_e820_table(struct e820_entry *biosmap, int nr_map) if (start > end && likely(size)) return -1; - e820_add_region(start, size, type); + e820__range_add(start, size, type); biosmap++; nr_map--; @@ -407,7 +407,7 @@ static int __init append_e820_table(struct e820_entry *biosmap, int nr_map) } static u64 __init -__e820_update_range(struct e820_table *table, u64 start, u64 size, unsigned old_type, unsigned new_type) +__e820__range_update(struct e820_table *table, u64 start, u64 size, unsigned old_type, unsigned new_type) { u64 end; unsigned int i; @@ -444,8 +444,8 @@ __e820_update_range(struct e820_table *table, u64 start, u64 size, unsigned old_ /* New range is completely covered? */ if (entry->addr < start && entry_end > end) { - __e820_add_region(table, start, size, new_type); - __e820_add_region(table, end, entry_end - end, entry->type); + __e820__range_add(table, start, size, new_type); + __e820__range_add(table, end, entry_end - end, entry->type); entry->size = start - entry->addr; real_updated_size += size; continue; @@ -457,7 +457,7 @@ __e820_update_range(struct e820_table *table, u64 start, u64 size, unsigned old_ if (final_start >= final_end) continue; - __e820_add_region(table, final_start, final_end - final_start, new_type); + __e820__range_add(table, final_start, final_end - final_start, new_type); real_updated_size += final_end - final_start; @@ -474,18 +474,18 @@ __e820_update_range(struct e820_table *table, u64 start, u64 size, unsigned old_ return real_updated_size; } -u64 __init e820_update_range(u64 start, u64 size, unsigned old_type, unsigned new_type) +u64 __init e820__range_update(u64 start, u64 size, unsigned old_type, unsigned new_type) { - return __e820_update_range(e820_table, start, size, old_type, new_type); + return __e820__range_update(e820_table, start, size, old_type, new_type); } -static u64 __init e820_update_range_firmware(u64 start, u64 size, unsigned old_type, unsigned new_type) +static u64 __init e820__range_update_firmware(u64 start, u64 size, unsigned old_type, unsigned new_type) { - return __e820_update_range(e820_table_firmware, start, size, old_type, new_type); + return __e820__range_update(e820_table_firmware, start, size, old_type, new_type); } /* Remove a range of memory from the E820 table: */ -u64 __init e820_remove_range(u64 start, u64 size, unsigned old_type, int checktype) +u64 __init e820__range_remove(u64 start, u64 size, unsigned old_type, int checktype) { int i; u64 end; @@ -519,7 +519,7 @@ u64 __init e820_remove_range(u64 start, u64 size, unsigned old_type, int checkty /* Is the new range completely covered? */ if (entry->addr < start && entry_end > end) { - e820_add_region(end, entry_end - end, entry->type); + e820__range_add(end, entry_end - end, entry->type); entry->size = start - entry->addr; real_removed_size += size; continue; @@ -747,7 +747,7 @@ u64 __init e820__memblock_alloc_reserved(u64 size, u64 align) addr = __memblock_alloc_base(size, align, MEMBLOCK_ALLOC_ACCESSIBLE); if (addr) { - e820_update_range_firmware(addr, size, E820_RAM, E820_RESERVED); + e820__range_update_firmware(addr, size, E820_RAM, E820_RESERVED); pr_info("e820: update e820_table_firmware for e820__memblock_alloc_reserved()\n"); e820__update_table_firmware(); } @@ -846,7 +846,7 @@ static int __init parse_memopt(char *p) if (mem_size == 0) return -EINVAL; - e820_remove_range(mem_size, ULLONG_MAX - mem_size, E820_RAM, 1); + e820__range_remove(mem_size, ULLONG_MAX - mem_size, E820_RAM, 1); return 0; } @@ -882,18 +882,18 @@ static int __init parse_memmap_one(char *p) userdef = 1; if (*p == '@') { start_at = memparse(p+1, &p); - e820_add_region(start_at, mem_size, E820_RAM); + e820__range_add(start_at, mem_size, E820_RAM); } else if (*p == '#') { start_at = memparse(p+1, &p); - e820_add_region(start_at, mem_size, E820_ACPI); + e820__range_add(start_at, mem_size, E820_ACPI); } else if (*p == '$') { start_at = memparse(p+1, &p); - e820_add_region(start_at, mem_size, E820_RESERVED); + e820__range_add(start_at, mem_size, E820_RESERVED); } else if (*p == '!') { start_at = memparse(p+1, &p); - e820_add_region(start_at, mem_size, E820_PRAM); + e820__range_add(start_at, mem_size, E820_PRAM); } else { - e820_remove_range(mem_size, ULLONG_MAX - mem_size, E820_RAM, 1); + e820__range_remove(mem_size, ULLONG_MAX - mem_size, E820_RAM, 1); } return *p == '\0' ? 0 : -EINVAL; @@ -926,7 +926,7 @@ void __init e820_reserve_setup_data(void) while (pa_data) { data = early_memremap(pa_data, sizeof(*data)); - e820_update_range(pa_data, sizeof(*data)+data->len, E820_RAM, E820_RESERVED_KERN); + e820__range_update(pa_data, sizeof(*data)+data->len, E820_RAM, E820_RESERVED_KERN); pa_data = data->next; early_memunmap(data, sizeof(*data)); } @@ -1146,8 +1146,8 @@ char *__init e820__memory_setup_default(void) } e820_table->nr_entries = 0; - e820_add_region(0, LOWMEMSIZE(), E820_RAM); - e820_add_region(HIGH_MEMORY, mem_size << 10, E820_RAM); + e820__range_add(0, LOWMEMSIZE(), E820_RAM); + e820__range_add(HIGH_MEMORY, mem_size << 10, E820_RAM); } return who; diff --git a/arch/x86/kernel/early-quirks.c b/arch/x86/kernel/early-quirks.c index 66722f447401..81a10ab15be9 100644 --- a/arch/x86/kernel/early-quirks.c +++ b/arch/x86/kernel/early-quirks.c @@ -546,7 +546,7 @@ intel_graphics_stolen(int num, int slot, int func, &base, &end); /* Mark this space as reserved */ - e820_add_region(base, size, E820_RESERVED); + e820__range_add(base, size, E820_RESERVED); e820__update_table(e820_table->entries, ARRAY_SIZE(e820_table->entries), &e820_table->nr_entries); } diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c index 0fd7c0ef2716..2449df3c0044 100644 --- a/arch/x86/kernel/setup.c +++ b/arch/x86/kernel/setup.c @@ -731,14 +731,14 @@ static void __init trim_bios_range(void) * since some BIOSes are known to corrupt low memory. See the * Kconfig help text for X86_RESERVE_LOW. */ - e820_update_range(0, PAGE_SIZE, E820_RAM, E820_RESERVED); + e820__range_update(0, PAGE_SIZE, E820_RAM, E820_RESERVED); /* * special case: Some BIOSen report the PC BIOS * area (640->1Mb) as ram even though it is not. * take them out. */ - e820_remove_range(BIOS_BEGIN, BIOS_END - BIOS_BEGIN, E820_RAM, 1); + e820__range_remove(BIOS_BEGIN, BIOS_END - BIOS_BEGIN, E820_RAM, 1); e820__update_table(e820_table->entries, ARRAY_SIZE(e820_table->entries), &e820_table->nr_entries); } @@ -760,8 +760,8 @@ static void __init e820_add_kernel_range(void) return; pr_warn(".text .data .bss are not marked as E820_RAM!\n"); - e820_remove_range(start, size, E820_RAM, 0); - e820_add_region(start, size, E820_RAM); + e820__range_remove(start, size, E820_RAM, 0); + e820__range_add(start, size, E820_RAM); } static unsigned reserve_low = CONFIG_X86_RESERVE_LOW << 10; @@ -1031,7 +1031,7 @@ void __init setup_arch(char **cmdline_p) trim_bios_range(); #ifdef CONFIG_X86_32 if (ppro_with_ram_bug()) { - e820_update_range(0x70000000ULL, 0x40000ULL, E820_RAM, + e820__range_update(0x70000000ULL, 0x40000ULL, E820_RAM, E820_RESERVED); e820__update_table(e820_table->entries, ARRAY_SIZE(e820_table->entries), &e820_table->nr_entries); printk(KERN_INFO "fixed physical RAM map:\n"); diff --git a/arch/x86/lguest/boot.c b/arch/x86/lguest/boot.c index fc42e9604562..7aa633686295 100644 --- a/arch/x86/lguest/boot.c +++ b/arch/x86/lguest/boot.c @@ -1178,7 +1178,7 @@ static __init char *lguest_memory_setup(void) * The Linux bootloader header contains an "e820" memory map: the * Launcher populated the first entry with our memory limit. */ - e820_add_region(boot_params.e820_table[0].addr, + e820__range_add(boot_params.e820_table[0].addr, boot_params.e820_table[0].size, boot_params.e820_table[0].type); diff --git a/arch/x86/platform/efi/efi.c b/arch/x86/platform/efi/efi.c index 3a8f11ef6bfe..d97c05ee9664 100644 --- a/arch/x86/platform/efi/efi.c +++ b/arch/x86/platform/efi/efi.c @@ -165,7 +165,7 @@ static void __init do_add_efi_memmap(void) e820_type = E820_RESERVED; break; } - e820_add_region(start, size, e820_type); + e820__range_add(start, size, e820_type); } e820__update_table(e820_table->entries, ARRAY_SIZE(e820_table->entries), &e820_table->nr_entries); } diff --git a/arch/x86/xen/setup.c b/arch/x86/xen/setup.c index c2f8e4ab55bd..a634723e660f 100644 --- a/arch/x86/xen/setup.c +++ b/arch/x86/xen/setup.c @@ -596,7 +596,7 @@ static void __init xen_align_and_add_e820_region(phys_addr_t start, end &= ~((phys_addr_t)PAGE_SIZE - 1); } - e820_add_region(start, end - start, type); + e820__range_add(start, end - start, type); } static void __init xen_ignore_unusable(void) @@ -858,7 +858,7 @@ char * __init xen_memory_setup(void) * reserve ISA memory anyway because too many things poke * about in there. */ - e820_add_region(ISA_START_ADDRESS, ISA_END_ADDRESS - ISA_START_ADDRESS, + e820__range_add(ISA_START_ADDRESS, ISA_END_ADDRESS - ISA_START_ADDRESS, E820_RESERVED); e820__update_table(e820_table->entries, ARRAY_SIZE(e820_table->entries), &e820_table->nr_entries); @@ -936,7 +936,7 @@ char * __init xen_auto_xlated_memory_setup(void) &xen_e820_table_entries); for (i = 0; i < xen_e820_table_entries; i++) - e820_add_region(xen_e820_table[i].addr, xen_e820_table[i].size, + e820__range_add(xen_e820_table[i].addr, xen_e820_table[i].size, xen_e820_table[i].type); /* Remove p2m info, it is not needed. */ diff --git a/drivers/acpi/tables.c b/drivers/acpi/tables.c index 2604189d6cd1..9b9ac04593fb 100644 --- a/drivers/acpi/tables.c +++ b/drivers/acpi/tables.c @@ -556,7 +556,7 @@ void __init acpi_table_upgrade(void) * But it's not enough on X86 because ioremap will * complain later (used by acpi_os_map_memory) that the pages * that should get mapped are not marked "reserved". - * Both memblock_reserve and e820_add_region (via arch_reserve_mem_area) + * Both memblock_reserve and e820__range_add (via arch_reserve_mem_area) * works fine. */ memblock_reserve(acpi_tables_addr, all_tables_size); -- cgit v1.2.3 From 09821ff1d50a1ecade182c2a68a90f835e257eef Mon Sep 17 00:00:00 2001 From: Ingo Molnar Date: Sat, 28 Jan 2017 17:09:33 +0100 Subject: x86/boot/e820: Prefix the E820_* type names with "E820_TYPE_" So there's a number of constants that start with "E820" but which are not types - these create a confusing mixture when seen together with 'enum e820_type' values: E820MAP E820NR E820_X_MAX E820MAX To better differentiate the 'enum e820_type' values prefix them with E820_TYPE_. No change in functionality. Cc: Alex Thorlton Cc: Andy Lutomirski Cc: Borislav Petkov Cc: Brian Gerst Cc: Dan Williams Cc: Denys Vlasenko Cc: H. Peter Anvin Cc: Huang, Ying Cc: Josh Poimboeuf Cc: Juergen Gross Cc: Linus Torvalds Cc: Paul Jackson Cc: Peter Zijlstra Cc: Rafael J. Wysocki Cc: Tejun Heo Cc: Thomas Gleixner Cc: Wei Yang Cc: Yinghai Lu Cc: linux-kernel@vger.kernel.org Signed-off-by: Ingo Molnar --- arch/x86/boot/compressed/eboot.c | 12 ++-- arch/x86/boot/compressed/kaslr.c | 2 +- arch/x86/include/asm/gart.h | 2 +- arch/x86/include/uapi/asm/e820/types.h | 16 ++--- arch/x86/kernel/acpi/boot.c | 2 +- arch/x86/kernel/aperture_64.c | 4 +- arch/x86/kernel/cpu/mtrr/cleanup.c | 2 +- arch/x86/kernel/crash.c | 10 ++-- arch/x86/kernel/e820.c | 104 ++++++++++++++++----------------- arch/x86/kernel/early-quirks.c | 2 +- arch/x86/kernel/kexec-bzimage64.c | 2 +- arch/x86/kernel/setup.c | 20 +++---- arch/x86/kernel/tboot.c | 8 +-- arch/x86/mm/init.c | 2 +- arch/x86/mm/init_64.c | 12 ++-- arch/x86/pci/mmconfig-shared.c | 2 +- arch/x86/platform/efi/efi.c | 14 ++--- arch/x86/platform/efi/quirks.c | 6 +- arch/x86/xen/setup.c | 22 +++---- tools/lguest/lguest.c | 2 +- 20 files changed, 123 insertions(+), 123 deletions(-) (limited to 'arch/x86/platform') diff --git a/arch/x86/boot/compressed/eboot.c b/arch/x86/boot/compressed/eboot.c index 04c406f9aee3..4cfba2f79dfd 100644 --- a/arch/x86/boot/compressed/eboot.c +++ b/arch/x86/boot/compressed/eboot.c @@ -944,15 +944,15 @@ static efi_status_t setup_e820(struct boot_params *params, case EFI_MEMORY_MAPPED_IO: case EFI_MEMORY_MAPPED_IO_PORT_SPACE: case EFI_PAL_CODE: - e820_type = E820_RESERVED; + e820_type = E820_TYPE_RESERVED; break; case EFI_UNUSABLE_MEMORY: - e820_type = E820_UNUSABLE; + e820_type = E820_TYPE_UNUSABLE; break; case EFI_ACPI_RECLAIM_MEMORY: - e820_type = E820_ACPI; + e820_type = E820_TYPE_ACPI; break; case EFI_LOADER_CODE: @@ -960,15 +960,15 @@ static efi_status_t setup_e820(struct boot_params *params, case EFI_BOOT_SERVICES_CODE: case EFI_BOOT_SERVICES_DATA: case EFI_CONVENTIONAL_MEMORY: - e820_type = E820_RAM; + e820_type = E820_TYPE_RAM; break; case EFI_ACPI_MEMORY_NVS: - e820_type = E820_NVS; + e820_type = E820_TYPE_NVS; break; case EFI_PERSISTENT_MEMORY: - e820_type = E820_PMEM; + e820_type = E820_TYPE_PMEM; break; default: diff --git a/arch/x86/boot/compressed/kaslr.c b/arch/x86/boot/compressed/kaslr.c index a47f832664f2..e8155eab5474 100644 --- a/arch/x86/boot/compressed/kaslr.c +++ b/arch/x86/boot/compressed/kaslr.c @@ -435,7 +435,7 @@ static void process_e820_entry(struct e820_entry *entry, unsigned long start_orig; /* Skip non-RAM entries. */ - if (entry->type != E820_RAM) + if (entry->type != E820_TYPE_RAM) return; /* On 32-bit, ignore entries entirely above our maximum. */ diff --git a/arch/x86/include/asm/gart.h b/arch/x86/include/asm/gart.h index 2a3ff2ac4686..1d268098ac2e 100644 --- a/arch/x86/include/asm/gart.h +++ b/arch/x86/include/asm/gart.h @@ -97,7 +97,7 @@ static inline int aperture_valid(u64 aper_base, u32 aper_size, u32 min_size) printk(KERN_INFO "Aperture beyond 4GB. Ignoring.\n"); return 0; } - if (e820__mapped_any(aper_base, aper_base + aper_size, E820_RAM)) { + if (e820__mapped_any(aper_base, aper_base + aper_size, E820_TYPE_RAM)) { printk(KERN_INFO "Aperture pointing to e820 RAM. Ignoring.\n"); return 0; } diff --git a/arch/x86/include/uapi/asm/e820/types.h b/arch/x86/include/uapi/asm/e820/types.h index 65c7a1beab22..29391386b63f 100644 --- a/arch/x86/include/uapi/asm/e820/types.h +++ b/arch/x86/include/uapi/asm/e820/types.h @@ -7,12 +7,12 @@ #ifndef __ASSEMBLY__ enum e820_type { - E820_RAM = 1, - E820_RESERVED = 2, - E820_ACPI = 3, - E820_NVS = 4, - E820_UNUSABLE = 5, - E820_PMEM = 7, + E820_TYPE_RAM = 1, + E820_TYPE_RESERVED = 2, + E820_TYPE_ACPI = 3, + E820_TYPE_NVS = 4, + E820_TYPE_UNUSABLE = 5, + E820_TYPE_PMEM = 7, /* * This is a non-standardized way to represent ADR or @@ -25,7 +25,7 @@ enum e820_type { * type of memory, but newer versions switched to 12 as * 6 was assigned differently. Some time they will learn... ) */ - E820_PRAM = 12, + E820_TYPE_PRAM = 12, /* * Reserved RAM used by the kernel itself if @@ -34,7 +34,7 @@ enum e820_type { * and so should not include any memory that the BIOS * might alter over the S3 transition: */ - E820_RESERVED_KERN = 128, + E820_TYPE_RESERVED_KERN = 128, }; /* diff --git a/arch/x86/kernel/acpi/boot.c b/arch/x86/kernel/acpi/boot.c index 31b350c6a3b1..873552718270 100644 --- a/arch/x86/kernel/acpi/boot.c +++ b/arch/x86/kernel/acpi/boot.c @@ -1715,6 +1715,6 @@ int __acpi_release_global_lock(unsigned int *lock) void __init arch_reserve_mem_area(acpi_physical_address addr, size_t size) { - e820__range_add(addr, size, E820_ACPI); + e820__range_add(addr, size, E820_TYPE_ACPI); e820__update_table_print(); } diff --git a/arch/x86/kernel/aperture_64.c b/arch/x86/kernel/aperture_64.c index 883485684435..ef2859f9fcce 100644 --- a/arch/x86/kernel/aperture_64.c +++ b/arch/x86/kernel/aperture_64.c @@ -307,11 +307,11 @@ void __init early_gart_iommu_check(void) if (gart_fix_e820 && !fix && aper_enabled) { if (e820__mapped_any(aper_base, aper_base + aper_size, - E820_RAM)) { + E820_TYPE_RAM)) { /* reserve it, so we can reuse it in second kernel */ pr_info("e820: reserve [mem %#010Lx-%#010Lx] for GART\n", aper_base, aper_base + aper_size - 1); - e820__range_add(aper_base, aper_size, E820_RESERVED); + e820__range_add(aper_base, aper_size, E820_TYPE_RESERVED); e820__update_table_print(); } } diff --git a/arch/x86/kernel/cpu/mtrr/cleanup.c b/arch/x86/kernel/cpu/mtrr/cleanup.c index 244aaa988ecd..765afd599039 100644 --- a/arch/x86/kernel/cpu/mtrr/cleanup.c +++ b/arch/x86/kernel/cpu/mtrr/cleanup.c @@ -860,7 +860,7 @@ real_trim_memory(unsigned long start_pfn, unsigned long limit_pfn) trim_size <<= PAGE_SHIFT; trim_size -= trim_start; - return e820__range_update(trim_start, trim_size, E820_RAM, E820_RESERVED); + return e820__range_update(trim_start, trim_size, E820_TYPE_RAM, E820_TYPE_RESERVED); } /** diff --git a/arch/x86/kernel/crash.c b/arch/x86/kernel/crash.c index 11f7eb1e2506..5feba9a21130 100644 --- a/arch/x86/kernel/crash.c +++ b/arch/x86/kernel/crash.c @@ -575,17 +575,17 @@ int crash_setup_memmap_entries(struct kimage *image, struct boot_params *params) /* Add first 640K segment */ ei.addr = image->arch.backup_src_start; ei.size = image->arch.backup_src_sz; - ei.type = E820_RAM; + ei.type = E820_TYPE_RAM; add_e820_entry(params, &ei); /* Add ACPI tables */ - cmd.type = E820_ACPI; + cmd.type = E820_TYPE_ACPI; flags = IORESOURCE_MEM | IORESOURCE_BUSY; walk_iomem_res_desc(IORES_DESC_ACPI_TABLES, flags, 0, -1, &cmd, memmap_entry_callback); /* Add ACPI Non-volatile Storage */ - cmd.type = E820_NVS; + cmd.type = E820_TYPE_NVS; walk_iomem_res_desc(IORES_DESC_ACPI_NV_STORAGE, flags, 0, -1, &cmd, memmap_entry_callback); @@ -593,7 +593,7 @@ int crash_setup_memmap_entries(struct kimage *image, struct boot_params *params) if (crashk_low_res.end) { ei.addr = crashk_low_res.start; ei.size = crashk_low_res.end - crashk_low_res.start + 1; - ei.type = E820_RAM; + ei.type = E820_TYPE_RAM; add_e820_entry(params, &ei); } @@ -610,7 +610,7 @@ int crash_setup_memmap_entries(struct kimage *image, struct boot_params *params) if (ei.size < PAGE_SIZE) continue; ei.addr = cmem->ranges[i].start; - ei.type = E820_RAM; + ei.type = E820_TYPE_RAM; add_e820_entry(params, &ei); } diff --git a/arch/x86/kernel/e820.c b/arch/x86/kernel/e820.c index 79673843dc42..90dcd240a389 100644 --- a/arch/x86/kernel/e820.c +++ b/arch/x86/kernel/e820.c @@ -148,14 +148,14 @@ void __init e820__range_add(u64 start, u64 size, enum e820_type type) static void __init e820_print_type(enum e820_type type) { switch (type) { - case E820_RAM: /* Fall through: */ - case E820_RESERVED_KERN: pr_cont("usable"); break; - case E820_RESERVED: pr_cont("reserved"); break; - case E820_ACPI: pr_cont("ACPI data"); break; - case E820_NVS: pr_cont("ACPI NVS"); break; - case E820_UNUSABLE: pr_cont("unusable"); break; - case E820_PMEM: /* Fall through: */ - case E820_PRAM: pr_cont("persistent (type %u)", type); break; + case E820_TYPE_RAM: /* Fall through: */ + case E820_TYPE_RESERVED_KERN: pr_cont("usable"); break; + case E820_TYPE_RESERVED: pr_cont("reserved"); break; + case E820_TYPE_ACPI: pr_cont("ACPI data"); break; + case E820_TYPE_NVS: pr_cont("ACPI NVS"); break; + case E820_TYPE_UNUSABLE: pr_cont("unusable"); break; + case E820_TYPE_PMEM: /* Fall through: */ + case E820_TYPE_PRAM: pr_cont("persistent (type %u)", type); break; default: pr_cont("type %u", type); break; } } @@ -340,7 +340,7 @@ int __init e820__update_table(struct e820_entry *biosmap, int max_nr_map, u32 *p } /* Continue building up new BIOS map based on this information: */ - if (current_type != last_type || current_type == E820_PRAM) { + if (current_type != last_type || current_type == E820_TYPE_PRAM) { if (last_type != 0) { new_bios[new_bios_entry].size = change_point[chgidx]->addr - last_addr; /* Move forward only if the new size was non-zero: */ @@ -704,7 +704,7 @@ void __init e820_mark_nosave_regions(unsigned long limit_pfn) pfn = PFN_DOWN(entry->addr + entry->size); - if (entry->type != E820_RAM && entry->type != E820_RESERVED_KERN) + if (entry->type != E820_TYPE_RAM && entry->type != E820_TYPE_RESERVED_KERN) register_nosave_region(PFN_UP(entry->addr), pfn); if (pfn >= limit_pfn) @@ -724,7 +724,7 @@ static int __init e820_mark_nvs_memory(void) for (i = 0; i < e820_table->nr_entries; i++) { struct e820_entry *entry = &e820_table->entries[i]; - if (entry->type == E820_NVS) + if (entry->type == E820_TYPE_NVS) acpi_nvs_register(entry->addr, entry->size); } @@ -747,7 +747,7 @@ u64 __init e820__memblock_alloc_reserved(u64 size, u64 align) addr = __memblock_alloc_base(size, align, MEMBLOCK_ALLOC_ACCESSIBLE); if (addr) { - e820__range_update_firmware(addr, size, E820_RAM, E820_RESERVED); + e820__range_update_firmware(addr, size, E820_TYPE_RAM, E820_TYPE_RESERVED); pr_info("e820: update e820_table_firmware for e820__memblock_alloc_reserved()\n"); e820__update_table_firmware(); } @@ -805,12 +805,12 @@ static unsigned long __init e820_end_pfn(unsigned long limit_pfn, enum e820_type unsigned long __init e820_end_of_ram_pfn(void) { - return e820_end_pfn(MAX_ARCH_PFN, E820_RAM); + return e820_end_pfn(MAX_ARCH_PFN, E820_TYPE_RAM); } unsigned long __init e820_end_of_low_ram_pfn(void) { - return e820_end_pfn(1UL << (32 - PAGE_SHIFT), E820_RAM); + return e820_end_pfn(1UL << (32 - PAGE_SHIFT), E820_TYPE_RAM); } static void __init early_panic(char *msg) @@ -846,7 +846,7 @@ static int __init parse_memopt(char *p) if (mem_size == 0) return -EINVAL; - e820__range_remove(mem_size, ULLONG_MAX - mem_size, E820_RAM, 1); + e820__range_remove(mem_size, ULLONG_MAX - mem_size, E820_TYPE_RAM, 1); return 0; } @@ -882,18 +882,18 @@ static int __init parse_memmap_one(char *p) userdef = 1; if (*p == '@') { start_at = memparse(p+1, &p); - e820__range_add(start_at, mem_size, E820_RAM); + e820__range_add(start_at, mem_size, E820_TYPE_RAM); } else if (*p == '#') { start_at = memparse(p+1, &p); - e820__range_add(start_at, mem_size, E820_ACPI); + e820__range_add(start_at, mem_size, E820_TYPE_ACPI); } else if (*p == '$') { start_at = memparse(p+1, &p); - e820__range_add(start_at, mem_size, E820_RESERVED); + e820__range_add(start_at, mem_size, E820_TYPE_RESERVED); } else if (*p == '!') { start_at = memparse(p+1, &p); - e820__range_add(start_at, mem_size, E820_PRAM); + e820__range_add(start_at, mem_size, E820_TYPE_PRAM); } else { - e820__range_remove(mem_size, ULLONG_MAX - mem_size, E820_RAM, 1); + e820__range_remove(mem_size, ULLONG_MAX - mem_size, E820_TYPE_RAM, 1); } return *p == '\0' ? 0 : -EINVAL; @@ -926,7 +926,7 @@ void __init e820_reserve_setup_data(void) while (pa_data) { data = early_memremap(pa_data, sizeof(*data)); - e820__range_update(pa_data, sizeof(*data)+data->len, E820_RAM, E820_RESERVED_KERN); + e820__range_update(pa_data, sizeof(*data)+data->len, E820_TYPE_RAM, E820_TYPE_RESERVED_KERN); pa_data = data->next; early_memunmap(data, sizeof(*data)); } @@ -956,42 +956,42 @@ void __init e820__finish_early_params(void) static const char *__init e820_type_to_string(struct e820_entry *entry) { switch (entry->type) { - case E820_RESERVED_KERN: /* Fall-through: */ - case E820_RAM: return "System RAM"; - case E820_ACPI: return "ACPI Tables"; - case E820_NVS: return "ACPI Non-volatile Storage"; - case E820_UNUSABLE: return "Unusable memory"; - case E820_PRAM: return "Persistent Memory (legacy)"; - case E820_PMEM: return "Persistent Memory"; - default: return "Reserved"; + case E820_TYPE_RESERVED_KERN: /* Fall-through: */ + case E820_TYPE_RAM: return "System RAM"; + case E820_TYPE_ACPI: return "ACPI Tables"; + case E820_TYPE_NVS: return "ACPI Non-volatile Storage"; + case E820_TYPE_UNUSABLE: return "Unusable memory"; + case E820_TYPE_PRAM: return "Persistent Memory (legacy)"; + case E820_TYPE_PMEM: return "Persistent Memory"; + default: return "Reserved"; } } static unsigned long __init e820_type_to_iomem_type(struct e820_entry *entry) { switch (entry->type) { - case E820_RESERVED_KERN: /* Fall-through: */ - case E820_RAM: return IORESOURCE_SYSTEM_RAM; - case E820_ACPI: /* Fall-through: */ - case E820_NVS: /* Fall-through: */ - case E820_UNUSABLE: /* Fall-through: */ - case E820_PRAM: /* Fall-through: */ - case E820_PMEM: /* Fall-through: */ - default: return IORESOURCE_MEM; + case E820_TYPE_RESERVED_KERN: /* Fall-through: */ + case E820_TYPE_RAM: return IORESOURCE_SYSTEM_RAM; + case E820_TYPE_ACPI: /* Fall-through: */ + case E820_TYPE_NVS: /* Fall-through: */ + case E820_TYPE_UNUSABLE: /* Fall-through: */ + case E820_TYPE_PRAM: /* Fall-through: */ + case E820_TYPE_PMEM: /* Fall-through: */ + default: return IORESOURCE_MEM; } } static unsigned long __init e820_type_to_iores_desc(struct e820_entry *entry) { switch (entry->type) { - case E820_ACPI: return IORES_DESC_ACPI_TABLES; - case E820_NVS: return IORES_DESC_ACPI_NV_STORAGE; - case E820_PMEM: return IORES_DESC_PERSISTENT_MEMORY; - case E820_PRAM: return IORES_DESC_PERSISTENT_MEMORY_LEGACY; - case E820_RESERVED_KERN: /* Fall-through: */ - case E820_RAM: /* Fall-through: */ - case E820_UNUSABLE: /* Fall-through: */ - default: return IORES_DESC_NONE; + case E820_TYPE_ACPI: return IORES_DESC_ACPI_TABLES; + case E820_TYPE_NVS: return IORES_DESC_ACPI_NV_STORAGE; + case E820_TYPE_PMEM: return IORES_DESC_PERSISTENT_MEMORY; + case E820_TYPE_PRAM: return IORES_DESC_PERSISTENT_MEMORY_LEGACY; + case E820_TYPE_RESERVED_KERN: /* Fall-through: */ + case E820_TYPE_RAM: /* Fall-through: */ + case E820_TYPE_UNUSABLE: /* Fall-through: */ + default: return IORES_DESC_NONE; } } @@ -1006,9 +1006,9 @@ static bool __init do_mark_busy(u32 type, struct resource *res) * for exclusive use of a driver */ switch (type) { - case E820_RESERVED: - case E820_PRAM: - case E820_PMEM: + case E820_TYPE_RESERVED: + case E820_TYPE_PRAM: + case E820_TYPE_PMEM: return false; default: return true; @@ -1102,7 +1102,7 @@ void __init e820_reserve_resources_late(void) struct e820_entry *entry = &e820_table->entries[i]; u64 start, end; - if (entry->type != E820_RAM) + if (entry->type != E820_TYPE_RAM) continue; start = entry->addr + entry->size; @@ -1148,8 +1148,8 @@ char *__init e820__memory_setup_default(void) } e820_table->nr_entries = 0; - e820__range_add(0, LOWMEMSIZE(), E820_RAM); - e820__range_add(HIGH_MEMORY, mem_size << 10, E820_RAM); + e820__range_add(0, LOWMEMSIZE(), E820_TYPE_RAM); + e820__range_add(HIGH_MEMORY, mem_size << 10, E820_TYPE_RAM); } return who; @@ -1198,7 +1198,7 @@ void __init e820__memblock_setup(void) if (end != (resource_size_t)end) continue; - if (entry->type != E820_RAM && entry->type != E820_RESERVED_KERN) + if (entry->type != E820_TYPE_RAM && entry->type != E820_TYPE_RESERVED_KERN) continue; memblock_add(entry->addr, entry->size); diff --git a/arch/x86/kernel/early-quirks.c b/arch/x86/kernel/early-quirks.c index 81a10ab15be9..2220a4c03adf 100644 --- a/arch/x86/kernel/early-quirks.c +++ b/arch/x86/kernel/early-quirks.c @@ -546,7 +546,7 @@ intel_graphics_stolen(int num, int slot, int func, &base, &end); /* Mark this space as reserved */ - e820__range_add(base, size, E820_RESERVED); + e820__range_add(base, size, E820_TYPE_RESERVED); e820__update_table(e820_table->entries, ARRAY_SIZE(e820_table->entries), &e820_table->nr_entries); } diff --git a/arch/x86/kernel/kexec-bzimage64.c b/arch/x86/kernel/kexec-bzimage64.c index a8c9563557c9..3e43a7d3b191 100644 --- a/arch/x86/kernel/kexec-bzimage64.c +++ b/arch/x86/kernel/kexec-bzimage64.c @@ -232,7 +232,7 @@ setup_boot_parameters(struct kimage *image, struct boot_params *params, nr_e820_entries = params->e820_entries; for (i = 0; i < nr_e820_entries; i++) { - if (params->e820_table[i].type != E820_RAM) + if (params->e820_table[i].type != E820_TYPE_RAM) continue; start = params->e820_table[i].addr; end = params->e820_table[i].addr + params->e820_table[i].size - 1; diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c index 0e70a7bbeeef..074c86a0ee86 100644 --- a/arch/x86/kernel/setup.c +++ b/arch/x86/kernel/setup.c @@ -119,7 +119,7 @@ * max_low_pfn_mapped: highest direct mapped pfn under 4GB * max_pfn_mapped: highest direct mapped pfn over 4GB * - * The direct mapping only covers E820_RAM regions, so the ranges and gaps are + * The direct mapping only covers E820_TYPE_RAM regions, so the ranges and gaps are * represented by pfn_mapped */ unsigned long max_low_pfn_mapped; @@ -731,14 +731,14 @@ static void __init trim_bios_range(void) * since some BIOSes are known to corrupt low memory. See the * Kconfig help text for X86_RESERVE_LOW. */ - e820__range_update(0, PAGE_SIZE, E820_RAM, E820_RESERVED); + e820__range_update(0, PAGE_SIZE, E820_TYPE_RAM, E820_TYPE_RESERVED); /* * special case: Some BIOSen report the PC BIOS * area (640->1Mb) as ram even though it is not. * take them out. */ - e820__range_remove(BIOS_BEGIN, BIOS_END - BIOS_BEGIN, E820_RAM, 1); + e820__range_remove(BIOS_BEGIN, BIOS_END - BIOS_BEGIN, E820_TYPE_RAM, 1); e820__update_table(e820_table->entries, ARRAY_SIZE(e820_table->entries), &e820_table->nr_entries); } @@ -750,18 +750,18 @@ static void __init e820_add_kernel_range(void) u64 size = __pa_symbol(_end) - start; /* - * Complain if .text .data and .bss are not marked as E820_RAM and + * Complain if .text .data and .bss are not marked as E820_TYPE_RAM and * attempt to fix it by adding the range. We may have a confused BIOS, * or the user may have used memmap=exactmap or memmap=xxM$yyM to * exclude kernel range. If we really are running on top non-RAM, * we will crash later anyways. */ - if (e820__mapped_all(start, start + size, E820_RAM)) + if (e820__mapped_all(start, start + size, E820_TYPE_RAM)) return; - pr_warn(".text .data .bss are not marked as E820_RAM!\n"); - e820__range_remove(start, size, E820_RAM, 0); - e820__range_add(start, size, E820_RAM); + pr_warn(".text .data .bss are not marked as E820_TYPE_RAM!\n"); + e820__range_remove(start, size, E820_TYPE_RAM, 0); + e820__range_add(start, size, E820_TYPE_RAM); } static unsigned reserve_low = CONFIG_X86_RESERVE_LOW << 10; @@ -1031,8 +1031,8 @@ void __init setup_arch(char **cmdline_p) trim_bios_range(); #ifdef CONFIG_X86_32 if (ppro_with_ram_bug()) { - e820__range_update(0x70000000ULL, 0x40000ULL, E820_RAM, - E820_RESERVED); + e820__range_update(0x70000000ULL, 0x40000ULL, E820_TYPE_RAM, + E820_TYPE_RESERVED); e820__update_table(e820_table->entries, ARRAY_SIZE(e820_table->entries), &e820_table->nr_entries); printk(KERN_INFO "fixed physical RAM map:\n"); e820__print_table("bad_ppro"); diff --git a/arch/x86/kernel/tboot.c b/arch/x86/kernel/tboot.c index 0e2dc3831970..ccccd335ae01 100644 --- a/arch/x86/kernel/tboot.c +++ b/arch/x86/kernel/tboot.c @@ -69,8 +69,8 @@ void __init tboot_probe(void) * set_fixmap(), to reduce chance of garbage value causing crash */ if (!e820__mapped_any(boot_params.tboot_addr, - boot_params.tboot_addr, E820_RESERVED)) { - pr_warning("non-0 tboot_addr but it is not of type E820_RESERVED\n"); + boot_params.tboot_addr, E820_TYPE_RESERVED)) { + pr_warning("non-0 tboot_addr but it is not of type E820_TYPE_RESERVED\n"); return; } @@ -189,8 +189,8 @@ static int tboot_setup_sleep(void) tboot->num_mac_regions = 0; for (i = 0; i < e820_table->nr_entries; i++) { - if ((e820_table->entries[i].type != E820_RAM) - && (e820_table->entries[i].type != E820_RESERVED_KERN)) + if ((e820_table->entries[i].type != E820_TYPE_RAM) + && (e820_table->entries[i].type != E820_TYPE_RESERVED_KERN)) continue; add_mac_region(e820_table->entries[i].addr, e820_table->entries[i].size); diff --git a/arch/x86/mm/init.c b/arch/x86/mm/init.c index 922671d3af85..158dfecdab72 100644 --- a/arch/x86/mm/init.c +++ b/arch/x86/mm/init.c @@ -430,7 +430,7 @@ unsigned long __ref init_memory_mapping(unsigned long start, /* * We need to iterate through the E820 memory map and create direct mappings - * for only E820_RAM and E820_KERN_RESERVED regions. We cannot simply + * for only E820_TYPE_RAM and E820_KERN_RESERVED regions. We cannot simply * create direct mappings for all pfns from [0 to max_low_pfn) and * [4GB to max_pfn) because of possible memory holes in high addresses * that cannot be marked as UC by fixed/variable range MTRRs. diff --git a/arch/x86/mm/init_64.c b/arch/x86/mm/init_64.c index cfb119e4c4d1..94e033085f60 100644 --- a/arch/x86/mm/init_64.c +++ b/arch/x86/mm/init_64.c @@ -338,9 +338,9 @@ phys_pte_init(pte_t *pte_page, unsigned long paddr, unsigned long paddr_end, if (paddr >= paddr_end) { if (!after_bootmem && !e820__mapped_any(paddr & PAGE_MASK, paddr_next, - E820_RAM) && + E820_TYPE_RAM) && !e820__mapped_any(paddr & PAGE_MASK, paddr_next, - E820_RESERVED_KERN)) + E820_TYPE_RESERVED_KERN)) set_pte(pte, __pte(0)); continue; } @@ -393,9 +393,9 @@ phys_pmd_init(pmd_t *pmd_page, unsigned long paddr, unsigned long paddr_end, if (paddr >= paddr_end) { if (!after_bootmem && !e820__mapped_any(paddr & PMD_MASK, paddr_next, - E820_RAM) && + E820_TYPE_RAM) && !e820__mapped_any(paddr & PMD_MASK, paddr_next, - E820_RESERVED_KERN)) + E820_TYPE_RESERVED_KERN)) set_pmd(pmd, __pmd(0)); continue; } @@ -479,9 +479,9 @@ phys_pud_init(pud_t *pud_page, unsigned long paddr, unsigned long paddr_end, if (paddr >= paddr_end) { if (!after_bootmem && !e820__mapped_any(paddr & PUD_MASK, paddr_next, - E820_RAM) && + E820_TYPE_RAM) && !e820__mapped_any(paddr & PUD_MASK, paddr_next, - E820_RESERVED_KERN)) + E820_TYPE_RESERVED_KERN)) set_pud(pud, __pud(0)); continue; } diff --git a/arch/x86/pci/mmconfig-shared.c b/arch/x86/pci/mmconfig-shared.c index 696b050bdc45..96057e4b6121 100644 --- a/arch/x86/pci/mmconfig-shared.c +++ b/arch/x86/pci/mmconfig-shared.c @@ -452,7 +452,7 @@ static int __ref is_mmconf_reserved(check_reserved_t is_reserved, int num_buses; char *method = with_e820 ? "E820" : "ACPI motherboard resources"; - while (!is_reserved(addr, addr + size, E820_RESERVED)) { + while (!is_reserved(addr, addr + size, E820_TYPE_RESERVED)) { size >>= 1; if (size < (16UL<<20)) break; diff --git a/arch/x86/platform/efi/efi.c b/arch/x86/platform/efi/efi.c index d97c05ee9664..14d0a6b1eee1 100644 --- a/arch/x86/platform/efi/efi.c +++ b/arch/x86/platform/efi/efi.c @@ -140,21 +140,21 @@ static void __init do_add_efi_memmap(void) case EFI_BOOT_SERVICES_DATA: case EFI_CONVENTIONAL_MEMORY: if (md->attribute & EFI_MEMORY_WB) - e820_type = E820_RAM; + e820_type = E820_TYPE_RAM; else - e820_type = E820_RESERVED; + e820_type = E820_TYPE_RESERVED; break; case EFI_ACPI_RECLAIM_MEMORY: - e820_type = E820_ACPI; + e820_type = E820_TYPE_ACPI; break; case EFI_ACPI_MEMORY_NVS: - e820_type = E820_NVS; + e820_type = E820_TYPE_NVS; break; case EFI_UNUSABLE_MEMORY: - e820_type = E820_UNUSABLE; + e820_type = E820_TYPE_UNUSABLE; break; case EFI_PERSISTENT_MEMORY: - e820_type = E820_PMEM; + e820_type = E820_TYPE_PMEM; break; default: /* @@ -162,7 +162,7 @@ static void __init do_add_efi_memmap(void) * EFI_RUNTIME_SERVICES_DATA EFI_MEMORY_MAPPED_IO * EFI_MEMORY_MAPPED_IO_PORT_SPACE EFI_PAL_CODE */ - e820_type = E820_RESERVED; + e820_type = E820_TYPE_RESERVED; break; } e820__range_add(start, size, e820_type); diff --git a/arch/x86/platform/efi/quirks.c b/arch/x86/platform/efi/quirks.c index d4acd1668d36..3c8d8e511fd4 100644 --- a/arch/x86/platform/efi/quirks.c +++ b/arch/x86/platform/efi/quirks.c @@ -242,14 +242,14 @@ void __init efi_arch_mem_reserve(phys_addr_t addr, u64 size) * else. We must only reserve (and then free) regions: * * - Not within any part of the kernel - * - Not the BIOS reserved area (E820_RESERVED, E820_NVS, etc) + * - Not the BIOS reserved area (E820_TYPE_RESERVED, E820_TYPE_NVS, etc) */ static bool can_free_region(u64 start, u64 size) { if (start + size > __pa_symbol(_text) && start <= __pa_symbol(_end)) return false; - if (!e820__mapped_all(start, start+size, E820_RAM)) + if (!e820__mapped_all(start, start+size, E820_TYPE_RAM)) return false; return true; @@ -282,7 +282,7 @@ void __init efi_reserve_boot_services(void) * A good example of a critical region that must not be * freed is page zero (first 4Kb of memory), which may * contain boot services code/data but is marked - * E820_RESERVED by trim_bios_range(). + * E820_TYPE_RESERVED by trim_bios_range(). */ if (!already_reserved) { memblock_reserve(start, size); diff --git a/arch/x86/xen/setup.c b/arch/x86/xen/setup.c index a634723e660f..625ceafeb7a0 100644 --- a/arch/x86/xen/setup.c +++ b/arch/x86/xen/setup.c @@ -206,7 +206,7 @@ static unsigned long __init xen_find_pfn_range(unsigned long *min_pfn) unsigned long s_pfn; unsigned long e_pfn; - if (entry->type != E820_RAM) + if (entry->type != E820_TYPE_RAM) continue; e_pfn = PFN_DOWN(entry->addr + entry->size); @@ -473,11 +473,11 @@ static unsigned long __init xen_foreach_remap_area(unsigned long nr_pages, */ for (i = 0; i < xen_e820_table_entries; i++, entry++) { phys_addr_t end = entry->addr + entry->size; - if (entry->type == E820_RAM || i == xen_e820_table_entries - 1) { + if (entry->type == E820_TYPE_RAM || i == xen_e820_table_entries - 1) { unsigned long start_pfn = PFN_DOWN(start); unsigned long end_pfn = PFN_UP(end); - if (entry->type == E820_RAM) + if (entry->type == E820_TYPE_RAM) end_pfn = PFN_UP(entry->addr); if (start_pfn < end_pfn) @@ -591,7 +591,7 @@ static void __init xen_align_and_add_e820_region(phys_addr_t start, phys_addr_t end = start + size; /* Align RAM regions to page boundaries. */ - if (type == E820_RAM) { + if (type == E820_TYPE_RAM) { start = PAGE_ALIGN(start); end &= ~((phys_addr_t)PAGE_SIZE - 1); } @@ -605,8 +605,8 @@ static void __init xen_ignore_unusable(void) unsigned int i; for (i = 0; i < xen_e820_table_entries; i++, entry++) { - if (entry->type == E820_UNUSABLE) - entry->type = E820_RAM; + if (entry->type == E820_TYPE_UNUSABLE) + entry->type = E820_TYPE_RAM; } } @@ -623,7 +623,7 @@ bool __init xen_is_e820_reserved(phys_addr_t start, phys_addr_t size) entry = xen_e820_table; for (mapcnt = 0; mapcnt < xen_e820_table_entries; mapcnt++) { - if (entry->type == E820_RAM && entry->addr <= start && + if (entry->type == E820_TYPE_RAM && entry->addr <= start && (entry->addr + entry->size) >= end) return false; @@ -648,7 +648,7 @@ phys_addr_t __init xen_find_free_area(phys_addr_t size) struct e820_entry *entry = xen_e820_table; for (mapcnt = 0; mapcnt < xen_e820_table_entries; mapcnt++, entry++) { - if (entry->type != E820_RAM || entry->size < size) + if (entry->type != E820_TYPE_RAM || entry->size < size) continue; start = entry->addr; for (addr = start; addr < start + size; addr += PAGE_SIZE) { @@ -764,7 +764,7 @@ char * __init xen_memory_setup(void) xen_e820_table[0].size = mem_end; /* 8MB slack (to balance backend allocations). */ xen_e820_table[0].size += 8ULL << 20; - xen_e820_table[0].type = E820_RAM; + xen_e820_table[0].type = E820_TYPE_RAM; rc = 0; } BUG_ON(rc); @@ -819,7 +819,7 @@ char * __init xen_memory_setup(void) chunk_size = size; type = xen_e820_table[i].type; - if (type == E820_RAM) { + if (type == E820_TYPE_RAM) { if (addr < mem_end) { chunk_size = min(size, mem_end - addr); } else if (extra_pages) { @@ -859,7 +859,7 @@ char * __init xen_memory_setup(void) * about in there. */ e820__range_add(ISA_START_ADDRESS, ISA_END_ADDRESS - ISA_START_ADDRESS, - E820_RESERVED); + E820_TYPE_RESERVED); e820__update_table(e820_table->entries, ARRAY_SIZE(e820_table->entries), &e820_table->nr_entries); diff --git a/tools/lguest/lguest.c b/tools/lguest/lguest.c index 3819e23a173e..4e38ea02ef0f 100644 --- a/tools/lguest/lguest.c +++ b/tools/lguest/lguest.c @@ -3339,7 +3339,7 @@ int main(int argc, char *argv[]) * simple, single region. */ boot->e820_entries = 1; - boot->e820_table[0] = ((struct e820_entry) { 0, mem, E820_RAM }); + boot->e820_table[0] = ((struct e820_entry) { 0, mem, E820_TYPE_RAM }); /* * The boot header contains a command line pointer: we put the command * line after the boot header. -- cgit v1.2.3 From f9748fa045851041ba69a1d2899971746f29c9d5 Mon Sep 17 00:00:00 2001 From: Ingo Molnar Date: Sat, 28 Jan 2017 18:00:35 +0100 Subject: x86/boot/e820: Simplify the e820__update_table() interface The e820__update_table() parameters are pretty complex: arch/x86/include/asm/e820/api.h:extern int e820__update_table(struct e820_entry *biosmap, int max_nr_map, u32 *pnr_map); But 90% of the usage is trivial: arch/x86/kernel/e820.c: if (e820__update_table(e820_table->entries, ARRAY_SIZE(e820_table->entries), &e820_table->nr_entries)) arch/x86/kernel/e820.c: e820__update_table(e820_table->entries, ARRAY_SIZE(e820_table->entries), &e820_table->nr_entries); arch/x86/kernel/e820.c: e820__update_table(e820_table->entries, ARRAY_SIZE(e820_table->entries), &e820_table->nr_entries); arch/x86/kernel/e820.c: if (e820__update_table(e820_table->entries, ARRAY_SIZE(e820_table->entries), &e820_table->nr_entries) < 0) arch/x86/kernel/e820.c: e820__update_table(boot_params.e820_table, ARRAY_SIZE(boot_params.e820_table), &new_nr); arch/x86/kernel/early-quirks.c: e820__update_table(e820_table->entries, ARRAY_SIZE(e820_table->entries), &e820_table->nr_entries); arch/x86/kernel/setup.c: e820__update_table(e820_table->entries, ARRAY_SIZE(e820_table->entries), &e820_table->nr_entries); arch/x86/kernel/setup.c: e820__update_table(e820_table->entries, ARRAY_SIZE(e820_table->entries), &e820_table->nr_entries); arch/x86/platform/efi/efi.c: e820__update_table(e820_table->entries, ARRAY_SIZE(e820_table->entries), &e820_table->nr_entries); arch/x86/xen/setup.c: e820__update_table(xen_e820_table.entries, ARRAY_SIZE(xen_e820_table.entries), arch/x86/xen/setup.c: e820__update_table(e820_table->entries, ARRAY_SIZE(e820_table->entries), &e820_table->nr_entries); arch/x86/xen/setup.c: e820__update_table(xen_e820_table.entries, ARRAY_SIZE(xen_e820_table.entries), as it only uses an exiting struct e820_table's entries array, its size and its current number of entries as input and output arguments. Only one use is non-trivial: arch/x86/kernel/e820.c: e820__update_table(boot_params.e820_table, ARRAY_SIZE(boot_params.e820_table), &new_nr); ... which call updates the E820 table in the zeropage in-situ, and the layout there does not match that of 'struct e820_table' (in particular nr_entries is at a different offset, hardcoded by the boot protocol). Simplify all this by introducing a low level __e820__update_table() API that the zeropage update call can use, and simplifying the main e820__update_table() call signature down to: int e820__update_table(struct e820_table *table); This visibly simplifies all the call sites: arch/x86/include/asm/e820/api.h:extern int e820__update_table(struct e820_table *table); arch/x86/include/asm/e820/types.h: * call to e820__update_table() to remove duplicates. The allowance arch/x86/kernel/e820.c: * The return value from e820__update_table() is zero if it arch/x86/kernel/e820.c:int __init e820__update_table(struct e820_table *table) arch/x86/kernel/e820.c: if (e820__update_table(e820_table)) arch/x86/kernel/e820.c: e820__update_table(e820_table_firmware); arch/x86/kernel/e820.c: e820__update_table(e820_table); arch/x86/kernel/e820.c: e820__update_table(e820_table); arch/x86/kernel/e820.c: if (e820__update_table(e820_table) < 0) arch/x86/kernel/early-quirks.c: e820__update_table(e820_table); arch/x86/kernel/setup.c: e820__update_table(e820_table); arch/x86/kernel/setup.c: e820__update_table(e820_table); arch/x86/platform/efi/efi.c: e820__update_table(e820_table); arch/x86/xen/setup.c: e820__update_table(&xen_e820_table); arch/x86/xen/setup.c: e820__update_table(e820_table); arch/x86/xen/setup.c: e820__update_table(&xen_e820_table); No change in functionality. Cc: Alex Thorlton Cc: Andy Lutomirski Cc: Borislav Petkov Cc: Brian Gerst Cc: Dan Williams Cc: Denys Vlasenko Cc: H. Peter Anvin Cc: Huang, Ying Cc: Josh Poimboeuf Cc: Juergen Gross Cc: Linus Torvalds Cc: Paul Jackson Cc: Peter Zijlstra Cc: Rafael J. Wysocki Cc: Tejun Heo Cc: Thomas Gleixner Cc: Wei Yang Cc: Yinghai Lu Cc: linux-kernel@vger.kernel.org Signed-off-by: Ingo Molnar --- arch/x86/include/asm/e820/api.h | 2 +- arch/x86/kernel/e820.c | 19 ++++++++++++------- arch/x86/kernel/early-quirks.c | 2 +- arch/x86/kernel/setup.c | 4 ++-- arch/x86/platform/efi/efi.c | 2 +- arch/x86/xen/setup.c | 9 ++++----- 6 files changed, 21 insertions(+), 17 deletions(-) (limited to 'arch/x86/platform') diff --git a/arch/x86/include/asm/e820/api.h b/arch/x86/include/asm/e820/api.h index 4c35c36c62d5..7d5dfc2f9e91 100644 --- a/arch/x86/include/asm/e820/api.h +++ b/arch/x86/include/asm/e820/api.h @@ -16,7 +16,7 @@ extern u64 e820__range_update(u64 start, u64 size, enum e820_type old_type, enu extern u64 e820__range_remove(u64 start, u64 size, enum e820_type old_type, int checktype); extern void e820__print_table(char *who); -extern int e820__update_table(struct e820_entry *biosmap, int max_nr_map, u32 *pnr_map); +extern int e820__update_table(struct e820_table *table); extern void e820__update_table_print(void); extern unsigned long e820_end_of_ram_pfn(void); diff --git a/arch/x86/kernel/e820.c b/arch/x86/kernel/e820.c index da69addf6c34..49823e0a7aea 100644 --- a/arch/x86/kernel/e820.c +++ b/arch/x86/kernel/e820.c @@ -259,7 +259,7 @@ static int __init cpcompare(const void *a, const void *b) return (ap->addr != ap->pbios->addr) - (bp->addr != bp->pbios->addr); } -int __init e820__update_table(struct e820_entry *biosmap, int max_nr_map, u32 *pnr_map) +static int __init __e820__update_table(struct e820_entry *biosmap, int max_nr_map, u32 *pnr_map) { static struct change_member change_point_list[2*E820_MAX_ENTRIES] __initdata; static struct change_member *change_point[2*E820_MAX_ENTRIES] __initdata; @@ -368,6 +368,11 @@ int __init e820__update_table(struct e820_entry *biosmap, int max_nr_map, u32 *p return 0; } +int __init e820__update_table(struct e820_table *table) +{ + return __e820__update_table(table->entries, ARRAY_SIZE(table->entries), &table->nr_entries); +} + static int __init __append_e820_table(struct e820_entry *biosmap, int nr_map) { while (nr_map) { @@ -548,7 +553,7 @@ u64 __init e820__range_remove(u64 start, u64 size, enum e820_type old_type, int void __init e820__update_table_print(void) { - if (e820__update_table(e820_table->entries, ARRAY_SIZE(e820_table->entries), &e820_table->nr_entries)) + if (e820__update_table(e820_table)) return; pr_info("e820: modified physical RAM map:\n"); @@ -557,7 +562,7 @@ void __init e820__update_table_print(void) static void __init e820__update_table_firmware(void) { - e820__update_table(e820_table_firmware->entries, ARRAY_SIZE(e820_table_firmware->entries), &e820_table_firmware->nr_entries); + e820__update_table(e820_table_firmware); } #define MAX_GAP_END 0x100000000ull @@ -676,7 +681,7 @@ void __init e820__memory_setup_extended(u64 phys_addr, u32 data_len) extmap = (struct e820_entry *)(sdata->data); __append_e820_table(extmap, entries); - e820__update_table(e820_table->entries, ARRAY_SIZE(e820_table->entries), &e820_table->nr_entries); + e820__update_table(e820_table); early_memunmap(sdata, data_len); pr_info("e820: extended physical RAM map:\n"); @@ -931,7 +936,7 @@ void __init e820_reserve_setup_data(void) early_memunmap(data, sizeof(*data)); } - e820__update_table(e820_table->entries, ARRAY_SIZE(e820_table->entries), &e820_table->nr_entries); + e820__update_table(e820_table); memcpy(e820_table_firmware, e820_table, sizeof(*e820_table_firmware)); printk(KERN_INFO "extended physical RAM map:\n"); e820__print_table("reserve setup_data"); @@ -945,7 +950,7 @@ void __init e820_reserve_setup_data(void) void __init e820__finish_early_params(void) { if (userdef) { - if (e820__update_table(e820_table->entries, ARRAY_SIZE(e820_table->entries), &e820_table->nr_entries) < 0) + if (e820__update_table(e820_table) < 0) early_panic("Invalid user supplied memory map"); pr_info("e820: user-defined physical RAM map:\n"); @@ -1132,7 +1137,7 @@ char *__init e820__memory_setup_default(void) * the next section from 1mb->appropriate_mem_k */ new_nr = boot_params.e820_entries; - e820__update_table(boot_params.e820_table, ARRAY_SIZE(boot_params.e820_table), &new_nr); + __e820__update_table(boot_params.e820_table, ARRAY_SIZE(boot_params.e820_table), &new_nr); boot_params.e820_entries = new_nr; if (append_e820_table(boot_params.e820_table, boot_params.e820_entries) < 0) { diff --git a/arch/x86/kernel/early-quirks.c b/arch/x86/kernel/early-quirks.c index 2220a4c03adf..ff7e4b3988ed 100644 --- a/arch/x86/kernel/early-quirks.c +++ b/arch/x86/kernel/early-quirks.c @@ -547,7 +547,7 @@ intel_graphics_stolen(int num, int slot, int func, /* Mark this space as reserved */ e820__range_add(base, size, E820_TYPE_RESERVED); - e820__update_table(e820_table->entries, ARRAY_SIZE(e820_table->entries), &e820_table->nr_entries); + e820__update_table(e820_table); } static void __init intel_graphics_quirks(int num, int slot, int func) diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c index 074c86a0ee86..acb2db02ec81 100644 --- a/arch/x86/kernel/setup.c +++ b/arch/x86/kernel/setup.c @@ -740,7 +740,7 @@ static void __init trim_bios_range(void) */ e820__range_remove(BIOS_BEGIN, BIOS_END - BIOS_BEGIN, E820_TYPE_RAM, 1); - e820__update_table(e820_table->entries, ARRAY_SIZE(e820_table->entries), &e820_table->nr_entries); + e820__update_table(e820_table); } /* called before trim_bios_range() to spare extra sanitize */ @@ -1033,7 +1033,7 @@ void __init setup_arch(char **cmdline_p) if (ppro_with_ram_bug()) { e820__range_update(0x70000000ULL, 0x40000ULL, E820_TYPE_RAM, E820_TYPE_RESERVED); - e820__update_table(e820_table->entries, ARRAY_SIZE(e820_table->entries), &e820_table->nr_entries); + e820__update_table(e820_table); printk(KERN_INFO "fixed physical RAM map:\n"); e820__print_table("bad_ppro"); } diff --git a/arch/x86/platform/efi/efi.c b/arch/x86/platform/efi/efi.c index 14d0a6b1eee1..2f7f7605fee0 100644 --- a/arch/x86/platform/efi/efi.c +++ b/arch/x86/platform/efi/efi.c @@ -167,7 +167,7 @@ static void __init do_add_efi_memmap(void) } e820__range_add(start, size, e820_type); } - e820__update_table(e820_table->entries, ARRAY_SIZE(e820_table->entries), &e820_table->nr_entries); + e820__update_table(e820_table); } int __init efi_memblock_x86_reserve_range(void) diff --git a/arch/x86/xen/setup.c b/arch/x86/xen/setup.c index cf29abfc392c..a5bf7c451435 100644 --- a/arch/x86/xen/setup.c +++ b/arch/x86/xen/setup.c @@ -782,7 +782,7 @@ char * __init xen_memory_setup(void) xen_ignore_unusable(); /* Make sure the Xen-supplied memory map is well-ordered. */ - e820__update_table(xen_e820_table.entries, ARRAY_SIZE(xen_e820_table.entries), &xen_e820_table.nr_entries); + e820__update_table(&xen_e820_table); max_pages = xen_get_max_pages(); @@ -856,10 +856,9 @@ char * __init xen_memory_setup(void) * reserve ISA memory anyway because too many things poke * about in there. */ - e820__range_add(ISA_START_ADDRESS, ISA_END_ADDRESS - ISA_START_ADDRESS, - E820_TYPE_RESERVED); + e820__range_add(ISA_START_ADDRESS, ISA_END_ADDRESS - ISA_START_ADDRESS, E820_TYPE_RESERVED); - e820__update_table(e820_table->entries, ARRAY_SIZE(e820_table->entries), &e820_table->nr_entries); + e820__update_table(e820_table); /* * Check whether the kernel itself conflicts with the target E820 map. @@ -930,7 +929,7 @@ char * __init xen_auto_xlated_memory_setup(void) xen_e820_table.nr_entries = memmap.nr_entries; - e820__update_table(xen_e820_table.entries, ARRAY_SIZE(xen_e820_table.entries), &xen_e820_table.nr_entries); + e820__update_table(&xen_e820_table); for (i = 0; i < xen_e820_table.nr_entries; i++) e820__range_add(xen_e820_table.entries[i].addr, xen_e820_table.entries[i].size, xen_e820_table.entries[i].type); -- cgit v1.2.3