Skip to content

Commit

Permalink
x86/kaiser: Move feature detection up
Browse files Browse the repository at this point in the history
... before the first use of kaiser_enabled as otherwise funky
things happen:

  about to get started...
  (XEN) d0v0 Unhandled page fault fault/trap [#14, ec=0000]
  (XEN) Pagetable walk from ffff88022a449090:
  (XEN)  L4[0x110] = 0000000229e0e067 0000000000001e0e
  (XEN)  L3[0x008] = 0000000000000000 ffffffffffffffff
  (XEN) domain_crash_sync called from entry.S: fault at ffff82d08033fd08
  entry.o#create_bounce_frame+0x135/0x14d
  (XEN) Domain 0 (vcpu#0) crashed on cpu#0:
  (XEN) ----[ Xen-4.9.1_02-3.21  x86_64  debug=n   Not tainted ]----
  (XEN) CPU:    0
  (XEN) RIP:    e033:[<ffffffff81007460>]
  (XEN) RFLAGS: 0000000000000286   EM: 1   CONTEXT: pv guest (d0v0)

Signed-off-by: Borislav Petkov <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
  • Loading branch information
suryasaimadhu authored and gregkh committed Jan 5, 2018
1 parent e4ba212 commit 7f79599
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
2 changes: 2 additions & 0 deletions arch/x86/include/asm/kaiser.h
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,10 @@ DECLARE_PER_CPU(unsigned long, x86_cr3_pcid_user);
extern char __per_cpu_user_mapped_start[], __per_cpu_user_mapped_end[];

extern int kaiser_enabled;
extern void __init kaiser_check_boottime_disable(void);
#else
#define kaiser_enabled 0
static inline void __init kaiser_check_boottime_disable(void) {}
#endif /* CONFIG_KAISER */

/*
Expand Down
7 changes: 7 additions & 0 deletions arch/x86/kernel/setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@
#include <asm/alternative.h>
#include <asm/prom.h>
#include <asm/microcode.h>
#include <asm/kaiser.h>

/*
* max_low_pfn_mapped: highest direct mapped pfn under 4GB
Expand Down Expand Up @@ -1016,6 +1017,12 @@ void __init setup_arch(char **cmdline_p)
*/
init_hypervisor_platform();

/*
* This needs to happen right after XENPV is set on xen and
* kaiser_enabled is checked below in cleanup_highmap().
*/
kaiser_check_boottime_disable();

x86_init.resources.probe_roms();

/* after parse_early_param, so could debug it */
Expand Down
2 changes: 0 additions & 2 deletions arch/x86/mm/kaiser.c
Original file line number Diff line number Diff line change
Expand Up @@ -311,8 +311,6 @@ void __init kaiser_init(void)
{
int cpu;

kaiser_check_boottime_disable();

if (!kaiser_enabled)
return;

Expand Down

0 comments on commit 7f79599

Please sign in to comment.