From: Greg Kurz <groug@kaod.org>
The KVM ICS reset handler simply writes the ICS state to KVM. This
doesn't need the overkill parent_reset logic we have today. Also
we want to use the same ICS type for the KVM and non-KVM case with
pseries.
Call icp_set_kvm_state() from the "simple" ICS reset function.
Signed-off-by: Greg Kurz <groug@kaod.org>
Message-Id: <155023082407.1011724.1983100830860273401.stgit@bahia.lan>
Reviewed-by: Cédric Le Goater <clg@kaod.org>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
---
hw/intc/xics.c | 4 ++++
hw/intc/xics_kvm.c | 18 ------------------
2 files changed, 4 insertions(+), 18 deletions(-)
diff --git a/hw/intc/xics.c b/hw/intc/xics.c
index ae5d5ea135..49401745c4 100644
--- a/hw/intc/xics.c
+++ b/hw/intc/xics.c
@@ -553,6 +553,10 @@ static void ics_simple_reset(DeviceState *dev)
ICSStateClass *icsc = ICS_BASE_GET_CLASS(dev);
icsc->parent_reset(dev);
+
+ if (kvm_irqchip_in_kernel()) {
+ ics_set_kvm_state(ICS_BASE(dev));
+ }
}
static void ics_simple_reset_handler(void *dev)
diff --git a/hw/intc/xics_kvm.c b/hw/intc/xics_kvm.c
index 642351e579..e7b8d4c29c 100644
--- a/hw/intc/xics_kvm.c
+++ b/hw/intc/xics_kvm.c
@@ -280,20 +280,6 @@ void ics_kvm_set_irq(void *opaque, int srcno, int val)
}
}
-static void ics_kvm_reset(DeviceState *dev)
-{
- ICSStateClass *icsc = ICS_BASE_GET_CLASS(dev);
-
- icsc->parent_reset(dev);
-
- ics_set_kvm_state(ICS_KVM(dev));
-}
-
-static void ics_kvm_reset_handler(void *dev)
-{
- ics_kvm_reset(dev);
-}
-
static void ics_kvm_realize(DeviceState *dev, Error **errp)
{
ICSState *ics = ICS_KVM(dev);
@@ -305,8 +291,6 @@ static void ics_kvm_realize(DeviceState *dev, Error **errp)
error_propagate(errp, local_err);
return;
}
-
- qemu_register_reset(ics_kvm_reset_handler, ics);
}
static void ics_kvm_class_init(ObjectClass *klass, void *data)
@@ -316,8 +300,6 @@ static void ics_kvm_class_init(ObjectClass *klass, void *data)
device_class_set_parent_realize(dc, ics_kvm_realize,
&icsc->parent_realize);
- device_class_set_parent_reset(dc, ics_kvm_reset,
- &icsc->parent_reset);
}
static const TypeInfo ics_kvm_info = {
--
2.20.1