qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Cédric Le Goater" <clg@kaod.org>
To: David Gibson <david@gibson.dropbear.id.au>
Cc: qemu-ppc@nongnu.org, qemu-devel@nongnu.org,
	"Cédric Le Goater" <clg@kaod.org>
Subject: [Qemu-devel] [PATCH v4 10/26] ppc/xics: use the QOM interface to resend irqs
Date: Mon, 27 Feb 2017 15:29:17 +0100	[thread overview]
Message-ID: <1488205773-30436-11-git-send-email-clg@kaod.org> (raw)
In-Reply-To: <1488205773-30436-1-git-send-email-clg@kaod.org>

Also change the ICPState 'xics' backlink to be a XICSFabric, this
removes the need of using qdev_get_machine() to get the QOM interface
in some of the routines.

Signed-off-by: Cédric Le Goater <clg@kaod.org>
---

 Changes since v3:

 - changed ICPState 'xics' backlink to be a XICSFabric.

 hw/intc/xics.c        | 20 +++++++++++---------
 hw/ppc/spapr.c        |  3 ++-
 include/hw/ppc/xics.h |  3 ++-
 3 files changed, 15 insertions(+), 11 deletions(-)

diff --git a/hw/intc/xics.c b/hw/intc/xics.c
index e3dbe63fc021..23e45a87d47a 100644
--- a/hw/intc/xics.c
+++ b/hw/intc/xics.c
@@ -231,14 +231,14 @@ static void icp_check_ipi(ICPState *ss)
 
 static void icp_resend(ICPState *ss)
 {
-    ICSState *ics;
+    XICSFabric *xi = ss->xics;
+    XICSFabricClass *xic = XICS_FABRIC_GET_CLASS(xi);
 
     if (ss->mfrr < CPPR(ss)) {
         icp_check_ipi(ss);
     }
-    QLIST_FOREACH(ics, &ss->xics->ics, list) {
-        ics_resend(ics);
-    }
+
+    xic->ics_resend(xi);
 }
 
 void icp_set_cppr(ICPState *ss, uint8_t cppr)
@@ -299,6 +299,8 @@ uint32_t icp_ipoll(ICPState *ss, uint32_t *mfrr)
 
 void icp_eoi(ICPState *ss, uint32_t xirr)
 {
+    XICSFabric *xi = ss->xics;
+    XICSFabricClass *xic = XICS_FABRIC_GET_CLASS(xi);
     ICSState *ics;
     uint32_t irq;
 
@@ -306,10 +308,10 @@ void icp_eoi(ICPState *ss, uint32_t xirr)
     ss->xirr = (ss->xirr & ~CPPR_MASK) | (xirr & CPPR_MASK);
     trace_xics_icp_eoi(ss->cs->cpu_index, xirr, ss->xirr);
     irq = xirr & XISR_MASK;
-    QLIST_FOREACH(ics, &ss->xics->ics, list) {
-        if (ics_valid_irq(ics, irq)) {
-            ics_eoi(ics, irq);
-        }
+
+    ics = xic->ics_get(xi, irq);
+    if (ics) {
+        ics_eoi(ics, irq);
     }
     if (!XISR(ss)) {
         icp_resend(ss);
@@ -401,7 +403,7 @@ static void icp_realize(DeviceState *dev, Error **errp)
         return;
     }
 
-    icp->xics = XICS_COMMON(obj);
+    icp->xics = XICS_FABRIC(obj);
 }
 
 
diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
index ad41aba44b49..669a3a621b56 100644
--- a/hw/ppc/spapr.c
+++ b/hw/ppc/spapr.c
@@ -100,6 +100,7 @@ static XICSState *try_create_xics(sPAPRMachineState *spapr,
                                   const char *type_icp, int nr_servers,
                                   int nr_irqs, Error **errp)
 {
+    XICSFabric *xi = XICS_FABRIC(spapr);
     Error *err = NULL, *local_err = NULL;
     XICSState *xics;
     ICSState *ics = NULL;
@@ -131,7 +132,7 @@ static XICSState *try_create_xics(sPAPRMachineState *spapr,
 
         object_initialize(icp, sizeof(*icp), type_icp);
         object_property_add_child(OBJECT(xics), "icp[*]", OBJECT(icp), NULL);
-        object_property_add_const_link(OBJECT(icp), "xics", OBJECT(xics), NULL);
+        object_property_add_const_link(OBJECT(icp), "xics", OBJECT(xi), NULL);
         object_property_set_bool(OBJECT(icp), true, "realized", &err);
         if (err) {
             goto error;
diff --git a/include/hw/ppc/xics.h b/include/hw/ppc/xics.h
index 094756dd75a0..b88071529d5b 100644
--- a/include/hw/ppc/xics.h
+++ b/include/hw/ppc/xics.h
@@ -69,6 +69,7 @@ typedef struct ICPState ICPState;
 typedef struct ICSStateClass ICSStateClass;
 typedef struct ICSState ICSState;
 typedef struct ICSIRQState ICSIRQState;
+typedef struct XICSFabric XICSFabric;
 
 struct XICSStateClass {
     DeviceClass parent_class;
@@ -115,7 +116,7 @@ struct ICPState {
     qemu_irq output;
     bool cap_irq_xics_enabled;
 
-    XICSState *xics;
+    XICSFabric *xics;
 };
 
 #define TYPE_ICS_BASE "ics-base"
-- 
2.7.4

  parent reply	other threads:[~2017-02-27 14:30 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-27 14:29 [Qemu-devel] [PATCH v4 00/26] ppc/xics: simplify ICS and ICP creation Cédric Le Goater
2017-02-27 14:29 ` [Qemu-devel] [PATCH v4 01/26] xics: XICS should not be a SysBusDevice Cédric Le Goater
2017-02-27 14:29 ` [Qemu-devel] [PATCH v4 02/26] ppc/xics: fix ICP and ICS reset Cédric Le Goater
2017-02-28  2:00   ` David Gibson
2017-02-28  6:54     ` Cédric Le Goater
2017-02-27 14:29 ` [Qemu-devel] [PATCH v4 03/26] ppc/xics: remove set_nr_irqs() handler from XICSStateClass Cédric Le Goater
2017-02-27 14:29 ` [Qemu-devel] [PATCH v4 04/26] ppc/xics: remove set_nr_servers() " Cédric Le Goater
2017-02-27 14:29 ` [Qemu-devel] [PATCH v4 05/26] ppc/xics: store the ICS object under the sPAPR machine Cédric Le Goater
2017-02-27 14:29 ` [Qemu-devel] [PATCH v4 06/26] ppc/xics: add an InterruptStatsProvider interface to ICS and ICP objects Cédric Le Goater
2017-02-27 14:29 ` [Qemu-devel] [PATCH v4 07/26] ppc/xics: introduce a XICSFabric QOM interface to handle ICSs Cédric Le Goater
2017-02-27 14:29 ` [Qemu-devel] [PATCH v4 08/26] ppc/xics: use the QOM interface under the sPAPR machine Cédric Le Goater
2017-02-27 14:29 ` [Qemu-devel] [PATCH v4 09/26] ppc/xics: use the QOM interface to get irqs Cédric Le Goater
2017-02-27 14:29 ` Cédric Le Goater [this message]
2017-02-27 14:29 ` [Qemu-devel] [PATCH v4 11/26] ppc/xics: remove xics_find_source() Cédric Le Goater
2017-02-27 14:29 ` [Qemu-devel] [PATCH v4 12/26] ppc/xics: register the reset handler of ICS objects Cédric Le Goater
2017-02-27 14:29 ` [Qemu-devel] [PATCH v4 13/26] ppc/xics: remove the XICS list of ICS Cédric Le Goater
2017-02-27 14:29 ` [Qemu-devel] [PATCH v4 14/26] ppc/xics: extend the QOM interface to handle ICPs Cédric Le Goater
2017-02-27 14:29 ` [Qemu-devel] [PATCH v4 15/26] ppc/xics: move kernel_xics_fd out of KVMXICSState Cédric Le Goater
2017-02-27 14:29 ` [Qemu-devel] [PATCH v4 16/26] ppc/xics: simplify the cpu_setup() handler Cédric Le Goater
2017-02-27 14:29 ` [Qemu-devel] [PATCH v4 17/26] ppc/xics: move the cpu_setup() handler under the ICPState class Cédric Le Goater
2017-02-27 14:29 ` [Qemu-devel] [PATCH v4 18/26] ppc/xics: use the QOM interface to grab an ICP Cédric Le Goater
2017-02-27 14:29 ` [Qemu-devel] [PATCH v4 19/26] ppc/xics: simplify spapr_dt_xics() interface Cédric Le Goater
2017-02-27 14:29 ` [Qemu-devel] [PATCH v4 20/26] ppc/xics: register the reset handler of ICP objects Cédric Le Goater
2017-02-27 14:29 ` [Qemu-devel] [PATCH v4 21/26] ppc/xics: move the ICP array under the sPAPR machine Cédric Le Goater
2017-02-27 14:29 ` [Qemu-devel] [PATCH v4 22/26] ppc/xics: export the XICS init routines Cédric Le Goater
2017-02-27 14:29 ` [Qemu-devel] [PATCH v4 23/26] ppc/xics: remove the XICSState classes Cédric Le Goater
2017-02-27 14:29 ` [Qemu-devel] [PATCH v4 24/26] ppc/xics: move ics-simple post_load under the machine Cédric Le Goater
2017-02-27 14:29 ` [Qemu-devel] [PATCH v4 25/26] ppc/xics: move InterruptStatsProvider to the sPAPR machine Cédric Le Goater
2017-02-27 14:29 ` [Qemu-devel] [PATCH v4 26/26] ppc/xics: rename 'ICPState *' variables to 'icp' Cédric Le Goater
2017-02-28  3:54 ` [Qemu-devel] [PATCH v4 00/26] ppc/xics: simplify ICS and ICP creation David Gibson

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=1488205773-30436-11-git-send-email-clg@kaod.org \
    --to=clg@kaod.org \
    --cc=david@gibson.dropbear.id.au \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@nongnu.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).