Re: [PATCH v2 2/5] KVM: Export KVM-internal symbols for sub-modules only

Nathan Chancellor
2025-09-23T01:27:45Z

Hi Sean,

On Thu, Sep 18, 2025 at 05:33:00PM -0700, Sean Christopherson wrote:
> diff --git a/arch/powerpc/include/asm/kvm_types.h b/arch/powerpc/include/asm/kvm_types.h
> new file mode 100644
> index 000000000000..656b498ed3b6
> --- /dev/null
> +++ b/arch/powerpc/include/asm/kvm_types.h
> @@ -0,0 +1,15 @@
> +/* SPDX-License-Identifier: GPL-2.0 */
> +#ifndef _ASM_PPC_KVM_TYPES_H
> +#define _ASM_PPC_KVM_TYPES_H
> +
> +#if IS_MODULE(CONFIG_KVM_BOOK3S_64_PR) && IS_MODULE(CONFIG_KVM_BOOK3S_64_HV)
> +#define KVM_SUB_MODULES kvm-pr,kvm-hv
> +#elif IS_MODULE(CONFIG_KVM_BOOK3S_64_PR)
> +#define KVM_SUB_MODULES kvm-pr
> +#elif IS_MODULE(CONFIG_KVM_INTEL)

Typo :) which obviously breaks the ppc64_guest_defconfig build.
Changing that to CONFIG_KVM_BOOK3S_64_HV fixes it.

> +#define KVM_SUB_MODULES kvm-hv
> +#else
> +#undef KVM_SUB_MODULES
> +#endif
> +
> +#endif

Also, you'll want to drop kvm_types.h from generic-y to avoid

scripts/Makefile.asm-headers:39: redundant generic-y found in arch/powerpc/include/asm/Kbuild: kvm_types.h

diff --git a/arch/powerpc/include/asm/Kbuild b/arch/powerpc/include/asm/Kbuild
index e5fdc336c9b2..2e23533b67e3 100644
--- a/arch/powerpc/include/asm/Kbuild
+++ b/arch/powerpc/include/asm/Kbuild
@@ -3,7 +3,6 @@ generated-y += syscall_table_32.h
generated-y += syscall_table_64.h
generated-y += syscall_table_spu.h
generic-y += agp.h
-generic-y += kvm_types.h
generic-y += mcs_spinlock.h
generic-y += qrwlock.h
generic-y += early_ioremap.h
--

Cheers,
Nathan