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

Re: [Xen-devel] [PATCH 12/14] xen/gnttab: Drop gnttab_create_{shared, status}_page()



Hi Andrew,

On 11/21/18 1:21 PM, Andrew Cooper wrote:
share_xen_page_with_guest() is a common API.  Use it directly rather than
wrapping it with unnecessary boilerplate.

Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>

Acked-by: Julien Grall <julien.grall@xxxxxxx>

Cheers,

---
CC: Jan Beulich <JBeulich@xxxxxxxx>
CC: Wei Liu <wei.liu2@xxxxxxxxxx>
CC: Roger Pau Monné <roger.pau@xxxxxxxxxx>
CC: Stefano Stabellini <sstabellini@xxxxxxxxxx>
CC: Julien Grall <julien.grall@xxxxxxx>
---
  xen/common/grant_table.c          |  7 ++++---
  xen/include/asm-arm/grant_table.h | 12 ------------
  xen/include/asm-x86/grant_table.h | 13 -------------
  3 files changed, 4 insertions(+), 28 deletions(-)

diff --git a/xen/common/grant_table.c b/xen/common/grant_table.c
index 6fc26cf..d5a1a00 100644
--- a/xen/common/grant_table.c
+++ b/xen/common/grant_table.c
@@ -1635,7 +1635,7 @@ gnttab_populate_status_frames(struct domain *d, struct 
grant_table *gt,
      }
      /* Share the new status frames with the recipient domain */
      for ( i = nr_status_frames(gt); i < req_status_frames; i++ )
-        gnttab_create_status_page(d, gt, i);
+        share_xen_page_with_guest(virt_to_page(gt->status[i]), d, SHARE_rw);
gt->nr_status_frames = req_status_frames; @@ -1702,7 +1702,8 @@ gnttab_unpopulate_status_frames(struct domain *d, struct grant_table *gt)
                  if ( get_page(pg, d) )
                      set_bit(_PGC_allocated, &pg->count_info);
                  while ( i-- )
-                    gnttab_create_status_page(d, gt, i);
+                    share_xen_page_with_guest(virt_to_page(gt->status[i]),
+                                              d, SHARE_rw);
              }
              return -EBUSY;
          }
@@ -1773,7 +1774,7 @@ gnttab_grow_table(struct domain *d, unsigned int 
req_nr_frames)
/* Share the new shared frames with the recipient domain */
      for ( i = nr_grant_frames(gt); i < req_nr_frames; i++ )
-        gnttab_create_shared_page(d, gt, i);
+        share_xen_page_with_guest(virt_to_page(gt->shared_raw[i]), d, 
SHARE_rw);
      gt->nr_grant_frames = req_nr_frames;
return 0;
diff --git a/xen/include/asm-arm/grant_table.h 
b/xen/include/asm-arm/grant_table.h
index 37415b7..816e3c6 100644
--- a/xen/include/asm-arm/grant_table.h
+++ b/xen/include/asm-arm/grant_table.h
@@ -71,18 +71,6 @@ void gnttab_mark_dirty(struct domain *d, mfn_t mfn);
               : gnttab_shared_gmfn(NULL, gt, idx));                       \
  })
-#define gnttab_create_shared_page(d, t, i) \
-    do {                                                                 \
-        share_xen_page_with_guest(                                       \
-            virt_to_page((char *)(t)->shared_raw[i]), d, SHARE_rw);      \
-    } while ( 0 )
-
-#define gnttab_create_status_page(d, t, i)                               \
-    do {                                                                 \
-        share_xen_page_with_guest(                                       \
-            virt_to_page((char *)(t)->status[i]), d, SHARE_rw);          \
-    } while ( 0 )
-
  #define gnttab_shared_gmfn(d, t, i)                                      \
      gfn_x(((i) >= nr_grant_frames(t)) ? INVALID_GFN : (t)->arch.shared_gfn[i])
diff --git a/xen/include/asm-x86/grant_table.h b/xen/include/asm-x86/grant_table.h
index 1e6a988..4b8c4f9 100644
--- a/xen/include/asm-x86/grant_table.h
+++ b/xen/include/asm-x86/grant_table.h
@@ -49,19 +49,6 @@ static inline int replace_grant_host_mapping(uint64_t addr, 
mfn_t frame,
      VALID_M2P(gpfn_) ? _gfn(gpfn_) : INVALID_GFN;                        \
  })
-#define gnttab_create_shared_page(d, t, i) \
-    do {                                                                 \
-        share_xen_page_with_guest(                                       \
-            virt_to_page((char *)(t)->shared_raw[i]), d, SHARE_rw);      \
-    } while ( 0 )
-
-#define gnttab_create_status_page(d, t, i)                               \
-    do {                                                                 \
-        share_xen_page_with_guest(                                       \
-            virt_to_page((char *)(t)->status[i]), d, SHARE_rw);          \
-    } while ( 0 )
-
-
  #define gnttab_shared_mfn(t, i)                         \
      ((virt_to_maddr((t)->shared_raw[i]) >> PAGE_SHIFT))

--
Julien Grall

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.