Merge branch 'x86-boot-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull x86 boot updates from Ingo Molnar: "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" * 'x86-boot-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (63 commits) x86/KASLR: Fix kexec kernel boot crash when KASLR randomization fails x86/reboot: Turn off KVM when halting a CPU x86/boot: Fix BSS corruption/overwrite bug in early x86 kernel startup x86: Enable KASLR by default boot/param: Move next_arg() function to lib/cmdline.c for later reuse x86/boot: Fix Sparse warning by including required header file x86/boot/64: Rename start_cpu() x86/xen: Update e820 table handling to the new core x86 E820 code x86/boot: Fix pr_debug() API braindamage xen, x86/headers: Add <linux/device.h> dependency to <asm/xen/page.h> x86/boot/e820: Simplify e820__update_table() x86/boot/e820: Separate the E820 ABI structures from the in-kernel structures x86/boot/e820: Fix and clean up e820_type switch() statements x86/boot/e820: Rename the remaining E820 APIs to the e820__*() prefix x86/boot/e820: Remove unnecessary #include's x86/boot/e820: Rename e820_mark_nosave_regions() to e820__register_nosave_regions() x86/boot/e820: Rename e820_reserve_resources*() to e820__reserve_resources*() x86/boot/e820: Use bool in query APIs x86/boot/e820: Document e820__reserve_setup_data() x86/boot/e820: Clean up __e820__update_table() et al ...
This commit is contained in:
@@ -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);
|
||||
|
@@ -1,73 +0,0 @@
|
||||
#ifndef _ASM_X86_E820_H
|
||||
#define _ASM_X86_E820_H
|
||||
|
||||
/*
|
||||
* E820_X_MAX is the maximum size of the extended E820 table. The extended
|
||||
* table may contain up to 3 extra E820 entries per possible NUMA node, so we
|
||||
* make room for 3 * MAX_NUMNODES possible entries, beyond the standard 128.
|
||||
* Also note that E820_X_MAX *must* be defined before we include uapi/asm/e820.h.
|
||||
*/
|
||||
#include <linux/numa.h>
|
||||
#define E820_X_MAX (E820MAX + 3 * MAX_NUMNODES)
|
||||
|
||||
#include <uapi/asm/e820.h>
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
/* see comment in arch/x86/kernel/e820.c */
|
||||
extern struct e820map *e820;
|
||||
extern struct e820map *e820_saved;
|
||||
|
||||
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 void e820_add_region(u64 start, u64 size, int type);
|
||||
extern void e820_print_map(char *who);
|
||||
extern int
|
||||
sanitize_e820_map(struct e820entry *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);
|
||||
extern void e820_setup_gap(void);
|
||||
struct setup_data;
|
||||
extern void parse_e820_ext(u64 phys_addr, u32 data_len);
|
||||
|
||||
#if defined(CONFIG_X86_64) || \
|
||||
(defined(CONFIG_X86_32) && defined(CONFIG_HIBERNATION))
|
||||
extern void e820_mark_nosave_regions(unsigned long limit_pfn);
|
||||
#else
|
||||
static inline void e820_mark_nosave_regions(unsigned long limit_pfn)
|
||||
{
|
||||
}
|
||||
#endif
|
||||
|
||||
extern unsigned long e820_end_of_ram_pfn(void);
|
||||
extern unsigned long e820_end_of_low_ram_pfn(void);
|
||||
extern u64 early_reserve_e820(u64 sizet, u64 align);
|
||||
|
||||
void memblock_x86_fill(void);
|
||||
void memblock_find_dma_reserve(void);
|
||||
|
||||
extern void finish_e820_parsing(void);
|
||||
extern void e820_reserve_resources(void);
|
||||
extern void e820_reserve_resources_late(void);
|
||||
extern void setup_memory_map(void);
|
||||
extern char *default_machine_specific_memory_setup(void);
|
||||
|
||||
extern void e820_reallocate_tables(void);
|
||||
|
||||
/*
|
||||
* Returns true iff the specified range [s,e) is completely contained inside
|
||||
* the ISA region.
|
||||
*/
|
||||
static inline bool is_ISA_range(u64 s, u64 e)
|
||||
{
|
||||
return s >= ISA_START_ADDRESS && e <= ISA_END_ADDRESS;
|
||||
}
|
||||
|
||||
#endif /* __ASSEMBLY__ */
|
||||
#include <linux/ioport.h>
|
||||
|
||||
#define HIGH_MEMORY (1024*1024)
|
||||
#endif /* _ASM_X86_E820_H */
|
50
arch/x86/include/asm/e820/api.h
Normal file
50
arch/x86/include/asm/e820/api.h
Normal file
@@ -0,0 +1,50 @@
|
||||
#ifndef _ASM_E820_API_H
|
||||
#define _ASM_E820_API_H
|
||||
|
||||
#include <asm/e820/types.h>
|
||||
|
||||
extern struct e820_table *e820_table;
|
||||
extern struct e820_table *e820_table_firmware;
|
||||
|
||||
extern unsigned long pci_mem_start;
|
||||
|
||||
extern bool e820__mapped_any(u64 start, u64 end, enum e820_type type);
|
||||
extern bool e820__mapped_all(u64 start, u64 end, enum e820_type type);
|
||||
|
||||
extern void e820__range_add (u64 start, u64 size, enum e820_type type);
|
||||
extern u64 e820__range_update(u64 start, u64 size, enum e820_type old_type, enum e820_type new_type);
|
||||
extern u64 e820__range_remove(u64 start, u64 size, enum e820_type old_type, bool check_type);
|
||||
|
||||
extern void e820__print_table(char *who);
|
||||
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);
|
||||
extern unsigned long e820__end_of_low_ram_pfn(void);
|
||||
|
||||
extern u64 e820__memblock_alloc_reserved(u64 size, u64 align);
|
||||
extern void e820__memblock_setup(void);
|
||||
|
||||
extern void e820__reserve_setup_data(void);
|
||||
extern void e820__finish_early_params(void);
|
||||
extern void e820__reserve_resources(void);
|
||||
extern void e820__reserve_resources_late(void);
|
||||
|
||||
extern void e820__memory_setup(void);
|
||||
extern void e820__memory_setup_extended(u64 phys_addr, u32 data_len);
|
||||
extern char *e820__memory_setup_default(void);
|
||||
extern void e820__setup_pci_gap(void);
|
||||
|
||||
extern void e820__reallocate_tables(void);
|
||||
extern void e820__register_nosave_regions(unsigned long limit_pfn);
|
||||
|
||||
/*
|
||||
* Returns true iff the specified range [start,end) is completely contained inside
|
||||
* the ISA region.
|
||||
*/
|
||||
static inline bool is_ISA_range(u64 start, u64 end)
|
||||
{
|
||||
return start >= ISA_START_ADDRESS && end <= ISA_END_ADDRESS;
|
||||
}
|
||||
|
||||
#endif /* _ASM_E820_API_H */
|
104
arch/x86/include/asm/e820/types.h
Normal file
104
arch/x86/include/asm/e820/types.h
Normal file
@@ -0,0 +1,104 @@
|
||||
#ifndef _ASM_E820_TYPES_H
|
||||
#define _ASM_E820_TYPES_H
|
||||
|
||||
#include <uapi/asm/bootparam.h>
|
||||
|
||||
/*
|
||||
* These are the E820 types known to the kernel:
|
||||
*/
|
||||
enum e820_type {
|
||||
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
|
||||
* NVDIMM regions that persist over a reboot.
|
||||
*
|
||||
* The kernel will ignore their special capabilities
|
||||
* unless the CONFIG_X86_PMEM_LEGACY=y option is set.
|
||||
*
|
||||
* ( Note that older platforms also used 6 for the same
|
||||
* type of memory, but newer versions switched to 12 as
|
||||
* 6 was assigned differently. Some time they will learn... )
|
||||
*/
|
||||
E820_TYPE_PRAM = 12,
|
||||
|
||||
/*
|
||||
* Reserved RAM used by the kernel itself if
|
||||
* CONFIG_INTEL_TXT=y is enabled, memory of this type
|
||||
* will be included in the S3 integrity calculation
|
||||
* and so should not include any memory that the BIOS
|
||||
* might alter over the S3 transition:
|
||||
*/
|
||||
E820_TYPE_RESERVED_KERN = 128,
|
||||
};
|
||||
|
||||
/*
|
||||
* A single E820 map entry, describing a memory range of [addr...addr+size-1],
|
||||
* of 'type' memory type:
|
||||
*
|
||||
* (We pack it because there can be thousands of them on large systems.)
|
||||
*/
|
||||
struct e820_entry {
|
||||
u64 addr;
|
||||
u64 size;
|
||||
enum e820_type type;
|
||||
} __attribute__((packed));
|
||||
|
||||
/*
|
||||
* The legacy E820 BIOS limits us to 128 (E820_MAX_ENTRIES_ZEROPAGE) nodes
|
||||
* due to the constrained space in the zeropage.
|
||||
*
|
||||
* On large systems we can easily have thousands of nodes with RAM,
|
||||
* which cannot be fit into so few entries - so we have a mechanism
|
||||
* to extend the e820 table size at build-time, via the E820_MAX_ENTRIES
|
||||
* define below.
|
||||
*
|
||||
* ( Those extra entries are enumerated via the EFI memory map, not
|
||||
* via the legacy zeropage mechanism. )
|
||||
*
|
||||
* Size our internal memory map tables to have room for these additional
|
||||
* entries, based on a heuristic calculation: up to three entries per
|
||||
* NUMA node, plus E820_MAX_ENTRIES_ZEROPAGE for some extra space.
|
||||
*
|
||||
* 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 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
|
||||
* to allow more than three entries per node or otherwise refine
|
||||
* this size.
|
||||
*/
|
||||
|
||||
#include <linux/numa.h>
|
||||
|
||||
#define E820_MAX_ENTRIES (E820_MAX_ENTRIES_ZEROPAGE + 3*MAX_NUMNODES)
|
||||
|
||||
/*
|
||||
* The whole array of E820 entries:
|
||||
*/
|
||||
struct e820_table {
|
||||
__u32 nr_entries;
|
||||
struct e820_entry entries[E820_MAX_ENTRIES];
|
||||
};
|
||||
|
||||
/*
|
||||
* Various well-known legacy memory ranges in physical memory:
|
||||
*/
|
||||
#define ISA_START_ADDRESS 0x000a0000
|
||||
#define ISA_END_ADDRESS 0x00100000
|
||||
|
||||
#define BIOS_BEGIN 0x000a0000
|
||||
#define BIOS_END 0x00100000
|
||||
|
||||
#define HIGH_MEMORY 0x00100000
|
||||
|
||||
#define BIOS_ROM_BASE 0xffe00000
|
||||
#define BIOS_ROM_END 0xffffffff
|
||||
|
||||
#endif /* _ASM_E820_TYPES_H */
|
@@ -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;
|
||||
}
|
||||
|
@@ -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
|
||||
|
@@ -4,6 +4,8 @@
|
||||
* (c) 1999 Martin Mares <mj@ucw.cz>
|
||||
*/
|
||||
|
||||
#include <linux/ioport.h>
|
||||
|
||||
#undef DEBUG
|
||||
|
||||
#ifdef DEBUG
|
||||
|
@@ -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. */
|
||||
|
@@ -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>
|
||||
|
Reference in New Issue
Block a user