WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] Split mmu_update() hypercall into mmu_update() and mmuex

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] Split mmu_update() hypercall into mmu_update() and mmuext_op().
From: BitKeeper Bot <riel@xxxxxxxxxxx>
Date: Wed, 30 Mar 2005 18:17:26 +0000
Delivery-date: Wed, 30 Mar 2005 19:04:07 +0000
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: Xen Development List <xen-devel@xxxxxxxxxxxxxxxxxxxxx>
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
ChangeSet 1.1400, 2005/03/30 19:17:26+01:00, kaf24@xxxxxxxxxxxxxxxxxxxx

        Split mmu_update() hypercall into mmu_update() and mmuext_op().
        All MMUEXT_* ops are now done via the latter hypercall. This allows
        more arguments to be passed in a nicer way to mmuext operations.
        Linux 2.4, 2.6 and control tools all use the new interface. The BSDs
        will need some work, but shouldn't be too hard (and they can be moved
        to writable pagetables at the same time :-) ).
        Signed-off-by: Keir Fraser <keir@xxxxxxxxxxxxx>



 freebsd-5.3-xen-sparse/i386-xen/i386-xen/xen_machdep.c     |    2 
 freebsd-5.3-xen-sparse/i386-xen/xen/netfront/xn_netfront.c |    2 
 linux-2.4.29-xen-sparse/arch/xen/kernel/traps.c            |   10 
 linux-2.4.29-xen-sparse/arch/xen/mm/ioremap.c              |   19 
 linux-2.4.29-xen-sparse/mm/memory.c                        |    2 
 linux-2.6.11-xen-sparse/arch/xen/i386/kernel/traps.c       |    9 
 linux-2.6.11-xen-sparse/arch/xen/i386/mm/hypervisor.c      |   84 -
 linux-2.6.11-xen-sparse/arch/xen/i386/mm/ioremap.c         |   24 
 linux-2.6.11-xen-sparse/drivers/xen/blkback/blkback.c      |    2 
 linux-2.6.11-xen-sparse/drivers/xen/netback/netback.c      |   65 
 linux-2.6.11-xen-sparse/drivers/xen/netfront/netfront.c    |    3 
 linux-2.6.11-xen-sparse/drivers/xen/privcmd/privcmd.c      |   24 
 linux-2.6.11-xen-sparse/drivers/xen/usbback/usbback.c      |    2 
 linux-2.6.11-xen-sparse/include/asm-xen/asm-i386/pgtable.h |    3 
 linux-2.6.11-xen-sparse/include/asm-xen/hypervisor.h       |   25 
 netbsd-2.0-xen-sparse/sys/arch/xen/xen/if_xennet.c         |    6 
 tools/libxc/xc_linux_build.c                               |    9 
 tools/libxc/xc_linux_restore.c                             |   15 
 tools/libxc/xc_plan9_build.c                               |   15 
 tools/libxc/xc_private.c                                   |   46 
 tools/libxc/xc_private.h                                   |    3 
 tools/libxc/xc_vmx_build.c                                 |    9 
 xen/arch/x86/mm.c                                          |  878 +++++++------
 xen/arch/x86/x86_32/entry.S                                |    2 
 xen/arch/x86/x86_64/entry.S                                |    1 
 xen/include/public/xen.h                                   |  137 +-
 26 files changed, 755 insertions(+), 642 deletions(-)


diff -Nru a/freebsd-5.3-xen-sparse/i386-xen/i386-xen/xen_machdep.c 
b/freebsd-5.3-xen-sparse/i386-xen/i386-xen/xen_machdep.c
--- a/freebsd-5.3-xen-sparse/i386-xen/i386-xen/xen_machdep.c    2005-03-30 
14:04:05 -05:00
+++ b/freebsd-5.3-xen-sparse/i386-xen/i386-xen/xen_machdep.c    2005-03-30 
14:04:05 -05:00
@@ -540,7 +540,7 @@
     MCL_QUEUE[MCL_IDX].op = __HYPERVISOR_update_va_mapping;
     MCL_QUEUE[MCL_IDX].args[0] = (unsigned long)va;
     MCL_QUEUE[MCL_IDX].args[1] = (unsigned long)ma;
-    MCL_QUEUE[MCL_IDX].args[2] = UVMF_INVLPG;
+    MCL_QUEUE[MCL_IDX].args[2] = UVMF_INVLPG_LOCAL;
     mcl_increment_idx();
 }
 
diff -Nru a/freebsd-5.3-xen-sparse/i386-xen/xen/netfront/xn_netfront.c 
b/freebsd-5.3-xen-sparse/i386-xen/xen/netfront/xn_netfront.c
--- a/freebsd-5.3-xen-sparse/i386-xen/xen/netfront/xn_netfront.c        
2005-03-30 14:04:06 -05:00
+++ b/freebsd-5.3-xen-sparse/i386-xen/xen/netfront/xn_netfront.c        
2005-03-30 14:04:06 -05:00
@@ -440,7 +440,7 @@
     PT_UPDATES_FLUSH();
 
     /* After all PTEs have been zapped we blow away stale TLB entries. */
-    xn_rx_mcl[i-1].args[2] = UVMF_FLUSH_TLB;
+    xn_rx_mcl[i-1].args[2] = UVMF_TLB_FLUSH_LOCAL;
 
     /* Give away a batch of pages. */
     xn_rx_mcl[i].op = __HYPERVISOR_dom_mem_op;
diff -Nru a/linux-2.4.29-xen-sparse/arch/xen/kernel/traps.c 
b/linux-2.4.29-xen-sparse/arch/xen/kernel/traps.c
--- a/linux-2.4.29-xen-sparse/arch/xen/kernel/traps.c   2005-03-30 14:04:04 
-05:00
+++ b/linux-2.4.29-xen-sparse/arch/xen/kernel/traps.c   2005-03-30 14:04:04 
-05:00
@@ -316,15 +316,7 @@
                __asm__ __volatile__ ( "sldt %0" : "=r" (ldt) );
                if ( ldt == 0 )
                {
-                   mmu_update_t u;
-                   u.ptr  = MMU_EXTENDED_COMMAND;
-                   u.ptr |= (unsigned long)&default_ldt[0];
-                   u.val  = MMUEXT_SET_LDT | (5 << MMUEXT_CMD_SHIFT);
-                   if ( unlikely(HYPERVISOR_mmu_update(&u, 1, NULL) < 0) )
-                   {
-                       show_trace(NULL);
-                       panic("Failed to install default LDT");
-                   }
+                    xen_set_ldt((unsigned long)&default_ldt[0], 5);
                    return;
                }
        }
diff -Nru a/linux-2.4.29-xen-sparse/arch/xen/mm/ioremap.c 
b/linux-2.4.29-xen-sparse/arch/xen/mm/ioremap.c
--- a/linux-2.4.29-xen-sparse/arch/xen/mm/ioremap.c     2005-03-30 14:04:05 
-05:00
+++ b/linux-2.4.29-xen-sparse/arch/xen/mm/ioremap.c     2005-03-30 14:04:05 
-05:00
@@ -113,12 +113,7 @@
     int i;
     unsigned long start_address;
 #define MAX_DIRECTMAP_MMU_QUEUE 130
-    mmu_update_t u[MAX_DIRECTMAP_MMU_QUEUE], *w, *v;
-
-    u[0].ptr  = MMU_EXTENDED_COMMAND;
-    u[0].val  = MMUEXT_SET_FOREIGNDOM;
-    u[0].val |= (unsigned long)domid << 16;
-    v = w = &u[1];
+    mmu_update_t u[MAX_DIRECTMAP_MMU_QUEUE], *v = u;
 
     start_address = address;
 
@@ -130,11 +125,11 @@
            __direct_remap_area_pages( mm,
                                       start_address, 
                                       address-start_address, 
-                                      w);
+                                      u);
            
-           if ( HYPERVISOR_mmu_update(u, v - u, NULL) < 0 )
+           if ( HYPERVISOR_mmu_update(u, v - u, NULL, domid) < 0 )
                return -EFAULT;     
-           v = w;
+           v = u;
            start_address = address;
        }
 
@@ -149,14 +144,14 @@
         v++;
     }
 
-    if ( v != w )
+    if ( v != u )
     {
        /* get the ptep's filled in */
        __direct_remap_area_pages(mm,
                                   start_address, 
                                   address-start_address, 
-                                  w);   
-       if ( unlikely(HYPERVISOR_mmu_update(u, v - u, NULL) < 0) )
+                                  u);   
+       if ( unlikely(HYPERVISOR_mmu_update(u, v - u, NULL, domid) < 0) )
            return -EFAULT;         
     }
     
diff -Nru a/linux-2.4.29-xen-sparse/mm/memory.c 
b/linux-2.4.29-xen-sparse/mm/memory.c
--- a/linux-2.4.29-xen-sparse/mm/memory.c       2005-03-30 14:04:05 -05:00
+++ b/linux-2.4.29-xen-sparse/mm/memory.c       2005-03-30 14:04:05 -05:00
@@ -911,7 +911,7 @@
 {
 #ifdef CONFIG_XEN
        if ( likely(vma->vm_mm == current->mm) ) {
-               HYPERVISOR_update_va_mapping(address, entry, UVMF_INVLPG);
+               HYPERVISOR_update_va_mapping(address, entry, UVMF_INVLPG_LOCAL);
        } else {
                set_pte(page_table, entry);
                flush_tlb_page(vma, address);
diff -Nru a/linux-2.6.11-xen-sparse/arch/xen/i386/kernel/traps.c 
b/linux-2.6.11-xen-sparse/arch/xen/i386/kernel/traps.c
--- a/linux-2.6.11-xen-sparse/arch/xen/i386/kernel/traps.c      2005-03-30 
14:04:05 -05:00
+++ b/linux-2.6.11-xen-sparse/arch/xen/i386/kernel/traps.c      2005-03-30 
14:04:05 -05:00
@@ -465,14 +465,7 @@
                unsigned long ldt;
                __asm__ __volatile__ ("sldt %0" : "=r" (ldt));
                if (ldt == 0) {
-                       mmu_update_t u;
-                       u.ptr = MMU_EXTENDED_COMMAND;
-                       u.ptr |= (unsigned long)&default_ldt[0];
-                       u.val = MMUEXT_SET_LDT | (5 << MMUEXT_CMD_SHIFT);
-                       if (unlikely(HYPERVISOR_mmu_update(&u, 1, NULL) < 0)) {
-                               show_trace(NULL, (unsigned long *)&u);
-                               panic("Failed to install default LDT");
-                       }
+                       xen_set_ldt((unsigned long)&default_ldt[0], 5);
                        return;
                }
        }
diff -Nru a/linux-2.6.11-xen-sparse/arch/xen/i386/mm/hypervisor.c 
b/linux-2.6.11-xen-sparse/arch/xen/i386/mm/hypervisor.c
--- a/linux-2.6.11-xen-sparse/arch/xen/i386/mm/hypervisor.c     2005-03-30 
14:04:05 -05:00
+++ b/linux-2.6.11-xen-sparse/arch/xen/i386/mm/hypervisor.c     2005-03-30 
14:04:05 -05:00
@@ -52,7 +52,7 @@
     mmu_update_t u;
     u.ptr = virt_to_machine(ptr);
     u.val = val;
-    BUG_ON(HYPERVISOR_mmu_update(&u, 1, NULL) < 0);
+    BUG_ON(HYPERVISOR_mmu_update(&u, 1, NULL, DOMID_SELF) < 0);
 }
 
 void xen_l2_entry_update(pmd_t *ptr, pmd_t val)
@@ -60,79 +60,79 @@
     mmu_update_t u;
     u.ptr = virt_to_machine(ptr);
     u.val = pmd_val_ma(val);
-    BUG_ON(HYPERVISOR_mmu_update(&u, 1, NULL) < 0);
+    BUG_ON(HYPERVISOR_mmu_update(&u, 1, NULL, DOMID_SELF) < 0);
 }
 
-void xen_pt_switch(unsigned long ptr)
+void xen_machphys_update(unsigned long mfn, unsigned long pfn)
 {
     mmu_update_t u;
-    u.ptr = phys_to_machine(ptr) | MMU_EXTENDED_COMMAND;
-    u.val = MMUEXT_NEW_BASEPTR;
-    BUG_ON(HYPERVISOR_mmu_update(&u, 1, NULL) < 0);
+    u.ptr = (mfn << PAGE_SHIFT) | MMU_MACHPHYS_UPDATE;
+    u.val = pfn;
+    BUG_ON(HYPERVISOR_mmu_update(&u, 1, NULL, DOMID_SELF) < 0);
+}
+
+void xen_pt_switch(unsigned long ptr)
+{
+    struct mmuext_op op;
+    op.cmd = MMUEXT_NEW_BASEPTR;
+    op.mfn = pfn_to_mfn(ptr >> PAGE_SHIFT);
+    BUG_ON(HYPERVISOR_mmuext_op(&op, 1, NULL, DOMID_SELF) < 0);
 }
 
 void xen_tlb_flush(void)
 {
-    mmu_update_t u;
-    u.ptr = MMU_EXTENDED_COMMAND;
-    u.val = MMUEXT_TLB_FLUSH;
-    BUG_ON(HYPERVISOR_mmu_update(&u, 1, NULL) < 0);
+    struct mmuext_op op;
+    op.cmd = MMUEXT_TLB_FLUSH_LOCAL;
+    BUG_ON(HYPERVISOR_mmuext_op(&op, 1, NULL, DOMID_SELF) < 0);
 }
 
 void xen_invlpg(unsigned long ptr)
 {
-    mmu_update_t u;
-    u.ptr = (ptr & PAGE_MASK) | MMU_EXTENDED_COMMAND;
-    u.val = MMUEXT_INVLPG;
-    BUG_ON(HYPERVISOR_mmu_update(&u, 1, NULL) < 0);
+    struct mmuext_op op;
+    op.cmd = MMUEXT_INVLPG_LOCAL;
+    op.linear_addr = ptr & PAGE_MASK;
+    BUG_ON(HYPERVISOR_mmuext_op(&op, 1, NULL, DOMID_SELF) < 0);
 }
 
 void xen_pgd_pin(unsigned long ptr)
 {
-    mmu_update_t u;
-    u.ptr = phys_to_machine(ptr) | MMU_EXTENDED_COMMAND;
-    u.val = MMUEXT_PIN_L2_TABLE;
-    BUG_ON(HYPERVISOR_mmu_update(&u, 1, NULL) < 0);
+    struct mmuext_op op;
+    op.cmd = MMUEXT_PIN_L2_TABLE;
+    op.mfn = pfn_to_mfn(ptr >> PAGE_SHIFT);
+    BUG_ON(HYPERVISOR_mmuext_op(&op, 1, NULL, DOMID_SELF) < 0);
 }
 
 void xen_pgd_unpin(unsigned long ptr)
 {
-    mmu_update_t u;
-    u.ptr = phys_to_machine(ptr) | MMU_EXTENDED_COMMAND;
-    u.val = MMUEXT_UNPIN_TABLE;
-    BUG_ON(HYPERVISOR_mmu_update(&u, 1, NULL) < 0);
+    struct mmuext_op op;
+    op.cmd = MMUEXT_UNPIN_TABLE;
+    op.mfn = pfn_to_mfn(ptr >> PAGE_SHIFT);
+    BUG_ON(HYPERVISOR_mmuext_op(&op, 1, NULL, DOMID_SELF) < 0);
 }
 
 void xen_pte_pin(unsigned long ptr)
 {
-    mmu_update_t u;
-    u.ptr = phys_to_machine(ptr) | MMU_EXTENDED_COMMAND;
-    u.val = MMUEXT_PIN_L1_TABLE;
-    BUG_ON(HYPERVISOR_mmu_update(&u, 1, NULL) < 0);
+    struct mmuext_op op;
+    op.cmd = MMUEXT_PIN_L1_TABLE;
+    op.mfn = pfn_to_mfn(ptr >> PAGE_SHIFT);
+    BUG_ON(HYPERVISOR_mmuext_op(&op, 1, NULL, DOMID_SELF) < 0);
 }
 
 void xen_pte_unpin(unsigned long ptr)
 {
-    mmu_update_t u;
-    u.ptr = phys_to_machine(ptr) | MMU_EXTENDED_COMMAND;
-    u.val = MMUEXT_UNPIN_TABLE;
-    BUG_ON(HYPERVISOR_mmu_update(&u, 1, NULL) < 0);
+    struct mmuext_op op;
+    op.cmd = MMUEXT_UNPIN_TABLE;
+    op.mfn = pfn_to_mfn(ptr >> PAGE_SHIFT);
+    BUG_ON(HYPERVISOR_mmuext_op(&op, 1, NULL, DOMID_SELF) < 0);
 }
 
 void xen_set_ldt(unsigned long ptr, unsigned long len)
 {
-    mmu_update_t u;
-    u.ptr = ptr | MMU_EXTENDED_COMMAND;
-    u.val = (len << MMUEXT_CMD_SHIFT) | MMUEXT_SET_LDT;
-    BUG_ON(HYPERVISOR_mmu_update(&u, 1, NULL) < 0);
-}
-
-void xen_machphys_update(unsigned long mfn, unsigned long pfn)
-{
-    mmu_update_t u;
-    u.ptr = (mfn << PAGE_SHIFT) | MMU_MACHPHYS_UPDATE;
-    u.val = pfn;
-    BUG_ON(HYPERVISOR_mmu_update(&u, 1, NULL) < 0);

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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] Split mmu_update() hypercall into mmu_update() and mmuext_op()., BitKeeper Bot <=