|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [RFC for-4.8 4/6] xen/arm: Add helper functions to map RWX memory regions
On Mon, May 23, 2016 at 04:36:03PM +0100, Julien Grall wrote:
> Hi Edgar,
>
> On 20/05/16 16:51, Edgar E. Iglesias wrote:
> >From: "Edgar E. Iglesias" <edgar.iglesias@xxxxxxxxxx>
> >
> >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).
Thanks, I'll have change the code around to do that.
>
> >Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xxxxxxxxxx>
> >---
> > 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.
OK, I see. I'll fix that.
Cheers,
Edgar
>
> >+ 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@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |