]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
KVM: Export KVM-internal symbols for sub-modules only
authorSean Christopherson <seanjc@google.com>
Fri, 19 Sep 2025 00:33:00 +0000 (17:33 -0700)
committerPaolo Bonzini <pbonzini@redhat.com>
Tue, 30 Sep 2025 17:40:02 +0000 (13:40 -0400)
commit20c48920583675e67b3824f147726e0fbda735ce
tree6920b8eaae52332786b4e02dc305533071beb07a
parent15463eece957be34da64b4d6fe18fc98981bf487
KVM: Export KVM-internal symbols for sub-modules only

Rework the vast majority of KVM's exports to expose symbols only to KVM
submodules, i.e. to x86's kvm-{amd,intel}.ko and PPC's kvm-{pr,hv}.ko.
With few exceptions, KVM's exported APIs are intended (and safe) for KVM-
internal usage only.

Keep kvm_get_kvm(), kvm_get_kvm_safe(), and kvm_put_kvm() as normal
exports, as they are needed by VFIO, and are generally safe for external
usage (though ideally even the get/put APIs would be KVM-internal, and
VFIO would pin a VM by grabbing a reference to its associated file).

Implement a framework in kvm_types.h in anticipation of providing a macro
to restrict KVM-specific kernel exports, i.e. to provide symbol exports
for KVM if and only if KVM is built as one or more modules.

Link: https://lore.kernel.org/r/20250919003303.1355064-3-seanjc@google.com
Cc: Nathan Chancellor <nathan@kernel.org>
Signed-off-by: Sean Christopherson <seanjc@google.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/powerpc/include/asm/Kbuild
arch/powerpc/include/asm/kvm_types.h [new file with mode: 0644]
arch/x86/include/asm/kvm_types.h
include/linux/kvm_types.h
virt/kvm/eventfd.c
virt/kvm/guest_memfd.c
virt/kvm/kvm_main.c