All of lore.kernel.org
 help / color / mirror / Atom feed
From: Damien Hedde <damien.hedde@greensocs.com>
To: qemu-devel@nongnu.org
Cc: Damien Hedde <damien.hedde@greensocs.com>,
	Alistair Francis <alistair@alistair23.me>
Subject: [PATCH] generic-loader: remove the ram_size limit when a loading binary file
Date: Wed,  6 Oct 2021 13:37:07 +0200	[thread overview]
Message-ID: <20211006113707.96907-1-damien.hedde@greensocs.com> (raw)

Right now, we cannot load some binary file if it is bigger than the
machine's ram size. This limitation only occurs when loading a
binary file: we can load a corresponding elf file without this
limitation.

This is an issue for machines that have small ram or do not use the
ram_size feature at all.

Also get rid of "hw/boards.h" include, since we needed it only
to access `current_machine`.

Fixes: e481a1f63c9 ("generic-loader: Add a generic loader")
Signed-off-by: Damien Hedde <damien.hedde@greensocs.com>
---

Hi Alistair,

I found this while experimenting with a ram_size=0 machine.

I checked the original discussion: it seems to me there was no
intention to specifically limit to the ram size but we had to
put some limit.

See this:
https://lists.gnu.org/archive/html/qemu-devel/2016-02/msg04668.html
https://lists.gnu.org/archive/html/qemu-devel/2016-02/msg04681.html

Thanks for your feedback,
Damien
---
 hw/core/generic-loader.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/hw/core/generic-loader.c b/hw/core/generic-loader.c
index d14f932eea..102605c07b 100644
--- a/hw/core/generic-loader.c
+++ b/hw/core/generic-loader.c
@@ -34,7 +34,6 @@
 #include "hw/core/cpu.h"
 #include "sysemu/dma.h"
 #include "sysemu/reset.h"
-#include "hw/boards.h"
 #include "hw/loader.h"
 #include "hw/qdev-properties.h"
 #include "qapi/error.h"
@@ -153,8 +152,8 @@ static void generic_loader_realize(DeviceState *dev, Error **errp)
         }
 
         if (size < 0 || s->force_raw) {
-            /* Default to the maximum size being the machine's ram size */
-            size = load_image_targphys_as(s->file, s->addr, current_machine->ram_size, as);
+            /* Do not limit the file size */
+            size = load_image_targphys_as(s->file, s->addr, -1, as);
         } else {
             s->addr = entry;
         }
-- 
2.33.0



             reply	other threads:[~2021-10-06 11:44 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-06 11:37 Damien Hedde [this message]
2021-10-06 11:49 ` [PATCH] generic-loader: remove the ram_size limit when a loading binary file Philippe Mathieu-Daudé
2021-10-06 11:58   ` Damien Hedde
2021-10-06 15:40     ` Alex Bennée
2021-10-07  7:54       ` Philippe Mathieu-Daudé
2021-10-07 10:12         ` Damien Hedde
2021-10-07 11:01           ` Philippe Mathieu-Daudé
2021-10-07  6:41     ` Alistair Francis
2021-10-07  7:59       ` Philippe Mathieu-Daudé
2021-10-08 10:38         ` Damien Hedde
2021-10-10 23:06           ` Alistair Francis
2021-10-07 10:12       ` Damien Hedde

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=20211006113707.96907-1-damien.hedde@greensocs.com \
    --to=damien.hedde@greensocs.com \
    --cc=alistair@alistair23.me \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.