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

[Xen-changelog] [xen master] x86/mm: carve out replace_grant_pv_mapping



commit f3386a44efe24a45a15c3f126d9cbf0ae622e16b
Author:     Wei Liu <wei.liu2@xxxxxxxxxx>
AuthorDate: Fri Jul 7 14:50:36 2017 +0100
Commit:     Wei Liu <wei.liu2@xxxxxxxxxx>
CommitDate: Fri Aug 18 13:59:05 2017 +0100

    x86/mm: carve out replace_grant_pv_mapping
    
    And at once make it an inline function. Add declarations of
    replace_grant_{p2m,pv}_mapping to respective header files.
    
    The code movement will be done later.
    
    Signed-off-by: Wei Liu <wei.liu2@xxxxxxxxxx>
    Reviewed-by: Jan Beulich <jbeulich@xxxxxxxx>
---
 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(-)

diff --git a/xen/arch/x86/mm.c b/xen/arch/x86/mm.c
index 7582795..d31669f 100644
--- a/xen/arch/x86/mm.c
+++ b/xen/arch/x86/mm.c
@@ -4077,7 +4077,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);
@@ -4107,8 +4107,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;
@@ -4116,9 +4116,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 )
diff --git a/xen/include/asm-x86/grant_table.h 
b/xen/include/asm-x86/grant_table.h
index 559ad2f..33b2f88 100644
--- a/xen/include/asm-x86/grant_table.h
+++ b/xen/include/asm-x86/grant_table.h
@@ -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 {                                                                 \
diff --git a/xen/include/asm-x86/hvm/grant_table.h 
b/xen/include/asm-x86/hvm/grant_table.h
index 83202c2..711ce9b 100644
--- a/xen/include/asm-x86/hvm/grant_table.h
+++ b/xen/include/asm-x86/hvm/grant_table.h
@@ -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;
 }
 
+static inline 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__ */
diff --git a/xen/include/asm-x86/pv/grant_table.h 
b/xen/include/asm-x86/pv/grant_table.h
index 165ebce..556e68f 100644
--- a/xen/include/asm-x86/pv/grant_table.h
+++ b/xen/include/asm-x86/pv/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;
 }
 
+static inline 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__ */
--
generated by git-patchbot for /home/xen/git/xen.git#master

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
https://lists.xenproject.org/xen-changelog

 


Rackspace

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