From: Sean Christopherson <seanjc@google.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: kvm@vger.kernel.org, linux-kernel@vger.kernel.org,
Sean Christopherson <seanjc@google.com>
Subject: [GIT PULL] KVM: Symbol export restrictions for 6.18
Date: Fri, 26 Sep 2025 23:09:10 -0700 [thread overview]
Message-ID: <20250927060910.2933942-11-seanjc@google.com> (raw)
In-Reply-To: <20250927060910.2933942-1-seanjc@google.com>
Note! If possible, and you're feeling generous, please merge this dead last
and manually convert any new KVM exports to EXPORT_SYMBOL_FOR_KVM_INTERNAL so
that there are no unwanted exports.
Three new exports are coming in via other kvm-x86 pull requests; I've been
"fixing" them as part of the merge into kvm-x86/next (see diff below), so those
at least have gotten coverage in -next.
Note #2, this is based on the "misc" branch/pull, but includes a backmerge of
v6.17-rc3. I posted the patches against kvm-x86/next to avoid an annoying
conflict (which I can't even remember at this point), and then didn't realize
I needed v6.17-rc3 to pick up the EXPORT_SYMBOL_GPL_FOR_MODULES =>
EXPORT_SYMBOL_FOR_MODULES rename that snuck in until the 0-day bot yelled
because the branch didn't compile (I only tested when merged on top of
kvm/next, doh).
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index e96080cba540..3d4ec1806d3e 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -695,7 +695,7 @@ u64 kvm_get_user_return_msr(unsigned int slot)
{
return this_cpu_ptr(user_return_msrs)->values[slot].curr;
}
-EXPORT_SYMBOL_GPL(kvm_get_user_return_msr);
+EXPORT_SYMBOL_FOR_KVM_INTERNAL(kvm_get_user_return_msr);
static void drop_user_return_notifiers(void)
{
@@ -1304,7 +1304,7 @@ int __kvm_set_xcr(struct kvm_vcpu *vcpu, u32 index, u64 xcr)
vcpu->arch.cpuid_dynamic_bits_dirty = true;
return 0;
}
-EXPORT_SYMBOL_GPL(__kvm_set_xcr);
+EXPORT_SYMBOL_FOR_KVM_INTERNAL(__kvm_set_xcr);
int kvm_emulate_xsetbv(struct kvm_vcpu *vcpu)
{
diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
index b99eb34174af..83a1b4dbbbd8 100644
--- a/virt/kvm/kvm_main.c
+++ b/virt/kvm/kvm_main.c
@@ -2661,7 +2661,7 @@ struct kvm_memory_slot *kvm_vcpu_gfn_to_memslot(struct kvm_vcpu *vcpu, gfn_t gfn
return NULL;
}
-EXPORT_SYMBOL_GPL(kvm_vcpu_gfn_to_memslot);
+EXPORT_SYMBOL_FOR_KVM_INTERNAL(kvm_vcpu_gfn_to_memslot);
bool kvm_is_visible_gfn(struct kvm *kvm, gfn_t gfn)
{
The following changes since commit 1b237f190eb3d36f52dffe07a40b5eb210280e00:
Linux 6.17-rc3 (2025-08-24 12:04:12 -0400)
are available in the Git repository at:
https://github.com/kvm-x86/linux.git tags/kvm-x86-exports-6.18
for you to fetch changes up to aca2a0fa7796cf026a39a49ef9325755a9ead932:
KVM: x86: Export KVM-internal symbols for sub-modules only (2025-09-24 07:01:30 -0700)
----------------------------------------------------------------
KVM symbol export restrictions for 6.18
Use the newfangled EXPORT_SYMBOL_FOR_MODULES() along with some macro
shenanigans to export KVM-internal symbols if and only if KVM has one or
more sub-modules, and only for those sub-modules, e.g. x86's kvm-amd.ko
and/or kvm-intel.ko, and PPC's many varieties of sub-modules.
Define the macros in the kvm_types.h so that the core logic is visible outside
of KVM, so that the logic can be reused in the future to further restrict
kernel exports that exist purely for KVM (x86 in particular has a _lot_ of
exports that are used only by KVM).
----------------------------------------------------------------
Sean Christopherson (6):
Merge 'v6.17-rc3' into 'exports' to EXPORT_SYMBOL_FOR_MODULES rename
KVM: s390/vfio-ap: Use kvm_is_gpa_in_memslot() instead of open coded equivalent
KVM: Export KVM-internal symbols for sub-modules only
KVM: x86: Move kvm_intr_is_single_vcpu() to lapic.c
KVM: x86: Drop pointless exports of kvm_arch_xxx() hooks
KVM: x86: Export KVM-internal symbols for sub-modules only
arch/powerpc/include/asm/Kbuild | 1 -
arch/powerpc/include/asm/kvm_types.h | 15 +++++++++
arch/s390/include/asm/kvm_host.h | 2 ++
arch/s390/kvm/priv.c | 8 +++++
arch/x86/include/asm/kvm_host.h | 3 --
arch/x86/include/asm/kvm_types.h | 10 ++++++
arch/x86/kvm/cpuid.c | 10 +++---
arch/x86/kvm/hyperv.c | 4 +--
arch/x86/kvm/irq.c | 34 ++------------------
arch/x86/kvm/kvm_onhyperv.c | 6 ++--
arch/x86/kvm/lapic.c | 71 +++++++++++++++++++++++++++++-------------
arch/x86/kvm/lapic.h | 4 +--
arch/x86/kvm/mmu/mmu.c | 36 ++++++++++-----------
arch/x86/kvm/mmu/spte.c | 10 +++---
arch/x86/kvm/mmu/tdp_mmu.c | 2 +-
arch/x86/kvm/pmu.c | 10 +++---
arch/x86/kvm/smm.c | 2 +-
arch/x86/kvm/x86.c | 219 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-----------------------------------------------------------------
drivers/s390/crypto/vfio_ap_ops.c | 2 +-
include/linux/kvm_types.h | 25 ++++++++++-----
virt/kvm/eventfd.c | 2 +-
virt/kvm/guest_memfd.c | 4 +--
virt/kvm/kvm_main.c | 126 +++++++++++++++++++++++++++++++++++++-------------------------------------
23 files changed, 323 insertions(+), 283 deletions(-)
create mode 100644 arch/powerpc/include/asm/kvm_types.h
next prev parent reply other threads:[~2025-09-27 6:09 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-27 6:09 [GIT PULL] KVM: x86 pull requests 6.18 Sean Christopherson
2025-09-27 6:09 ` [GIT PULL] x86/kvm: Guest side changes for 6.18 Sean Christopherson
2025-09-30 17:28 ` Paolo Bonzini
2025-09-27 6:09 ` [GIT PULL] KVM: One lone common change " Sean Christopherson
2025-09-30 17:28 ` Paolo Bonzini
2025-09-27 6:09 ` [GIT PULL] KVM: x86: MMU changes " Sean Christopherson
2025-09-30 17:33 ` Paolo Bonzini
2025-09-27 6:09 ` [GIT PULL] KVM: Selftests " Sean Christopherson
2025-09-30 17:24 ` Paolo Bonzini
2025-09-27 6:09 ` [GIT PULL] KVM: x86: VMX " Sean Christopherson
2025-09-30 17:33 ` Paolo Bonzini
2025-09-27 6:09 ` [GIT PULL] KVM: x86: SVM " Sean Christopherson
2025-09-30 17:35 ` Paolo Bonzini
2025-09-27 6:09 ` [GIT PULL] KVM: x86: SNP CipherTextHiding " Sean Christopherson
2025-09-30 17:35 ` Paolo Bonzini
2025-09-27 6:09 ` [GIT PULL] KVM: x86: Misc changes " Sean Christopherson
2025-09-30 18:06 ` Paolo Bonzini
2025-09-27 6:09 ` [GIT PULL] KVM: x86: CET virtualization " Sean Christopherson
2025-09-27 6:09 ` Sean Christopherson [this message]
2025-09-30 17:41 ` [GIT PULL] KVM: Symbol export restrictions " Paolo Bonzini
2025-09-30 18:10 ` [GIT PULL] KVM: x86 pull requests 6.18 Paolo Bonzini
2025-09-30 19:16 ` Sean Christopherson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250927060910.2933942-11-seanjc@google.com \
--to=seanjc@google.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=pbonzini@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®