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 v3 5/8] xen/arm: preserve DTB mappings
Date: Tue, 18 Dec 2012 18:46:38 +0000 [thread overview]
Message-ID: <1355856402-26614-5-git-send-email-stefano.stabellini@eu.citrix.com> (raw)
In-Reply-To: <alpine.DEB.2.02.1212181843200.17523@kaball.uk.xensource.com>
At the moment we destroy the DTB mappings we have in setup_pagetables
and we don't restore them until setup_mm.
Keep the temporary DTB mapping until we create the new ones.
Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
---
xen/arch/arm/kernel.h | 2 ++
xen/arch/arm/mm.c | 12 ++++++++++++
xen/arch/arm/setup.c | 1 +
xen/include/asm-arm/mm.h | 2 ++
4 files changed, 17 insertions(+), 0 deletions(-)
diff --git a/xen/arch/arm/kernel.h b/xen/arch/arm/kernel.h
index 4533568..a179ffb 100644
--- a/xen/arch/arm/kernel.h
+++ b/xen/arch/arm/kernel.h
@@ -38,4 +38,6 @@ struct kernel_info {
int kernel_prepare(struct kernel_info *info);
void kernel_load(struct kernel_info *info);
+extern char _sdtb[];
+
#endif /* #ifdef __ARCH_ARM_KERNEL_H__ */
diff --git a/xen/arch/arm/mm.c b/xen/arch/arm/mm.c
index 0d7a163..2410794 100644
--- a/xen/arch/arm/mm.c
+++ b/xen/arch/arm/mm.c
@@ -34,6 +34,7 @@
#include <asm/current.h>
#include <public/memory.h>
#include <xen/sched.h>
+#include "kernel.h"
struct domain *dom_xen, *dom_io;
@@ -295,12 +296,23 @@ void __init setup_pagetables(unsigned long boot_phys_offset, paddr_t xen_paddr)
write_pte(xen_second + second_linear_offset(XEN_VIRT_START), pte);
/* TLBFLUSH and ISB would be needed here, but wait until we set WXN */
+ /* preserve the DTB mapping a little while longer */
+ pte = mfn_to_xen_entry(((unsigned long) _sdtb + boot_phys_offset) >> PAGE_SHIFT);
+ write_pte(xen_second + second_linear_offset(BOOT_MISC_VIRT_START), pte);
+
/* From now on, no mapping may be both writable and executable. */
WRITE_CP32(READ_CP32(HSCTLR) | SCTLR_WXN, HSCTLR);
/* Flush everything after setting WXN bit. */
flush_xen_text_tlb();
}
+void __init destroy_dtb_mapping(void)
+{
+ /* destroy old DTB mapping */
+ xen_second[second_linear_offset(BOOT_MISC_VIRT_START)].bits = 0;
+ dsb();
+}
+
/* MMU setup for secondary CPUS (which already have paging enabled) */
void __cpuinit mmu_init_secondary_cpu(void)
{
diff --git a/xen/arch/arm/setup.c b/xen/arch/arm/setup.c
index 2076724..06a878f 100644
--- a/xen/arch/arm/setup.c
+++ b/xen/arch/arm/setup.c
@@ -229,6 +229,7 @@ void __init start_xen(unsigned long boot_phys_offset,
init_xen_time();
+ destroy_dtb_mapping();
setup_mm(atag_paddr, fdt_size);
/* Setup Hyp vector base */
diff --git a/xen/include/asm-arm/mm.h b/xen/include/asm-arm/mm.h
index 4ed5df6..6fa4308 100644
--- a/xen/include/asm-arm/mm.h
+++ b/xen/include/asm-arm/mm.h
@@ -139,6 +139,8 @@ extern unsigned long total_pages;
/* Boot-time pagetable setup */
extern void setup_pagetables(unsigned long boot_phys_offset, paddr_t xen_paddr);
+/* Destroy temporary DTB mapping */
+extern void destroy_dtb_mapping(void);
/* MMU setup for seccondary CPUS (which already have paging enabled) */
extern void __cpuinit mmu_init_secondary_cpu(void);
/* Set up the xenheap: up to 1GB of contiguous, always-mapped memory.
--
1.7.2.5
next prev parent reply other threads:[~2012-12-18 18:46 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-12-18 18:45 [PATCH v3 0/8] xen: ARM HDLCD video driver Stefano Stabellini
2012-12-18 18:46 ` [PATCH v3 1/8] xen/arm: introduce early_ioremap Stefano Stabellini
2012-12-19 11:52 ` Ian Campbell
2013-01-08 19:02 ` Stefano Stabellini
2012-12-18 18:46 ` [PATCH v3 2/8] xen: infrastructure to have cross-platform video drivers Stefano Stabellini
2012-12-18 18:46 ` [PATCH v3 3/8] xen: introduce a generic framebuffer driver Stefano Stabellini
2012-12-19 8:08 ` Jan Beulich
2012-12-19 8:13 ` Jan Beulich
2012-12-18 18:46 ` [PATCH v3 4/8] xen/vesa: use the new fb_* functions Stefano Stabellini
2012-12-19 12:29 ` Ian Campbell
2012-12-18 18:46 ` Stefano Stabellini [this message]
2012-12-19 12:36 ` [PATCH v3 5/8] xen/arm: preserve DTB mappings Ian Campbell
2013-01-08 18:33 ` Stefano Stabellini
2013-01-08 19:04 ` David Vrabel
2013-01-08 19:32 ` Stefano Stabellini
2012-12-18 18:46 ` [PATCH v3 6/8] xen/device_tree: introduce find_compatible_node Stefano Stabellini
2012-12-19 14:06 ` Ian Campbell
2012-12-18 18:46 ` [PATCH v3 7/8] xen/arm: introduce vexpress_syscfg Stefano Stabellini
2012-12-19 12:47 ` Ian Campbell
2013-01-08 17:16 ` Stefano Stabellini
2012-12-18 18:46 ` [PATCH v3 8/8] xen/arm: introduce a driver for the ARM HDLCD controller Stefano Stabellini
2012-12-19 12:58 ` Ian Campbell
2013-01-08 13:51 ` 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=1355856402-26614-5-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).