|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen-unstable] xen/arm: introduce early_ioremap
# HG changeset patch
# User Stefano Stabellini <stefano.stabellini@xxxxxxxxxxxxx>
# Date 1359031670 0
# Node ID 814a4f471fffe742f8499e4f3133ad5409f1b943
# Parent 27facb2c4c29c42bbbb5fcf56bd892ffb5bcb793
xen/arm: introduce early_ioremap
Introduce a function to map a range of physical memory into Xen virtual
memory.
It doesn't need domheap to be setup.
It is going to be used to map the videoram.
Signed-off-by: Stefano Stabellini <stefano.stabellini@xxxxxxxxxxxxx>
Acked-by: Ian Campbell <ian.campbell@xxxxxxxxxx>
Committed-by: Ian Campbell <ian.campbell@xxxxxxxxxx>
---
diff -r 27facb2c4c29 -r 814a4f471fff xen/arch/arm/mm.c
--- a/xen/arch/arm/mm.c Thu Jan 24 12:47:49 2013 +0000
+++ b/xen/arch/arm/mm.c Thu Jan 24 12:47:50 2013 +0000
@@ -394,6 +394,38 @@ void __init setup_frametable_mappings(pa
frametable_virt_end = FRAMETABLE_VIRT_START + (nr_pages * sizeof(struct
page_info));
}
+/* Map the physical memory range start - start + len into virtual
+ * memory and return the virtual address of the mapping.
+ * start has to be 2MB aligned.
+ * len has to be < EARLY_VMAP_VIRT_END - EARLY_VMAP_VIRT_START.
+ */
+void* __init early_ioremap(paddr_t start, size_t len, unsigned attributes)
+{
+ static unsigned long virt_start = EARLY_VMAP_VIRT_START;
+ unsigned long ret_addr = virt_start;
+ paddr_t end = start + len;
+
+ ASSERT(!(start & (~SECOND_MASK)));
+ ASSERT(!(virt_start & (~SECOND_MASK)));
+
+ /* The range we need to map is too big */
+ if ( virt_start + len >= EARLY_VMAP_VIRT_END )
+ return NULL;
+
+ while ( start < end )
+ {
+ lpae_t e = mfn_to_xen_entry(start >> PAGE_SHIFT);
+ e.pt.ai = attributes;
+ write_pte(xen_second + second_table_offset(virt_start), e);
+
+ start += SECOND_SIZE;
+ virt_start += SECOND_SIZE;
+ }
+ flush_xen_data_tlb_range_va(ret_addr, len);
+
+ return (void*)ret_addr;
+}
+
enum mg { mg_clear, mg_ro, mg_rw, mg_rx };
static void set_pte_flags_on_range(const char *p, unsigned long l, enum mg mg)
{
diff -r 27facb2c4c29 -r 814a4f471fff xen/include/asm-arm/config.h
--- a/xen/include/asm-arm/config.h Thu Jan 24 12:47:49 2013 +0000
+++ b/xen/include/asm-arm/config.h Thu Jan 24 12:47:50 2013 +0000
@@ -60,6 +60,8 @@
* 6M - 8M Early boot misc (see below)
*
* 32M - 128M Frametable: 24 bytes per page for 16GB of RAM
+ * 256M - 1G VMAP: ioremap and early_ioremap use this virtual address
+ * space
*
* 1G - 2G Xenheap: always-mapped memory
* 2G - 4G Domheap: on-demand-mapped
@@ -73,9 +75,11 @@
#define FIXMAP_ADDR(n) (mk_unsigned_long(0x00400000) + (n) * PAGE_SIZE)
#define BOOT_MISC_VIRT_START mk_unsigned_long(0x00600000)
#define FRAMETABLE_VIRT_START mk_unsigned_long(0x02000000)
+#define EARLY_VMAP_VIRT_START mk_unsigned_long(0x10000000)
#define XENHEAP_VIRT_START mk_unsigned_long(0x40000000)
#define DOMHEAP_VIRT_START mk_unsigned_long(0x80000000)
+#define EARLY_VMAP_VIRT_END XENHEAP_VIRT_START
#define HYPERVISOR_VIRT_START XEN_VIRT_START
#define DOMHEAP_ENTRIES 1024 /* 1024 2MB mapping slots */
diff -r 27facb2c4c29 -r 814a4f471fff xen/include/asm-arm/mm.h
--- a/xen/include/asm-arm/mm.h Thu Jan 24 12:47:49 2013 +0000
+++ b/xen/include/asm-arm/mm.h Thu Jan 24 12:47:50 2013 +0000
@@ -149,7 +149,8 @@ extern void setup_frametable_mappings(pa
extern void set_fixmap(unsigned map, unsigned long mfn, unsigned attributes);
/* Remove a mapping from a fixmap entry */
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);
#define mfn_valid(mfn) ({ \
unsigned long __m_f_n = (mfn); \
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |