On 02/23/2017 03:18 AM, David Gibson wrote: > On Thu, Feb 16, 2017 at 02:47:28PM +0100, Cédric Le Goater wrote: >> This QOM interface provides two simple handlers. One is to get an ICS >> object from an irq number and a second to resend the irqs when needed. > > Maybe call this XICSFabric rather than XicsInterface. While it's an > interface from the QOM point-of-view, that doesn't really describe > where it sits in the hardware model, and it's the ics and icp objects > which provide all the interfaces which are visible to the guest or to > interrupt generating devices.
Curiously, this is the only email that was not trashed by my bogus filters and so this is the only change I did in v3 ... C. > Apart from that, > > Reviewed-by: David Gibson <da...@gibson.dropbear.id.au> > >> Signed-off-by: Cédric Le Goater <c...@kaod.org> >> --- >> hw/intc/xics.c | 7 +++++++ >> include/hw/ppc/xics.h | 18 ++++++++++++++++++ >> 2 files changed, 25 insertions(+) >> >> diff --git a/hw/intc/xics.c b/hw/intc/xics.c >> index b1294417a0ae..3e80d2d0f0d9 100644 >> --- a/hw/intc/xics.c >> +++ b/hw/intc/xics.c >> @@ -726,6 +726,12 @@ static const TypeInfo ics_base_info = { >> .class_size = sizeof(ICSStateClass), >> }; >> >> +static const TypeInfo xics_interface_info = { >> + .name = TYPE_XICS_INTERFACE, >> + .parent = TYPE_INTERFACE, >> + .class_size = sizeof(XICSInterfaceClass), >> +}; >> + >> /* >> * Exported functions >> */ >> @@ -766,6 +772,7 @@ static void xics_register_types(void) >> type_register_static(&ics_simple_info); >> type_register_static(&ics_base_info); >> type_register_static(&icp_info); >> + type_register_static(&xics_interface_info); >> } >> >> type_init(xics_register_types) >> diff --git a/include/hw/ppc/xics.h b/include/hw/ppc/xics.h >> index 6d443ce09dba..fe2bb5c8ef54 100644 >> --- a/include/hw/ppc/xics.h >> +++ b/include/hw/ppc/xics.h >> @@ -177,6 +177,24 @@ struct ICSIRQState { >> uint8_t flags; >> }; >> >> +typedef struct XICSInterface { >> + Object parent; >> +} XICSInterface; >> + >> +#define TYPE_XICS_INTERFACE "xics-interface" >> +#define XICS_INTERFACE(obj) \ >> + OBJECT_CHECK(XICSInterface, (obj), TYPE_XICS_INTERFACE) >> +#define XICS_INTERFACE_CLASS(klass) \ >> + OBJECT_CLASS_CHECK(XICSInterfaceClass, (klass), TYPE_XICS_INTERFACE) >> +#define XICS_INTERFACE_GET_CLASS(obj) \ >> + OBJECT_GET_CLASS(XICSInterfaceClass, (obj), TYPE_XICS_INTERFACE) >> + >> +typedef struct XICSInterfaceClass { >> + InterfaceClass parent; >> + ICSState *(*ics_get)(XICSInterface *xi, int irq); >> + void (*ics_resend)(XICSInterface *xi); >> +} XICSInterfaceClass; >> + >> #define XICS_IRQS_SPAPR 1024 >> >> qemu_irq xics_get_qirq(XICSState *icp, int irq); >