qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Peter Maydell <peter.maydell@linaro.org>
To: Evgeny Voevodin <e.voevodin@samsung.com>
Cc: m.kozlov@samsung.com, qemu-devel@nongnu.org, d.solodkiy@samsung.com
Subject: Re: [Qemu-devel] [PATCH v3 07/14] hw/arm_boot.c: Add new secondary CPU bootloader.
Date: Tue, 13 Dec 2011 11:28:36 +0000	[thread overview]
Message-ID: <CAFEAcA_UaeNqO4+MwSk3Lj9CyWqeTxdagz-fNVW3fNUDP7sr3w@mail.gmail.com> (raw)
In-Reply-To: <1323672206-11891-8-git-send-email-e.voevodin@samsung.com>

On 12 December 2011 06:43, 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. If target board doesn't specify start address then
> default 0x10000030 is used

This commit message isn't quite right. We aren't adding a new bootloader,
we're modifying the existing one.

>
> Signed-off-by: Evgeny Voevodin <e.voevodin@samsung.com>
> ---
>  hw/arm-misc.h |    1 +
>  hw/arm_boot.c |   22 +++++++++++++++-------
>  2 files changed, 16 insertions(+), 7 deletions(-)
>
> diff --git a/hw/arm-misc.h b/hw/arm-misc.h
> index af403a1..6e8ae6b 100644
> --- a/hw/arm-misc.h
> +++ b/hw/arm-misc.h
> @@ -31,6 +31,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_bootreg_addr;
>     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 215d5de..ecaac22 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           /* bootreg: Boot register address is hold here */

"held"

>  };
>
>  #define WRITE_WORD(p, value) do { \
> @@ -179,6 +179,7 @@ static void do_cpu_reset(void *opaque)
>  {
>     CPUState *env = opaque;
>     const struct arm_boot_info *info = env->boot_info;
> +    uint8_t smp_bootreg_addr[4] = {0};
>
>     cpu_reset(env);
>     if (info) {
> @@ -197,6 +198,8 @@ static void do_cpu_reset(void *opaque)
>                                     info->loader_start);
>                 }
>             } else {
> +                cpu_physical_memory_rw(info->smp_bootreg_addr, smp_bootreg_addr,
> +                        sizeof(smp_bootreg_addr), 1);

Any reason not to use WRITE_WORD() ?

>                 env->regs[15] = info->smp_loader_start;
>             }
>         }
> @@ -262,6 +265,7 @@ void arm_load_kernel(CPUState *env, struct arm_boot_info *info)
>         } else {
>             initrd_size = 0;
>         }
> +
>         bootloader[1] |= info->board_id & 0xff;
>         bootloader[2] |= (info->board_id >> 8) & 0xff;
>         bootloader[5] = info->loader_start + KERNEL_ARGS_ADDR;

Stray whitespace change, please remove from patch.

> @@ -272,7 +276,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_bootreg_addr) {
> +                info->smp_bootreg_addr = 0x10000030;
> +            }
> +            smpboot[(sizeof(smpboot) - 8)/4] = info->smp_priv_base;
> +            smpboot[(sizeof(smpboot) - 4)/4] = info->smp_bootreg_addr;

smpboot[ARRAY_SIZE(smpboot) - 1] = ...

>             for (n = 0; n < sizeof(smpboot) / 4; n++) {
>                 smpboot[n] = tswap32(smpboot[n]);
>             }
> --
> 1.7.4.1

-- PMM

  reply	other threads:[~2011-12-13 11:28 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-12  6:43 [Qemu-devel] [PATCH v3 00/14] ARM: Samsung Exynos4210-based boards support Evgeny Voevodin
2011-12-12  6:43 ` [Qemu-devel] [PATCH v3 01/14] ARM: Samsung exynos4210-based boards emulation Evgeny Voevodin
2011-12-12 22:17   ` Peter Maydell
2011-12-12  6:43 ` [Qemu-devel] [PATCH v3 02/14] ARM: exynos4210: CMU support Evgeny Voevodin
2011-12-12 22:44   ` Peter Maydell
2011-12-14 12:10     ` Maksim E. Kozlov
2011-12-14 11:43       ` Peter Maydell
2011-12-14 17:08     ` Maksim E. Kozlov
2011-12-14 16:25       ` Peter Maydell
2011-12-15  7:11     ` Dmitry Solodkiy
2011-12-12  6:43 ` [Qemu-devel] [PATCH v3 03/14] ARM: exynos4210: UART support Evgeny Voevodin
2011-12-12 22:55   ` Peter Maydell
2011-12-12  6:43 ` [Qemu-devel] [PATCH v3 04/14] hw/sysbus.h: Increase maximum number of device IRQs Evgeny Voevodin
2011-12-12  6:43 ` [Qemu-devel] [PATCH v3 05/14] ARM: exynos4210: IRQ subsystem support Evgeny Voevodin
2011-12-12  6:43 ` [Qemu-devel] [PATCH v3 06/14] ARM: exynos4210: PWM support Evgeny Voevodin
2011-12-13 10:51   ` Peter Maydell
2011-12-12  6:43 ` [Qemu-devel] [PATCH v3 07/14] hw/arm_boot.c: Add new secondary CPU bootloader Evgeny Voevodin
2011-12-13 11:28   ` Peter Maydell [this message]
2011-12-12  6:43 ` [Qemu-devel] [PATCH v3 08/14] ARM: exynos4210: MCT support Evgeny Voevodin
2011-12-12  6:43 ` [Qemu-devel] [PATCH v3 09/14] hw/exynos4210.c: Boot secondary CPU Evgeny Voevodin
2011-12-12  6:43 ` [Qemu-devel] [PATCH v3 10/14] hw/lan9118: Add basic 16-bit mode support Evgeny Voevodin
2011-12-13 11:54   ` Peter Maydell
2011-12-12  6:43 ` [Qemu-devel] [PATCH v3 11/14] hw/exynos4210.c: Add LAN support for SMDKC210 Evgeny Voevodin
2011-12-13 12:01   ` Peter Maydell
2011-12-12  6:43 ` [Qemu-devel] [PATCH v3 12/14] hw/sd.c, hw/sd.h: add receive ready query routine to SD/MMC API Evgeny Voevodin
2011-12-13 15:11   ` Peter Maydell
2011-12-13 16:22     ` Peter Maydell
2011-12-14  8:29       ` Mitsyanko Igor
2011-12-12  6:43 ` [Qemu-devel] [PATCH v3 13/14] ARM: exynos4210: added SD/MMC host controller Evgeny Voevodin
2011-12-13 14:56   ` Peter Maydell
2011-12-13 16:23     ` Mitsyanko Igor
2011-12-12  6:43 ` [Qemu-devel] [PATCH v3 14/14] ARM: exynos4210: added display controller implementation Evgeny Voevodin
2011-12-12  7:22 ` [Qemu-devel] [PATCH v3 00/14] ARM: Samsung Exynos4210-based boards support Stefan Weil
2011-12-13 10:14 ` Peter Maydell
2011-12-13 10:37   ` Dmitry Solodkiy
2011-12-13 10:59     ` 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=CAFEAcA_UaeNqO4+MwSk3Lj9CyWqeTxdagz-fNVW3fNUDP7sr3w@mail.gmail.com \
    --to=peter.maydell@linaro.org \
    --cc=d.solodkiy@samsung.com \
    --cc=e.voevodin@samsung.com \
    --cc=m.kozlov@samsung.com \
    --cc=qemu-devel@nongnu.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 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).