Commit bbacc0c111c3c5d1f3192b8cc1642b9c3954f80d

Authored by Alex Williamson
Committed by Marcelo Tosatti
1 parent b7f69c555c

KVM: Rename KVM_MEMORY_SLOTS -> KVM_USER_MEM_SLOTS

It's easy to confuse KVM_MEMORY_SLOTS and KVM_MEM_SLOTS_NUM.  One is
the user accessible slots and the other is user + private.  Make this
more obvious.

Reviewed-by: Gleb Natapov <gleb@redhat.com>
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>

Showing 10 changed files with 19 additions and 19 deletions Side-by-side Diff

arch/ia64/include/asm/kvm_host.h
... ... @@ -23,7 +23,7 @@
23 23 #ifndef __ASM_KVM_HOST_H
24 24 #define __ASM_KVM_HOST_H
25 25  
26   -#define KVM_MEMORY_SLOTS 32
  26 +#define KVM_USER_MEM_SLOTS 32
27 27 /* memory slots that does not exposed to userspace */
28 28 #define KVM_PRIVATE_MEM_SLOTS 4
29 29  
arch/ia64/kvm/kvm-ia64.c
... ... @@ -1834,7 +1834,7 @@
1834 1834 mutex_lock(&kvm->slots_lock);
1835 1835  
1836 1836 r = -EINVAL;
1837   - if (log->slot >= KVM_MEMORY_SLOTS)
  1837 + if (log->slot >= KVM_USER_MEM_SLOTS)
1838 1838 goto out;
1839 1839  
1840 1840 memslot = id_to_memslot(kvm->memslots, log->slot);
arch/powerpc/include/asm/kvm_host.h
... ... @@ -37,10 +37,10 @@
37 37  
38 38 #define KVM_MAX_VCPUS NR_CPUS
39 39 #define KVM_MAX_VCORES NR_CPUS
40   -#define KVM_MEMORY_SLOTS 32
  40 +#define KVM_USER_MEM_SLOTS 32
41 41 /* memory slots that does not exposed to userspace */
42 42 #define KVM_PRIVATE_MEM_SLOTS 4
43   -#define KVM_MEM_SLOTS_NUM (KVM_MEMORY_SLOTS + KVM_PRIVATE_MEM_SLOTS)
  43 +#define KVM_MEM_SLOTS_NUM (KVM_USER_MEM_SLOTS + KVM_PRIVATE_MEM_SLOTS)
44 44  
45 45 #ifdef CONFIG_KVM_MMIO
46 46 #define KVM_COALESCED_MMIO_PAGE_OFFSET 1
arch/powerpc/kvm/book3s_hv.c
... ... @@ -1549,7 +1549,7 @@
1549 1549 mutex_lock(&kvm->slots_lock);
1550 1550  
1551 1551 r = -EINVAL;
1552   - if (log->slot >= KVM_MEMORY_SLOTS)
  1552 + if (log->slot >= KVM_USER_MEM_SLOTS)
1553 1553 goto out;
1554 1554  
1555 1555 memslot = id_to_memslot(kvm->memslots, log->slot);
arch/s390/include/asm/kvm_host.h
... ... @@ -20,7 +20,7 @@
20 20 #include <asm/cpu.h>
21 21  
22 22 #define KVM_MAX_VCPUS 64
23   -#define KVM_MEMORY_SLOTS 32
  23 +#define KVM_USER_MEM_SLOTS 32
24 24 /* memory slots that does not exposed to userspace */
25 25 #define KVM_PRIVATE_MEM_SLOTS 4
26 26  
arch/x86/include/asm/kvm_host.h
... ... @@ -33,10 +33,10 @@
33 33  
34 34 #define KVM_MAX_VCPUS 254
35 35 #define KVM_SOFT_MAX_VCPUS 160
36   -#define KVM_MEMORY_SLOTS 32
  36 +#define KVM_USER_MEM_SLOTS 32
37 37 /* memory slots that does not exposed to userspace */
38 38 #define KVM_PRIVATE_MEM_SLOTS 4
39   -#define KVM_MEM_SLOTS_NUM (KVM_MEMORY_SLOTS + KVM_PRIVATE_MEM_SLOTS)
  39 +#define KVM_MEM_SLOTS_NUM (KVM_USER_MEM_SLOTS + KVM_PRIVATE_MEM_SLOTS)
40 40  
41 41 #define KVM_MMIO_SIZE 16
42 42  
arch/x86/include/asm/vmx.h
... ... @@ -427,9 +427,9 @@
427 427  
428 428 #define AR_RESERVD_MASK 0xfffe0f00
429 429  
430   -#define TSS_PRIVATE_MEMSLOT (KVM_MEMORY_SLOTS + 0)
431   -#define APIC_ACCESS_PAGE_PRIVATE_MEMSLOT (KVM_MEMORY_SLOTS + 1)
432   -#define IDENTITY_PAGETABLE_PRIVATE_MEMSLOT (KVM_MEMORY_SLOTS + 2)
  430 +#define TSS_PRIVATE_MEMSLOT (KVM_USER_MEM_SLOTS + 0)
  431 +#define APIC_ACCESS_PAGE_PRIVATE_MEMSLOT (KVM_USER_MEM_SLOTS + 1)
  432 +#define IDENTITY_PAGETABLE_PRIVATE_MEMSLOT (KVM_USER_MEM_SLOTS + 2)
433 433  
434 434 #define VMX_NR_VPIDS (1 << 16)
435 435 #define VMX_VPID_EXTENT_SINGLE_CONTEXT 1
... ... @@ -2518,7 +2518,7 @@
2518 2518 r = KVM_MAX_VCPUS;
2519 2519 break;
2520 2520 case KVM_CAP_NR_MEMSLOTS:
2521   - r = KVM_MEMORY_SLOTS;
  2521 + r = KVM_USER_MEM_SLOTS;
2522 2522 break;
2523 2523 case KVM_CAP_PV_MMU: /* obsolete */
2524 2524 r = 0;
... ... @@ -3435,7 +3435,7 @@
3435 3435 mutex_lock(&kvm->slots_lock);
3436 3436  
3437 3437 r = -EINVAL;
3438   - if (log->slot >= KVM_MEMORY_SLOTS)
  3438 + if (log->slot >= KVM_USER_MEM_SLOTS)
3439 3439 goto out;
3440 3440  
3441 3441 memslot = id_to_memslot(kvm->memslots, log->slot);
... ... @@ -6845,7 +6845,7 @@
6845 6845 int map_flags = MAP_PRIVATE | MAP_ANONYMOUS;
6846 6846  
6847 6847 /* Prevent internal slot pages from being moved by fork()/COW. */
6848   - if (memslot->id >= KVM_MEMORY_SLOTS)
  6848 + if (memslot->id >= KVM_USER_MEM_SLOTS)
6849 6849 map_flags = MAP_SHARED | MAP_ANONYMOUS;
6850 6850  
6851 6851 /*To keep backward compatibility with older userspace,
include/linux/kvm_host.h
... ... @@ -314,7 +314,7 @@
314 314 #endif
315 315  
316 316 #ifndef KVM_MEM_SLOTS_NUM
317   -#define KVM_MEM_SLOTS_NUM (KVM_MEMORY_SLOTS + KVM_PRIVATE_MEM_SLOTS)
  317 +#define KVM_MEM_SLOTS_NUM (KVM_USER_MEM_SLOTS + KVM_PRIVATE_MEM_SLOTS)
318 318 #endif
319 319  
320 320 /*
... ... @@ -771,7 +771,7 @@
771 771 /* Check for overlaps */
772 772 r = -EEXIST;
773 773 kvm_for_each_memslot(slot, kvm->memslots) {
774   - if (slot->id >= KVM_MEMORY_SLOTS || slot == memslot)
  774 + if (slot->id >= KVM_USER_MEM_SLOTS || slot == memslot)
775 775 continue;
776 776 if (!((base_gfn + npages <= slot->base_gfn) ||
777 777 (base_gfn >= slot->base_gfn + slot->npages)))
... ... @@ -905,7 +905,7 @@
905 905 kvm_userspace_memory_region *mem,
906 906 int user_alloc)
907 907 {
908   - if (mem->slot >= KVM_MEMORY_SLOTS)
  908 + if (mem->slot >= KVM_USER_MEM_SLOTS)
909 909 return -EINVAL;
910 910 return kvm_set_memory_region(kvm, mem, user_alloc);
911 911 }
... ... @@ -919,7 +919,7 @@
919 919 unsigned long any = 0;
920 920  
921 921 r = -EINVAL;
922   - if (log->slot >= KVM_MEMORY_SLOTS)
  922 + if (log->slot >= KVM_USER_MEM_SLOTS)
923 923 goto out;
924 924  
925 925 memslot = id_to_memslot(kvm->memslots, log->slot);
... ... @@ -965,7 +965,7 @@
965 965 {
966 966 struct kvm_memory_slot *memslot = gfn_to_memslot(kvm, gfn);
967 967  
968   - if (!memslot || memslot->id >= KVM_MEMORY_SLOTS ||
  968 + if (!memslot || memslot->id >= KVM_USER_MEM_SLOTS ||
969 969 memslot->flags & KVM_MEMSLOT_INVALID)
970 970 return 0;
971 971