qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [RFC PATCH 20/26] ppc/xive: introduce a helper to create XI


From: Cédric Le Goater
Subject: [Qemu-devel] [RFC PATCH 20/26] ppc/xive: introduce a helper to create XIVE interrupt source objects
Date: Wed, 5 Jul 2017 19:13:33 +0200

Signed-off-by: Cédric Le Goater <address@hidden>
---
 hw/intc/xive.c        | 21 +++++++++++++++++++++
 include/hw/ppc/xive.h |  4 ++++
 2 files changed, 25 insertions(+)

diff --git a/hw/intc/xive.c b/hw/intc/xive.c
index 895dd2b2f61b..bec123649ebd 100644
--- a/hw/intc/xive.c
+++ b/hw/intc/xive.c
@@ -726,6 +726,27 @@ static const TypeInfo xive_ics_info = {
     .class_init = xive_ics_class_init,
 };
 
+void xive_ics_create(XiveICSState *xs, XIVE *x, uint32_t offset,
+                     uint32_t nr_irqs, uint32_t shift,
+                     uint32_t flags, Error **errp)
+{
+    Error *error = NULL;
+
+    object_property_add_const_link(OBJECT(xs), "xive", OBJECT(x),
+                                   &error_fatal);
+    object_property_add_const_link(OBJECT(xs), "xics",
+                                   OBJECT(qdev_get_machine()), &error_fatal);
+    object_property_set_int(OBJECT(xs), shift, "shift", &error_fatal);
+    object_property_set_int(OBJECT(xs), flags, "flags", &error_fatal);
+    object_property_set_int(OBJECT(xs), offset, "irq-base", &error_fatal);
+    object_property_set_int(OBJECT(xs), nr_irqs, "nr-irqs", &error_fatal);
+    object_property_set_bool(OBJECT(xs), true, "realized", &error);
+    if (error) {
+        error_propagate(errp, error);
+        return;
+    }
+}
+
 /*
  * Main XIVE object
  */
diff --git a/include/hw/ppc/xive.h b/include/hw/ppc/xive.h
index 560f6ab66f73..a1c7797658ba 100644
--- a/include/hw/ppc/xive.h
+++ b/include/hw/ppc/xive.h
@@ -70,4 +70,8 @@ void xive_spapr_populate(XIVE *x, void *fdt);
 
 void xive_mmio_map(XIVE *x);
 
+void xive_ics_create(XiveICSState *xs, XIVE *x, uint32_t offset,
+                     uint32_t nr_irqs, uint32_t shift, uint32_t flags,
+                     Error **errp);
+
 #endif /* PPC_XIVE_H */
-- 
2.7.5




reply via email to

[Prev in Thread] Current Thread [Next in Thread]