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] This patch adds two macros for construction of the

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] This patch adds two macros for construction of the
From: Xen patchbot -unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Mon, 01 Aug 2005 06:44:11 -0400
Delivery-date: Mon, 01 Aug 2005 10:44:40 +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-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User kaf24@xxxxxxxxxxxxxxxxxxxx
# Node ID ae51fa1d32b23066c4342bbeb5f4dc401b82ea37
# Parent  ac7176771024daa6d8029de2735d7741c713c03e
This patch adds two macros for construction of the
frame_and_sectors field in blkif messages, to eliminate the
"magic shifts" in the blkif code.

It also increases the number of bits representing the sector
number within a page, from 3 to 5, to allow page sizes up to
16K (needed for IA64).

Tested to still work on x86.

Signed-off-by: Matthew Chapman <matthewc@xxxxxx>

diff -r ac7176771024 -r ae51fa1d32b2 
linux-2.6-xen-sparse/drivers/xen/blkfront/blkfront.c
--- a/linux-2.6-xen-sparse/drivers/xen/blkfront/blkfront.c      Mon Aug  1 
09:16:25 2005
+++ b/linux-2.6-xen-sparse/drivers/xen/blkfront/blkfront.c      Mon Aug  1 
09:26:51 2005
@@ -329,11 +329,11 @@
                 buffer_ma >> PAGE_SHIFT;
 
             ring_req->frame_and_sects[ring_req->nr_segments++] =
-                (((u32) ref) << 16) | (fsect << 3) | lsect;
+                blkif_fas_from_gref(ref, fsect, lsect);
 
 #else
             ring_req->frame_and_sects[ring_req->nr_segments++] =
-                buffer_ma | (fsect << 3) | lsect;
+                blkif_fas(buffer_ma, fsect, lsect);
 #endif
         }
     }
@@ -832,10 +832,10 @@
                 buffer_ma >> PAGE_SHIFT;
 
             req->frame_and_sects[req->nr_segments] =
-                (((u32) ref ) << 16) | (fsect << 3) | lsect;
+                blkif_fas_from_gref(ref, fsect, lsect);
 #else
             req->frame_and_sects[req->nr_segments] =
-                buffer_ma | (fsect << 3) | lsect;
+                blkif_fas(buffer_ma, fsect, lsect);
 #endif
             if ( ++req->nr_segments < BLKIF_MAX_SEGMENTS_PER_REQUEST )
                 sg_next_sect += nr_sectors;
@@ -887,9 +887,9 @@
 
     blk_shadow[xid].frame[0] = buffer_ma >> PAGE_SHIFT;
 
-    req->frame_and_sects[0] = (((u32) ref)<<16)  | (fsect<<3) | lsect;
+    req->frame_and_sects[0] = blkif_fas_from_gref(ref, fsect, lsect);
 #else
-    req->frame_and_sects[0] = buffer_ma | (fsect<<3) | lsect;
+    req->frame_and_sects[0] = blkif_fas(buffer_ma, fsect, lsect);
 #endif
 
     /* Keep a private copy so we can reissue requests when recovering. */    
@@ -1057,7 +1057,7 @@
 
     gnttab_grant_foreign_access_ref( ref, rdomid, address >> PAGE_SHIFT, 0 );
 
-    req->frame_and_sects[0] = (((u32) ref) << 16) | 7;
+    req->frame_and_sects[0] = blkif_fas_from_gref(ref, 0, (PAGE_SIZE/512)-1);
 
     blkif_control_send(req, rsp);
 }
diff -r ac7176771024 -r ae51fa1d32b2 
linux-2.6-xen-sparse/drivers/xen/blkfront/vbd.c
--- a/linux-2.6-xen-sparse/drivers/xen/blkfront/vbd.c   Mon Aug  1 09:16:25 2005
+++ b/linux-2.6-xen-sparse/drivers/xen/blkfront/vbd.c   Mon Aug  1 09:26:51 2005
@@ -137,7 +137,7 @@
     blkif_control_probe_send(&req, &rsp,
                              (unsigned long)(virt_to_machine(buf)));
 #else
-    req.frame_and_sects[0] = virt_to_machine(buf) | 7;
+    req.frame_and_sects[0] = blkif_fas(virt_to_machine(buf), 0, 
((PAGE_SIZE/512)-1);
 
     blkif_control_send(&req, &rsp);
 #endif
diff -r ac7176771024 -r ae51fa1d32b2 xen/include/public/io/blkif.h
--- a/xen/include/public/io/blkif.h     Mon Aug  1 09:16:25 2005
+++ b/xen/include/public/io/blkif.h     Mon Aug  1 09:26:51 2005
@@ -36,7 +36,7 @@
     blkif_vdev_t   device;       /* only for read/write requests         */
     unsigned long  id;           /* private guest value, echoed in resp  */
     blkif_sector_t sector_number;/* start sector idx on disk (r/w only)  */
-    /* @f_a_s[2:0]=last_sect ; @f_a_s[5:3]=first_sect                        */
+    /* @f_a_s[4:0]=last_sect ; @f_a_s[9:5]=first_sect                        */
 #ifdef CONFIG_XEN_BLKDEV_GRANT
     /* @f_a_s[:16]= grant reference (16 bits)                                */
 #else
@@ -47,10 +47,12 @@
     unsigned long  frame_and_sects[BLKIF_MAX_SEGMENTS_PER_REQUEST];
 } blkif_request_t;
 
-#define blkif_first_sect(_fas) (((_fas)>>3)&7)
-#define blkif_last_sect(_fas)  ((_fas)&7)
+#define blkif_fas(_addr, _fs, _ls) ((addr)|((_fs)<<5)|(_ls))
+#define blkif_first_sect(_fas) (((_fas)>>5)&31)
+#define blkif_last_sect(_fas)  ((_fas)&31)
 
 #ifdef CONFIG_XEN_BLKDEV_GRANT
+#define blkif_fas_from_gref(_gref, _fs, _ls) (((_gref)<<16)|((_fs)<<5)|(_ls))
 #define blkif_gref_from_fas(_fas) ((_fas)>>16)
 #endif
 

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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] This patch adds two macros for construction of the, Xen patchbot -unstable <=