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

[Xen-changelog] Here are two patches which update the hypercall interfaces to



# HG changeset patch
# User kaf24@xxxxxxxxxxxxxxxxxxxx
# Node ID ec3b7c87b5776cce5ae3e9b9d030016dd0d722f1
# Parent  47295d6ca1d7f4f9045a0e99e38acf28788cc2e1

Here are two patches which update the hypercall interfaces to
use 64-bit values for both page table entries and physical
addresses.  These changes are needed to use more than 4GB with
PAE paging enabled.

The first patch is a pretty straightforward update for xen, it
simply makes the values 64-bit wide everythere.

The second patch adapts the linux kernel to the hypercall
interface changes.  It also introduces two MULTI_* functions
(for the update_va_mapping hypercalls) which have simliar
behavior like the HYPERVISOR_* counterparts but fill
multicall_entry_t instead of doing the call directly.

The tools don't need source code changes, but must be rebuilt
due to the change in the xen public header file.

Domain0 boots fine, unpriviliged domain boots fine with fully
functional networking.  Note this is non-PAE mode, tools don't
have support for PAE domU boots yet.

Signed-off-by: Gerd Knorr <kraxel@xxxxxxx>

diff -r 47295d6ca1d7 -r ec3b7c87b577 
linux-2.6.11-xen-sparse/drivers/xen/blkback/blkback.c
--- a/linux-2.6.11-xen-sparse/drivers/xen/blkback/blkback.c     Tue Jul  5 
09:01:37 2005
+++ b/linux-2.6.11-xen-sparse/drivers/xen/blkback/blkback.c     Tue Jul  5 
16:08:03 2005
@@ -141,10 +141,8 @@
 
     for ( i = 0; i < nr_pages; i++ )
     {
-        mcl[i].op = __HYPERVISOR_update_va_mapping;
-        mcl[i].args[0] = MMAP_VADDR(idx, i);
-        mcl[i].args[1] = 0;
-        mcl[i].args[2] = 0;
+       MULTI_update_va_mapping(mcl+i, MMAP_VADDR(idx, i),
+                               __pte(0), 0);
     }
 
     mcl[nr_pages-1].args[2] = UVMF_TLB_FLUSH|UVMF_ALL;
@@ -545,11 +543,10 @@
 
     for ( i = 0; i < nseg; i++ )
     {
-        mcl[i].op = __HYPERVISOR_update_va_mapping_otherdomain;
-        mcl[i].args[0] = MMAP_VADDR(pending_idx, i);
-        mcl[i].args[1] = (seg[i].buf & PAGE_MASK) | remap_prot;
-        mcl[i].args[2] = 0;
-        mcl[i].args[3] = blkif->domid;
+       MULTI_update_va_mapping_otherdomain(
+           mcl+i, MMAP_VADDR(pending_idx, i),
+           pfn_pte_ma(seg[i].buf >> PAGE_SHIFT, remap_prot),
+           0, blkif->domid);
 #ifdef CONFIG_XEN_BLKDEV_TAP_BE
         if ( blkif->is_blktap )
             mcl[i].args[3] = ID_TO_DOM(req->id);
diff -r 47295d6ca1d7 -r ec3b7c87b577 xen/arch/x86/mm.c
--- a/xen/arch/x86/mm.c Tue Jul  5 09:01:37 2005
+++ b/xen/arch/x86/mm.c Tue Jul  5 16:08:03 2005
@@ -2020,7 +2020,8 @@
             }
 
             va = map_domain_page_with_cache(mfn, &mapcache);
-            va = (void *)((unsigned long)va + (req.ptr & ~PAGE_MASK));
+            va = (void *)((unsigned long)va +
+                          (unsigned long)(req.ptr & ~PAGE_MASK));
             page = &frame_table[mfn];
 
             switch ( (type_info = page->u.inuse.type_info) & PGT_type_mask )
@@ -2164,7 +2165,7 @@
             break;
 
         default:
-            MEM_LOG("Invalid page update command %lx", req.ptr);
+            MEM_LOG("Invalid page update command %x", cmd);
             break;
         }
 
@@ -2251,11 +2252,10 @@
 }
 
 
-int do_update_va_mapping(unsigned long va,
-                         unsigned long val32,
+int do_update_va_mapping(unsigned long va, u64 val64,
                          unsigned long flags)
 {
-    l1_pgentry_t   val = l1e_from_intpte(val32);
+    l1_pgentry_t   val = l1e_from_intpte(val64);
     struct vcpu   *v   = current;
     struct domain *d   = v->domain;
     unsigned int   cpu = v->processor;
@@ -2349,8 +2349,7 @@
     return rc;
 }
 
-int do_update_va_mapping_otherdomain(unsigned long va,
-                                     unsigned long val32,
+int do_update_va_mapping_otherdomain(unsigned long va, u64 val64,
                                      unsigned long flags,
                                      domid_t domid)
 {
@@ -2368,7 +2367,7 @@
         return -ESRCH;
     }
 
-    rc = do_update_va_mapping(va, val32, flags);
+    rc = do_update_va_mapping(va, val64, flags);
 
     return rc;
 }
diff -r 47295d6ca1d7 -r ec3b7c87b577 
linux-2.6.11-xen-sparse/drivers/xen/netback/netback.c
--- a/linux-2.6.11-xen-sparse/drivers/xen/netback/netback.c     Tue Jul  5 
09:01:37 2005
+++ b/linux-2.6.11-xen-sparse/drivers/xen/netback/netback.c     Tue Jul  5 
16:08:03 2005
@@ -234,11 +234,9 @@
          * Heed the comment in pgtable-2level.h:pte_page(). :-)
          */
         phys_to_machine_mapping[__pa(skb->data) >> PAGE_SHIFT] = new_mfn;
-        
-        mcl->op = __HYPERVISOR_update_va_mapping;
-        mcl->args[0] = vdata;
-        mcl->args[1] = (new_mfn << PAGE_SHIFT) | __PAGE_KERNEL;
-        mcl->args[2] = 0;
+
+        MULTI_update_va_mapping(mcl, vdata,
+                               pfn_pte_ma(new_mfn, PAGE_KERNEL), 0);
         mcl++;
 
         mcl->op = __HYPERVISOR_mmuext_op;
@@ -425,10 +423,8 @@
     while ( dc != dp )
     {
         pending_idx = dealloc_ring[MASK_PEND_IDX(dc++)];
-        mcl[0].op = __HYPERVISOR_update_va_mapping;
-        mcl[0].args[0] = MMAP_VADDR(pending_idx);
-        mcl[0].args[1] = 0;
-        mcl[0].args[2] = 0;
+       MULTI_update_va_mapping(mcl, MMAP_VADDR(pending_idx),
+                               __pte(0), 0);
         mcl++;     
     }
 
@@ -571,11 +567,10 @@
         /* Packets passed to netif_rx() must have some headroom. */
         skb_reserve(skb, 16);
 
-        mcl[0].op = __HYPERVISOR_update_va_mapping_otherdomain;
-        mcl[0].args[0] = MMAP_VADDR(pending_idx);
-        mcl[0].args[1] = (txreq.addr & PAGE_MASK) | __PAGE_KERNEL;
-        mcl[0].args[2] = 0;
-        mcl[0].args[3] = netif->domid;
+       MULTI_update_va_mapping_otherdomain(
+           mcl, MMAP_VADDR(pending_idx),
+           pfn_pte_ma(txreq.addr >> PAGE_SHIFT, PAGE_KERNEL),
+           0, netif->domid);
         mcl++;
 
         memcpy(&pending_tx_info[pending_idx].req, &txreq, sizeof(txreq));
diff -r 47295d6ca1d7 -r ec3b7c87b577 
linux-2.6.11-xen-sparse/include/asm-xen/asm-i386/hypercall.h
--- a/linux-2.6.11-xen-sparse/include/asm-xen/asm-i386/hypercall.h      Tue Jul 
 5 09:01:37 2005
+++ b/linux-2.6.11-xen-sparse/include/asm-xen/asm-i386/hypercall.h      Tue Jul 
 5 16:08:03 2005
@@ -371,13 +371,19 @@
     unsigned long va, pte_t new_val, unsigned long flags)
 {
     int ret;
-    unsigned long ign1, ign2, ign3;
-
-    __asm__ __volatile__ (
-        TRAP_INSTR
-        : "=a" (ret), "=b" (ign1), "=c" (ign2), "=d" (ign3)
+    unsigned long ign1, ign2, ign3, ign4;
+
+    __asm__ __volatile__ (
+        TRAP_INSTR
+        : "=a" (ret), "=b" (ign1), "=c" (ign2), "=d" (ign3), "=S" (ign4)
        : "0" (__HYPERVISOR_update_va_mapping), 
-          "1" (va), "2" ((new_val).pte_low), "3" (flags)
+          "1" (va), "2" ((new_val).pte_low),
+#ifdef CONFIG_X86_PAE
+         "3" ((new_val).pte_high),
+#else
+         "3" (0),
+#endif
+         "4" (flags)
        : "memory" );
 
     if ( unlikely(ret < 0) )
@@ -473,13 +479,20 @@
     unsigned long va, pte_t new_val, unsigned long flags, domid_t domid)
 {
     int ret;
-    unsigned long ign1, ign2, ign3, ign4;
-
-    __asm__ __volatile__ (
-        TRAP_INSTR
-        : "=a" (ret), "=b" (ign1), "=c" (ign2), "=d" (ign3), "=S" (ign4)
+    unsigned long ign1, ign2, ign3, ign4, ign5;
+
+    __asm__ __volatile__ (
+        TRAP_INSTR
+        : "=a" (ret), "=b" (ign1), "=c" (ign2), "=d" (ign3),
+         "=S" (ign4), "=D" (ign5)
        : "0" (__HYPERVISOR_update_va_mapping_otherdomain),
-          "1" (va), "2" ((new_val).pte_low), "3" (flags), "4" (domid) :
+          "1" (va), "2" ((new_val).pte_low),
+#ifdef CONFIG_X86_PAE
+         "3" ((new_val).pte_high),
+#else
+         "3" (0),
+#endif
+         "4" (flags), "5" (domid) :
         "memory" );
     
     return ret;
diff -r 47295d6ca1d7 -r ec3b7c87b577 
linux-2.6.11-xen-sparse/include/asm-xen/hypervisor.h
--- a/linux-2.6.11-xen-sparse/include/asm-xen/hypervisor.h      Tue Jul  5 
09:01:37 2005
+++ b/linux-2.6.11-xen-sparse/include/asm-xen/hypervisor.h      Tue Jul  5 
16:08:03 2005
@@ -139,4 +139,49 @@
 
 #include <asm/hypercall.h>
 
+static inline void
+MULTI_update_va_mapping(
+    multicall_entry_t *mcl, unsigned long va,
+    pte_t new_val, unsigned long flags)
+{
+    mcl->op = __HYPERVISOR_update_va_mapping;
+    mcl->args[0] = va;
+#if defined(CONFIG_X86_64)
+    mcl->args[1] = new_val.pte;
+    mcl->args[2] = flags;
+#elif defined(CONFIG_X86_PAE)
+    mcl->args[1] = new_val.pte_low;
+    mcl->args[2] = new_val.pte_high;
+    mcl->args[3] = flags;
+#else
+    mcl->args[1] = new_val.pte_low;
+    mcl->args[2] = 0;
+    mcl->args[3] = flags;
+#endif
+}
+
+static inline void
+MULTI_update_va_mapping_otherdomain(
+    multicall_entry_t *mcl, unsigned long va,
+    pte_t new_val, unsigned long flags, domid_t domid)
+{
+    mcl->op = __HYPERVISOR_update_va_mapping_otherdomain;
+    mcl->args[0] = va;
+#if defined(CONFIG_X86_64)
+    mcl->args[1] = new_val.pte;
+    mcl->args[2] = flags;
+    mcl->args[3] = domid;
+#elif defined(CONFIG_X86_PAE)
+    mcl->args[1] = new_val.pte_low;
+    mcl->args[2] = new_val.pte_high;
+    mcl->args[3] = flags;
+    mcl->args[4] = domid;
+#else
+    mcl->args[1] = new_val.pte_low;
+    mcl->args[2] = 0;
+    mcl->args[3] = flags;
+    mcl->args[4] = domid;
+#endif
+}
+
 #endif /* __HYPERVISOR_H__ */
diff -r 47295d6ca1d7 -r ec3b7c87b577 xen/include/public/dom0_ops.h
--- a/xen/include/public/dom0_ops.h     Tue Jul  5 09:01:37 2005
+++ b/xen/include/public/dom0_ops.h     Tue Jul  5 16:08:03 2005
@@ -19,7 +19,7 @@
  * This makes sure that old versions of dom0 tools will stop working in a
  * well-defined way (rather than crashing the machine, for instance).
  */
-#define DOM0_INTERFACE_VERSION   0xAAAA100A
+#define DOM0_INTERFACE_VERSION   0xAAAA100B
 
 /************************************************************************/
 
diff -r 47295d6ca1d7 -r ec3b7c87b577 
linux-2.6.11-xen-sparse/drivers/xen/usbback/usbback.c
--- a/linux-2.6.11-xen-sparse/drivers/xen/usbback/usbback.c     Tue Jul  5 
09:01:37 2005
+++ b/linux-2.6.11-xen-sparse/drivers/xen/usbback/usbback.c     Tue Jul  5 
16:08:03 2005
@@ -189,10 +189,8 @@
 
     for ( i = 0; i < nr_pages; i++ )
     {
-        mcl[i].op = __HYPERVISOR_update_va_mapping;
-        mcl[i].args[0] = MMAP_VADDR(idx, i);
-        mcl[i].args[1] = 0;
-        mcl[i].args[2] = 0;
+       MULTI_update_va_mapping(mcl+i, MMAP_VADDR(idx, i),
+                               __pte(0), 0);
     }
 
     mcl[nr_pages-1].args[2] = UVMF_TLB_FLUSH|UVMF_ALL;
@@ -651,11 +649,10 @@
     for ( i = 0, offset = 0; offset < req->length;
           i++, offset += PAGE_SIZE )
     {
-       mcl[i].op = __HYPERVISOR_update_va_mapping_otherdomain;
-       mcl[i].args[0] = MMAP_VADDR(pending_idx, i);
-        mcl[i].args[1] = ((buffer_mach & PAGE_MASK) + offset) | remap_prot;
-        mcl[i].args[2] = 0;
-        mcl[i].args[3] = up->domid;
+       MULTI_update_va_mapping_otherdomain(
+           mcl+i, MMAP_VADDR(pending_idx, i),
+           pfn_pte_ma(buffer_mach >> PAGE_SHIFT, remap_prot),
+           0, up->domid);
         
         phys_to_machine_mapping[__pa(MMAP_VADDR(pending_idx, i))>>PAGE_SHIFT] =
             FOREIGN_FRAME((buffer_mach + offset) >> PAGE_SHIFT);
@@ -667,11 +664,10 @@
     if ( req->pipe_type == 0 && req->num_iso > 0 ) /* Maybe schedule ISO... */
     {
         /* Map in ISO schedule, if necessary. */
-        mcl[i].op = __HYPERVISOR_update_va_mapping_otherdomain;
-        mcl[i].args[0] = MMAP_VADDR(pending_idx, i);
-        mcl[i].args[1] = (req->iso_schedule & PAGE_MASK) | remap_prot;
-        mcl[i].args[2] = 0;
-        mcl[i].args[3] = up->domid;
+       MULTI_update_va_mapping_otherdomain(
+           mcl+i, MMAP_VADDR(pending_idx, i),
+           pfn_pte_ma(req->iso_schedule >> PAGE_SHIFT, remap_prot),
+           0, up->domid);
 
         phys_to_machine_mapping[__pa(MMAP_VADDR(pending_idx, i))>>PAGE_SHIFT] =
             FOREIGN_FRAME(req->iso_schedule >> PAGE_SHIFT);
diff -r 47295d6ca1d7 -r ec3b7c87b577 xen/include/public/xen.h
--- a/xen/include/public/xen.h  Tue Jul  5 09:01:37 2005
+++ b/xen/include/public/xen.h  Tue Jul  5 16:08:03 2005
@@ -274,8 +274,8 @@
  */
 typedef struct
 {
-    memory_t ptr;       /* Machine address of PTE. */
-    memory_t val;       /* New contents of PTE.    */
+    u64 ptr;       /* Machine address of PTE. */
+    u64 val;       /* New contents of PTE.    */
 } mmu_update_t;
 
 /*
diff -r 47295d6ca1d7 -r ec3b7c87b577 
linux-2.6.11-xen-sparse/drivers/xen/netfront/netfront.c
--- a/linux-2.6.11-xen-sparse/drivers/xen/netfront/netfront.c   Tue Jul  5 
09:01:37 2005
+++ b/linux-2.6.11-xen-sparse/drivers/xen/netfront/netfront.c   Tue Jul  5 
16:08:03 2005
@@ -395,10 +395,8 @@
        phys_to_machine_mapping[__pa(skb->head) >> PAGE_SHIFT] 
            = INVALID_P2M_ENTRY;
 
-        rx_mcl[i].op = __HYPERVISOR_update_va_mapping;
-        rx_mcl[i].args[0] = (unsigned long)skb->head;
-        rx_mcl[i].args[1] = 0;
-        rx_mcl[i].args[2] = 0;
+       MULTI_update_va_mapping(rx_mcl+i, (unsigned long)skb->head,
+                               __pte(0), 0);
     }
 
     /* After all PTEs have been zapped we blow away stale TLB entries. */
@@ -585,10 +583,8 @@
         mmu->ptr  = (rx->addr & PAGE_MASK) | MMU_MACHPHYS_UPDATE;
         mmu->val  = __pa(skb->head) >> PAGE_SHIFT;
         mmu++;
-        mcl->op = __HYPERVISOR_update_va_mapping;
-        mcl->args[0] = (unsigned long)skb->head;
-        mcl->args[1] = (rx->addr & PAGE_MASK) | __PAGE_KERNEL;
-        mcl->args[2] = 0;
+       MULTI_update_va_mapping(mcl, (unsigned long)skb->head,
+                               pfn_pte_ma(rx->addr >> PAGE_SHIFT, 
PAGE_KERNEL), 0);
         mcl++;
 
         phys_to_machine_mapping[__pa(skb->head) >> PAGE_SHIFT] = 

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