diff mbox

[v2,03/24] xen/mm: Use __virt_to_mfn in map_domain_page instead of virt_to_mfn

Message ID 20170912100330.2168-4-julien.grall@arm.com (mailing list archive)
State New, archived
Headers show

Commit Message

Julien Grall Sept. 12, 2017, 10:03 a.m. UTC
virt_to_mfn may by overridden by the source files, for improving locally
typesafe.

Therefore map_domain_page has to use __virt_to_mfn to prevent any
compilation issue in sources files that override the helper.

Signed-off-by: Julien Grall <julien.grall@arm.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
---

Changes in v2:
    - Add Jan's acked-by

Cc: Stefano Stabellini <sstabellini@kernel.org>
Cc: Andrew Cooper <andrew.cooper3@citrix.com>
Cc: George Dunlap <George.Dunlap@eu.citrix.com>
Cc: Ian Jackson <ian.jackson@eu.citrix.com>
Cc: Jan Beulich <jbeulich@suse.com>
Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Cc: Tim Deegan <tim@xen.org>
Cc: Wei Liu <wei.liu2@citrix.com>
---
 xen/include/asm-arm/mm.h      | 3 ++-
 xen/include/xen/domain_page.h | 2 +-
 2 files changed, 3 insertions(+), 2 deletions(-)

Comments

Wei Liu Sept. 12, 2017, 10:29 a.m. UTC | #1
On Tue, Sep 12, 2017 at 11:03:09AM +0100, Julien Grall wrote:
> virt_to_mfn may by overridden by the source files, for improving locally
> typesafe.
> 
> Therefore map_domain_page has to use __virt_to_mfn to prevent any
> compilation issue in sources files that override the helper.
> 
> Signed-off-by: Julien Grall <julien.grall@arm.com>
> Acked-by: Jan Beulich <jbeulich@suse.com>

Reviewed-by: Wei Liu <wei.liu2@citrix.com>
Stefano Stabellini Sept. 15, 2017, 11:39 p.m. UTC | #2
On Tue, 12 Sep 2017, Julien Grall wrote:
> virt_to_mfn may by overridden by the source files, for improving locally
> typesafe.
> 
> Therefore map_domain_page has to use __virt_to_mfn to prevent any
> compilation issue in sources files that override the helper.
> 
> Signed-off-by: Julien Grall <julien.grall@arm.com>
> Acked-by: Jan Beulich <jbeulich@suse.com>

Acked-by: Stefano Stabellini <sstabellini@kernel.org>


> ---
> 
> Changes in v2:
>     - Add Jan's acked-by
> 
> Cc: Stefano Stabellini <sstabellini@kernel.org>
> Cc: Andrew Cooper <andrew.cooper3@citrix.com>
> Cc: George Dunlap <George.Dunlap@eu.citrix.com>
> Cc: Ian Jackson <ian.jackson@eu.citrix.com>
> Cc: Jan Beulich <jbeulich@suse.com>
> Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
> Cc: Tim Deegan <tim@xen.org>
> Cc: Wei Liu <wei.liu2@citrix.com>
> ---
>  xen/include/asm-arm/mm.h      | 3 ++-
>  xen/include/xen/domain_page.h | 2 +-
>  2 files changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/xen/include/asm-arm/mm.h b/xen/include/asm-arm/mm.h
> index 7de2f32f58..cd6dfb54b9 100644
> --- a/xen/include/asm-arm/mm.h
> +++ b/xen/include/asm-arm/mm.h
> @@ -281,7 +281,7 @@ static inline int gvirt_to_maddr(vaddr_t va, paddr_t *pa, unsigned int flags)
>  
>  /* Convert between Xen-heap virtual addresses and machine frame numbers. */
>  #define __virt_to_mfn(va) (virt_to_maddr(va) >> PAGE_SHIFT)
> -#define mfn_to_virt(mfn)  (maddr_to_virt((paddr_t)(mfn) << PAGE_SHIFT))
> +#define __mfn_to_virt(mfn) (maddr_to_virt((paddr_t)(mfn) << PAGE_SHIFT))
>  
>  /*
>   * We define non-underscored wrappers for above conversion functions.
> @@ -291,6 +291,7 @@ static inline int gvirt_to_maddr(vaddr_t va, paddr_t *pa, unsigned int flags)
>  #define mfn_to_page(mfn)    __mfn_to_page(mfn)
>  #define page_to_mfn(pg)     __page_to_mfn(pg)
>  #define virt_to_mfn(va)     __virt_to_mfn(va)
> +#define mfn_to_virt(mfn)    __mfn_to_virt(mfn)
>  
>  /* Convert between Xen-heap virtual addresses and page-info structures. */
>  static inline struct page_info *virt_to_page(const void *v)
> diff --git a/xen/include/xen/domain_page.h b/xen/include/xen/domain_page.h
> index 93f2a5aaf7..890bae5b9c 100644
> --- a/xen/include/xen/domain_page.h
> +++ b/xen/include/xen/domain_page.h
> @@ -53,7 +53,7 @@ static inline void *__map_domain_page_global(const struct page_info *pg)
>  
>  #else /* !CONFIG_DOMAIN_PAGE */
>  
> -#define map_domain_page(mfn)                mfn_to_virt(mfn_x(mfn))
> +#define map_domain_page(mfn)                __mfn_to_virt(mfn_x(mfn))
>  #define __map_domain_page(pg)               page_to_virt(pg)
>  #define unmap_domain_page(va)               ((void)(va))
>  #define domain_page_map_to_mfn(va)          virt_to_mfn((unsigned long)(va))
> -- 
> 2.11.0
>
diff mbox

Patch

diff --git a/xen/include/asm-arm/mm.h b/xen/include/asm-arm/mm.h
index 7de2f32f58..cd6dfb54b9 100644
--- a/xen/include/asm-arm/mm.h
+++ b/xen/include/asm-arm/mm.h
@@ -281,7 +281,7 @@  static inline int gvirt_to_maddr(vaddr_t va, paddr_t *pa, unsigned int flags)
 
 /* Convert between Xen-heap virtual addresses and machine frame numbers. */
 #define __virt_to_mfn(va) (virt_to_maddr(va) >> PAGE_SHIFT)
-#define mfn_to_virt(mfn)  (maddr_to_virt((paddr_t)(mfn) << PAGE_SHIFT))
+#define __mfn_to_virt(mfn) (maddr_to_virt((paddr_t)(mfn) << PAGE_SHIFT))
 
 /*
  * We define non-underscored wrappers for above conversion functions.
@@ -291,6 +291,7 @@  static inline int gvirt_to_maddr(vaddr_t va, paddr_t *pa, unsigned int flags)
 #define mfn_to_page(mfn)    __mfn_to_page(mfn)
 #define page_to_mfn(pg)     __page_to_mfn(pg)
 #define virt_to_mfn(va)     __virt_to_mfn(va)
+#define mfn_to_virt(mfn)    __mfn_to_virt(mfn)
 
 /* Convert between Xen-heap virtual addresses and page-info structures. */
 static inline struct page_info *virt_to_page(const void *v)
diff --git a/xen/include/xen/domain_page.h b/xen/include/xen/domain_page.h
index 93f2a5aaf7..890bae5b9c 100644
--- a/xen/include/xen/domain_page.h
+++ b/xen/include/xen/domain_page.h
@@ -53,7 +53,7 @@  static inline void *__map_domain_page_global(const struct page_info *pg)
 
 #else /* !CONFIG_DOMAIN_PAGE */
 
-#define map_domain_page(mfn)                mfn_to_virt(mfn_x(mfn))
+#define map_domain_page(mfn)                __mfn_to_virt(mfn_x(mfn))
 #define __map_domain_page(pg)               page_to_virt(pg)
 #define unmap_domain_page(va)               ((void)(va))
 #define domain_page_map_to_mfn(va)          virt_to_mfn((unsigned long)(va))