aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc
diff options
context:
space:
mode:
authorAlexey Kardashevskiy <aik@ozlabs.ru>2014-08-14 01:03:07 -0400
committerPaolo Bonzini <pbonzini@redhat.com>2014-08-19 09:11:57 -0400
commitc04fa5831d4d89dfbc88406f4a46f9846841a560 (patch)
tree691332dbb4ce5b6180326d5097e9485a781a4753 /arch/powerpc
parent350b8bdd689cd2ab2c67c8a86a0be86cfa0751a7 (diff)
PC, KVM, CMA: Fix regression caused by wrong get_order() use
fc95ca7284bc54953165cba76c3228bd2cdb9591 claims that there is no functional change but this is not true as it calls get_order() (which takes bytes) where it should have called order_base_2() and the kernel stops on VM_BUG_ON(). This replaces get_order() with order_base_2() (round-up version of ilog2). Suggested-by: Paul Mackerras <paulus@samba.org> Cc: Alexander Graf <agraf@suse.de> Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org> Reviewed-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'arch/powerpc')
-rw-r--r--arch/powerpc/kvm/book3s_hv_builtin.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/arch/powerpc/kvm/book3s_hv_builtin.c b/arch/powerpc/kvm/book3s_hv_builtin.c
index 329d7fdd0a6a..b9615ba5b083 100644
--- a/arch/powerpc/kvm/book3s_hv_builtin.c
+++ b/arch/powerpc/kvm/book3s_hv_builtin.c
@@ -101,7 +101,7 @@ struct kvm_rma_info *kvm_alloc_rma()
101 ri = kmalloc(sizeof(struct kvm_rma_info), GFP_KERNEL); 101 ri = kmalloc(sizeof(struct kvm_rma_info), GFP_KERNEL);
102 if (!ri) 102 if (!ri)
103 return NULL; 103 return NULL;
104 page = cma_alloc(kvm_cma, kvm_rma_pages, get_order(kvm_rma_pages)); 104 page = cma_alloc(kvm_cma, kvm_rma_pages, order_base_2(kvm_rma_pages));
105 if (!page) 105 if (!page)
106 goto err_out; 106 goto err_out;
107 atomic_set(&ri->use_count, 1); 107 atomic_set(&ri->use_count, 1);
@@ -135,12 +135,12 @@ struct page *kvm_alloc_hpt(unsigned long nr_pages)
135{ 135{
136 unsigned long align_pages = HPT_ALIGN_PAGES; 136 unsigned long align_pages = HPT_ALIGN_PAGES;
137 137
138 VM_BUG_ON(get_order(nr_pages) < KVM_CMA_CHUNK_ORDER - PAGE_SHIFT); 138 VM_BUG_ON(order_base_2(nr_pages) < KVM_CMA_CHUNK_ORDER - PAGE_SHIFT);
139 139
140 /* Old CPUs require HPT aligned on a multiple of its size */ 140 /* Old CPUs require HPT aligned on a multiple of its size */
141 if (!cpu_has_feature(CPU_FTR_ARCH_206)) 141 if (!cpu_has_feature(CPU_FTR_ARCH_206))
142 align_pages = nr_pages; 142 align_pages = nr_pages;
143 return cma_alloc(kvm_cma, nr_pages, get_order(align_pages)); 143 return cma_alloc(kvm_cma, nr_pages, order_base_2(align_pages));
144} 144}
145EXPORT_SYMBOL_GPL(kvm_alloc_hpt); 145EXPORT_SYMBOL_GPL(kvm_alloc_hpt);
146 146