FIXME.  No idea how to figure how much ram we have.

For now claim we have 128 MB.  That is the minimum kvmtool uses
if you don't specify something via -m (if I read the code correctly).
So things should at least work, even though we might leave memory
unused.

Signed-off-by: Gerd Hoffmann <kra...@redhat.com>
---
 src/fw/paravirt.c | 11 +++++++++++
 src/fw/paravirt.h |  2 ++
 src/post.c        |  1 +
 3 files changed, 14 insertions(+)

diff --git a/src/fw/paravirt.c b/src/fw/paravirt.c
index db22ae8..efd9848 100644
--- a/src/fw/paravirt.c
+++ b/src/fw/paravirt.c
@@ -446,3 +446,14 @@ void qemu_cfg_init(void)
         dprintf(1, "Moving pm_base to 0x%x\n", acpi_pm_base);
     }
 }
+
+void
+kvmtool_preinit(void)
+{
+    if (!CONFIG_KVMTOOL)
+        return;
+
+    /* FIXME: claim we have 128 MB */
+    RamSize = 128 * 1024 * 1024;
+    add_e820(0, RamSize, E820_RAM);
+}
diff --git a/src/fw/paravirt.h b/src/fw/paravirt.h
index 95ffb92..7caca4d 100644
--- a/src/fw/paravirt.h
+++ b/src/fw/paravirt.h
@@ -34,4 +34,6 @@ void qemu_preinit(void);
 void qemu_platform_setup(void);
 void qemu_cfg_init(void);
 
+void kvmtool_preinit(void);
+
 #endif
diff --git a/src/post.c b/src/post.c
index 65a3c9c..36cc5d7 100644
--- a/src/post.c
+++ b/src/post.c
@@ -314,6 +314,7 @@ dopost(void)
 {
     // Detect ram and setup internal malloc.
     qemu_preinit();
+    kvmtool_preinit();
     coreboot_preinit();
     malloc_preinit();
 
-- 
1.8.3.1

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to