From: Peter Maydell <peter.maydell@linaro.org>
To: Joel Stanley <joel@jms.id.au>
Cc: "Andrew Jeffery" <andrew@aj.id.au>,
qemu-arm <qemu-arm@nongnu.org>,
"Philippe Mathieu-Daudé" <philmd@redhat.com>,
"Cédric Le Goater" <clg@kaod.org>,
"QEMU Developers" <qemu-devel@nongnu.org>
Subject: Re: [PATCH v2] aspeed: Add boot stub for smp booting
Date: Thu, 16 Apr 2020 17:48:41 +0100 [thread overview]
Message-ID: <CAFEAcA8M06TFD4d8jLe-w24PMUGDH_sRXhf8TV25JuTV1ig2jQ@mail.gmail.com> (raw)
In-Reply-To: <20200409063137.803522-1-joel@jms.id.au>
On Thu, 9 Apr 2020 at 07:31, Joel Stanley <joel@jms.id.au> wrote:
>
> This is a boot stub that is similar to the code u-boot runs, allowing
> the kernel to boot the secondary CPU.
> +static void aspeed_write_smpboot(ARMCPU *cpu,
> + const struct arm_boot_info *info)
> +{
> + static const uint32_t poll_mailbox_ready[] = {
> + /*
> + * r2 = per-cpu go sign value
> + * r1 = AST_SMP_MBOX_FIELD_ENTRY
> + * r0 = AST_SMP_MBOX_FIELD_GOSIGN
> + */
> + 0xee100fb0, /* mrc p15, 0, r0, c0, c0, 5 */
> + 0xe21000ff, /* ands r0, r0, #255 */
> + 0xe59f201c, /* ldr r2, [pc, #28] */
> + 0xe1822000, /* orr r2, r2, r0 */
> +
> + 0xe59f1018, /* ldr r1, [pc, #24] */
> + 0xe59f0018, /* ldr r0, [pc, #24] */
> +
> + 0xe320f002, /* wfe */
> + 0xe5904000, /* ldr r4, [r0] */
> + 0xe1520004, /* cmp r2, r4 */
> + 0x1afffffb, /* bne <wfe> */
Note that unlike "wfi", QEMU's "wfe" implementation is merely
a 'yield', so a secondary-CPU boot loop that has wfe in it
will basically be a busy-loop of those vcpu threads.
(This is why the smpboot code in hw/arm/boot.c uses wfi.)
I don't suppose the secondary boot protocol on these boards
is such that a wfi loop will work ? (Depends on what the
primary code in the kernel does to prod the secondary after
writing the magic value.)
> + 0xe591f000, /* ldr pc, [r1] */
> + AST_SMP_MBOX_GOSIGN,
> + AST_SMP_MBOX_FIELD_ENTRY,
> + AST_SMP_MBOX_FIELD_GOSIGN,
> + };
thanks
-- PMM
next prev parent reply other threads:[~2020-04-16 16:49 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-04-09 6:31 [PATCH v2] aspeed: Add boot stub for smp booting Joel Stanley
2020-04-16 16:48 ` Peter Maydell [this message]
2020-05-04 8:18 ` Joel Stanley
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=CAFEAcA8M06TFD4d8jLe-w24PMUGDH_sRXhf8TV25JuTV1ig2jQ@mail.gmail.com \
--to=peter.maydell@linaro.org \
--cc=andrew@aj.id.au \
--cc=clg@kaod.org \
--cc=joel@jms.id.au \
--cc=philmd@redhat.com \
--cc=qemu-arm@nongnu.org \
--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).