Message ID | 1489608329-7275-4-git-send-email-olekstysh@gmail.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Hi Oleksandr, On 15/03/17 20:05, Oleksandr Tyshchenko wrote: > From: Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com> > > The helper has the same purpose as existing for x86 one. > It is used for choosing IOMMU mapping attribute according to > the memory type. > > Signed-off-by: Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com> Reviewed-by: Julien Grall <julien.grall@arm.com> Cheers,
On Wed, Apr 19, 2017 at 8:28 PM, Julien Grall <julien.grall@arm.com> wrote: > Hi Oleksandr, Hi, Julien > > On 15/03/17 20:05, Oleksandr Tyshchenko wrote: >> >> From: Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com> >> >> The helper has the same purpose as existing for x86 one. >> It is used for choosing IOMMU mapping attribute according to >> the memory type. >> >> Signed-off-by: Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com> > > > Reviewed-by: Julien Grall <julien.grall@arm.com> Thank you > > Cheers, > > -- > Julien Grall
diff --git a/xen/include/asm-arm/p2m.h b/xen/include/asm-arm/p2m.h index 0899523..4a93ba8 100644 --- a/xen/include/asm-arm/p2m.h +++ b/xen/include/asm-arm/p2m.h @@ -5,6 +5,7 @@ #include <xen/radix-tree.h> #include <xen/rwlock.h> #include <xen/mem_access.h> +#include <xen/iommu.h> #include <public/vm_event.h> /* for vm_event_response_t */ #include <public/memory.h> #include <xen/p2m-common.h> @@ -354,6 +355,39 @@ static inline gfn_t gfn_next_boundary(gfn_t gfn, unsigned int order) return gfn_add(gfn, 1UL << order); } +/* + * p2m type to IOMMU flags + */ +static inline unsigned int p2m_get_iommu_flags(p2m_type_t p2mt) +{ + unsigned int flags; + + switch( p2mt ) + { + case p2m_ram_rw: + case p2m_iommu_map_rw: + case p2m_map_foreign: + case p2m_grant_map_rw: + case p2m_mmio_direct_dev: + case p2m_mmio_direct_nc: + case p2m_mmio_direct_c: + flags = IOMMUF_readable | IOMMUF_writable; + break; + case p2m_ram_ro: + case p2m_iommu_map_ro: + case p2m_grant_map_ro: + flags = IOMMUF_readable; + break; + default: + flags = 0; + break; + } + + /* TODO Do we need to handle access permissions here? */ + + return flags; +} + #endif /* _XEN_P2M_H */ /*