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

[Xen-changelog] Merge maf46@xxxxxxxxxxxxxxxxxxxxxxx:/usr/groups/xeno/BK/xen-unstable.bk



ChangeSet 1.1271, 2005/04/05 12:58:00+01:00, mafetter@xxxxxxxxxxxxxxxx

        Merge maf46@xxxxxxxxxxxxxxxxxxxxxxx:/usr/groups/xeno/BK/xen-unstable.bk
        into fleming.research:/scratch/fleming/mafetter/xen.work
        
        Signed-off-by: michael.fetterman@xxxxxxxxxxxx



 domain_build.c |   58 ++++++++++++++++++++++++++++++++++++++++++++++++++++-----
 1 files changed, 53 insertions(+), 5 deletions(-)


diff -Nru a/xen/arch/x86/domain_build.c b/xen/arch/x86/domain_build.c
--- a/xen/arch/x86/domain_build.c       2005-04-05 12:22:47 -04:00
+++ b/xen/arch/x86/domain_build.c       2005-04-05 12:22:47 -04:00
@@ -25,6 +25,12 @@
 static unsigned int opt_dom0_mem = 0;
 integer_unit_param("dom0_mem", opt_dom0_mem);
 
+static unsigned int opt_dom0_shadow = 0;
+boolean_param("dom0_shadow", opt_dom0_shadow);
+
+static unsigned int opt_dom0_translate = 0;
+boolean_param("dom0_translate", opt_dom0_translate);
+
 #if defined(__i386__)
 /* No ring-3 access in initial leaf page tables. */
 #define L1_PROT (_PAGE_PRESENT|_PAGE_RW|_PAGE_ACCESSED)
@@ -103,6 +109,7 @@
     unsigned long mpt_alloc;
 
     extern void physdev_init_dom0(struct domain *);
+    extern void translate_l2pgtable(struct domain *d, l1_pgentry_t *p2m, 
unsigned long l2mfn);
 
     /* Sanity! */
     if ( d->id != 0 ) 
@@ -270,8 +277,13 @@
     l1tab += l1_table_offset(vpt_start);
     for ( count = 0; count < nr_pt_pages; count++ ) 
     {
-        *l1tab = mk_l1_pgentry(l1_pgentry_val(*l1tab) & ~_PAGE_RW);
         page = &frame_table[l1_pgentry_to_pfn(*l1tab)];
+        if ( !opt_dom0_shadow )
+            *l1tab = mk_l1_pgentry(l1_pgentry_val(*l1tab) & ~_PAGE_RW);
+        else
+            if ( !get_page_type(page, PGT_writable_page) )
+                BUG();
+
         if ( count == 0 )
         {
             page->u.inuse.type_info &= ~PGT_type_mask;
@@ -414,7 +426,7 @@
         d->shared_info->vcpu_data[i].evtchn_upcall_mask = 1;
     d->shared_info->n_vcpu = smp_num_cpus;
 
-    /* Set up shadow and monitor tables. */
+    /* Set up monitor table */
     update_pagetables(ed);
 
     /* Install the new page tables. */
@@ -434,12 +446,24 @@
         init_domheap_pages(
             _initrd_start, (_initrd_start+initrd_len+PAGE_SIZE-1) & PAGE_MASK);
     }
-    
+
+    d->next_io_page = max_page;
+
     /* Set up start info area. */
     si = (start_info_t *)vstartinfo_start;
     memset(si, 0, PAGE_SIZE);
     si->nr_pages     = nr_pages;
-    si->shared_info  = virt_to_phys(d->shared_info);
+
+    if ( opt_dom0_translate )
+    {
+        si->shared_info  = d->next_io_page << PAGE_SHIFT;
+        set_machinetophys(virt_to_phys(d->shared_info) >> PAGE_SHIFT,
+                          d->next_io_page);
+        d->next_io_page++;
+    }
+    else
+        si->shared_info  = virt_to_phys(d->shared_info);
+
     si->flags        = SIF_PRIVILEGED | SIF_INITDOMAIN;
     si->pt_base      = vpt_start;
     si->nr_pt_frames = nr_pt_pages;
@@ -451,7 +475,7 @@
         mfn = pfn + (alloc_start>>PAGE_SHIFT);
 #ifndef NDEBUG
 #define REVERSE_START ((v_end - dsi.v_start) >> PAGE_SHIFT)
-        if ( pfn > REVERSE_START )
+        if ( !opt_dom0_translate && (pfn > REVERSE_START) )
             mfn = (alloc_end>>PAGE_SHIFT) - (pfn - REVERSE_START);
 #endif
         ((u32 *)vphysmap_start)[pfn] = mfn;
@@ -512,6 +536,30 @@
     set_bit(DF_CONSTRUCTED, &d->d_flags);
 
     new_thread(ed, dsi.v_kernentry, vstack_end, vstartinfo_start);
+
+    if ( opt_dom0_shadow || opt_dom0_translate )
+    {
+        shadow_mode_enable(d, (opt_dom0_translate
+                               ? SHM_enable | SHM_translate
+                               : SHM_enable));
+        if ( opt_dom0_translate )
+        {
+            // map this domain's p2m table into current page table,
+            // so that we can easily access it.
+            //
+            ASSERT( root_pgentry_val(idle_pg_table[1]) == 0 );
+            ASSERT( pagetable_val(d->arch.phys_table) );
+            idle_pg_table[1] = mk_root_pgentry(
+                pagetable_val(d->arch.phys_table) | __PAGE_HYPERVISOR);
+            translate_l2pgtable(d, (l1_pgentry_t *)(1u << L2_PAGETABLE_SHIFT),
+                                pagetable_val(ed->arch.guest_table)
+                                >> PAGE_SHIFT);
+            idle_pg_table[1] = mk_root_pgentry(0);
+            local_flush_tlb();
+        }
+
+        update_pagetables(ed); /* XXX SMP */
+    }
 
     return 0;
 }

_______________________________________________
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®.