diff options
author | Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> | 2012-10-22 11:35:16 -0400 |
---|---|---|
committer | Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> | 2013-02-19 21:59:47 -0500 |
commit | dacd45f4e793e46e8299c9a580e400866ffe0770 (patch) | |
tree | c42f689874c1b7953224921d15c415e1ce80269f | |
parent | 949db153b6466c6f7cad5a427ecea94985927311 (diff) |
xen/smp: Move the common CPU init code a bit to prep for PVH patch.
The PV and PVH code CPU init code share some functionality. The
PVH code ("xen/pvh: Extend vcpu_guest_context, p2m, event, and XenBus")
sets some of these up, but not all. To make it easier to read, this
patch removes the PV specific out of the generic way.
No functional change - just code movement.
Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
[v2: Fixed compile errors noticed by Fengguang Wu build system]
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
-rw-r--r-- | arch/x86/xen/smp.c | 42 |
1 files changed, 23 insertions, 19 deletions
diff --git a/arch/x86/xen/smp.c b/arch/x86/xen/smp.c index 34bc4cee8887..09ea61d2e02f 100644 --- a/arch/x86/xen/smp.c +++ b/arch/x86/xen/smp.c | |||
@@ -300,8 +300,6 @@ cpu_initialize_context(unsigned int cpu, struct task_struct *idle) | |||
300 | gdt = get_cpu_gdt_table(cpu); | 300 | gdt = get_cpu_gdt_table(cpu); |
301 | 301 | ||
302 | ctxt->flags = VGCF_IN_KERNEL; | 302 | ctxt->flags = VGCF_IN_KERNEL; |
303 | ctxt->user_regs.ds = __USER_DS; | ||
304 | ctxt->user_regs.es = __USER_DS; | ||
305 | ctxt->user_regs.ss = __KERNEL_DS; | 303 | ctxt->user_regs.ss = __KERNEL_DS; |
306 | #ifdef CONFIG_X86_32 | 304 | #ifdef CONFIG_X86_32 |
307 | ctxt->user_regs.fs = __KERNEL_PERCPU; | 305 | ctxt->user_regs.fs = __KERNEL_PERCPU; |
@@ -310,35 +308,41 @@ cpu_initialize_context(unsigned int cpu, struct task_struct *idle) | |||
310 | ctxt->gs_base_kernel = per_cpu_offset(cpu); | 308 | ctxt->gs_base_kernel = per_cpu_offset(cpu); |
311 | #endif | 309 | #endif |
312 | ctxt->user_regs.eip = (unsigned long)cpu_bringup_and_idle; | 310 | ctxt->user_regs.eip = (unsigned long)cpu_bringup_and_idle; |
313 | ctxt->user_regs.eflags = 0x1000; /* IOPL_RING1 */ | ||
314 | 311 | ||
315 | memset(&ctxt->fpu_ctxt, 0, sizeof(ctxt->fpu_ctxt)); | 312 | memset(&ctxt->fpu_ctxt, 0, sizeof(ctxt->fpu_ctxt)); |
316 | 313 | ||
317 | xen_copy_trap_info(ctxt->trap_ctxt); | 314 | { |
315 | ctxt->user_regs.eflags = 0x1000; /* IOPL_RING1 */ | ||
316 | ctxt->user_regs.ds = __USER_DS; | ||
317 | ctxt->user_regs.es = __USER_DS; | ||
318 | 318 | ||
319 | ctxt->ldt_ents = 0; | 319 | xen_copy_trap_info(ctxt->trap_ctxt); |
320 | 320 | ||
321 | BUG_ON((unsigned long)gdt & ~PAGE_MASK); | 321 | ctxt->ldt_ents = 0; |
322 | 322 | ||
323 | gdt_mfn = arbitrary_virt_to_mfn(gdt); | 323 | BUG_ON((unsigned long)gdt & ~PAGE_MASK); |
324 | make_lowmem_page_readonly(gdt); | ||
325 | make_lowmem_page_readonly(mfn_to_virt(gdt_mfn)); | ||
326 | 324 | ||
327 | ctxt->gdt_frames[0] = gdt_mfn; | 325 | gdt_mfn = arbitrary_virt_to_mfn(gdt); |
328 | ctxt->gdt_ents = GDT_ENTRIES; | 326 | make_lowmem_page_readonly(gdt); |
327 | make_lowmem_page_readonly(mfn_to_virt(gdt_mfn)); | ||
329 | 328 | ||
330 | ctxt->user_regs.cs = __KERNEL_CS; | 329 | ctxt->gdt_frames[0] = gdt_mfn; |
331 | ctxt->user_regs.esp = idle->thread.sp0 - sizeof(struct pt_regs); | 330 | ctxt->gdt_ents = GDT_ENTRIES; |
332 | 331 | ||
333 | ctxt->kernel_ss = __KERNEL_DS; | 332 | ctxt->kernel_ss = __KERNEL_DS; |
334 | ctxt->kernel_sp = idle->thread.sp0; | 333 | ctxt->kernel_sp = idle->thread.sp0; |
335 | 334 | ||
336 | #ifdef CONFIG_X86_32 | 335 | #ifdef CONFIG_X86_32 |
337 | ctxt->event_callback_cs = __KERNEL_CS; | 336 | ctxt->event_callback_cs = __KERNEL_CS; |
338 | ctxt->failsafe_callback_cs = __KERNEL_CS; | 337 | ctxt->failsafe_callback_cs = __KERNEL_CS; |
339 | #endif | 338 | #endif |
340 | ctxt->event_callback_eip = (unsigned long)xen_hypervisor_callback; | 339 | ctxt->event_callback_eip = |
341 | ctxt->failsafe_callback_eip = (unsigned long)xen_failsafe_callback; | 340 | (unsigned long)xen_hypervisor_callback; |
341 | ctxt->failsafe_callback_eip = | ||
342 | (unsigned long)xen_failsafe_callback; | ||
343 | } | ||
344 | ctxt->user_regs.cs = __KERNEL_CS; | ||
345 | ctxt->user_regs.esp = idle->thread.sp0 - sizeof(struct pt_regs); | ||
342 | 346 | ||
343 | per_cpu(xen_cr3, cpu) = __pa(swapper_pg_dir); | 347 | per_cpu(xen_cr3, cpu) = __pa(swapper_pg_dir); |
344 | ctxt->ctrlreg[3] = xen_pfn_to_cr3(virt_to_mfn(swapper_pg_dir)); | 348 | ctxt->ctrlreg[3] = xen_pfn_to_cr3(virt_to_mfn(swapper_pg_dir)); |