ppc/xics: use the QOM interface to resend irqs
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> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
This commit is contained in:
parent
f7759e4331
commit
2cd908d0ad
|
@ -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,11 +308,11 @@ 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 = 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);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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"
|
||||
|
|
Loading…
Reference in a new issue