qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH v3 29/39] sun4u: convert to memory API


From: Anthony Liguori
Subject: Re: [Qemu-devel] [PATCH v3 29/39] sun4u: convert to memory API
Date: Fri, 05 Aug 2011 10:30:54 -0500
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.17) Gecko/20110516 Lightning/1.0b2 Thunderbird/3.1.10

On 08/04/2011 08:06 AM, Avi Kivity wrote:
fixes memory leak on repeated BAR map/unmap

Reviewed-by: Richard Henderson<address@hidden>
Signed-off-by: Avi Kivity<address@hidden>
---
  hw/sun4u.c |   55 +++++++++++++++++++++++++------------------------------
  1 files changed, 25 insertions(+), 30 deletions(-)

diff --git a/hw/sun4u.c b/hw/sun4u.c
index d7dcaf0..74a06a8 100644
--- a/hw/sun4u.c
+++ b/hw/sun4u.c
@@ -91,6 +91,12 @@ struct hwdef {
      uint64_t console_serial_base;
  };

+typedef struct EbusState {
+    PCIDevice pci_dev;
+    MemoryRegion bar0;
+    MemoryRegion bar1;
+} EbusState;
+
  int DMA_get_channel_mode (int nchan)
  {
      return 0;
@@ -518,21 +524,6 @@ void cpu_tick_set_limit(CPUTimer *timer, uint64_t limit)
      }
  }

-static void ebus_mmio_mapfunc(PCIDevice *pci_dev, int region_num,
-                              pcibus_t addr, pcibus_t size, int type)
-{
-    EBUS_DPRINTF("Mapping region %d registers at %" FMT_PCIBUS "\n",
-                 region_num, addr);
-    switch (region_num) {
-    case 0:
-        isa_mmio_init(addr, 0x1000000);
-        break;
-    case 1:
-        isa_mmio_init(addr, 0x800000);
-        break;
-    }
-}
-
  static void dummy_isa_irq_handler(void *opaque, int n, int level)
  {
  }
@@ -549,27 +540,31 @@ pci_ebus_init(PCIBus *bus, int devfn)
  }

  static int
-pci_ebus_init1(PCIDevice *s)
+pci_ebus_init1(PCIDevice *pci_dev)
  {
-    isa_bus_new(&s->qdev);
+    EbusState *s = container_of(pci_dev, EbusState, pci_dev);

DO_UPCAST() is the qdev macro for this.

Regards,

Anthony Liguori



reply via email to

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