xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
To: xen-devel@lists.xensource.com
Cc: tim@xen.org, Ian.Campbell@citrix.com,
	Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Subject: [PATCH 1/6] xen/arm: introduce map_phys_range
Date: Wed, 5 Dec 2012 18:19:43 +0000	[thread overview]
Message-ID: <1354731588-32579-1-git-send-email-stefano.stabellini@eu.citrix.com> (raw)
In-Reply-To: <alpine.DEB.2.02.1212051805020.8801@kaball.uk.xensource.com>

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@eu.citrix.com>
---
 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

  reply	other threads:[~2012-12-05 18:19 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-12-05 18:19 [PATCH 0/6] xen: ARM HDLCD video driver Stefano Stabellini
2012-12-05 18:19 ` Stefano Stabellini [this message]
2012-12-06  9:55   ` [PATCH 1/6] xen/arm: introduce map_phys_range Ian Campbell
2012-12-06 16:06     ` Stefano Stabellini
2012-12-07  9:53       ` Ian Campbell
2012-12-06 12:44   ` Tim Deegan
2012-12-05 18:19 ` [PATCH 2/6] xen: infrastructure to have cross-platform video drivers Stefano Stabellini
2012-12-06  9:57   ` Ian Campbell
2012-12-06 11:25   ` Jan Beulich
2012-12-06 12:46   ` Tim Deegan
2012-12-05 18:19 ` [PATCH 3/6] xen: introduce a generic framebuffer driver Stefano Stabellini
2012-12-05 18:19 ` [PATCH 4/6] xen/vesa: use the new fb_* functions Stefano Stabellini
2012-12-06 11:28   ` Jan Beulich
2012-12-06 11:36     ` Ian Campbell
2012-12-06 15:39       ` Stefano Stabellini
2012-12-06 15:18     ` Stefano Stabellini
2012-12-05 18:19 ` [PATCH 5/6] xen/device_tree: introduce find_compatible_node Stefano Stabellini
2012-12-06 10:14   ` Ian Campbell
2012-12-06 12:55     ` Stefano Stabellini
2012-12-05 18:19 ` [PATCH 6/6] xen/arm: introduce a driver for the ARM HDLCD controller Stefano Stabellini
2012-12-06 10:28   ` Ian Campbell
2012-12-07 15:50     ` Stefano Stabellini
2012-12-06 12:53   ` Tim Deegan
2012-12-06 16:35     ` Stefano Stabellini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1354731588-32579-1-git-send-email-stefano.stabellini@eu.citrix.com \
    --to=stefano.stabellini@eu.citrix.com \
    --cc=Ian.Campbell@citrix.com \
    --cc=tim@xen.org \
    --cc=xen-devel@lists.xensource.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).