Re: [PATCH 1/4] KVM: introduce CONFIG_KVM_COMMON

From: Sean Christopherson
Date: Fri Jan 05 2024 - 14:13:45 EST


On Thu, Jan 04, 2024, Paolo Bonzini wrote:
> CONFIG_HAVE_KVM is currently used by some architectures to either
> enabled the KVM config proper, or to enable host-side code that is
> not part of the KVM module. However, the "select" statement in
> virt/kvm/Kconfig corresponds to a third meaning, namely to
> enable common Kconfigs required by all architectures that support
> KVM.
>
> These three meanings can be replaced respectively by an
> architecture-specific Kconfig, by IS_ENABLED(CONFIG_KVM), or by
> a new Kconfig symbol that is in turn selected by the
> architecture-specific "config KVM".
>
> Start by introducing such a new Kconfig symbol, CONFIG_KVM_COMMON.
> Unlike CONFIG_HAVE_KVM, it is selected by CONFIG_KVM, not by
> architecture code.

Why? I don't get it, just have code that cares do IS_ENABLED(CONFIG_KVM). Except
for the MIPS usage of HAVE_KVM that you solved by adding CPU_SUPPORTS_VZ, I got
all the way there using just CONFIG_KVM[*].

Ah, and so does this series for the most part, the only usage of CONFIG_KVM_COMMON
is in scripts/gdb/linux/constants.py.in. Honestly, adding a Kconfig just so that
VMX's posted interrupts that arrive in the host can be printed when KVM is built
as a module is a waste of a Kconfig.

[*] https://lore.kernel.org/all/20230916003118.2540661-12-seanjc@xxxxxxxxxx