qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Alistair Francis <alistair23@gmail.com>
To: "Philippe Mathieu-Daudé" <philmd@redhat.com>
Cc: Bug 1814343 <1814343@bugs.launchpad.net>,
	"qemu-devel@nongnu.org Developers" <qemu-devel@nongnu.org>,
	Alistair Francis <Alistair.Francis@wdc.com>,
	Alistair Francis <alistair@alistair23.me>,
	"qemu-riscv@nongnu.org" <qemu-riscv@nongnu.org>
Subject: Re: [Qemu-devel] [Bug 1814343] [NEW] Initrd not loaded on riscv32
Date: Tue, 5 Feb 2019 10:36:46 -0800	[thread overview]
Message-ID: <CAKmqyKMBF23CJTNtdqiQ7gO7kA5ZSAu3aXr1uoF+=rE_RKwgFw@mail.gmail.com> (raw)
In-Reply-To: <a667006b-44e2-f72d-8164-c52a9374cb84@redhat.com>

On Fri, Feb 1, 2019 at 3:26 PM Philippe Mathieu-Daudé <philmd@redhat.com> wrote:
>
> Hi Jonathan,
>
> On 2/1/19 11:06 PM, Jonathan Behrens wrote:
> > Public bug reported:
> >
> > I attempted to run qemu with a ram disk. However, when reading the
> > contents of the disk from within the VM I only get back zeros.
> >
> > I was able to trace the issue to a mismatch of expectations on line 93
> > of hw/riscv/virt.c. Specifically, when running in 32-bit mode the value
> > of kernel_entry is sign extended to 64-bits, but load_image_targphys
> > expects the start address to not be sign extended.
> >
> > Straw man patch (works for 32-bit but would probably break 64-bit VMs?):
> >
> > diff --git a/hw/riscv/virt.c b/hw/riscv/virt.c
> > index e7f0716fb6..32216f993c 100644
> > --- a/hw/riscv/virt.c
> > +++ b/hw/riscv/virt.c
> > @@ -90,7 +90,7 @@ static hwaddr load_initrd(const char *filename, uint64_t mem_size,
> >       * halfway into RAM, and for boards with 256MB of RAM or more we put
> >       * the initrd at 128MB.
> >       */
> > -    *start = kernel_entry + MIN(mem_size / 2, 128 * MiB);
> > +    *start = (kernel_entry & 0xffffffff) + MIN(mem_size / 2, 128 * MiB);
> >
> >      size = load_ramdisk(filename, *start, mem_size - *start);
> >      if (size == -1) {
> >
> >
> > Run command:
> >
> > $ qemu/build/riscv32-softmmu/qemu-system-riscv32 -machine virt -kernel
> > mykernel.elf -nographic -initrd payload
> >
> > Commit hash:
> >
> > 3a183e330dbd7dbcac3841737ac874979552cca2
> >
> > ** Affects: qemu
> >      Importance: Undecided
> >          Status: New
>
> I believe this is fixed by the following patch:
> "Ensure the kernel start address is correctly cast"
> https://lists.gnu.org/archive/html/qemu-devel/2019-01/msg06358.html
>
> Can you test it?
> If if works you can reply to it with a
> "Tested-by: Jonathan Behrens <your-email>"
> to increases the odds it get merged ;)

Did you get a chance to test this Jonathan?

Alistair

>
> Thanks,
>
> Phil.
>

  reply	other threads:[~2019-02-05 18:37 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-01 22:06 [Qemu-devel] [Bug 1814343] [NEW] Initrd not loaded on riscv32 Jonathan Behrens
2019-02-01 23:15 ` Philippe Mathieu-Daudé
2019-02-05 18:36   ` Alistair Francis [this message]
2019-02-01 23:16 ` [Qemu-devel] [Bug 1814343] " Philippe Mathieu-Daudé
2021-04-20  8:17 ` Thomas Huth
2021-06-20  4:17 ` Launchpad Bug Tracker

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='CAKmqyKMBF23CJTNtdqiQ7gO7kA5ZSAu3aXr1uoF+=rE_RKwgFw@mail.gmail.com' \
    --to=alistair23@gmail.com \
    --cc=1814343@bugs.launchpad.net \
    --cc=Alistair.Francis@wdc.com \
    --cc=alistair@alistair23.me \
    --cc=philmd@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-riscv@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).