Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1705235

Re: [PATCH v2 1/3] KVM: x86: X86_FEATURE_NRIPS is not scattered anymore

From David Hildenbrand <david@redhat.com>
Newsgroups linux.kernel
Subject Re: [PATCH v2 1/3] KVM: x86: X86_FEATURE_NRIPS is not scattered anymore
Date 2017-08-07 10:30 +0200
Message-ID <ubLAf-5Ov-21@gated-at.bofh.it> (permalink)
References <uaT6N-4ub-7@gated-at.bofh.it> <uaT6P-4ub-25@gated-at.bofh.it>
Organization Red Hat GmbH

Show all headers | View raw


On 05.08.2017 00:12, Radim Krčmář wrote:
> bit(X86_FEATURE_NRIPS) is 3 since 2ccd71f1b278 ("x86/cpufeature: Move
> some of the scattered feature bits to x86_capability"), so we can
> simplify the code.
> 
> Signed-off-by: Radim Krčmář <rkrcmar@redhat.com>
> ---
> v2: new, explain why it's ok to use X86_FEATURE_NRIPS (David)
> ---
>  arch/x86/kvm/cpuid.h | 14 +-------------
>  1 file changed, 1 insertion(+), 13 deletions(-)
> 
> diff --git a/arch/x86/kvm/cpuid.h b/arch/x86/kvm/cpuid.h
> index da6728383052..c723d64657d0 100644
> --- a/arch/x86/kvm/cpuid.h
> +++ b/arch/x86/kvm/cpuid.h
> @@ -160,25 +160,13 @@ static inline bool guest_cpuid_has_rdtscp(struct kvm_vcpu *vcpu)
>  	return best && (best->edx & bit(X86_FEATURE_RDTSCP));
>  }
>  
> -/*
> - * NRIPS is provided through cpuidfn 0x8000000a.edx bit 3
> - */
> -#define BIT_NRIPS	3
> -
>  static inline bool guest_cpuid_has_nrips(struct kvm_vcpu *vcpu)
>  {
>  	struct kvm_cpuid_entry2 *best;
>  
>  	best = kvm_find_cpuid_entry(vcpu, 0x8000000a, 0);
> -
> -	/*
> -	 * NRIPS is a scattered cpuid feature, so we can't use
> -	 * X86_FEATURE_NRIPS here (X86_FEATURE_NRIPS would be bit
> -	 * position 8, not 3).
> -	 */
> -	return best && (best->edx & bit(BIT_NRIPS));
> +	return best && (best->edx & bit(X86_FEATURE_NRIPS));
>  }
> -#undef BIT_NRIPS
>  
>  static inline int guest_cpuid_family(struct kvm_vcpu *vcpu)
>  {
> 

Reviewed-by: David Hildenbrand <david@redhat.com>

-- 

Thanks,

David

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v2 0/3] KVM: x86: generalize guest cpuid helpers Radim Krčmář <rkrcmar@redhat.com> - 2017-08-05 00:20 +0200
  [PATCH v2 3/3] KVM: x86: use general helpers for some cpuid manipulation Radim Krčmář <rkrcmar@redhat.com> - 2017-08-05 00:20 +0200
    Re: [PATCH v2 3/3] KVM: x86: use general helpers for some cpuid  manipulation David Hildenbrand <david@redhat.com> - 2017-08-07 10:40 +0200
  [PATCH v2 1/3] KVM: x86: X86_FEATURE_NRIPS is not scattered anymore Radim Krčmář <rkrcmar@redhat.com> - 2017-08-05 00:20 +0200
    Re: [PATCH v2 1/3] KVM: x86: X86_FEATURE_NRIPS is not scattered  anymore David Hildenbrand <david@redhat.com> - 2017-08-07 10:30 +0200
  [PATCH v2 2/3] KVM: x86: generalize guest_cpuid_has_ helpers Radim Krčmář <rkrcmar@redhat.com> - 2017-08-05 00:20 +0200
    Re: [PATCH v2 2/3] KVM: x86: generalize guest_cpuid_has_ helpers David Hildenbrand <david@redhat.com> - 2017-08-07 10:40 +0200
  Re: [PATCH v2 0/3] KVM: x86: generalize guest cpuid helpers Paolo Bonzini <pbonzini@redhat.com> - 2017-08-07 16:20 +0200

csiph-web