Patchwork [uq/master] kvmclock: Fix feature detection

login
register
mail settings
Submitter Jan Kiszka
Date June 23, 2011, 8:23 a.m.
Message ID <4E02F7EE.6050000@web.de>
Download mbox | patch
Permalink /patch/101602/
State New
Headers show

Comments

Jan Kiszka - June 23, 2011, 8:23 a.m.
From: Jan Kiszka <jan.kiszka@siemens.com>

Bit-wise or the feature flags and drop the obsolete #ifdef.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
 hw/kvmclock.c |    7 ++-----
 1 files changed, 2 insertions(+), 5 deletions(-)
Marcelo Tosatti - July 4, 2011, 6:37 p.m.
On Thu, Jun 23, 2011 at 10:23:10AM +0200, Jan Kiszka wrote:
> From: Jan Kiszka <jan.kiszka@siemens.com>
> 
> Bit-wise or the feature flags and drop the obsolete #ifdef.
> 
> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
> ---
>  hw/kvmclock.c |    7 ++-----
>  1 files changed, 2 insertions(+), 5 deletions(-)

Applied, thanks.
Jan Kiszka - Aug. 4, 2011, 7:06 a.m.
On 2011-07-04 20:37, Marcelo Tosatti wrote:
> On Thu, Jun 23, 2011 at 10:23:10AM +0200, Jan Kiszka wrote:
>> From: Jan Kiszka <jan.kiszka@siemens.com>
>>
>> Bit-wise or the feature flags and drop the obsolete #ifdef.
>>
>> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
>> ---
>>  hw/kvmclock.c |    7 ++-----
>>  1 files changed, 2 insertions(+), 5 deletions(-)
> 
> Applied, thanks.

Please note that this stable-relevant bug fix is still stuck in
uq/master. It should be able to break migration from older versions as
the kvmclock vmstate is generated/expected incorrectly even if the
feature is disabled.

Jan

Patch

diff --git a/hw/kvmclock.c b/hw/kvmclock.c
index 692ad18..b73aec4 100644
--- a/hw/kvmclock.c
+++ b/hw/kvmclock.c
@@ -101,11 +101,8 @@  static SysBusDeviceInfo kvmclock_info = {
 void kvmclock_create(void)
 {
     if (kvm_enabled() &&
-        first_cpu->cpuid_kvm_features & ((1ULL << KVM_FEATURE_CLOCKSOURCE)
-#ifdef KVM_FEATURE_CLOCKSOURCE2
-        || (1ULL << KVM_FEATURE_CLOCKSOURCE2)
-#endif
-    )) {
+        first_cpu->cpuid_kvm_features & ((1ULL << KVM_FEATURE_CLOCKSOURCE) |
+                                         (1ULL << KVM_FEATURE_CLOCKSOURCE2))) {
         sysbus_create_simple("kvmclock", -1, NULL);
     }
 }