# HG changeset patch
# User Alex Williamson <alex.williamson@hp.com>
# Date 1193929636 21600
# Node ID 4255ca79f9d9944be4e3e0d4fdaf22aff77e7129
# Parent  41c1731c9125b74a10c8ddf2b7cf0549afb59959
# Parent  adefbadab27ce0c83cd58fe4216c3d3521235366
merge with xen-unstable.hg (staging)

diff -r 41c1731c9125 -r 4255ca79f9d9 xen/arch/ia64/xen/mm.c
--- a/xen/arch/ia64/xen/mm.c	Thu Nov 01 09:00:27 2007 -0600
+++ b/xen/arch/ia64/xen/mm.c	Thu Nov 01 09:07:16 2007 -0600
@@ -2412,7 +2412,7 @@ steal_page(struct domain *d, struct page
     return 0;
 }
 
-void
+int
 guest_physmap_add_page(struct domain *d, unsigned long gpfn,
                        unsigned long mfn)
 {
@@ -2426,6 +2426,7 @@ guest_physmap_add_page(struct domain *d,
     //BUG_ON(mfn != ((lookup_domain_mpa(d, gpfn << PAGE_SHIFT) & _PFN_MASK) >> PAGE_SHIFT));
 
     perfc_incr(guest_physmap_add_page);
+    return 0;
 }
 
 void
diff -r 41c1731c9125 -r 4255ca79f9d9 xen/common/memory.c
--- a/xen/common/memory.c	Thu Nov 01 09:00:27 2007 -0600
+++ b/xen/common/memory.c	Thu Nov 01 09:07:16 2007 -0600
@@ -131,7 +131,8 @@ static void populate_physmap(struct memo
         if ( unlikely(paging_mode_translate(d)) )
         {
             for ( j = 0; j < (1 << a->extent_order); j++ )
-                guest_physmap_add_page(d, gpfn + j, mfn + j);
+                if ( guest_physmap_add_page(d, gpfn + j, mfn + j) )
+                    goto out;
         }
         else
         {
@@ -445,8 +446,9 @@ static long memory_exchange(XEN_GUEST_HA
             mfn = page_to_mfn(page);
             if ( unlikely(paging_mode_translate(d)) )
             {
+                /* Ignore failure here. There's nothing we can do. */
                 for ( k = 0; k < (1UL << exch.out.extent_order); k++ )
-                    guest_physmap_add_page(d, gpfn + k, mfn + k);
+                    (void)guest_physmap_add_page(d, gpfn + k, mfn + k);
             }
             else
             {
diff -r 41c1731c9125 -r 4255ca79f9d9 xen/include/asm-ia64/grant_table.h
--- a/xen/include/asm-ia64/grant_table.h	Thu Nov 01 09:00:27 2007 -0600
+++ b/xen/include/asm-ia64/grant_table.h	Thu Nov 01 09:07:16 2007 -0600
@@ -12,7 +12,7 @@ int replace_grant_host_mapping(unsigned 
 int replace_grant_host_mapping(unsigned long gpaddr, unsigned long mfn, unsigned long new_gpaddr, unsigned int flags);
 
 // for grant transfer
-void guest_physmap_add_page(struct domain *d, unsigned long gpfn, unsigned long mfn);
+int guest_physmap_add_page(struct domain *d, unsigned long gpfn, unsigned long mfn);
 
 /* XXX
  * somewhere appropriate
diff -r 41c1731c9125 -r 4255ca79f9d9 xen/include/asm-ia64/shadow.h
--- a/xen/include/asm-ia64/shadow.h	Thu Nov 01 09:00:27 2007 -0600
+++ b/xen/include/asm-ia64/shadow.h	Thu Nov 01 09:07:16 2007 -0600
@@ -40,7 +40,7 @@
  * Utilities to change relationship of gpfn->mfn for designated domain,
  * which is required by gnttab transfer, balloon, device model and etc.
  */
-void guest_physmap_add_page(struct domain *d, unsigned long gpfn, unsigned long mfn);
+int guest_physmap_add_page(struct domain *d, unsigned long gpfn, unsigned long mfn);
 void guest_physmap_remove_page(struct domain *d, unsigned long gpfn, unsigned long mfn);
 
 static inline int
diff -r 41c1731c9125 -r 4255ca79f9d9 xen/include/public/hvm/ioreq.h
--- a/xen/include/public/hvm/ioreq.h	Thu Nov 01 09:00:27 2007 -0600
+++ b/xen/include/public/hvm/ioreq.h	Thu Nov 01 09:07:16 2007 -0600
@@ -80,9 +80,9 @@ struct buf_ioreq {
 struct buf_ioreq {
     uint8_t  type;   /*  I/O type                    */
     uint8_t  dir:1;  /*  1=read, 0=write             */
-    uint8_t  size:2; /*  0=>1, 1=>2, 3=>8. If 8 then use two contig buf_ioreqs */
-    uint16_t data;   /*  (low order) data            */
-    uint32_t addr;   /*  physical address or high-order data */
+    uint8_t  size:2; /*  0=>1, 1=>2, 2=>4, 3=>8. If 8, use two buf_ioreqs */
+    uint32_t addr:20;/*  physical address            */
+    uint32_t data;   /*  data                        */
 };
 typedef struct buf_ioreq buf_ioreq_t;
 
diff -r 41c1731c9125 -r 4255ca79f9d9 xen/include/xen/paging.h
--- a/xen/include/xen/paging.h	Thu Nov 01 09:00:27 2007 -0600
+++ b/xen/include/xen/paging.h	Thu Nov 01 09:07:16 2007 -0600
@@ -18,7 +18,7 @@
 #else
 
 #define paging_mode_translate(d)              (0)
-#define guest_physmap_add_page(d, p, m)       ((void)0)
+#define guest_physmap_add_page(d, p, m)       (0)
 #define guest_physmap_remove_page(d, p, m)    ((void)0)
 
 #endif
