From: Aneesh Kumar K.V Date: Mon, 29 Sep 2014 08:02:38 +0000 (+0530) Subject: KVM: PPC: BOOK3S: HV: CMA: Reserve cma region only in hypervisor mode X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=cec26bc3c125b5dd12a02f04133cd91eae3f1622;p=GitHub%2FLineageOS%2FG12%2Fandroid_kernel_amlogic_linux-4.9.git KVM: PPC: BOOK3S: HV: CMA: Reserve cma region only in hypervisor mode We use cma reserved area for creating guest hash page table. Don't do the reservation in non-hypervisor mode. This avoids unnecessary CMA reservation when booting with limited memory configs like fadump and kdump. Signed-off-by: Aneesh Kumar K.V Reviewed-by: Alexander Graf Signed-off-by: Paolo Bonzini --- diff --git a/arch/powerpc/kvm/book3s_hv_builtin.c b/arch/powerpc/kvm/book3s_hv_builtin.c index b9615ba5b083..4fdc27c80f4c 100644 --- a/arch/powerpc/kvm/book3s_hv_builtin.c +++ b/arch/powerpc/kvm/book3s_hv_builtin.c @@ -163,6 +163,12 @@ void __init kvm_cma_reserve(void) unsigned long align_size; struct memblock_region *reg; phys_addr_t selected_size = 0; + + /* + * We need CMA reservation only when we are in HV mode + */ + if (!cpu_has_feature(CPU_FTR_HVMODE)) + return; /* * We cannot use memblock_phys_mem_size() here, because * memblock_analyze() has not been called yet.