Blob Blame History Raw
From 5c401c750c8e52fe5c67b4e60143a862a0d584c1 Mon Sep 17 00:00:00 2001
From: Markus Armbruster <armbru@redhat.com>
Date: Mon, 7 Jul 2014 10:28:38 +0200
Subject: vl: Round memory sizes below 2MiB up to 2MiB

RH-Author: Markus Armbruster <armbru@redhat.com>
Message-id: <1387459965-19517-2-git-send-email-armbru@redhat.com>
Patchwork-id: 56389
O-Subject: [PATCH 7.0 qemu-kvm 1/1] vl: Round memory sizes below 2MiB up to 2MiB
Bugzilla: 999836
RH-Acked-by: Laszlo Ersek <lersek@redhat.com>
RH-Acked-by: Luiz Capitulino <lcapitulino@redhat.com>
RH-Acked-by: Igor Mammedov <imammedo@redhat.com>

From: Markus Armbruster <armbru@redhat.com>

SeaBIOS requires at least 1MiB of RAM, but doesn't doesn't check for
it.  It simply assumes it's there, and crashes when it isn't, often
without any indication what's wrong.  No upstream SeaBIOS fix
expected.

In RHEL-6, we round memory sizes below 2MiB up to 2MiB to protect
SeaBIOS (commit 551c098 and commit b9d6c40).  Do the same for RHEL-7.
Not wanted upstream.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
(cherry picked from commit 059f9d2454b587d72e186aeb49795601a5a809a6)
(cherry picked from commit 8687bf531780ccbed0a23d3eaa66af30b79d70e8)
---
 vl.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/vl.c b/vl.c
index 0296a90..8a5df00 100644
--- a/vl.c
+++ b/vl.c
@@ -2873,6 +2873,7 @@ static void set_memory_options(uint64_t *ram_slots, ram_addr_t *maxram_size,
     }
 
     sz = QEMU_ALIGN_UP(sz, 8192);
+    sz = MAX(sz, 2 * 1024 * 1024);
     ram_size = sz;
     if (ram_size != sz) {
         error_report("ram size too large");
-- 
1.8.3.1