All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stefano Stabellini <sstabellini@kernel.org>
To: Julien Grall <julien.grall@arm.com>
Cc: sstabellini@kernel.org, andre.przywara@linaro.org,
	xen-devel@lists.xen.org
Subject: Re: [RFC 06/16] xen/arm: p2m: Introduce a helper to generate P2M table entry from a page
Date: Mon, 29 Oct 2018 17:14:47 -0700 (PDT)	[thread overview]
Message-ID: <alpine.DEB.2.10.1810291714110.6510@sstabellini-ThinkPad-X260> (raw)
In-Reply-To: <20181008183352.16291-7-julien.grall@arm.com>

On Mon, 8 Oct 2018, Julien Grall wrote:
> Generate P2M table entry requires to set some default values which are
> worth to explain in a comment. At the moment, there are 2 places where
> such entry are created but only one as proper comment.
> 
> Some move the code to generate P2M table entry in a separate helper.
> This will be helpful in a follow-up patch to make modification on the
> defaults.
> 
> At the same time, switch the default access from p2m->default_access to
> p2m_access_rwx. This should not matter as permission are ignored for
> table by the hardware.
> 
> Signed-off-by: Julien Grall <julien.grall@arm.com>

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

> ---
>  xen/arch/arm/p2m.c | 25 ++++++++++++-------------
>  1 file changed, 12 insertions(+), 13 deletions(-)
> 
> diff --git a/xen/arch/arm/p2m.c b/xen/arch/arm/p2m.c
> index 8fffb42889..6c76298ebc 100644
> --- a/xen/arch/arm/p2m.c
> +++ b/xen/arch/arm/p2m.c
> @@ -538,6 +538,16 @@ static lpae_t mfn_to_p2m_entry(mfn_t mfn, p2m_type_t t, p2m_access_t a)
>      return e;
>  }
>  
> +/* Generate table entry with correct attributes. */
> +static lpae_t page_to_p2m_table(struct page_info *page)
> +{
> +    /*
> +     * The access value does not matter because the hardware will ignore
> +     * the permission fields for table entry.
> +     */
> +    return mfn_to_p2m_entry(page_to_mfn(page), p2m_invalid, p2m_access_rwx);
> +}
> +
>  static inline void p2m_write_pte(lpae_t *p, lpae_t pte, bool clean_pte)
>  {
>      write_pte(p, pte);
> @@ -558,7 +568,6 @@ static int p2m_create_table(struct p2m_domain *p2m, lpae_t *entry)
>  {
>      struct page_info *page;
>      lpae_t *p;
> -    lpae_t pte;
>  
>      ASSERT(!lpae_is_valid(*entry));
>  
> @@ -576,14 +585,7 @@ static int p2m_create_table(struct p2m_domain *p2m, lpae_t *entry)
>  
>      unmap_domain_page(p);
>  
> -    /*
> -     * The access value does not matter because the hardware will ignore
> -     * the permission fields for table entry.
> -     */
> -    pte = mfn_to_p2m_entry(page_to_mfn(page), p2m_invalid,
> -                           p2m->default_access);
> -
> -    p2m_write_pte(entry, pte, p2m->clean_pte);
> +    p2m_write_pte(entry, page_to_p2m_table(page), p2m->clean_pte);
>  
>      return 0;
>  }
> @@ -764,14 +766,11 @@ static bool p2m_split_superpage(struct p2m_domain *p2m, lpae_t *entry,
>  
>      unmap_domain_page(table);
>  
> -    pte = mfn_to_p2m_entry(page_to_mfn(page), p2m_invalid,
> -                           p2m->default_access);
> -
>      /*
>       * Even if we failed, we should install the newly allocated LPAE
>       * entry. The caller will be in charge to free the sub-tree.
>       */
> -    p2m_write_pte(entry, pte, p2m->clean_pte);
> +    p2m_write_pte(entry, page_to_p2m_table(page), p2m->clean_pte);
>  
>      return rv;
>  }
> -- 
> 2.11.0
> 

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

  reply	other threads:[~2018-10-30  0:14 UTC|newest]

Thread overview: 62+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-08 18:33 [RFC 00/16] xen/arm: Implement Set/Way operations Julien Grall
2018-10-08 18:33 ` [RFC 01/16] xen/arm: Introduce helpers to clear/flags flags in HCR_EL2 Julien Grall
2018-10-08 18:33 ` [RFC 02/16] xen/arm: Introduce helpers to get/set an MFN from/to an LPAE entry Julien Grall
2018-10-30  0:07   ` Stefano Stabellini
2018-10-08 18:33 ` [RFC 03/16] xen/arm: Allow lpae_is_{table, mapping} helpers to work on invalid entry Julien Grall
2018-10-30  0:10   ` Stefano Stabellini
2018-10-08 18:33 ` [RFC 04/16] xen/arm: guest_walk_tables: Switch the return to bool Julien Grall
2018-10-08 18:33 ` [RFC 05/16] xen/arm: traps: Move the implementation of GUEST_BUG_ON in traps.h Julien Grall
2018-10-30  0:11   ` Stefano Stabellini
2018-10-08 18:33 ` [RFC 06/16] xen/arm: p2m: Introduce a helper to generate P2M table entry from a page Julien Grall
2018-10-30  0:14   ` Stefano Stabellini [this message]
2018-10-08 18:33 ` [RFC 07/16] xen/arm: p2m: Introduce p2m_is_valid and use it Julien Grall
2018-10-30  0:21   ` Stefano Stabellini
2018-10-30 11:02     ` Julien Grall
2018-11-02 22:45       ` Stefano Stabellini
2018-10-08 18:33 ` [RFC 08/16] xen/arm: p2m: Handle translation fault in get_page_from_gva Julien Grall
2018-10-30  0:47   ` Stefano Stabellini
2018-10-30 11:24     ` Julien Grall
2018-10-08 18:33 ` [RFC 09/16] xen/arm: p2m: Introduce a function to resolve translation fault Julien Grall
2018-11-02 23:27   ` Stefano Stabellini
2018-11-05 11:55     ` Julien Grall
2018-11-05 17:56       ` Stefano Stabellini
2018-11-06 14:20         ` Julien Grall
2018-11-12 17:59           ` Julien Grall
2018-11-12 23:36             ` Stefano Stabellini
2018-12-04 15:35               ` Julien Grall
2018-12-04 19:13                 ` Stefano Stabellini
2018-10-08 18:33 ` [RFC 10/16] xen/arm: vcpreg: Add wrappers to handle co-proc access trapped by HCR_EL2.TVM Julien Grall
2018-11-05 19:47   ` Stefano Stabellini
2018-11-05 23:21     ` Julien Grall
2018-11-06 17:36       ` Stefano Stabellini
2018-11-06 17:52         ` Julien Grall
2018-11-06 17:56           ` Stefano Stabellini
2018-12-04 16:24       ` Julien Grall
2018-10-08 18:33 ` [RFC 11/16] xen/arm: vsysreg: Add wrapper to handle sysreg " Julien Grall
2018-11-05 20:42   ` Stefano Stabellini
2018-10-08 18:33 ` [RFC 12/16] xen/arm: Rework p2m_cache_flush to take a range [begin, end) Julien Grall
2018-11-02 23:38   ` Stefano Stabellini
2018-10-08 18:33 ` [RFC 13/16] xen/arm: p2m: Allow to flush cache on any RAM region Julien Grall
2018-11-02 23:40   ` Stefano Stabellini
2018-10-08 18:33 ` [RFC 14/16] xen/arm: p2m: Extend p2m_get_entry to return the value of bit[0] (valid bit) Julien Grall
2018-11-02 23:44   ` Stefano Stabellini
2018-11-05 11:56     ` Julien Grall
2018-11-05 17:31       ` Stefano Stabellini
2018-11-05 17:32         ` Julien Grall
2018-10-08 18:33 ` [RFC 15/16] xen/arm: Implement Set/Way operations Julien Grall
2018-11-05 21:10   ` Stefano Stabellini
2018-11-05 23:38     ` Julien Grall
2018-11-06 17:31       ` Stefano Stabellini
2018-11-06 17:34         ` Julien Grall
2018-11-06 17:38           ` Stefano Stabellini
2018-10-08 18:33 ` [RFC 16/16] xen/arm: Track page accessed between batch of " Julien Grall
2018-10-09  7:04   ` Jan Beulich
2018-10-09 10:16     ` Julien Grall
2018-10-09 11:43       ` Jan Beulich
2018-10-09 12:24         ` Julien Grall
2018-11-05 21:35   ` Stefano Stabellini
2018-11-05 23:28     ` Julien Grall
2018-11-06 17:43       ` Stefano Stabellini
2018-11-06 18:10         ` Julien Grall
2018-11-06 18:41           ` Stefano Stabellini
2018-11-22 14:21 ` [RFC 00/16] xen/arm: Implement " Julien Grall

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=alpine.DEB.2.10.1810291714110.6510@sstabellini-ThinkPad-X260 \
    --to=sstabellini@kernel.org \
    --cc=andre.przywara@linaro.org \
    --cc=julien.grall@arm.com \
    --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.