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] make gnttab.c can be used in para-driver for unmodif

To: Ian Pratt <m+Ian.Pratt@xxxxxxxxxxxx>, Keir Fraser <Keir.Fraser@xxxxxxxxxxxx>
Subject: [Xen-devel] [PATCH] make gnttab.c can be used in para-driver for unmodified guest
From: Xiaofeng Ling <xiaofeng.ling@xxxxxxxxx>
Date: Mon, 05 Sep 2005 17:09:40 +0800
Cc: xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxx>
Delivery-date: Mon, 05 Sep 2005 09:10:34 +0000
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/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.6) Gecko/20040510
make gnttab.c can be used in para-driver for unmodified guest
changes are:
1. export one more symbols, include more files
2. A different implementation for setup grant table share page
   use ioremap to map the physical address returned by hypercall.
3. remove static for gnttab_init so that it can be called from
module init function in event channel pci driver.

Signed-off-by: Xiaofeng Ling <xiaofeng.ling@xxxxxxxxx>
Signed-off-by: Arun Sharma <arun.sharma@xxxxxxxxx>


diff -r 287d36b46fa3 linux-2.6-xen-sparse/arch/xen/kernel/gnttab.c
--- a/linux-2.6-xen-sparse/arch/xen/kernel/gnttab.c     Tue Aug 30 20:36:49 2005
+++ b/linux-2.6-xen-sparse/arch/xen/kernel/gnttab.c     Fri Sep  2 22:47:27 2005
@@ -17,9 +17,13 @@
 #include <asm/fixmap.h>
 #include <asm/uaccess.h>
 #include <asm-xen/xen_proc.h>
+#include <xen-public/xen.h>
 #include <asm-xen/linux-public/privcmd.h>
 #include <asm-xen/gnttab.h>
 #include <asm-xen/synch_bitops.h>
+#ifndef CONFIG_XEN
+#include <asm/io.h>
+#endif

 #if 1
 #define ASSERT(_p) \
@@ -47,6 +51,7 @@
 EXPORT_SYMBOL(gnttab_release_grant_reference);
 EXPORT_SYMBOL(gnttab_grant_foreign_access_ref);
 EXPORT_SYMBOL(gnttab_grant_foreign_transfer_ref);
+EXPORT_SYMBOL(gnttab_request_free_callback);

#define NR_GRANT_ENTRIES (NR_GRANT_FRAMES * PAGE_SIZE / sizeof(grant_entry_t))
 #define GNTTAB_LIST_END (NR_GRANT_ENTRIES + 1)
@@ -404,9 +409,19 @@
 gnttab_resume(void)
 {
     gnttab_setup_table_t setup;
+#ifdef CONFIG_XEN
+    int                  i;
     unsigned long        frames[NR_GRANT_FRAMES];
-    int                  i;
-
+#else
+    unsigned long *frames;
+    unsigned long alloc_xen_mmio(unsigned long len);
+    frames = (unsigned long *)alloc_xen_mmio(PAGE_SIZE * NR_GRANT_FRAMES);
+    shared = ioremap((unsigned long)frames, PAGE_SIZE * NR_GRANT_FRAMES);
+    if(!shared){
+        printk("error to ioremap gnttab share frames\n");
+        return -1;
+    }
+#endif
     setup.dom        = DOMID_SELF;
     setup.nr_frames  = NR_GRANT_FRAMES;
     setup.frame_list = frames;
@@ -414,8 +429,10 @@
BUG_ON(HYPERVISOR_grant_table_op(GNTTABOP_setup_table, &setup, 1) != 0);
     BUG_ON(setup.status != 0);

+#ifdef CONFIG_XEN
     for ( i = 0; i < NR_GRANT_FRAMES; i++ )
         set_fixmap(FIX_GNTTAB_END - i, frames[i] << PAGE_SHIFT);
+#endif

     return 0;
 }
@@ -423,22 +440,27 @@
 int
 gnttab_suspend(void)
 {
+#ifdef CONFIG_XEN
     int i;

     for ( i = 0; i < NR_GRANT_FRAMES; i++ )
        clear_fixmap(FIX_GNTTAB_END - i);
-
+#else
+    iounmap(shared);
+#endif
     return 0;
 }

-static int __init
+int __init
 gnttab_init(void)
 {
     int i;

     BUG_ON(gnttab_resume());

+#ifdef CONFIG_XEN
     shared = (grant_entry_t *)fix_to_virt(FIX_GNTTAB_END);
+#endif

     for ( i = 0; i < NR_GRANT_ENTRIES; i++ )
         gnttab_list[i] = i + 1;


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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-devel] [PATCH] make gnttab.c can be used in para-driver for unmodified guest, Xiaofeng Ling <=