Blob Blame History Raw
From 3e580f65ac69c7a84b672a59de6772dae24b5a8a 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.
---
 hw/i386/pc_piix.c | 20 ++++++++++++++++----
 1 file changed, 16 insertions(+), 4 deletions(-)

diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c
index 43ab480..48fb7b7 100644
--- a/hw/i386/pc_piix.c
+++ b/hw/i386/pc_piix.c
@@ -383,6 +383,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,\
         {\
@@ -406,6 +413,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",\
@@ -423,6 +434,7 @@ static QEMUMachine pc_machine_v1_2 = {
     DEFAULT_MACHINE_OPTIONS,
 };
 
+
 #define PC_COMPAT_1_1 \
         PC_COMPAT_1_2,\
         {\
@@ -436,19 +448,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",\