diff mbox series

KVM: selftests: fix bit test in is_steal_time_supported()

Message ID YtZ/Rnrm8Y+uPjDq@kili (mailing list archive)
State New
Headers show
Series KVM: selftests: fix bit test in is_steal_time_supported() | expand

Commit Message

Dan Carpenter July 19, 2022, 9:54 a.m. UTC
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 <dan.carpenter@oracle.com>
---
 tools/testing/selftests/kvm/steal_time.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Paolo Bonzini July 19, 2022, 12:59 p.m. UTC | #1
On 7/19/22 11:54, Dan Carpenter wrote:
> 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 <dan.carpenter@oracle.com>
> ---
>   tools/testing/selftests/kvm/steal_time.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/tools/testing/selftests/kvm/steal_time.c b/tools/testing/selftests/kvm/steal_time.c
> index d122f1e05cdd..b89f0cfa2dc3 100644
> --- a/tools/testing/selftests/kvm/steal_time.c
> +++ b/tools/testing/selftests/kvm/steal_time.c
> @@ -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
diff mbox series

Patch

diff --git a/tools/testing/selftests/kvm/steal_time.c b/tools/testing/selftests/kvm/steal_time.c
index d122f1e05cdd..b89f0cfa2dc3 100644
--- a/tools/testing/selftests/kvm/steal_time.c
+++ b/tools/testing/selftests/kvm/steal_time.c
@@ -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)