qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Markus Armbruster <armbru@redhat.com>
To: qemu-devel@nongnu.org
Cc: blauwirbel@gmail.com, anthony@codemonkey.ws, avi@redhat.com,
	gleb@redhat.com
Subject: [Qemu-devel] [PATCH v3 1/2] vl: Round argument of -m up to multiple of 8KiB
Date: Wed, 15 Aug 2012 13:12:19 +0200	[thread overview]
Message-ID: <1345029140-12338-2-git-send-email-armbru@redhat.com> (raw)
In-Reply-To: <1345029140-12338-1-git-send-email-armbru@redhat.com>

Partial pages make little sense and don't work.  Ensure the RAM size
is a multiple of any possible target's page size.

Fixes

    $ qemu-system-x86_64 -nodefaults -S -vnc :0 -m 0.8
    qemu-system-x86_64: /work/armbru/qemu/exec.c:2255: register_subpage: Assertion `existing->mr->subpage || existing->mr == &io_mem_unassigned' failed.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
---
 vl.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/vl.c b/vl.c
index d01256a..a63e16b 100644
--- a/vl.c
+++ b/vl.c
@@ -2701,6 +2701,7 @@ int main(int argc, char **argv, char **envp)
                 break;
             case QEMU_OPTION_m: {
                 int64_t value;
+                uint64_t sz;
                 char *end;
 
                 value = strtosz(optarg, &end);
@@ -2708,12 +2709,12 @@ int main(int argc, char **argv, char **envp)
                     fprintf(stderr, "qemu: invalid ram size: %s\n", optarg);
                     exit(1);
                 }
-
-                if (value != (uint64_t)(ram_addr_t)value) {
+                sz = QEMU_ALIGN_UP((uint64_t)value, 8192);
+                ram_size = sz;
+                if (ram_size != sz) {
                     fprintf(stderr, "qemu: ram size too large\n");
                     exit(1);
                 }
-                ram_size = value;
                 break;
             }
             case QEMU_OPTION_mempath:
-- 
1.7.11.2

  reply	other threads:[~2012-08-15 11:12 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-15 11:12 [Qemu-devel] [PATCH v3 0/2] Fix two bugs related to ram_size Markus Armbruster
2012-08-15 11:12 ` Markus Armbruster [this message]
2012-08-15 11:12 ` [Qemu-devel] [PATCH v3 2/2] pc: Fix RTC CMOS info on RAM for ram_size < 1MiB Markus Armbruster
2012-08-19 19:36   ` Kevin O'Connor
2012-08-20  8:54     ` Markus Armbruster
2012-08-18 20:04 ` [Qemu-devel] [PATCH v3 0/2] Fix two bugs related to ram_size Blue Swirl

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=1345029140-12338-2-git-send-email-armbru@redhat.com \
    --to=armbru@redhat.com \
    --cc=anthony@codemonkey.ws \
    --cc=avi@redhat.com \
    --cc=blauwirbel@gmail.com \
    --cc=gleb@redhat.com \
    --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).