[03/58] spapr: make irq customizable via qdev

Submitted by Alexander Graf on Sept. 14, 2011, 8:42 a.m.

Details

Message ID 1315989802-18753-4-git-send-email-agraf@suse.de
State New
Headers show

Commit Message

Alexander Graf Sept. 14, 2011, 8:42 a.m.
From: Paolo Bonzini <pbonzini@redhat.com>

This also lets the user see the irq in "info qtree".

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Cc: Alexander Graf <agraf@suse.de>
Cc: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Alexander Graf <agraf@suse.de>
---
 hw/spapr_vio.c |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)

Comments

David Gibson Sept. 15, 2011, 3:15 a.m.
On Wed, Sep 14, 2011 at 10:42:27AM +0200, Alexander Graf wrote:
> From: Paolo Bonzini <pbonzini@redhat.com>
> 
> This also lets the user see the irq in "info qtree".

Um.. I'm a bit confused by this one.  The previous patch comment
implies it's a preparation for this, but then you add the new irq
property to the BusInfo, rather than to the macro that goes into the
DeviceInfos.  Why does this one go in the bus, rather than the device?

> 
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> Cc: Alexander Graf <agraf@suse.de>
> Cc: David Gibson <david@gibson.dropbear.id.au>
> Signed-off-by: Alexander Graf <agraf@suse.de>
> ---
>  hw/spapr_vio.c |    8 +++++++-
>  1 files changed, 7 insertions(+), 1 deletions(-)
> 
> diff --git a/hw/spapr_vio.c b/hw/spapr_vio.c
> index ba2e1c1..0546ccb 100644
> --- a/hw/spapr_vio.c
> +++ b/hw/spapr_vio.c
> @@ -52,6 +52,10 @@
>  static struct BusInfo spapr_vio_bus_info = {
>      .name       = "spapr-vio",
>      .size       = sizeof(VIOsPAPRBus),
> +    .props = (Property[]) {
> +        DEFINE_PROP_UINT32("irq", VIOsPAPRDevice, vio_irq_num, 0), \
> +        DEFINE_PROP_END_OF_LIST(),
> +    },
>  };
>  
>  VIOsPAPRDevice *spapr_vio_find_by_reg(VIOsPAPRBus *bus, uint32_t reg)
> @@ -604,7 +608,9 @@ static int spapr_vio_busdev_init(DeviceState *qdev, DeviceInfo *qinfo)
>      }
>  
>      dev->qdev.id = id;
> -    dev->vio_irq_num = bus->irq++;
> +    if (!dev->vio_irq_num) {
> +        dev->vio_irq_num = bus->irq++;
> +    }
>      dev->qirq = spapr_find_qirq(spapr, dev->vio_irq_num);
>  
>      rtce_init(dev);
Paolo Bonzini Sept. 15, 2011, 6:51 a.m.
On 09/15/2011 05:15 AM, David Gibson wrote:
>> >
>> >  This also lets the user see the irq in "info qtree".
> Um.. I'm a bit confused by this one.  The previous patch comment
> implies it's a preparation for this, but then you add the new irq
> property to the BusInfo, rather than to the macro that goes into the
> DeviceInfos.  Why does this one go in the bus, rather than the device?

Yes, I suppose that the commit message for patch 2 is a bit stale.

I put this one in the bus, rather than the device, because the default 
is common to all devices.  Instead, each device type has its own default 
reg and default dma-window.

Paolo

Patch hide | download patch | download mbox

diff --git a/hw/spapr_vio.c b/hw/spapr_vio.c
index ba2e1c1..0546ccb 100644
--- a/hw/spapr_vio.c
+++ b/hw/spapr_vio.c
@@ -52,6 +52,10 @@ 
 static struct BusInfo spapr_vio_bus_info = {
     .name       = "spapr-vio",
     .size       = sizeof(VIOsPAPRBus),
+    .props = (Property[]) {
+        DEFINE_PROP_UINT32("irq", VIOsPAPRDevice, vio_irq_num, 0), \
+        DEFINE_PROP_END_OF_LIST(),
+    },
 };
 
 VIOsPAPRDevice *spapr_vio_find_by_reg(VIOsPAPRBus *bus, uint32_t reg)
@@ -604,7 +608,9 @@  static int spapr_vio_busdev_init(DeviceState *qdev, DeviceInfo *qinfo)
     }
 
     dev->qdev.id = id;
-    dev->vio_irq_num = bus->irq++;
+    if (!dev->vio_irq_num) {
+        dev->vio_irq_num = bus->irq++;
+    }
     dev->qirq = spapr_find_qirq(spapr, dev->vio_irq_num);
 
     rtce_init(dev);