^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) /* SPDX-License-Identifier: GPL-2.0 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) #ifndef _ASM_X86_BOOT_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) #define _ASM_X86_BOOT_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) #include <asm/pgtable_types.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) #include <uapi/asm/boot.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) /* Physical address where kernel should be loaded. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) #define LOAD_PHYSICAL_ADDR ((CONFIG_PHYSICAL_START \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) + (CONFIG_PHYSICAL_ALIGN - 1)) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) & ~(CONFIG_PHYSICAL_ALIGN - 1))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) /* Minimum kernel alignment, as a power of two */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) #ifdef CONFIG_X86_64
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) # define MIN_KERNEL_ALIGN_LG2 PMD_SHIFT
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) #else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) # define MIN_KERNEL_ALIGN_LG2 (PAGE_SHIFT + THREAD_SIZE_ORDER)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) #define MIN_KERNEL_ALIGN (_AC(1, UL) << MIN_KERNEL_ALIGN_LG2)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) #if (CONFIG_PHYSICAL_ALIGN & (CONFIG_PHYSICAL_ALIGN-1)) || \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) (CONFIG_PHYSICAL_ALIGN < MIN_KERNEL_ALIGN)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) # error "Invalid value for CONFIG_PHYSICAL_ALIGN"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) #if defined(CONFIG_KERNEL_BZIP2)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) # define BOOT_HEAP_SIZE 0x400000
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) #elif defined(CONFIG_KERNEL_ZSTD)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) * Zstd needs to allocate the ZSTD_DCtx in order to decompress the kernel.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) * The ZSTD_DCtx is ~160KB, so set the heap size to 192KB because it is a
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) * round number and to allow some slack.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) # define BOOT_HEAP_SIZE 0x30000
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) #else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) # define BOOT_HEAP_SIZE 0x10000
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) #ifdef CONFIG_X86_64
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) # define BOOT_STACK_SIZE 0x4000
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) # define BOOT_INIT_PGT_SIZE (6*4096)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) # ifdef CONFIG_RANDOMIZE_BASE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) * Assuming all cross the 512GB boundary:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) * 1 page for level4
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) * (2+2)*4 pages for kernel, param, cmd_line, and randomized kernel
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) * 2 pages for first 2M (video RAM: CONFIG_X86_VERBOSE_BOOTUP).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) * Total is 19 pages.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) # ifdef CONFIG_X86_VERBOSE_BOOTUP
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) # define BOOT_PGT_SIZE (19*4096)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) # else /* !CONFIG_X86_VERBOSE_BOOTUP */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) # define BOOT_PGT_SIZE (17*4096)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) # endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) # else /* !CONFIG_RANDOMIZE_BASE */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) # define BOOT_PGT_SIZE BOOT_INIT_PGT_SIZE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) # endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) #else /* !CONFIG_X86_64 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) # define BOOT_STACK_SIZE 0x1000
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) #endif /* _ASM_X86_BOOT_H */