All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ard Biesheuvel <ard.biesheuvel@linaro.org>
To: u-boot@lists.denx.de
Subject: [RFC PATCH 1/1] riscv: Add boot hartid to Device tree
Date: Tue, 25 Feb 2020 00:44:01 +0100	[thread overview]
Message-ID: <CAKv+Gu9678rOf4BEVejjBUiuqYcvSgCSBOnayCWNoyUennTXxQ@mail.gmail.com> (raw)
In-Reply-To: <20200224221949.28826-2-atish.patra@wdc.com>

On Mon, 24 Feb 2020 at 23:20, Atish Patra <atish.patra@wdc.com> wrote:
>
> Linux booting protocol mandates that register "a0" contains the hartid.
> However, U-boot can not pass the hartid via a0 during EFI boot without
> breaking the UEFI specification.
>

It is not about breaking or violating the UEFI specification. It is
about the firmware using a conduit that is already being used to
describe the hardware to the OS to pass an extra piece of information
that the OS needs.

> Add a DT node under chosen node to indicate the boot hartid. EFI stub
> in Linux kernel will parse this node and pass it to the real kernel
> in "a0" before jumping to it.
>
> Signed-off-by: Atish Patra <atish.patra@wdc.com>
> ---
>  arch/riscv/lib/bootm.c | 13 +++++++++++++
>  1 file changed, 13 insertions(+)
>
> diff --git a/arch/riscv/lib/bootm.c b/arch/riscv/lib/bootm.c
> index fad16901c5f2..b84cc2db2016 100644
> --- a/arch/riscv/lib/bootm.c
> +++ b/arch/riscv/lib/bootm.c
> @@ -28,6 +28,19 @@ __weak void board_quiesce_devices(void)
>
>  int arch_fixup_fdt(void *blob)
>  {
> +       u32 size;
> +       int chosen_offset, err;
> +
> +       size = fdt_totalsize(blob);
> +       err  = fdt_open_into(blob, blob, size + 32);
> +       if (err < 0) {
> +               printf("Device Tree can't be expanded to accmodate new node");

'accommodate'

> +               return -1;
> +       }
> +       chosen_offset = fdt_path_offset(blob, "/chosen");
> +       fdt_setprop_u64(blob, chosen_offset, "efi-boot-hartid",

I assume that boot hartid does not change value when you boot via
UEFI, so this should simply be /chosen/boot-hartid

> +                          gd->arch.boot_hart);
> +
>         return 0;
>  }
>
> --
> 2.24.0
>

  reply	other threads:[~2020-02-24 23:44 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-24 22:19 [RFC PATCH 0/1] Add boot hartid to a Device tree Atish Patra
2020-02-24 22:19 ` [RFC PATCH 1/1] riscv: Add boot hartid to " Atish Patra
2020-02-24 23:44   ` Ard Biesheuvel [this message]
2020-02-24 23:08 ` [RFC PATCH 0/1] Add boot hartid to a " Heinrich Schuchardt
2020-02-24 23:35   ` Ard Biesheuvel
2020-02-24 23:52     ` Atish Patra
2020-02-25  8:28       ` Chang, Abner
2020-02-25  8:48         ` Ard Biesheuvel
2020-02-25  8:59           ` Chang, Abner
2020-02-25  9:07             ` Ard Biesheuvel
2020-03-05  3:22               ` Schaefer, Daniel
2020-03-05  7:35                 ` Ard Biesheuvel
2020-03-06  0:34                 ` Atish Patra

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=CAKv+Gu9678rOf4BEVejjBUiuqYcvSgCSBOnayCWNoyUennTXxQ@mail.gmail.com \
    --to=ard.biesheuvel@linaro.org \
    --cc=u-boot@lists.denx.de \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.