mirror of
				git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
				synced 2025-10-31 08:44:41 +00:00 
			
		
		
		
	 cb1c9e02b0
			
		
	
	
		cb1c9e02b0
		
	
	
	
	
		
			
			In preparation for updating the EFI stub boot flow to avoid the bare metal decompressor code altogether, implement the support code for switching between 4 and 5 levels of paging before jumping to the kernel proper. Reuse the newly refactored trampoline that the bare metal decompressor uses, but relies on EFI APIs to allocate 32-bit addressable memory and remap it with the appropriate permissions. Given that the bare metal decompressor will no longer call into the trampoline if the number of paging levels is already set correctly, it is no longer needed to remove NX restrictions from the memory range where this trampoline may end up. Signed-off-by: Ard Biesheuvel <ardb@kernel.org> Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de> Acked-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com> Link: https://lore.kernel.org/r/20230807162720.545787-17-ardb@kernel.org
		
			
				
	
	
		
			17 lines
		
	
	
	
		
			486 B
		
	
	
	
		
			C
		
	
	
	
	
	
			
		
		
	
	
			17 lines
		
	
	
	
		
			486 B
		
	
	
	
		
			C
		
	
	
	
	
	
| /* SPDX-License-Identifier: GPL-2.0-only */
 | |
| 
 | |
| #include <linux/efi.h>
 | |
| 
 | |
| extern void trampoline_32bit_src(void *, bool);
 | |
| extern const u16 trampoline_ljmp_imm_offset;
 | |
| 
 | |
| void efi_adjust_memory_range_protection(unsigned long start,
 | |
| 					unsigned long size);
 | |
| 
 | |
| #ifdef CONFIG_X86_64
 | |
| efi_status_t efi_setup_5level_paging(void);
 | |
| void efi_5level_switch(void);
 | |
| #else
 | |
| static inline efi_status_t efi_setup_5level_paging(void) { return EFI_SUCCESS; }
 | |
| static inline void efi_5level_switch(void) {}
 | |
| #endif
 |