KVM: selftests: fix bit test in is_steal_time_supported()
Subsystems (3)
PATCH 1/1 KVM: selftests: fix bit test in is_steal_time_supported()
The KVM_FEATURE_STEAL_TIME (5) define is the BIT() value so we need to do shift for this to work correctly.
Fixes 998016048221 ("KVM: selftests: Convert steal_time away from VCPU_ID")
Signed-off-by Dan Carpenter <[email protected]>
--- tools/testing/selftests/kvm/steal_time.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/selftests/kvm/steal_time.c +1 -1
@@ -62,7 +62,7 @@ static bool is_steal_time_supported(struct kvm_vcpu *vcpu) {struct kvm_cpuid_entry2 *cpuid =kvm_get_supported_cpuid_entry (KVM_CPUID_FEATURES ); -return cpuid && (cpuid->eax &KVM_FEATURE_STEAL_TIME ); +return cpuid && (cpuid->eax & (1 <<KVM_FEATURE_STEAL_TIME )); }static void steal_time_init (struct kvm_vcpu *vcpu,uint32_t i)
Signature · 1 line
2.35.1
Paolo Bonzini
maintainerQuoted 14 lines · Dan Carpenter
The
KVM_FEATURE_STEAL_TIME(5) define is theBIT()value so we need to do shift for this to work correctly.Fixes 998016048221 ("KVM: selftests: Convert steal_time away from VCPU_ID")Signed-off-by Dan Carpenter <[email protected]>--- tools/testing/selftests/kvm/steal_time.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)tools/testing/selftests/kvm/steal_time.c +0
-0
tools/testing/selftests/kvm/steal_time.c static bool is_steal_time_supported(struct kvm_vcpu *vcpu) · line 68
Quoted 8 lines
tools/testing/selftests/kvm/steal_time.c +1
-1@@ -62,7 +62,7 @@ static bool is_steal_time_supported(struct kvm_vcpu *vcpu) {struct kvm_cpuid_entry2 *cpuid =kvm_get_supported_cpuid_entry (KVM_CPUID_FEATURES ); -return cpuid && (cpuid->eax &KVM_FEATURE_STEAL_TIME ); +return cpuid && (cpuid->eax & (1 <<KVM_FEATURE_STEAL_TIME )); }static void steal_time_init (struct kvm_vcpu *vcpu,uint32_t i)
This is already fixed in kvm/queue, but also actually the Fixes tag would have to date back to commit 94c4b76b88d4 ("KVM: selftests: Introduce steal-time test", 2020-03-16).
Paolo