qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Conor Dooley <conor@kernel.org>
To: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
Cc: Jim Shu <jim.shu@sifive.com>,
	qemu-devel@nongnu.org, qemu-riscv@nongnu.org,
	Palmer Dabbelt <palmer@dabbelt.com>,
	Alistair Francis <alistair.francis@wdc.com>,
	Bin Meng <bmeng.cn@gmail.com>, Weiwei Li <liwei1518@gmail.com>,
	Liu Zhiwei <zhiwei_liu@linux.alibaba.com>
Subject: Re: [PATCH 2/2] hw/riscv: Support different address-cells for initrd
Date: Thu, 24 Oct 2024 16:20:02 +0100	[thread overview]
Message-ID: <20241024-prism-hermit-ce5876051ade@spud> (raw)
In-Reply-To: <25ae806f-38de-425f-8590-1c605d93197d@ventanamicro.com>

[-- Attachment #1: Type: text/plain, Size: 2337 bytes --]

On Mon, Oct 21, 2024 at 04:30:11PM -0300, Daniel Henrique Barboza wrote:
> 
> 
> On 10/21/24 1:09 AM, Jim Shu wrote:
> > The cells of 'initrd-start/end' should follow the '#address-cell'.
> > QEMU API could support 1 and 2 cells.
> > 
> > Signed-off-by: Jim Shu <jim.shu@sifive.com>
> > ---
> >   hw/riscv/boot.c | 14 ++++++++++++--
> >   1 file changed, 12 insertions(+), 2 deletions(-)
> > 
> > diff --git a/hw/riscv/boot.c b/hw/riscv/boot.c
> > index ad45bd7a6a..76b099c696 100644
> > --- a/hw/riscv/boot.c
> > +++ b/hw/riscv/boot.c
> > @@ -182,6 +182,7 @@ static void riscv_load_initrd(MachineState *machine, uint64_t kernel_entry)
> >       void *fdt = machine->fdt;
> >       hwaddr start, end;
> >       ssize_t size;
> > +    uint32_t acells;
> >       g_assert(filename != NULL);
> > @@ -209,9 +210,18 @@ static void riscv_load_initrd(MachineState *machine, uint64_t kernel_entry)
> >       /* Some RISC-V machines (e.g. opentitan) don't have a fdt. */
> >       if (fdt) {
> > +        acells = qemu_fdt_getprop_cell(fdt, "/", "#address-cells",
> > +                                       NULL, NULL);
> > +        if (acells == 0) {
> > +            error_report("dtb file invalid (#address-cells 0)");
> > +            exit(1);
> > +        }
> > +
> >           end = start + size;
> > -        qemu_fdt_setprop_u64(fdt, "/chosen", "linux,initrd-start", start);
> > -        qemu_fdt_setprop_u64(fdt, "/chosen", "linux,initrd-end", end);
> > +        qemu_fdt_setprop_sized_cells(fdt, "/chosen", "linux,initrd-start",
> > +                                     acells, start);
> > +        qemu_fdt_setprop_sized_cells(fdt, "/chosen", "linux,initrd-end",
> > +                                     acells, end);
> >       }
> 
> Is this a legal format for linux,initrd-start and linux,initrd-end?
> 
> This link:
> 
> https://www.kernel.org/doc/Documentation/devicetree/bindings/chosen.txt
> 
> Defines both attributes as:
> 
> "These properties hold the physical start and end address of an initrd that's
> loaded by the bootloader."
> 
> So I'm not sure if this format you're using here is valid.

Looks like my input isn't really required here anymore, but I think
these two are actually identical in how they appear in the blob. Don't
see much reason to change it.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

      parent reply	other threads:[~2024-10-24 15:21 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-21  4:09 [PATCH 0/2] Support 64-bit address of initrd Jim Shu
2024-10-21  4:09 ` [PATCH 1/2] hw/riscv: Support to load DTB after 3GB memory on 64-bit system Jim Shu
2024-10-21 13:41   ` Daniel Henrique Barboza
2024-10-23 10:19     ` Jim Shu
2024-10-24 14:23       ` Daniel Henrique Barboza
2024-10-21  4:09 ` [PATCH 2/2] hw/riscv: Support different address-cells for initrd Jim Shu
2024-10-21 19:30   ` Daniel Henrique Barboza
2024-10-23 10:44     ` Jim Shu
2024-10-24 15:20     ` Conor Dooley [this message]

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=20241024-prism-hermit-ce5876051ade@spud \
    --to=conor@kernel.org \
    --cc=alistair.francis@wdc.com \
    --cc=bmeng.cn@gmail.com \
    --cc=dbarboza@ventanamicro.com \
    --cc=jim.shu@sifive.com \
    --cc=liwei1518@gmail.com \
    --cc=palmer@dabbelt.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-riscv@nongnu.org \
    --cc=zhiwei_liu@linux.alibaba.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).