xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Julien Grall <julien.grall@arm.com>
To: "Edgar E. Iglesias" <edgar.iglesias@gmail.com>, xen-devel@lists.xen.org
Cc: edgar.iglesias@xilinx.com, sstabellini@kernel.org
Subject: Re: [RFC for-4.8 4/6] xen/arm: Add helper functions to map RWX memory regions
Date: Mon, 23 May 2016 16:36:03 +0100	[thread overview]
Message-ID: <57432363.9030901@arm.com> (raw)
In-Reply-To: <1463759488-11900-5-git-send-email-edgar.iglesias@gmail.com>

Hi Edgar,

On 20/05/16 16:51, Edgar E. Iglesias wrote:
> From: "Edgar E. Iglesias" <edgar.iglesias@xilinx.com>
>
> Create a helper function to map regions as MEMORY with
> cached attributes and read-write-execute permissions.

Providing setting the execute bit is useful, I would try to rationalize 
the helpers by expanding map_regions_rw_cache (and maybe rename it).

> Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
> ---
>   xen/arch/arm/p2m.c        | 26 ++++++++++++++++++++++++++
>   xen/include/asm-arm/p2m.h | 10 ++++++++++
>   2 files changed, 36 insertions(+)
>
> diff --git a/xen/arch/arm/p2m.c b/xen/arch/arm/p2m.c
> index db21433..7e788f9 100644
> --- a/xen/arch/arm/p2m.c
> +++ b/xen/arch/arm/p2m.c
> @@ -1219,6 +1219,32 @@ int p2m_populate_ram(struct domain *d,
>                                d->arch.p2m.default_access);
>   }
>
> +int map_regions_rwx_cache(struct domain *d,
> +                         unsigned long start_gfn,
> +                         unsigned long nr,
> +                         unsigned long mfn)
> +{
> +    return apply_p2m_changes(d, INSERT,
> +                             pfn_to_paddr(start_gfn),
> +                             pfn_to_paddr(start_gfn + nr),
> +                             pfn_to_paddr(mfn),
> +                             MATTR_MEM, 0, p2m_ram_rw,

We should not use p2m_ram_rw for other mapping than DRAM. It could be 
used by Xen to differentiate MMIO vs RAM.

> +                             p2m_access_rwx);
> +}
> +
> +int unmap_regions_rwx_cache(struct domain *d,
> +                           unsigned long start_gfn,
> +                           unsigned long nr,
> +                           unsigned long mfn)
> +{
> +    return apply_p2m_changes(d, REMOVE,
> +                             pfn_to_paddr(start_gfn),
> +                             pfn_to_paddr(start_gfn + nr),
> +                             pfn_to_paddr(mfn),
> +                             MATTR_MEM, 0, p2m_invalid,
> +                             p2m_access_rwx);
> +}
> +
>   int map_regions_rw_cache(struct domain *d,
>                            unsigned long start_gfn,
>                            unsigned long nr,
> diff --git a/xen/include/asm-arm/p2m.h b/xen/include/asm-arm/p2m.h
> index d240d1e..294050e 100644
> --- a/xen/include/asm-arm/p2m.h
> +++ b/xen/include/asm-arm/p2m.h
> @@ -144,6 +144,16 @@ int p2m_cache_flush(struct domain *d, xen_pfn_t start_mfn, xen_pfn_t end_mfn);
>   /* Setup p2m RAM mapping for domain d from start-end. */
>   int p2m_populate_ram(struct domain *d, paddr_t start, paddr_t end);
>
> +int map_regions_rwx_cache(struct domain *d,
> +                          unsigned long start_gfn,
> +                          unsigned long nr_mfns,
> +                          unsigned long mfn);
> +
> +int unmap_regions_rwx_cache(struct domain *d,
> +                            unsigned long start_gfn,
> +                            unsigned long nr_mfns,
> +                            unsigned long mfn);
> +
>   int map_regions_rw_cache(struct domain *d,
>                            unsigned long start_gfn,
>                            unsigned long nr_mfns,
>

Regards,

-- 
Julien Grall

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

  reply	other threads:[~2016-05-23 15:36 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-20 15:51 [RFC for-4.8 0/6] xen/arm: Add support for mapping mmio-sram nodes into dom0 Edgar E. Iglesias
2016-05-20 15:51 ` [RFC for-4.8 1/6] xen/arm: Add device_get_desc() Edgar E. Iglesias
2016-05-20 15:51 ` [RFC for-4.8 2/6] xen/arm: Add an optional map function to the device descriptor Edgar E. Iglesias
2016-05-20 15:51 ` [RFC for-4.8 3/6] xen/arm: Add a DEVICE_MEMORY class Edgar E. Iglesias
2016-05-20 15:51 ` [RFC for-4.8 4/6] xen/arm: Add helper functions to map RWX memory regions Edgar E. Iglesias
2016-05-23 15:36   ` Julien Grall [this message]
2016-05-24 14:14     ` Edgar E. Iglesias
2016-05-20 15:51 ` [RFC for-4.8 5/6] xen/arm: Add an mmio-sram device Edgar E. Iglesias
2016-05-20 15:51 ` [RFC for-4.8 6/6] xen/arm: Avoid multiple dev class lookups in handle_node Edgar E. Iglesias
2016-05-23 10:29 ` [RFC for-4.8 0/6] xen/arm: Add support for mapping mmio-sram nodes into dom0 Julien Grall
2016-05-23 11:56   ` Edgar E. Iglesias
2016-05-23 13:02     ` Julien Grall
2016-05-23 14:02       ` Edgar E. Iglesias
2016-05-23 15:13         ` Julien Grall
2016-05-23 15:42           ` Edgar E. Iglesias
2016-05-24 19:44             ` Julien Grall
2016-05-25  9:43               ` Stefano Stabellini
2016-05-25  9:52                 ` Julien Grall
2016-05-25 10:00                   ` Stefano Stabellini
2016-05-25 10:35               ` Edgar E. Iglesias
2016-05-25 13:29               ` Edgar E. Iglesias
2016-05-25 14:24                 ` Julien Grall
2016-06-03 13:10                   ` Edgar E. Iglesias
2016-05-25  9:31   ` Stefano Stabellini

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=57432363.9030901@arm.com \
    --to=julien.grall@arm.com \
    --cc=edgar.iglesias@gmail.com \
    --cc=edgar.iglesias@xilinx.com \
    --cc=sstabellini@kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).