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]blkfront change to support unmodified linux

To: Ian Pratt <m+Ian.Pratt@xxxxxxxxxxxx>, Keir Fraser <Keir.Fraser@xxxxxxxxxxxx>
Subject: [Xen-devel] [PATCH]blkfront change to support unmodified linux
From: Xiaofeng Ling <xiaofeng.ling@xxxxxxxxx>
Date: Mon, 05 Sep 2005 13:41:11 +0800
Cc: xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxx>
Delivery-date: Mon, 05 Sep 2005 05:42:09 +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
This patch is to make blkfront can work both in xen-linux and in
unmodified guest which is shadow_model_translate enabled.

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

diff -r 287d36b46fa3 linux-2.6-xen-sparse/drivers/xen/blkfront/blkfront.c
--- a/linux-2.6-xen-sparse/drivers/xen/blkfront/blkfront.c
+++ b/linux-2.6-xen-sparse/drivers/xen/blkfront/blkfront.c
@@ -511,7 +511,7 @@
        FRONT_RING_INIT(&info->ring, sring, PAGE_SIZE);

        err = gnttab_grant_foreign_access(info->backend_id,
-                                         virt_to_mfn(info->ring.sring), 0);
+                                         virt_to_xfn(info->ring.sring), 0);
        if (err == -ENOSPC) {
                free_page((unsigned long)info->ring.sring);
                info->ring.sring = 0;
diff -r 287d36b46fa3 linux-2.6-xen-sparse/include/asm-xen/asm-i386/io.h
--- a/linux-2.6-xen-sparse/include/asm-xen/asm-i386/io.h        
+++ b/linux-2.6-xen-sparse/include/asm-xen/asm-i386/io.h        
@@ -101,7 +101,17 @@
  * Change "struct page" to physical address.
  */
#define page_to_pseudophys(page) ((dma_addr_t)page_to_pfn(page) << PAGE_SHIFT)
+#ifndef CONFIG_XEN_SHADOW_TRANSLATE
 #define page_to_phys(page)      (phys_to_machine(page_to_pseudophys(page)))
+#else
+#define page_to_phys(page)      (page_to_pseudophys(page))
+#endif
+
+#ifndef CONFIG_XEN_SHADOW_TRANSLATE
+#define virt_to_xfn(va)         (virt_to_mfn(va))
+#else
+#define virt_to_xfn(va)         (virt_to_phys(va) >> PAGE_SHIFT)
+#endif

 #define bio_to_pseudophys(bio)  (page_to_pseudophys(bio_page((bio))) + \
                                  (unsigned long) bio_offset((bio)))
diff -r 287d36b46fa3 linux-2.6-xen-sparse/drivers/xen/blkfront/blkfront.c
--- a/linux-2.6-xen-sparse/drivers/xen/blkfront/blkfront.c      Tue Aug 30 
20:36:49 2005
+++ b/linux-2.6-xen-sparse/drivers/xen/blkfront/blkfront.c      Fri Sep  2 
22:47:27 2005
@@ -511,7 +511,7 @@
        FRONT_RING_INIT(&info->ring, sring, PAGE_SIZE);
 
        err = gnttab_grant_foreign_access(info->backend_id,
-                                         virt_to_mfn(info->ring.sring), 0);
+                                         virt_to_xfn(info->ring.sring), 0);
        if (err == -ENOSPC) {
                free_page((unsigned long)info->ring.sring);
                info->ring.sring = 0;
diff -r 287d36b46fa3 linux-2.6-xen-sparse/include/asm-xen/asm-i386/io.h
--- a/linux-2.6-xen-sparse/include/asm-xen/asm-i386/io.h        Tue Aug 30 
20:36:49 2005
+++ b/linux-2.6-xen-sparse/include/asm-xen/asm-i386/io.h        Fri Sep  2 
22:47:27 2005
@@ -101,7 +101,17 @@
  * Change "struct page" to physical address.
  */
 #define page_to_pseudophys(page) ((dma_addr_t)page_to_pfn(page) << PAGE_SHIFT)
+#ifndef CONFIG_XEN_SHADOW_TRANSLATE
 #define page_to_phys(page)      (phys_to_machine(page_to_pseudophys(page)))
+#else
+#define page_to_phys(page)      (page_to_pseudophys(page))
+#endif
+
+#ifndef CONFIG_XEN_SHADOW_TRANSLATE
+#define virt_to_xfn(va)         (virt_to_mfn(va))
+#else
+#define virt_to_xfn(va)         (virt_to_phys(va) >> PAGE_SHIFT)
+#endif
 
 #define bio_to_pseudophys(bio)  (page_to_pseudophys(bio_page((bio))) + \
                                  (unsigned long) bio_offset((bio)))

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
<Prev in Thread] Current Thread [Next in Thread>