From: Ian Campbell <ijc@hellion.org.uk>
To: xen-devel@lists.xen.org
Cc: stefano.stabellini@citrix.com, tim@xen.org,
Ian Campbell <ian.campbell@citrix.com>
Subject: [PATCH 2/9] arm: consolidate setup of hypervisor traps and second stage paging
Date: Wed, 6 Mar 2013 08:54:29 +0000 [thread overview]
Message-ID: <1362560076-25897-2-git-send-email-ijc@hellion.org.uk> (raw)
In-Reply-To: <1362559920.8941.98.camel@hastur.hellion.org.uk>
From: Ian Campbell <ian.campbell@citrix.com>
In particular be sure to initisalise HCR_EL2 on secondary processors.
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
---
xen/arch/arm/domain_build.c | 7 -------
xen/arch/arm/mm.c | 10 ++++++++++
xen/arch/arm/setup.c | 13 +++----------
xen/arch/arm/smpboot.c | 5 +++--
xen/arch/arm/traps.c | 11 +++++++++++
xen/include/asm-arm/mm.h | 4 +++-
xen/include/asm-arm/processor.h | 2 ++
7 files changed, 32 insertions(+), 20 deletions(-)
diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c
index bdf41fa..f161845 100644
--- a/xen/arch/arm/domain_build.c
+++ b/xen/arch/arm/domain_build.c
@@ -322,10 +322,6 @@ int construct_dom0(struct domain *d)
gic_route_irq_to_guest(d, 46, "lcd");
gic_route_irq_to_guest(d, 47, "eth");
- /* Enable second stage translation */
- WRITE_SYSREG(READ_SYSREG(HCR_EL2) | HCR_VM, HCR_EL2);
- isb();
-
/* The following loads use the domain's p2m */
p2m_load_VTTBR(d);
@@ -373,9 +369,6 @@ int construct_dom0(struct domain *d)
}
#endif
- WRITE_SYSREG(HCR_PTW|HCR_BSU_OUTER|HCR_AMO|HCR_IMO|HCR_VM|HCR_TWI, HCR_EL2);
- isb();
-
local_abort_enable();
return 0;
diff --git a/xen/arch/arm/mm.c b/xen/arch/arm/mm.c
index 9661f10..ba3140d 100644
--- a/xen/arch/arm/mm.c
+++ b/xen/arch/arm/mm.c
@@ -251,6 +251,16 @@ void __init arch_init_memory(void)
BUG_ON(IS_ERR(dom_cow));
}
+void __cpuinit setup_virt_paging(void)
+{
+ /* Setup Stage 2 address translation */
+ /* SH0=00, ORGN0=IRGN0=01
+ * SL0=01 (Level-1)
+ * T0SZ=(1)1000 = -8 (40 bit physical addresses)
+ */
+ WRITE_SYSREG32(0x80002558, VTCR_EL2); isb();
+}
+
/* Boot-time pagetable setup.
* Changes here may need matching changes in head.S */
void __init setup_pagetables(unsigned long boot_phys_offset, paddr_t xen_paddr)
diff --git a/xen/arch/arm/setup.c b/xen/arch/arm/setup.c
index 566f36c..cfe3d94 100644
--- a/xen/arch/arm/setup.c
+++ b/xen/arch/arm/setup.c
@@ -446,16 +446,9 @@ void __init start_xen(unsigned long boot_phys_offset,
set_current((struct vcpu *)0xfffff000); /* debug sanity */
idle_vcpu[0] = current;
- /* Setup Hyp vector base */
- WRITE_SYSREG((vaddr_t)hyp_traps_vector, VBAR_EL2);
- isb();
-
- /* Setup Stage 2 address translation */
- /* SH0=00, ORGN0=IRGN0=01
- * SL0=01 (Level-1)
- * T0SZ=(1)1000 = -8 (40 bit physical addresses)
- */
- WRITE_SYSREG32(0x80002558, VTCR_EL2); isb();
+ init_traps();
+
+ setup_virt_paging();
enable_vfp();
diff --git a/xen/arch/arm/smpboot.c b/xen/arch/arm/smpboot.c
index b2af42e..1bebf86 100644
--- a/xen/arch/arm/smpboot.c
+++ b/xen/arch/arm/smpboot.c
@@ -148,8 +148,9 @@ void __cpuinit start_secondary(unsigned long boot_phys_offset,
*c = boot_cpu_data;
identify_cpu(c);
- /* Setup Hyp vector base */
- WRITE_SYSREG((vaddr_t)hyp_traps_vector, VBAR_EL2);
+ init_traps();
+
+ setup_virt_paging();
mmu_init_secondary_cpu();
enable_vfp();
diff --git a/xen/arch/arm/traps.c b/xen/arch/arm/traps.c
index cf28974..2cc31ab 100644
--- a/xen/arch/arm/traps.c
+++ b/xen/arch/arm/traps.c
@@ -53,6 +53,17 @@ integer_param("debug_stack_lines", debug_stack_lines);
#define stack_words_per_line 8
+
+void __cpuinit init_traps(void)
+{
+ /* Setup Hyp vector base */
+ WRITE_SYSREG((vaddr_t)hyp_traps_vector, VBAR_EL2);
+
+ /* Setup hypervisor traps */
+ WRITE_SYSREG(HCR_PTW|HCR_BSU_OUTER|HCR_AMO|HCR_IMO|HCR_VM|HCR_TWI, HCR_EL2);
+ isb();
+}
+
asmlinkage void __div0(void)
{
printk("Division by zero in hypervisor.\n");
diff --git a/xen/include/asm-arm/mm.h b/xen/include/asm-arm/mm.h
index 19e5bc2..4be383e 100644
--- a/xen/include/asm-arm/mm.h
+++ b/xen/include/asm-arm/mm.h
@@ -138,8 +138,10 @@ extern unsigned long total_pages;
/* Boot-time pagetable setup */
extern void setup_pagetables(unsigned long boot_phys_offset, paddr_t xen_paddr);
-/* MMU setup for seccondary CPUS (which already have paging enabled) */
+/* MMU setup for secondary CPUS (which already have paging enabled) */
extern void __cpuinit mmu_init_secondary_cpu(void);
+/* Second stage paging setup, to be called on all CPUs */
+extern void __cpuinit setup_virt_paging(void);
/* Set up the xenheap: up to 1GB of contiguous, always-mapped memory.
* Base must be 32MB aligned and size a multiple of 32MB. */
extern void setup_xenheap_mappings(unsigned long base_mfn, unsigned long nr_mfns);
diff --git a/xen/include/asm-arm/processor.h b/xen/include/asm-arm/processor.h
index 6fbe2fa..1681ebf 100644
--- a/xen/include/asm-arm/processor.h
+++ b/xen/include/asm-arm/processor.h
@@ -353,6 +353,8 @@ union hsr {
#ifndef __ASSEMBLY__
extern uint32_t hyp_traps_vector[];
+void init_traps(void);
+
void panic_PAR(uint64_t par);
void show_execution_state(struct cpu_user_regs *regs);
--
1.7.10.4
next prev parent reply other threads:[~2013-03-06 8:54 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-03-06 8:52 [PATCH 00/09] arm: host SMP support Ian Campbell
2013-03-06 8:54 ` [PATCH 1/9] arm: initialise VCPU SCTLR in vcpu_initialise Ian Campbell
2013-03-19 15:58 ` Stefano Stabellini
2013-04-11 8:58 ` Ian Campbell
2013-03-06 8:54 ` Ian Campbell [this message]
2013-03-19 17:34 ` [PATCH 2/9] arm: consolidate setup of hypervisor traps and second stage paging Stefano Stabellini
2013-04-11 8:58 ` Ian Campbell
2013-03-06 8:54 ` [PATCH 3/9] arm: gic: implement IPIs using SGI mechanism Ian Campbell
2013-03-19 17:28 ` Stefano Stabellini
2013-04-09 14:51 ` Ian Campbell
2013-04-11 15:53 ` Ian Campbell
2013-04-11 16:17 ` Ian Campbell
2013-04-11 22:40 ` Julien Grall
2013-04-12 8:00 ` Ian Campbell
2013-03-06 8:54 ` [PATCH 4/9] arm64: correct secondary CPU bringup Ian Campbell
2013-04-11 8:27 ` Ian Campbell
2013-04-18 13:33 ` Stefano Stabellini
2013-03-06 8:54 ` [PATCH 5/9] arm: vgic: typo s/securty/security/ Ian Campbell
2013-03-19 16:06 ` Stefano Stabellini
2013-04-11 8:59 ` Ian Campbell
2013-03-06 8:54 ` [PATCH 6/9] arm: vgic: fix race in vgic_vcpu_inject_irq Ian Campbell
2013-03-19 16:10 ` Stefano Stabellini
2013-04-11 8:59 ` Ian Campbell
2013-03-06 8:54 ` [PATCH 7/9] arm: vgic: fix race between evtchn upcall and evtchnop_send Ian Campbell
2013-03-19 16:18 ` Stefano Stabellini
2013-04-09 14:39 ` Ian Campbell
2013-04-11 8:59 ` Ian Campbell
2013-03-06 8:54 ` [PATCH 8/9] arm: gic: fix build on arm64 Ian Campbell
2013-03-19 16:05 ` Stefano Stabellini
2013-04-11 9:00 ` Ian Campbell
2013-03-06 8:54 ` [PATCH 9/9] arm: tweak/improve logging for host SMP Ian Campbell
2013-03-19 16:05 ` Stefano Stabellini
2013-04-11 9:00 ` Ian Campbell
2013-03-22 14:50 ` [PATCH 00/09] arm: host SMP support Stefano Stabellini
2013-03-22 15:05 ` 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=1362560076-25897-2-git-send-email-ijc@hellion.org.uk \
--to=ijc@hellion.org.uk \
--cc=ian.campbell@citrix.com \
--cc=stefano.stabellini@citrix.com \
--cc=tim@xen.org \
--cc=xen-devel@lists.xen.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.