Blob Blame History Raw
From a3c975852ea909b93953f53a39ab4c696c595091 Mon Sep 17 00:00:00 2001
From: Cole Robinson <crobinso@redhat.com>
Date: Tue, 19 Feb 2013 15:35:40 -0500
Subject: [PATCH] pc_piix: Add compat handling for qemu-kvm VGA mem size

Paolo outlines this here:

https://lists.gnu.org/archive/html/qemu-devel/2013-01/msg02540.html

qemu-kvm defaulted to vgamem=16MB since at least 0.15, while qemu used
8MB. For qemu 1.2, the default was changed to 16MB for all devices
except cirrus.

If --enable-migration-from-qemu-kvm is specified, make sure cirrus
uses 16MB for <= pc-1.2 (the qemu-kvm merge), and 16MB always for
all others. This will break incoming qemu migration for qemu < 1.3.

Signed-off-by: Cole Robinson <crobinso@redhat.com>
---
 hw/pc_piix.c | 20 ++++++++++++++++----
 1 file changed, 16 insertions(+), 4 deletions(-)

diff --git a/hw/pc_piix.c b/hw/pc_piix.c
index 0af436c..e3f8e96 100644
--- a/hw/pc_piix.c
+++ b/hw/pc_piix.c
@@ -331,6 +331,13 @@ static QEMUMachine pc_machine_v1_3 = {
     DEFAULT_MACHINE_OPTIONS,
 };
 
+#ifdef CONFIG_MIGRATE_FROM_QEMU_KVM
+/* qemu-kvm defaulted to 16MB video memory since 0.15 at least. */
+# define OLD_VGA_MEM stringify(16)
+#else
+# define OLD_VGA_MEM stringify(8)
+#endif
+
 #define PC_COMPAT_1_2 \
         PC_COMPAT_1_3,\
         {\
@@ -354,6 +361,10 @@ static QEMUMachine pc_machine_v1_3 = {
             .property = "revision",\
             .value    = stringify(3),\
         },{\
+            .driver   = "cirrus-vga",\
+            .property = "vgamem_mb",\
+            .value    = OLD_VGA_MEM,\
+        },{\
             .driver   = "VGA",\
             .property = "mmio",\
             .value    = "off",\
@@ -371,6 +382,7 @@ static QEMUMachine pc_machine_v1_2 = {
     DEFAULT_MACHINE_OPTIONS,
 };
 
+
 #define PC_COMPAT_1_1 \
         PC_COMPAT_1_2,\
         {\
@@ -384,19 +396,19 @@ static QEMUMachine pc_machine_v1_2 = {
         },{\
             .driver   = "VGA",\
             .property = "vgamem_mb",\
-            .value    = stringify(8),\
+            .value    = OLD_VGA_MEM,\
         },{\
             .driver   = "vmware-svga",\
             .property = "vgamem_mb",\
-            .value    = stringify(8),\
+            .value    = OLD_VGA_MEM,\
         },{\
             .driver   = "qxl-vga",\
             .property = "vgamem_mb",\
-            .value    = stringify(8),\
+            .value    = OLD_VGA_MEM,\
         },{\
             .driver   = "qxl",\
             .property = "vgamem_mb",\
-            .value    = stringify(8),\
+            .value    = OLD_VGA_MEM,\
         },{\
             .driver   = "virtio-blk-pci",\
             .property = "config-wce",\