diff options
author | Anthony Liguori <aliguori@us.ibm.com> | 2012-01-24 13:12:29 -0600 |
---|---|---|
committer | Anthony Liguori <aliguori@us.ibm.com> | 2012-01-27 10:50:50 -0600 |
commit | 999e12bbe85c5dcf49bef13bce4f97399c7105f4 (patch) | |
tree | 73b6ed8633a73134e9f728baa1ed2b1dab58b5b0 /hw/kvm | |
parent | 40021f08882aaef93c66c8c740087b6d3031b63a (diff) |
sysbus: apic: ioapic: convert to QEMU Object Model
This converts three devices because apic and ioapic are subclasses of sysbus.
Converting subclasses independently of their base class is prohibitively hard.
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'hw/kvm')
-rw-r--r-- | hw/kvm/apic.c | 19 | ||||
-rw-r--r-- | hw/kvm/clock.c | 19 | ||||
-rw-r--r-- | hw/kvm/ioapic.c | 23 |
3 files changed, 41 insertions, 20 deletions
diff --git a/hw/kvm/apic.c b/hw/kvm/apic.c index 6300695e86..bc80ae4ede 100644 --- a/hw/kvm/apic.c +++ b/hw/kvm/apic.c @@ -122,12 +122,19 @@ static void kvm_apic_init(APICCommonState *s) MSI_SPACE_SIZE); } -static APICCommonInfo kvm_apic_info = { - .busdev.qdev.name = "kvm-apic", - .init = kvm_apic_init, - .set_base = kvm_apic_set_base, - .set_tpr = kvm_apic_set_tpr, - .external_nmi = kvm_apic_external_nmi, +static void kvm_apic_class_init(ObjectClass *klass, void *data) +{ + APICCommonClass *k = APIC_COMMON_CLASS(klass); + + k->init = kvm_apic_init; + k->set_base = kvm_apic_set_base; + k->set_tpr = kvm_apic_set_tpr; + k->external_nmi = kvm_apic_external_nmi; +} + +static DeviceInfo kvm_apic_info = { + .name = "kvm-apic", + .class_init = kvm_apic_class_init, }; static void kvm_apic_register_device(void) diff --git a/hw/kvm/clock.c b/hw/kvm/clock.c index bb28c088db..b997d2a388 100644 --- a/hw/kvm/clock.c +++ b/hw/kvm/clock.c @@ -92,12 +92,19 @@ static const VMStateDescription kvmclock_vmsd = { } }; -static SysBusDeviceInfo kvmclock_info = { - .qdev.name = "kvmclock", - .qdev.size = sizeof(KVMClockState), - .qdev.vmsd = &kvmclock_vmsd, - .qdev.no_user = 1, - .init = kvmclock_init, +static void kvmclock_class_init(ObjectClass *klass, void *data) +{ + SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass); + + k->init = kvmclock_init; +} + +static DeviceInfo kvmclock_info = { + .name = "kvmclock", + .size = sizeof(KVMClockState), + .vmsd = &kvmclock_vmsd, + .no_user = 1, + .class_init = kvmclock_class_init, }; /* Note: Must be called after VCPU initialization. */ diff --git a/hw/kvm/ioapic.c b/hw/kvm/ioapic.c index 10ffdd4b20..f8ea0cc31a 100644 --- a/hw/kvm/ioapic.c +++ b/hw/kvm/ioapic.c @@ -93,17 +93,24 @@ static void kvm_ioapic_init(IOAPICCommonState *s, int instance_no) qdev_init_gpio_in(&s->busdev.qdev, kvm_ioapic_set_irq, IOAPIC_NUM_PINS); } -static IOAPICCommonInfo kvm_ioapic_info = { - .busdev.qdev.name = "kvm-ioapic", - .busdev.qdev.size = sizeof(KVMIOAPICState), - .busdev.qdev.reset = kvm_ioapic_reset, - .busdev.qdev.props = (Property[]) { +static void kvm_ioapic_class_init(ObjectClass *klass, void *data) +{ + IOAPICCommonClass *k = IOAPIC_COMMON_CLASS(klass); + + k->init = kvm_ioapic_init; + k->pre_save = kvm_ioapic_get; + k->post_load = kvm_ioapic_put; +} + +static DeviceInfo kvm_ioapic_info = { + .name = "kvm-ioapic", + .size = sizeof(KVMIOAPICState), + .reset = kvm_ioapic_reset, + .class_init = kvm_ioapic_class_init, + .props = (Property[]) { DEFINE_PROP_UINT32("gsi_base", KVMIOAPICState, kvm_gsi_base, 0), DEFINE_PROP_END_OF_LIST() }, - .init = kvm_ioapic_init, - .pre_save = kvm_ioapic_get, - .post_load = kvm_ioapic_put, }; static void kvm_ioapic_register_device(void) |