On 16/06/2026 17:36, Daniel P. Berrangé wrote:
Isn't this the same as the existing qemu_allocate_irq() ?
Doh, I missed the very surprising naming pattern where "qemu_irq" is a
typedef of 'struct IRQState *'.
(I have over the past few years occasionally been trying to get rid
of existing uses of qemu_allocate_irq() and its cousin
qemu_allocate_irqs(), because they are persistent sources of memory
leaks. The function returns a pointer that the caller has to deal
with and remember to free, whereas using e.g. qdev_init_gpio_*()
makes the new irq objects children of the device they belong to,
so they're automatically freed when the device is destroyed.
qemu_init_irq_child() similarly.)
If we think it is best practice to mandate passing in a parent
object so that every IRQ is gauranteed to be owned by the QOM
tree, that's fine with me.
Yes, this feels like the right way forward to me.
ATB,
Mark.