From: "Mian M. Hamayun" <m.hamayun@virtualopensystems.com>
To: qemu-devel@nongnu.org
Cc: peter.maydell@linaro.org, agraf@suse.de,
tech@virtualopensystems.com, kvmarm@lists.cs.columbia.edu,
afaerber@suse.de
Subject: [Qemu-devel] [PATCH v3 07/11] AARCH64: Add boot support for aarch64 processor
Date: Fri, 27 Sep 2013 12:10:10 +0200 [thread overview]
Message-ID: <1380276614-857-8-git-send-email-m.hamayun@virtualopensystems.com> (raw)
In-Reply-To: <1380276614-857-1-git-send-email-m.hamayun@virtualopensystems.com>
From: "Mian M. Hamayun" <m.hamayun@virtualopensystems.com>
This commit adds support for booting a single AArch64 CPU by setting
appropriate registers. The bootloader includes placehoders for Board-ID
that are used to implement uniform indexing across different bootloaders.
We also introduce Cortex-A57 to virt platform.
Signed-off-by: Mian M. Hamayun <m.hamayun@virtualopensystems.com>
---
hw/arm/boot.c | 57 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
hw/arm/virt.c | 8 ++++++++
2 files changed, 65 insertions(+)
diff --git a/hw/arm/boot.c b/hw/arm/boot.c
index 4c1170e..0471eb8 100644
--- a/hw/arm/boot.c
+++ b/hw/arm/boot.c
@@ -19,6 +19,23 @@
#define KERNEL_ARGS_ADDR 0x100
+#ifdef TARGET_AARCH64
+static uint32_t bootloader_arm64[] = {
+ 0x580000c0, /* ldr x0, 18 ; Load the lower 32-bits of DTB */
+ 0xaa1f03e1, /* mov x1, xzr */
+ 0xaa1f03e2, /* mov x2, xzr */
+ 0xaa1f03e3, /* mov x3, xzr */
+ 0x58000084, /* ldr x4, 20 ; Load the lower 32-bits of kernel entry */
+ 0xd61f0080, /* br x4 ; Jump to the kernel entry point */
+ 0x00000000, /* .word @DTB Lower 32-bits */
+ 0x00000000, /* .word @DTB Higher 32-bits */
+ 0x00000000, /* .word @Kernel Entry Lower 32-bits */
+ 0x00000000, /* .word @Kernel Entry Higher 32-bits */
+ 0x00000000, /* .word @Board ID Lower 32-bits -- Placeholder */
+ 0x00000000 /* .word @Board ID Higher 32-bits -- Placeholder */
+};
+#endif
+
/* The worlds second smallest bootloader. Set r0-r2, then jump to kernel. */
static uint32_t bootloader_arm32[] = {
0xe3a00000, /* mov r0, #0 */
@@ -103,11 +120,37 @@ static void setup_boot_env_32(void)
return;
}
+#ifdef TARGET_AARCH64
+static void setup_boot_env_64(void)
+{
+ bootloader = bootloader_arm64;
+ bootloader_array_size = ARRAY_SIZE(bootloader_arm64);
+
+ kernel_args_index = bootloader_array_size - 6;
+ kernel_entry_index = bootloader_array_size - 4;
+ kernel_boardid_index = bootloader_array_size - 2;
+ return;
+}
+#endif
+
static void setup_boot_env(ARMCPU *cpu)
{
+#ifdef TARGET_AARCH64
+ CPUARMState *env = &cpu->env;
+ if(env->aarch64) {
+ /* AARCH64 Mode */
+ kernel_load_addr = 0x00080000;
+ setup_boot_env_64();
+ }
+ else {
+ /* AARCH32 Mode */
+ /* TODO: Specify Kernel Load Address for AARCH32 */
+ }
+#else
/* ARMv7 */
kernel_load_addr = 0x00010000;
setup_boot_env_32();
+#endif
return;
}
@@ -380,8 +423,22 @@ static void do_cpu_reset(void *opaque)
env->regs[15] = info->entry & 0xfffffffe;
env->thumb = info->entry & 1;
} else {
+#ifdef TARGET_AARCH64
+ if(env->aarch64) {
+ env->pstate = PSR_D_BIT | PSR_A_BIT | PSR_I_BIT | PSR_F_BIT | PSR_MODE_EL1h;
+ } else {
+ hw_error("AArch32 mode is currently not supported\n");
+ }
+ env->xregs[0] = 0;
+ env->xregs[1] = -1;
+#endif
if (CPU(cpu) == first_cpu) {
+#ifdef TARGET_AARCH64
+ env->xregs[2] = bootloader[kernel_args_index];
+ env->pc = info->loader_start;
+#else
env->regs[15] = info->loader_start;
+#endif
if (!info->dtb_filename) {
if (old_param) {
set_kernel_args_old(info);
diff --git a/hw/arm/virt.c b/hw/arm/virt.c
index 448a0e5..8043fd4 100644
--- a/hw/arm/virt.c
+++ b/hw/arm/virt.c
@@ -118,6 +118,14 @@ static VirtBoardInfo machines[] = {
.memmap = a15memmap,
.irqmap = a15irqmap,
},
+ {
+ .cpu_model = "cortex-a57",
+ .cpu_compatible = "arm,arm-v8",
+ .qdevname = "a57mpcore_priv",
+ .gic_compatible = "arm,cortex-a15-gic",
+ .memmap = a15memmap,
+ .irqmap = a15irqmap,
+ },
};
static VirtBoardInfo *find_machine_info(const char *cpu)
--
1.8.1.2
next prev parent reply other threads:[~2013-09-27 10:10 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-09-27 10:10 [Qemu-devel] [PATCH v3 00/11] AARCH64 support on machvirt machine model using KVM Mian M. Hamayun
2013-09-27 10:10 ` [Qemu-devel] [PATCH v3 01/11] ARM: arm64 kvm headers from kernel arm64-kvm tree Mian M. Hamayun
2013-09-27 10:10 ` [Qemu-devel] [PATCH v3 02/11] AARCH64: add a57core Mian M. Hamayun
2013-09-27 15:53 ` Andreas Färber
2013-09-28 0:16 ` Peter Maydell
2013-09-30 15:53 ` Mian M. Hamayun
2013-09-30 18:09 ` Andreas Färber
2013-10-01 0:55 ` Peter Maydell
2013-09-27 10:10 ` [Qemu-devel] [PATCH v3 03/11] AARCH64: Add A57 CPU to default AArch64 configuration and enable KVM Mian M. Hamayun
2013-09-27 10:10 ` [Qemu-devel] [PATCH v3 04/11] AARCH64: Separate 32-bit specific code from common KVM hooks Mian M. Hamayun
2013-09-27 10:10 ` [Qemu-devel] [PATCH v3 05/11] AARCH64: Add AARCH64 CPU initialization, get and put registers support Mian M. Hamayun
2013-11-26 22:24 ` Peter Maydell
2013-09-27 10:10 ` [Qemu-devel] [PATCH v3 06/11] target-arm: Parameterize the bootloader selection and setup mechanism Mian M. Hamayun
2013-11-25 21:17 ` Peter Maydell
2013-09-27 10:10 ` Mian M. Hamayun [this message]
2013-11-25 23:51 ` [Qemu-devel] [PATCH v3 07/11] AARCH64: Add boot support for aarch64 processor Peter Maydell
2013-09-27 10:10 ` [Qemu-devel] [PATCH v3 08/11] AARCH64: Enable SMP support for aarch64 processors using PSCI method Mian M. Hamayun
2013-09-27 10:10 ` [Qemu-devel] [PATCH v3 09/11] AARCH64: Enable configure support for 32-bit guests on AARCH64 Mian M. Hamayun
2013-09-27 10:10 ` [Qemu-devel] [PATCH v3 10/11] AARCH64: Add flags and boot parameters " Mian M. Hamayun
2013-09-27 10:10 ` [Qemu-devel] [PATCH v3 11/11] AARCH64: Add 32-bit mode selection parameter Mian M. Hamayun
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=1380276614-857-8-git-send-email-m.hamayun@virtualopensystems.com \
--to=m.hamayun@virtualopensystems.com \
--cc=afaerber@suse.de \
--cc=agraf@suse.de \
--cc=kvmarm@lists.cs.columbia.edu \
--cc=peter.maydell@linaro.org \
--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).