@@ -32,10 +32,36 @@ static const TypeInfo intctrl_info = {
.class_size = sizeof(InterruptStatsProviderClass),
};
+static const TypeInfo cpu_intc_info = {
+ .name = TYPE_CPU_INTC,
+ .parent = TYPE_INTERFACE,
+ .class_size = sizeof(CPUIntcClass),
+};
+
static void intc_register_types(void)
{
+ type_register_static(&cpu_intc_info);
type_register_static(&intctrl_info);
}
type_init(intc_register_types)
+void cpu_intc_disconnect(CPUIntc *intc, Error **errp)
+{
+ CPUIntcClass *cic;
+
+ cic = CPU_INTC_GET_CLASS(intc);
+ if (cic->disconnect) {
+ cic->disconnect(intc, errp);
+ }
+}
+
+void cpu_intc_connect(CPUIntc *intc, Error **errp)
+{
+ CPUIntcClass *cic;
+
+ cic = CPU_INTC_GET_CLASS(intc);
+ if (cic->connect) {
+ cic->connect(intc, errp);
+ }
+}
@@ -30,4 +30,25 @@ typedef struct InterruptStatsProviderClass {
void (*print_info)(InterruptStatsProvider *obj, Monitor *mon);
} InterruptStatsProviderClass;
+#define TYPE_CPU_INTC "cpu-intc"
+#define CPU_INTC(obj) \
+ OBJECT_CHECK(CPUIntc, (obj), TYPE_CPU_INTC)
+#define CPU_INTC_CLASS(klass) \
+ OBJECT_CLASS_CHECK(CPUIntcClass, (klass), TYPE_CPU_INTC)
+#define CPU_INTC_GET_CLASS(obj) \
+ OBJECT_GET_CLASS(CPUIntcClass, (obj), TYPE_CPU_INTC)
+
+typedef struct CPUIntc {
+ Object parent;
+} CPUIntc;
+
+typedef struct CPUIntcClass {
+ InterfaceClass parent;
+ void (*connect)(CPUIntc *icp, Error **errp);
+ void (*disconnect)(CPUIntc *icp, Error **errp);
+} CPUIntcClass;
+
+void cpu_intc_disconnect(CPUIntc *intc, Error **errp);
+void cpu_intc_connect(CPUIntc *intc, Error **errp);
+
#endif
which we will use in the sPAPR machine to reset the interrupt controller of each CPU at the KVM level. Signed-off-by: Cédric Le Goater <clg@kaod.org> --- hw/intc/intc.c | 26 ++++++++++++++++++++++++++ include/hw/intc/intc.h | 21 +++++++++++++++++++++ 2 files changed, 47 insertions(+)