Greg Kroah-Hartman | b244131 | 2017-11-01 15:07:57 +0100 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
H. Peter Anvin | 1965aae | 2008-10-22 22:26:29 -0700 | [diff] [blame] | 2 | #ifndef _ASM_X86_BOOT_H |
| 3 | #define _ASM_X86_BOOT_H |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4 | |
Cyrill Gorcunov | 95c4bff | 2009-01-14 23:37:46 +0300 | [diff] [blame] | 5 | |
H. Peter Anvin | 658dbfe | 2009-06-25 15:16:06 -0700 | [diff] [blame] | 6 | #include <asm/pgtable_types.h> |
David Howells | af170c5 | 2012-12-14 22:37:13 +0000 | [diff] [blame] | 7 | #include <uapi/asm/boot.h> |
H. Peter Anvin | 37ba7ab | 2009-05-11 15:56:08 -0700 | [diff] [blame] | 8 | |
Robert P. J. Day | beb7dd8 | 2007-05-09 07:14:03 +0200 | [diff] [blame] | 9 | /* Physical address where kernel should be loaded. */ |
Vivek Goyal | dd0ec16 | 2007-01-05 16:36:30 -0800 | [diff] [blame] | 10 | #define LOAD_PHYSICAL_ADDR ((CONFIG_PHYSICAL_START \ |
| 11 | + (CONFIG_PHYSICAL_ALIGN - 1)) \ |
Vivek Goyal | e69f202 | 2006-12-07 02:14:04 +0100 | [diff] [blame] | 12 | & ~(CONFIG_PHYSICAL_ALIGN - 1)) |
| 13 | |
H. Peter Anvin | 37ba7ab | 2009-05-11 15:56:08 -0700 | [diff] [blame] | 14 | /* Minimum kernel alignment, as a power of two */ |
Robert P. J. Day | 22f4319 | 2009-06-25 16:20:48 -0400 | [diff] [blame] | 15 | #ifdef CONFIG_X86_64 |
Kees Cook | 8665e6f | 2016-05-06 15:01:33 -0700 | [diff] [blame] | 16 | # define MIN_KERNEL_ALIGN_LG2 PMD_SHIFT |
H. Peter Anvin | 37ba7ab | 2009-05-11 15:56:08 -0700 | [diff] [blame] | 17 | #else |
Kees Cook | 8665e6f | 2016-05-06 15:01:33 -0700 | [diff] [blame] | 18 | # define MIN_KERNEL_ALIGN_LG2 (PAGE_SHIFT + THREAD_SIZE_ORDER) |
H. Peter Anvin | 37ba7ab | 2009-05-11 15:56:08 -0700 | [diff] [blame] | 19 | #endif |
| 20 | #define MIN_KERNEL_ALIGN (_AC(1, UL) << MIN_KERNEL_ALIGN_LG2) |
| 21 | |
| 22 | #if (CONFIG_PHYSICAL_ALIGN & (CONFIG_PHYSICAL_ALIGN-1)) || \ |
Jan Beulich | 6fc108a | 2010-04-21 15:23:44 +0100 | [diff] [blame] | 23 | (CONFIG_PHYSICAL_ALIGN < MIN_KERNEL_ALIGN) |
Kees Cook | 8665e6f | 2016-05-06 15:01:33 -0700 | [diff] [blame] | 24 | # error "Invalid value for CONFIG_PHYSICAL_ALIGN" |
H. Peter Anvin | 37ba7ab | 2009-05-11 15:56:08 -0700 | [diff] [blame] | 25 | #endif |
| 26 | |
Cyrill Gorcunov | 95c4bff | 2009-01-14 23:37:46 +0300 | [diff] [blame] | 27 | #ifdef CONFIG_KERNEL_BZIP2 |
Kees Cook | 8665e6f | 2016-05-06 15:01:33 -0700 | [diff] [blame] | 28 | # define BOOT_HEAP_SIZE 0x400000 |
Cyrill Gorcunov | 95c4bff | 2009-01-14 23:37:46 +0300 | [diff] [blame] | 29 | #else /* !CONFIG_KERNEL_BZIP2 */ |
Kees Cook | 8665e6f | 2016-05-06 15:01:33 -0700 | [diff] [blame] | 30 | # define BOOT_HEAP_SIZE 0x10000 |
| 31 | #endif |
Alain Knaff | ae03c49 | 2009-01-04 22:46:17 +0100 | [diff] [blame] | 32 | |
| 33 | #ifdef CONFIG_X86_64 |
Kees Cook | 8665e6f | 2016-05-06 15:01:33 -0700 | [diff] [blame] | 34 | # define BOOT_STACK_SIZE 0x4000 |
Kees Cook | 3a94707 | 2016-05-06 15:01:35 -0700 | [diff] [blame] | 35 | |
| 36 | # define BOOT_INIT_PGT_SIZE (6*4096) |
| 37 | # ifdef CONFIG_RANDOMIZE_BASE |
| 38 | /* |
| 39 | * Assuming all cross the 512GB boundary: |
| 40 | * 1 page for level4 |
| 41 | * (2+2)*4 pages for kernel, param, cmd_line, and randomized kernel |
| 42 | * 2 pages for first 2M (video RAM: CONFIG_X86_VERBOSE_BOOTUP). |
| 43 | * Total is 19 pages. |
| 44 | */ |
| 45 | # ifdef CONFIG_X86_VERBOSE_BOOTUP |
| 46 | # define BOOT_PGT_SIZE (19*4096) |
| 47 | # else /* !CONFIG_X86_VERBOSE_BOOTUP */ |
| 48 | # define BOOT_PGT_SIZE (17*4096) |
| 49 | # endif |
| 50 | # else /* !CONFIG_RANDOMIZE_BASE */ |
| 51 | # define BOOT_PGT_SIZE BOOT_INIT_PGT_SIZE |
| 52 | # endif |
| 53 | |
Kees Cook | 8665e6f | 2016-05-06 15:01:33 -0700 | [diff] [blame] | 54 | #else /* !CONFIG_X86_64 */ |
| 55 | # define BOOT_STACK_SIZE 0x1000 |
Alexander van Heukelum | 7c53976 | 2008-04-08 12:54:30 +0200 | [diff] [blame] | 56 | #endif |
| 57 | |
H. Peter Anvin | 1965aae | 2008-10-22 22:26:29 -0700 | [diff] [blame] | 58 | #endif /* _ASM_X86_BOOT_H */ |