Skip to contentSkip to conversation

kvmclock: Always register type

PATCH Superseded Andreas Färber 2 participants 3 messages Feb 17, 2012

v1 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 kvmclock: Always register type

Currently, the "kvmclock" type is only registered when kvm_enabled().

This breaks when moving type registration to before command line parsing (so that QOM types can be used for CPU and machine).

Since the QOM classes are lazy-initialized anyway and kvmclock_create() has another kvm_enabled() check, simply drop the KVM check in kvmclock_register_types().

kvm-i8259, kvm-apic and kvm-ioapic do not suffer from such a check.

Cc Jan Kiszka <[email protected]>
Cc Marcelo Tosatti <[email protected]>
---
 hw/kvm/clock.c |    2 --
 1 files changed, 0 insertions(+), 2 deletions(-)
hw/kvm/clock.c +0 -2
index 2157340..446bd62 100644
@@ -121,9 +121,7 @@ void kvmclock_create(void)
 
 static void kvmclock_register_types(void)
 {
-    if (kvm_enabled()) {
     type_register_static(&kvmclock_info);
-    }
 }
 
 type_init(kvmclock_register_types)
Signature · 1 line
1.7.7
Reviewed-by on v1 1/1
#1 lore raw
Quoted 23 lines · Andreas Färber

Currently, the "kvmclock" type is only registered when kvm_enabled().

This breaks when moving type registration to before command line parsing (so that QOM types can be used for CPU and machine).

Since the QOM classes are lazy-initialized anyway and kvmclock_create() has another kvm_enabled() check, simply drop the KVM check in kvmclock_register_types().

kvm-i8259, kvm-apic and kvm-ioapic do not suffer from such a check.

Cc Jan Kiszka <[email protected]>
Cc Marcelo Tosatti <[email protected]>
---
 hw/kvm/clock.c |    2 --
 1 files changed, 0 insertions(+), 2 deletions(-)
hw/kvm/clock.c +0 -0
index 2157340..446bd62 100644

hw/kvm/clock.c void kvmclock_create(void) · line 127

Quoted 9 lines
hw/kvm/clock.c +0 -2
@@ -121,9 +121,7 @@ void kvmclock_create(void)
 
 static void kvmclock_register_types(void)
 {
-    if (kvm_enabled()) {
     type_register_static(&kvmclock_info);
-    }
 }
 
 type_init(kvmclock_register_types)

uq/master stuff or do other changes need it earlier?

Signature · 2 lines
Siemens AG, Corporate Technology, CT T DE IT 1
Corporate Competence Center Embedded Linux
#2 lore raw

Am 17.02.2012 10:33, schrieb Jan Kiszka:

Quoted 32 lines · Andreas Färber
Quoted 31 lines

Currently, the "kvmclock" type is only registered when kvm_enabled().

This breaks when moving type registration to before command line parsing (so that QOM types can be used for CPU and machine).

Since the QOM classes are lazy-initialized anyway and kvmclock_create() has another kvm_enabled() check, simply drop the KVM check in kvmclock_register_types().

kvm-i8259, kvm-apic and kvm-ioapic do not suffer from such a check.

Cc Jan Kiszka <[email protected]>
Cc Marcelo Tosatti <[email protected]>
---
 hw/kvm/clock.c |    2 --
 1 files changed, 0 insertions(+), 2 deletions(-)
hw/kvm/clock.c +0 -2
index 2157340..446bd62 100644
@@ -121,9 +121,7 @@ void kvmclock_create(void)
 
 static void kvmclock_register_types(void)
 {
-    if (kvm_enabled()) {
     type_register_static(&kvmclock_info);
-    }
 }
 
Quoted 5 lines

hw/kvm/clock.c void kvmclock_create(void) · line 127

Quoted 1 line
hw/kvm/clock.c +0 -0
 type_init(kvmclock_register_types)

uq/master stuff or do other changes need it earlier?

Yes, uq/master will be fine. Thanks.

I'll prepend it to my qom-cpu branch for now, but since that's getting rather large for my taste (50+), I'm pushing independent bits out early.

Andreas

Signature · 2 lines
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg