KVM: always define KVM_CAP_SYNC_MMU
authorPaolo Bonzini <pbonzini@redhat.com>
Wed, 11 Feb 2026 18:06:31 +0000 (19:06 +0100)
committerPaolo Bonzini <pbonzini@redhat.com>
Sat, 28 Feb 2026 14:31:35 +0000 (15:31 +0100)
KVM_CAP_SYNC_MMU is provided by KVM's MMU notifiers, which are now always
available.  Move the definition from individual architectures to common
code.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Documentation/virt/kvm/api.rst
arch/arm64/kvm/arm.c
arch/loongarch/kvm/vm.c
arch/mips/kvm/mips.c
arch/powerpc/kvm/powerpc.c
arch/riscv/kvm/vm.c
arch/s390/kvm/kvm-s390.c
arch/x86/kvm/x86.c
virt/kvm/kvm_main.c

index fc57368..6f85e1b 100644 (file)
@@ -1396,7 +1396,10 @@ or its flags may be modified, but it may not be resized.
 Memory for the region is taken starting at the address denoted by the
 field userspace_addr, which must point at user addressable memory for
 the entire memory slot size.  Any object may back this memory, including
-anonymous memory, ordinary files, and hugetlbfs.
+anonymous memory, ordinary files, and hugetlbfs.  Changes in the backing
+of the memory region are automatically reflected into the guest.
+For example, an mmap() that affects the region will be made visible
+immediately.  Another example is madvise(MADV_DROP).
 
 On architectures that support a form of address tagging, userspace_addr must
 be an untagged address.
@@ -1412,11 +1415,6 @@ use it.  The latter can be set, if KVM_CAP_READONLY_MEM capability allows it,
 to make a new slot read-only.  In this case, writes to this memory will be
 posted to userspace as KVM_EXIT_MMIO exits.
 
-When the KVM_CAP_SYNC_MMU capability is available, changes in the backing of
-the memory region are automatically reflected into the guest.  For example, an
-mmap() that affects the region will be made visible immediately.  Another
-example is madvise(MADV_DROP).
-
 For TDX guest, deleting/moving memory region loses guest memory contents.
 Read only region isn't supported.  Only as-id 0 is supported.
 
index 29f0326..410ffd4 100644 (file)
@@ -358,7 +358,6 @@ int kvm_vm_ioctl_check_extension(struct kvm *kvm, long ext)
                break;
        case KVM_CAP_IOEVENTFD:
        case KVM_CAP_USER_MEMORY:
-       case KVM_CAP_SYNC_MMU:
        case KVM_CAP_DESTROY_MEMORY_REGION_WORKS:
        case KVM_CAP_ONE_REG:
        case KVM_CAP_ARM_PSCI:
index 63fd405..5282158 100644 (file)
@@ -118,7 +118,6 @@ int kvm_vm_ioctl_check_extension(struct kvm *kvm, long ext)
        case KVM_CAP_ONE_REG:
        case KVM_CAP_ENABLE_CAP:
        case KVM_CAP_READONLY_MEM:
-       case KVM_CAP_SYNC_MMU:
        case KVM_CAP_IMMEDIATE_EXIT:
        case KVM_CAP_IOEVENTFD:
        case KVM_CAP_MP_STATE:
index b0fb92f..29d9f63 100644 (file)
@@ -1035,7 +1035,6 @@ int kvm_vm_ioctl_check_extension(struct kvm *kvm, long ext)
        case KVM_CAP_ONE_REG:
        case KVM_CAP_ENABLE_CAP:
        case KVM_CAP_READONLY_MEM:
-       case KVM_CAP_SYNC_MMU:
        case KVM_CAP_IMMEDIATE_EXIT:
                r = 1;
                break;
index 3da40ea..0030239 100644 (file)
@@ -623,11 +623,6 @@ int kvm_vm_ioctl_check_extension(struct kvm *kvm, long ext)
                r = !!(hv_enabled && kvmppc_hv_ops->enable_nested &&
                       !kvmppc_hv_ops->enable_nested(NULL));
                break;
-#endif
-       case KVM_CAP_SYNC_MMU:
-               r = 1;
-               break;
-#ifdef CONFIG_KVM_BOOK3S_HV_POSSIBLE
        case KVM_CAP_PPC_HTAB_FD:
                r = hv_enabled;
                break;
index 7cbd234..58bce57 100644 (file)
@@ -181,7 +181,6 @@ int kvm_vm_ioctl_check_extension(struct kvm *kvm, long ext)
                break;
        case KVM_CAP_IOEVENTFD:
        case KVM_CAP_USER_MEMORY:
-       case KVM_CAP_SYNC_MMU:
        case KVM_CAP_DESTROY_MEMORY_REGION_WORKS:
        case KVM_CAP_ONE_REG:
        case KVM_CAP_READONLY_MEM:
index 7a175d8..bc7d6fa 100644 (file)
@@ -601,7 +601,6 @@ int kvm_vm_ioctl_check_extension(struct kvm *kvm, long ext)
        switch (ext) {
        case KVM_CAP_S390_PSW:
        case KVM_CAP_S390_GMAP:
-       case KVM_CAP_SYNC_MMU:
 #ifdef CONFIG_KVM_S390_UCONTROL
        case KVM_CAP_S390_UCONTROL:
 #endif
index 3fb6490..a035307 100644 (file)
@@ -4805,7 +4805,6 @@ int kvm_vm_ioctl_check_extension(struct kvm *kvm, long ext)
 #endif
        case KVM_CAP_NOP_IO_DELAY:
        case KVM_CAP_MP_STATE:
-       case KVM_CAP_SYNC_MMU:
        case KVM_CAP_USER_NMI:
        case KVM_CAP_IRQ_INJECT_STATUS:
        case KVM_CAP_IOEVENTFD:
index 29ee017..1bc1da6 100644 (file)
@@ -4870,6 +4870,7 @@ static int kvm_ioctl_create_device(struct kvm *kvm,
 static int kvm_vm_ioctl_check_extension_generic(struct kvm *kvm, long arg)
 {
        switch (arg) {
+       case KVM_CAP_SYNC_MMU:
        case KVM_CAP_USER_MEMORY:
        case KVM_CAP_USER_MEMORY2:
        case KVM_CAP_DESTROY_MEMORY_REGION_WORKS: