From d2c1d3bd7d95a8214df387368ec443e9b9d4dd95 Mon Sep 17 00:00:00 2001 Message-Id: In-Reply-To: <5d2ec4d8ecd7ab6bd4a62bec6b2f63577549b3bd.1347457394.git.minovotn@redhat.com> References: <5d2ec4d8ecd7ab6bd4a62bec6b2f63577549b3bd.1347457394.git.minovotn@redhat.com> From: Markus Armbruster Date: Thu, 6 Sep 2012 08:55:53 +0200 Subject: [PATCH 5/6] vl: Round argument of -m up to multiple of 8KiB RH-Author: Markus Armbruster Message-id: <1346921754-12722-3-git-send-email-armbru@redhat.com> Patchwork-id: 41696 O-Subject: [RHEL-6.4 PATCH qemu-kvm 2/3] vl: Round argument of -m up to multiple of 8KiB Bugzilla: 755594 RH-Acked-by: Laszlo Ersek RH-Acked-by: Pavel Hrdina RH-Acked-by: Luiz Capitulino 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 Signed-off-by: Blue Swirl (cherry picked from commit ff961015529437f4b83fca0a92069aebcf533c9c) Trivial conflict because we lack commit 834e76ea. Doesn't fix upstream's reproducer, because we run into another bug, which I'll patch next. Does fix this one: $ qemu-kvm -nodefaults -S -vnc :0 -m 1.1 create_userspace_phys_mem: Invalid argument kvm_cpu_register_physical_memory: failed Conflicts: vl.c --- vl.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) Signed-off-by: Michal Novotny --- vl.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/vl.c b/vl.c index 4280a83..7cfea7b 100644 --- a/vl.c +++ b/vl.c @@ -5439,6 +5439,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); @@ -5452,11 +5453,12 @@ int main(int argc, char **argv, char **envp) fprintf(stderr, "qemu: at most 2047 MB RAM can be simulated\n"); 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_d: -- 1.7.11.4