ppc64: Allocate IRQ lines with qdev_init_gpio_in()

This replaces the IRQ array 'irq_inputs' with GPIO lines, the goal
being to remove 'irq_inputs' when all CPUs have been converted.

Signed-off-by: Cédric Le Goater <clg@kaod.org>
Acked-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Message-Id: <20220705145814.461723-2-clg@kaod.org>
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
This commit is contained in:
Cédric Le Goater 2022-07-05 16:58:10 +02:00 committed by Daniel Henrique Barboza
parent 7823789731
commit 9fd0122e7d
4 changed files with 15 additions and 22 deletions

View File

@ -301,23 +301,25 @@ void icp_reset(ICPState *icp)
static void icp_realize(DeviceState *dev, Error **errp) static void icp_realize(DeviceState *dev, Error **errp)
{ {
ICPState *icp = ICP(dev); ICPState *icp = ICP(dev);
PowerPCCPU *cpu;
CPUPPCState *env; CPUPPCState *env;
Error *err = NULL; Error *err = NULL;
assert(icp->xics); assert(icp->xics);
assert(icp->cs); assert(icp->cs);
env = &POWERPC_CPU(icp->cs)->env; cpu = POWERPC_CPU(icp->cs);
env = &cpu->env;
switch (PPC_INPUT(env)) { switch (PPC_INPUT(env)) {
case PPC_FLAGS_INPUT_POWER7: case PPC_FLAGS_INPUT_POWER7:
icp->output = env->irq_inputs[POWER7_INPUT_INT]; icp->output = qdev_get_gpio_in(DEVICE(cpu), POWER7_INPUT_INT);
break; break;
case PPC_FLAGS_INPUT_POWER9: /* For SPAPR xics emulation */ case PPC_FLAGS_INPUT_POWER9: /* For SPAPR xics emulation */
icp->output = env->irq_inputs[POWER9_INPUT_INT]; icp->output = qdev_get_gpio_in(DEVICE(cpu), POWER9_INPUT_INT);
break; break;
case PPC_FLAGS_INPUT_970: case PPC_FLAGS_INPUT_970:
icp->output = env->irq_inputs[PPC970_INPUT_INT]; icp->output = qdev_get_gpio_in(DEVICE(cpu), PPC970_INPUT_INT);
break; break;
default: default:

View File

@ -695,8 +695,8 @@ static void xive_tctx_realize(DeviceState *dev, Error **errp)
env = &cpu->env; env = &cpu->env;
switch (PPC_INPUT(env)) { switch (PPC_INPUT(env)) {
case PPC_FLAGS_INPUT_POWER9: case PPC_FLAGS_INPUT_POWER9:
tctx->hv_output = env->irq_inputs[POWER9_INPUT_HINT]; tctx->hv_output = qdev_get_gpio_in(DEVICE(cpu), POWER9_INPUT_HINT);
tctx->os_output = env->irq_inputs[POWER9_INPUT_INT]; tctx->os_output = qdev_get_gpio_in(DEVICE(cpu), POWER9_INPUT_INT);
break; break;
default: default:

View File

@ -276,16 +276,16 @@ static void ppc_core99_init(MachineState *machine)
#if defined(TARGET_PPC64) #if defined(TARGET_PPC64)
case PPC_FLAGS_INPUT_970: case PPC_FLAGS_INPUT_970:
openpic_irqs[i].irq[OPENPIC_OUTPUT_INT] = openpic_irqs[i].irq[OPENPIC_OUTPUT_INT] =
((qemu_irq *)env->irq_inputs)[PPC970_INPUT_INT]; qdev_get_gpio_in(DEVICE(cpu), PPC970_INPUT_INT);
openpic_irqs[i].irq[OPENPIC_OUTPUT_CINT] = openpic_irqs[i].irq[OPENPIC_OUTPUT_CINT] =
((qemu_irq *)env->irq_inputs)[PPC970_INPUT_INT]; qdev_get_gpio_in(DEVICE(cpu), PPC970_INPUT_INT);
openpic_irqs[i].irq[OPENPIC_OUTPUT_MCK] = openpic_irqs[i].irq[OPENPIC_OUTPUT_MCK] =
((qemu_irq *)env->irq_inputs)[PPC970_INPUT_MCP]; qdev_get_gpio_in(DEVICE(cpu), PPC970_INPUT_MCP);
/* Not connected ? */ /* Not connected ? */
openpic_irqs[i].irq[OPENPIC_OUTPUT_DEBUG] = NULL; openpic_irqs[i].irq[OPENPIC_OUTPUT_DEBUG] = NULL;
/* Check this */ /* Check this */
openpic_irqs[i].irq[OPENPIC_OUTPUT_RESET] = openpic_irqs[i].irq[OPENPIC_OUTPUT_RESET] =
((qemu_irq *)env->irq_inputs)[PPC970_INPUT_HRESET]; qdev_get_gpio_in(DEVICE(cpu), PPC970_INPUT_HRESET);
break; break;
#endif /* defined(TARGET_PPC64) */ #endif /* defined(TARGET_PPC64) */
default: default:

View File

@ -234,10 +234,7 @@ static void ppc970_set_irq(void *opaque, int pin, int level)
void ppc970_irq_init(PowerPCCPU *cpu) void ppc970_irq_init(PowerPCCPU *cpu)
{ {
CPUPPCState *env = &cpu->env; qdev_init_gpio_in(DEVICE(cpu), ppc970_set_irq, PPC970_INPUT_NB);
env->irq_inputs = (void **)qemu_allocate_irqs(&ppc970_set_irq, cpu,
PPC970_INPUT_NB);
} }
/* POWER7 internal IRQ controller */ /* POWER7 internal IRQ controller */
@ -260,10 +257,7 @@ static void power7_set_irq(void *opaque, int pin, int level)
void ppcPOWER7_irq_init(PowerPCCPU *cpu) void ppcPOWER7_irq_init(PowerPCCPU *cpu)
{ {
CPUPPCState *env = &cpu->env; qdev_init_gpio_in(DEVICE(cpu), power7_set_irq, POWER7_INPUT_NB);
env->irq_inputs = (void **)qemu_allocate_irqs(&power7_set_irq, cpu,
POWER7_INPUT_NB);
} }
/* POWER9 internal IRQ controller */ /* POWER9 internal IRQ controller */
@ -292,10 +286,7 @@ static void power9_set_irq(void *opaque, int pin, int level)
void ppcPOWER9_irq_init(PowerPCCPU *cpu) void ppcPOWER9_irq_init(PowerPCCPU *cpu)
{ {
CPUPPCState *env = &cpu->env; qdev_init_gpio_in(DEVICE(cpu), power9_set_irq, POWER9_INPUT_NB);
env->irq_inputs = (void **)qemu_allocate_irqs(&power9_set_irq, cpu,
POWER9_INPUT_NB);
} }
#endif /* defined(TARGET_PPC64) */ #endif /* defined(TARGET_PPC64) */