qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH] vga: set owner for mmio regions


From: Philippe Mathieu-Daudé
Subject: Re: [Qemu-devel] [PATCH] vga: set owner for mmio regions
Date: Tue, 26 Jun 2018 08:39:23 -0300
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0

On 06/26/2018 03:09 AM, Gerd Hoffmann wrote:
> This makes sure the regions are properly cleaned when unplugging -device
> seconday-vga.
> 
> Reported-by: Thomas Huth <address@hidden>
> Signed-off-by: Gerd Hoffmann <address@hidden>

Reviewed-by: Philippe Mathieu-Daudé <address@hidden>

> ---
>  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;
> 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]