|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH 1/6] xen/arm: introduce map_phys_range
Introduce a function to map a physical memory into virtual memory.
It is going to be used later to map the videoram.
Signed-off-by: Stefano Stabellini <stefano.stabellini@xxxxxxxxxxxxx>
---
xen/arch/arm/mm.c | 23 +++++++++++++++++++++++
xen/include/asm-arm/mm.h | 3 +++
2 files changed, 26 insertions(+), 0 deletions(-)
diff --git a/xen/arch/arm/mm.c b/xen/arch/arm/mm.c
index 68ee9da..418a414 100644
--- a/xen/arch/arm/mm.c
+++ b/xen/arch/arm/mm.c
@@ -376,6 +376,29 @@ void __init setup_frametable_mappings(paddr_t ps, paddr_t
pe)
frametable_virt_end = FRAMETABLE_VIRT_START + (nr_pages * sizeof(struct
page_info));
}
+/* Map the physical memory range start - end at the virtual address
+ * virt_start in 2MB chunks. start and virt_start have to be 2MB
+ * aligned.
+ */
+void map_phys_range(paddr_t start, paddr_t end,
+ unsigned long virt_start, unsigned attributes)
+{
+ ASSERT(!(start & ((1 << 21) - 1)));
+ ASSERT(!(virt_start & ((1 << 21) - 1)));
+
+ 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 += (1<<21);
+ virt_start += (1<<21);
+ }
+
+ flush_xen_data_tlb();
+}
+
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 --git a/xen/include/asm-arm/mm.h b/xen/include/asm-arm/mm.h
index 3549c83..a11f20b 100644
--- a/xen/include/asm-arm/mm.h
+++ b/xen/include/asm-arm/mm.h
@@ -152,6 +152,9 @@ extern void setup_frametable_mappings(paddr_t ps, paddr_t
pe);
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. */
+extern void map_phys_range(paddr_t start, paddr_t end,
+ unsigned long virt_start, unsigned attributes);
#define mfn_valid(mfn) ({ \
--
1.7.2.5
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |