qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH 0/2] versatile: cleanups to remove use of sysbus_mmio_init_cb2
@ 2011-09-01 17:36 Peter Maydell
  2011-09-01 17:36 ` [Qemu-devel] [PATCH 1/2] hw/arm11mpcore: Clean up to avoid using sysbus_mmio_init_cb2 Peter Maydell
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Peter Maydell @ 2011-09-01 17:36 UTC (permalink / raw)
  To: qemu-devel; +Cc: Avi Kivity, patches

A couple of patches which do some cleanup work to versatile
devices following the recent MemoryRegion conversion. These
both remove uses of sysbus_mmio_init_cb2(), which strikes me
as kind of ugly and worth avoiding. (After these two patches
it will be used by only sh_pci.c and ppce500_pci.c...)

Peter Maydell (2):
  hw/arm11mpcore: Clean up to avoid using sysbus_mmio_init_cb2
  hw/versatile_pci: Expose multiple sysbus mmio regions

 hw/arm11mpcore.c   |   13 +------------
 hw/realview.c      |   12 ++++++++++--
 hw/versatile_pci.c |   42 ++++++++----------------------------------
 hw/versatilepb.c   |   12 ++++++++++--
 4 files changed, 29 insertions(+), 50 deletions(-)

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Qemu-devel] [PATCH 1/2] hw/arm11mpcore: Clean up to avoid using sysbus_mmio_init_cb2
  2011-09-01 17:36 [Qemu-devel] [PATCH 0/2] versatile: cleanups to remove use of sysbus_mmio_init_cb2 Peter Maydell
@ 2011-09-01 17:36 ` Peter Maydell
  2011-09-01 17:36 ` [Qemu-devel] [PATCH 2/2] hw/versatile_pci: Expose multiple sysbus mmio regions Peter Maydell
  2011-09-12 15:01 ` [Qemu-devel] [PATCH 0/2] versatile: cleanups to remove use of sysbus_mmio_init_cb2 Peter Maydell
  2 siblings, 0 replies; 5+ messages in thread
From: Peter Maydell @ 2011-09-01 17:36 UTC (permalink / raw)
  To: qemu-devel; +Cc: Avi Kivity, patches

Clean up the initialisation of the realview_mpcore device to avoid
using sysbus_init_mmio_cb2(): we can pass through the MemoryRegion
of the private arm11mpcore_priv device directly now.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
 hw/arm11mpcore.c |   13 +------------
 1 files changed, 1 insertions(+), 12 deletions(-)

diff --git a/hw/arm11mpcore.c b/hw/arm11mpcore.c
index 7d60ef6..974a0d8 100644
--- a/hw/arm11mpcore.c
+++ b/hw/arm11mpcore.c
@@ -48,17 +48,6 @@ static void mpcore_rirq_set_irq(void *opaque, int irq, int level)
     }
 }
 
-static void mpcore_rirq_map(SysBusDevice *dev, target_phys_addr_t base)
-{
-    mpcore_rirq_state *s = FROM_SYSBUS(mpcore_rirq_state, dev);
-    sysbus_mmio_map(s->priv, 0, base);
-}
-
-static void mpcore_rirq_unmap(SysBusDevice *dev, target_phys_addr_t base)
-{
-    /* nothing to do */
-}
-
 static int realview_mpcore_init(SysBusDevice *dev)
 {
     mpcore_rirq_state *s = FROM_SYSBUS(mpcore_rirq_state, dev);
@@ -84,7 +73,7 @@ static int realview_mpcore_init(SysBusDevice *dev)
         }
     }
     qdev_init_gpio_in(&dev->qdev, mpcore_rirq_set_irq, 64);
-    sysbus_init_mmio_cb2(dev, mpcore_rirq_map, mpcore_rirq_unmap);
+    sysbus_init_mmio_region(dev, sysbus_mmio_get_region(s->priv, 0));
     return 0;
 }
 
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [Qemu-devel] [PATCH 2/2] hw/versatile_pci: Expose multiple sysbus mmio regions
  2011-09-01 17:36 [Qemu-devel] [PATCH 0/2] versatile: cleanups to remove use of sysbus_mmio_init_cb2 Peter Maydell
  2011-09-01 17:36 ` [Qemu-devel] [PATCH 1/2] hw/arm11mpcore: Clean up to avoid using sysbus_mmio_init_cb2 Peter Maydell
@ 2011-09-01 17:36 ` Peter Maydell
  2011-09-12 15:01 ` [Qemu-devel] [PATCH 0/2] versatile: cleanups to remove use of sysbus_mmio_init_cb2 Peter Maydell
  2 siblings, 0 replies; 5+ messages in thread
From: Peter Maydell @ 2011-09-01 17:36 UTC (permalink / raw)
  To: qemu-devel; +Cc: Avi Kivity, patches

Clean up versatile_pci to expose the various PCI mmio regions
properly as separate mmio regions rather than as a single mmio
which uses callbacks to map and unmap everything.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
 hw/realview.c      |   12 ++++++++++--
 hw/versatile_pci.c |   42 ++++++++----------------------------------
 hw/versatilepb.c   |   12 ++++++++++--
 3 files changed, 28 insertions(+), 38 deletions(-)

diff --git a/hw/realview.c b/hw/realview.c
index 549bb15..11ffb8a 100644
--- a/hw/realview.c
+++ b/hw/realview.c
@@ -272,8 +272,16 @@ static void realview_init(ram_addr_t ram_size,
     sysbus_create_simple("pl031", 0x10017000, pic[10]);
 
     if (!is_pb) {
-        dev = sysbus_create_varargs("realview_pci", 0x60000000,
-                                    pic[48], pic[49], pic[50], pic[51], NULL);
+        dev = qdev_create(NULL, "realview_pci");
+        busdev = sysbus_from_qdev(dev);
+        qdev_init_nofail(dev);
+        sysbus_mmio_map(busdev, 0, 0x61000000); /* PCI self-config */
+        sysbus_mmio_map(busdev, 1, 0x62000000); /* PCI config */
+        sysbus_mmio_map(busdev, 2, 0x63000000); /* PCI I/O */
+        sysbus_connect_irq(busdev, 0, pic[48]);
+        sysbus_connect_irq(busdev, 1, pic[49]);
+        sysbus_connect_irq(busdev, 2, pic[50]);
+        sysbus_connect_irq(busdev, 3, pic[51]);
         pci_bus = (PCIBus *)qdev_get_child_bus(dev, "pci");
         if (usb_enabled) {
             usb_ohci_init_pci(pci_bus, -1);
diff --git a/hw/versatile_pci.c b/hw/versatile_pci.c
index 98e56f1..8a88696 100644
--- a/hw/versatile_pci.c
+++ b/hw/versatile_pci.c
@@ -58,38 +58,6 @@ static void pci_vpb_set_irq(void *opaque, int irq_num, int level)
     qemu_set_irq(pic[irq_num], level);
 }
 
-
-static void pci_vpb_map(SysBusDevice *dev, target_phys_addr_t base)
-{
-    PCIVPBState *s = (PCIVPBState *)dev;
-    /* Selfconfig area.  */
-    memory_region_add_subregion(get_system_memory(), base + 0x01000000,
-                                &s->mem_config);
-    /* Normal config area.  */
-    memory_region_add_subregion(get_system_memory(), base + 0x02000000,
-                                &s->mem_config2);
-
-    if (s->realview) {
-        /* IO memory area.  */
-        memory_region_add_subregion(get_system_memory(), base + 0x03000000,
-                                    &s->isa);
-    }
-}
-
-static void pci_vpb_unmap(SysBusDevice *dev, target_phys_addr_t base)
-{
-    PCIVPBState *s = (PCIVPBState *)dev;
-    /* Selfconfig area.  */
-    memory_region_del_subregion(get_system_memory(), &s->mem_config);
-    /* Normal config area.  */
-    memory_region_del_subregion(get_system_memory(), &s->mem_config2);
-
-    if (s->realview) {
-        /* IO memory area.  */
-        memory_region_del_subregion(get_system_memory(), &s->isa);
-    }
-}
-
 static int pci_vpb_init(SysBusDevice *dev)
 {
     PCIVPBState *s = FROM_SYSBUS(PCIVPBState, dev);
@@ -106,16 +74,22 @@ static int pci_vpb_init(SysBusDevice *dev)
 
     /* ??? Register memory space.  */
 
+    /* Our memory regions are:
+     * 0 : PCI self config window
+     * 1 : PCI config window
+     * 2 : PCI IO window (realview_pci only)
+     */
     memory_region_init_io(&s->mem_config, &pci_vpb_config_ops, bus,
                           "pci-vpb-selfconfig", 0x1000000);
+    sysbus_init_mmio_region(dev, &s->mem_config);
     memory_region_init_io(&s->mem_config2, &pci_vpb_config_ops, bus,
                           "pci-vpb-config", 0x1000000);
+    sysbus_init_mmio_region(dev, &s->mem_config2);
     if (s->realview) {
         isa_mmio_setup(&s->isa, 0x0100000);
+        sysbus_init_mmio_region(dev, &s->isa);
     }
 
-    sysbus_init_mmio_cb2(dev, pci_vpb_map, pci_vpb_unmap);
-
     pci_create_simple(bus, -1, "versatile_pci_host");
     return 0;
 }
diff --git a/hw/versatilepb.c b/hw/versatilepb.c
index 49f8f5f..68402cc 100644
--- a/hw/versatilepb.c
+++ b/hw/versatilepb.c
@@ -181,6 +181,7 @@ static void versatile_init(ram_addr_t ram_size,
     qemu_irq pic[32];
     qemu_irq sic[32];
     DeviceState *dev, *sysctl;
+    SysBusDevice *busdev;
     PCIBus *pci_bus;
     NICInfo *nd;
     int n;
@@ -219,8 +220,15 @@ static void versatile_init(ram_addr_t ram_size,
     sysbus_create_simple("pl050_keyboard", 0x10006000, sic[3]);
     sysbus_create_simple("pl050_mouse", 0x10007000, sic[4]);
 
-    dev = sysbus_create_varargs("versatile_pci", 0x40000000,
-                                sic[27], sic[28], sic[29], sic[30], NULL);
+    dev = qdev_create(NULL, "versatile_pci");
+    busdev = sysbus_from_qdev(dev);
+    qdev_init_nofail(dev);
+    sysbus_mmio_map(busdev, 0, 0x41000000); /* PCI self-config */
+    sysbus_mmio_map(busdev, 1, 0x42000000); /* PCI config */
+    sysbus_connect_irq(busdev, 0, sic[27]);
+    sysbus_connect_irq(busdev, 1, sic[28]);
+    sysbus_connect_irq(busdev, 2, sic[29]);
+    sysbus_connect_irq(busdev, 3, sic[30]);
     pci_bus = (PCIBus *)qdev_get_child_bus(dev, "pci");
 
     /* The Versatile PCI bridge does not provide access to PCI IO space,
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [Qemu-devel] [PATCH 0/2] versatile: cleanups to remove use of sysbus_mmio_init_cb2
  2011-09-01 17:36 [Qemu-devel] [PATCH 0/2] versatile: cleanups to remove use of sysbus_mmio_init_cb2 Peter Maydell
  2011-09-01 17:36 ` [Qemu-devel] [PATCH 1/2] hw/arm11mpcore: Clean up to avoid using sysbus_mmio_init_cb2 Peter Maydell
  2011-09-01 17:36 ` [Qemu-devel] [PATCH 2/2] hw/versatile_pci: Expose multiple sysbus mmio regions Peter Maydell
@ 2011-09-12 15:01 ` Peter Maydell
  2011-09-13 12:29   ` Avi Kivity
  2 siblings, 1 reply; 5+ messages in thread
From: Peter Maydell @ 2011-09-12 15:01 UTC (permalink / raw)
  To: qemu-devel; +Cc: Avi Kivity, patches

Ping?

On 1 September 2011 18:36, Peter Maydell <peter.maydell@linaro.org> wrote:
> A couple of patches which do some cleanup work to versatile
> devices following the recent MemoryRegion conversion. These
> both remove uses of sysbus_mmio_init_cb2(), which strikes me
> as kind of ugly and worth avoiding. (After these two patches
> it will be used by only sh_pci.c and ppce500_pci.c...)
>
> Peter Maydell (2):
>  hw/arm11mpcore: Clean up to avoid using sysbus_mmio_init_cb2
>  hw/versatile_pci: Expose multiple sysbus mmio regions
>
>  hw/arm11mpcore.c   |   13 +------------
>  hw/realview.c      |   12 ++++++++++--
>  hw/versatile_pci.c |   42 ++++++++----------------------------------
>  hw/versatilepb.c   |   12 ++++++++++--
>  4 files changed, 29 insertions(+), 50 deletions(-)

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Qemu-devel] [PATCH 0/2] versatile: cleanups to remove use of sysbus_mmio_init_cb2
  2011-09-12 15:01 ` [Qemu-devel] [PATCH 0/2] versatile: cleanups to remove use of sysbus_mmio_init_cb2 Peter Maydell
@ 2011-09-13 12:29   ` Avi Kivity
  0 siblings, 0 replies; 5+ messages in thread
From: Avi Kivity @ 2011-09-13 12:29 UTC (permalink / raw)
  To: Peter Maydell; +Cc: qemu-devel, patches

On 09/12/2011 06:01 PM, Peter Maydell wrote:
> Ping?

Sorry; applied to memory/queue.

> On 1 September 2011 18:36, Peter Maydell<peter.maydell@linaro.org>  wrote:
> >  A couple of patches which do some cleanup work to versatile
> >  devices following the recent MemoryRegion conversion. These
> >  both remove uses of sysbus_mmio_init_cb2(), which strikes me
> >  as kind of ugly and worth avoiding. (After these two patches
> >  it will be used by only sh_pci.c and ppce500_pci.c...)
> >
> >  Peter Maydell (2):
> >    hw/arm11mpcore: Clean up to avoid using sysbus_mmio_init_cb2
> >    hw/versatile_pci: Expose multiple sysbus mmio regions
> >
> >    hw/arm11mpcore.c   |   13 +------------
> >    hw/realview.c      |   12 ++++++++++--
> >    hw/versatile_pci.c |   42 ++++++++----------------------------------
> >    hw/versatilepb.c   |   12 ++++++++++--
> >    4 files changed, 29 insertions(+), 50 deletions(-)


-- 
error compiling committee.c: too many arguments to function

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2011-09-13 12:29 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-09-01 17:36 [Qemu-devel] [PATCH 0/2] versatile: cleanups to remove use of sysbus_mmio_init_cb2 Peter Maydell
2011-09-01 17:36 ` [Qemu-devel] [PATCH 1/2] hw/arm11mpcore: Clean up to avoid using sysbus_mmio_init_cb2 Peter Maydell
2011-09-01 17:36 ` [Qemu-devel] [PATCH 2/2] hw/versatile_pci: Expose multiple sysbus mmio regions Peter Maydell
2011-09-12 15:01 ` [Qemu-devel] [PATCH 0/2] versatile: cleanups to remove use of sysbus_mmio_init_cb2 Peter Maydell
2011-09-13 12:29   ` Avi Kivity

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).