KVM: Unconditionally export KVM_CAP_READONLY_MEM
authorChristoffer Dall <christoffer.dall@linaro.org>
Tue, 26 Aug 2014 12:00:37 +0000 (14:00 +0200)
committerPaolo Bonzini <pbonzini@redhat.com>
Fri, 29 Aug 2014 11:47:04 +0000 (13:47 +0200)
The idea between capabilities and the KVM_CHECK_EXTENSION ioctl is that
userspace can, at run-time, determine if a feature is supported or not.
This allows KVM to being supporting a new feature with a new kernel
version without any need to update user space.  Unfortunately, since the
definition of KVM_CAP_READONLY_MEM was guarded by #ifdef
__KVM_HAVE_READONLY_MEM, such discovery still required a user space
update.

Therefore, unconditionally export KVM_CAP_READONLY_MEM and change the
in-kernel conditional to rely on __KVM_HAVE_READONLY_MEM.

Signed-off-by: Christoffer Dall <christoffer.dall@linaro.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
include/uapi/linux/kvm.h
virt/kvm/kvm_main.c

index cf3a2ff440e4ae6840aa2d7a45c1e7590a8ce719..90d3edab839c7e32f0e594bedfa884d04040b2bb 100644 (file)
@@ -738,9 +738,7 @@ struct kvm_ppc_smmu_info {
 #define KVM_CAP_PPC_GET_SMMU_INFO 78
 #define KVM_CAP_S390_COW 79
 #define KVM_CAP_PPC_ALLOC_HTAB 80
-#ifdef __KVM_HAVE_READONLY_MEM
 #define KVM_CAP_READONLY_MEM 81
-#endif
 #define KVM_CAP_IRQFD_RESAMPLE 82
 #define KVM_CAP_PPC_BOOKE_WATCHDOG 83
 #define KVM_CAP_PPC_HTAB_FD 84
index 5a0817ee996ec058e1164dd77fb7404c1d6740a1..1d03967def407580bfdb8ecb69bcd511c0168056 100644 (file)
@@ -708,7 +708,7 @@ static int check_memory_region_flags(struct kvm_userspace_memory_region *mem)
 {
        u32 valid_flags = KVM_MEM_LOG_DIRTY_PAGES;
 
-#ifdef KVM_CAP_READONLY_MEM
+#ifdef __KVM_HAVE_READONLY_MEM
        valid_flags |= KVM_MEM_READONLY;
 #endif