mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-04 18:09:57 +00:00
![Alexander Egorenkov](/assets/img/avatar_default.png)
This change simplifies the task of making the decompressor relocatable.
The decompressor's image contains special DMA sections between _sdma and
_edma. This DMA segment is loaded at boot as part of the decompressor and
then simply handed over to the decompressed kernel. The decompressor itself
never uses it in any way. The primary reason for this is the need to keep
the aforementioned DMA segment below 2GB which is required by architecture,
and because the decompressor is always loaded at a fixed low physical
address, it is guaranteed that the DMA region will not cross the 2GB
memory limit. If the DMA region had been placed in the decompressed kernel,
then KASLR would make this guarantee impossible to fulfill or it would
be restricted to the first 2GB of memory address space.
This commit moves all DMA sections between _sdma and _edma from
the decompressor's image to the decompressed kernel's image. The complete
DMA region is placed in the init section of the decompressed kernel and
immediately relocated below 2GB at start-up before it is needed by other
parts of the decompressed kernel. The relocation of the DMA region happens
even if the decompressed kernel is already located below 2GB in order
to keep the first implementation simple. The relocation should not have
any noticeable impact on boot time because the DMA segment is only a couple
of pages.
After relocating the DMA sections, the kernel has to fix all references
which point into it. In order to automate this, place all variables
pointing into the DMA sections in a special .dma.refs section. All such
variables must be defined using the new __dma_ref macro. Only variables
containing addresses within the DMA sections must be placed in the new
.dma.refs section.
Furthermore, move the initialization of control registers from
the decompressor to the decompressed kernel because some control registers
reference tables that must be placed in the DMA data section to
guarantee that their addresses are below 2G. Because the decompressed
kernel relocates the DMA sections at startup, the content of control
registers CR2, CR5 and CR15 must be updated with new addresses after
the relocation. The decompressed kernel initializes all control registers
early at boot and then updates the content of CR2, CR5 and CR15
as soon as the DMA relocation has occurred. This practically reverts
the commit a80313ff91
("s390/kernel: introduce .dma sections").
Signed-off-by: Alexander Egorenkov <egorenar@linux.ibm.com>
Acked-by: Heiko Carstens <hca@linux.ibm.com>
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
34 lines
1.1 KiB
C
34 lines
1.1 KiB
C
/* SPDX-License-Identifier: GPL-2.0 */
|
|
#ifndef BOOT_BOOT_H
|
|
#define BOOT_BOOT_H
|
|
|
|
#include <asm/extable.h>
|
|
#include <linux/types.h>
|
|
|
|
void startup_kernel(void);
|
|
unsigned long detect_memory(void);
|
|
bool is_ipl_block_dump(void);
|
|
void store_ipl_parmblock(void);
|
|
void setup_boot_command_line(void);
|
|
void parse_boot_command_line(void);
|
|
void verify_facilities(void);
|
|
void print_missing_facilities(void);
|
|
void sclp_early_setup_buffer(void);
|
|
void print_pgm_check_info(void);
|
|
unsigned long get_random_base(unsigned long safe_addr);
|
|
void __printf(1, 2) decompressor_printk(const char *fmt, ...);
|
|
|
|
/* Symbols defined by linker scripts */
|
|
extern const char kernel_version[];
|
|
extern unsigned long memory_limit;
|
|
extern unsigned long vmalloc_size;
|
|
extern int vmalloc_size_set;
|
|
extern int kaslr_enabled;
|
|
extern char __boot_data_start[], __boot_data_end[];
|
|
extern char __boot_data_preserved_start[], __boot_data_preserved_end[];
|
|
extern char _decompressor_syms_start[], _decompressor_syms_end[];
|
|
extern char _stack_start[], _stack_end[];
|
|
|
|
unsigned long read_ipl_report(unsigned long safe_offset);
|
|
|
|
#endif /* BOOT_BOOT_H */
|