xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Mukesh Rathor <mukesh.rathor@oracle.com>
To: George Dunlap <George.Dunlap@eu.citrix.com>
Cc: xen-devel <xen-devel@lists.xenproject.org>,
	Jan Beulich <JBeulich@suse.com>
Subject: Re: [V11 PATCH 00/21]PVH xen: Phase I, Version 11 patches...
Date: Tue, 27 Aug 2013 17:37:29 -0700	[thread overview]
Message-ID: <20130827173729.1ecfe48e@mantra.us.oracle.com> (raw)
In-Reply-To: <CAFLBxZbKjXn9Dy-Ktmg5srwO5R8mZ+jWySDKYXRdK-Hu1yWFBQ@mail.gmail.com>

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

> On Sat, Aug 24, 2013 at 1:40 AM, Mukesh Rathor
> <mukesh.rathor@oracle.com> wrote:
> > On Fri, 23 Aug 2013 13:05:08 +0100
> > "Jan Beulich" <JBeulich@suse.com> wrote:
> >
> >> >>> On 23.08.13 at 13:15, George Dunlap
> >> >>> <George.Dunlap@eu.citrix.com> wrote:
> >> > On Fri, Aug 23, 2013 at 9:49 AM, Jan Beulich <JBeulich@suse.com>
> >> > 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();

  parent reply	other threads:[~2013-08-28  0:37 UTC|newest]

Thread overview: 49+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-23  1:18 [V11 PATCH 00/21]PVH xen: Phase I, Version 11 patches Mukesh Rathor
2013-08-23  1:18 ` [V11 PATCH 01/21] PVH xen: Add readme docs/misc/pvh-readme.txt Mukesh Rathor
2013-08-23  1:18 ` [V11 PATCH 02/21] PVH xen: add params to read_segment_register Mukesh Rathor
2013-08-23  1:18 ` [V11 PATCH 03/21] PVH xen: Move e820 fields out of pv_domain struct Mukesh Rathor
2013-08-23  1:18 ` [V11 PATCH 04/21] PVH xen: hvm related preparatory changes for PVH Mukesh Rathor
2013-08-23  1:18 ` [V11 PATCH 05/21] PVH xen: vmx " Mukesh Rathor
2013-08-23  1:18 ` [V11 PATCH 06/21] PVH xen: vmcs " Mukesh Rathor
2013-08-23  1:18 ` [V11 PATCH 07/21] PVH xen: Introduce PVH guest type and some basic changes Mukesh Rathor
2013-08-23  1:18 ` [V11 PATCH 08/21] PVH xen: introduce pvh_vcpu_boot_set_info() and vmx_pvh_vcpu_boot_set_info() Mukesh Rathor
2013-08-23  1:18 ` [V11 PATCH 09/21] PVH xen: domain create, context switch related code changes Mukesh Rathor
2013-08-23  8:12   ` Jan Beulich
2013-08-23  1:18 ` [V11 PATCH 10/21] PVH xen: support invalid op emulation for PVH Mukesh Rathor
2013-08-23  1:19 ` [V11 PATCH 11/21] PVH xen: Support privileged " Mukesh Rathor
2013-08-23  1:19 ` [V11 PATCH 12/21] PVH xen: interrupt/event-channel delivery to PVH Mukesh Rathor
2013-08-23  1:19 ` [V11 PATCH 13/21] PVH xen: additional changes to support PVH guest creation and execution Mukesh Rathor
2013-08-23  1:19 ` [V11 PATCH 14/21] PVH xen: mapcache and show registers Mukesh Rathor
2013-08-23  1:19 ` [V11 PATCH 15/21] PVH xen: mtrr, tsc, timers, grant changes Mukesh Rathor
2013-08-23  1:19 ` [V11 PATCH 16/21] PVH xen: add hypercall support for PVH Mukesh Rathor
2013-08-23  1:19 ` [V11 PATCH 17/21] PVH xen: vmcs related changes Mukesh Rathor
2013-08-23  8:41   ` Jan Beulich
2013-08-24  0:26     ` Mukesh Rathor
2013-08-26  8:15       ` Jan Beulich
2013-08-27 17:00       ` George Dunlap
2013-08-27 22:43         ` Mukesh Rathor
2013-08-23  1:19 ` [V11 PATCH 18/21] PVH xen: HVM support of PVH guest creation/destruction Mukesh Rathor
2013-08-23  1:19 ` [V11 PATCH 19/21] PVH xen: VMX " Mukesh Rathor
2013-08-23  9:14   ` Jan Beulich
2013-08-24  0:27     ` Mukesh Rathor
2013-08-23  1:19 ` [V11 PATCH 20/21] PVH xen: introduce vmexit handler for PVH Mukesh Rathor
2013-08-23  9:12   ` Jan Beulich
2013-08-24  0:35     ` Mukesh Rathor
2013-08-26  8:22       ` Jan Beulich
2013-08-23  1:19 ` [V11 PATCH 21/21] PVH xen: Checks, asserts, and limitations " Mukesh Rathor
2013-08-23  8:49 ` [V11 PATCH 00/21]PVH xen: Phase I, Version 11 patches Jan Beulich
2013-08-23 11:15   ` George Dunlap
2013-08-23 12:05     ` Jan Beulich
2013-08-24  0:40       ` Mukesh Rathor
2013-08-27 17:05         ` George Dunlap
2013-08-27 19:18           ` Mukesh Rathor
2013-08-28 11:20             ` George Dunlap
2013-08-29  0:16               ` Mukesh Rathor
2013-08-28  0:37           ` Mukesh Rathor [this message]
2013-08-29 16:28             ` George Dunlap
2013-08-30  0:25               ` Mukesh Rathor
2013-08-30 11:02                 ` George Dunlap
2013-08-30 17:21                   ` George Dunlap
2013-08-30 21:22                     ` Mukesh Rathor
2013-09-02 14:52                       ` George Dunlap
2013-09-06  1:07                         ` Mukesh Rathor

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20130827173729.1ecfe48e@mantra.us.oracle.com \
    --to=mukesh.rathor@oracle.com \
    --cc=George.Dunlap@eu.citrix.com \
    --cc=JBeulich@suse.com \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).