diff mbox series

[Xen-devel,for-next,6/9] xen: Convert is_xen_fixed_mfn to use typesafe MFN

Message ID 20190218113600.9540-7-julien.grall@arm.com
State Superseded
Headers show
Series xen/arm: Properly disable M2P on Arm. | expand

Commit Message

Julien Grall Feb. 18, 2019, 11:35 a.m. UTC
No functional changes.

Signed-off-by: Julien Grall <julien.grall@arm.com>
---
 xen/arch/x86/tboot.c     | 2 +-
 xen/common/page_alloc.c  | 2 +-
 xen/include/asm-arm/mm.h | 4 ++--
 xen/include/asm-x86/mm.h | 4 ++--
 4 files changed, 6 insertions(+), 6 deletions(-)

Comments

Jan Beulich March 13, 2019, 2:58 p.m. UTC | #1
>>> On 18.02.19 at 12:35, <julien.grall@arm.com> wrote:
> No functional changes.
> 
> Signed-off-by: Julien Grall <julien.grall@arm.com>

Reviewed-by: Jan Beulich <jbeulich@suse.com>
Stefano Stabellini April 15, 2019, 10:05 p.m. UTC | #2
On Mon, 18 Feb 2019, Julien Grall wrote:
> No functional changes.
> 
> Signed-off-by: Julien Grall <julien.grall@arm.com>

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


> ---
>  xen/arch/x86/tboot.c     | 2 +-
>  xen/common/page_alloc.c  | 2 +-
>  xen/include/asm-arm/mm.h | 4 ++--
>  xen/include/asm-x86/mm.h | 4 ++--
>  4 files changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/xen/arch/x86/tboot.c b/xen/arch/x86/tboot.c
> index f3fdee4d39..30d159cc62 100644
> --- a/xen/arch/x86/tboot.c
> +++ b/xen/arch/x86/tboot.c
> @@ -280,7 +280,7 @@ static void tboot_gen_xenheap_integrity(const uint8_t key[TB_KEY_SIZE],
>  
>          if ( !mfn_valid(_mfn(mfn)) )
>              continue;
> -        if ( is_xen_fixed_mfn(mfn) )
> +        if ( is_xen_fixed_mfn(_mfn(mfn)) )
>              continue; /* skip Xen */
>          if ( (mfn >= PFN_DOWN(g_tboot_shared->tboot_base - 3 * PAGE_SIZE))
>               && (mfn < PFN_UP(g_tboot_shared->tboot_base
> diff --git a/xen/common/page_alloc.c b/xen/common/page_alloc.c
> index 5684a13557..5de3686d85 100644
> --- a/xen/common/page_alloc.c
> +++ b/xen/common/page_alloc.c
> @@ -1584,7 +1584,7 @@ int offline_page(mfn_t mfn, int broken, uint32_t *status)
>      *status = 0;
>      pg = mfn_to_page(mfn);
>  
> -    if ( is_xen_fixed_mfn(mfn_x(mfn)) )
> +    if ( is_xen_fixed_mfn(mfn) )
>      {
>          *status = PG_OFFLINE_XENPAGE | PG_OFFLINE_FAILED |
>            (DOMID_XEN << PG_OFFLINE_OWNER_SHIFT);
> diff --git a/xen/include/asm-arm/mm.h b/xen/include/asm-arm/mm.h
> index 7b6aaf5e3f..b56018aace 100644
> --- a/xen/include/asm-arm/mm.h
> +++ b/xen/include/asm-arm/mm.h
> @@ -151,8 +151,8 @@ extern vaddr_t xenheap_virt_start;
>  #endif
>  
>  #define is_xen_fixed_mfn(mfn)                                   \
> -    ((pfn_to_paddr(mfn) >= virt_to_maddr(&_start)) &&       \
> -     (pfn_to_paddr(mfn) <= virt_to_maddr(&_end)))
> +    ((mfn_to_maddr(mfn) >= virt_to_maddr(&_start)) &&           \
> +     (mfn_to_maddr(mfn) <= virt_to_maddr(&_end)))
>  
>  #define page_get_owner(_p)    (_p)->v.inuse.domain
>  #define page_set_owner(_p,_d) ((_p)->v.inuse.domain = (_d))
> diff --git a/xen/include/asm-x86/mm.h b/xen/include/asm-x86/mm.h
> index 6faa563167..f124f57964 100644
> --- a/xen/include/asm-x86/mm.h
> +++ b/xen/include/asm-x86/mm.h
> @@ -280,8 +280,8 @@ struct page_info
>  #define is_xen_heap_mfn(mfn) \
>      (__mfn_valid(mfn) && is_xen_heap_page(mfn_to_page(_mfn(mfn))))
>  #define is_xen_fixed_mfn(mfn)                     \
> -    ((((mfn) << PAGE_SHIFT) >= __pa(&_stext)) &&  \
> -     (((mfn) << PAGE_SHIFT) <= __pa(&__2M_rwdata_end)))
> +    (((mfn_to_maddr(mfn)) >= __pa(&_stext)) &&    \
> +     ((mfn_to_maddr(mfn)) <= __pa(&__2M_rwdata_end)))
>  
>  #define PRtype_info "016lx"/* should only be used for printk's */
>  
> -- 
> 2.11.0
>
diff mbox series

Patch

diff --git a/xen/arch/x86/tboot.c b/xen/arch/x86/tboot.c
index f3fdee4d39..30d159cc62 100644
--- a/xen/arch/x86/tboot.c
+++ b/xen/arch/x86/tboot.c
@@ -280,7 +280,7 @@  static void tboot_gen_xenheap_integrity(const uint8_t key[TB_KEY_SIZE],
 
         if ( !mfn_valid(_mfn(mfn)) )
             continue;
-        if ( is_xen_fixed_mfn(mfn) )
+        if ( is_xen_fixed_mfn(_mfn(mfn)) )
             continue; /* skip Xen */
         if ( (mfn >= PFN_DOWN(g_tboot_shared->tboot_base - 3 * PAGE_SIZE))
              && (mfn < PFN_UP(g_tboot_shared->tboot_base
diff --git a/xen/common/page_alloc.c b/xen/common/page_alloc.c
index 5684a13557..5de3686d85 100644
--- a/xen/common/page_alloc.c
+++ b/xen/common/page_alloc.c
@@ -1584,7 +1584,7 @@  int offline_page(mfn_t mfn, int broken, uint32_t *status)
     *status = 0;
     pg = mfn_to_page(mfn);
 
-    if ( is_xen_fixed_mfn(mfn_x(mfn)) )
+    if ( is_xen_fixed_mfn(mfn) )
     {
         *status = PG_OFFLINE_XENPAGE | PG_OFFLINE_FAILED |
           (DOMID_XEN << PG_OFFLINE_OWNER_SHIFT);
diff --git a/xen/include/asm-arm/mm.h b/xen/include/asm-arm/mm.h
index 7b6aaf5e3f..b56018aace 100644
--- a/xen/include/asm-arm/mm.h
+++ b/xen/include/asm-arm/mm.h
@@ -151,8 +151,8 @@  extern vaddr_t xenheap_virt_start;
 #endif
 
 #define is_xen_fixed_mfn(mfn)                                   \
-    ((pfn_to_paddr(mfn) >= virt_to_maddr(&_start)) &&       \
-     (pfn_to_paddr(mfn) <= virt_to_maddr(&_end)))
+    ((mfn_to_maddr(mfn) >= virt_to_maddr(&_start)) &&           \
+     (mfn_to_maddr(mfn) <= virt_to_maddr(&_end)))
 
 #define page_get_owner(_p)    (_p)->v.inuse.domain
 #define page_set_owner(_p,_d) ((_p)->v.inuse.domain = (_d))
diff --git a/xen/include/asm-x86/mm.h b/xen/include/asm-x86/mm.h
index 6faa563167..f124f57964 100644
--- a/xen/include/asm-x86/mm.h
+++ b/xen/include/asm-x86/mm.h
@@ -280,8 +280,8 @@  struct page_info
 #define is_xen_heap_mfn(mfn) \
     (__mfn_valid(mfn) && is_xen_heap_page(mfn_to_page(_mfn(mfn))))
 #define is_xen_fixed_mfn(mfn)                     \
-    ((((mfn) << PAGE_SHIFT) >= __pa(&_stext)) &&  \
-     (((mfn) << PAGE_SHIFT) <= __pa(&__2M_rwdata_end)))
+    (((mfn_to_maddr(mfn)) >= __pa(&_stext)) &&    \
+     ((mfn_to_maddr(mfn)) <= __pa(&__2M_rwdata_end)))
 
 #define PRtype_info "016lx"/* should only be used for printk's */