From: Palmer Dabbelt <palmer@sifive.com>
To: linux@roeck-us.net
Cc: qemu-riscv@nongnu.org, sagark@eecs.berkeley.edu,
Bastian Koppelmann <kbastian@mail.uni-paderborn.de>,
qemu-devel@nongnu.org,
Alistair Francis <Alistair.Francis@wdc.com>,
linux@roeck-us.net
Subject: Re: [Qemu-devel] [PATCH 1/3] riscv: sifive_u: Add support for loading initrd
Date: Mon, 12 Aug 2019 15:44:43 -0700 (PDT) [thread overview]
Message-ID: <mhng-ed1aa538-1ac8-4013-a274-f9c3a9a71fd0@palmer-si-x1e> (raw)
In-Reply-To: <1563543645-20804-1-git-send-email-linux@roeck-us.net>
On Fri, 19 Jul 2019 06:40:43 PDT (-0700), linux@roeck-us.net wrote:
> Add support for loading initrd with "-initrd <filename>"
> to the sifive_u machine. This lets us boot into Linux without
> disk drive.
>
> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
> ---
> hw/riscv/sifive_u.c | 20 +++++++++++++++++---
> 1 file changed, 17 insertions(+), 3 deletions(-)
>
> diff --git a/hw/riscv/sifive_u.c b/hw/riscv/sifive_u.c
> index 71b8083..0657046 100644
> --- a/hw/riscv/sifive_u.c
> +++ b/hw/riscv/sifive_u.c
> @@ -67,7 +67,7 @@ static const struct MemmapEntry {
>
> #define GEM_REVISION 0x10070109
>
> -static void create_fdt(SiFiveUState *s, const struct MemmapEntry *memmap,
> +static void *create_fdt(SiFiveUState *s, const struct MemmapEntry *memmap,
> uint64_t mem_size, const char *cmdline)
> {
> void *fdt;
> @@ -244,11 +244,14 @@ static void create_fdt(SiFiveUState *s, const struct MemmapEntry *memmap,
> qemu_fdt_setprop_string(fdt, "/chosen", "bootargs", cmdline);
> }
> g_free(nodename);
> +
> + return fdt;
> }
>
> static void riscv_sifive_u_init(MachineState *machine)
> {
> const struct MemmapEntry *memmap = sifive_u_memmap;
> + void *fdt;
>
> SiFiveUState *s = g_new0(SiFiveUState, 1);
> MemoryRegion *system_memory = get_system_memory();
> @@ -269,13 +272,24 @@ static void riscv_sifive_u_init(MachineState *machine)
> main_mem);
>
> /* create device tree */
> - create_fdt(s, memmap, machine->ram_size, machine->kernel_cmdline);
> + fdt = create_fdt(s, memmap, machine->ram_size, machine->kernel_cmdline);
>
> riscv_find_and_load_firmware(machine, BIOS_FILENAME,
> memmap[SIFIVE_U_DRAM].base);
>
> if (machine->kernel_filename) {
> - riscv_load_kernel(machine->kernel_filename);
> + uint64_t kernel_entry = riscv_load_kernel(machine->kernel_filename);
> +
> + if (machine->initrd_filename) {
> + hwaddr start;
> + hwaddr end = riscv_load_initrd(machine->initrd_filename,
> + machine->ram_size, kernel_entry,
> + &start);
> + qemu_fdt_setprop_cell(fdt, "/chosen",
> + "linux,initrd-start", start);
> + qemu_fdt_setprop_cell(fdt, "/chosen", "linux,initrd-end",
> + end);
> + }
> }
>
> /* reset vector */
Thanks. I've queued all three of these.
next prev parent reply other threads:[~2019-08-12 22:45 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1563543645-20804-1-git-send-email-linux@roeck-us.net>
2019-07-19 13:40 ` [Qemu-devel] [PATCH 2/3] riscv: sivive_u: Add dummy serial clock and aliases entry for uart Guenter Roeck
2019-07-26 20:16 ` Alistair Francis
2019-07-19 13:40 ` [Qemu-devel] [PATCH 3/3] riscv: sifive_u: Fix clock-names property for ethernet node Guenter Roeck
2019-07-19 16:19 ` Alistair Francis
2019-07-22 22:28 ` [Qemu-devel] [PATCH 1/3] riscv: sifive_u: Add support for loading initrd Alistair Francis
2019-08-12 22:44 ` Palmer Dabbelt [this message]
[not found] <CAEUhbmU8s5cEt4J-ae0wqfgFHEWe=YWQaDn_Au_MhtK1J7OntA@mail.gmail.com>
2019-08-14 17:06 ` Palmer Dabbelt
2019-08-15 1:30 ` Bin Meng
2019-08-15 1:53 ` Palmer Dabbelt
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=mhng-ed1aa538-1ac8-4013-a274-f9c3a9a71fd0@palmer-si-x1e \
--to=palmer@sifive.com \
--cc=Alistair.Francis@wdc.com \
--cc=kbastian@mail.uni-paderborn.de \
--cc=linux@roeck-us.net \
--cc=qemu-devel@nongnu.org \
--cc=qemu-riscv@nongnu.org \
--cc=sagark@eecs.berkeley.edu \
/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).