Skip to content

Commit 70295a4

Browse files
committed
KVM: always define KVM_CAP_SYNC_MMU
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>
1 parent 407fd8b commit 70295a4

File tree

9 files changed

+5
-17
lines changed

9 files changed

+5
-17
lines changed

Documentation/virt/kvm/api.rst

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1396,7 +1396,10 @@ or its flags may be modified, but it may not be resized.
13961396
Memory for the region is taken starting at the address denoted by the
13971397
field userspace_addr, which must point at user addressable memory for
13981398
the entire memory slot size. Any object may back this memory, including
1399-
anonymous memory, ordinary files, and hugetlbfs.
1399+
anonymous memory, ordinary files, and hugetlbfs. Changes in the backing
1400+
of the memory region are automatically reflected into the guest.
1401+
For example, an mmap() that affects the region will be made visible
1402+
immediately. Another example is madvise(MADV_DROP).
14001403

14011404
On architectures that support a form of address tagging, userspace_addr must
14021405
be an untagged address.
@@ -1412,11 +1415,6 @@ use it. The latter can be set, if KVM_CAP_READONLY_MEM capability allows it,
14121415
to make a new slot read-only. In this case, writes to this memory will be
14131416
posted to userspace as KVM_EXIT_MMIO exits.
14141417

1415-
When the KVM_CAP_SYNC_MMU capability is available, changes in the backing of
1416-
the memory region are automatically reflected into the guest. For example, an
1417-
mmap() that affects the region will be made visible immediately. Another
1418-
example is madvise(MADV_DROP).
1419-
14201418
For TDX guest, deleting/moving memory region loses guest memory contents.
14211419
Read only region isn't supported. Only as-id 0 is supported.
14221420

arch/arm64/kvm/arm.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -358,7 +358,6 @@ int kvm_vm_ioctl_check_extension(struct kvm *kvm, long ext)
358358
break;
359359
case KVM_CAP_IOEVENTFD:
360360
case KVM_CAP_USER_MEMORY:
361-
case KVM_CAP_SYNC_MMU:
362361
case KVM_CAP_DESTROY_MEMORY_REGION_WORKS:
363362
case KVM_CAP_ONE_REG:
364363
case KVM_CAP_ARM_PSCI:

arch/loongarch/kvm/vm.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,6 @@ int kvm_vm_ioctl_check_extension(struct kvm *kvm, long ext)
118118
case KVM_CAP_ONE_REG:
119119
case KVM_CAP_ENABLE_CAP:
120120
case KVM_CAP_READONLY_MEM:
121-
case KVM_CAP_SYNC_MMU:
122121
case KVM_CAP_IMMEDIATE_EXIT:
123122
case KVM_CAP_IOEVENTFD:
124123
case KVM_CAP_MP_STATE:

arch/mips/kvm/mips.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1035,7 +1035,6 @@ int kvm_vm_ioctl_check_extension(struct kvm *kvm, long ext)
10351035
case KVM_CAP_ONE_REG:
10361036
case KVM_CAP_ENABLE_CAP:
10371037
case KVM_CAP_READONLY_MEM:
1038-
case KVM_CAP_SYNC_MMU:
10391038
case KVM_CAP_IMMEDIATE_EXIT:
10401039
r = 1;
10411040
break;

arch/powerpc/kvm/powerpc.c

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -623,11 +623,6 @@ int kvm_vm_ioctl_check_extension(struct kvm *kvm, long ext)
623623
r = !!(hv_enabled && kvmppc_hv_ops->enable_nested &&
624624
!kvmppc_hv_ops->enable_nested(NULL));
625625
break;
626-
#endif
627-
case KVM_CAP_SYNC_MMU:
628-
r = 1;
629-
break;
630-
#ifdef CONFIG_KVM_BOOK3S_HV_POSSIBLE
631626
case KVM_CAP_PPC_HTAB_FD:
632627
r = hv_enabled;
633628
break;

arch/riscv/kvm/vm.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,6 @@ int kvm_vm_ioctl_check_extension(struct kvm *kvm, long ext)
181181
break;
182182
case KVM_CAP_IOEVENTFD:
183183
case KVM_CAP_USER_MEMORY:
184-
case KVM_CAP_SYNC_MMU:
185184
case KVM_CAP_DESTROY_MEMORY_REGION_WORKS:
186185
case KVM_CAP_ONE_REG:
187186
case KVM_CAP_READONLY_MEM:

arch/s390/kvm/kvm-s390.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -601,7 +601,6 @@ int kvm_vm_ioctl_check_extension(struct kvm *kvm, long ext)
601601
switch (ext) {
602602
case KVM_CAP_S390_PSW:
603603
case KVM_CAP_S390_GMAP:
604-
case KVM_CAP_SYNC_MMU:
605604
#ifdef CONFIG_KVM_S390_UCONTROL
606605
case KVM_CAP_S390_UCONTROL:
607606
#endif

arch/x86/kvm/x86.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4805,7 +4805,6 @@ int kvm_vm_ioctl_check_extension(struct kvm *kvm, long ext)
48054805
#endif
48064806
case KVM_CAP_NOP_IO_DELAY:
48074807
case KVM_CAP_MP_STATE:
4808-
case KVM_CAP_SYNC_MMU:
48094808
case KVM_CAP_USER_NMI:
48104809
case KVM_CAP_IRQ_INJECT_STATUS:
48114810
case KVM_CAP_IOEVENTFD:

virt/kvm/kvm_main.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4870,6 +4870,7 @@ static int kvm_ioctl_create_device(struct kvm *kvm,
48704870
static int kvm_vm_ioctl_check_extension_generic(struct kvm *kvm, long arg)
48714871
{
48724872
switch (arg) {
4873+
case KVM_CAP_SYNC_MMU:
48734874
case KVM_CAP_USER_MEMORY:
48744875
case KVM_CAP_USER_MEMORY2:
48754876
case KVM_CAP_DESTROY_MEMORY_REGION_WORKS:

0 commit comments

Comments
 (0)