[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [V11 PATCH 00/21]PVH xen: Phase I, Version 11 patches...



On Tue, 27 Aug 2013 18:05:00 +0100
George Dunlap <George.Dunlap@xxxxxxxxxxxxx> wrote:

> On Sat, Aug 24, 2013 at 1:40 AM, Mukesh Rathor
> <mukesh.rathor@xxxxxxxxxx> wrote:
> > On Fri, 23 Aug 2013 13:05:08 +0100
> > "Jan Beulich" <JBeulich@xxxxxxxx> wrote:
> >
> >> >>> On 23.08.13 at 13:15, George Dunlap
> >> >>> <George.Dunlap@xxxxxxxxxxxxx> wrote:
> >> > On Fri, Aug 23, 2013 at 9:49 AM, Jan Beulich <JBeulich@xxxxxxxx>
> >> > wrote:
> >> >>>>> On 23.08.13 at 03:18, Mukesh Rathor
.......
> >> Fine with me, but perhaps Mukesh won't be that happy...
> >
> > It's OK. I'd like this to be merged in asap so I and others can
> > working on the FIXME's right away...
> 
> I'm still waiting on the toolstack changes that are needed to actually
> put it in PVH mode before I can test it.

Also, for V11 you'd need following patch for linux:

diff --git a/arch/x86/xen/smp.c b/arch/x86/xen/smp.c
index 7cd47a7..747057e 100644
--- a/arch/x86/xen/smp.c
+++ b/arch/x86/xen/smp.c
@@ -94,8 +94,33 @@ static void __cpuinit cpu_bringup(void)
        wmb();                  /* make sure everything is out */
 }
 
+static void pvh_set_bringup_context(void)
+{
+        int cpu = smp_processor_id();
+
+        load_percpu_segment(cpu);
+        switch_to_new_gdt(smp_processor_id());
+
+        /* loadsegment(es, 0); */
+
+        __asm__ __volatile__ (
+                "movl %0,%%ds\n"
+                "movl %0,%%ss\n"
+                "pushq %%rax\n"
+                "leaq 1f(%%rip),%%rax\n"
+                "pushq %%rax\n"
+                "retfq\n"
+                "1:\n"
+                : : "r" (__KERNEL_DS), "a" (__KERNEL_CS) : "memory");
+}
+
+
 static void __cpuinit cpu_bringup_and_idle(void)
 {
+        if (xen_feature(XENFEAT_auto_translated_physmap) &&
+            xen_feature(XENFEAT_supervisor_mode_kernel))
+                pvh_set_bringup_context();
+
        cpu_bringup();
        cpu_idle();
 }
@@ -302,38 +327,23 @@ cpu_initialize_context(unsigned int cpu, struct 
task_struct *idle)
 
        gdt = get_cpu_gdt_table(cpu);
 
-       ctxt->flags = VGCF_IN_KERNEL;
-       ctxt->user_regs.ss = __KERNEL_DS;
 #ifdef CONFIG_X86_32
        ctxt->user_regs.fs = __KERNEL_PERCPU;
        ctxt->user_regs.gs = __KERNEL_STACK_CANARY;
 #else
+       /* Note: PVH is not yet supported on x86_32. */
        ctxt->gs_base_kernel = per_cpu_offset(cpu);
 #endif
        ctxt->user_regs.eip = (unsigned long)cpu_bringup_and_idle;
 
        memset(&ctxt->fpu_ctxt, 0, sizeof(ctxt->fpu_ctxt));
 
-       if (xen_feature(XENFEAT_auto_translated_physmap) &&
-           xen_feature(XENFEAT_supervisor_mode_kernel)) {
-               /* Note: PVH is not supported on x86_32. */
-#ifdef CONFIG_X86_64
-               ctxt->user_regs.ds = __KERNEL_DS;
-               ctxt->user_regs.es = 0;
-               ctxt->user_regs.gs = 0;
-
-               /* GUEST_GDTR_BASE and */
-               ctxt->u.pvh.gdtaddr = (unsigned long)gdt;
-               /* GUEST_GDTR_LIMIT in the VMCS. */
-               ctxt->u.pvh.gdtsz = (unsigned long)(GDT_SIZE - 1);
-
-               ctxt->gs_base_user = (unsigned long)
-                                       per_cpu(irq_stack_union.gs_base, cpu);
-#endif
-       } else {
+       if (!xen_feature(XENFEAT_auto_translated_physmap)) {
+               ctxt->flags = VGCF_IN_KERNEL;
                ctxt->user_regs.eflags = 0x1000; /* IOPL_RING1 */
                ctxt->user_regs.ds = __USER_DS;
                ctxt->user_regs.es = __USER_DS;
+               ctxt->user_regs.ss = __KERNEL_DS;
 
                xen_copy_trap_info(ctxt->trap_ctxt);
 
@@ -359,13 +369,12 @@ cpu_initialize_context(unsigned int cpu, struct 
task_struct *idle)
                                        (unsigned long)xen_hypervisor_callback;
                ctxt->failsafe_callback_eip =
                                        (unsigned long)xen_failsafe_callback;
+               ctxt->user_regs.cs = __KERNEL_CS;
+               per_cpu(xen_cr3, cpu) = __pa(swapper_pg_dir);
        }
-       ctxt->user_regs.cs = __KERNEL_CS;
-       ctxt->user_regs.esp = idle->thread.sp0 - sizeof(struct pt_regs);
 
-       per_cpu(xen_cr3, cpu) = __pa(swapper_pg_dir);
+       ctxt->user_regs.esp = idle->thread.sp0 - sizeof(struct pt_regs);
        ctxt->ctrlreg[3] = xen_pfn_to_cr3(virt_to_mfn(swapper_pg_dir));
-
        if (HYPERVISOR_vcpu_op(VCPUOP_initialise, cpu, ctxt))
                BUG();
 




_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.