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

Re: [Xen-devel] [PATCH v3 02/21] x86/mm: carve out replace_grant_pv_mapping



On 07/20/2017 05:04 PM, Wei Liu wrote:
> And at once make it an inline function. Add declarations of

at the same time

Other than that:

Acked-by: George Dunlap <george.dunlap@xxxxxxxxxx>

> replace_grant_{hvm,pv}_mapping to respective header files.
> 
> The code movement will be done later.
> 
> Signed-off-by: Wei Liu <wei.liu2@xxxxxxxxxx>
> ---
>  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 532b1ee7e7..defc2c9bcc 100644
> --- a/xen/arch/x86/mm.c
> +++ b/xen/arch/x86/mm.c
> @@ -4296,7 +4296,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);
> @@ -4326,8 +4326,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;
> @@ -4335,9 +4335,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 4aa22126d3..6c98672a4d 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 83202c219c..4b1afa179b 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;
>  }
>  
> +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 165ebce22f..c6474973cd 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;
>  }
>  
> +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__ */
> 


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

 


Rackspace

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