Skip to content

Commit ba1f77c

Browse files
Leonardo Brasbonzini
authored andcommitted
x86/kvm: Fix compilation warning in non-x86_64 builds
On non-x86_64 builds, helpers gtod_is_based_on_tsc() and kvm_guest_supported_xfd() are defined but never used. Because these are static inline but are in a .c file, some compilers do warn for them with -Wunused-function, which becomes an error if -Werror is present. Add #ifdef so they are only defined in x86_64 builds. Reported-by: kernel test robot <lkp@intel.com> Signed-off-by: Leonardo Bras <leobras@redhat.com> Message-Id: <20220218034100.115702-1-leobras@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
1 parent 988896b commit ba1f77c

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

arch/x86/kvm/x86.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -989,10 +989,12 @@ static inline u64 kvm_guest_supported_xcr0(struct kvm_vcpu *vcpu)
989989
return vcpu->arch.guest_fpu.fpstate->user_xfeatures;
990990
}
991991

992+
#ifdef CONFIG_X86_64
992993
static inline u64 kvm_guest_supported_xfd(struct kvm_vcpu *vcpu)
993994
{
994995
return kvm_guest_supported_xcr0(vcpu) & XFEATURE_MASK_USER_DYNAMIC;
995996
}
997+
#endif
996998

997999
static int __kvm_set_xcr(struct kvm_vcpu *vcpu, u32 index, u64 xcr)
9981000
{
@@ -2361,10 +2363,12 @@ static u64 compute_guest_tsc(struct kvm_vcpu *vcpu, s64 kernel_ns)
23612363
return tsc;
23622364
}
23632365

2366+
#ifdef CONFIG_X86_64
23642367
static inline int gtod_is_based_on_tsc(int mode)
23652368
{
23662369
return mode == VDSO_CLOCKMODE_TSC || mode == VDSO_CLOCKMODE_HVCLOCK;
23672370
}
2371+
#endif
23682372

23692373
static void kvm_track_tsc_matching(struct kvm_vcpu *vcpu)
23702374
{

0 commit comments

Comments
 (0)