Patchwork qxl: set size of PCI IO BAR correctly (16) for revision 2

login
register
mail settings
Submitter Uri Lublin
Date May 10, 2012, 1:24 p.m.
Message ID <1336656293-31499-1-git-send-email-uril@redhat.com>
Download mbox | patch
Permalink /patch/158290/
State New
Headers show

Comments

Uri Lublin - May 10, 2012, 1:24 p.m.
Also move it up into switch(qxl->revision) block

Signed-off-by: Uri Lublin <uril@redhat.com>
---
 hw/qxl.c |    8 +++-----
 1 files changed, 3 insertions(+), 5 deletions(-)
Gerd Hoffmann - May 10, 2012, 3:18 p.m.
On 05/10/12 15:24, Uri Lublin wrote:
> Also move it up into switch(qxl->revision) block

Looks good.

Anthony, want a one-patch-pull-req for this one?
Or can you just pick it up directly?

cheers,
  Gerd

Patch

diff --git a/hw/qxl.c b/hw/qxl.c
index 6c11e70..3da3399 100644
--- a/hw/qxl.c
+++ b/hw/qxl.c
@@ -1746,13 +1746,16 @@  static int qxl_init_common(PCIQXLDevice *qxl)
     switch (qxl->revision) {
     case 1: /* spice 0.4 -- qxl-1 */
         pci_device_rev = QXL_REVISION_STABLE_V04;
+        io_size = 8;
         break;
     case 2: /* spice 0.6 -- qxl-2 */
         pci_device_rev = QXL_REVISION_STABLE_V06;
+        io_size = 16;
         break;
     case 3: /* qxl-3 */
     default:
         pci_device_rev = QXL_DEFAULT_REVISION;
+        io_size = msb_mask(QXL_IO_RANGE_SIZE * 2 - 1);
         break;
     }
 
@@ -1770,11 +1773,6 @@  static int qxl_init_common(PCIQXLDevice *qxl)
     memory_region_init_alias(&qxl->vram32_bar, "qxl.vram32", &qxl->vram_bar,
                              0, qxl->vram32_size);
 
-    io_size = msb_mask(QXL_IO_RANGE_SIZE * 2 - 1);
-    if (qxl->revision == 1) {
-        io_size = 8;
-    }
-
     memory_region_init_io(&qxl->io_bar, &qxl_io_ops, qxl,
                           "qxl-ioports", io_size);
     if (qxl->id == 0) {