qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] fix initrd load failed
@ 2013-11-17 16:10 ChenQun
  2013-11-17 16:26 ` Peter Maydell
  0 siblings, 1 reply; 2+ messages in thread
From: ChenQun @ 2013-11-17 16:10 UTC (permalink / raw)
  To: peter.maydell; +Cc: ChenQun, qemu-devel, kvmarm

Here's a bug, some examples are as follows:
1.Assuming Guest's filesystem size 6M.
2.For vexpress_a15, the loader_start = 2048M.
If we set guest ram_size range from  2048M+128M to 2048M+128M+6M,
  then the initrd load failed.
3.For mach-virt, the loader_start = 128M.
If we set guest ram_size range from 256M to 256M+6M, then it is
failed too.

So,it is a bug for load initrd max mem calculation.
It should be (ram_size + loader_start - initrd_start).

Signed-off-by: ChenQun <chenq009@gmail.com>
---
 hw/arm/boot.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/hw/arm/boot.c b/hw/arm/boot.c
index 583ec79..831128d 100644
--- a/hw/arm/boot.c
+++ b/hw/arm/boot.c
@@ -415,12 +415,14 @@ void arm_load_kernel(ARMCPU *cpu, struct arm_boot_info *info)
         if (info->initrd_filename) {
             initrd_size = load_ramdisk(info->initrd_filename,
                                        info->initrd_start,
-                                       info->ram_size -
+                                       info->ram_size +
+                                       info->loader_start -
                                        info->initrd_start);
             if (initrd_size < 0) {
                 initrd_size = load_image_targphys(info->initrd_filename,
                                                   info->initrd_start,
-                                                  info->ram_size -
+                                                  info->ram_size +
+                                                  info->loader_start -
                                                   info->initrd_start);
             }
             if (initrd_size < 0) {
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [Qemu-devel] [PATCH] fix initrd load failed
  2013-11-17 16:10 [Qemu-devel] [PATCH] fix initrd load failed ChenQun
@ 2013-11-17 16:26 ` Peter Maydell
  0 siblings, 0 replies; 2+ messages in thread
From: Peter Maydell @ 2013-11-17 16:26 UTC (permalink / raw)
  To: ChenQun; +Cc: QEMU Developers, kvmarm@lists.cs.columbia.edu

On 17 November 2013 16:10, ChenQun <chenq009@gmail.com> wrote:
> Here's a bug, some examples are as follows:
> 1.Assuming Guest's filesystem size 6M.
> 2.For vexpress_a15, the loader_start = 2048M.
> If we set guest ram_size range from  2048M+128M to 2048M+128M+6M,
>   then the initrd load failed.
> 3.For mach-virt, the loader_start = 128M.
> If we set guest ram_size range from 256M to 256M+6M, then it is
> failed too.
>
> So,it is a bug for load initrd max mem calculation.
> It should be (ram_size + loader_start - initrd_start).

Yes, this is definitely a bug. The set of addresses/sizes we
pass to the loader is a bit of a mess, though -- we kind of
implicitly assume that "loader_start" means "bottom of RAM",
and that all the ram is in one chunk. However for example
realview-pbx-a9 sets loader_start to 0 when the size of that
bit of RAM may be less than the total ram_size. The device
tree editing code also assumes a single contiguous block
of RAM...

thanks
-- PMM

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-11-17 16:27 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-11-17 16:10 [Qemu-devel] [PATCH] fix initrd load failed ChenQun
2013-11-17 16:26 ` Peter Maydell

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).