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

[Xen-changelog] [xen-unstable] 32-on-64: Fixes to previous changeset.



# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1196949360 0
# Node ID baf90ee3c1dab65f4a386521be6e108920622866
# Parent  cd5e1e76d0bc66440a04122baa27860f5d763b5b
32-on-64: Fixes to previous changeset.
Signed-off-by: Keir Fraser <keir.fraser@xxxxxxxxxx>
---
 xen/common/grant_table.c         |   14 +++++++++-----
 xen/common/memory.c              |    2 +-
 xen/common/page_alloc.c          |    2 +-
 xen/include/public/grant_table.h |    6 ++++--
 4 files changed, 15 insertions(+), 9 deletions(-)

diff -r cd5e1e76d0bc -r baf90ee3c1da xen/common/grant_table.c
--- a/xen/common/grant_table.c  Thu Dec 06 13:39:19 2007 +0000
+++ b/xen/common/grant_table.c  Thu Dec 06 13:56:00 2007 +0000
@@ -1031,6 +1031,7 @@ gnttab_transfer(
     grant_entry_t *sha;
     struct gnttab_transfer gop;
     unsigned long mfn;
+    unsigned int max_bitsize;
 
     for ( i = 0; i < count; i++ )
     {
@@ -1081,24 +1082,27 @@ gnttab_transfer(
 
         if ( xsm_grant_transfer(d, e) )
         {
+            gop.status = GNTST_permission_denied;
         unlock_and_copyback:
             rcu_unlock_domain(e);
             page->count_info &= ~(PGC_count_mask|PGC_allocated);
             free_domheap_page(page);
-            gop.status = GNTST_permission_denied;
             goto copyback;
         }
 
-        if ( (1UL << domain_clamp_alloc_bitsize(e, BITS_PER_LONG-1)) <= mfn )
+        max_bitsize = domain_clamp_alloc_bitsize(
+            e, BITS_PER_LONG+PAGE_SHIFT-1);
+        if ( (1UL << (max_bitsize - PAGE_SHIFT)) <= mfn )
         {
             struct page_info *new_page;
             void *sp, *dp;
 
-            new_page = alloc_domheap_pages(
-                NULL, 0, 
-                MEMF_bits(domain_clamp_alloc_bitsize(e, BITS_PER_LONG-1)));
+            new_page = alloc_domheap_pages(NULL, 0, MEMF_bits(max_bitsize));
             if ( new_page == NULL )
+            {
+                gop.status = GNTST_address_too_big;
                 goto unlock_and_copyback;
+            }
 
             sp = map_domain_page(mfn);
             dp = map_domain_page(page_to_mfn(new_page));
diff -r cd5e1e76d0bc -r baf90ee3c1da xen/common/memory.c
--- a/xen/common/memory.c       Thu Dec 06 13:39:19 2007 +0000
+++ b/xen/common/memory.c       Thu Dec 06 13:56:00 2007 +0000
@@ -342,7 +342,7 @@ static long memory_exchange(XEN_GUEST_HA
     d = current->domain;
 
     memflags |= MEMF_bits(domain_clamp_alloc_bitsize(
-        d, exch.out.address_bits ? : BITS_PER_LONG));
+        d, exch.out.address_bits ? : (BITS_PER_LONG+PAGE_SHIFT)));
 
     cpu = select_local_cpu(d);
 
diff -r cd5e1e76d0bc -r baf90ee3c1da xen/common/page_alloc.c
--- a/xen/common/page_alloc.c   Thu Dec 06 13:39:19 2007 +0000
+++ b/xen/common/page_alloc.c   Thu Dec 06 13:56:00 2007 +0000
@@ -786,7 +786,7 @@ struct page_info *__alloc_domheap_pages(
 
     ASSERT(!in_irq());
 
-    bits = domain_clamp_alloc_bitsize(d, bits ? : BITS_PER_LONG);
+    bits = domain_clamp_alloc_bitsize(d, bits ? : (BITS_PER_LONG+PAGE_SHIFT));
     if ( bits <= (PAGE_SHIFT + 1) )
         return NULL;
 
diff -r cd5e1e76d0bc -r baf90ee3c1da xen/include/public/grant_table.h
--- a/xen/include/public/grant_table.h  Thu Dec 06 13:39:19 2007 +0000
+++ b/xen/include/public/grant_table.h  Thu Dec 06 13:56:00 2007 +0000
@@ -400,7 +400,8 @@ DEFINE_XEN_GUEST_HANDLE(gnttab_unmap_and
 #define GNTST_no_device_space  (-7) /* Out of space in I/O MMU.              */
 #define GNTST_permission_denied (-8) /* Not enough privilege for operation.  */
 #define GNTST_bad_page         (-9) /* Specified page was invalid for op.    */
-#define GNTST_bad_copy_arg    (-10) /* copy arguments cross page boundary */
+#define GNTST_bad_copy_arg    (-10) /* copy arguments cross page boundary.   */
+#define GNTST_address_too_big (-11) /* transfer page address too large.      */
 
 #define GNTTABOP_error_msgs {                   \
     "okay",                                     \
@@ -413,7 +414,8 @@ DEFINE_XEN_GUEST_HANDLE(gnttab_unmap_and
     "no spare translation slot in the I/O MMU", \
     "permission denied",                        \
     "bad page",                                 \
-    "copy arguments cross page boundary"        \
+    "copy arguments cross page boundary",       \
+    "page address size too large"               \
 }
 
 #endif /* __XEN_PUBLIC_GRANT_TABLE_H__ */

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