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

[Xen-changelog] [xen-unstable] [IA64] Use virtualized psr in vcpu context instead of real psr.



# HG changeset patch
# User Alex Williamson <alex.williamson@xxxxxx>
# Date 1181682963 21600
# Node ID 171ec463e7ce7673edf1915a5c61420ade4bad1a
# Parent  601509daabfc0f33bae7cc5c07ef620b41c4a7a0
[IA64] Use virtualized psr in vcpu context instead of real psr.

Signed-off-by: Tristan Gingold <tgingold@xxxxxxx>
---
 tools/libxc/ia64/xc_ia64_hvm_build.c     |    6 ++
 tools/libxc/ia64/xc_ia64_linux_restore.c |   12 -----
 tools/libxc/xc_dom_ia64.c                |    6 +-
 xen/arch/ia64/vmx/vlsapic.c              |    7 ---
 xen/arch/ia64/xen/domain.c               |   63 ++++++++++++++-----------------
 xen/arch/ia64/xen/hypercall.c            |    6 --
 xen/arch/ia64/xen/vcpu.c                 |    2 
 7 files changed, 43 insertions(+), 59 deletions(-)

diff -r 601509daabfc -r 171ec463e7ce tools/libxc/ia64/xc_ia64_hvm_build.c
--- a/tools/libxc/ia64/xc_ia64_hvm_build.c      Tue Jun 12 15:07:05 2007 -0600
+++ b/tools/libxc/ia64/xc_ia64_hvm_build.c      Tue Jun 12 15:16:03 2007 -0600
@@ -1,3 +1,4 @@
+#include <asm/kregs.h>
 #include "xg_private.h"
 #include "xenguest.h"
 #include "xc_private.h"
@@ -1083,6 +1084,11 @@ xc_hvm_build(int xc_handle, uint32_t dom
     free(image);
 
     ctxt->regs.ip = 0x80000000ffffffb0UL;
+    ctxt->regs.ar.fpsr = xc_ia64_fpsr_default();
+    ctxt->regs.cr.isr = 1UL << 63;
+    ctxt->regs.psr = IA64_PSR_AC | IA64_PSR_BN;
+    ctxt->regs.cr.dcr = 0;
+    ctxt->regs.cr.pta = 15 << 2;
 
     memset(&launch_domctl, 0, sizeof(launch_domctl));
 
diff -r 601509daabfc -r 171ec463e7ce tools/libxc/ia64/xc_ia64_linux_restore.c
--- a/tools/libxc/ia64/xc_ia64_linux_restore.c  Tue Jun 12 15:07:05 2007 -0600
+++ b/tools/libxc/ia64/xc_ia64_linux_restore.c  Tue Jun 12 15:16:03 2007 -0600
@@ -227,17 +227,7 @@ xc_domain_restore(int xc_handle, int io_
 
     fprintf(stderr, "ip=%016lx, b0=%016lx\n", ctxt.regs.ip, ctxt.regs.b[0]);
 
-    /* First to initialize.  */
-    domctl.cmd = XEN_DOMCTL_setvcpucontext;
-    domctl.domain = (domid_t)dom;
-    domctl.u.vcpucontext.vcpu   = 0;
-    set_xen_guest_handle(domctl.u.vcpucontext.ctxt, &ctxt);
-    if (xc_domctl(xc_handle, &domctl) != 0) {
-        ERROR("Couldn't set vcpu context");
-        goto out;
-    }
-
-    /* Second to set registers...  */
+    /* Initialize and set registers.  */
     ctxt.flags = VGCF_EXTRA_REGS;
     domctl.cmd = XEN_DOMCTL_setvcpucontext;
     domctl.domain = (domid_t)dom;
diff -r 601509daabfc -r 171ec463e7ce tools/libxc/xc_dom_ia64.c
--- a/tools/libxc/xc_dom_ia64.c Tue Jun 12 15:07:05 2007 -0600
+++ b/tools/libxc/xc_dom_ia64.c Tue Jun 12 15:16:03 2007 -0600
@@ -13,6 +13,7 @@
 #include <string.h>
 #include <inttypes.h>
 #include <assert.h>
+#include <asm/kregs.h>
 
 #include <xen/xen.h>
 #include <xen/foreign/ia64.h>
@@ -106,9 +107,10 @@ static int vcpu_ia64(struct xc_dom_image
     memset(ctxt, 0, sizeof(*ctxt));
 
     ctxt->flags = 0;
-    ctxt->regs.psr = 0;        /* all necessary bits filled by hypervisor */
+    /* PSR is set according to SAL 3.2.4: AC, IC and BN are set. */
+    ctxt->regs.psr = IA64_PSR_AC | IA64_PSR_IC | IA64_PSR_BN;
     ctxt->regs.ip = dom->parms.virt_entry;
-    ctxt->regs.cfm = (uint64_t) 1 << 63;
+    ctxt->regs.cfm = 1UL << 63;
 #ifdef __ia64__                        /* FIXME */
     ctxt->regs.ar.fpsr = xc_ia64_fpsr_default();
 #endif
diff -r 601509daabfc -r 171ec463e7ce xen/arch/ia64/vmx/vlsapic.c
--- a/xen/arch/ia64/vmx/vlsapic.c       Tue Jun 12 15:07:05 2007 -0600
+++ b/xen/arch/ia64/vmx/vlsapic.c       Tue Jun 12 15:16:03 2007 -0600
@@ -696,11 +696,8 @@ static void vlsapic_write_ipi(VCPU *vcpu
         test_bit(_VPF_down, &targ->pause_flags)) {
 
         struct pt_regs *targ_regs = vcpu_regs(targ);
-        struct vcpu_guest_context c;
-
-        memset (&c, 0, sizeof(c));
-
-        if (arch_set_info_guest(targ, &c) != 0) {
+
+        if (arch_set_info_guest(targ, NULL) != 0) {
             printk("arch_boot_vcpu: failure\n");
             return;
         }
diff -r 601509daabfc -r 171ec463e7ce xen/arch/ia64/xen/domain.c
--- a/xen/arch/ia64/xen/domain.c        Tue Jun 12 15:07:05 2007 -0600
+++ b/xen/arch/ia64/xen/domain.c        Tue Jun 12 15:16:03 2007 -0600
@@ -622,12 +622,10 @@ void arch_get_info_guest(struct vcpu *v,
        c.nat->regs.r[10] = uregs->r10;
        c.nat->regs.r[11] = uregs->r11;
 
-       if (is_hvm) {
-               c.nat->regs.psr = vmx_vcpu_get_psr (v);
-       } else {
-               /* FIXME: get the vpsr.  */
-               c.nat->regs.psr = uregs->cr_ipsr;
-       }
+       if (is_hvm)
+               c.nat->regs.psr = vmx_vcpu_get_psr(v);
+       else
+               c.nat->regs.psr = vcpu_get_psr(v);
 
        c.nat->regs.ip = uregs->cr_iip;
        c.nat->regs.cfm = uregs->cr_ifs;
@@ -717,6 +715,26 @@ int arch_set_info_guest(struct vcpu *v, 
        struct domain *d = v->domain;
        int rc;
 
+       /* Finish vcpu initialization.  */
+       if (!v->is_initialised) {
+               if (d->arch.is_vti)
+                       rc = vmx_final_setup_guest(v);
+               else
+                       rc = vcpu_late_initialise(v);
+               if (rc != 0)
+                       return rc;
+
+               vcpu_init_regs(v);
+
+               v->is_initialised = 1;
+               /* Auto-online VCPU0 when it is initialised. */
+               if (v->vcpu_id == 0)
+                       clear_bit(_VPF_down, &v->pause_flags);
+       }
+
+       if (c.nat == NULL)
+               return 0;
+
        uregs->b6 = c.nat->regs.b[6];
        uregs->b7 = c.nat->regs.b[7];
        
@@ -727,8 +745,11 @@ int arch_set_info_guest(struct vcpu *v, 
        uregs->r9 = c.nat->regs.r[9];
        uregs->r10 = c.nat->regs.r[10];
        uregs->r11 = c.nat->regs.r[11];
-       
-       uregs->cr_ipsr = c.nat->regs.psr;
+
+       if (!d->arch.is_vti)
+               vcpu_set_psr(v, c.nat->regs.psr);
+       else
+               vmx_vcpu_set_psr(v, c.nat->regs.psr);
        uregs->cr_iip = c.nat->regs.ip;
        uregs->cr_ifs = c.nat->regs.cfm;
        
@@ -813,32 +834,6 @@ int arch_set_info_guest(struct vcpu *v, 
                v->arch.iva = c.nat->regs.cr.iva;
        }
 
-       if (v->is_initialised)
-               return 0;
-
-       if (d->arch.is_vti) {
-               rc = vmx_final_setup_guest(v);
-               if (rc != 0)
-                       return rc;
-       } else {
-               rc = vcpu_late_initialise(v);
-               if (rc != 0)
-                       return rc;
-               VCPU(v, interrupt_mask_addr) = 
-                       (unsigned char *) d->arch.shared_info_va +
-                       INT_ENABLE_OFFSET(v);
-       }
-
-       /* This overrides some registers. */
-       vcpu_init_regs(v);
-
-       if (!v->is_initialised) {
-               v->is_initialised = 1;
-               /* Auto-online VCPU0 when it is initialised. */
-               if (v->vcpu_id == 0)
-                       clear_bit(_VPF_down, &v->pause_flags);
-       }
-
        return 0;
 }
 
diff -r 601509daabfc -r 171ec463e7ce xen/arch/ia64/xen/hypercall.c
--- a/xen/arch/ia64/xen/hypercall.c     Tue Jun 12 15:07:05 2007 -0600
+++ b/xen/arch/ia64/xen/hypercall.c     Tue Jun 12 15:16:03 2007 -0600
@@ -86,11 +86,7 @@ fw_hypercall_ipi (struct pt_regs *regs)
 
                /* First start: initialize vpcu.  */
                if (!targ->is_initialised) {
-                       struct vcpu_guest_context c;
-               
-                       memset (&c, 0, sizeof (c));
-
-                       if (arch_set_info_guest (targ, &c) != 0) {
+                       if (arch_set_info_guest (targ, NULL) != 0) {
                                printk ("arch_boot_vcpu: failure\n");
                                return;
                        }
diff -r 601509daabfc -r 171ec463e7ce xen/arch/ia64/xen/vcpu.c
--- a/xen/arch/ia64/xen/vcpu.c  Tue Jun 12 15:07:05 2007 -0600
+++ b/xen/arch/ia64/xen/vcpu.c  Tue Jun 12 15:16:03 2007 -0600
@@ -182,8 +182,6 @@ void vcpu_init_regs(struct vcpu *v)
                    INT_ENABLE_OFFSET(v);
                VCPU(v, itv) = (1 << 16);       /* timer vector masked */
 
-               /* SAL specification 3.2.4 */
-               VCPU(v, vpsr) = IA64_PSR_AC | IA64_PSR_IC | IA64_PSR_BN;
                v->vcpu_info->evtchn_upcall_pending = 0;
                v->vcpu_info->evtchn_upcall_mask = -1;
        }

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

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