From: "Mian M. Hamayun" <m.hamayun@virtualopensystems.com>
To: qemu-devel@nongnu.org
Cc: Alexander Spyridakis <a.spyridakis@virtualopensystems.com>,
tech@virtualopensystems.com, kvmarm@lists.cs.columbia.edu
Subject: [Qemu-devel] [PATCH 6/6] Added SMP for Aarch64 Processors.
Date: Fri, 28 Jun 2013 14:11:59 +0200 [thread overview]
Message-ID: <1372421519-5146-6-git-send-email-m.hamayun@virtualopensystems.com> (raw)
In-Reply-To: <1372421519-5146-1-git-send-email-m.hamayun@virtualopensystems.com>
From: Alexander Spyridakis <a.spyridakis@virtualopensystems.com>
AArch64 uses a cpu-release-addr memory location (defined in the dts) as
a way to inform secondary CPUs where to jump to and enter their holding
pen. Inject a very simple bootloader that polls this memory location,
until the primary CPU sets it to the right address.
Signed-off-by: Alexander Spyridakis <a.spyridakis@virtualopensystems.com>
---
hw/arm/boot.c | 20 +++++++++++++++++---
1 file changed, 17 insertions(+), 3 deletions(-)
diff --git a/hw/arm/boot.c b/hw/arm/boot.c
index 94e628b..f7a97d1 100644
--- a/hw/arm/boot.c
+++ b/hw/arm/boot.c
@@ -17,6 +17,8 @@
#include "sysemu/device_tree.h"
#include "qemu/config-file.h"
+#define DSB_INSN 0xf57ff04f
+#define CP15_DSB_INSN 0xee070f9a /* mcr cp15, 0, r0, c7, c10, 4 */
#define KERNEL_ARGS_ADDR 0x100
#ifdef TARGET_AARCH64
@@ -40,6 +42,16 @@ static uint32_t bootloader[] = {
0x00000000 /* .word @Board ID Higher 32-bits -- Placeholder */
};
+static uint32_t smpboot[] = {
+ 0x18000085, /* ldr w5, =0x8000fff8 - mbox value for secondary CPUs */
+ 0xf94000a4, /* 1: ldr x4, [x5] - Read address to jump to */
+ 0xb4ffffe4, /* cbz x4, 1b - Check if mbox value is zero, if yes retry */
+ 0xd61f0080, /* br x4 - Branch to given address */
+ 0x8000fff8, /* mbox value */
+ 0,
+ 0
+};
+
#else
#define KERNEL_LOAD_ADDR 0x00010000
#define KERNEL_BOARDID_INDEX 4
@@ -56,7 +68,6 @@ static uint32_t bootloader[] = {
0, /* Address of kernel args. Set by integratorcp_init. */
0 /* Kernel entry point. Set by integratorcp_init. */
};
-#endif
/* Handling for secondary CPU boot in a multicore system.
* Unlike the uniprocessor/primary CPU boot, this is platform
@@ -72,8 +83,6 @@ static uint32_t bootloader[] = {
* for an interprocessor interrupt and polling a configurable
* location for the kernel secondary CPU entry point.
*/
-#define DSB_INSN 0xf57ff04f
-#define CP15_DSB_INSN 0xee070f9a /* mcr cp15, 0, r0, c7, c10, 4 */
static uint32_t smpboot[] = {
0xe59f2028, /* ldr r2, gic_cpu_if */
@@ -91,6 +100,7 @@ static uint32_t smpboot[] = {
0, /* gic_cpu_if: base address of GIC CPU interface */
0 /* bootreg: Boot register address is held here */
};
+#endif
static void default_write_secondary(ARMCPU *cpu,
const struct arm_boot_info *info)
@@ -115,8 +125,12 @@ static void default_reset_secondary(ARMCPU *cpu,
{
CPUARMState *env = &cpu->env;
+#ifdef TARGET_AARCH64
+ env->pc = info->smp_loader_start;
+#else
stl_phys_notdirty(info->smp_bootreg_addr, 0);
env->regs[15] = info->smp_loader_start;
+#endif
}
#define WRITE_WORD(p, value) do { \
--
1.7.9.5
next prev parent reply other threads:[~2013-06-28 12:13 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-06-28 12:11 [Qemu-devel] [PATCH 1/6] Added aarch64 configure support and default configuration Mian M. Hamayun
2013-06-28 12:11 ` [Qemu-devel] [PATCH 2/6] Added KVM Headers from KVM Tool Mian M. Hamayun
2013-06-28 12:11 ` [Qemu-devel] [PATCH 3/6] Added Aarch64 CPU Initialization, Get and Put Registers Support Mian M. Hamayun
2013-06-28 12:43 ` Alexander Graf
2013-06-29 17:48 ` Mian M. Hamayun
2013-06-29 18:05 ` Alexander Graf
2013-06-29 19:17 ` Peter Maydell
2013-07-01 17:54 ` Alexander Spyridakis
2013-06-28 12:11 ` [Qemu-devel] [PATCH 4/6] Added the Versatile Express Machine Model for A57 Mian M. Hamayun
2013-06-29 19:21 ` Peter Maydell
2013-07-01 18:06 ` Alexander Spyridakis
2013-07-01 19:08 ` Peter Maydell
2013-06-28 12:11 ` [Qemu-devel] [PATCH 5/6] Added Boot Support for Aarch64 Processor Mian M. Hamayun
2013-06-28 12:11 ` Mian M. Hamayun [this message]
2013-06-29 19:24 ` [Qemu-devel] [PATCH 6/6] Added SMP for Aarch64 Processors Peter Maydell
2013-07-01 18:18 ` Alexander Spyridakis
2013-06-29 19:20 ` [Qemu-devel] [PATCH 1/6] Added aarch64 configure support and default configuration Peter Maydell
2013-07-01 18:46 ` Alexander Spyridakis
2013-07-01 19:22 ` Peter Maydell
2013-07-01 19:24 ` Peter Maydell
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=1372421519-5146-6-git-send-email-m.hamayun@virtualopensystems.com \
--to=m.hamayun@virtualopensystems.com \
--cc=a.spyridakis@virtualopensystems.com \
--cc=kvmarm@lists.cs.columbia.edu \
--cc=qemu-devel@nongnu.org \
--cc=tech@virtualopensystems.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).