mirror of
https://github.com/xen-project/xen.git
synced 2026-10-28 02:01:24 +01:00
x86/traps: Move traps_init() earlier on boot
We wish to make use of opt_fred earlier on boot, which involves moving traps_init() earlier, but this comes with several ordering complications. The feature word containing FRED needs collecting in early_cpu_init(), and legacy_syscall_init() cannot be moved that early because it relies on the stubs being allocated, yet must be called ahead of cpu_init() so the SYSCALL linkage MSRs are set up before being cached. Delaying legacy_syscall_init() is easy enough based on a system_state check. Reuse bsp_traps_reinit() to cause a call to legacy_syscall_init() to occur at the same point as previously. Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com> Reviewed-by: Jan Beulich <jbeulich@suse.com>
This commit is contained in:
1 parent
c2f15b0fff
commit
8e4775d118
3 files changed
+17
-3
No files matched your search
@@ -407,7 +407,9 @@ void __init early_cpu_init(bool verbose)
|
||||
}
|
||||
|
||||
if (max_subleaf >= 1)
|
||||
cpuid_count(7, 1, &eax, &ebx, &ecx,
|
||||
cpuid_count(7, 1,
|
||||
&c->x86_capability[FEATURESET_7a1],
|
||||
&ebx, &ecx,
|
||||
&c->x86_capability[FEATURESET_7d1]);
|
||||
}
|
||||
|
||||
|
||||
@@ -1386,6 +1386,8 @@ void asmlinkage __init noreturn __start_xen(void)
|
||||
else
|
||||
panic("Bootloader provided no memory information\n");
|
||||
|
||||
traps_init();
|
||||
|
||||
/* Choose shadow stack early, to set infrastructure up appropriately. */
|
||||
if ( !boot_cpu_has(X86_FEATURE_CET_SS) )
|
||||
opt_xen_shstk = 0;
|
||||
@@ -2078,7 +2080,7 @@ void asmlinkage __init noreturn __start_xen(void)
|
||||
&this_cpu(stubs).mfn);
|
||||
BUG_ON(!this_cpu(stubs.addr));
|
||||
|
||||
traps_init(); /* Needs stubs allocated, must be before presmp_initcalls. */
|
||||
bsp_traps_reinit(); /* Needs stubs allocated, must be before presmp_initcalls. */
|
||||
|
||||
cpu_init();
|
||||
|
||||
|
||||
@@ -346,6 +346,10 @@ void __init traps_init(void)
|
||||
|
||||
/*
|
||||
* Re-initialise all state referencing the early-boot stack.
|
||||
*
|
||||
* This is called twice during boot, first to ensure legacy_syscall_init() has
|
||||
* run (deferred from earlier), and second when the virtual address of the BSP
|
||||
* stack changes.
|
||||
*/
|
||||
void __init bsp_traps_reinit(void)
|
||||
{
|
||||
@@ -359,7 +363,13 @@ void __init bsp_traps_reinit(void)
|
||||
*/
|
||||
void percpu_traps_init(void)
|
||||
{
|
||||
legacy_syscall_init();
|
||||
/*
|
||||
* Skip legacy_syscall_init() at early boot. It requires the stubs being
|
||||
* allocated, limiting the placement of the traps_init() call, and gets
|
||||
* re-done anyway by bsp_traps_reinit().
|
||||
*/
|
||||
if ( system_state > SYS_STATE_early_boot )
|
||||
legacy_syscall_init();
|
||||
|
||||
if ( cpu_has_xen_lbr )
|
||||
wrmsrl(MSR_IA32_DEBUGCTLMSR, IA32_DEBUGCTLMSR_LBR);
|
||||
|
||||