aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlex Williamson <alex.williamson@redhat.com>2012-12-10 12:33:21 -0500
committerMarcelo Tosatti <mtosatti@redhat.com>2012-12-13 20:24:38 -0500
commitf82a8cfe9354f5cdea55ebeceba3fd19051d3ee8 (patch)
tree335e968cef697b7831c48849677de628cee4e73d
parent0743247fbf0c4a27185b2aa1fdda91d0745dfed1 (diff)
KVM: struct kvm_memory_slot.user_alloc -> bool
There's no need for this to be an int, it holds a boolean. Move to the end of the struct for alignment. Reviewed-by: Gleb Natapov <gleb@redhat.com> Signed-off-by: Alex Williamson <alex.williamson@redhat.com> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
-rw-r--r--arch/ia64/kvm/kvm-ia64.c6
-rw-r--r--arch/powerpc/kvm/powerpc.c4
-rw-r--r--arch/s390/kvm/kvm-s390.c4
-rw-r--r--arch/x86/kvm/vmx.c6
-rw-r--r--arch/x86/kvm/x86.c4
-rw-r--r--include/linux/kvm_host.h12
-rw-r--r--virt/kvm/kvm_main.c8
7 files changed, 22 insertions, 22 deletions
diff --git a/arch/ia64/kvm/kvm-ia64.c b/arch/ia64/kvm/kvm-ia64.c
index 9bacfe207b43..ad3126a58644 100644
--- a/arch/ia64/kvm/kvm-ia64.c
+++ b/arch/ia64/kvm/kvm-ia64.c
@@ -955,7 +955,7 @@ long kvm_arch_vm_ioctl(struct file *filp,
955 kvm_mem.guest_phys_addr; 955 kvm_mem.guest_phys_addr;
956 kvm_userspace_mem.memory_size = kvm_mem.memory_size; 956 kvm_userspace_mem.memory_size = kvm_mem.memory_size;
957 r = kvm_vm_ioctl_set_memory_region(kvm, 957 r = kvm_vm_ioctl_set_memory_region(kvm,
958 &kvm_userspace_mem, 0); 958 &kvm_userspace_mem, false);
959 if (r) 959 if (r)
960 goto out; 960 goto out;
961 break; 961 break;
@@ -1580,7 +1580,7 @@ int kvm_arch_prepare_memory_region(struct kvm *kvm,
1580 struct kvm_memory_slot *memslot, 1580 struct kvm_memory_slot *memslot,
1581 struct kvm_memory_slot old, 1581 struct kvm_memory_slot old,
1582 struct kvm_userspace_memory_region *mem, 1582 struct kvm_userspace_memory_region *mem,
1583 int user_alloc) 1583 bool user_alloc)
1584{ 1584{
1585 unsigned long i; 1585 unsigned long i;
1586 unsigned long pfn; 1586 unsigned long pfn;
@@ -1611,7 +1611,7 @@ int kvm_arch_prepare_memory_region(struct kvm *kvm,
1611void kvm_arch_commit_memory_region(struct kvm *kvm, 1611void kvm_arch_commit_memory_region(struct kvm *kvm,
1612 struct kvm_userspace_memory_region *mem, 1612 struct kvm_userspace_memory_region *mem,
1613 struct kvm_memory_slot old, 1613 struct kvm_memory_slot old,
1614 int user_alloc) 1614 bool user_alloc)
1615{ 1615{
1616 return; 1616 return;
1617} 1617}
diff --git a/arch/powerpc/kvm/powerpc.c b/arch/powerpc/kvm/powerpc.c
index 70739a089560..be83fca2e8fd 100644
--- a/arch/powerpc/kvm/powerpc.c
+++ b/arch/powerpc/kvm/powerpc.c
@@ -412,7 +412,7 @@ int kvm_arch_prepare_memory_region(struct kvm *kvm,
412 struct kvm_memory_slot *memslot, 412 struct kvm_memory_slot *memslot,
413 struct kvm_memory_slot old, 413 struct kvm_memory_slot old,
414 struct kvm_userspace_memory_region *mem, 414 struct kvm_userspace_memory_region *mem,
415 int user_alloc) 415 bool user_alloc)
416{ 416{
417 return kvmppc_core_prepare_memory_region(kvm, memslot, mem); 417 return kvmppc_core_prepare_memory_region(kvm, memslot, mem);
418} 418}
@@ -420,7 +420,7 @@ int kvm_arch_prepare_memory_region(struct kvm *kvm,
420void kvm_arch_commit_memory_region(struct kvm *kvm, 420void kvm_arch_commit_memory_region(struct kvm *kvm,
421 struct kvm_userspace_memory_region *mem, 421 struct kvm_userspace_memory_region *mem,
422 struct kvm_memory_slot old, 422 struct kvm_memory_slot old,
423 int user_alloc) 423 bool user_alloc)
424{ 424{
425 kvmppc_core_commit_memory_region(kvm, mem, old); 425 kvmppc_core_commit_memory_region(kvm, mem, old);
426} 426}
diff --git a/arch/s390/kvm/kvm-s390.c b/arch/s390/kvm/kvm-s390.c
index c9011bfaabbe..f718bc65835c 100644
--- a/arch/s390/kvm/kvm-s390.c
+++ b/arch/s390/kvm/kvm-s390.c
@@ -928,7 +928,7 @@ int kvm_arch_prepare_memory_region(struct kvm *kvm,
928 struct kvm_memory_slot *memslot, 928 struct kvm_memory_slot *memslot,
929 struct kvm_memory_slot old, 929 struct kvm_memory_slot old,
930 struct kvm_userspace_memory_region *mem, 930 struct kvm_userspace_memory_region *mem,
931 int user_alloc) 931 bool user_alloc)
932{ 932{
933 /* A few sanity checks. We can have exactly one memory slot which has 933 /* A few sanity checks. We can have exactly one memory slot which has
934 to start at guest virtual zero and which has to be located at a 934 to start at guest virtual zero and which has to be located at a
@@ -958,7 +958,7 @@ int kvm_arch_prepare_memory_region(struct kvm *kvm,
958void kvm_arch_commit_memory_region(struct kvm *kvm, 958void kvm_arch_commit_memory_region(struct kvm *kvm,
959 struct kvm_userspace_memory_region *mem, 959 struct kvm_userspace_memory_region *mem,
960 struct kvm_memory_slot old, 960 struct kvm_memory_slot old,
961 int user_alloc) 961 bool user_alloc)
962{ 962{
963 int rc; 963 int rc;
964 964
diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
index 9120ae1901e4..b3101e368079 100644
--- a/arch/x86/kvm/vmx.c
+++ b/arch/x86/kvm/vmx.c
@@ -3667,7 +3667,7 @@ static int alloc_apic_access_page(struct kvm *kvm)
3667 kvm_userspace_mem.flags = 0; 3667 kvm_userspace_mem.flags = 0;
3668 kvm_userspace_mem.guest_phys_addr = 0xfee00000ULL; 3668 kvm_userspace_mem.guest_phys_addr = 0xfee00000ULL;
3669 kvm_userspace_mem.memory_size = PAGE_SIZE; 3669 kvm_userspace_mem.memory_size = PAGE_SIZE;
3670 r = __kvm_set_memory_region(kvm, &kvm_userspace_mem, 0); 3670 r = __kvm_set_memory_region(kvm, &kvm_userspace_mem, false);
3671 if (r) 3671 if (r)
3672 goto out; 3672 goto out;
3673 3673
@@ -3697,7 +3697,7 @@ static int alloc_identity_pagetable(struct kvm *kvm)
3697 kvm_userspace_mem.guest_phys_addr = 3697 kvm_userspace_mem.guest_phys_addr =
3698 kvm->arch.ept_identity_map_addr; 3698 kvm->arch.ept_identity_map_addr;
3699 kvm_userspace_mem.memory_size = PAGE_SIZE; 3699 kvm_userspace_mem.memory_size = PAGE_SIZE;
3700 r = __kvm_set_memory_region(kvm, &kvm_userspace_mem, 0); 3700 r = __kvm_set_memory_region(kvm, &kvm_userspace_mem, false);
3701 if (r) 3701 if (r)
3702 goto out; 3702 goto out;
3703 3703
@@ -4251,7 +4251,7 @@ static int vmx_set_tss_addr(struct kvm *kvm, unsigned int addr)
4251 .flags = 0, 4251 .flags = 0,
4252 }; 4252 };
4253 4253
4254 ret = kvm_set_memory_region(kvm, &tss_mem, 0); 4254 ret = kvm_set_memory_region(kvm, &tss_mem, false);
4255 if (ret) 4255 if (ret)
4256 return ret; 4256 return ret;
4257 kvm->arch.tss_addr = addr; 4257 kvm->arch.tss_addr = addr;
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index 816074757c96..1c9c834b72f0 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -6839,7 +6839,7 @@ int kvm_arch_prepare_memory_region(struct kvm *kvm,
6839 struct kvm_memory_slot *memslot, 6839 struct kvm_memory_slot *memslot,
6840 struct kvm_memory_slot old, 6840 struct kvm_memory_slot old,
6841 struct kvm_userspace_memory_region *mem, 6841 struct kvm_userspace_memory_region *mem,
6842 int user_alloc) 6842 bool user_alloc)
6843{ 6843{
6844 int npages = memslot->npages; 6844 int npages = memslot->npages;
6845 int map_flags = MAP_PRIVATE | MAP_ANONYMOUS; 6845 int map_flags = MAP_PRIVATE | MAP_ANONYMOUS;
@@ -6875,7 +6875,7 @@ int kvm_arch_prepare_memory_region(struct kvm *kvm,
6875void kvm_arch_commit_memory_region(struct kvm *kvm, 6875void kvm_arch_commit_memory_region(struct kvm *kvm,
6876 struct kvm_userspace_memory_region *mem, 6876 struct kvm_userspace_memory_region *mem,
6877 struct kvm_memory_slot old, 6877 struct kvm_memory_slot old,
6878 int user_alloc) 6878 bool user_alloc)
6879{ 6879{
6880 6880
6881 int nr_mmu_pages = 0, npages = mem->memory_size >> PAGE_SHIFT; 6881 int nr_mmu_pages = 0, npages = mem->memory_size >> PAGE_SHIFT;
diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h
index 5a3581ceb036..d897f035749f 100644
--- a/include/linux/kvm_host.h
+++ b/include/linux/kvm_host.h
@@ -270,8 +270,8 @@ struct kvm_memory_slot {
270 unsigned long *dirty_bitmap; 270 unsigned long *dirty_bitmap;
271 struct kvm_arch_memory_slot arch; 271 struct kvm_arch_memory_slot arch;
272 unsigned long userspace_addr; 272 unsigned long userspace_addr;
273 int user_alloc;
274 int id; 273 int id;
274 bool user_alloc;
275}; 275};
276 276
277static inline unsigned long kvm_dirty_bitmap_bytes(struct kvm_memory_slot *memslot) 277static inline unsigned long kvm_dirty_bitmap_bytes(struct kvm_memory_slot *memslot)
@@ -451,10 +451,10 @@ id_to_memslot(struct kvm_memslots *slots, int id)
451 451
452int kvm_set_memory_region(struct kvm *kvm, 452int kvm_set_memory_region(struct kvm *kvm,
453 struct kvm_userspace_memory_region *mem, 453 struct kvm_userspace_memory_region *mem,
454 int user_alloc); 454 bool user_alloc);
455int __kvm_set_memory_region(struct kvm *kvm, 455int __kvm_set_memory_region(struct kvm *kvm,
456 struct kvm_userspace_memory_region *mem, 456 struct kvm_userspace_memory_region *mem,
457 int user_alloc); 457 bool user_alloc);
458void kvm_arch_free_memslot(struct kvm_memory_slot *free, 458void kvm_arch_free_memslot(struct kvm_memory_slot *free,
459 struct kvm_memory_slot *dont); 459 struct kvm_memory_slot *dont);
460int kvm_arch_create_memslot(struct kvm_memory_slot *slot, unsigned long npages); 460int kvm_arch_create_memslot(struct kvm_memory_slot *slot, unsigned long npages);
@@ -462,11 +462,11 @@ int kvm_arch_prepare_memory_region(struct kvm *kvm,
462 struct kvm_memory_slot *memslot, 462 struct kvm_memory_slot *memslot,
463 struct kvm_memory_slot old, 463 struct kvm_memory_slot old,
464 struct kvm_userspace_memory_region *mem, 464 struct kvm_userspace_memory_region *mem,
465 int user_alloc); 465 bool user_alloc);
466void kvm_arch_commit_memory_region(struct kvm *kvm, 466void kvm_arch_commit_memory_region(struct kvm *kvm,
467 struct kvm_userspace_memory_region *mem, 467 struct kvm_userspace_memory_region *mem,
468 struct kvm_memory_slot old, 468 struct kvm_memory_slot old,
469 int user_alloc); 469 bool user_alloc);
470bool kvm_largepages_enabled(void); 470bool kvm_largepages_enabled(void);
471void kvm_disable_largepages(void); 471void kvm_disable_largepages(void);
472/* flush all memory translations */ 472/* flush all memory translations */
@@ -553,7 +553,7 @@ int kvm_vm_ioctl_get_dirty_log(struct kvm *kvm,
553int kvm_vm_ioctl_set_memory_region(struct kvm *kvm, 553int kvm_vm_ioctl_set_memory_region(struct kvm *kvm,
554 struct 554 struct
555 kvm_userspace_memory_region *mem, 555 kvm_userspace_memory_region *mem,
556 int user_alloc); 556 bool user_alloc);
557int kvm_vm_ioctl_irq_line(struct kvm *kvm, struct kvm_irq_level *irq_level); 557int kvm_vm_ioctl_irq_line(struct kvm *kvm, struct kvm_irq_level *irq_level);
558long kvm_arch_vm_ioctl(struct file *filp, 558long kvm_arch_vm_ioctl(struct file *filp,
559 unsigned int ioctl, unsigned long arg); 559 unsigned int ioctl, unsigned long arg);
diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
index 5f0638cb6968..42c1eb73a0e3 100644
--- a/virt/kvm/kvm_main.c
+++ b/virt/kvm/kvm_main.c
@@ -709,7 +709,7 @@ static int check_memory_region_flags(struct kvm_userspace_memory_region *mem)
709 */ 709 */
710int __kvm_set_memory_region(struct kvm *kvm, 710int __kvm_set_memory_region(struct kvm *kvm,
711 struct kvm_userspace_memory_region *mem, 711 struct kvm_userspace_memory_region *mem,
712 int user_alloc) 712 bool user_alloc)
713{ 713{
714 int r; 714 int r;
715 gfn_t base_gfn; 715 gfn_t base_gfn;
@@ -889,7 +889,7 @@ EXPORT_SYMBOL_GPL(__kvm_set_memory_region);
889 889
890int kvm_set_memory_region(struct kvm *kvm, 890int kvm_set_memory_region(struct kvm *kvm,
891 struct kvm_userspace_memory_region *mem, 891 struct kvm_userspace_memory_region *mem,
892 int user_alloc) 892 bool user_alloc)
893{ 893{
894 int r; 894 int r;
895 895
@@ -903,7 +903,7 @@ EXPORT_SYMBOL_GPL(kvm_set_memory_region);
903int kvm_vm_ioctl_set_memory_region(struct kvm *kvm, 903int kvm_vm_ioctl_set_memory_region(struct kvm *kvm,
904 struct 904 struct
905 kvm_userspace_memory_region *mem, 905 kvm_userspace_memory_region *mem,
906 int user_alloc) 906 bool user_alloc)
907{ 907{
908 if (mem->slot >= KVM_USER_MEM_SLOTS) 908 if (mem->slot >= KVM_USER_MEM_SLOTS)
909 return -EINVAL; 909 return -EINVAL;
@@ -2148,7 +2148,7 @@ static long kvm_vm_ioctl(struct file *filp,
2148 sizeof kvm_userspace_mem)) 2148 sizeof kvm_userspace_mem))
2149 goto out; 2149 goto out;
2150 2150
2151 r = kvm_vm_ioctl_set_memory_region(kvm, &kvm_userspace_mem, 1); 2151 r = kvm_vm_ioctl_set_memory_region(kvm, &kvm_userspace_mem, true);
2152 break; 2152 break;
2153 } 2153 }
2154 case KVM_GET_DIRTY_LOG: { 2154 case KVM_GET_DIRTY_LOG: {