[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH V3 11/41] xen/arm: Introduce ioremap_attr
Map physical range in virtual memory with a specific mapping attribute. Also add new mapping attributes for ARM: PAGE_HYPERVISOR_NOCACHE and PAGE_HYPERVISOR_WC. Signed-off-by: Julien Grall <julien.grall@xxxxxxxxxx> --- xen/arch/arm/mm.c | 14 ++++++++++++++ xen/arch/arm/setup.c | 4 ++-- xen/include/asm-arm/mm.h | 2 ++ xen/include/asm-arm/page.h | 2 ++ 4 files changed, 20 insertions(+), 2 deletions(-) diff --git a/xen/arch/arm/mm.c b/xen/arch/arm/mm.c index 96297d3..10d2869 100644 --- a/xen/arch/arm/mm.c +++ b/xen/arch/arm/mm.c @@ -38,6 +38,7 @@ #include <xen/sched.h> #include <xen/vmap.h> #include <xsm/xsm.h> +#include <xen/pfn.h> struct domain *dom_xen, *dom_io, *dom_cow; @@ -608,6 +609,19 @@ void *__init arch_vmap_virt_end(void) return (void *)early_vmap_start; } +/* + * This function should only be used to remap device address ranges + * TODO: add a check to verify this assumption + */ +void *ioremap_attr(paddr_t pa, size_t len, unsigned int attributes) +{ + unsigned long pfn = PFN_DOWN(pa); + unsigned int offs = pa & (PAGE_SIZE - 1); + unsigned int nr = PFN_UP(offs + len); + + return (__vmap(&pfn, nr, 1, 1, attributes) + offs); +} + static int create_xen_table(lpae_t *entry) { void *p; diff --git a/xen/arch/arm/setup.c b/xen/arch/arm/setup.c index 29447ef..a667db4 100644 --- a/xen/arch/arm/setup.c +++ b/xen/arch/arm/setup.c @@ -429,6 +429,8 @@ void __init start_xen(unsigned long boot_phys_offset, setup_pagetables(boot_phys_offset, get_xen_paddr()); setup_mm(fdt_paddr, fdt_size); + vm_init(); + #ifdef EARLY_UART_ADDRESS /* TODO Need to get device tree or command line for UART address */ pl011_init(0, FIXMAP_ADDR(FIXMAP_CONSOLE)); @@ -483,8 +485,6 @@ void __init start_xen(unsigned long boot_phys_offset, console_init_postirq(); - vm_init(); - do_presmp_initcalls(); for_each_present_cpu ( i ) diff --git a/xen/include/asm-arm/mm.h b/xen/include/asm-arm/mm.h index 26c271e..4ac8fab 100644 --- a/xen/include/asm-arm/mm.h +++ b/xen/include/asm-arm/mm.h @@ -155,6 +155,8 @@ extern void set_fixmap(unsigned map, unsigned long mfn, unsigned attributes); extern void clear_fixmap(unsigned map); /* map a 2MB aligned physical range in virtual memory. */ void* early_ioremap(paddr_t start, size_t len, unsigned attributes); +/* map a physical range in virtual memory */ +void *ioremap_attr(paddr_t start, size_t len, unsigned attributes); #define mfn_valid(mfn) ({ \ unsigned long __m_f_n = (mfn); \ diff --git a/xen/include/asm-arm/page.h b/xen/include/asm-arm/page.h index fd6946e..13fbd78 100644 --- a/xen/include/asm-arm/page.h +++ b/xen/include/asm-arm/page.h @@ -59,6 +59,8 @@ #define DEV_CACHED WRITEBACK #define PAGE_HYPERVISOR (MATTR_MEM) +#define PAGE_HYPERVISOR_NOCACHE (DEV_SHARED) +#define PAGE_HYPERVISOR_WC (DEV_WC) #define MAP_SMALL_PAGES PAGE_HYPERVISOR /* -- 1.7.10.4 _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |