mirror of
https://github.com/xen-project/xen.git
synced 2026-10-28 02:01:24 +01:00
x86/boot: Move gdt_l1e caching out of traps_init()
Commit 564d261687 ("x86/ctxt-switch: Document and improve GDT handling") put
the initialisation of {,compat_}gdt_l1e into traps_init() but this wasn't a
great choice. Instead, put it in smp_prepare_cpus() which performs the BSP
preparation of variables normally set up by cpu_smpboot_alloc() for APs.
This removes an implicit dependency that prevents traps_init() moving earlier
than move_xen() in the boot sequence.
No functional change.
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
This commit is contained in:
1 parent
31cbb8e2a5
commit
a1e6afbf54
3 files changed
+13
-7
No files matched your search
@@ -2029,6 +2029,8 @@ static always_inline bool need_full_gdt(const struct domain *d)
|
||||
|
||||
static void update_xen_slot_in_full_gdt(const struct vcpu *v, unsigned int cpu)
|
||||
{
|
||||
ASSERT(per_cpu(gdt_l1e, cpu).l1); /* Confirm these have been cached. */
|
||||
|
||||
l1e_write(pv_gdt_ptes(v) + FIRST_RESERVED_GDT_PAGE,
|
||||
!is_pv_32bit_vcpu(v) ? per_cpu(gdt_l1e, cpu)
|
||||
: per_cpu(compat_gdt_l1e, cpu));
|
||||
|
||||
@@ -1167,6 +1167,17 @@ void __init smp_prepare_cpus(void)
|
||||
initialize_cpu_data(0); /* Final full version of the data */
|
||||
print_cpu_info(0);
|
||||
|
||||
/*
|
||||
* Cache {,compat_}gdt_l1e for the BSP now that physically relocation is
|
||||
* done. It must be after physical relocation of Xen, and before the
|
||||
* first context_switch().
|
||||
*/
|
||||
this_cpu(gdt_l1e) =
|
||||
l1e_from_pfn(virt_to_mfn(boot_gdt), __PAGE_HYPERVISOR_RW);
|
||||
if ( IS_ENABLED(CONFIG_PV32) )
|
||||
this_cpu(compat_gdt_l1e) =
|
||||
l1e_from_pfn(virt_to_mfn(boot_compat_gdt), __PAGE_HYPERVISOR_RW);
|
||||
|
||||
boot_cpu_physical_apicid = get_apic_id();
|
||||
x86_cpu_to_apicid[0] = boot_cpu_physical_apicid;
|
||||
|
||||
|
||||
@@ -341,13 +341,6 @@ void __init traps_init(void)
|
||||
|
||||
init_ler();
|
||||
|
||||
/* Cache {,compat_}gdt_l1e now that physically relocation is done. */
|
||||
this_cpu(gdt_l1e) =
|
||||
l1e_from_pfn(virt_to_mfn(boot_gdt), __PAGE_HYPERVISOR_RW);
|
||||
if ( IS_ENABLED(CONFIG_PV32) )
|
||||
this_cpu(compat_gdt_l1e) =
|
||||
l1e_from_pfn(virt_to_mfn(boot_compat_gdt), __PAGE_HYPERVISOR_RW);
|
||||
|
||||
percpu_traps_init();
|
||||
}
|
||||
|
||||
|
||||