[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-ppc] [PULL 33/50] ppc/xics: use the QOM interface to resend irqs
From: |
David Gibson |
Subject: |
[Qemu-ppc] [PULL 33/50] ppc/xics: use the QOM interface to resend irqs |
Date: |
Wed, 1 Mar 2017 15:43:48 +1100 |
From: Cédric Le Goater <address@hidden>
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 <address@hidden>
Signed-off-by: David Gibson <address@hidden>
---
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 e3dbe63..23e45a8 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 c6cef04..a4e4b86 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 094756d..b880715 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.9.3
- [Qemu-ppc] [PULL 14/50] target/ppc: Remove the function ppc_hash64_set_sdr1(), (continued)
- [Qemu-ppc] [PULL 14/50] target/ppc: Remove the function ppc_hash64_set_sdr1(), David Gibson, 2017/02/28
- [Qemu-ppc] [PULL 03/50] PCI: add missing classes in pci_ids.h to build device tree, David Gibson, 2017/02/28
- [Qemu-ppc] [PULL 20/50] target/ppc: use tcg ops for neg instruction, David Gibson, 2017/02/28
- [Qemu-ppc] [PULL 04/50] spapr: generate DT node names, David Gibson, 2017/02/28
- [Qemu-ppc] [PULL 16/50] target/ppc: support for 32-bit carry and overflow, David Gibson, 2017/02/28
- [Qemu-ppc] [PULL 17/50] target/ppc: update ca32 in arithmetic add, David Gibson, 2017/02/28
- [Qemu-ppc] [PULL 15/50] target/ppc: Correct SDR1 masking, David Gibson, 2017/02/28
- [Qemu-ppc] [PULL 07/50] target/ppc: Fix KVM-HV HPTE accessors, David Gibson, 2017/02/28
- [Qemu-ppc] [PULL 34/50] ppc/xics: remove xics_find_source(), David Gibson, 2017/02/28
- [Qemu-ppc] [PULL 24/50] spapr/pci: populate PCI DT in reverse order, David Gibson, 2017/02/28
- [Qemu-ppc] [PULL 33/50] ppc/xics: use the QOM interface to resend irqs,
David Gibson <=
- [Qemu-ppc] [PULL 22/50] target/ppc: add ov32 flag in divide operations, David Gibson, 2017/02/28
- [Qemu-ppc] [PULL 42/50] ppc/xics: simplify spapr_dt_xics() interface, David Gibson, 2017/02/28
- [Qemu-ppc] [PULL 47/50] ppc/xics: move ics-simple post_load under the machine, David Gibson, 2017/02/28
- [Qemu-ppc] [PULL 27/50] ppc/xics: remove set_nr_servers() handler from XICSStateClass, David Gibson, 2017/02/28
- [Qemu-ppc] [PULL 49/50] ppc/xics: rename 'ICPState *' variables to 'icp', David Gibson, 2017/02/28
- [Qemu-ppc] [PULL 21/50] target/ppc: add ov32 flag for multiply low insns, David Gibson, 2017/02/28
- [Qemu-ppc] [PULL 39/50] ppc/xics: simplify the cpu_setup() handler, David Gibson, 2017/02/28
- [Qemu-ppc] [PULL 08/50] pseries: Minor cleanups to HPT management hypercalls, David Gibson, 2017/02/28
- [Qemu-ppc] [PULL 12/50] target/ppc: Eliminate htab_base and htab_mask variables, David Gibson, 2017/02/28
- [Qemu-ppc] [PULL 43/50] ppc/xics: register the reset handler of ICP objects, David Gibson, 2017/02/28