All of lore.kernel.org
 help / color / mirror / Atom feed
From: Daniel Henrique Barboza <danielhb413@gmail.com>
To: qemu-devel@nongnu.org
Cc: qemu-ppc@nongnu.org, danielhb413@gmail.com,
	peter.maydell@linaro.org, richard.henderson@linaro.org,
	"Cédric Le Goater" <clg@kaod.org>,
	"Mark Cave-Ayland" <mark.cave-ayland@ilande.co.uk>
Subject: [PULL 01/30] ppc64: Allocate IRQ lines with qdev_init_gpio_in()
Date: Mon, 18 Jul 2022 14:21:39 -0300	[thread overview]
Message-ID: <20220718172208.1247624-2-danielhb413@gmail.com> (raw)
In-Reply-To: <20220718172208.1247624-1-danielhb413@gmail.com>

From: Cédric Le Goater <clg@kaod.org>

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>
---
 hw/intc/xics.c        | 10 ++++++----
 hw/intc/xive.c        |  4 ++--
 hw/ppc/mac_newworld.c |  8 ++++----
 hw/ppc/ppc.c          | 15 +++------------
 4 files changed, 15 insertions(+), 22 deletions(-)

diff --git a/hw/intc/xics.c b/hw/intc/xics.c
index 24e67020db..5b0b4d9624 100644
--- a/hw/intc/xics.c
+++ b/hw/intc/xics.c
@@ -301,23 +301,25 @@ void icp_reset(ICPState *icp)
 static void icp_realize(DeviceState *dev, Error **errp)
 {
     ICPState *icp = ICP(dev);
+    PowerPCCPU *cpu;
     CPUPPCState *env;
     Error *err = NULL;
 
     assert(icp->xics);
     assert(icp->cs);
 
-    env = &POWERPC_CPU(icp->cs)->env;
+    cpu = POWERPC_CPU(icp->cs);
+    env = &cpu->env;
     switch (PPC_INPUT(env)) {
     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;
     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;
 
     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;
 
     default:
diff --git a/hw/intc/xive.c b/hw/intc/xive.c
index ae221fed73..a986b96843 100644
--- a/hw/intc/xive.c
+++ b/hw/intc/xive.c
@@ -695,8 +695,8 @@ static void xive_tctx_realize(DeviceState *dev, Error **errp)
     env = &cpu->env;
     switch (PPC_INPUT(env)) {
     case PPC_FLAGS_INPUT_POWER9:
-        tctx->hv_output = env->irq_inputs[POWER9_INPUT_HINT];
-        tctx->os_output = env->irq_inputs[POWER9_INPUT_INT];
+        tctx->hv_output = qdev_get_gpio_in(DEVICE(cpu), POWER9_INPUT_HINT);
+        tctx->os_output = qdev_get_gpio_in(DEVICE(cpu), POWER9_INPUT_INT);
         break;
 
     default:
diff --git a/hw/ppc/mac_newworld.c b/hw/ppc/mac_newworld.c
index c865921bdc..22405dd27a 100644
--- a/hw/ppc/mac_newworld.c
+++ b/hw/ppc/mac_newworld.c
@@ -276,16 +276,16 @@ static void ppc_core99_init(MachineState *machine)
 #if defined(TARGET_PPC64)
         case PPC_FLAGS_INPUT_970:
             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] =
-                ((qemu_irq *)env->irq_inputs)[PPC970_INPUT_INT];
+                qdev_get_gpio_in(DEVICE(cpu), PPC970_INPUT_INT);
             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 ? */
             openpic_irqs[i].irq[OPENPIC_OUTPUT_DEBUG] = NULL;
             /* Check this */
             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;
 #endif /* defined(TARGET_PPC64) */
         default:
diff --git a/hw/ppc/ppc.c b/hw/ppc/ppc.c
index fea70df45e..15f2b5f0f0 100644
--- a/hw/ppc/ppc.c
+++ b/hw/ppc/ppc.c
@@ -234,10 +234,7 @@ static void ppc970_set_irq(void *opaque, int pin, int level)
 
 void ppc970_irq_init(PowerPCCPU *cpu)
 {
-    CPUPPCState *env = &cpu->env;
-
-    env->irq_inputs = (void **)qemu_allocate_irqs(&ppc970_set_irq, cpu,
-                                                  PPC970_INPUT_NB);
+    qdev_init_gpio_in(DEVICE(cpu), ppc970_set_irq, PPC970_INPUT_NB);
 }
 
 /* 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)
 {
-    CPUPPCState *env = &cpu->env;
-
-    env->irq_inputs = (void **)qemu_allocate_irqs(&power7_set_irq, cpu,
-                                                  POWER7_INPUT_NB);
+    qdev_init_gpio_in(DEVICE(cpu), power7_set_irq, POWER7_INPUT_NB);
 }
 
 /* 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)
 {
-    CPUPPCState *env = &cpu->env;
-
-    env->irq_inputs = (void **)qemu_allocate_irqs(&power9_set_irq, cpu,
-                                                  POWER9_INPUT_NB);
+    qdev_init_gpio_in(DEVICE(cpu), power9_set_irq, POWER9_INPUT_NB);
 }
 #endif /* defined(TARGET_PPC64) */
 
-- 
2.36.1



  reply	other threads:[~2022-07-18 17:28 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-18 17:21 [PULL 00/30] ppc queue Daniel Henrique Barboza
2022-07-18 17:21 ` Daniel Henrique Barboza [this message]
2022-07-18 17:21 ` [PULL 02/30] ppc/40x: Allocate IRQ lines with qdev_init_gpio_in() Daniel Henrique Barboza
2022-07-18 17:21 ` [PULL 03/30] ppc/6xx: " Daniel Henrique Barboza
2022-07-18 17:21 ` [PULL 04/30] ppc/e500: " Daniel Henrique Barboza
2022-07-18 17:21 ` [PULL 05/30] ppc: Remove unused irq_inputs Daniel Henrique Barboza
2022-07-18 17:21 ` [PULL 06/30] hw/ppc: pass random seed to fdt Daniel Henrique Barboza
2022-07-18 17:21 ` [PULL 07/30] target/ppc/kvm: Skip current and parent directories in kvmppc_find_cpu_dt Daniel Henrique Barboza
2022-07-18 17:21 ` [PULL 08/30] target/ppc: Fix gen_priv_exception error value in mfspr/mtspr Daniel Henrique Barboza
2022-07-18 17:21 ` [PULL 09/30] target/ppc: fix exception error value in slbfee Daniel Henrique Barboza
2022-07-18 17:21 ` [PULL 10/30] target/ppc: remove mfdcrux and mtdcrux Daniel Henrique Barboza
2022-07-18 17:21 ` [PULL 11/30] target/ppc: fix exception error code in helper_{load, store}_dcr Daniel Henrique Barboza
2022-07-18 17:21 ` [PULL 12/30] target/ppc: fix PMU Group A register read/write exceptions Daniel Henrique Barboza
2022-07-18 17:21 ` [PULL 13/30] target/ppc: fix exception error code in spr_write_excp_vector Daniel Henrique Barboza
2022-07-18 17:21 ` [PULL 14/30] target/ppc: Move tlbie[l] to decode tree Daniel Henrique Barboza
2022-07-18 17:21 ` [PULL 15/30] target/ppc: Implement ISA 3.00 tlbie[l] Daniel Henrique Barboza
2022-07-18 17:21 ` [PULL 16/30] target/ppc: receive DisasContext explicitly in GEN_PRIV Daniel Henrique Barboza
2022-07-18 17:21 ` [PULL 17/30] target/ppc: add macros to check privilege level Daniel Henrique Barboza
2022-07-18 17:21 ` [PULL 18/30] target/ppc: Move slbie to decodetree Daniel Henrique Barboza
2022-07-18 17:21 ` [PULL 19/30] target/ppc: Move slbieg " Daniel Henrique Barboza
2022-07-18 17:21 ` [PULL 20/30] target/ppc: Move slbia " Daniel Henrique Barboza
2022-07-18 17:21 ` [PULL 21/30] target/ppc: Move slbmte " Daniel Henrique Barboza
2022-07-18 17:22 ` [PULL 22/30] target/ppc: Move slbmfev " Daniel Henrique Barboza
2022-07-18 17:22 ` [PULL 23/30] target/ppc: Move slbmfee " Daniel Henrique Barboza
2022-07-18 17:22 ` [PULL 24/30] target/ppc: Move slbfee " Daniel Henrique Barboza
2022-07-18 17:22 ` [PULL 25/30] target/ppc: Move slbsync " Daniel Henrique Barboza
2022-07-18 17:22 ` [PULL 26/30] target/ppc: Implement slbiag Daniel Henrique Barboza
2022-07-18 17:22 ` [PULL 27/30] target/ppc: check tb_env != 0 before printing TBU/TBL/DECR Daniel Henrique Barboza
2022-07-18 17:22 ` [PULL 28/30] ppc: Check partition and process table alignment Daniel Henrique Barboza
2022-07-18 17:22 ` [PULL 29/30] target/ppc: Improve Radix xlate level validation Daniel Henrique Barboza
2022-07-18 17:22 ` [PULL 30/30] target/ppc: Check page dir/table base alignment Daniel Henrique Barboza
2022-07-19  8:56 ` [PULL 00/30] ppc queue Peter Maydell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220718172208.1247624-2-danielhb413@gmail.com \
    --to=danielhb413@gmail.com \
    --cc=clg@kaod.org \
    --cc=mark.cave-ayland@ilande.co.uk \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@nongnu.org \
    --cc=richard.henderson@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.