x86/boot changes for v4.12
Subsystems (15)
Linus,
Please pull the latest x86-boot-for-linus git tree from:
git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git x86-boot-for-linus
# HEAD: da63b6b20077469bd6bd96e07991ce145fc4fbc4 x86/KASLR: Fix kexec kernel boot crash when KASLR randomization fails
The biggest changes in this cycle were:
- Reworking of the e820 code: separate in-kernel and boot-ABI data structures and apply a whole range of cleanups to the kernel side. No change in functionality.
- Enable KASLR by default: it's used by all major distros and it's out of the experimental stage as well.
- ... misc fixes and cleanups.
out-of-topic modifications in x86-boot-for-linus:
---------------------------------------------------
drivers/acpi/tables.c # ab6bc04cfdbd: x86/boot/e820: Create cohere
drivers/char/agp/amd64-agp.c # 66441bd3cfdc: x86/boot/e820: Move asm/e820
include/linux/kernel.h # f51b17c8d90f: boot/param: Move next_arg()
kernel/params.c # f51b17c8d90f: boot/param: Move next_arg()
lib/cmdline.c # f51b17c8d90f: boot/param: Move next_arg()
tools/lguest/lguest.c # 09821ff1d50a: x86/boot/e820: Prefix the E8
# 61a501016382: x86/boot/e820: Rename everyt
# acd4c0487288: x86/boot/e820: Rename 'e820_
# 8ec67d97bff5: x86/boot/e820: Rename the baThanks,
Ingo
------------------>
Ashish Kalra (1):
x86/boot: Fix BSS corruption/overwrite bug in early x86 kernel startup
Baoquan He (2):
boot/param: Move next_arg() function to lib/cmdline.c for later reuse x86/KASLR: Fix kexec kernel boot crash when KASLR randomization fails
Borislav Petkov (2):
x86/boot: Fix pr_debug() API braindamage
x86/boot/64: Rename start_cpu()
Ingo Molnar (56):
x86/boot/e820: Introduce arch/x86/include/asm/e820/types.h
x86/boot/e820: Clean up and improve comments in asm/e820/types.h
x86/boot/e820: Move asm/e820.h to asm/e820/api.h
x86/boot/e820: Split minimal UAPI types out into uapi/asm/e820/types.h
x86/boot/e820: Clean up the E820_X_MAX definition
x86/boot/e820: Remove spurious asm/e820/api.h inclusions
x86/boot/e820: Remove assembly guard from asm/e820/types.h
x86/boot/e820: Clean up asm/e820/api.h
x86/boot/e820: Remove unnecessary __ASSEMBLY__ guard
x86/boot/e820: Move HIGH_MEMORY define to asm/e820/types.h
x86/boot/e820: Rename the basic e820 data types to 'struct e820_entry' and 'struct e820_array'
x86/boot/e820: Remove unnecessary #include <linux/ioport.h> from asm/e820/api.h
x86/boot/e820: Remove e820_mark_nosave_regions() definition uglies
x86/boot/e820: Rename 'e820_map' variables to 'e820_array'
x86/boot/e820: Rename everything to e820_table
x86/boot/e820: Harmonize the 'struct e820_table' fields
x86/boot/e820: Rename default_machine_specific_memory_setup() to e820__memory_setup_default()
x86/boot/e820: Rename e820_table_saved to e820_table_firmware and improve the description
x86/boot/e820: Basic cleanup of e820.c
x86/boot/e820: Rename memblock_x86_fill() to e820__memblock_setup() and improve the explanations
x86/boot/e820: Consolidate 'struct e820_entry *entry' local variable names
x86/boot/e820: Convert printk(KERN_* ...) to pr_*()
x86/boot/e820: Move the memblock_find_dma_reserve() function and rename it to memblock_set_dma_reserve()
x86/boot/e820: Rename parse_e820_ext() to e820__memory_setup_extended()
x86/boot/e820: Move e820_reserve_setup_data() to e820.c
x86/boot/e820: Clarify the role of finish_e820_parsing() and rename it to e820__finish_early_params()
x86/boot/e820: Rename early_reserve_e820() to e820__memblock_alloc() and document it
x86/boot/e820: Rename update_e820() to e820__update_table()
x86/boot/e820: Rename sanitize_e820_table() to e820__update_table()
x86/boot/e820: Rename e820_any_mapped()/e820_all_mapped() to e820__mapped_any()/e820__mapped_all()
x86/boot/e820: Rename e820_setup_gap() to e820__setup_pci_gap()
x86/boot/e820: Create coherent API function names for E820 range operations
x86/boot/e820: Rename e820_print_map() to e820__print_table()
x86/boot/e820: Reorder the function prototypes in api.h
x86/boot/e820: Simplify e820_reserve_resources()
x86/boot/e820: Introduce 'enum e820_type'
x86/boot/e820: Use 'enum e820_type' in 'struct e820_entry'
x86/boot/e820: Use 'enum e820_type' when handling the e820 region type
x86/boot/e820: Prefix the E820_* type names with "E820_TYPE_"
x86/boot/e820: Clean up the E820 table size define names
x86/boot/e820: Clean up and standardize sizeof() uses
xen, x86/boot/e820: Simplify Xen's xen_e820_table construct
x86/boot/e820: Simplify the e820__update_table() interface
x86/boot/e820: Clean up __e820__update_table() et al
x86/boot/e820: Document e820__reserve_setup_data()
x86/boot/e820: Use bool in query APIs
x86/boot/e820: Rename e820_reserve_resources*() to e820__reserve_resources*()
x86/boot/e820: Rename e820_mark_nosave_regions() to e820__register_nosave_regions()
x86/boot/e820: Remove unnecessary #include's
x86/boot/e820: Rename the remaining E820 APIs to the e820__*() prefix
x86/boot/e820: Fix and clean up e820_type switch() statements
x86/boot/e820: Separate the E820 ABI structures from the in-kernel structures
x86/boot/e820: Simplify e820__update_table()
xen, x86/headers: Add <linux/device.h> dependency to <asm/xen/page.h>
x86/xen: Update e820 table handling to the new core x86 E820 code
x86: Enable KASLR by defaultTiantian Feng (1):
x86/reboot: Turn off KVM when halting a CPU
Zhengyi Shen (1):
x86/boot: Fix Sparse warning by including required header file
Documentation/x86/zero-page.txt | 6 +- arch/x86/Kconfig | 6 +- arch/x86/boot/boot.h | 2 +- arch/x86/boot/compressed/eboot.c | 44 +- arch/x86/boot/compressed/error.c | 1 + arch/x86/boot/compressed/kaslr.c | 17 +- arch/x86/boot/header.S | 1 - arch/x86/boot/memory.c | 6 +- arch/x86/configs/i386_defconfig | 2 + arch/x86/configs/x86_64_defconfig | 2 + arch/x86/include/asm/acpi.h | 2 + arch/x86/include/asm/e820.h | 73 --- arch/x86/include/asm/e820/api.h | 50 ++ arch/x86/include/asm/e820/types.h | 104 ++++ arch/x86/include/asm/gart.h | 4 +- arch/x86/include/asm/mpspec.h | 4 +- arch/x86/include/asm/pci_x86.h | 2 + arch/x86/include/asm/pgtable.h | 3 +- arch/x86/include/asm/xen/page.h | 1 + arch/x86/include/uapi/asm/bootparam.h | 18 +- arch/x86/kernel/acpi/boot.c | 5 +- arch/x86/kernel/aperture_64.c | 10 +- arch/x86/kernel/apic/apic.c | 2 +- arch/x86/kernel/apic/apic_noop.c | 2 +- arch/x86/kernel/apic/probe_32.c | 2 +- arch/x86/kernel/apic/x2apic_uv_x.c | 1 + arch/x86/kernel/cpu/centaur.c | 2 +- arch/x86/kernel/cpu/mtrr/cleanup.c | 6 +- arch/x86/kernel/cpu/mtrr/main.c | 2 +- arch/x86/kernel/crash.c | 23 +- arch/x86/kernel/e820.c | 1054 +++++++++++++++++---------------- arch/x86/kernel/early-quirks.c | 4 +- arch/x86/kernel/head32.c | 2 +- arch/x86/kernel/head64.c | 2 +- arch/x86/kernel/head_64.S | 10 +- arch/x86/kernel/kexec-bzimage64.c | 18 +- arch/x86/kernel/mpparse.c | 6 +- arch/x86/kernel/probe_roms.c | 2 +- arch/x86/kernel/resource.c | 8 +- arch/x86/kernel/setup.c | 78 +-- arch/x86/kernel/smp.c | 3 + arch/x86/kernel/tboot.c | 16 +- arch/x86/kernel/x86_init.c | 4 +- arch/x86/lguest/boot.c | 8 +- arch/x86/lib/kaslr.c | 2 +- arch/x86/mm/amdtopology.c | 2 +- arch/x86/mm/init.c | 59 +- arch/x86/mm/init_32.c | 2 +- arch/x86/mm/init_64.c | 26 +- arch/x86/mm/ioremap.c | 3 +- arch/x86/mm/kasan_init_64.c | 5 +- arch/x86/mm/mmio-mod.c | 2 +- arch/x86/mm/numa.c | 2 +- arch/x86/mm/pageattr.c | 2 +- arch/x86/mm/pat.c | 3 +- arch/x86/mm/pgtable_32.c | 2 +- arch/x86/mm/srat.c | 2 +- arch/x86/pci/i386.c | 4 +- arch/x86/pci/mmconfig-shared.c | 22 +- arch/x86/pci/mmconfig_32.c | 2 +- arch/x86/pci/mmconfig_64.c | 2 +- arch/x86/pci/pcbios.c | 2 + arch/x86/platform/efi/efi.c | 19 +- arch/x86/platform/efi/efi_64.c | 2 +- arch/x86/platform/efi/quirks.c | 8 +- arch/x86/power/hibernate_64.c | 16 +- arch/x86/xen/enlighten.c | 27 +- arch/x86/xen/mmu.c | 2 +- arch/x86/xen/setup.c | 118 ++-- drivers/acpi/tables.c | 2 +- drivers/char/agp/amd64-agp.c | 2 +- include/linux/kernel.h | 1 + include/xen/page.h | 2 +- kernel/params.c | 52 -- lib/cmdline.c | 57 ++ tools/lguest/lguest.c | 2 +- 76 files changed, 1128 insertions(+), 944 deletions(-) delete mode 100644 arch/x86/include/asm/e820.h create mode 100644 arch/x86/include/asm/e820/api.h create mode 100644 arch/x86/include/asm/e820/types.h
Documentation/x86/zero-page.txt +3 -3
@@ -27,7 +27,7 @@ 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_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)
@@ -35,6 +35,6 @@ Offset Proto Name Meaning 1EC/001 ALL secure_boot Secure boot is enabled in the firmware 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 - (array of struct e820entry) +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)
arch/x86/Kconfig +3 -3
@@ -1966,7 +1966,7 @@ config RELOCATABLE config RANDOMIZE_BASE bool "Randomize the address of the kernel image (KASLR)" depends on RELOCATABLE - default n + default y ---help--- In support of Kernel Address Space Layout Randomization (KASLR), this randomizes the physical address at which the kernel image
@@ -1996,7 +1996,7 @@ config RANDOMIZE_BASE theoretically possible, but the implementations are further limited due to memory layouts. - If unsure, say N. + If unsure, say Y. # Relocation on x86 needs some additional build support config X86_NEED_RELOCS
@@ -2045,7 +2045,7 @@ config RANDOMIZE_MEMORY configuration have in average 30,000 different possible virtual addresses for each memory section. - If unsure, say N. + If unsure, say Y. config RANDOMIZE_MEMORY_PHYSICAL_PADDING hex "Physical memory mapping padding" if EXPERT
arch/x86/boot/boot.h +1 -1
@@ -16,7 +16,7 @@#ifndef BOOT_BOOT_H #define BOOT_BOOT_H -#define STACK_SIZE 512/* Minimum number of bytes for stack */ +#define STACK_SIZE 1024/* Minimum number of bytes for stack */ #ifndef __ASSEMBLY__
arch/x86/boot/compressed/eboot.c +23 -21
118 lines not on this page · raw message
arch/x86/boot/compressed/error.c +1 -0
@@ -4,6 +4,7 @@* memcpy() and memmove() are defined for the compressed boot environment. */ #include "misc.h" +#include "error.h" void warn (char *m) {
arch/x86/boot/compressed/kaslr.c +12 -5
@@ -426,7 +426,7 @@ static unsigned long slots_fetch_random(void)return 0 ; } -static void process_e820_entry (struct e820entry *entry, +static void process_e820_entry (struct boot_e820_entry *entry,unsigned long minimum,unsigned long image_size) {
@@ -435,7 +435,7 @@ static void process_e820_entry(struct e820entry *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. */
@@ -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_table[i], minimum, image_size);if (slot_area_index ==MAX_SLOT_AREA ) {debug_putstr ("Aborted e820 scan (slot_areas full)!\n" );
@@ -597,10 +597,17 @@ void choose_random_location(unsigned long input,add_identity_map (random_addr, output_size); *output = random_addr; } + +/* +* This loads the identity mapping page table. +* This should only be done if a new physical address +* is found for the kernel, otherwise we should keep +* the old page table to make it be like the "nokaslr" +* case. +*/ +finalize_identity_maps (); } -/* This actually loads the identity pagetable on x86_64. */ -finalize_identity_maps ();/* Pick random virtual address starting from LOAD_PHYSICAL_ADDR. */ if (IS_ENABLED (CONFIG_X86_64 ))
arch/x86/boot/header.S +0 -1
@@ -18,7 +18,6 @@ #include <asm/segment.h> #include <generated/utsrelease.h> #include <asm/boot.h> -#include <asm/e820.h> #include <asm/page_types.h> #include <asm/setup.h> #include <asm/bootparam.h>
arch/x86/boot/memory.c +3 -3
@@ -21,8 +21,8 @@ static int detect_memory_e820(void) {int count =0 ;struct biosregs ireg, oreg; -struct e820entry *desc = boot_params.e820_map; -static struct e820entry buf;/* static so it is zeroed */ +struct boot_e820_entry *desc = boot_params.e820_table; +static struct boot_e820_entry buf;/* static so it is zeroed */ initregs (&ireg); ireg.ax =0xe820 ;
@@ -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_table));return boot_params.e820_entries = count; }
arch/x86/configs/i386_defconfig +2 -0
@@ -57,6 +57,8 @@ CONFIG_EFI=y CONFIG_HZ_1000=y CONFIG_KEXEC=y CONFIG_CRASH_DUMP=y +CONFIG_RANDOMIZE_BASE=y +CONFIG_RANDOMIZE_MEMORY=y # CONFIG_COMPAT_VDSO is not set CONFIG_HIBERNATION=y CONFIG_PM_DEBUG=y
arch/x86/configs/x86_64_defconfig +2 -0
@@ -55,6 +55,8 @@ CONFIG_EFI=y CONFIG_HZ_1000=y CONFIG_KEXEC=y CONFIG_CRASH_DUMP=y +CONFIG_RANDOMIZE_BASE=y +CONFIG_RANDOMIZE_MEMORY=y # CONFIG_COMPAT_VDSO is not set CONFIG_HIBERNATION=y CONFIG_PM_DEBUG=y
arch/x86/include/asm/acpi.h +2 -0
@@ -52,6 +52,8 @@ extern u8 acpi_sci_flags;extern int acpi_sci_override_gsi;void acpi_pic_sci_set_trigger (unsigned int ,u16 ); +struct device ; +extern int (*__acpi_register_gsi)(struct device *dev,u32 gsi,int trigger,int polarity);extern void (*__acpi_unregister_gsi)(u32 gsi);
arch/x86/include/asm/e820.h deleted +0 -73
73 lines not on this page · raw message
arch/x86/include/asm/e820/api.h new file +50 -0
50 lines not on this page · raw message
arch/x86/include/asm/e820/types.h new file +104 -0
104 lines not on this page · raw message
arch/x86/include/asm/gart.h +2 -2
@@ -1,7 +1,7 @@#ifndef _ASM_X86_GART_H#define _ASM_X86_GART_H -#include <asm/e820.h> +#include <asm/e820/api.h> extern void set_up_gart_resume (u32 ,u32 );
@@ -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_TYPE_RAM )) {printk (KERN_INFO "Aperture pointing to e820 RAM. Ignoring.\n" );return 0 ; }
arch/x86/include/asm/mpspec.h +2 -2
@@ -64,7 +64,7 @@ static inline void find_smp_config(void) }#ifdef CONFIG_X86_MPPARSE -extern void early_reserve_e820_mpc_new (void ); +extern void e820__memblock_alloc_reserved_mpc_new (void );extern int enable_update_mptable;extern int default_mpc_apic_id (struct mpc_cpu *m);extern void default_smp_read_mpc_oem (struct mpc_table *mpc);
@@ -76,7 +76,7 @@ extern void default_mpc_oem_bus_info(struct mpc_bus *m, char *str);extern void default_find_smp_config (void );extern void default_get_smp_config (unsigned int early);#else -static inline void early_reserve_e820_mpc_new (void ) { } +static inline void e820__memblock_alloc_reserved_mpc_new (void ) { }#define enable_update_mptable 0#define default_mpc_apic_id NULL#define default_smp_read_mpc_oem NULL
arch/x86/include/asm/pci_x86.h +2 -0
@@ -4,6 +4,8 @@* (c) 1999 Martin Mares <[email protected]> */ +#include <linux/ioport.h> +#undef DEBUG#ifdef DEBUG
arch/x86/include/asm/pgtable.h +1 -2
@@ -2,8 +2,6 @@#define _ASM_X86_PGTABLE_H#include <asm/page.h> -#include <asm/e820.h> -#include <asm/pgtable_types.h> /*
@@ -845,6 +843,7 @@ static inline int pgd_none(pgd_t pgd)extern int direct_gbpages;void init_mem_mapping (void );void early_alloc_pgt_buf (void ); +extern void memblock_find_dma_reserve (void );#ifdef CONFIG_X86_64 /* Realmode trampoline initialization. */
arch/x86/include/asm/xen/page.h +1 -0
@@ -6,6 +6,7 @@#include <linux/spinlock.h> #include <linux/pfn.h> #include <linux/mm.h> +#include <linux/device.h> #include <linux/uaccess.h> #include <asm/page.h>
arch/x86/include/uapi/asm/bootparam.h +16 -2
@@ -34,7 +34,6 @@#include <linux/screen_info.h> #include <linux/apm_bios.h> #include <linux/edd.h> -#include <asm/e820.h> #include <asm/ist.h> #include <video/edid.h>
@@ -111,6 +110,21 @@ struct efi_info {__u32 efi_memmap_hi; }; +/* +* This is the maximum number of entries in struct boot_params::e820_table +* (the zeropage), which is part of the x86 boot protocol ABI: +*/ +#define E820_MAX_ENTRIES_ZEROPAGE 128 + +/* +* The E820 memory region entry of the boot protocol ABI: +*/ +struct boot_e820_entry { +__u64 addr; +__u64 size; +__u32 type; +} __attribute__((packed)); +/* The so-called "zeropage" */ struct boot_params {struct screen_info screen_info;/* 0x000 */
@@ -153,7 +167,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 e820entry e820_map[E820MAX ];/* 0x2d0 */ +struct boot_e820_entry e820_table[E820_MAX_ENTRIES_ZEROPAGE ];/* 0x2d0 */ __u8 _pad8[48 ];/* 0xcd0 */ struct edd_info eddbuf[EDDMAXNR ];/* 0xd00 */ __u8 _pad9[276 ];/* 0xeec */
arch/x86/kernel/acpi/boot.c +3 -2
@@ -37,6 +37,7 @@#include <linux/pci.h> #include <linux/efi-bgrt.h> +#include <asm/e820/api.h> #include <asm/irqdomain.h> #include <asm/pci_x86.h> #include <asm/pgtable.h>
@@ -1724,6 +1725,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 ); -update_e820 (); +e820__range_add (addr, size,E820_TYPE_ACPI ); +e820__update_table_print (); }
arch/x86/kernel/aperture_64.c +5 -5
@@ -21,7 +21,7 @@#include <linux/pci.h> #include <linux/bitops.h> #include <linux/suspend.h> -#include <asm/e820.h> +#include <asm/e820/api.h> #include <asm/io.h> #include <asm/iommu.h> #include <asm/gart.h>
@@ -306,13 +306,13 @@ 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, -E820_RAM )) { +if (e820__mapped_any (aper_base, aper_base + aper_size, +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_add_region (aper_base, aper_size,E820_RESERVED ); -update_e820 (); +e820__range_add (aper_base, aper_size,E820_TYPE_RESERVED ); +e820__update_table_print (); } }
arch/x86/kernel/apic/apic.c +1 -1
@@ -2648,7 +2648,7 @@ static int __init lapic_insert_resource(void) }/* -* need call insert after e820_reserve_resources() +* need call insert after e820__reserve_resources() * that is using request_resource */ late_initcall (lapic_insert_resource);
arch/x86/kernel/apic/apic_noop.c +1 -1
@@ -26,7 +26,7 @@#include <linux/interrupt.h> #include <asm/acpi.h> -#include <asm/e820.h> +#include <asm/e820/api.h> static void noop_init_apic_ldr (void ) { }static void noop_send_IPI (int cpu,int vector) { }
arch/x86/kernel/apic/probe_32.c +1 -1
@@ -25,7 +25,7 @@#include <linux/interrupt.h> #include <asm/acpi.h> -#include <asm/e820.h> +#include <asm/e820/api.h> #ifdef CONFIG_HOTPLUG_CPU #define DEFAULT_SEND_IPI (1)
arch/x86/kernel/apic/x2apic_uv_x.c +1 -0
@@ -34,6 +34,7 @@#include <asm/uv/bios.h> #include <asm/uv/uv.h> #include <asm/apic.h> +#include <asm/e820/api.h> #include <asm/ipi.h> #include <asm/smp.h> #include <asm/x86_init.h>
arch/x86/kernel/cpu/centaur.c +1 -1
@@ -3,7 +3,7 @@#include <linux/sched/clock.h> #include <asm/cpufeature.h> -#include <asm/e820.h> +#include <asm/e820/api.h> #include <asm/mtrr.h> #include <asm/msr.h>
arch/x86/kernel/cpu/mtrr/cleanup.c +3 -3
@@ -27,7 +27,7 @@#include <linux/range.h> #include <asm/processor.h> -#include <asm/e820.h> +#include <asm/e820/api.h> #include <asm/mtrr.h> #include <asm/msr.h>
@@ -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_TYPE_RAM ,E820_TYPE_RESERVED ); }/**
@@ -978,7 +978,7 @@ int __init mtrr_trim_uncached_memory(unsigned long end_pfn)WARN_ON (1 );pr_info ("update e820 for mtrr\n" ); -update_e820 (); +e820__update_table_print ();return 1 ; }
arch/x86/kernel/cpu/mtrr/main.c +1 -1
@@ -48,7 +48,7 @@#include <linux/syscore_ops.h> #include <asm/cpufeature.h> -#include <asm/e820.h> +#include <asm/e820/api.h> #include <asm/mtrr.h> #include <asm/msr.h> #include <asm/pat.h>
arch/x86/kernel/crash.c +12 -11
@@ -29,6 +29,7 @@#include <asm/nmi.h> #include <asm/hw_irq.h> #include <asm/apic.h> +#include <asm/e820/types.h> #include <asm/io_apic.h> #include <asm/hpet.h> #include <linux/kdebug.h>
@@ -503,16 +504,16 @@ static int prepare_elf_headers(struct kimage *image, void **addr,return ret; } -static int add_e820_entry (struct boot_params *params,struct e820entry *entry) +static int add_e820_entry (struct boot_params *params,struct e820_entry *entry) {unsigned int nr_e820_entries; nr_e820_entries = params->e820_entries; -if (nr_e820_entries >=E820MAX ) +if (nr_e820_entries >=E820_MAX_ENTRIES_ZEROPAGE )return 1 ; -memcpy (¶ms->e820_map[nr_e820_entries], entry, -sizeof (struct e820entry )); +memcpy (¶ms->e820_table[nr_e820_entries], entry, +sizeof (struct e820_entry )); params->e820_entries++;return 0 ; }
@@ -521,7 +522,7 @@ static int memmap_entry_callback(u64 start, u64 end, void *arg) {struct crash_memmap_data *cmd = arg;struct boot_params *params = cmd->params; -struct e820entry ei; +struct e820_entry ei; ei.addr = start; ei.size = end - start +1 ;
@@ -560,7 +561,7 @@ int crash_setup_memmap_entries(struct kimage *image, struct boot_params *params) {int i, ret =0 ;unsigned long flags; -struct e820entry ei; +struct e820_entry ei;struct crash_memmap_data cmd;struct crash_mem *cmem;
@@ -574,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);
@@ -592,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); }
@@ -609,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); }
arch/x86/kernel/e820.c +529 -525
1,601 lines not on this page · raw message
arch/x86/kernel/early-quirks.c +2 -2
@@ -546,8 +546,8 @@ intel_graphics_stolen(int num, int slot, int func, &base, &end);/* Mark this space as reserved */ -e820_add_region (base, size,E820_RESERVED ); -sanitize_e820_map (e820->map,ARRAY_SIZE (e820->map), &e820->nr_map); +e820__range_add (base, size,E820_TYPE_RESERVED ); +e820__update_table (e820_table); }static void __init intel_graphics_quirks (int num,int slot,int func)
arch/x86/kernel/head32.c +1 -1
@@ -12,7 +12,7 @@#include <asm/setup.h> #include <asm/sections.h> -#include <asm/e820.h> +#include <asm/e820/api.h> #include <asm/page.h> #include <asm/apic.h> #include <asm/io_apic.h>
arch/x86/kernel/head64.c +1 -1
@@ -23,7 +23,7 @@#include <asm/tlbflush.h> #include <asm/sections.h> #include <asm/kdebug.h> -#include <asm/e820.h> +#include <asm/e820/api.h> #include <asm/bios_ebda.h> #include <asm/bootparam_utils.h> #include <asm/microcode.h>
arch/x86/kernel/head_64.S +4 -6
@@ -269,10 +269,8 @@ ENTRY(secondary_startup_64) /* rsi is pointer to real mode structure with interesting info. pass it to C */ movq %rsi, %rdi - jmp start_cpu -ENDPROC(secondary_startup_64) -ENTRY(start_cpu) +.Ljump_to_C_code: /* * Jump to run C code and to be on a real kernel address. * Since we are running on identity-mapped space we have to jump
@@ -305,7 +303,7 @@ ENTRY(start_cpu) pushq %rax # target address in negative space lretq .Lafter_lret: -ENDPROC(start_cpu) +ENDPROC(secondary_startup_64) #include "verify_cpu.S"
@@ -313,11 +311,11 @@ ENDPROC(start_cpu) /* * Boot CPU0 entry point. It's called from play_dead(). Everything has been set * up already except stack. We just set up stack here. Then call - * start_secondary() via start_cpu(). + * start_secondary() via .Ljump_to_C_code. */ ENTRY(start_cpu0) movq initial_stack(%rip), %rsp - jmp start_cpu + jmp .Ljump_to_C_code ENDPROC(start_cpu0) #endif
arch/x86/kernel/kexec-bzimage64.c +9 -9
@@ -25,6 +25,7 @@#include <asm/setup.h> #include <asm/crash.h> #include <asm/efi.h> +#include <asm/e820/api.h> #include <asm/kexec-bzimage64.h> #define MAX_ELFCOREHDR_STR_LEN 30/* elfcorehdr=0x<64bit-value> */
@@ -99,15 +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_table_firmware->nr_entries; -/* TODO: Pass entries more than E820MAX in bootparams setup data */ -if (nr_e820_entries >E820MAX ) - nr_e820_entries =E820MAX ; +/* TODO: Pass entries more than E820_MAX_ENTRIES_ZEROPAGE in bootparams setup data */ +if (nr_e820_entries >E820_MAX_ENTRIES_ZEROPAGE ) + nr_e820_entries =E820_MAX_ENTRIES_ZEROPAGE ; params->e820_entries = nr_e820_entries; -memcpy (¶ms->e820_map, &e820_saved->map, - nr_e820_entries *sizeof (struct e820entry )); +memcpy (¶ms->e820_table, &e820_table_firmware->entries, nr_e820_entries*sizeof (struct e820_entry ));return 0 ; }
@@ -232,10 +232,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_table[i].type !=E820_TYPE_RAM )continue ; - start = params->e820_map[i].addr; - end = params->e820_map[i].addr + params->e820_map[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 );
arch/x86/kernel/mpparse.c +3 -3
@@ -26,7 +26,7 @@#include <asm/io_apic.h> #include <asm/proto.h> #include <asm/bios_ebda.h> -#include <asm/e820.h> +#include <asm/e820/api.h> #include <asm/setup.h> #include <asm/smp.h>
@@ -826,10 +826,10 @@ static int __init parse_alloc_mptable_opt(char *p) }early_param ("alloc_mptable" , parse_alloc_mptable_opt); -void __init early_reserve_e820_mpc_new (void ) +void __init e820__memblock_alloc_reserved_mpc_new (void ) {if (enable_update_mptable && alloc_mptable) - mpc_new_phys =early_reserve_e820 (mpc_new_length,4 ); + mpc_new_phys =e820__memblock_alloc_reserved (mpc_new_length,4 ); }static int __init update_mp_table (void )
arch/x86/kernel/probe_roms.c +1 -1
@@ -14,7 +14,7 @@#include <asm/probe_roms.h> #include <asm/pci-direct.h> -#include <asm/e820.h> +#include <asm/e820/api.h> #include <asm/mmzone.h> #include <asm/setup.h> #include <asm/sections.h>
arch/x86/kernel/resource.c +4 -4
@@ -1,5 +1,5 @@#include <linux/ioport.h> -#include <asm/e820.h> +#include <asm/e820/api.h> static void resource_clip (struct resource *res,resource_size_t start,resource_size_t end)
@@ -25,10 +25,10 @@ static void resource_clip(struct resource *res, resource_size_t start,static void remove_e820_regions (struct resource *avail) {int i; -struct e820entry *entry; +struct e820_entry *entry; -for (i =0 ; i < e820->nr_map; i++) { - entry = &e820->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 );
arch/x86/kernel/setup.c +27 -51
190 lines not on this page · raw message
arch/x86/kernel/smp.c +3 -0
@@ -33,6 +33,7 @@#include <asm/mce.h> #include <asm/trace/irq_vectors.h> #include <asm/kexec.h> +#include <asm/virtext.h> /* * Some notes on x86 processor bugs affecting SMP operation:
@@ -162,6 +163,7 @@ static int smp_stop_nmi_callback(unsigned int val, struct pt_regs *regs)if (raw_smp_processor_id () ==atomic_read (&stopping_cpu))return NMI_HANDLED ; +cpu_emergency_vmxoff ();stop_this_cpu (NULL );return NMI_HANDLED ;
@@ -174,6 +176,7 @@ static int smp_stop_nmi_callback(unsigned int val, struct pt_regs *regs) asmlinkage __visible void smp_reboot_interrupt(void) {ipi_entering_ack_irq (); +cpu_emergency_vmxoff ();stop_this_cpu (NULL );irq_exit (); }
arch/x86/kernel/tboot.c +8 -8
@@ -42,7 +42,7 @@#include <asm/fixmap.h> #include <asm/proto.h> #include <asm/setup.h> -#include <asm/e820.h> +#include <asm/e820/api.h> #include <asm/io.h> #include "../realmode/rm/wakeup.h"
@@ -68,9 +68,9 @@ 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, - boot_params.tboot_addr,E820_RESERVED )) { -pr_warning ("non-0 tboot_addr but it is not of type E820_RESERVED\n" ); +if (!e820__mapped_any (boot_params.tboot_addr, + boot_params.tboot_addr,E820_TYPE_RESERVED )) { +pr_warning ("non-0 tboot_addr but it is not of type E820_TYPE_RESERVED\n" );return ; }
@@ -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_table->nr_entries; i++) { +if ((e820_table->entries[i].type !=E820_TYPE_RAM ) + && (e820_table->entries[i].type !=E820_TYPE_RESERVED_KERN ))continue ; -add_mac_region (e820->map[i].addr, e820->map[i].size); +add_mac_region (e820_table->entries[i].addr, e820_table->entries[i].size); } tboot->acpi_sinfo.kernel_s3_resume_vector =
arch/x86/kernel/x86_init.c +2 -2
@@ -14,7 +14,7 @@#include <asm/mpspec.h> #include <asm/setup.h> #include <asm/apic.h> -#include <asm/e820.h> +#include <asm/e820/api.h> #include <asm/time.h> #include <asm/irq.h> #include <asm/io_apic.h>
@@ -38,7 +38,7 @@ struct x86_init_ops x86_init __initdata = { .resources = { .probe_roms = probe_roms, .reserve_resources = reserve_standard_io_resources, - .memory_setup = default_machine_specific_memory_setup, + .memory_setup = e820__memory_setup_default, }, .mpparse = {
arch/x86/lguest/boot.c +4 -4
@@ -67,7 +67,7 @@#include <asm/pgtable.h> #include <asm/desc.h> #include <asm/setup.h> -#include <asm/e820.h> +#include <asm/e820/api.h> #include <asm/mce.h> #include <asm/io.h> #include <asm/fpu/api.h>
@@ -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__range_add (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" ;
arch/x86/lib/kaslr.c +1 -1
@@ -8,7 +8,7 @@#include <asm/kaslr.h> #include <asm/msr.h> #include <asm/archrandom.h> -#include <asm/e820.h> +#include <asm/e820/api.h> #include <asm/io.h> /*
arch/x86/mm/amdtopology.c +1 -1
@@ -19,7 +19,7 @@#include <asm/types.h> #include <asm/mmzone.h> #include <asm/proto.h> -#include <asm/e820.h> +#include <asm/e820/api.h> #include <asm/pci-direct.h> #include <asm/numa.h> #include <asm/mpspec.h>
arch/x86/mm/init.c +53 -6
94 lines not on this page · raw message
arch/x86/mm/init_32.c +1 -1
@@ -38,7 +38,7 @@#include <asm/pgtable.h> #include <asm/dma.h> #include <asm/fixmap.h> -#include <asm/e820.h> +#include <asm/e820/api.h> #include <asm/apic.h> #include <asm/bugs.h> #include <asm/tlb.h>
arch/x86/mm/init_64.c +13 -13
@@ -41,7 +41,7 @@#include <asm/pgalloc.h> #include <asm/dma.h> #include <asm/fixmap.h> -#include <asm/e820.h> +#include <asm/e820/api.h> #include <asm/apic.h> #include <asm/tlb.h> #include <asm/mmu_context.h>
@@ -337,10 +337,10 @@ 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_RAM ) && - !e820_any_mapped (paddr &PAGE_MASK , paddr_next, -E820_RESERVED_KERN )) + !e820__mapped_any (paddr &PAGE_MASK , paddr_next, +E820_TYPE_RAM ) && + !e820__mapped_any (paddr &PAGE_MASK , paddr_next, +E820_TYPE_RESERVED_KERN ))set_pte (pte,__pte (0 ));continue ; }
@@ -392,10 +392,10 @@ 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_RAM ) && - !e820_any_mapped (paddr &PMD_MASK , paddr_next, -E820_RESERVED_KERN )) + !e820__mapped_any (paddr &PMD_MASK , paddr_next, +E820_TYPE_RAM ) && + !e820__mapped_any (paddr &PMD_MASK , paddr_next, +E820_TYPE_RESERVED_KERN ))set_pmd (pmd,__pmd (0 ));continue ; }
@@ -478,10 +478,10 @@ 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_RAM ) && - !e820_any_mapped (paddr &PUD_MASK , paddr_next, -E820_RESERVED_KERN )) + !e820__mapped_any (paddr &PUD_MASK , paddr_next, +E820_TYPE_RAM ) && + !e820__mapped_any (paddr &PUD_MASK , paddr_next, +E820_TYPE_RESERVED_KERN ))set_pud (pud,__pud (0 ));continue ; }
arch/x86/mm/ioremap.c +2 -1
@@ -9,12 +9,13 @@#include <linux/bootmem.h> #include <linux/init.h> #include <linux/io.h> +#include <linux/ioport.h> #include <linux/slab.h> #include <linux/vmalloc.h> #include <linux/mmiotrace.h> #include <asm/cacheflush.h> -#include <asm/e820.h> +#include <asm/e820/api.h> #include <asm/fixmap.h> #include <asm/pgtable.h> #include <asm/tlbflush.h>
arch/x86/mm/kasan_init_64.c +3 -2
@@ -7,11 +7,12 @@#include <linux/sched/task.h> #include <linux/vmalloc.h> +#include <asm/e820/types.h> #include <asm/tlbflush.h> #include <asm/sections.h> extern pgd_t early_level4_pgt[PTRS_PER_PGD ]; -extern struct range pfn_mapped[E820_X_MAX ];
Lines of this file are not shown. View the raw message.
arch/x86/xen/setup.c +73 -45
118 lines not on this page · raw message
kernel/params.c +0 -52
52 lines not on this page · raw message
lib/cmdline.c +57 -0
57 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Part of the diff is not shown here. View the raw message.