On 21/3/22 19:55, Cédric Le Goater wrote:
On 3/21/22 14:04, Philippe Mathieu-Daudé wrote:
Cc'ing Bernhard who did a similar cleanup recently.
Same problem happens with qemu-system-ppc64 and the pegasos2 machine.
No clue how to properly fix this... is it safe to free the pointer
at the end of the function?
I introduced quite a few of these calls,
hw/ppc/pnv_lpc.c: irqs = qemu_allocate_irqs(handler, lpc,
ISA_NUM_IRQS);
hw/ppc/pnv_psi.c: psi->qirqs = qemu_allocate_irqs(ics_set_irq,
ics, ics->nr_irqs);
hw/ppc/pnv_psi.c: psi->qirqs =
qemu_allocate_irqs(xive_source_set_irq, xsrc, xsrc->nr_irqs);
hw/ppc/ppc.c: env->irq_inputs = (void
**)qemu_allocate_irqs(&ppc6xx_set_irq, cpu,
hw/ppc/ppc.c: env->irq_inputs = (void
**)qemu_allocate_irqs(&ppc970_set_irq, cpu,
hw/ppc/ppc.c: env->irq_inputs = (void
**)qemu_allocate_irqs(&power7_set_irq, cpu,
hw/ppc/ppc.c: env->irq_inputs = (void
**)qemu_allocate_irqs(&power9_set_irq, cpu,
hw/ppc/ppc.c: env->irq_inputs = (void
**)qemu_allocate_irqs(&ppc40x_set_irq,
hw/ppc/ppc.c: env->irq_inputs = (void
**)qemu_allocate_irqs(&ppce500_set_irq,
hw/ppc/spapr_irq.c: spapr->qirqs =
qemu_allocate_irqs(spapr_set_irq, spapr,
and may be I can remove some. What's the best practice ?
I recommend looking at how Peter did it recently in commit 3391953660
("hw/sparc: Make grlib-irqmp device handle its own inbound IRQ lines")
and d9cd403972 ("hw/m68k/next-cube: Make next_irq GPIO inputs to NEXT_PC
device").