From: Gerd Hoffmann <kraxel@redhat.com>
To: qemu-devel@nongnu.org
Cc: Gerd Hoffmann <kraxel@redhat.com>, "Michael S. Tsirkin" <mst@redhat.com>
Subject: [Qemu-devel] [PULL 1/3] vga: set owner for mmio regions
Date: Tue, 26 Jun 2018 18:27:34 +0200 [thread overview]
Message-ID: <20180626162736.9749-2-kraxel@redhat.com> (raw)
In-Reply-To: <20180626162736.9749-1-kraxel@redhat.com>
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
---
hw/display/vga_int.h | 1 +
hw/display/vga-pci.c | 11 ++++++-----
hw/display/virtio-vga.c | 2 +-
3 files changed, 8 insertions(+), 6 deletions(-)
diff --git a/hw/display/vga_int.h b/hw/display/vga_int.h
index 313cff84fc..f8fcf62a56 100644
--- a/hw/display/vga_int.h
+++ b/hw/display/vga_int.h
@@ -193,6 +193,7 @@ extern const MemoryRegionOps vga_mem_ops;
/* vga-pci.c */
void pci_std_vga_mmio_region_init(VGACommonState *s,
+ Object *owner,
MemoryRegion *parent,
MemoryRegion *subs,
bool qext);
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);
diff --git a/hw/display/virtio-vga.c b/hw/display/virtio-vga.c
index baa74ba82c..97db6c3372 100644
--- a/hw/display/virtio-vga.c
+++ b/hw/display/virtio-vga.c
@@ -152,7 +152,7 @@ static void virtio_vga_realize(VirtIOPCIProxy *vpci_dev, Error **errp)
}
/* add stdvga mmio regions */
- pci_std_vga_mmio_region_init(vga, &vpci_dev->modern_bar,
+ pci_std_vga_mmio_region_init(vga, OBJECT(vvga), &vpci_dev->modern_bar,
vvga->vga_mrs, true);
vga->con = g->scanout[0].con;
--
2.9.3
next prev parent reply other threads:[~2018-06-26 16:27 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-06-26 16:27 [Qemu-devel] [PULL 0/3] Vga 20180626 patches Gerd Hoffmann
2018-06-26 16:27 ` Gerd Hoffmann [this message]
2018-06-26 16:27 ` [Qemu-devel] [PULL 2/3] ramfb: fix overflow Gerd Hoffmann
2018-06-26 16:27 ` [Qemu-devel] [PULL 3/3] virtio-gpu-3d: Drop workaround for VIRTIO_GPU_CAPSET_VIRGL2 define Gerd Hoffmann
2018-06-26 17:23 ` [Qemu-devel] [PULL 0/3] Vga 20180626 patches Peter Maydell
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180626162736.9749-2-kraxel@redhat.com \
--to=kraxel@redhat.com \
--cc=mst@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).