Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

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

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

Pull x86 fixes from Ingo Molnar:
 "Misc fixes:

   - fix the s2ram regression related to confusion around segment
     register restoration, plus related cleanups that make the code more
     robust

   - a guess-unwinder Kconfig dependency fix

   - an isoimage build target fix for certain tool chain combinations

   - instruction decoder opcode map fixes+updates, and the syncing of
     the kernel decoder headers to the objtool headers

   - a kmmio tracing fix

   - two 5-level paging related fixes

   - a topology enumeration fix on certain SMP systems"

* 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  objtool: Resync objtool's instruction decoder source code copy with the kernel's latest version
  x86/decoder: Fix and update the opcodes map
  x86/power: Make restore_processor_context() sane
  x86/power/32: Move SYSENTER MSR restoration to fix_processor_context()
  x86/power/64: Use struct desc_ptr for the IDT in struct saved_context
  x86/unwinder/guess: Prevent using CONFIG_UNWINDER_GUESS=y with CONFIG_STACKDEPOT=y
  x86/build: Don't verify mtools configuration file for isoimage
  x86/mm/kmmio: Fix mmiotrace for page unaligned addresses
  x86/boot/compressed/64: Print error if 5-level paging is not supported
  x86/boot/compressed/64: Detect and handle 5-level paging at boot-time
  x86/smpboot: Do not use smp_num_siblings in __max_logical_packages calculation
parents 1f76a755 215eada7
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -400,6 +400,7 @@ config UNWINDER_FRAME_POINTER
config UNWINDER_GUESS
	bool "Guess unwinder"
	depends on EXPERT
	depends on !STACKDEPOT
	---help---
	  This option enables the "guess" unwinder for unwinding kernel stack
	  traces.  It scans the stack and reports every kernel text address it
+1 −0
Original line number Diff line number Diff line
@@ -80,6 +80,7 @@ vmlinux-objs-$(CONFIG_RANDOMIZE_BASE) += $(obj)/kaslr.o
ifdef CONFIG_X86_64
	vmlinux-objs-$(CONFIG_RANDOMIZE_BASE) += $(obj)/pagetable.o
	vmlinux-objs-y += $(obj)/mem_encrypt.o
	vmlinux-objs-y += $(obj)/pgtable_64.o
endif

$(obj)/eboot.o: KBUILD_CFLAGS += -fshort-wchar -mno-red-zone
+12 −4
Original line number Diff line number Diff line
@@ -305,10 +305,18 @@ ENTRY(startup_64)
	leaq	boot_stack_end(%rbx), %rsp

#ifdef CONFIG_X86_5LEVEL
	/* Check if 5-level paging has already enabled */
	movq	%cr4, %rax
	testl	$X86_CR4_LA57, %eax
	jnz	lvl5
	/*
	 * Check if we need to enable 5-level paging.
	 * RSI holds real mode data and need to be preserved across
	 * a function call.
	 */
	pushq	%rsi
	call	l5_paging_required
	popq	%rsi

	/* If l5_paging_required() returned zero, we're done here. */
	cmpq	$0, %rax
	je	lvl5

	/*
	 * At this point we are in long mode with 4-level paging enabled,
+16 −0
Original line number Diff line number Diff line
@@ -169,6 +169,16 @@ void __puthex(unsigned long value)
	}
}

static bool l5_supported(void)
{
	/* Check if leaf 7 is supported. */
	if (native_cpuid_eax(0) < 7)
		return 0;

	/* Check if la57 is supported. */
	return native_cpuid_ecx(7) & (1 << (X86_FEATURE_LA57 & 31));
}

#if CONFIG_X86_NEED_RELOCS
static void handle_relocations(void *output, unsigned long output_len,
			       unsigned long virt_addr)
@@ -362,6 +372,12 @@ asmlinkage __visible void *extract_kernel(void *rmode, memptr heap,
	console_init();
	debug_putstr("early console in extract_kernel\n");

	if (IS_ENABLED(CONFIG_X86_5LEVEL) && !l5_supported()) {
		error("This linux kernel as configured requires 5-level paging\n"
			"This CPU does not support the required 'cr4.la57' feature\n"
			"Unable to boot - please use a kernel appropriate for your CPU\n");
	}

	free_mem_ptr     = heap;	/* Heap */
	free_mem_end_ptr = heap + BOOT_HEAP_SIZE;

+28 −0
Original line number Diff line number Diff line
#include <asm/processor.h>

/*
 * __force_order is used by special_insns.h asm code to force instruction
 * serialization.
 *
 * It is not referenced from the code, but GCC < 5 with -fPIE would fail
 * due to an undefined symbol. Define it to make these ancient GCCs work.
 */
unsigned long __force_order;

int l5_paging_required(void)
{
	/* Check if leaf 7 is supported. */

	if (native_cpuid_eax(0) < 7)
		return 0;

	/* Check if la57 is supported. */
	if (!(native_cpuid_ecx(7) & (1 << (X86_FEATURE_LA57 & 31))))
		return 0;

	/* Check if 5-level paging has already been enabled. */
	if (native_read_cr4() & X86_CR4_LA57)
		return 0;

	return 1;
}
Loading