arm: Add support for CONFIG_ENABLE_DMM
Add a new config ENABLE_DMM that will turn on/off the DMM feature.
DMM stands for "dynamic memory management" (the ability to power
off some memory when the system is idle) and the reason this
is needed is that many customers do not want this functionality
and we want to provide a consistent and simple way of turning
this off, rather than the ad-hoc methods some have been using.
DMM currently is enabled by default on 8960.
The following configs are currently used only by DMM
and will be disabled if ENABLE_DMM is not true.
CONFIG_MEMORY_HOTPLUG
CONFIG_HOTREMOVE
CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG
CONFIG_ARCH_ENABLE_MEMORY_HOTREMOVE
CONFIG_MIGRATION
CONFIG_ARCH_MEMORY_PROBE
CONFIG_ARCH_MEMORY_REMOVE
CRs-Fixed: 344176
Change-Id: I1f1fa8a8882136a38f0abd01b0f5cb59c9a25152
Signed-off-by: Jack Cheung <jackc@codeaurora.org>
Signed-off-by: Larry Bassel <lbassel@codeaurora.org>
diff --git a/arch/arm/mach-msm/Kconfig b/arch/arm/mach-msm/Kconfig
index 20a5449..ff35e4c 100644
--- a/arch/arm/mach-msm/Kconfig
+++ b/arch/arm/mach-msm/Kconfig
@@ -154,14 +154,15 @@
select ARCH_POPULATES_NODE_MAP
select ARCH_SPARSEMEM_ENABLE
select ARCH_HAS_HOLES_MEMORYMODEL
- select MEMORY_HOTPLUG
- select MEMORY_HOTREMOVE
- select ARCH_ENABLE_MEMORY_HOTPLUG
- select ARCH_ENABLE_MEMORY_HOTREMOVE
- select MIGRATION
- select ARCH_MEMORY_PROBE
- select ARCH_MEMORY_REMOVE
- select FIX_MOVABLE_ZONE
+ select ENABLE_DMM
+ select MEMORY_HOTPLUG if ENABLE_DMM
+ select MEMORY_HOTREMOVE if ENABLE_DMM
+ select ARCH_ENABLE_MEMORY_HOTPLUG if ENABLE_DMM
+ select ARCH_ENABLE_MEMORY_HOTREMOVE if ENABLE_DMM
+ select MIGRATION if ENABLE_DMM
+ select ARCH_MEMORY_PROBE if ENABLE_DMM
+ select ARCH_MEMORY_REMOVE if ENABLE_DMM
+ select FIX_MOVABLE_ZONE if ENABLE_DMM
select CLEANCACHE
select QCACHE
select MSM_MULTIMEDIA_USE_ION
@@ -193,14 +194,15 @@
select ARCH_POPULATES_NODE_MAP
select ARCH_SPARSEMEM_ENABLE
select ARCH_HAS_HOLES_MEMORYMODEL
- select MEMORY_HOTPLUG
- select MEMORY_HOTREMOVE
- select ARCH_ENABLE_MEMORY_HOTPLUG
- select ARCH_ENABLE_MEMORY_HOTREMOVE
- select MIGRATION
- select ARCH_MEMORY_PROBE
- select ARCH_MEMORY_REMOVE
- select FIX_MOVABLE_ZONE
+ select ENABLE_DMM
+ select MEMORY_HOTPLUG if ENABLE_DMM
+ select MEMORY_HOTREMOVE if ENABLE_DMM
+ select ARCH_ENABLE_MEMORY_HOTPLUG if ENABLE_DMM
+ select ARCH_ENABLE_MEMORY_HOTREMOVE if ENABLE_DMM
+ select MIGRATION if ENABLE_DMM
+ select ARCH_MEMORY_PROBE if ENABLE_DMM
+ select ARCH_MEMORY_REMOVE if ENABLE_DMM
+ select FIX_MOVABLE_ZONE if ENABLE_DMM
select MSM_ULTRASOUND
select MULTI_IRQ_HANDLER
select MSM_PM8X60 if PM
diff --git a/arch/arm/mach-msm/board-8930.c b/arch/arm/mach-msm/board-8930.c
index dbd6329..46c60ff 100644
--- a/arch/arm/mach-msm/board-8930.c
+++ b/arch/arm/mach-msm/board-8930.c
@@ -474,23 +474,30 @@
if (high - low <= bank_size)
return;
+
+ msm8930_reserve_info.bank_size = bank_size;
+#ifdef CONFIG_ENABLE_DMM
msm8930_reserve_info.low_unstable_address = mb->start -
MIN_MEMORY_BLOCK_SIZE + mb->size;
msm8930_reserve_info.max_unstable_size = MIN_MEMORY_BLOCK_SIZE;
-
- msm8930_reserve_info.bank_size = bank_size;
pr_info("low unstable address %lx max size %lx bank size %lx\n",
msm8930_reserve_info.low_unstable_address,
msm8930_reserve_info.max_unstable_size,
msm8930_reserve_info.bank_size);
+#else
+ msm8930_reserve_info.low_unstable_address = 0;
+ msm8930_reserve_info.max_unstable_size = 0;
+#endif
}
static void __init place_movable_zone(void)
{
+#ifdef CONFIG_ENABLE_DMM
movable_reserved_start = msm8930_reserve_info.low_unstable_address;
movable_reserved_size = msm8930_reserve_info.max_unstable_size;
pr_info("movable zone start %lx size %lx\n",
movable_reserved_start, movable_reserved_size);
+#endif
}
static void __init msm8930_early_memory(void)
diff --git a/arch/arm/mach-msm/board-8960.c b/arch/arm/mach-msm/board-8960.c
index 462cb5d..de42371 100644
--- a/arch/arm/mach-msm/board-8960.c
+++ b/arch/arm/mach-msm/board-8960.c
@@ -619,23 +619,30 @@
if (high - low <= bank_size)
return;
+
+ msm8960_reserve_info.bank_size = bank_size;
+#ifdef CONFIG_ENABLE_DMM
msm8960_reserve_info.low_unstable_address = mb->start -
MIN_MEMORY_BLOCK_SIZE + mb->size;
msm8960_reserve_info.max_unstable_size = MIN_MEMORY_BLOCK_SIZE;
-
- msm8960_reserve_info.bank_size = bank_size;
pr_info("low unstable address %lx max size %lx bank size %lx\n",
msm8960_reserve_info.low_unstable_address,
msm8960_reserve_info.max_unstable_size,
msm8960_reserve_info.bank_size);
+#else
+ msm8960_reserve_info.low_unstable_address = 0;
+ msm8960_reserve_info.max_unstable_size = 0;
+#endif
}
static void __init place_movable_zone(void)
{
+#ifdef CONFIG_ENABLE_DMM
movable_reserved_start = msm8960_reserve_info.low_unstable_address;
movable_reserved_size = msm8960_reserve_info.max_unstable_size;
pr_info("movable zone start %lx size %lx\n",
movable_reserved_start, movable_reserved_size);
+#endif
}
static void __init msm8960_early_memory(void)
diff --git a/arch/arm/mach-msm/memory_topology.c b/arch/arm/mach-msm/memory_topology.c
index 6208a0d..70aaf4a 100644
--- a/arch/arm/mach-msm/memory_topology.c
+++ b/arch/arm/mach-msm/memory_topology.c
@@ -66,7 +66,8 @@
}
#endif
-#if defined(CONFIG_ARCH_MSM8960)
+#if (defined(CONFIG_ARCH_MSM8960) || defined(CONFIG_ARCH_MSM8930)) \
+ && defined(CONFIG_ENABLE_DMM)
static int rpm_change_memory_state(int retention_mask,
int active_mask)
{