]> git.baikalelectronics.ru Git - kernel.git/commit
selftests: KVM: Fix non-x86 compiling
authorAndrew Jones <drjones@redhat.com>
Tue, 14 Dec 2021 15:18:42 +0000 (16:18 +0100)
committerPaolo Bonzini <pbonzini@redhat.com>
Mon, 20 Dec 2021 13:06:54 +0000 (08:06 -0500)
commit3be8c7e6a1ae99142c31a52a5d6a25c23c7ea0c3
tree5e0ad68c2366c356da194f9474d0d40b16d84b5b
parent7f2e1f432106250a1700c17a83e027cc9745fe7d
selftests: KVM: Fix non-x86 compiling

Attempting to compile on a non-x86 architecture fails with

include/kvm_util.h: In function â€˜vm_compute_max_gfn’:
include/kvm_util.h:79:21: error: dereferencing pointer to incomplete type â€˜struct kvm_vm’
  return ((1ULL << vm->pa_bits) >> vm->page_shift) - 1;
                     ^~

This is because the declaration of struct kvm_vm is in
lib/kvm_util_internal.h as an effort to make it private to
the test lib code. We can still provide arch specific functions,
though, by making the generic function symbols weak. Do that to
fix the compile error.

Fixes: 1c5c26c16f4c ("selftests: KVM: avoid failures due to reserved HyperTransport region")
Cc: stable@vger.kernel.org
Signed-off-by: Andrew Jones <drjones@redhat.com>
Message-Id: <20211214151842.848314-1-drjones@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
tools/testing/selftests/kvm/include/kvm_util.h
tools/testing/selftests/kvm/lib/kvm_util.c