kvm: replace __KVM_HAVE_READONLY_MEM with Kconfig symbol

KVM uses __KVM_HAVE_* symbols in the architecture-dependent uapi/asm/kvm.h to mask
unused definitions in include/uapi/linux/kvm.h.  __KVM_HAVE_READONLY_MEM however
was nothing but a misguided attempt to define KVM_CAP_READONLY_MEM only on
architectures where KVM_CHECK_EXTENSION(KVM_CAP_READONLY_MEM) could possibly
return nonzero.  This however does not make sense, and it prevented userspace
from supporting this architecture-independent feature without recompilation.

Therefore, these days __KVM_HAVE_READONLY_MEM does not mask anything and
is only used in virt/kvm/kvm_main.c.  Userspace does not need to test it
and there should be no need for it to exist.  Remove it and replace it
with a Kconfig symbol within Linux source code.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
Paolo Bonzini
2024-01-11 03:00:34 -05:00
parent 5d9cb71642
commit 8886640dad
12 changed files with 9 additions and 8 deletions
+3
View File
@@ -55,6 +55,9 @@ config KVM_ASYNC_PF_SYNC
config HAVE_KVM_MSI
bool
config HAVE_KVM_READONLY_MEM
bool
config HAVE_KVM_CPU_RELAX_INTERCEPT
bool
+1 -1
View File
@@ -1614,7 +1614,7 @@ static int check_memory_region_flags(struct kvm *kvm,
if (mem->flags & KVM_MEM_GUEST_MEMFD)
valid_flags &= ~KVM_MEM_LOG_DIRTY_PAGES;
#ifdef __KVM_HAVE_READONLY_MEM
#ifdef CONFIG_HAVE_KVM_READONLY_MEM
valid_flags |= KVM_MEM_READONLY;
#endif