From nobody Tue Nov 4 15:26:25 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 1530031246608957.8236213511121; Tue, 26 Jun 2018 09:40:46 -0700 (PDT) Received: from localhost ([::1]:53888 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fXr1A-0000dT-Gp for importer@patchew.org; Tue, 26 Jun 2018 12:40:36 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44518) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fXqog-0007Zo-KR for qemu-devel@nongnu.org; Tue, 26 Jun 2018 12:27:44 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fXqoc-0000Oj-En for qemu-devel@nongnu.org; Tue, 26 Jun 2018 12:27:42 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:46928 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fXqoc-0000OZ-9w for qemu-devel@nongnu.org; Tue, 26 Jun 2018 12:27:38 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id E8D02401EF11 for ; Tue, 26 Jun 2018 16:27:37 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-116-216.ams2.redhat.com [10.36.116.216]) by smtp.corp.redhat.com (Postfix) with ESMTP id 731232026D6A; Tue, 26 Jun 2018 16:27:37 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id D268A8F537; Tue, 26 Jun 2018 18:27:36 +0200 (CEST) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Tue, 26 Jun 2018 18:27:34 +0200 Message-Id: <20180626162736.9749-2-kraxel@redhat.com> In-Reply-To: <20180626162736.9749-1-kraxel@redhat.com> References: <20180626162736.9749-1-kraxel@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.5]); Tue, 26 Jun 2018 16:27:37 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.5]); Tue, 26 Jun 2018 16:27:37 +0000 (UTC) for IP:'10.11.54.4' DOMAIN:'int-mx04.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'kraxel@redhat.com' RCPT:'' Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PULL 1/3] vga: set owner for mmio regions X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Gerd Hoffmann , "Michael S. Tsirkin" Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" This makes sure the regions are properly cleaned when unplugging -device seconday-vga. Reported-by: Thomas Huth Signed-off-by: Gerd Hoffmann Reviewed-by: Thomas Huth Reviewed-by: Philippe Mathieu-Daud=C3=A9 Tested-by: Thomas Huth 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; =20 /* 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 =3D { }; =20 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]); =20 - 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]); =20 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 =3D 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, qex= t); =20 pci_register_bar(&d->dev, 2, PCI_BASE_ADDRESS_SPACE_MEMORY, &d->mm= io); } @@ -275,7 +276,7 @@ static void pci_secondary_vga_realize(PCIDevice *dev, E= rror **errp) qext =3D 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); =20 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) } =20 /* 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); =20 vga->con =3D g->scanout[0].con; --=20 2.9.3