* [Qemu-devel] [PATCH] target-arm: upgrade for secondary cpu bootloader
@ 2011-08-05 10:37 Evgeny Voevodin
2011-08-05 11:03 ` Evgeny Voevodin
` (3 more replies)
0 siblings, 4 replies; 9+ messages in thread
From: Evgeny Voevodin @ 2011-08-05 10:37 UTC (permalink / raw)
To: qemu-devel; +Cc: 0
[-- Attachment #1: Type: text/plain, Size: 318 bytes --]
Secondary CPU bootloader enables interrupt and issues wfi until start
address is written to system controller. The position where to find this
start address is hardcoded to 0x10000030. This commit adds new
bootloader for secondary CPU which allows a target board to cpecify a
position where to find start address.
[-- Attachment #2: 0001-arm-Add-new-secondary-CPU-bootloader.patch --]
[-- Type: text/x-patch, Size: 3462 bytes --]
>From 851173b22dc2c5d5f8bb46eef07c452af78f61e8 Mon Sep 17 00:00:00 2001
From: Evgeny Voevodin <e.voevodin@samsung.com>
Date: Fri, 29 Jul 2011 09:36:21 +0400
Subject: [PATCH 1/2] arm: Add new secondary CPU bootloader
Secondary CPU bootloader enables interrupt and issues wfi until start address
is written to system controller. The position where to find this start
address is hardcoded to 0x10000030. This commit adds new bootloader for
secondary CPU which allows a target board to cpecify a position where
to find start address.
Signed-off-by: Evgeny Voevodin <e.voevodin@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
---
hw/arm-misc.h | 1 +
hw/arm_boot.c | 35 ++++++++++++++++++++++++++++++-----
2 files changed, 31 insertions(+), 5 deletions(-)
diff --git a/hw/arm-misc.h b/hw/arm-misc.h
index 010acb4..ef1d61d 100644
--- a/hw/arm-misc.h
+++ b/hw/arm-misc.h
@@ -28,6 +28,7 @@ struct arm_boot_info {
const char *initrd_filename;
target_phys_addr_t loader_start;
target_phys_addr_t smp_loader_start;
+ target_phys_addr_t smp_startaddr;
target_phys_addr_t smp_priv_base;
int nb_cpus;
int board_id;
diff --git a/hw/arm_boot.c b/hw/arm_boot.c
index 620550b..59a6f05 100644
--- a/hw/arm_boot.c
+++ b/hw/arm_boot.c
@@ -44,6 +44,20 @@ static uint32_t smpboot[] = {
0 /* privbase: Private memory region base address. */
};
+static uint32_t smpboot2[] = {
+ 0xe59f201c, /* ldr r2, privbase */
+ 0xe59f001c, /* ldr r0, startaddr */
+ 0xe3a01001, /* mov r1, #1 */
+ 0xe5821100, /* str r1, [r2, #256] */
+ 0xe320f003, /* wfi */
+ 0xe5901000, /* ldr r1, [r0] */
+ 0xe1110001, /* tst r1, r1 */
+ 0x0afffffb, /* beq <wfi> */
+ 0xe12fff11, /* bx r1 */
+ 0, /* privbase: Private memory region base address. */
+ 0 /* startaddr: Where to find start address */
+};
+
#define WRITE_WORD(p, value) do { \
stl_phys_notdirty(p, value); \
p += 4; \
@@ -269,12 +283,23 @@ void arm_load_kernel(CPUState *env, struct arm_boot_info *info)
rom_add_blob_fixed("bootloader", bootloader, sizeof(bootloader),
info->loader_start);
if (info->nb_cpus > 1) {
- smpboot[10] = info->smp_priv_base;
- for (n = 0; n < sizeof(smpboot) / 4; n++) {
- smpboot[n] = tswap32(smpboot[n]);
+ if (info->smp_startaddr) {
+ smpboot2[(sizeof(smpboot2) - 8)/4] = info->smp_priv_base;
+ smpboot2[(sizeof(smpboot2) - 4)/4] = info->smp_startaddr;
+ for (n = 0; n < sizeof(smpboot2) / 4; n++) {
+ smpboot2[n] = tswap32(smpboot2[n]);
+ }
+ rom_add_blob_fixed("smpboot2", smpboot2, sizeof(smpboot2),
+ info->smp_loader_start);
+ }
+ else {
+ smpboot[10] = info->smp_priv_base;
+ for (n = 0; n < sizeof(smpboot) / 4; n++) {
+ smpboot[n] = tswap32(smpboot[n]);
+ }
+ rom_add_blob_fixed("smpboot", smpboot, sizeof(smpboot),
+ info->smp_loader_start);
}
- rom_add_blob_fixed("smpboot", smpboot, sizeof(smpboot),
- info->smp_loader_start);
}
info->initrd_size = initrd_size;
}
--
1.7.4.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [Qemu-devel] [PATCH] target-arm: upgrade for secondary cpu bootloader
2011-08-05 10:37 [Qemu-devel] [PATCH] target-arm: upgrade for secondary cpu bootloader Evgeny Voevodin
@ 2011-08-05 11:03 ` Evgeny Voevodin
2011-08-05 11:04 ` Evgeny Voevodin
` (2 subsequent siblings)
3 siblings, 0 replies; 9+ messages in thread
From: Evgeny Voevodin @ 2011-08-05 11:03 UTC (permalink / raw)
To: qemu-devel; +Cc: Kyungmin Park, Dmitry Solodkiy
[-- Attachment #1: Type: text/plain, Size: 1 bytes --]
[-- Attachment #2: 0001-arm-Add-new-secondary-CPU-bootloader.patch --]
[-- Type: text/x-patch, Size: 3462 bytes --]
>From 851173b22dc2c5d5f8bb46eef07c452af78f61e8 Mon Sep 17 00:00:00 2001
From: Evgeny Voevodin <e.voevodin@samsung.com>
Date: Fri, 29 Jul 2011 09:36:21 +0400
Subject: [PATCH 1/2] arm: Add new secondary CPU bootloader
Secondary CPU bootloader enables interrupt and issues wfi until start address
is written to system controller. The position where to find this start
address is hardcoded to 0x10000030. This commit adds new bootloader for
secondary CPU which allows a target board to cpecify a position where
to find start address.
Signed-off-by: Evgeny Voevodin <e.voevodin@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
---
hw/arm-misc.h | 1 +
hw/arm_boot.c | 35 ++++++++++++++++++++++++++++++-----
2 files changed, 31 insertions(+), 5 deletions(-)
diff --git a/hw/arm-misc.h b/hw/arm-misc.h
index 010acb4..ef1d61d 100644
--- a/hw/arm-misc.h
+++ b/hw/arm-misc.h
@@ -28,6 +28,7 @@ struct arm_boot_info {
const char *initrd_filename;
target_phys_addr_t loader_start;
target_phys_addr_t smp_loader_start;
+ target_phys_addr_t smp_startaddr;
target_phys_addr_t smp_priv_base;
int nb_cpus;
int board_id;
diff --git a/hw/arm_boot.c b/hw/arm_boot.c
index 620550b..59a6f05 100644
--- a/hw/arm_boot.c
+++ b/hw/arm_boot.c
@@ -44,6 +44,20 @@ static uint32_t smpboot[] = {
0 /* privbase: Private memory region base address. */
};
+static uint32_t smpboot2[] = {
+ 0xe59f201c, /* ldr r2, privbase */
+ 0xe59f001c, /* ldr r0, startaddr */
+ 0xe3a01001, /* mov r1, #1 */
+ 0xe5821100, /* str r1, [r2, #256] */
+ 0xe320f003, /* wfi */
+ 0xe5901000, /* ldr r1, [r0] */
+ 0xe1110001, /* tst r1, r1 */
+ 0x0afffffb, /* beq <wfi> */
+ 0xe12fff11, /* bx r1 */
+ 0, /* privbase: Private memory region base address. */
+ 0 /* startaddr: Where to find start address */
+};
+
#define WRITE_WORD(p, value) do { \
stl_phys_notdirty(p, value); \
p += 4; \
@@ -269,12 +283,23 @@ void arm_load_kernel(CPUState *env, struct arm_boot_info *info)
rom_add_blob_fixed("bootloader", bootloader, sizeof(bootloader),
info->loader_start);
if (info->nb_cpus > 1) {
- smpboot[10] = info->smp_priv_base;
- for (n = 0; n < sizeof(smpboot) / 4; n++) {
- smpboot[n] = tswap32(smpboot[n]);
+ if (info->smp_startaddr) {
+ smpboot2[(sizeof(smpboot2) - 8)/4] = info->smp_priv_base;
+ smpboot2[(sizeof(smpboot2) - 4)/4] = info->smp_startaddr;
+ for (n = 0; n < sizeof(smpboot2) / 4; n++) {
+ smpboot2[n] = tswap32(smpboot2[n]);
+ }
+ rom_add_blob_fixed("smpboot2", smpboot2, sizeof(smpboot2),
+ info->smp_loader_start);
+ }
+ else {
+ smpboot[10] = info->smp_priv_base;
+ for (n = 0; n < sizeof(smpboot) / 4; n++) {
+ smpboot[n] = tswap32(smpboot[n]);
+ }
+ rom_add_blob_fixed("smpboot", smpboot, sizeof(smpboot),
+ info->smp_loader_start);
}
- rom_add_blob_fixed("smpboot", smpboot, sizeof(smpboot),
- info->smp_loader_start);
}
info->initrd_size = initrd_size;
}
--
1.7.4.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [Qemu-devel] [PATCH] target-arm: upgrade for secondary cpu bootloader
2011-08-05 10:37 [Qemu-devel] [PATCH] target-arm: upgrade for secondary cpu bootloader Evgeny Voevodin
2011-08-05 11:03 ` Evgeny Voevodin
@ 2011-08-05 11:04 ` Evgeny Voevodin
2011-08-05 11:06 ` Evgeny Voevodin
2011-08-05 11:35 ` Peter Maydell
3 siblings, 0 replies; 9+ messages in thread
From: Evgeny Voevodin @ 2011-08-05 11:04 UTC (permalink / raw)
To: qemu-devel; +Cc: Kyungmin Park, Dmitry Solodkiy
[-- Attachment #1: Type: text/plain, Size: 1 bytes --]
[-- Attachment #2: 0001-arm-Add-new-secondary-CPU-bootloader.patch --]
[-- Type: text/x-patch, Size: 3462 bytes --]
>From 851173b22dc2c5d5f8bb46eef07c452af78f61e8 Mon Sep 17 00:00:00 2001
From: Evgeny Voevodin <e.voevodin@samsung.com>
Date: Fri, 29 Jul 2011 09:36:21 +0400
Subject: [PATCH 1/2] arm: Add new secondary CPU bootloader
Secondary CPU bootloader enables interrupt and issues wfi until start address
is written to system controller. The position where to find this start
address is hardcoded to 0x10000030. This commit adds new bootloader for
secondary CPU which allows a target board to cpecify a position where
to find start address.
Signed-off-by: Evgeny Voevodin <e.voevodin@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
---
hw/arm-misc.h | 1 +
hw/arm_boot.c | 35 ++++++++++++++++++++++++++++++-----
2 files changed, 31 insertions(+), 5 deletions(-)
diff --git a/hw/arm-misc.h b/hw/arm-misc.h
index 010acb4..ef1d61d 100644
--- a/hw/arm-misc.h
+++ b/hw/arm-misc.h
@@ -28,6 +28,7 @@ struct arm_boot_info {
const char *initrd_filename;
target_phys_addr_t loader_start;
target_phys_addr_t smp_loader_start;
+ target_phys_addr_t smp_startaddr;
target_phys_addr_t smp_priv_base;
int nb_cpus;
int board_id;
diff --git a/hw/arm_boot.c b/hw/arm_boot.c
index 620550b..59a6f05 100644
--- a/hw/arm_boot.c
+++ b/hw/arm_boot.c
@@ -44,6 +44,20 @@ static uint32_t smpboot[] = {
0 /* privbase: Private memory region base address. */
};
+static uint32_t smpboot2[] = {
+ 0xe59f201c, /* ldr r2, privbase */
+ 0xe59f001c, /* ldr r0, startaddr */
+ 0xe3a01001, /* mov r1, #1 */
+ 0xe5821100, /* str r1, [r2, #256] */
+ 0xe320f003, /* wfi */
+ 0xe5901000, /* ldr r1, [r0] */
+ 0xe1110001, /* tst r1, r1 */
+ 0x0afffffb, /* beq <wfi> */
+ 0xe12fff11, /* bx r1 */
+ 0, /* privbase: Private memory region base address. */
+ 0 /* startaddr: Where to find start address */
+};
+
#define WRITE_WORD(p, value) do { \
stl_phys_notdirty(p, value); \
p += 4; \
@@ -269,12 +283,23 @@ void arm_load_kernel(CPUState *env, struct arm_boot_info *info)
rom_add_blob_fixed("bootloader", bootloader, sizeof(bootloader),
info->loader_start);
if (info->nb_cpus > 1) {
- smpboot[10] = info->smp_priv_base;
- for (n = 0; n < sizeof(smpboot) / 4; n++) {
- smpboot[n] = tswap32(smpboot[n]);
+ if (info->smp_startaddr) {
+ smpboot2[(sizeof(smpboot2) - 8)/4] = info->smp_priv_base;
+ smpboot2[(sizeof(smpboot2) - 4)/4] = info->smp_startaddr;
+ for (n = 0; n < sizeof(smpboot2) / 4; n++) {
+ smpboot2[n] = tswap32(smpboot2[n]);
+ }
+ rom_add_blob_fixed("smpboot2", smpboot2, sizeof(smpboot2),
+ info->smp_loader_start);
+ }
+ else {
+ smpboot[10] = info->smp_priv_base;
+ for (n = 0; n < sizeof(smpboot) / 4; n++) {
+ smpboot[n] = tswap32(smpboot[n]);
+ }
+ rom_add_blob_fixed("smpboot", smpboot, sizeof(smpboot),
+ info->smp_loader_start);
}
- rom_add_blob_fixed("smpboot", smpboot, sizeof(smpboot),
- info->smp_loader_start);
}
info->initrd_size = initrd_size;
}
--
1.7.4.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [Qemu-devel] [PATCH] target-arm: upgrade for secondary cpu bootloader
2011-08-05 10:37 [Qemu-devel] [PATCH] target-arm: upgrade for secondary cpu bootloader Evgeny Voevodin
2011-08-05 11:03 ` Evgeny Voevodin
2011-08-05 11:04 ` Evgeny Voevodin
@ 2011-08-05 11:06 ` Evgeny Voevodin
2011-08-05 11:25 ` Evgeny Voevodin
2011-08-05 11:35 ` Peter Maydell
3 siblings, 1 reply; 9+ messages in thread
From: Evgeny Voevodin @ 2011-08-05 11:06 UTC (permalink / raw)
To: qemu-devel; +Cc: Kyungmin Park, Dmitry Solodkiy
[-- Attachment #1: Type: text/plain, Size: 1 bytes --]
[-- Attachment #2: 0001-arm-Add-new-secondary-CPU-bootloader.patch --]
[-- Type: text/x-patch, Size: 3462 bytes --]
>From 851173b22dc2c5d5f8bb46eef07c452af78f61e8 Mon Sep 17 00:00:00 2001
From: Evgeny Voevodin <e.voevodin@samsung.com>
Date: Fri, 29 Jul 2011 09:36:21 +0400
Subject: [PATCH 1/2] arm: Add new secondary CPU bootloader
Secondary CPU bootloader enables interrupt and issues wfi until start address
is written to system controller. The position where to find this start
address is hardcoded to 0x10000030. This commit adds new bootloader for
secondary CPU which allows a target board to cpecify a position where
to find start address.
Signed-off-by: Evgeny Voevodin <e.voevodin@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
---
hw/arm-misc.h | 1 +
hw/arm_boot.c | 35 ++++++++++++++++++++++++++++++-----
2 files changed, 31 insertions(+), 5 deletions(-)
diff --git a/hw/arm-misc.h b/hw/arm-misc.h
index 010acb4..ef1d61d 100644
--- a/hw/arm-misc.h
+++ b/hw/arm-misc.h
@@ -28,6 +28,7 @@ struct arm_boot_info {
const char *initrd_filename;
target_phys_addr_t loader_start;
target_phys_addr_t smp_loader_start;
+ target_phys_addr_t smp_startaddr;
target_phys_addr_t smp_priv_base;
int nb_cpus;
int board_id;
diff --git a/hw/arm_boot.c b/hw/arm_boot.c
index 620550b..59a6f05 100644
--- a/hw/arm_boot.c
+++ b/hw/arm_boot.c
@@ -44,6 +44,20 @@ static uint32_t smpboot[] = {
0 /* privbase: Private memory region base address. */
};
+static uint32_t smpboot2[] = {
+ 0xe59f201c, /* ldr r2, privbase */
+ 0xe59f001c, /* ldr r0, startaddr */
+ 0xe3a01001, /* mov r1, #1 */
+ 0xe5821100, /* str r1, [r2, #256] */
+ 0xe320f003, /* wfi */
+ 0xe5901000, /* ldr r1, [r0] */
+ 0xe1110001, /* tst r1, r1 */
+ 0x0afffffb, /* beq <wfi> */
+ 0xe12fff11, /* bx r1 */
+ 0, /* privbase: Private memory region base address. */
+ 0 /* startaddr: Where to find start address */
+};
+
#define WRITE_WORD(p, value) do { \
stl_phys_notdirty(p, value); \
p += 4; \
@@ -269,12 +283,23 @@ void arm_load_kernel(CPUState *env, struct arm_boot_info *info)
rom_add_blob_fixed("bootloader", bootloader, sizeof(bootloader),
info->loader_start);
if (info->nb_cpus > 1) {
- smpboot[10] = info->smp_priv_base;
- for (n = 0; n < sizeof(smpboot) / 4; n++) {
- smpboot[n] = tswap32(smpboot[n]);
+ if (info->smp_startaddr) {
+ smpboot2[(sizeof(smpboot2) - 8)/4] = info->smp_priv_base;
+ smpboot2[(sizeof(smpboot2) - 4)/4] = info->smp_startaddr;
+ for (n = 0; n < sizeof(smpboot2) / 4; n++) {
+ smpboot2[n] = tswap32(smpboot2[n]);
+ }
+ rom_add_blob_fixed("smpboot2", smpboot2, sizeof(smpboot2),
+ info->smp_loader_start);
+ }
+ else {
+ smpboot[10] = info->smp_priv_base;
+ for (n = 0; n < sizeof(smpboot) / 4; n++) {
+ smpboot[n] = tswap32(smpboot[n]);
+ }
+ rom_add_blob_fixed("smpboot", smpboot, sizeof(smpboot),
+ info->smp_loader_start);
}
- rom_add_blob_fixed("smpboot", smpboot, sizeof(smpboot),
- info->smp_loader_start);
}
info->initrd_size = initrd_size;
}
--
1.7.4.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [Qemu-devel] [PATCH] target-arm: upgrade for secondary cpu bootloader
2011-08-05 11:06 ` Evgeny Voevodin
@ 2011-08-05 11:25 ` Evgeny Voevodin
0 siblings, 0 replies; 9+ messages in thread
From: Evgeny Voevodin @ 2011-08-05 11:25 UTC (permalink / raw)
To: qemu-devel; +Cc: Kyungmin Park, Dmitry Solodkiy
Sorry for flooding. Looks like my e-mail preferences have been broken.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [Qemu-devel] [PATCH] target-arm: upgrade for secondary cpu bootloader
2011-08-05 10:37 [Qemu-devel] [PATCH] target-arm: upgrade for secondary cpu bootloader Evgeny Voevodin
` (2 preceding siblings ...)
2011-08-05 11:06 ` Evgeny Voevodin
@ 2011-08-05 11:35 ` Peter Maydell
2011-08-05 12:10 ` Evgeny Voevodin
3 siblings, 1 reply; 9+ messages in thread
From: Peter Maydell @ 2011-08-05 11:35 UTC (permalink / raw)
To: Evgeny Voevodin; +Cc: 0, qemu-devel
On 5 August 2011 11:37, Evgeny Voevodin <e.voevodin@samsung.com> wrote:
> Secondary CPU bootloader enables interrupt and issues wfi until start
> address is written to system controller. The position where to find this
> start address is hardcoded to 0x10000030. This commit adds new bootloader
> for secondary CPU which allows a target board to cpecify a position where to
> find start address.
What's the motivation for this? (ie what target board needs this?)
(Is there a patch 2/2 or is the subject wrong?)
Also, having a second almost-but-not-quite-identical copy of the
secondary-cpu bootloader is definitely the wrong approach. If some
boards need this then we should just have a single smpboot[] bootloader
which has both privbase and startaddr specified as data members, and
just have the code which sets it up fill in 0x10000030 if the board
doesn't override the default.
-- PMM
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [Qemu-devel] [PATCH] target-arm: upgrade for secondary cpu bootloader
2011-08-05 11:35 ` Peter Maydell
@ 2011-08-05 12:10 ` Evgeny Voevodin
2011-08-05 13:11 ` Peter Maydell
2011-08-05 13:49 ` Evgeny Voevodin
0 siblings, 2 replies; 9+ messages in thread
From: Evgeny Voevodin @ 2011-08-05 12:10 UTC (permalink / raw)
To: qemu-devel; +Cc: Kyungmin Park, Dmitry Solodkiy
On 08/05/2011 03:35 PM, Peter Maydell wrote:
> On 5 August 2011 11:37, Evgeny Voevodin<e.voevodin@samsung.com> wrote:
>> Secondary CPU bootloader enables interrupt and issues wfi until start
>> address is written to system controller. The position where to find this
>> start address is hardcoded to 0x10000030. This commit adds new bootloader
>> for secondary CPU which allows a target board to cpecify a position where to
>> find start address.
>
> What's the motivation for this? (ie what target board needs this?)
The motivation is that Samsung s5pc210 board which is under development
needs this. Also, I believe that more boards will need it in future.
> (Is there a patch 2/2 or is the subject wrong?)
Subject is wrong.
>
> Also, having a second almost-but-not-quite-identical copy of the
> secondary-cpu bootloader is definitely the wrong approach. If some
> boards need this then we should just have a single smpboot[] bootloader
> which has both privbase and startaddr specified as data members, and
> just have the code which sets it up fill in 0x10000030 if the board
> doesn't override the default.
>
> -- PMM
>
>
Will update.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [Qemu-devel] [PATCH] target-arm: upgrade for secondary cpu bootloader
2011-08-05 12:10 ` Evgeny Voevodin
@ 2011-08-05 13:11 ` Peter Maydell
2011-08-05 13:49 ` Evgeny Voevodin
1 sibling, 0 replies; 9+ messages in thread
From: Peter Maydell @ 2011-08-05 13:11 UTC (permalink / raw)
To: Evgeny Voevodin; +Cc: Kyungmin Park, qemu-devel, Dmitry Solodkiy
On 5 August 2011 13:10, Evgeny Voevodin <e.voevodin@samsung.com> wrote:
> On 08/05/2011 03:35 PM, Peter Maydell wrote:
>> What's the motivation for this? (ie what target board needs this?)
>
> The motivation is that Samsung s5pc210 board which is under development
> needs this. Also, I believe that more boards will need it in future.
Cool. Are you planning to submit this board model upstream? (on
what timescale?)
thanks
-- PMM
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [Qemu-devel] [PATCH] target-arm: upgrade for secondary cpu bootloader
2011-08-05 12:10 ` Evgeny Voevodin
2011-08-05 13:11 ` Peter Maydell
@ 2011-08-05 13:49 ` Evgeny Voevodin
1 sibling, 0 replies; 9+ messages in thread
From: Evgeny Voevodin @ 2011-08-05 13:49 UTC (permalink / raw)
To: qemu-devel; +Cc: Kyungmin Park, Dmitry Solodkiy
From 4c843ce18a7534e722670ecb892a2dedd3eae5b3 Mon Sep 17 00:00:00 2001
From: Evgeny Voevodin <e.voevodin@samsung.com>
Date: Fri, 5 Aug 2011 17:24:48 +0400
Subject: [PATCH 1/1] target-arm: Add new secondary CPU bootloader
Secondary CPU bootloader enables interrupt and issues wfi until start
address
is written to system controller. The position where to find this start
address is hardcoded to 0x10000030. This commit adds new bootloader for
secondary CPU which allows a target board to cpecify a position where
to find start address.
Signed-off-by: Evgeny Voevodin <e.voevodin@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
---
hw/arm-misc.h | 1 +
hw/arm_boot.c | 18 +++++++++++-------
2 files changed, 12 insertions(+), 7 deletions(-)
diff --git a/hw/arm-misc.h b/hw/arm-misc.h
index 010acb4..ef1d61d 100644
--- a/hw/arm-misc.h
+++ b/hw/arm-misc.h
@@ -28,6 +28,7 @@ struct arm_boot_info {
const char *initrd_filename;
target_phys_addr_t loader_start;
target_phys_addr_t smp_loader_start;
+ target_phys_addr_t smp_startaddr;
target_phys_addr_t smp_priv_base;
int nb_cpus;
int board_id;
diff --git a/hw/arm_boot.c b/hw/arm_boot.c
index 620550b..4557bbd 100644
--- a/hw/arm_boot.c
+++ b/hw/arm_boot.c
@@ -31,17 +31,17 @@ static uint32_t bootloader[] = {
/* Entry point for secondary CPUs. Enable interrupt controller and
Issue WFI until start address is written to system controller. */
static uint32_t smpboot[] = {
- 0xe59f0020, /* ldr r0, privbase */
- 0xe3a01001, /* mov r1, #1 */
- 0xe5801100, /* str r1, [r0, #0x100] */
- 0xe3a00201, /* mov r0, #0x10000000 */
- 0xe3800030, /* orr r0, #0x30 */
+ 0xe59f201c, /* ldr r2, privbase */
+ 0xe59f001c, /* ldr r0, startaddr */
+ 0xe3a01001, /* mov r1, #1 */
+ 0xe5821100, /* str r1, [r2, #256] */
0xe320f003, /* wfi */
0xe5901000, /* ldr r1, [r0] */
0xe1110001, /* tst r1, r1 */
0x0afffffb, /* beq <wfi> */
0xe12fff11, /* bx r1 */
- 0 /* privbase: Private memory region base address. */
+ 0, /* privbase: Private memory region base address. */
+ 0 /* startaddr: Where to find start address */
};
#define WRITE_WORD(p, value) do { \
@@ -269,7 +269,11 @@ void arm_load_kernel(CPUState *env, struct
arm_boot_info *info)
rom_add_blob_fixed("bootloader", bootloader, sizeof(bootloader),
info->loader_start);
if (info->nb_cpus > 1) {
- smpboot[10] = info->smp_priv_base;
+ if (!info->smp_startaddr) {
+ info->smp_startaddr = 0x10000030;
+ }
+ smpboot[(sizeof(smpboot) - 8)/4] = info->smp_priv_base;
+ smpboot[(sizeof(smpboot) - 4)/4] = info->smp_startaddr;
for (n = 0; n < sizeof(smpboot) / 4; n++) {
smpboot[n] = tswap32(smpboot[n]);
}
--
1.7.4.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
end of thread, other threads:[~2011-08-05 13:50 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-08-05 10:37 [Qemu-devel] [PATCH] target-arm: upgrade for secondary cpu bootloader Evgeny Voevodin
2011-08-05 11:03 ` Evgeny Voevodin
2011-08-05 11:04 ` Evgeny Voevodin
2011-08-05 11:06 ` Evgeny Voevodin
2011-08-05 11:25 ` Evgeny Voevodin
2011-08-05 11:35 ` Peter Maydell
2011-08-05 12:10 ` Evgeny Voevodin
2011-08-05 13:11 ` Peter Maydell
2011-08-05 13:49 ` Evgeny Voevodin
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).