@@ -4068,7 +4068,7 @@ int create_grant_pv_mapping(uint64_t addr, unsigned long frame,
return create_grant_va_mapping(addr, pte, current);
}
-static int replace_grant_p2m_mapping(
+int replace_grant_p2m_mapping(
uint64_t addr, unsigned long frame, uint64_t new_addr, unsigned int flags)
{
unsigned long gfn = (unsigned long)(addr >> PAGE_SHIFT);
@@ -4098,8 +4098,8 @@ static int replace_grant_p2m_mapping(
return GNTST_okay;
}
-int replace_grant_host_mapping(
- uint64_t addr, unsigned long frame, uint64_t new_addr, unsigned int flags)
+int replace_grant_pv_mapping(uint64_t addr, unsigned long frame,
+ uint64_t new_addr, unsigned int flags)
{
struct vcpu *curr = current;
l1_pgentry_t *pl1e, ol1e;
@@ -4107,9 +4107,6 @@ int replace_grant_host_mapping(
struct page_info *l1pg;
int rc;
- if ( paging_mode_external(current->domain) )
- return replace_grant_p2m_mapping(addr, frame, new_addr, flags);
-
if ( flags & GNTMAP_contains_pte )
{
if ( !new_addr )
@@ -27,8 +27,14 @@ static inline int create_grant_host_mapping(uint64_t addr, unsigned long frame,
return create_grant_pv_mapping(addr, frame, flags, cache_flags);
}
-int replace_grant_host_mapping(
- uint64_t addr, unsigned long frame, uint64_t new_addr, unsigned int flags);
+static inline int replace_grant_host_mapping(uint64_t addr, unsigned long frame,
+ uint64_t new_addr,
+ unsigned int flags)
+{
+ if ( paging_mode_external(current->domain) )
+ return replace_grant_p2m_mapping(addr, frame, new_addr, flags);
+ return replace_grant_pv_mapping(addr, frame, new_addr, flags);
+}
#define gnttab_create_shared_page(d, t, i) \
do { \
@@ -26,6 +26,8 @@
int create_grant_p2m_mapping(uint64_t addr, unsigned long frame,
unsigned int flags,
unsigned int cache_flags);
+int replace_grant_p2m_mapping(uint64_t addr, unsigned long frame,
+ uint64_t new_addr, unsigned int flags);
#else
@@ -38,6 +40,12 @@ static inline int create_grant_p2m_mapping(uint64_t addr, unsigned long frame,
return GNTST_general_error;
}
+int replace_grant_p2m_mapping(uint64_t addr, unsigned long frame,
+ uint64_t new_addr, unsigned int flags)
+{
+ return GNTST_general_error;
+}
+
#endif
#endif /* __X86_HVM_GRANT_TABLE_H__ */
@@ -25,6 +25,8 @@
int create_grant_pv_mapping(uint64_t addr, unsigned long frame,
unsigned int flags, unsigned int cache_flags);
+int replace_grant_pv_mapping(uint64_t addr, unsigned long frame,
+ uint64_t new_addr, unsigned int flags);
#else
@@ -37,6 +39,12 @@ static inline int create_grant_pv_mapping(uint64_t addr, unsigned long frame,
return GNTST_general_error;
}
+int replace_grant_pv_mapping(uint64_t addr, unsigned long frame,
+ uint64_t new_addr, unsigned int flags)
+{
+ return GNTST_general_error;
+}
+
#endif
#endif /* __X86_PV_GRANT_TABLE_H__ */
And at once make it an inline function. Add declarations of replace_grant_{hvm,pv}_mapping to respective header files. The code movement will be done later. Signed-off-by: Wei Liu <wei.liu2@citrix.com> --- xen/arch/x86/mm.c | 9 +++------ xen/include/asm-x86/grant_table.h | 10 ++++++++-- xen/include/asm-x86/hvm/grant_table.h | 8 ++++++++ xen/include/asm-x86/pv/grant_table.h | 8 ++++++++ 4 files changed, 27 insertions(+), 8 deletions(-)