All of lore.kernel.org
 help / color / mirror / Atom feed
From: George Dunlap <george.dunlap@citrix.com>
To: Andrew Cooper <andrew.cooper3@citrix.com>,
	Xen-devel <xen-devel@lists.xen.org>
Cc: George Dunlap <george.dunlap@eu.citrix.com>,
	Julien Grall <julien.grall@arm.com>,
	Stefano Stabellini <sstabellini@kernel.org>,
	Tim Deegan <tim@xen.org>, Jan Beulich <JBeulich@suse.com>
Subject: Re: [PATCH] xen/mm: Alter is_iomem_page() to use mfn_t
Date: Mon, 6 Feb 2017 14:11:49 +0000	[thread overview]
Message-ID: <5c5bffa3-ffe4-2377-4e9f-f5e9d4244180@citrix.com> (raw)
In-Reply-To: <1486389313-8326-1-git-send-email-andrew.cooper3@citrix.com>

On 06/02/17 13:55, Andrew Cooper wrote:
> Switch its return type to bool to match its use, and simplify the ARM
> implementation slightly.
> 
> No functional change.
> 
> Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>

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

> ---
> CC: Jan Beulich <JBeulich@suse.com>
> CC: Tim Deegan <tim@xen.org>
> CC: George Dunlap <george.dunlap@eu.citrix.com>
> CC: Stefano Stabellini <sstabellini@kernel.org>
> CC: Julien Grall <julien.grall@arm.com>
> ---
>  xen/arch/arm/mm.c         |  6 ++----
>  xen/arch/x86/mm.c         | 10 +++++-----
>  xen/arch/x86/mm/p2m.c     |  2 +-
>  xen/common/grant_table.c  | 12 ++++++------
>  xen/include/asm-arm/p2m.h |  2 +-
>  xen/include/asm-x86/mm.h  |  2 +-
>  6 files changed, 16 insertions(+), 18 deletions(-)
> 
> diff --git a/xen/arch/arm/mm.c b/xen/arch/arm/mm.c
> index 596283f..fbeed0e 100644
> --- a/xen/arch/arm/mm.c
> +++ b/xen/arch/arm/mm.c
> @@ -1349,11 +1349,9 @@ int replace_grant_host_mapping(unsigned long addr, unsigned long mfn,
>      return GNTST_okay;
>  }
>  
> -int is_iomem_page(unsigned long mfn)
> +bool is_iomem_page(mfn_t mfn)
>  {
> -    if ( !mfn_valid(mfn) )
> -        return 1;
> -    return 0;
> +    return !mfn_valid(mfn_x(mfn));
>  }
>  
>  void clear_and_clean_page(struct page_info *page)
> diff --git a/xen/arch/x86/mm.c b/xen/arch/x86/mm.c
> index f35e311..f87c08f 100644
> --- a/xen/arch/x86/mm.c
> +++ b/xen/arch/x86/mm.c
> @@ -789,15 +789,15 @@ get_##level##_linear_pagetable(                                             \
>  }
>  
>  
> -int is_iomem_page(unsigned long mfn)
> +bool is_iomem_page(mfn_t mfn)
>  {
>      struct page_info *page;
>  
> -    if ( !mfn_valid(mfn) )
> -        return 1;
> +    if ( !mfn_valid(mfn_x(mfn)) )
> +        return true;
>  
>      /* Caller must know that it is an iomem page, or a reference is held. */
> -    page = mfn_to_page(mfn);
> +    page = mfn_to_page(mfn_x(mfn));
>      ASSERT((page->count_info & PGC_count_mask) != 0);
>  
>      return (page_get_owner(page) == dom_io);
> @@ -1209,7 +1209,7 @@ void put_page_from_l1e(l1_pgentry_t l1e, struct domain *l1e_owner)
>      struct domain    *pg_owner;
>      struct vcpu      *v;
>  
> -    if ( !(l1e_get_flags(l1e) & _PAGE_PRESENT) || is_iomem_page(pfn) )
> +    if ( !(l1e_get_flags(l1e) & _PAGE_PRESENT) || is_iomem_page(_mfn(pfn)) )
>          return;
>  
>      page = mfn_to_page(pfn);
> diff --git a/xen/arch/x86/mm/p2m.c b/xen/arch/x86/mm/p2m.c
> index 73d93ee..6548e9f 100644
> --- a/xen/arch/x86/mm/p2m.c
> +++ b/xen/arch/x86/mm/p2m.c
> @@ -1240,7 +1240,7 @@ int p2m_mem_paging_nominate(struct domain *d, unsigned long gfn)
>          goto out;
>  
>      /* Check for io memory page */
> -    if ( is_iomem_page(mfn_x(mfn)) )
> +    if ( is_iomem_page(mfn) )
>          goto out;
>  
>      /* Check page count and type */
> diff --git a/xen/common/grant_table.c b/xen/common/grant_table.c
> index a425a9e..1b7d236 100644
> --- a/xen/common/grant_table.c
> +++ b/xen/common/grant_table.c
> @@ -1259,7 +1259,7 @@ __gnttab_unmap_common_complete(struct gnttab_unmap_common *op)
>  
>      if ( op->flags & GNTMAP_device_map ) 
>      {
> -        if ( !is_iomem_page(act->frame) )
> +        if ( !is_iomem_page(_mfn(act->frame)) )
>          {
>              if ( op->flags & GNTMAP_readonly )
>                  put_page(pg);
> @@ -1279,7 +1279,7 @@ __gnttab_unmap_common_complete(struct gnttab_unmap_common *op)
>              goto act_release_out;
>          }
>  
> -        if ( !is_iomem_page(op->frame) ) 
> +        if ( !is_iomem_page(_mfn(op->frame)) )
>          {
>              if ( gnttab_host_mapping_get_page_type(op, ld, rd) )
>                  put_page_type(pg);
> @@ -3314,7 +3314,7 @@ gnttab_release_mappings(
>              {
>                  BUG_ON(!(act->pin & GNTPIN_devr_mask));
>                  act->pin -= GNTPIN_devr_inc;
> -                if ( !is_iomem_page(act->frame) )
> +                if ( !is_iomem_page(_mfn(act->frame)) )
>                      put_page(pg);
>              }
>  
> @@ -3323,7 +3323,7 @@ gnttab_release_mappings(
>                  BUG_ON(!(act->pin & GNTPIN_hstr_mask));
>                  act->pin -= GNTPIN_hstr_inc;
>                  if ( gnttab_release_host_mappings(d) &&
> -                     !is_iomem_page(act->frame) )
> +                     !is_iomem_page(_mfn(act->frame)) )
>                      put_page(pg);
>              }
>          }
> @@ -3333,7 +3333,7 @@ gnttab_release_mappings(
>              {
>                  BUG_ON(!(act->pin & GNTPIN_devw_mask));
>                  act->pin -= GNTPIN_devw_inc;
> -                if ( !is_iomem_page(act->frame) )
> +                if ( !is_iomem_page(_mfn(act->frame)) )
>                      put_page_and_type(pg);
>              }
>  
> @@ -3342,7 +3342,7 @@ gnttab_release_mappings(
>                  BUG_ON(!(act->pin & GNTPIN_hstw_mask));
>                  act->pin -= GNTPIN_hstw_inc;
>                  if ( gnttab_release_host_mappings(d) &&
> -                     !is_iomem_page(act->frame) )
> +                     !is_iomem_page(_mfn(act->frame)) )
>                  {
>                      if ( gnttab_host_mapping_get_page_type(map, d, rd) )
>                          put_page_type(pg);
> diff --git a/xen/include/asm-arm/p2m.h b/xen/include/asm-arm/p2m.h
> index 5ddad34..0905a3f 100644
> --- a/xen/include/asm-arm/p2m.h
> +++ b/xen/include/asm-arm/p2m.h
> @@ -314,7 +314,7 @@ static inline struct page_info *get_page_from_gfn(
>  }
>  
>  int get_page_type(struct page_info *page, unsigned long type);
> -int is_iomem_page(unsigned long mfn);
> +bool is_iomem_page(mfn_t mfn);
>  static inline int get_page_and_type(struct page_info *page,
>                                      struct domain *domain,
>                                      unsigned long type)
> diff --git a/xen/include/asm-x86/mm.h b/xen/include/asm-x86/mm.h
> index 93a073d..f0efacb 100644
> --- a/xen/include/asm-x86/mm.h
> +++ b/xen/include/asm-x86/mm.h
> @@ -326,7 +326,7 @@ void init_guest_l4_table(l4_pgentry_t[], const struct domain *,
>  bool_t fill_ro_mpt(unsigned long mfn);
>  void zap_ro_mpt(unsigned long mfn);
>  
> -int is_iomem_page(unsigned long mfn);
> +bool is_iomem_page(mfn_t mfn);
>  
>  void clear_superpage_mark(struct page_info *page);
>  
> 


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

  parent reply	other threads:[~2017-02-06 14:11 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-06 13:55 [PATCH] xen/mm: Alter is_iomem_page() to use mfn_t Andrew Cooper
2017-02-06 14:02 ` Julien Grall
2017-02-06 14:11 ` George Dunlap [this message]
2017-02-06 14:26 ` Jan Beulich
2017-02-06 14:48   ` David Woodhouse
2017-02-06 15:38     ` Jan Beulich
2017-02-08  7:31       ` Tian, Kevin
2017-02-08 17:05         ` Jan Beulich
2017-02-09  8:27           ` Chao Gao
2017-02-09  8:56             ` Jan Beulich
2017-02-09  3:54               ` Chao Gao
2017-02-09 11:10                 ` David Woodhouse
2017-02-09  9:01               ` David Woodhouse

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5c5bffa3-ffe4-2377-4e9f-f5e9d4244180@citrix.com \
    --to=george.dunlap@citrix.com \
    --cc=JBeulich@suse.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=george.dunlap@eu.citrix.com \
    --cc=julien.grall@arm.com \
    --cc=sstabellini@kernel.org \
    --cc=tim@xen.org \
    --cc=xen-devel@lists.xen.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.