summary refs log tree commit diff stats
path: root/hw/display/vga-pci.c
diff options
context:
space:
mode:
authorGerd Hoffmann <kraxel@redhat.com>2018-06-26 08:09:41 +0200
committerGerd Hoffmann <kraxel@redhat.com>2018-06-26 16:03:40 +0200
commit93abfc88bd649de1933588bfc7175605331b3ea9 (patch)
tree8821fb65c40968ba4d1d0f646b7d55877d71c09b /hw/display/vga-pci.c
parente409d9a158c77c650651e8118f6c86c8dc76eba6 (diff)
downloadfocaccia-qemu-93abfc88bd649de1933588bfc7175605331b3ea9.tar.gz
focaccia-qemu-93abfc88bd649de1933588bfc7175605331b3ea9.zip
vga: set owner for mmio regions
This makes sure the regions are properly cleaned when unplugging -device
seconday-vga.

Reported-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Tested-by: Thomas Huth <thuth@redhat.com>
Message-id: 20180626060941.8326-1-kraxel@redhat.com
Diffstat (limited to 'hw/display/vga-pci.c')
-rw-r--r--hw/display/vga-pci.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/hw/display/vga-pci.c b/hw/display/vga-pci.c
index 700ac58c69..1ea559762a 100644
--- a/hw/display/vga-pci.c
+++ b/hw/display/vga-pci.c
@@ -192,22 +192,23 @@ static const MemoryRegionOps pci_vga_qext_ops = {
 };
 
 void pci_std_vga_mmio_region_init(VGACommonState *s,
+                                  Object *owner,
                                   MemoryRegion *parent,
                                   MemoryRegion *subs,
                                   bool qext)
 {
-    memory_region_init_io(&subs[0], NULL, &pci_vga_ioport_ops, s,
+    memory_region_init_io(&subs[0], owner, &pci_vga_ioport_ops, s,
                           "vga ioports remapped", PCI_VGA_IOPORT_SIZE);
     memory_region_add_subregion(parent, PCI_VGA_IOPORT_OFFSET,
                                 &subs[0]);
 
-    memory_region_init_io(&subs[1], NULL, &pci_vga_bochs_ops, s,
+    memory_region_init_io(&subs[1], owner, &pci_vga_bochs_ops, s,
                           "bochs dispi interface", PCI_VGA_BOCHS_SIZE);
     memory_region_add_subregion(parent, PCI_VGA_BOCHS_OFFSET,
                                 &subs[1]);
 
     if (qext) {
-        memory_region_init_io(&subs[2], NULL, &pci_vga_qext_ops, s,
+        memory_region_init_io(&subs[2], owner, &pci_vga_qext_ops, s,
                               "qemu extended regs", PCI_VGA_QEXT_SIZE);
         memory_region_add_subregion(parent, PCI_VGA_QEXT_OFFSET,
                                     &subs[2]);
@@ -239,7 +240,7 @@ static void pci_std_vga_realize(PCIDevice *dev, Error **errp)
             qext = true;
             pci_set_byte(&d->dev.config[PCI_REVISION_ID], 2);
         }
-        pci_std_vga_mmio_region_init(s, &d->mmio, d->mrs, qext);
+        pci_std_vga_mmio_region_init(s, OBJECT(dev), &d->mmio, d->mrs, qext);
 
         pci_register_bar(&d->dev, 2, PCI_BASE_ADDRESS_SPACE_MEMORY, &d->mmio);
     }
@@ -275,7 +276,7 @@ static void pci_secondary_vga_realize(PCIDevice *dev, Error **errp)
         qext = true;
         pci_set_byte(&d->dev.config[PCI_REVISION_ID], 2);
     }
-    pci_std_vga_mmio_region_init(s, &d->mmio, d->mrs, qext);
+    pci_std_vga_mmio_region_init(s, OBJECT(dev), &d->mmio, d->mrs, qext);
 
     pci_register_bar(&d->dev, 0, PCI_BASE_ADDRESS_MEM_PREFETCH, &s->vram);
     pci_register_bar(&d->dev, 2, PCI_BASE_ADDRESS_SPACE_MEMORY, &d->mmio);