aboutsummaryrefslogtreecommitdiff
path: root/hw/intc/xics.c
diff options
context:
space:
mode:
authorDavid Gibson <david@gibson.dropbear.id.au>2019-09-24 14:19:22 +1000
committerDavid Gibson <david@gibson.dropbear.id.au>2019-10-04 19:08:22 +1000
commitda2ef5b2f24be70d4fa0b05fd6799031cd3a456e (patch)
tree958f37282b5e2b1fb4a398e66e72052fdd7fa5f1 /hw/intc/xics.c
parent28976c99cfa59e1880a86a59af20099eba62f5e7 (diff)
xics: Eliminate reset hook
Currently TYPE_XICS_BASE and TYPE_XICS_SIMPLE have their own reset methods, using the standard technique for having the subtype call the supertype's methods before doing its own thing. But TYPE_XICS_SIMPLE is the only subtype of TYPE_XICS_BASE ever instantiated, so there's no point having the split here. Merge them together into just an ics_reset() function. Signed-off-by: David Gibson <david@gibson.dropbear.id.au> Reviewed-by: Cédric Le Goater <clg@kaod.org> Reviewed-by: Greg Kurz <groug@kaod.org>
Diffstat (limited to 'hw/intc/xics.c')
-rw-r--r--hw/intc/xics.c57
1 files changed, 24 insertions, 33 deletions
diff --git a/hw/intc/xics.c b/hw/intc/xics.c
index 310dc72b46..82e6f09259 100644
--- a/hw/intc/xics.c
+++ b/hw/intc/xics.c
@@ -547,11 +547,28 @@ static void ics_eoi(ICSState *ics, uint32_t nr)
}
}
-static void ics_simple_reset(DeviceState *dev)
+static void ics_reset_irq(ICSIRQState *irq)
{
- ICSStateClass *icsc = ICS_BASE_GET_CLASS(dev);
+ irq->priority = 0xff;
+ irq->saved_priority = 0xff;
+}
- icsc->parent_reset(dev);
+static void ics_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_reset_irq(ics->irqs + i);
+ ics->irqs[i].flags = flags[i];
+ }
if (kvm_irqchip_in_kernel()) {
Error *local_err = NULL;
@@ -563,9 +580,9 @@ static void ics_simple_reset(DeviceState *dev)
}
}
-static void ics_simple_reset_handler(void *dev)
+static void ics_reset_handler(void *dev)
{
- ics_simple_reset(dev);
+ ics_reset(dev);
}
static void ics_simple_realize(DeviceState *dev, Error **errp)
@@ -580,7 +597,7 @@ static void ics_simple_realize(DeviceState *dev, Error **errp)
return;
}
- qemu_register_reset(ics_simple_reset_handler, ics);
+ qemu_register_reset(ics_reset_handler, ics);
}
static void ics_simple_class_init(ObjectClass *klass, void *data)
@@ -590,8 +607,6 @@ 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);
}
static const TypeInfo ics_simple_info = {
@@ -602,30 +617,6 @@ static const TypeInfo ics_simple_info = {
.class_size = sizeof(ICSStateClass),
};
-static void ics_reset_irq(ICSIRQState *irq)
-{
- irq->priority = 0xff;
- irq->saved_priority = 0xff;
-}
-
-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_reset_irq(ics->irqs + i);
- ics->irqs[i].flags = flags[i];
- }
-}
-
static void ics_base_realize(DeviceState *dev, Error **errp)
{
ICSState *ics = ICS_BASE(dev);
@@ -726,7 +717,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->reset = ics_reset;
dc->vmsd = &vmstate_ics_base;
}