* [Qemu-devel] [PATCH v2 0/5] rework the ICS classes inheritance tree
@ 2018-06-25 9:17 Cédric Le Goater
2018-06-25 9:17 ` [Qemu-devel] [PATCH v2 1/5] ppc/xics: introduce a parent_realize in ICSStateClass Cédric Le Goater
` (5 more replies)
0 siblings, 6 replies; 16+ messages in thread
From: Cédric Le Goater @ 2018-06-25 9:17 UTC (permalink / raw)
To: David Gibson; +Cc: qemu-ppc, qemu-devel, Greg Kurz, Cédric Le Goater
Hello,
It makes the class hierarchy much cleaner and removes duplicated
code. As we are touching the location of the objects states, migration
compatibility was checked and the following tests were performed under
KVM :
qemu-3.0 (pseries-3.0) -> qemu-3.0 (pseries-3.0) OK
qemu-3.0 (pseries-2.12) -> qemu-2.12 (pseries-2.12) OK
qemu-3.0 (pseries-2.11) -> qemu-2.11 (pseries-2.11) OK
qemu-3.0 (pseries-2.10) -> qemu-2.10 (pseries-2.10) OK
qemu-3.0 (pseries-2.9) -> qemu-2.9 (pseries-2.9) OK
qemu-3.0 (pseries-2.8) -> qemu-2.8 (pseries-2.8) OK
qemu-3.0 (pseries-2.7) -> qemu-2.7 (pseries-2.7) FAIL
and back :
qemu-3.0 (pseries-3.0) <- qemu-3.0 (pseries-3.0) OK
qemu-3.0 (pseries-2.12) <- qemu-2.12 (pseries-2.12) OK
qemu-3.0 (pseries-2.11) <- qemu-2.11 (pseries-2.11) OK
qemu-3.0 (pseries-2.10) <- qemu-2.10 (pseries-2.10) OK
qemu-3.0 (pseries-2.9) <- qemu-2.9 (pseries-2.9) OK
qemu-3.0 (pseries-2.8) <- qemu-2.8 (pseries-2.8) OK
qemu-3.0 (pseries-2.7) <- qemu-2.7 (pseries-2.7) OK
under TCG, same scenarios were run but up to 2.10 only, in which case
the migration fails for other reasons.
I wouldn't mind some extra cross checking from someone else.
Thanks,
C.
Changes since v2:
- split the patch in smaller units. The migration tests were not
rerun because the code is very much the same. make check was run on
each patch.
Cédric Le Goater (5):
ppc/xics: introduce a parent_realize in ICSStateClass
ppc/xics: move the instance_init handler under the ics-base class
ppx/xics: introduce a parent_reset in ICSStateClass
ppc/xics: move the vmstate structures under the ics-base class
ppc/xics: rework the ICS classes inheritance tree
include/hw/ppc/xics.h | 4 +-
hw/intc/xics.c | 164 ++++++++++++++++++++++++++++----------------------
hw/intc/xics_kvm.c | 46 +++++++-------
hw/ppc/spapr.c | 2 +-
4 files changed, 121 insertions(+), 95 deletions(-)
--
2.13.6
^ permalink raw reply [flat|nested] 16+ messages in thread
* [Qemu-devel] [PATCH v2 1/5] ppc/xics: introduce a parent_realize in ICSStateClass
2018-06-25 9:17 [Qemu-devel] [PATCH v2 0/5] rework the ICS classes inheritance tree Cédric Le Goater
@ 2018-06-25 9:17 ` Cédric Le Goater
2018-06-26 2:18 ` David Gibson
2018-06-25 9:17 ` [Qemu-devel] [PATCH v2 2/5] ppc/xics: move the instance_init handler under the ics-base class Cédric Le Goater
` (4 subsequent siblings)
5 siblings, 1 reply; 16+ messages in thread
From: Cédric Le Goater @ 2018-06-25 9:17 UTC (permalink / raw)
To: David Gibson; +Cc: qemu-ppc, qemu-devel, Greg Kurz, Cédric Le Goater
This makes possible to move the common ICSState code of the realize
handlers in the ics-base class.
Signed-off-by: Cédric Le Goater <clg@kaod.org>
---
include/hw/ppc/xics.h | 3 ++-
hw/intc/xics.c | 37 ++++++++++++++++++++++---------------
hw/intc/xics_kvm.c | 20 +++++++++++++++-----
3 files changed, 39 insertions(+), 21 deletions(-)
diff --git a/include/hw/ppc/xics.h b/include/hw/ppc/xics.h
index 4b04b295a772..44e96e640070 100644
--- a/include/hw/ppc/xics.h
+++ b/include/hw/ppc/xics.h
@@ -115,7 +115,8 @@ struct PnvICPState {
struct ICSStateClass {
DeviceClass parent_class;
- void (*realize)(ICSState *s, Error **errp);
+ DeviceRealize parent_realize;
+
void (*pre_save)(ICSState *s);
int (*post_load)(ICSState *s, int version_id);
void (*reject)(ICSState *s, uint32_t irq);
diff --git a/hw/intc/xics.c b/hw/intc/xics.c
index 063491f38712..d6066d561fdc 100644
--- a/hw/intc/xics.c
+++ b/hw/intc/xics.c
@@ -618,30 +618,31 @@ static void ics_simple_initfn(Object *obj)
ics->offset = XICS_IRQ_BASE;
}
-static void ics_simple_realize(ICSState *ics, Error **errp)
+static void ics_simple_realize(DeviceState *dev, Error **errp)
{
- if (!ics->nr_irqs) {
- error_setg(errp, "Number of interrupts needs to be greater 0");
+ ICSState *ics = ICS_SIMPLE(dev);
+ ICSStateClass *icsc = ICS_BASE_GET_CLASS(ics);
+ Error *local_err = NULL;
+
+ icsc->parent_realize(dev, &local_err);
+ if (local_err) {
+ error_propagate(errp, local_err);
return;
}
- ics->irqs = g_malloc0(ics->nr_irqs * sizeof(ICSIRQState));
+
ics->qirqs = qemu_allocate_irqs(ics_simple_set_irq, ics, ics->nr_irqs);
qemu_register_reset(ics_simple_reset, ics);
}
-static Property ics_simple_properties[] = {
- DEFINE_PROP_UINT32("nr-irqs", ICSState, nr_irqs, 0),
- DEFINE_PROP_END_OF_LIST(),
-};
-
static void ics_simple_class_init(ObjectClass *klass, void *data)
{
DeviceClass *dc = DEVICE_CLASS(klass);
ICSStateClass *isc = ICS_BASE_CLASS(klass);
- isc->realize = ics_simple_realize;
- dc->props = ics_simple_properties;
+ device_class_set_parent_realize(dc, ics_simple_realize,
+ &isc->parent_realize);
+
dc->vmsd = &vmstate_ics_simple;
isc->reject = ics_simple_reject;
isc->resend = ics_simple_resend;
@@ -659,7 +660,6 @@ static const TypeInfo ics_simple_info = {
static void ics_base_realize(DeviceState *dev, Error **errp)
{
- ICSStateClass *icsc = ICS_BASE_GET_CLASS(dev);
ICSState *ics = ICS_BASE(dev);
Object *obj;
Error *err = NULL;
@@ -672,17 +672,24 @@ static void ics_base_realize(DeviceState *dev, Error **errp)
}
ics->xics = XICS_FABRIC(obj);
-
- if (icsc->realize) {
- icsc->realize(ics, errp);
+ if (!ics->nr_irqs) {
+ error_setg(errp, "Number of interrupts needs to be greater 0");
+ return;
}
+ ics->irqs = g_malloc0(ics->nr_irqs * sizeof(ICSIRQState));
}
+static Property ics_base_properties[] = {
+ DEFINE_PROP_UINT32("nr-irqs", ICSState, nr_irqs, 0),
+ DEFINE_PROP_END_OF_LIST(),
+};
+
static void ics_base_class_init(ObjectClass *klass, void *data)
{
DeviceClass *dc = DEVICE_CLASS(klass);
dc->realize = ics_base_realize;
+ dc->props = ics_base_properties;
}
static const TypeInfo ics_base_info = {
diff --git a/hw/intc/xics_kvm.c b/hw/intc/xics_kvm.c
index f511e50a8020..1f27eb497981 100644
--- a/hw/intc/xics_kvm.c
+++ b/hw/intc/xics_kvm.c
@@ -345,13 +345,17 @@ static void ics_kvm_reset(void *dev)
ics_set_kvm_state(ics, 1);
}
-static void ics_kvm_realize(ICSState *ics, Error **errp)
+static void ics_kvm_realize(DeviceState *dev, Error **errp)
{
- if (!ics->nr_irqs) {
- error_setg(errp, "Number of interrupts needs to be greater 0");
+ ICSState *ics = ICS_KVM(dev);
+ ICSStateClass *icsc = ICS_BASE_GET_CLASS(ics);
+ Error *local_err = NULL;
+
+ icsc->parent_realize(dev, &local_err);
+ if (local_err) {
+ error_propagate(errp, local_err);
return;
}
- ics->irqs = g_malloc0(ics->nr_irqs * sizeof(ICSIRQState));
ics->qirqs = qemu_allocate_irqs(ics_kvm_set_irq, ics, ics->nr_irqs);
qemu_register_reset(ics_kvm_reset, ics);
@@ -360,8 +364,14 @@ static void ics_kvm_realize(ICSState *ics, Error **errp)
static void ics_kvm_class_init(ObjectClass *klass, void *data)
{
ICSStateClass *icsc = ICS_BASE_CLASS(klass);
+ DeviceClass *dc = DEVICE_CLASS(klass);
+
+ /*
+ * Use device_class_set_parent_realize() when ics-kvm inherits
+ * directly from ics-base and not from ics-simple anymore.
+ */
+ dc->realize = ics_kvm_realize;
- icsc->realize = ics_kvm_realize;
icsc->pre_save = ics_get_kvm_state;
icsc->post_load = ics_set_kvm_state;
icsc->synchronize_state = ics_synchronize_state;
--
2.13.6
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [Qemu-devel] [PATCH v2 2/5] ppc/xics: move the instance_init handler under the ics-base class
2018-06-25 9:17 [Qemu-devel] [PATCH v2 0/5] rework the ICS classes inheritance tree Cédric Le Goater
2018-06-25 9:17 ` [Qemu-devel] [PATCH v2 1/5] ppc/xics: introduce a parent_realize in ICSStateClass Cédric Le Goater
@ 2018-06-25 9:17 ` Cédric Le Goater
2018-06-26 2:21 ` David Gibson
2018-06-25 9:17 ` [Qemu-devel] [PATCH v2 3/5] ppx/xics: introduce a parent_reset in ICSStateClass Cédric Le Goater
` (3 subsequent siblings)
5 siblings, 1 reply; 16+ messages in thread
From: Cédric Le Goater @ 2018-06-25 9:17 UTC (permalink / raw)
To: David Gibson; +Cc: qemu-ppc, qemu-devel, Greg Kurz, Cédric Le Goater
Signed-off-by: Cédric Le Goater <clg@kaod.org>
---
hw/intc/xics.c | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/hw/intc/xics.c b/hw/intc/xics.c
index d6066d561fdc..83340770f7c0 100644
--- a/hw/intc/xics.c
+++ b/hw/intc/xics.c
@@ -611,13 +611,6 @@ static const VMStateDescription vmstate_ics_simple = {
},
};
-static void ics_simple_initfn(Object *obj)
-{
- ICSState *ics = ICS_SIMPLE(obj);
-
- ics->offset = XICS_IRQ_BASE;
-}
-
static void ics_simple_realize(DeviceState *dev, Error **errp)
{
ICSState *ics = ICS_SIMPLE(dev);
@@ -655,7 +648,6 @@ static const TypeInfo ics_simple_info = {
.instance_size = sizeof(ICSState),
.class_init = ics_simple_class_init,
.class_size = sizeof(ICSStateClass),
- .instance_init = ics_simple_initfn,
};
static void ics_base_realize(DeviceState *dev, Error **errp)
@@ -679,6 +671,13 @@ static void ics_base_realize(DeviceState *dev, Error **errp)
ics->irqs = g_malloc0(ics->nr_irqs * sizeof(ICSIRQState));
}
+static void ics_base_instance_init(Object *obj)
+{
+ ICSState *ics = ICS_BASE(obj);
+
+ ics->offset = XICS_IRQ_BASE;
+}
+
static Property ics_base_properties[] = {
DEFINE_PROP_UINT32("nr-irqs", ICSState, nr_irqs, 0),
DEFINE_PROP_END_OF_LIST(),
@@ -697,6 +696,7 @@ static const TypeInfo ics_base_info = {
.parent = TYPE_DEVICE,
.abstract = true,
.instance_size = sizeof(ICSState),
+ .instance_init = ics_base_instance_init,
.class_init = ics_base_class_init,
.class_size = sizeof(ICSStateClass),
};
--
2.13.6
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [Qemu-devel] [PATCH v2 3/5] ppx/xics: introduce a parent_reset in ICSStateClass
2018-06-25 9:17 [Qemu-devel] [PATCH v2 0/5] rework the ICS classes inheritance tree Cédric Le Goater
2018-06-25 9:17 ` [Qemu-devel] [PATCH v2 1/5] ppc/xics: introduce a parent_realize in ICSStateClass Cédric Le Goater
2018-06-25 9:17 ` [Qemu-devel] [PATCH v2 2/5] ppc/xics: move the instance_init handler under the ics-base class Cédric Le Goater
@ 2018-06-25 9:17 ` Cédric Le Goater
2018-06-26 2:25 ` David Gibson
2018-06-25 9:17 ` [Qemu-devel] [PATCH v2 4/5] ppc/xics: move the vmstate structures under the ics-base class Cédric Le Goater
` (2 subsequent siblings)
5 siblings, 1 reply; 16+ messages in thread
From: Cédric Le Goater @ 2018-06-25 9:17 UTC (permalink / raw)
To: David Gibson; +Cc: qemu-ppc, qemu-devel, Greg Kurz, Cédric Le Goater
Just like for the realize handlers, this makes possible to move the
common ICSState code of the reset handlers in the ics-base class.
Signed-off-by: Cédric Le Goater <clg@kaod.org>
---
include/hw/ppc/xics.h | 1 +
hw/intc/xics.c | 45 ++++++++++++++++++++++++++++++---------------
hw/intc/xics_kvm.c | 26 ++++++++++----------------
3 files changed, 41 insertions(+), 31 deletions(-)
diff --git a/include/hw/ppc/xics.h b/include/hw/ppc/xics.h
index 44e96e640070..6ac8a9392da6 100644
--- a/include/hw/ppc/xics.h
+++ b/include/hw/ppc/xics.h
@@ -116,6 +116,7 @@ struct ICSStateClass {
DeviceClass parent_class;
DeviceRealize parent_realize;
+ DeviceReset parent_reset;
void (*pre_save)(ICSState *s);
int (*post_load)(ICSState *s, int version_id);
diff --git a/hw/intc/xics.c b/hw/intc/xics.c
index 83340770f7c0..8cfe2231531e 100644
--- a/hw/intc/xics.c
+++ b/hw/intc/xics.c
@@ -537,23 +537,16 @@ static void ics_simple_eoi(ICSState *ics, uint32_t nr)
}
}
-static void ics_simple_reset(void *dev)
+static void ics_simple_reset(DeviceState *dev)
{
- ICSState *ics = ICS_SIMPLE(dev);
- int i;
- uint8_t flags[ics->nr_irqs];
+ ICSStateClass *icsc = ICS_BASE_GET_CLASS(dev);
- for (i = 0; i < ics->nr_irqs; i++) {
- flags[i] = ics->irqs[i].flags;
- }
-
- memset(ics->irqs, 0, sizeof(ICSIRQState) * ics->nr_irqs);
+ icsc->parent_reset(dev);
+}
- for (i = 0; i < ics->nr_irqs; i++) {
- ics->irqs[i].priority = 0xff;
- ics->irqs[i].saved_priority = 0xff;
- ics->irqs[i].flags = flags[i];
- }
+static void ics_simple_reset_handler(void *dev)
+{
+ ics_simple_reset(dev);
}
static int ics_simple_dispatch_pre_save(void *opaque)
@@ -625,7 +618,7 @@ static void ics_simple_realize(DeviceState *dev, Error **errp)
ics->qirqs = qemu_allocate_irqs(ics_simple_set_irq, ics, ics->nr_irqs);
- qemu_register_reset(ics_simple_reset, ics);
+ qemu_register_reset(ics_simple_reset_handler, ics);
}
static void ics_simple_class_init(ObjectClass *klass, void *data)
@@ -635,6 +628,8 @@ static void ics_simple_class_init(ObjectClass *klass, void *data)
device_class_set_parent_realize(dc, ics_simple_realize,
&isc->parent_realize);
+ device_class_set_parent_reset(dc, ics_simple_reset,
+ &isc->parent_reset);
dc->vmsd = &vmstate_ics_simple;
isc->reject = ics_simple_reject;
@@ -650,6 +645,25 @@ static const TypeInfo ics_simple_info = {
.class_size = sizeof(ICSStateClass),
};
+static void ics_base_reset(DeviceState *dev)
+{
+ ICSState *ics = ICS_BASE(dev);
+ int i;
+ uint8_t flags[ics->nr_irqs];
+
+ for (i = 0; i < ics->nr_irqs; i++) {
+ flags[i] = ics->irqs[i].flags;
+ }
+
+ memset(ics->irqs, 0, sizeof(ICSIRQState) * ics->nr_irqs);
+
+ for (i = 0; i < ics->nr_irqs; i++) {
+ ics->irqs[i].priority = 0xff;
+ ics->irqs[i].saved_priority = 0xff;
+ ics->irqs[i].flags = flags[i];
+ }
+}
+
static void ics_base_realize(DeviceState *dev, Error **errp)
{
ICSState *ics = ICS_BASE(dev);
@@ -689,6 +703,7 @@ static void ics_base_class_init(ObjectClass *klass, void *data)
dc->realize = ics_base_realize;
dc->props = ics_base_properties;
+ dc->reset = ics_base_reset;
}
static const TypeInfo ics_base_info = {
diff --git a/hw/intc/xics_kvm.c b/hw/intc/xics_kvm.c
index 1f27eb497981..b314eb7d1607 100644
--- a/hw/intc/xics_kvm.c
+++ b/hw/intc/xics_kvm.c
@@ -324,25 +324,18 @@ static void ics_kvm_set_irq(void *opaque, int srcno, int val)
}
}
-static void ics_kvm_reset(void *dev)
+static void ics_kvm_reset(DeviceState *dev)
{
- ICSState *ics = ICS_SIMPLE(dev);
- int i;
- uint8_t flags[ics->nr_irqs];
-
- for (i = 0; i < ics->nr_irqs; i++) {
- flags[i] = ics->irqs[i].flags;
- }
+ ICSStateClass *icsc = ICS_BASE_GET_CLASS(dev);
- memset(ics->irqs, 0, sizeof(ICSIRQState) * ics->nr_irqs);
+ icsc->parent_reset(dev);
- for (i = 0; i < ics->nr_irqs; i++) {
- ics->irqs[i].priority = 0xff;
- ics->irqs[i].saved_priority = 0xff;
- ics->irqs[i].flags = flags[i];
- }
+ ics_set_kvm_state(ICS_KVM(dev), 1);
+}
- ics_set_kvm_state(ics, 1);
+static void ics_kvm_reset_handler(void *dev)
+{
+ ics_kvm_reset(dev);
}
static void ics_kvm_realize(DeviceState *dev, Error **errp)
@@ -358,7 +351,7 @@ static void ics_kvm_realize(DeviceState *dev, Error **errp)
}
ics->qirqs = qemu_allocate_irqs(ics_kvm_set_irq, ics, ics->nr_irqs);
- qemu_register_reset(ics_kvm_reset, ics);
+ qemu_register_reset(ics_kvm_reset_handler, ics);
}
static void ics_kvm_class_init(ObjectClass *klass, void *data)
@@ -371,6 +364,7 @@ static void ics_kvm_class_init(ObjectClass *klass, void *data)
* directly from ics-base and not from ics-simple anymore.
*/
dc->realize = ics_kvm_realize;
+ dc->reset = ics_kvm_reset;
icsc->pre_save = ics_get_kvm_state;
icsc->post_load = ics_set_kvm_state;
--
2.13.6
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [Qemu-devel] [PATCH v2 4/5] ppc/xics: move the vmstate structures under the ics-base class
2018-06-25 9:17 [Qemu-devel] [PATCH v2 0/5] rework the ICS classes inheritance tree Cédric Le Goater
` (2 preceding siblings ...)
2018-06-25 9:17 ` [Qemu-devel] [PATCH v2 3/5] ppx/xics: introduce a parent_reset in ICSStateClass Cédric Le Goater
@ 2018-06-25 9:17 ` Cédric Le Goater
2018-06-26 2:30 ` David Gibson
2018-06-25 9:17 ` [Qemu-devel] [PATCH v2 5/5] ppc/xics: rework the ICS classes inheritance tree Cédric Le Goater
2018-06-26 13:27 ` [Qemu-devel] [Qemu-ppc] [PATCH v2 0/5] " Greg Kurz
5 siblings, 1 reply; 16+ messages in thread
From: Cédric Le Goater @ 2018-06-25 9:17 UTC (permalink / raw)
To: David Gibson; +Cc: qemu-ppc, qemu-devel, Greg Kurz, Cédric Le Goater
Signed-off-by: Cédric Le Goater <clg@kaod.org>
---
hw/intc/xics.c | 112 ++++++++++++++++++++++++++++-----------------------------
1 file changed, 56 insertions(+), 56 deletions(-)
diff --git a/hw/intc/xics.c b/hw/intc/xics.c
index 8cfe2231531e..b9f1a3c97214 100644
--- a/hw/intc/xics.c
+++ b/hw/intc/xics.c
@@ -549,61 +549,6 @@ static void ics_simple_reset_handler(void *dev)
ics_simple_reset(dev);
}
-static int ics_simple_dispatch_pre_save(void *opaque)
-{
- ICSState *ics = opaque;
- ICSStateClass *info = ICS_BASE_GET_CLASS(ics);
-
- if (info->pre_save) {
- info->pre_save(ics);
- }
-
- return 0;
-}
-
-static int ics_simple_dispatch_post_load(void *opaque, int version_id)
-{
- ICSState *ics = opaque;
- ICSStateClass *info = ICS_BASE_GET_CLASS(ics);
-
- if (info->post_load) {
- return info->post_load(ics, version_id);
- }
-
- return 0;
-}
-
-static const VMStateDescription vmstate_ics_simple_irq = {
- .name = "ics/irq",
- .version_id = 2,
- .minimum_version_id = 1,
- .fields = (VMStateField[]) {
- VMSTATE_UINT32(server, ICSIRQState),
- VMSTATE_UINT8(priority, ICSIRQState),
- VMSTATE_UINT8(saved_priority, ICSIRQState),
- VMSTATE_UINT8(status, ICSIRQState),
- VMSTATE_UINT8(flags, ICSIRQState),
- VMSTATE_END_OF_LIST()
- },
-};
-
-static const VMStateDescription vmstate_ics_simple = {
- .name = "ics",
- .version_id = 1,
- .minimum_version_id = 1,
- .pre_save = ics_simple_dispatch_pre_save,
- .post_load = ics_simple_dispatch_post_load,
- .fields = (VMStateField[]) {
- /* Sanity check */
- VMSTATE_UINT32_EQUAL(nr_irqs, ICSState, NULL),
-
- VMSTATE_STRUCT_VARRAY_POINTER_UINT32(irqs, ICSState, nr_irqs,
- vmstate_ics_simple_irq,
- ICSIRQState),
- VMSTATE_END_OF_LIST()
- },
-};
-
static void ics_simple_realize(DeviceState *dev, Error **errp)
{
ICSState *ics = ICS_SIMPLE(dev);
@@ -631,7 +576,6 @@ static void ics_simple_class_init(ObjectClass *klass, void *data)
device_class_set_parent_reset(dc, ics_simple_reset,
&isc->parent_reset);
- dc->vmsd = &vmstate_ics_simple;
isc->reject = ics_simple_reject;
isc->resend = ics_simple_resend;
isc->eoi = ics_simple_eoi;
@@ -692,6 +636,61 @@ static void ics_base_instance_init(Object *obj)
ics->offset = XICS_IRQ_BASE;
}
+static int ics_base_dispatch_pre_save(void *opaque)
+{
+ ICSState *ics = opaque;
+ ICSStateClass *info = ICS_BASE_GET_CLASS(ics);
+
+ if (info->pre_save) {
+ info->pre_save(ics);
+ }
+
+ return 0;
+}
+
+static int ics_base_dispatch_post_load(void *opaque, int version_id)
+{
+ ICSState *ics = opaque;
+ ICSStateClass *info = ICS_BASE_GET_CLASS(ics);
+
+ if (info->post_load) {
+ return info->post_load(ics, version_id);
+ }
+
+ return 0;
+}
+
+static const VMStateDescription vmstate_ics_base_irq = {
+ .name = "ics/irq",
+ .version_id = 2,
+ .minimum_version_id = 1,
+ .fields = (VMStateField[]) {
+ VMSTATE_UINT32(server, ICSIRQState),
+ VMSTATE_UINT8(priority, ICSIRQState),
+ VMSTATE_UINT8(saved_priority, ICSIRQState),
+ VMSTATE_UINT8(status, ICSIRQState),
+ VMSTATE_UINT8(flags, ICSIRQState),
+ VMSTATE_END_OF_LIST()
+ },
+};
+
+static const VMStateDescription vmstate_ics_base = {
+ .name = "ics",
+ .version_id = 1,
+ .minimum_version_id = 1,
+ .pre_save = ics_base_dispatch_pre_save,
+ .post_load = ics_base_dispatch_post_load,
+ .fields = (VMStateField[]) {
+ /* Sanity check */
+ VMSTATE_UINT32_EQUAL(nr_irqs, ICSState, NULL),
+
+ VMSTATE_STRUCT_VARRAY_POINTER_UINT32(irqs, ICSState, nr_irqs,
+ vmstate_ics_base_irq,
+ ICSIRQState),
+ VMSTATE_END_OF_LIST()
+ },
+};
+
static Property ics_base_properties[] = {
DEFINE_PROP_UINT32("nr-irqs", ICSState, nr_irqs, 0),
DEFINE_PROP_END_OF_LIST(),
@@ -704,6 +703,7 @@ static void ics_base_class_init(ObjectClass *klass, void *data)
dc->realize = ics_base_realize;
dc->props = ics_base_properties;
dc->reset = ics_base_reset;
+ dc->vmsd = &vmstate_ics_base;
}
static const TypeInfo ics_base_info = {
--
2.13.6
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [Qemu-devel] [PATCH v2 5/5] ppc/xics: rework the ICS classes inheritance tree
2018-06-25 9:17 [Qemu-devel] [PATCH v2 0/5] rework the ICS classes inheritance tree Cédric Le Goater
` (3 preceding siblings ...)
2018-06-25 9:17 ` [Qemu-devel] [PATCH v2 4/5] ppc/xics: move the vmstate structures under the ics-base class Cédric Le Goater
@ 2018-06-25 9:17 ` Cédric Le Goater
2018-06-26 3:21 ` David Gibson
2018-06-26 13:27 ` [Qemu-devel] [Qemu-ppc] [PATCH v2 0/5] " Greg Kurz
5 siblings, 1 reply; 16+ messages in thread
From: Cédric Le Goater @ 2018-06-25 9:17 UTC (permalink / raw)
To: David Gibson; +Cc: qemu-ppc, qemu-devel, Greg Kurz, Cédric Le Goater
With the previous changes, we can now let the ICS_KVM class inherit
directly from ICS_BASE class and not from the intermediate ICS_SIMPLE.
It makes the class hierarchy much cleaner.
What is left in the top classes is the low level interface to access
the KVM XICS device in ICS_KVM and the XICS emulating handlers in
ICS_SIMPLE.
This should not break migration compatibility.
Signed-off-by: Cédric Le Goater <clg@kaod.org>
---
hw/intc/xics_kvm.c | 12 +++++-------
hw/ppc/spapr.c | 2 +-
2 files changed, 6 insertions(+), 8 deletions(-)
diff --git a/hw/intc/xics_kvm.c b/hw/intc/xics_kvm.c
index b314eb7d1607..30c3769a2084 100644
--- a/hw/intc/xics_kvm.c
+++ b/hw/intc/xics_kvm.c
@@ -359,12 +359,10 @@ static void ics_kvm_class_init(ObjectClass *klass, void *data)
ICSStateClass *icsc = ICS_BASE_CLASS(klass);
DeviceClass *dc = DEVICE_CLASS(klass);
- /*
- * Use device_class_set_parent_realize() when ics-kvm inherits
- * directly from ics-base and not from ics-simple anymore.
- */
- dc->realize = ics_kvm_realize;
- dc->reset = ics_kvm_reset;
+ device_class_set_parent_realize(dc, ics_kvm_realize,
+ &icsc->parent_realize);
+ device_class_set_parent_reset(dc, ics_kvm_reset,
+ &icsc->parent_reset);
icsc->pre_save = ics_get_kvm_state;
icsc->post_load = ics_set_kvm_state;
@@ -373,7 +371,7 @@ static void ics_kvm_class_init(ObjectClass *klass, void *data)
static const TypeInfo ics_kvm_info = {
.name = TYPE_ICS_KVM,
- .parent = TYPE_ICS_SIMPLE,
+ .parent = TYPE_ICS_BASE,
.instance_size = sizeof(ICSState),
.class_init = ics_kvm_class_init,
};
diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
index 0d032a1ad03c..8cc996d0b822 100644
--- a/hw/ppc/spapr.c
+++ b/hw/ppc/spapr.c
@@ -137,7 +137,7 @@ static ICSState *spapr_ics_create(sPAPRMachineState *spapr,
goto error;
}
- return ICS_SIMPLE(obj);
+ return ICS_BASE(obj);
error:
error_propagate(errp, local_err);
--
2.13.6
^ permalink raw reply related [flat|nested] 16+ messages in thread
* Re: [Qemu-devel] [PATCH v2 1/5] ppc/xics: introduce a parent_realize in ICSStateClass
2018-06-25 9:17 ` [Qemu-devel] [PATCH v2 1/5] ppc/xics: introduce a parent_realize in ICSStateClass Cédric Le Goater
@ 2018-06-26 2:18 ` David Gibson
0 siblings, 0 replies; 16+ messages in thread
From: David Gibson @ 2018-06-26 2:18 UTC (permalink / raw)
To: Cédric Le Goater; +Cc: qemu-ppc, qemu-devel, Greg Kurz
[-- Attachment #1: Type: text/plain, Size: 5624 bytes --]
On Mon, Jun 25, 2018 at 11:17:14AM +0200, Cédric Le Goater wrote:
> This makes possible to move the common ICSState code of the realize
> handlers in the ics-base class.
>
> Signed-off-by: Cédric Le Goater <clg@kaod.org>
Applied to ppc-for-3.0, thanks.
> ---
> include/hw/ppc/xics.h | 3 ++-
> hw/intc/xics.c | 37 ++++++++++++++++++++++---------------
> hw/intc/xics_kvm.c | 20 +++++++++++++++-----
> 3 files changed, 39 insertions(+), 21 deletions(-)
>
> diff --git a/include/hw/ppc/xics.h b/include/hw/ppc/xics.h
> index 4b04b295a772..44e96e640070 100644
> --- a/include/hw/ppc/xics.h
> +++ b/include/hw/ppc/xics.h
> @@ -115,7 +115,8 @@ struct PnvICPState {
> struct ICSStateClass {
> DeviceClass parent_class;
>
> - void (*realize)(ICSState *s, Error **errp);
> + DeviceRealize parent_realize;
> +
> void (*pre_save)(ICSState *s);
> int (*post_load)(ICSState *s, int version_id);
> void (*reject)(ICSState *s, uint32_t irq);
> diff --git a/hw/intc/xics.c b/hw/intc/xics.c
> index 063491f38712..d6066d561fdc 100644
> --- a/hw/intc/xics.c
> +++ b/hw/intc/xics.c
> @@ -618,30 +618,31 @@ static void ics_simple_initfn(Object *obj)
> ics->offset = XICS_IRQ_BASE;
> }
>
> -static void ics_simple_realize(ICSState *ics, Error **errp)
> +static void ics_simple_realize(DeviceState *dev, Error **errp)
> {
> - if (!ics->nr_irqs) {
> - error_setg(errp, "Number of interrupts needs to be greater 0");
> + ICSState *ics = ICS_SIMPLE(dev);
> + ICSStateClass *icsc = ICS_BASE_GET_CLASS(ics);
> + Error *local_err = NULL;
> +
> + icsc->parent_realize(dev, &local_err);
> + if (local_err) {
> + error_propagate(errp, local_err);
> return;
> }
> - ics->irqs = g_malloc0(ics->nr_irqs * sizeof(ICSIRQState));
> +
> ics->qirqs = qemu_allocate_irqs(ics_simple_set_irq, ics, ics->nr_irqs);
>
> qemu_register_reset(ics_simple_reset, ics);
> }
>
> -static Property ics_simple_properties[] = {
> - DEFINE_PROP_UINT32("nr-irqs", ICSState, nr_irqs, 0),
> - DEFINE_PROP_END_OF_LIST(),
> -};
> -
> static void ics_simple_class_init(ObjectClass *klass, void *data)
> {
> DeviceClass *dc = DEVICE_CLASS(klass);
> ICSStateClass *isc = ICS_BASE_CLASS(klass);
>
> - isc->realize = ics_simple_realize;
> - dc->props = ics_simple_properties;
> + device_class_set_parent_realize(dc, ics_simple_realize,
> + &isc->parent_realize);
> +
> dc->vmsd = &vmstate_ics_simple;
> isc->reject = ics_simple_reject;
> isc->resend = ics_simple_resend;
> @@ -659,7 +660,6 @@ static const TypeInfo ics_simple_info = {
>
> static void ics_base_realize(DeviceState *dev, Error **errp)
> {
> - ICSStateClass *icsc = ICS_BASE_GET_CLASS(dev);
> ICSState *ics = ICS_BASE(dev);
> Object *obj;
> Error *err = NULL;
> @@ -672,17 +672,24 @@ static void ics_base_realize(DeviceState *dev, Error **errp)
> }
> ics->xics = XICS_FABRIC(obj);
>
> -
> - if (icsc->realize) {
> - icsc->realize(ics, errp);
> + if (!ics->nr_irqs) {
> + error_setg(errp, "Number of interrupts needs to be greater 0");
> + return;
> }
> + ics->irqs = g_malloc0(ics->nr_irqs * sizeof(ICSIRQState));
> }
>
> +static Property ics_base_properties[] = {
> + DEFINE_PROP_UINT32("nr-irqs", ICSState, nr_irqs, 0),
> + DEFINE_PROP_END_OF_LIST(),
> +};
> +
> static void ics_base_class_init(ObjectClass *klass, void *data)
> {
> DeviceClass *dc = DEVICE_CLASS(klass);
>
> dc->realize = ics_base_realize;
> + dc->props = ics_base_properties;
> }
>
> static const TypeInfo ics_base_info = {
> diff --git a/hw/intc/xics_kvm.c b/hw/intc/xics_kvm.c
> index f511e50a8020..1f27eb497981 100644
> --- a/hw/intc/xics_kvm.c
> +++ b/hw/intc/xics_kvm.c
> @@ -345,13 +345,17 @@ static void ics_kvm_reset(void *dev)
> ics_set_kvm_state(ics, 1);
> }
>
> -static void ics_kvm_realize(ICSState *ics, Error **errp)
> +static void ics_kvm_realize(DeviceState *dev, Error **errp)
> {
> - if (!ics->nr_irqs) {
> - error_setg(errp, "Number of interrupts needs to be greater 0");
> + ICSState *ics = ICS_KVM(dev);
> + ICSStateClass *icsc = ICS_BASE_GET_CLASS(ics);
> + Error *local_err = NULL;
> +
> + icsc->parent_realize(dev, &local_err);
> + if (local_err) {
> + error_propagate(errp, local_err);
> return;
> }
> - ics->irqs = g_malloc0(ics->nr_irqs * sizeof(ICSIRQState));
> ics->qirqs = qemu_allocate_irqs(ics_kvm_set_irq, ics, ics->nr_irqs);
>
> qemu_register_reset(ics_kvm_reset, ics);
> @@ -360,8 +364,14 @@ static void ics_kvm_realize(ICSState *ics, Error **errp)
> static void ics_kvm_class_init(ObjectClass *klass, void *data)
> {
> ICSStateClass *icsc = ICS_BASE_CLASS(klass);
> + DeviceClass *dc = DEVICE_CLASS(klass);
> +
> + /*
> + * Use device_class_set_parent_realize() when ics-kvm inherits
> + * directly from ics-base and not from ics-simple anymore.
> + */
> + dc->realize = ics_kvm_realize;
>
> - icsc->realize = ics_kvm_realize;
> icsc->pre_save = ics_get_kvm_state;
> icsc->post_load = ics_set_kvm_state;
> icsc->synchronize_state = ics_synchronize_state;
--
David Gibson | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [Qemu-devel] [PATCH v2 2/5] ppc/xics: move the instance_init handler under the ics-base class
2018-06-25 9:17 ` [Qemu-devel] [PATCH v2 2/5] ppc/xics: move the instance_init handler under the ics-base class Cédric Le Goater
@ 2018-06-26 2:21 ` David Gibson
0 siblings, 0 replies; 16+ messages in thread
From: David Gibson @ 2018-06-26 2:21 UTC (permalink / raw)
To: Cédric Le Goater; +Cc: qemu-ppc, qemu-devel, Greg Kurz
[-- Attachment #1: Type: text/plain, Size: 2018 bytes --]
On Mon, Jun 25, 2018 at 11:17:15AM +0200, Cédric Le Goater wrote:
> Signed-off-by: Cédric Le Goater <clg@kaod.org>
> ---
> hw/intc/xics.c | 16 ++++++++--------
> 1 file changed, 8 insertions(+), 8 deletions(-)
Applied, thanks.
> diff --git a/hw/intc/xics.c b/hw/intc/xics.c
> index d6066d561fdc..83340770f7c0 100644
> --- a/hw/intc/xics.c
> +++ b/hw/intc/xics.c
> @@ -611,13 +611,6 @@ static const VMStateDescription vmstate_ics_simple = {
> },
> };
>
> -static void ics_simple_initfn(Object *obj)
> -{
> - ICSState *ics = ICS_SIMPLE(obj);
> -
> - ics->offset = XICS_IRQ_BASE;
> -}
> -
> static void ics_simple_realize(DeviceState *dev, Error **errp)
> {
> ICSState *ics = ICS_SIMPLE(dev);
> @@ -655,7 +648,6 @@ static const TypeInfo ics_simple_info = {
> .instance_size = sizeof(ICSState),
> .class_init = ics_simple_class_init,
> .class_size = sizeof(ICSStateClass),
> - .instance_init = ics_simple_initfn,
> };
>
> static void ics_base_realize(DeviceState *dev, Error **errp)
> @@ -679,6 +671,13 @@ static void ics_base_realize(DeviceState *dev, Error **errp)
> ics->irqs = g_malloc0(ics->nr_irqs * sizeof(ICSIRQState));
> }
>
> +static void ics_base_instance_init(Object *obj)
> +{
> + ICSState *ics = ICS_BASE(obj);
> +
> + ics->offset = XICS_IRQ_BASE;
> +}
> +
> static Property ics_base_properties[] = {
> DEFINE_PROP_UINT32("nr-irqs", ICSState, nr_irqs, 0),
> DEFINE_PROP_END_OF_LIST(),
> @@ -697,6 +696,7 @@ static const TypeInfo ics_base_info = {
> .parent = TYPE_DEVICE,
> .abstract = true,
> .instance_size = sizeof(ICSState),
> + .instance_init = ics_base_instance_init,
> .class_init = ics_base_class_init,
> .class_size = sizeof(ICSStateClass),
> };
--
David Gibson | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [Qemu-devel] [PATCH v2 3/5] ppx/xics: introduce a parent_reset in ICSStateClass
2018-06-25 9:17 ` [Qemu-devel] [PATCH v2 3/5] ppx/xics: introduce a parent_reset in ICSStateClass Cédric Le Goater
@ 2018-06-26 2:25 ` David Gibson
0 siblings, 0 replies; 16+ messages in thread
From: David Gibson @ 2018-06-26 2:25 UTC (permalink / raw)
To: Cédric Le Goater; +Cc: qemu-ppc, qemu-devel, Greg Kurz
[-- Attachment #1: Type: text/plain, Size: 5851 bytes --]
On Mon, Jun 25, 2018 at 11:17:16AM +0200, Cédric Le Goater wrote:
> Just like for the realize handlers, this makes possible to move the
> common ICSState code of the reset handlers in the ics-base class.
>
> Signed-off-by: Cédric Le Goater <clg@kaod.org>
Applied, thanks.
> ---
> include/hw/ppc/xics.h | 1 +
> hw/intc/xics.c | 45 ++++++++++++++++++++++++++++++---------------
> hw/intc/xics_kvm.c | 26 ++++++++++----------------
> 3 files changed, 41 insertions(+), 31 deletions(-)
>
> diff --git a/include/hw/ppc/xics.h b/include/hw/ppc/xics.h
> index 44e96e640070..6ac8a9392da6 100644
> --- a/include/hw/ppc/xics.h
> +++ b/include/hw/ppc/xics.h
> @@ -116,6 +116,7 @@ struct ICSStateClass {
> DeviceClass parent_class;
>
> DeviceRealize parent_realize;
> + DeviceReset parent_reset;
>
> void (*pre_save)(ICSState *s);
> int (*post_load)(ICSState *s, int version_id);
> diff --git a/hw/intc/xics.c b/hw/intc/xics.c
> index 83340770f7c0..8cfe2231531e 100644
> --- a/hw/intc/xics.c
> +++ b/hw/intc/xics.c
> @@ -537,23 +537,16 @@ static void ics_simple_eoi(ICSState *ics, uint32_t nr)
> }
> }
>
> -static void ics_simple_reset(void *dev)
> +static void ics_simple_reset(DeviceState *dev)
> {
> - ICSState *ics = ICS_SIMPLE(dev);
> - int i;
> - uint8_t flags[ics->nr_irqs];
> + ICSStateClass *icsc = ICS_BASE_GET_CLASS(dev);
>
> - for (i = 0; i < ics->nr_irqs; i++) {
> - flags[i] = ics->irqs[i].flags;
> - }
> -
> - memset(ics->irqs, 0, sizeof(ICSIRQState) * ics->nr_irqs);
> + icsc->parent_reset(dev);
> +}
>
> - for (i = 0; i < ics->nr_irqs; i++) {
> - ics->irqs[i].priority = 0xff;
> - ics->irqs[i].saved_priority = 0xff;
> - ics->irqs[i].flags = flags[i];
> - }
> +static void ics_simple_reset_handler(void *dev)
> +{
> + ics_simple_reset(dev);
> }
>
> static int ics_simple_dispatch_pre_save(void *opaque)
> @@ -625,7 +618,7 @@ static void ics_simple_realize(DeviceState *dev, Error **errp)
>
> ics->qirqs = qemu_allocate_irqs(ics_simple_set_irq, ics, ics->nr_irqs);
>
> - qemu_register_reset(ics_simple_reset, ics);
> + qemu_register_reset(ics_simple_reset_handler, ics);
> }
>
> static void ics_simple_class_init(ObjectClass *klass, void *data)
> @@ -635,6 +628,8 @@ static void ics_simple_class_init(ObjectClass *klass, void *data)
>
> device_class_set_parent_realize(dc, ics_simple_realize,
> &isc->parent_realize);
> + device_class_set_parent_reset(dc, ics_simple_reset,
> + &isc->parent_reset);
>
> dc->vmsd = &vmstate_ics_simple;
> isc->reject = ics_simple_reject;
> @@ -650,6 +645,25 @@ static const TypeInfo ics_simple_info = {
> .class_size = sizeof(ICSStateClass),
> };
>
> +static void ics_base_reset(DeviceState *dev)
> +{
> + ICSState *ics = ICS_BASE(dev);
> + int i;
> + uint8_t flags[ics->nr_irqs];
> +
> + for (i = 0; i < ics->nr_irqs; i++) {
> + flags[i] = ics->irqs[i].flags;
> + }
> +
> + memset(ics->irqs, 0, sizeof(ICSIRQState) * ics->nr_irqs);
> +
> + for (i = 0; i < ics->nr_irqs; i++) {
> + ics->irqs[i].priority = 0xff;
> + ics->irqs[i].saved_priority = 0xff;
> + ics->irqs[i].flags = flags[i];
> + }
> +}
> +
> static void ics_base_realize(DeviceState *dev, Error **errp)
> {
> ICSState *ics = ICS_BASE(dev);
> @@ -689,6 +703,7 @@ static void ics_base_class_init(ObjectClass *klass, void *data)
>
> dc->realize = ics_base_realize;
> dc->props = ics_base_properties;
> + dc->reset = ics_base_reset;
> }
>
> static const TypeInfo ics_base_info = {
> diff --git a/hw/intc/xics_kvm.c b/hw/intc/xics_kvm.c
> index 1f27eb497981..b314eb7d1607 100644
> --- a/hw/intc/xics_kvm.c
> +++ b/hw/intc/xics_kvm.c
> @@ -324,25 +324,18 @@ static void ics_kvm_set_irq(void *opaque, int srcno, int val)
> }
> }
>
> -static void ics_kvm_reset(void *dev)
> +static void ics_kvm_reset(DeviceState *dev)
> {
> - ICSState *ics = ICS_SIMPLE(dev);
> - int i;
> - uint8_t flags[ics->nr_irqs];
> -
> - for (i = 0; i < ics->nr_irqs; i++) {
> - flags[i] = ics->irqs[i].flags;
> - }
> + ICSStateClass *icsc = ICS_BASE_GET_CLASS(dev);
>
> - memset(ics->irqs, 0, sizeof(ICSIRQState) * ics->nr_irqs);
> + icsc->parent_reset(dev);
>
> - for (i = 0; i < ics->nr_irqs; i++) {
> - ics->irqs[i].priority = 0xff;
> - ics->irqs[i].saved_priority = 0xff;
> - ics->irqs[i].flags = flags[i];
> - }
> + ics_set_kvm_state(ICS_KVM(dev), 1);
> +}
>
> - ics_set_kvm_state(ics, 1);
> +static void ics_kvm_reset_handler(void *dev)
> +{
> + ics_kvm_reset(dev);
> }
>
> static void ics_kvm_realize(DeviceState *dev, Error **errp)
> @@ -358,7 +351,7 @@ static void ics_kvm_realize(DeviceState *dev, Error **errp)
> }
> ics->qirqs = qemu_allocate_irqs(ics_kvm_set_irq, ics, ics->nr_irqs);
>
> - qemu_register_reset(ics_kvm_reset, ics);
> + qemu_register_reset(ics_kvm_reset_handler, ics);
> }
>
> static void ics_kvm_class_init(ObjectClass *klass, void *data)
> @@ -371,6 +364,7 @@ static void ics_kvm_class_init(ObjectClass *klass, void *data)
> * directly from ics-base and not from ics-simple anymore.
> */
> dc->realize = ics_kvm_realize;
> + dc->reset = ics_kvm_reset;
>
> icsc->pre_save = ics_get_kvm_state;
> icsc->post_load = ics_set_kvm_state;
--
David Gibson | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [Qemu-devel] [PATCH v2 4/5] ppc/xics: move the vmstate structures under the ics-base class
2018-06-25 9:17 ` [Qemu-devel] [PATCH v2 4/5] ppc/xics: move the vmstate structures under the ics-base class Cédric Le Goater
@ 2018-06-26 2:30 ` David Gibson
0 siblings, 0 replies; 16+ messages in thread
From: David Gibson @ 2018-06-26 2:30 UTC (permalink / raw)
To: Cédric Le Goater; +Cc: qemu-ppc, qemu-devel, Greg Kurz
[-- Attachment #1: Type: text/plain, Size: 5159 bytes --]
On Mon, Jun 25, 2018 at 11:17:17AM +0200, Cédric Le Goater wrote:
> Signed-off-by: Cédric Le Goater <clg@kaod.org>
Applied, thanks.
> ---
> hw/intc/xics.c | 112 ++++++++++++++++++++++++++++-----------------------------
> 1 file changed, 56 insertions(+), 56 deletions(-)
>
> diff --git a/hw/intc/xics.c b/hw/intc/xics.c
> index 8cfe2231531e..b9f1a3c97214 100644
> --- a/hw/intc/xics.c
> +++ b/hw/intc/xics.c
> @@ -549,61 +549,6 @@ static void ics_simple_reset_handler(void *dev)
> ics_simple_reset(dev);
> }
>
> -static int ics_simple_dispatch_pre_save(void *opaque)
> -{
> - ICSState *ics = opaque;
> - ICSStateClass *info = ICS_BASE_GET_CLASS(ics);
> -
> - if (info->pre_save) {
> - info->pre_save(ics);
> - }
> -
> - return 0;
> -}
> -
> -static int ics_simple_dispatch_post_load(void *opaque, int version_id)
> -{
> - ICSState *ics = opaque;
> - ICSStateClass *info = ICS_BASE_GET_CLASS(ics);
> -
> - if (info->post_load) {
> - return info->post_load(ics, version_id);
> - }
> -
> - return 0;
> -}
> -
> -static const VMStateDescription vmstate_ics_simple_irq = {
> - .name = "ics/irq",
> - .version_id = 2,
> - .minimum_version_id = 1,
> - .fields = (VMStateField[]) {
> - VMSTATE_UINT32(server, ICSIRQState),
> - VMSTATE_UINT8(priority, ICSIRQState),
> - VMSTATE_UINT8(saved_priority, ICSIRQState),
> - VMSTATE_UINT8(status, ICSIRQState),
> - VMSTATE_UINT8(flags, ICSIRQState),
> - VMSTATE_END_OF_LIST()
> - },
> -};
> -
> -static const VMStateDescription vmstate_ics_simple = {
> - .name = "ics",
> - .version_id = 1,
> - .minimum_version_id = 1,
> - .pre_save = ics_simple_dispatch_pre_save,
> - .post_load = ics_simple_dispatch_post_load,
> - .fields = (VMStateField[]) {
> - /* Sanity check */
> - VMSTATE_UINT32_EQUAL(nr_irqs, ICSState, NULL),
> -
> - VMSTATE_STRUCT_VARRAY_POINTER_UINT32(irqs, ICSState, nr_irqs,
> - vmstate_ics_simple_irq,
> - ICSIRQState),
> - VMSTATE_END_OF_LIST()
> - },
> -};
> -
> static void ics_simple_realize(DeviceState *dev, Error **errp)
> {
> ICSState *ics = ICS_SIMPLE(dev);
> @@ -631,7 +576,6 @@ static void ics_simple_class_init(ObjectClass *klass, void *data)
> device_class_set_parent_reset(dc, ics_simple_reset,
> &isc->parent_reset);
>
> - dc->vmsd = &vmstate_ics_simple;
> isc->reject = ics_simple_reject;
> isc->resend = ics_simple_resend;
> isc->eoi = ics_simple_eoi;
> @@ -692,6 +636,61 @@ static void ics_base_instance_init(Object *obj)
> ics->offset = XICS_IRQ_BASE;
> }
>
> +static int ics_base_dispatch_pre_save(void *opaque)
> +{
> + ICSState *ics = opaque;
> + ICSStateClass *info = ICS_BASE_GET_CLASS(ics);
> +
> + if (info->pre_save) {
> + info->pre_save(ics);
> + }
> +
> + return 0;
> +}
> +
> +static int ics_base_dispatch_post_load(void *opaque, int version_id)
> +{
> + ICSState *ics = opaque;
> + ICSStateClass *info = ICS_BASE_GET_CLASS(ics);
> +
> + if (info->post_load) {
> + return info->post_load(ics, version_id);
> + }
> +
> + return 0;
> +}
> +
> +static const VMStateDescription vmstate_ics_base_irq = {
> + .name = "ics/irq",
> + .version_id = 2,
> + .minimum_version_id = 1,
> + .fields = (VMStateField[]) {
> + VMSTATE_UINT32(server, ICSIRQState),
> + VMSTATE_UINT8(priority, ICSIRQState),
> + VMSTATE_UINT8(saved_priority, ICSIRQState),
> + VMSTATE_UINT8(status, ICSIRQState),
> + VMSTATE_UINT8(flags, ICSIRQState),
> + VMSTATE_END_OF_LIST()
> + },
> +};
> +
> +static const VMStateDescription vmstate_ics_base = {
> + .name = "ics",
> + .version_id = 1,
> + .minimum_version_id = 1,
> + .pre_save = ics_base_dispatch_pre_save,
> + .post_load = ics_base_dispatch_post_load,
> + .fields = (VMStateField[]) {
> + /* Sanity check */
> + VMSTATE_UINT32_EQUAL(nr_irqs, ICSState, NULL),
> +
> + VMSTATE_STRUCT_VARRAY_POINTER_UINT32(irqs, ICSState, nr_irqs,
> + vmstate_ics_base_irq,
> + ICSIRQState),
> + VMSTATE_END_OF_LIST()
> + },
> +};
> +
> static Property ics_base_properties[] = {
> DEFINE_PROP_UINT32("nr-irqs", ICSState, nr_irqs, 0),
> DEFINE_PROP_END_OF_LIST(),
> @@ -704,6 +703,7 @@ static void ics_base_class_init(ObjectClass *klass, void *data)
> dc->realize = ics_base_realize;
> dc->props = ics_base_properties;
> dc->reset = ics_base_reset;
> + dc->vmsd = &vmstate_ics_base;
> }
>
> static const TypeInfo ics_base_info = {
--
David Gibson | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [Qemu-devel] [PATCH v2 5/5] ppc/xics: rework the ICS classes inheritance tree
2018-06-25 9:17 ` [Qemu-devel] [PATCH v2 5/5] ppc/xics: rework the ICS classes inheritance tree Cédric Le Goater
@ 2018-06-26 3:21 ` David Gibson
0 siblings, 0 replies; 16+ messages in thread
From: David Gibson @ 2018-06-26 3:21 UTC (permalink / raw)
To: Cédric Le Goater; +Cc: qemu-ppc, qemu-devel, Greg Kurz
[-- Attachment #1: Type: text/plain, Size: 2504 bytes --]
On Mon, Jun 25, 2018 at 11:17:18AM +0200, Cédric Le Goater wrote:
> With the previous changes, we can now let the ICS_KVM class inherit
> directly from ICS_BASE class and not from the intermediate ICS_SIMPLE.
> It makes the class hierarchy much cleaner.
>
> What is left in the top classes is the low level interface to access
> the KVM XICS device in ICS_KVM and the XICS emulating handlers in
> ICS_SIMPLE.
>
> This should not break migration compatibility.
>
> Signed-off-by: Cédric Le Goater <clg@kaod.org>
Applied, thanks.
> ---
> hw/intc/xics_kvm.c | 12 +++++-------
> hw/ppc/spapr.c | 2 +-
> 2 files changed, 6 insertions(+), 8 deletions(-)
>
> diff --git a/hw/intc/xics_kvm.c b/hw/intc/xics_kvm.c
> index b314eb7d1607..30c3769a2084 100644
> --- a/hw/intc/xics_kvm.c
> +++ b/hw/intc/xics_kvm.c
> @@ -359,12 +359,10 @@ static void ics_kvm_class_init(ObjectClass *klass, void *data)
> ICSStateClass *icsc = ICS_BASE_CLASS(klass);
> DeviceClass *dc = DEVICE_CLASS(klass);
>
> - /*
> - * Use device_class_set_parent_realize() when ics-kvm inherits
> - * directly from ics-base and not from ics-simple anymore.
> - */
> - dc->realize = ics_kvm_realize;
> - dc->reset = ics_kvm_reset;
> + device_class_set_parent_realize(dc, ics_kvm_realize,
> + &icsc->parent_realize);
> + device_class_set_parent_reset(dc, ics_kvm_reset,
> + &icsc->parent_reset);
>
> icsc->pre_save = ics_get_kvm_state;
> icsc->post_load = ics_set_kvm_state;
> @@ -373,7 +371,7 @@ static void ics_kvm_class_init(ObjectClass *klass, void *data)
>
> static const TypeInfo ics_kvm_info = {
> .name = TYPE_ICS_KVM,
> - .parent = TYPE_ICS_SIMPLE,
> + .parent = TYPE_ICS_BASE,
> .instance_size = sizeof(ICSState),
> .class_init = ics_kvm_class_init,
> };
> diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
> index 0d032a1ad03c..8cc996d0b822 100644
> --- a/hw/ppc/spapr.c
> +++ b/hw/ppc/spapr.c
> @@ -137,7 +137,7 @@ static ICSState *spapr_ics_create(sPAPRMachineState *spapr,
> goto error;
> }
>
> - return ICS_SIMPLE(obj);
> + return ICS_BASE(obj);
>
> error:
> error_propagate(errp, local_err);
--
David Gibson | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [Qemu-devel] [Qemu-ppc] [PATCH v2 0/5] rework the ICS classes inheritance tree
2018-06-25 9:17 [Qemu-devel] [PATCH v2 0/5] rework the ICS classes inheritance tree Cédric Le Goater
` (4 preceding siblings ...)
2018-06-25 9:17 ` [Qemu-devel] [PATCH v2 5/5] ppc/xics: rework the ICS classes inheritance tree Cédric Le Goater
@ 2018-06-26 13:27 ` Greg Kurz
2018-06-26 16:37 ` Cédric Le Goater
5 siblings, 1 reply; 16+ messages in thread
From: Greg Kurz @ 2018-06-26 13:27 UTC (permalink / raw)
To: Cédric Le Goater; +Cc: David Gibson, qemu-ppc, qemu-devel
On Mon, 25 Jun 2018 11:17:13 +0200
Cédric Le Goater <clg@kaod.org> wrote:
> Hello,
>
Hello,
Sorry I didn't manage to look at this before it got merged :)
> It makes the class hierarchy much cleaner and removes duplicated
> code. As we are touching the location of the objects states, migration
> compatibility was checked and the following tests were performed under
> KVM :
>
> qemu-3.0 (pseries-3.0) -> qemu-3.0 (pseries-3.0) OK
> qemu-3.0 (pseries-2.12) -> qemu-2.12 (pseries-2.12) OK
> qemu-3.0 (pseries-2.11) -> qemu-2.11 (pseries-2.11) OK
> qemu-3.0 (pseries-2.10) -> qemu-2.10 (pseries-2.10) OK
> qemu-3.0 (pseries-2.9) -> qemu-2.9 (pseries-2.9) OK
> qemu-3.0 (pseries-2.8) -> qemu-2.8 (pseries-2.8) OK
> qemu-3.0 (pseries-2.7) -> qemu-2.7 (pseries-2.7) FAIL
What's the failure ?
>
> and back :
>
> qemu-3.0 (pseries-3.0) <- qemu-3.0 (pseries-3.0) OK
> qemu-3.0 (pseries-2.12) <- qemu-2.12 (pseries-2.12) OK
> qemu-3.0 (pseries-2.11) <- qemu-2.11 (pseries-2.11) OK
> qemu-3.0 (pseries-2.10) <- qemu-2.10 (pseries-2.10) OK
> qemu-3.0 (pseries-2.9) <- qemu-2.9 (pseries-2.9) OK
> qemu-3.0 (pseries-2.8) <- qemu-2.8 (pseries-2.8) OK
> qemu-3.0 (pseries-2.7) <- qemu-2.7 (pseries-2.7) OK
>
> under TCG, same scenarios were run but up to 2.10 only, in which case
> the migration fails for other reasons.
>
> I wouldn't mind some extra cross checking from someone else.
>
> Thanks,
>
> C.
>
> Changes since v2:
>
> - split the patch in smaller units. The migration tests were not
> rerun because the code is very much the same. make check was run on
> each patch.
>
>
> Cédric Le Goater (5):
> ppc/xics: introduce a parent_realize in ICSStateClass
> ppc/xics: move the instance_init handler under the ics-base class
> ppx/xics: introduce a parent_reset in ICSStateClass
> ppc/xics: move the vmstate structures under the ics-base class
> ppc/xics: rework the ICS classes inheritance tree
>
> include/hw/ppc/xics.h | 4 +-
> hw/intc/xics.c | 164 ++++++++++++++++++++++++++++----------------------
> hw/intc/xics_kvm.c | 46 +++++++-------
> hw/ppc/spapr.c | 2 +-
> 4 files changed, 121 insertions(+), 95 deletions(-)
>
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [Qemu-devel] [Qemu-ppc] [PATCH v2 0/5] rework the ICS classes inheritance tree
2018-06-26 13:27 ` [Qemu-devel] [Qemu-ppc] [PATCH v2 0/5] " Greg Kurz
@ 2018-06-26 16:37 ` Cédric Le Goater
2018-06-27 0:14 ` David Gibson
0 siblings, 1 reply; 16+ messages in thread
From: Cédric Le Goater @ 2018-06-26 16:37 UTC (permalink / raw)
To: Greg Kurz; +Cc: David Gibson, qemu-ppc, qemu-devel
On 06/26/2018 03:27 PM, Greg Kurz wrote:
> On Mon, 25 Jun 2018 11:17:13 +0200
> Cédric Le Goater <clg@kaod.org> wrote:
>
>> Hello,
>>
>
> Hello,
>
> Sorry I didn't manage to look at this before it got merged :)
>
>> It makes the class hierarchy much cleaner and removes duplicated
>> code. As we are touching the location of the objects states, migration
>> compatibility was checked and the following tests were performed under
>> KVM :
>>
>> qemu-3.0 (pseries-3.0) -> qemu-3.0 (pseries-3.0) OK
>> qemu-3.0 (pseries-2.12) -> qemu-2.12 (pseries-2.12) OK
>> qemu-3.0 (pseries-2.11) -> qemu-2.11 (pseries-2.11) OK
>> qemu-3.0 (pseries-2.10) -> qemu-2.10 (pseries-2.10) OK
>> qemu-3.0 (pseries-2.9) -> qemu-2.9 (pseries-2.9) OK
>> qemu-3.0 (pseries-2.8) -> qemu-2.8 (pseries-2.8) OK
>> qemu-3.0 (pseries-2.7) -> qemu-2.7 (pseries-2.7) FAIL
>
> What's the failure ?
qemu-system-ppc64: error while loading state for instance 0x0 of device 'cpu'
qemu-system-ppc64: load of migration failed: Invalid argument
and to be more precise :
qemu-3.0 (pseries-2.7) -> qemu-2.7 (pseries-2.7) FAIL
qemu-2.12 (pseries-2.7) -> qemu-2.7 (pseries-2.7) FAIL
qemu-2.11 (pseries-2.7) -> qemu-2.7 (pseries-2.7) FAIL
qemu-2.10 (pseries-2.7) -> qemu-2.7 (pseries-2.7) FAIL
qemu-2.9 (pseries-2.7) -> qemu-2.7 (pseries-2.7) FAIL
qemu-2.8 (pseries-2.7) -> qemu-2.7 (pseries-2.7) FAIL
qemu-2.7 (pseries-2.7) -> qemu-2.7 (pseries-2.7) OK
So it has been a while.
C.
>
>>
>> and back :
>>
>> qemu-3.0 (pseries-3.0) <- qemu-3.0 (pseries-3.0) OK
>> qemu-3.0 (pseries-2.12) <- qemu-2.12 (pseries-2.12) OK
>> qemu-3.0 (pseries-2.11) <- qemu-2.11 (pseries-2.11) OK
>> qemu-3.0 (pseries-2.10) <- qemu-2.10 (pseries-2.10) OK
>> qemu-3.0 (pseries-2.9) <- qemu-2.9 (pseries-2.9) OK
>> qemu-3.0 (pseries-2.8) <- qemu-2.8 (pseries-2.8) OK
>> qemu-3.0 (pseries-2.7) <- qemu-2.7 (pseries-2.7) OK
>>
>> under TCG, same scenarios were run but up to 2.10 only, in which case
>> the migration fails for other reasons.
>>
>> I wouldn't mind some extra cross checking from someone else.
>>
>> Thanks,
>>
>> C.
>>
>> Changes since v2:
>>
>> - split the patch in smaller units. The migration tests were not
>> rerun because the code is very much the same. make check was run on
>> each patch.
>>
>>
>> Cédric Le Goater (5):
>> ppc/xics: introduce a parent_realize in ICSStateClass
>> ppc/xics: move the instance_init handler under the ics-base class
>> ppx/xics: introduce a parent_reset in ICSStateClass
>> ppc/xics: move the vmstate structures under the ics-base class
>> ppc/xics: rework the ICS classes inheritance tree
>>
>> include/hw/ppc/xics.h | 4 +-
>> hw/intc/xics.c | 164 ++++++++++++++++++++++++++++----------------------
>> hw/intc/xics_kvm.c | 46 +++++++-------
>> hw/ppc/spapr.c | 2 +-
>> 4 files changed, 121 insertions(+), 95 deletions(-)
>>
>
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [Qemu-devel] [Qemu-ppc] [PATCH v2 0/5] rework the ICS classes inheritance tree
2018-06-26 16:37 ` Cédric Le Goater
@ 2018-06-27 0:14 ` David Gibson
2018-06-27 6:34 ` Cédric Le Goater
0 siblings, 1 reply; 16+ messages in thread
From: David Gibson @ 2018-06-27 0:14 UTC (permalink / raw)
To: Cédric Le Goater; +Cc: Greg Kurz, qemu-ppc, qemu-devel
[-- Attachment #1: Type: text/plain, Size: 3624 bytes --]
On Tue, Jun 26, 2018 at 06:37:12PM +0200, Cédric Le Goater wrote:
1;5202;0c> On 06/26/2018 03:27 PM, Greg Kurz wrote:
> > On Mon, 25 Jun 2018 11:17:13 +0200
> > Cédric Le Goater <clg@kaod.org> wrote:
> >
> >> Hello,
> >>
> >
> > Hello,
> >
> > Sorry I didn't manage to look at this before it got merged :)
> >
> >> It makes the class hierarchy much cleaner and removes duplicated
> >> code. As we are touching the location of the objects states, migration
> >> compatibility was checked and the following tests were performed under
> >> KVM :
> >>
> >> qemu-3.0 (pseries-3.0) -> qemu-3.0 (pseries-3.0) OK
> >> qemu-3.0 (pseries-2.12) -> qemu-2.12 (pseries-2.12) OK
> >> qemu-3.0 (pseries-2.11) -> qemu-2.11 (pseries-2.11) OK
> >> qemu-3.0 (pseries-2.10) -> qemu-2.10 (pseries-2.10) OK
> >> qemu-3.0 (pseries-2.9) -> qemu-2.9 (pseries-2.9) OK
> >> qemu-3.0 (pseries-2.8) -> qemu-2.8 (pseries-2.8) OK
> >> qemu-3.0 (pseries-2.7) -> qemu-2.7 (pseries-2.7) FAIL
> >
> > What's the failure ?
>
> qemu-system-ppc64: error while loading state for instance 0x0 of device 'cpu'
> qemu-system-ppc64: load of migration failed: Invalid argument
>
> and to be more precise :
>
> qemu-3.0 (pseries-2.7) -> qemu-2.7 (pseries-2.7) FAIL
> qemu-2.12 (pseries-2.7) -> qemu-2.7 (pseries-2.7) FAIL
> qemu-2.11 (pseries-2.7) -> qemu-2.7 (pseries-2.7) FAIL
> qemu-2.10 (pseries-2.7) -> qemu-2.7 (pseries-2.7) FAIL
> qemu-2.9 (pseries-2.7) -> qemu-2.7 (pseries-2.7) FAIL
> qemu-2.8 (pseries-2.7) -> qemu-2.7 (pseries-2.7) FAIL
> qemu-2.7 (pseries-2.7) -> qemu-2.7 (pseries-2.7) OK
>
>
> So it has been a while.
Yeah, IIRC that's a known problem. If you try 2.7.1, I think it will work.
>
> C.
>
>
> >
> >>
> >> and back :
> >>
> >> qemu-3.0 (pseries-3.0) <- qemu-3.0 (pseries-3.0) OK
> >> qemu-3.0 (pseries-2.12) <- qemu-2.12 (pseries-2.12) OK
> >> qemu-3.0 (pseries-2.11) <- qemu-2.11 (pseries-2.11) OK
> >> qemu-3.0 (pseries-2.10) <- qemu-2.10 (pseries-2.10) OK
> >> qemu-3.0 (pseries-2.9) <- qemu-2.9 (pseries-2.9) OK
> >> qemu-3.0 (pseries-2.8) <- qemu-2.8 (pseries-2.8) OK
> >> qemu-3.0 (pseries-2.7) <- qemu-2.7 (pseries-2.7) OK
> >>
> >> under TCG, same scenarios were run but up to 2.10 only, in which case
> >> the migration fails for other reasons.
> >>
> >> I wouldn't mind some extra cross checking from someone else.
> >>
> >> Thanks,
> >>
> >> C.
> >>
> >> Changes since v2:
> >>
> >> - split the patch in smaller units. The migration tests were not
> >> rerun because the code is very much the same. make check was run on
> >> each patch.
> >>
> >>
> >> Cédric Le Goater (5):
> >> ppc/xics: introduce a parent_realize in ICSStateClass
> >> ppc/xics: move the instance_init handler under the ics-base class
> >> ppx/xics: introduce a parent_reset in ICSStateClass
> >> ppc/xics: move the vmstate structures under the ics-base class
> >> ppc/xics: rework the ICS classes inheritance tree
> >>
> >> include/hw/ppc/xics.h | 4 +-
> >> hw/intc/xics.c | 164 ++++++++++++++++++++++++++++----------------------
> >> hw/intc/xics_kvm.c | 46 +++++++-------
> >> hw/ppc/spapr.c | 2 +-
> >> 4 files changed, 121 insertions(+), 95 deletions(-)
> >>
> >
>
--
David Gibson | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [Qemu-devel] [Qemu-ppc] [PATCH v2 0/5] rework the ICS classes inheritance tree
2018-06-27 0:14 ` David Gibson
@ 2018-06-27 6:34 ` Cédric Le Goater
2018-06-28 3:54 ` David Gibson
0 siblings, 1 reply; 16+ messages in thread
From: Cédric Le Goater @ 2018-06-27 6:34 UTC (permalink / raw)
To: David Gibson; +Cc: Greg Kurz, qemu-ppc, qemu-devel
On 06/27/2018 02:14 AM, David Gibson wrote:
> On Tue, Jun 26, 2018 at 06:37:12PM +0200, Cédric Le Goater wrote:
> 1;5202;0c> On 06/26/2018 03:27 PM, Greg Kurz wrote:
>>> On Mon, 25 Jun 2018 11:17:13 +0200
>>> Cédric Le Goater <clg@kaod.org> wrote:
>>>
>>>> Hello,
>>>>
>>>
>>> Hello,
>>>
>>> Sorry I didn't manage to look at this before it got merged :)
>>>
>>>> It makes the class hierarchy much cleaner and removes duplicated
>>>> code. As we are touching the location of the objects states, migration
>>>> compatibility was checked and the following tests were performed under
>>>> KVM :
>>>>
>>>> qemu-3.0 (pseries-3.0) -> qemu-3.0 (pseries-3.0) OK
>>>> qemu-3.0 (pseries-2.12) -> qemu-2.12 (pseries-2.12) OK
>>>> qemu-3.0 (pseries-2.11) -> qemu-2.11 (pseries-2.11) OK
>>>> qemu-3.0 (pseries-2.10) -> qemu-2.10 (pseries-2.10) OK
>>>> qemu-3.0 (pseries-2.9) -> qemu-2.9 (pseries-2.9) OK
>>>> qemu-3.0 (pseries-2.8) -> qemu-2.8 (pseries-2.8) OK
>>>> qemu-3.0 (pseries-2.7) -> qemu-2.7 (pseries-2.7) FAIL
>>>
>>> What's the failure ?
>>
>> qemu-system-ppc64: error while loading state for instance 0x0 of device 'cpu'
>> qemu-system-ppc64: load of migration failed: Invalid argument
>>
>> and to be more precise :
>>
>> qemu-3.0 (pseries-2.7) -> qemu-2.7 (pseries-2.7) FAIL
>> qemu-2.12 (pseries-2.7) -> qemu-2.7 (pseries-2.7) FAIL
>> qemu-2.11 (pseries-2.7) -> qemu-2.7 (pseries-2.7) FAIL
>> qemu-2.10 (pseries-2.7) -> qemu-2.7 (pseries-2.7) FAIL
>> qemu-2.9 (pseries-2.7) -> qemu-2.7 (pseries-2.7) FAIL
>> qemu-2.8 (pseries-2.7) -> qemu-2.7 (pseries-2.7) FAIL
>> qemu-2.7 (pseries-2.7) -> qemu-2.7 (pseries-2.7) OK
>>
>>
>> So it has been a while.
>
> Yeah, IIRC that's a known problem. If you try 2.7.1, I think it will work.
I was using a 2.7.1.
C.
>
>>
>> C.
>>
>>
>>>
>>>>
>>>> and back :
>>>>
>>>> qemu-3.0 (pseries-3.0) <- qemu-3.0 (pseries-3.0) OK
>>>> qemu-3.0 (pseries-2.12) <- qemu-2.12 (pseries-2.12) OK
>>>> qemu-3.0 (pseries-2.11) <- qemu-2.11 (pseries-2.11) OK
>>>> qemu-3.0 (pseries-2.10) <- qemu-2.10 (pseries-2.10) OK
>>>> qemu-3.0 (pseries-2.9) <- qemu-2.9 (pseries-2.9) OK
>>>> qemu-3.0 (pseries-2.8) <- qemu-2.8 (pseries-2.8) OK
>>>> qemu-3.0 (pseries-2.7) <- qemu-2.7 (pseries-2.7) OK
>>>>
>>>> under TCG, same scenarios were run but up to 2.10 only, in which case
>>>> the migration fails for other reasons.
>>>>
>>>> I wouldn't mind some extra cross checking from someone else.
>>>>
>>>> Thanks,
>>>>
>>>> C.
>>>>
>>>> Changes since v2:
>>>>
>>>> - split the patch in smaller units. The migration tests were not
>>>> rerun because the code is very much the same. make check was run on
>>>> each patch.
>>>>
>>>>
>>>> Cédric Le Goater (5):
>>>> ppc/xics: introduce a parent_realize in ICSStateClass
>>>> ppc/xics: move the instance_init handler under the ics-base class
>>>> ppx/xics: introduce a parent_reset in ICSStateClass
>>>> ppc/xics: move the vmstate structures under the ics-base class
>>>> ppc/xics: rework the ICS classes inheritance tree
>>>>
>>>> include/hw/ppc/xics.h | 4 +-
>>>> hw/intc/xics.c | 164 ++++++++++++++++++++++++++++----------------------
>>>> hw/intc/xics_kvm.c | 46 +++++++-------
>>>> hw/ppc/spapr.c | 2 +-
>>>> 4 files changed, 121 insertions(+), 95 deletions(-)
>>>>
>>>
>>
>
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [Qemu-devel] [Qemu-ppc] [PATCH v2 0/5] rework the ICS classes inheritance tree
2018-06-27 6:34 ` Cédric Le Goater
@ 2018-06-28 3:54 ` David Gibson
0 siblings, 0 replies; 16+ messages in thread
From: David Gibson @ 2018-06-28 3:54 UTC (permalink / raw)
To: Cédric Le Goater; +Cc: Greg Kurz, qemu-ppc, qemu-devel
[-- Attachment #1: Type: text/plain, Size: 2370 bytes --]
On Wed, Jun 27, 2018 at 08:34:22AM +0200, Cédric Le Goater wrote:
> On 06/27/2018 02:14 AM, David Gibson wrote:
> > On Tue, Jun 26, 2018 at 06:37:12PM +0200, Cédric Le Goater wrote:
> > 1;5202;0c> On 06/26/2018 03:27 PM, Greg Kurz wrote:
> >>> On Mon, 25 Jun 2018 11:17:13 +0200
> >>> Cédric Le Goater <clg@kaod.org> wrote:
> >>>
> >>>> Hello,
> >>>>
> >>>
> >>> Hello,
> >>>
> >>> Sorry I didn't manage to look at this before it got merged :)
> >>>
> >>>> It makes the class hierarchy much cleaner and removes duplicated
> >>>> code. As we are touching the location of the objects states, migration
> >>>> compatibility was checked and the following tests were performed under
> >>>> KVM :
> >>>>
> >>>> qemu-3.0 (pseries-3.0) -> qemu-3.0 (pseries-3.0) OK
> >>>> qemu-3.0 (pseries-2.12) -> qemu-2.12 (pseries-2.12) OK
> >>>> qemu-3.0 (pseries-2.11) -> qemu-2.11 (pseries-2.11) OK
> >>>> qemu-3.0 (pseries-2.10) -> qemu-2.10 (pseries-2.10) OK
> >>>> qemu-3.0 (pseries-2.9) -> qemu-2.9 (pseries-2.9) OK
> >>>> qemu-3.0 (pseries-2.8) -> qemu-2.8 (pseries-2.8) OK
> >>>> qemu-3.0 (pseries-2.7) -> qemu-2.7 (pseries-2.7) FAIL
> >>>
> >>> What's the failure ?
> >>
> >> qemu-system-ppc64: error while loading state for instance 0x0 of device 'cpu'
> >> qemu-system-ppc64: load of migration failed: Invalid argument
> >>
> >> and to be more precise :
> >>
> >> qemu-3.0 (pseries-2.7) -> qemu-2.7 (pseries-2.7) FAIL
> >> qemu-2.12 (pseries-2.7) -> qemu-2.7 (pseries-2.7) FAIL
> >> qemu-2.11 (pseries-2.7) -> qemu-2.7 (pseries-2.7) FAIL
> >> qemu-2.10 (pseries-2.7) -> qemu-2.7 (pseries-2.7) FAIL
> >> qemu-2.9 (pseries-2.7) -> qemu-2.7 (pseries-2.7) FAIL
> >> qemu-2.8 (pseries-2.7) -> qemu-2.7 (pseries-2.7) FAIL
> >> qemu-2.7 (pseries-2.7) -> qemu-2.7 (pseries-2.7) OK
> >>
> >>
> >> So it has been a while.
> >
> > Yeah, IIRC that's a known problem. If you try 2.7.1, I think it will work.
>
> I was using a 2.7.1.
Huh. Ok, I don't know what's going on then. But your patches haven't
changed the behaviour, so, whatever.
--
David Gibson | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 16+ messages in thread
end of thread, other threads:[~2018-06-28 3:54 UTC | newest]
Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-06-25 9:17 [Qemu-devel] [PATCH v2 0/5] rework the ICS classes inheritance tree Cédric Le Goater
2018-06-25 9:17 ` [Qemu-devel] [PATCH v2 1/5] ppc/xics: introduce a parent_realize in ICSStateClass Cédric Le Goater
2018-06-26 2:18 ` David Gibson
2018-06-25 9:17 ` [Qemu-devel] [PATCH v2 2/5] ppc/xics: move the instance_init handler under the ics-base class Cédric Le Goater
2018-06-26 2:21 ` David Gibson
2018-06-25 9:17 ` [Qemu-devel] [PATCH v2 3/5] ppx/xics: introduce a parent_reset in ICSStateClass Cédric Le Goater
2018-06-26 2:25 ` David Gibson
2018-06-25 9:17 ` [Qemu-devel] [PATCH v2 4/5] ppc/xics: move the vmstate structures under the ics-base class Cédric Le Goater
2018-06-26 2:30 ` David Gibson
2018-06-25 9:17 ` [Qemu-devel] [PATCH v2 5/5] ppc/xics: rework the ICS classes inheritance tree Cédric Le Goater
2018-06-26 3:21 ` David Gibson
2018-06-26 13:27 ` [Qemu-devel] [Qemu-ppc] [PATCH v2 0/5] " Greg Kurz
2018-06-26 16:37 ` Cédric Le Goater
2018-06-27 0:14 ` David Gibson
2018-06-27 6:34 ` Cédric Le Goater
2018-06-28 3:54 ` David Gibson
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).