diff mbox

[Utopic/Trusty,SRU] KVM: PPC: BOOK3S: HV: CMA: Reserve cma region only in hypervisor mode

Message ID 1418771976-30080-1-git-send-email-chris.j.arges@canonical.com
State New
Headers show

Commit Message

Chris J Arges Dec. 16, 2014, 11:19 p.m. UTC
From: "Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>

BugLink: http://bugs.launchpad.net/bugs/1400209

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 <aneesh.kumar@linux.vnet.ibm.com>
Reviewed-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
(cherry picked from commit cec26bc3c125b5dd12a02f04133cd91eae3f1622)
Signed-off-by: Chris J Arges <chris.j.arges@canonical.com>
---
 arch/powerpc/kvm/book3s_hv_builtin.c | 6 ++++++
 1 file changed, 6 insertions(+)

Comments

Stefan Bader Dec. 17, 2014, 2:40 p.m. UTC | #1

Andy Whitcroft Dec. 19, 2014, 11:09 a.m. UTC | #2
On Tue, Dec 16, 2014 at 05:19:36PM -0600, Chris J Arges wrote:
> From: "Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>
> 
> BugLink: http://bugs.launchpad.net/bugs/1400209
> 
> 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 <aneesh.kumar@linux.vnet.ibm.com>
> Reviewed-by: Alexander Graf <agraf@suse.de>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> (cherry picked from commit cec26bc3c125b5dd12a02f04133cd91eae3f1622)
> Signed-off-by: Chris J Arges <chris.j.arges@canonical.com>
> ---
>  arch/powerpc/kvm/book3s_hv_builtin.c | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/arch/powerpc/kvm/book3s_hv_builtin.c b/arch/powerpc/kvm/book3s_hv_builtin.c
> index 7cde8a6..73f19fb 100644
> --- a/arch/powerpc/kvm/book3s_hv_builtin.c
> +++ b/arch/powerpc/kvm/book3s_hv_builtin.c
> @@ -157,6 +157,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.

Looks reasonable.  Upstream cherry-pick, very targetted.

Acked-by: Andy Whitcroft <apw@canonical.com>

-apw
Andy Whitcroft Dec. 19, 2014, 11:11 a.m. UTC | #3
Applied to Utopic and Trusty.

-apw
diff mbox

Patch

diff --git a/arch/powerpc/kvm/book3s_hv_builtin.c b/arch/powerpc/kvm/book3s_hv_builtin.c
index 7cde8a6..73f19fb 100644
--- a/arch/powerpc/kvm/book3s_hv_builtin.c
+++ b/arch/powerpc/kvm/book3s_hv_builtin.c
@@ -157,6 +157,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.