On 05/25/2011 12:12 AM, David Gibson wrote:
@@ -602,6 +604,8 @@ static int spapr_vio_busdev_init(DeviceState *qdev, 
DeviceInfo *qinfo)
      }

      dev->qdev.id = id;
+    dev->vio_irq_num = bus->irq++;
+    dev->qirq = xics_find_qirq(spapr->icp, dev->vio_irq_num);

I'd prefer to see an spapr_allocate_irq() function, rather than open
coding this multiple times.

I don't understand. This is the only call to xics_find_qirq, unlike before this patch. It's not open coded multiple times.

I can surely add a spapr_allocate_irq() function that would keep the code independent of the particular interrupt controller. Would you prefer something that gives back the virtual IRQ number as well:

    qemu_irq *spapr_allocate_irq(uint32_t *p_vio_irq_num)

or should I keep that in the VIOsPAPRBus, like this:

    qemu_irq *spapr_allocate_irq(uint32_t p_vio_irq_num)

?  Should I pass a sPAPREnvironment too, or should it just use the global?

Paolo

Reply via email to