]> git.proxmox.com Git - mirror_qemu.git/commitdiff
secondary-vga: delete mmio subregions upon exit
authorremy.noel <remy.noel@blade-group.com>
Tue, 2 Oct 2018 12:19:35 +0000 (14:19 +0200)
committerGerd Hoffmann <kraxel@redhat.com>
Fri, 5 Oct 2018 09:23:37 +0000 (11:23 +0200)
93abfc88bd649de1933588bfc7175605331b3ea9 introduced a reference cycle in
the vga-pci devices, preventing cleanup of the object upon hotblug.

This patch allows to break the cycle.

Signed-off-by: remy.noel <remy.noel@blade-group.com>
Message-id: 20181002121935.23706-1-remy.noel@blade-group.com

[ kraxel: delete the recently added edid region too ]

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
hw/display/vga-pci.c

index 24ca1b3e1fddc0e9ca131a4175586a06bde38331..a17c96e703febf15c5d01f9c073efa0aa4acc7ef 100644 (file)
@@ -309,6 +309,14 @@ static void pci_secondary_vga_exit(PCIDevice *dev)
     VGACommonState *s = &d->vga;
 
     graphic_console_close(s->con);
+    memory_region_del_subregion(&d->mmio, &d->mrs[0]);
+    memory_region_del_subregion(&d->mmio, &d->mrs[1]);
+    if (d->flags & (1 << PCI_VGA_FLAG_ENABLE_QEXT)) {
+        memory_region_del_subregion(&d->mmio, &d->mrs[2]);
+    }
+    if (d->flags & (1 << PCI_VGA_FLAG_ENABLE_EDID)) {
+        memory_region_del_subregion(&d->mmio, &d->mrs[3]);
+    }
 }
 
 static void pci_secondary_vga_init(Object *obj)