qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: ChenQun <chenq009@gmail.com>
To: peter.maydell@linaro.org
Cc: ChenQun <chenq009@gmail.com>,
	qemu-devel@nongnu.org, kvmarm@lists.cs.columbia.edu
Subject: [Qemu-devel] [PATCH] fix initrd load failed
Date: Sun, 17 Nov 2013 08:10:24 -0800	[thread overview]
Message-ID: <1384704624-3860-1-git-send-email-chenq009@gmail.com> (raw)

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

             reply	other threads:[~2013-11-17 16:11 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-17 16:10 ChenQun [this message]
2013-11-17 16:26 ` [Qemu-devel] [PATCH] fix initrd load failed Peter Maydell

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=1384704624-3860-1-git-send-email-chenq009@gmail.com \
    --to=chenq009@gmail.com \
    --cc=kvmarm@lists.cs.columbia.edu \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@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).