diff mbox

[5/3] ioapic: unify reset callbacks

Message ID 1351599394-24876-6-git-send-email-pbonzini@redhat.com (mailing list archive)
State New, archived
Headers show

Commit Message

Paolo Bonzini Oct. 30, 2012, 12:16 p.m. UTC
The reset callback of the in-kernel ioapic has to update the kernel
state.  This can be done for all "models" using ioapic_put.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 hw/ioapic.c          |    2 --
 hw/ioapic_common.c   |    2 ++
 hw/ioapic_internal.h |    2 --
 hw/kvm/ioapic.c      |    9 ---------
 4 files changed, 2 insertions(+), 13 deletions(-)
diff mbox

Patch

diff --git a/hw/ioapic.c b/hw/ioapic.c
index 7273095..c9f5993 100644
--- a/hw/ioapic.c
+++ b/hw/ioapic.c
@@ -238,10 +238,8 @@  static void ioapic_init(IOAPICCommonState *s, int instance_no)
 static void ioapic_class_init(ObjectClass *klass, void *data)
 {
     IOAPICCommonClass *k = IOAPIC_COMMON_CLASS(klass);
-    DeviceClass *dc = DEVICE_CLASS(klass);
 
     k->init = ioapic_init;
-    dc->reset = ioapic_reset_common;
 }
 
 static TypeInfo ioapic_info = {
diff --git a/hw/ioapic_common.c b/hw/ioapic_common.c
index 1f3ea37..37715ab 100644
--- a/hw/ioapic_common.c
+++ b/hw/ioapic_common.c
@@ -52,6 +52,7 @@  static void ioapic_reset_common(DeviceState *dev)
     for (i = 0; i < IOAPIC_NUM_PINS; i++) {
         s->ioredtbl[i] = 1 << IOAPIC_LVT_MASKED_SHIFT;
     }
+    ioapic_put(s);
 }
 
 static void ioapic_pre_save(void *opaque)
@@ -109,6 +110,7 @@  static void ioapic_common_class_init(ObjectClass *klass, void *data)
     DeviceClass *dc = DEVICE_CLASS(klass);
 
     sc->init = ioapic_init_common;
+    dc->reset = ioapic_reset_common;
     dc->vmsd = &vmstate_ioapic_common;
     dc->no_user = 1;
 }
diff --git a/hw/ioapic_internal.h b/hw/ioapic_internal.h
index 7311ad0..f8861a2 100644
--- a/hw/ioapic_internal.h
+++ b/hw/ioapic_internal.h
@@ -97,6 +97,4 @@  struct IOAPICCommonState {
     uint64_t ioredtbl[IOAPIC_NUM_PINS];
 };
 
-void ioapic_reset_common(DeviceState *dev);
-
 #endif /* !QEMU_IOAPIC_INTERNAL_H */
diff --git a/hw/kvm/ioapic.c b/hw/kvm/ioapic.c
index 03cb36c..41cfa08 100644
--- a/hw/kvm/ioapic.c
+++ b/hw/kvm/ioapic.c
@@ -69,14 +69,6 @@  static void kvm_ioapic_put(IOAPICCommonState *s)
     }
 }
 
-static void kvm_ioapic_reset(DeviceState *dev)
-{
-    IOAPICCommonState *s = DO_UPCAST(IOAPICCommonState, busdev.qdev, dev);
-
-    ioapic_reset_common(dev);
-    kvm_ioapic_put(s);
-}
-
 static void kvm_ioapic_set_irq(void *opaque, int irq, int level)
 {
     KVMIOAPICState *s = opaque;
@@ -106,7 +98,6 @@  static void kvm_ioapic_class_init(ObjectClass *klass, void *data)
     k->init      = kvm_ioapic_init;
     k->get       = kvm_ioapic_get;
     k->put       = kvm_ioapic_put;
-    dc->reset    = kvm_ioapic_reset;
     dc->props    = kvm_ioapic_properties;
 }