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-devel

[Xen-devel] [PATCH, RFC 3/4] qemu: use new (replacement) mmap-batch ioct

To: <xen-devel@xxxxxxxxxxxxxxxxxxx>
Subject: [Xen-devel] [PATCH, RFC 3/4] qemu: use new (replacement) mmap-batch ioctl
From: "Jan Beulich" <JBeulich@xxxxxxxxxx>
Date: Mon, 11 Jan 2010 14:50:54 +0000
Delivery-date: Mon, 11 Jan 2010 06:53:21 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
--- 2010-01-06.orig/qemu/hw/xen_common.h        2009-01-27 08:32:14.000000000 
+0100
+++ 2010-01-06/qemu/hw/xen_common.h     2010-01-08 17:19:07.000000000 +0100
@@ -30,5 +30,10 @@
 # define xen_rmb() rmb()
 # define xen_wmb() wmb()
 #endif
+#if __XEN_LATEST_INTERFACE_VERSION__ < 0x0003020a
+void * __attribute__((__weak__))
+xc_map_foreign_bulk(int xc_handle, uint32_t dom, int prot,
+                    const xen_pfn_t *, int *err, unsigned int num);
+#endif
 
 #endif /* QEMU_HW_XEN_COMMON_H */
--- 2010-01-06.orig/qemu/hw/xen_machine_fv.c    2009-05-19 16:24:10.000000000 
+0200
+++ 2010-01-06/qemu/hw/xen_machine_fv.c 2010-01-08 17:24:10.000000000 +0100
@@ -109,6 +109,34 @@ static void qemu_remap_bucket(struct map
     for (i = 0; i < MCACHE_BUCKET_SIZE >> XC_PAGE_SHIFT; i++)
         pfns[i] = (address_index << (MCACHE_BUCKET_SHIFT-XC_PAGE_SHIFT)) + i;
 
+    if (xc_map_foreign_bulk != NULL) {
+        int err[MCACHE_BUCKET_SIZE >> XC_PAGE_SHIFT];
+
+        vaddr_base = xc_map_foreign_bulk(xc_handle, domid,
+                                         PROT_READ|PROT_WRITE, pfns, err,
+                                         MCACHE_BUCKET_SIZE >> XC_PAGE_SHIFT);
+        if (vaddr_base == NULL) {
+            fprintf(logfile, "xc_map_foreign_bulk error %d\n", errno);
+            exit(-1);
+        }
+
+        entry->vaddr_base  = vaddr_base;
+        entry->paddr_index = address_index;
+
+        for (i = 0; i < MCACHE_BUCKET_SIZE >> XC_PAGE_SHIFT;
+             i += BITS_PER_LONG) {
+            unsigned long word = 0;
+            j = ((i + BITS_PER_LONG) > (MCACHE_BUCKET_SIZE >> XC_PAGE_SHIFT)) ?
+                (MCACHE_BUCKET_SIZE >> XC_PAGE_SHIFT) % BITS_PER_LONG :
+                BITS_PER_LONG;
+            while (j > 0)
+                word = (word << 1) | !err[i + --j];
+            entry->valid_mapping[i / BITS_PER_LONG] = word;
+        }
+
+        return;
+    }
+
     vaddr_base = xc_map_foreign_batch(xc_handle, domid, PROT_READ|PROT_WRITE,
                                       pfns, MCACHE_BUCKET_SIZE >> 
XC_PAGE_SHIFT);
     if (vaddr_base == NULL) {
@@ -347,11 +375,11 @@ static void xen_init_fv(ram_addr_t ram_s
                 (STORE_PAGE_START >> XC_PAGE_SHIFT); 
     }
 
-    phys_ram_base = xc_map_foreign_batch(xc_handle, domid,
+    phys_ram_base = xc_map_foreign_pages(xc_handle, domid,
                                          PROT_READ|PROT_WRITE,
                                          page_array, nr_pages);
     if (phys_ram_base == 0) {
-        fprintf(logfile, "xc_map_foreign_batch returned error %d\n", errno);
+        fprintf(logfile, "xc_map_foreign_pages returned error %d\n", errno);
         exit(-1);
     }
     free(page_array);



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