Commit de3fbb2a authored by Linus Torvalds's avatar Linus Torvalds
Browse files

Merge branch 'efi-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

Pull EFI updates from Ingo Molnar:
 "The main changes are:

   - Add support for enlisting the help of the EFI firmware to create
     memory reservations that persist across kexec.

   - Add page fault handling to the runtime services support code on x86
     so we can more gracefully recover from buggy EFI firmware.

   - Fix command line handling on x86 for the boot path that omits the
     stub's PE/COFF entry point.

   - Other assorted fixes and updates"

* 'efi-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  x86: boot: Fix EFI stub alignment
  efi/x86: Call efi_parse_options() from efi_main()
  efi/x86: earlyprintk - Add 64bit efi fb address support
  efi/x86: drop task_lock() from efi_switch_mm()
  efi/x86: Handle page faults occurring while running EFI runtime services
  efi: Make efi_rts_work accessible to efi page fault handler
  efi/efi_test: add exporting ResetSystem runtime service
  efi/libstub: arm: support building with clang
  efi: add API to reserve memory persistently across kexec reboot
  efi/arm: libstub: add a root memreserve config table
  efi: honour memory reservations passed via a linux specific config table
parents cee1352f fa70f0d2
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -738,6 +738,7 @@ efi_main(struct efi_config *c, struct boot_params *boot_params)
	struct desc_struct *desc;
	void *handle;
	efi_system_table_t *_table;
	unsigned long cmdline_paddr;

	efi_early = c;

@@ -755,6 +756,15 @@ efi_main(struct efi_config *c, struct boot_params *boot_params)
	else
		setup_boot_services32(efi_early);

	/*
	 * make_boot_params() may have been called before efi_main(), in which
	 * case this is the second time we parse the cmdline. This is ok,
	 * parsing the cmdline multiple times does not have side-effects.
	 */
	cmdline_paddr = ((u64)hdr->cmd_line_ptr |
			 ((u64)boot_params->ext_cmd_line_ptr << 32));
	efi_parse_options((char *)cmdline_paddr);

	/*
	 * If the boot loader gave us a value for secure_boot then we use that,
	 * otherwise we ask the BIOS.
+7 −0
Original line number Diff line number Diff line
@@ -391,6 +391,13 @@ int main(int argc, char ** argv)
		die("Unable to mmap '%s': %m", argv[2]);
	/* Number of 16-byte paragraphs, including space for a 4-byte CRC */
	sys_size = (sz + 15 + 4) / 16;
#ifdef CONFIG_EFI_STUB
	/*
	 * COFF requires minimum 32-byte alignment of sections, and
	 * adding a signature is problematic without that alignment.
	 */
	sys_size = (sys_size + 1) & ~1;
#endif

	/* Patch the setup code with the appropriate size parameters */
	buf[0x1f1] = setup_sectors-1;
+1 −0
Original line number Diff line number Diff line
@@ -140,6 +140,7 @@ extern void __init efi_apply_memmap_quirks(void);
extern int __init efi_reuse_config(u64 tables, int nr_tables);
extern void efi_delete_dummy_variable(void);
extern void efi_switch_mm(struct mm_struct *mm);
extern void efi_recover_from_page_fault(unsigned long phys_addr);

struct efi_setup_data {
	u64 fw_vendor;
+9 −0
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@
#include <linux/prefetch.h>		/* prefetchw			*/
#include <linux/context_tracking.h>	/* exception_enter(), ...	*/
#include <linux/uaccess.h>		/* faulthandler_disabled()	*/
#include <linux/efi.h>			/* efi_recover_from_page_fault()*/
#include <linux/mm_types.h>

#include <asm/cpufeature.h>		/* boot_cpu_has, ...		*/
@@ -25,6 +26,7 @@
#include <asm/vsyscall.h>		/* emulate_vsyscall		*/
#include <asm/vm86.h>			/* struct vm86			*/
#include <asm/mmu_context.h>		/* vma_pkey()			*/
#include <asm/efi.h>			/* efi_recover_from_page_fault()*/

#define CREATE_TRACE_POINTS
#include <asm/trace/exceptions.h>
@@ -788,6 +790,13 @@ no_context(struct pt_regs *regs, unsigned long error_code,
	if (is_errata93(regs, address))
		return;

	/*
	 * Buggy firmware could access regions which might page fault, try to
	 * recover from such faults.
	 */
	if (IS_ENABLED(CONFIG_EFI))
		efi_recover_from_page_fault(address);

	/*
	 * Oops. The kernel tried to access some bad page. We'll have to
	 * terminate things with extreme prejudice:
+6 −2
Original line number Diff line number Diff line
@@ -26,12 +26,14 @@ static bool early_efi_keep;
 */
static __init int early_efi_map_fb(void)
{
	unsigned long base, size;
	u64 base, size;

	if (!early_efi_keep)
		return 0;

	base = boot_params.screen_info.lfb_base;
	if (boot_params.screen_info.capabilities & VIDEO_CAPABILITY_64BIT_BASE)
		base |= (u64)boot_params.screen_info.ext_lfb_base << 32;
	size = boot_params.screen_info.lfb_size;
	efi_fb = ioremap(base, size);

@@ -46,9 +48,11 @@ early_initcall(early_efi_map_fb);
 */
static __ref void *early_efi_map(unsigned long start, unsigned long len)
{
	unsigned long base;
	u64 base;

	base = boot_params.screen_info.lfb_base;
	if (boot_params.screen_info.capabilities & VIDEO_CAPABILITY_64BIT_BASE)
		base |= (u64)boot_params.screen_info.ext_lfb_base << 32;

	if (efi_fb)
		return (efi_fb + start);
Loading