Discussion:
[Xen-changelog] [xen staging] xen/gnttab: Drop gnttab_create_{shared, status}_page()
p***@xen.org
2018-11-22 19:11:45 UTC
Permalink
commit 53fa8c88833207e950014da12cf535847b789774
Author: Andrew Cooper <***@citrix.com>
AuthorDate: Wed Oct 24 13:12:35 2018 +0100
Commit: Andrew Cooper <***@citrix.com>
CommitDate: Thu Nov 22 17:58:46 2018 +0000

xen/gnttab: Drop gnttab_create_{shared,status}_page()

share_xen_page_with_guest() is a common API. Use it directly rather than
wrapping it with unnecessary boilerplate.

Signed-off-by: Andrew Cooper <***@citrix.com>
Acked-by: Julien Grall <***@arm.com>
Reviewed-by: Jan Beulich <***@suse.com>
---
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 f7860f6548..9ddfee1da9 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 37415b7821..816e3c6d68 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 1e6a98813d..4b8c4f9160 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))

--
generated by git-patchbot for /home/xen/git/xen.git#staging

Loading...