render / rpms / qemu

Forked from rpms/qemu 9 months ago
Clone

Blame 0105-qxl-Add-rom_size-compat-property-fix-migration-from-.patch

96a5f8
From 95a59bc743f27d7d3fdcc1b0ff131f240e01e839 Mon Sep 17 00:00:00 2001
96a5f8
From: Cole Robinson <crobinso@redhat.com>
96a5f8
Date: Tue, 19 Feb 2013 16:19:02 -0500
96a5f8
Subject: [PATCH] qxl: Add rom_size compat property, fix migration from 1.2
96a5f8
96a5f8
Commit 038c1879a00153b14bce113315b693e8c2944fa9 changed the qxl rom
96a5f8
size to 8192, which fixes incoming migration from qemu 1.0. However
96a5f8
from qemu 1.2 and 1.3 had rom size 16384, so incoming migration
96a5f8
from those versions is now broken.
96a5f8
96a5f8
Add a rom_size compat property. 1.2 and 1.3 get 16384, everything
96a5f8
else is 8192.
96a5f8
96a5f8
This isn't actually fool proof, since rom_size can be dependent on
96a5f8
the version of spice qemu is built against:
96a5f8
96a5f8
https://lists.gnu.org/archive/html/qemu-devel/2013-02/msg03154.html
96a5f8
96a5f8
However these sizes match what native Fedora packages get, so it's
96a5f8
good enough for now.
96a5f8
96a5f8
Signed-off-by: Cole Robinson <crobinso@redhat.com>
96a5f8
---
96a5f8
 hw/pc_piix.c | 16 ++++++++++++++++
96a5f8
 hw/qxl.c     |  9 ++++-----
96a5f8
 2 files changed, 20 insertions(+), 5 deletions(-)
96a5f8
96a5f8
diff --git a/hw/pc_piix.c b/hw/pc_piix.c
96a5f8
index e3f8e96..a1a6794 100644
96a5f8
--- a/hw/pc_piix.c
96a5f8
+++ b/hw/pc_piix.c
96a5f8
@@ -317,6 +317,14 @@ static QEMUMachine pc_i440fx_machine_v1_4 = {
96a5f8
             .driver   = "virtio-net-pci", \
96a5f8
             .property = "mq", \
96a5f8
             .value    = "off", \
96a5f8
+        },{ \
96a5f8
+            .driver   = "qxl", \
96a5f8
+            .property = "rom_size", \
96a5f8
+            .value    = stringify(16384), \
96a5f8
+        },{\
96a5f8
+            .driver   = "qxl-vga", \
96a5f8
+            .property = "rom_size", \
96a5f8
+            .value    = stringify(16384), \
96a5f8
         }
96a5f8
 
96a5f8
 static QEMUMachine pc_machine_v1_3 = {
96a5f8
@@ -413,6 +421,14 @@ static QEMUMachine pc_machine_v1_2 = {
96a5f8
             .driver   = "virtio-blk-pci",\
96a5f8
             .property = "config-wce",\
96a5f8
             .value    = "off",\
96a5f8
+        },{ \
96a5f8
+            .driver   = "qxl", \
96a5f8
+            .property = "rom_size", \
96a5f8
+            .value    = stringify(8192), \
96a5f8
+        },{\
96a5f8
+            .driver   = "qxl-vga", \
96a5f8
+            .property = "rom_size", \
96a5f8
+            .value    = stringify(8192), \
96a5f8
         }
96a5f8
 
96a5f8
 static QEMUMachine pc_machine_v1_1 = {
96a5f8
diff --git a/hw/qxl.c b/hw/qxl.c
96a5f8
index 2e1c5e2..436e375 100644
96a5f8
--- a/hw/qxl.c
96a5f8
+++ b/hw/qxl.c
96a5f8
@@ -302,16 +302,14 @@ static inline uint32_t msb_mask(uint32_t val)
96a5f8
     return mask;
96a5f8
 }
96a5f8
 
96a5f8
-static ram_addr_t qxl_rom_size(void)
96a5f8
+static void check_qxl_rom_size(PCIQXLDevice *d)
96a5f8
 {
96a5f8
     uint32_t required_rom_size = sizeof(QXLRom) + sizeof(QXLModes) +
96a5f8
                                  sizeof(qxl_modes);
96a5f8
-    uint32_t rom_size = 8192; /* two pages */
96a5f8
 
96a5f8
     required_rom_size = MAX(required_rom_size, TARGET_PAGE_SIZE);
96a5f8
     required_rom_size = msb_mask(required_rom_size * 2 - 1);
96a5f8
-    assert(required_rom_size <= rom_size);
96a5f8
-    return rom_size;
96a5f8
+    assert(required_rom_size <= d->rom_size);
96a5f8
 }
96a5f8
 
96a5f8
 static void init_qxl_rom(PCIQXLDevice *d)
96a5f8
@@ -1979,7 +1977,7 @@ static int qxl_init_common(PCIQXLDevice *qxl)
96a5f8
     pci_set_byte(&config[PCI_REVISION_ID], pci_device_rev);
96a5f8
     pci_set_byte(&config[PCI_INTERRUPT_PIN], 1);
96a5f8
 
96a5f8
-    qxl->rom_size = qxl_rom_size();
96a5f8
+    check_qxl_rom_size(qxl);
96a5f8
     memory_region_init_ram(&qxl->rom_bar, "qxl.vrom", qxl->rom_size);
96a5f8
     vmstate_register_ram(&qxl->rom_bar, &qxl->pci.qdev);
96a5f8
     init_qxl_rom(qxl);
96a5f8
@@ -2296,6 +2294,7 @@ static Property qxl_properties[] = {
96a5f8
         DEFINE_PROP_UINT32("vram64_size_mb", PCIQXLDevice, vram_size_mb, -1),
96a5f8
         DEFINE_PROP_UINT32("vgamem_mb", PCIQXLDevice, vgamem_size_mb, 16),
96a5f8
         DEFINE_PROP_INT32("surfaces", PCIQXLDevice, ssd.num_surfaces, 1024),
96a5f8
+        DEFINE_PROP_UINT32("rom_size", PCIQXLDevice, rom_size, 8192),
96a5f8
         DEFINE_PROP_END_OF_LIST(),
96a5f8
 };
96a5f8