]> git.proxmox.com Git - mirror_ubuntu-jammy-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)
committerAndrea Righi <andrea.righi@canonical.com>
Tue, 4 Jan 2022 08:49:41 +0000 (09:49 +0100)
commit61e0573e6c62fa8f1bd726c4e36126c335c662ca
treea99a3f6feeab237dd6e9f4f2943f6d74211f8615
parentf25a7f5b67438084146bee6cddfb4ecc9a10a1e5
selftests: KVM: Fix non-x86 compiling

BugLink: https://bugs.launchpad.net/bugs/1956305
commit 577e022b7b41854911dcfb03678d8d2b930e8a3f upstream.

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: c8cc43c1eae2 ("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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Andrea Righi <andrea.righi@canonical.com>
tools/testing/selftests/kvm/include/kvm_util.h
tools/testing/selftests/kvm/lib/kvm_util.c