Re: [PATCH v2 2/3] KVM: x86: generalize guest_cpuid_has_ helpers

From: David Hildenbrand
Date: Mon Aug 07 2017 - 04:34:37 EST


On 05.08.2017 00:12, Radim KrÄmÃÅ wrote:
> This patch turns guest_cpuid_has_XYZ(cpuid) into guest_cpuid_has(cpuid,
> X86_FEATURE_XYZ), which gets rid of many very similar helpers.
>
> When seeing a X86_FEATURE_*, we can know which cpuid it belongs to, but
> this information isn't in common code, so we recreate it for KVM.
>
> Add some BUILD_BUG_ONs to make sure that it runs nicely.
>
> Signed-off-by: Radim KrÄmÃÅ <rkrcmar@xxxxxxxxxx>
> ---
> v2:
> - fixed X86_FEATURE_RDTSCP (David)
> - renamed best to entry (David)
> - added const (David)
> - added __always_inline (Paolo)
> ---
> arch/x86/kvm/cpuid.h | 170 +++++++++++++++++----------------------------------
> arch/x86/kvm/mmu.c | 7 ++-
> arch/x86/kvm/mtrr.c | 2 +-
> arch/x86/kvm/svm.c | 2 +-
> arch/x86/kvm/vmx.c | 26 ++++----
> arch/x86/kvm/x86.c | 38 ++++++------
> 6 files changed, 95 insertions(+), 150 deletions(-)
>

Reviewed-by: David Hildenbrand <david@xxxxxxxxxx>


--

Thanks,

David