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

[XenPPC][Patch 2/3] xen patches for xm save/restore



diff -r 9148f7816d00 xen/arch/powerpc/domain.c
--- a/xen/arch/powerpc/domain.c    Tue Oct 24 19:11:00 2006 -0400
+++ b/xen/arch/powerpc/domain.c    Wed Nov 01 10:15:32 2006 -0500
@@ -143,7 +143,32 @@ void free_vcpu_struct(struct vcpu *v)

 int arch_set_info_guest(struct vcpu *v, vcpu_guest_context_t *c)
 {
+    int i;
+
     memcpy(&v->arch.ctxt, &c->user_regs, sizeof(c->user_regs));
+
+    for ( i = 0; i < NUM_SLB_ENTRIES; i++) {
+ memcpy(&v->arch.slb_entries[i], &c->slb_entries[i], sizeof(struct slb_entry));
+    }
+
+    for ( i = 0; i< 4; i++) v->arch.sprg[i] = c->sprg[i];
+
+    v->arch.timebase = c->timebase;
+    v->arch.dar = c->dar;
+    v->arch.dsisr = c->dsisr;
+
+    memcpy( &v->arch.cpu, &c->cpu, sizeof(struct cpu_vcpu));
+    v->arch.dec = c->dec;
+
+#ifdef HAS_FLOAT
+    memcpy( v->arch.fprs, c->fprs, sizeof(double)*NUM_FPRS);
+#endif /* HAS_FLOAT */
+
+#ifdef HAS_VMX
+    memcpy( &v->arch.vrs, &c->vrs, sizeof(vector128)*32);
+    memcpy( &v->arch.vscr, &c->vscr, sizeof(vector128));
+    v->arch.vrsave = c->vrsave;
+#endif /* HAS_VMX */

     printf("Domain[%d].%d: initializing\n",
            v->domain->domain_id, v->vcpu_id);
diff -r 9148f7816d00 xen/arch/powerpc/domctl.c
--- a/xen/arch/powerpc/domctl.c    Tue Oct 24 19:11:00 2006 -0400
+++ b/xen/arch/powerpc/domctl.c    Wed Nov 01 10:19:12 2006 -0500
@@ -29,10 +29,37 @@
 #include <public/sysctl.h>
 #include <asm/processor.h>

+#define        DECOR   0x80000000      // indicates htab address
+
+
 void arch_getdomaininfo_ctxt(struct vcpu *, vcpu_guest_context_t *);
 void arch_getdomaininfo_ctxt(struct vcpu *v, vcpu_guest_context_t *c)
 {
+    int i;
+
     memcpy(&c->user_regs, &v->arch.ctxt, sizeof(struct cpu_user_regs));
+    for (i = 0; i < NUM_SLB_ENTRIES; i++) {
+ memcpy(&c->slb_entries[i],&v->arch.slb_entries[i],sizeof(struct slb_entry));
+    }
+
+    for (i = 0; i < 4; i++) c->sprg[i] = v->arch.sprg[i] ;
+    c->timebase = v->arch.timebase;
+    c->dar = v->arch.dar;
+    c->dsisr = v->arch.dsisr;
+    memcpy(&c->cpu,&v->arch.cpu,sizeof(struct cpu_vcpu));
+    c->dec = v->arch.dec;
+
+#ifdef HAS_FLOAT
+    memcpy(c->fprs,v->arch.fprs,sizeof(double)*NUM_FPRS);
+#endif         /*  HAS_FLOAT */
+
+#ifdef HAS_VMX
+    memcpy(c->vrs, v->arch.vrs, sizeof(vector128)*32);
+    memcpy(&c->vscr, &v->arch.vscr, sizeof(vector128));
+    c->vrsave = v->arch.vrsave;
+#endif /* HAS_VMX */
+
+
     /* XXX fill in rest of vcpu_guest_context_t */
 }

@@ -109,6 +136,52 @@ long arch_do_domctl(struct xen_domctl *d
     }
     break;

+    case XEN_DOMCTL_getshadowlist:
+    {
+       struct domain *d = find_domain_by_id(domctl->domain);
+       uint num_ptes;
+
+       printk(" XEN_DOMCTL_getshadowlist: \n");
+
+       ret = -EINVAL;
+       if ( d != NULL)
+       {
+          ret = 0;
+
+          domctl->u.getshadowlist.htab_map = (uint64_t)(d->arch.htab.map);
+          printk("htab_map: 0x%016lx\n",(uint64_t)(d->arch.htab.map));
+
+          num_ptes = 1UL << d->arch.htab.log_num_ptes;
+          domctl->u.getshadowlist.htab_num_ptes = num_ptes;
+
+          printk("num_ptes : %d \n",num_ptes);
+          copy_to_guest(u_domctl, domctl, 1);
+#if 0
+       // Print out Shadow Htab pages
+       {
+          uint64_t htab_rpn;
+          int i =0;
+          uint64_t htab_addr = domctl->u.getshadowlist.htab_map;
+          union pte *ppte = (union pte *)htab_addr;
+
+
+          printk("htab valid entry: \n");
+          for( i= 0 ; i< (PAGE_SIZE/ (1UL<< LOG_PTE_SIZE)) ; i++,ppte++)
+          //for( i= 0 ; i< num_ptes ; i++,ppte++)
+          {
+        //     if (ppte->bits.v == 1)
+               {
+                       htab_rpn = ppte->bits.rpn;
+ printk("htab : i %d, vsid %llx, rpn %llx \n", i, (unsigned long long)ppte->words.vsid, (unsigned long long)ppte->words.rpn);
+               }
+          }
+        }
+#endif
+          put_domain(d);
+       }
+    }
+    break;
+
     default:
         ret = -ENOSYS;
         break;
diff -r 9148f7816d00 xen/arch/powerpc/mm.c
--- a/xen/arch/powerpc/mm.c    Tue Oct 24 19:11:00 2006 -0400
+++ b/xen/arch/powerpc/mm.c    Wed Nov 01 10:20:33 2006 -0500
@@ -36,6 +36,8 @@
 #define MEM_LOG(_f, _a...) ((void)0)
 #endif

+#define        DECOR 0x80000000UL
+
 /* Frame table and its size in pages. */
 struct page_info *frame_table;
 unsigned long max_page;
@@ -386,6 +388,13 @@ ulong pfn2mfn(struct domain *d, ulong pf
     ulong foreign_map_pfn = 1UL << cpu_foreign_map_order();

     /* quick tests first */
+    if (pfn & DECOR)
+    {
+        //t = PFN_TYPE_FOREIGN;
+        mfn = pfn & ~DECOR;
+       //DPRINTK("pfn2mfn DECOR %lx  mfn %lx\n",pfn,mfn);
+    }
+    else
     if (pfn & foreign_map_pfn) {
         t = PFN_TYPE_FOREIGN;
         mfn = pfn & ~(foreign_map_pfn);


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


 


Rackspace

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