Patchwork [4/5] powerpc: booke: Make CAM entries used for lowmem configurable

login
register
mail settings
Submitter Trent Piepho
Date Dec. 9, 2008, 3:34 a.m.
Message ID <1228793699-23110-4-git-send-email-tpiepho@freescale.com>
Download mbox | patch
Permalink /patch/12884/
State Accepted, archived
Commit 96051465fdc29e00dd14b484a45daac089c657f8
Delegated to: Kumar Gala
Headers show

Comments

Trent Piepho - Dec. 9, 2008, 3:34 a.m.
On booke processors, the code that maps low memory only uses up to three
CAM entries, even though there are sixteen and nothing else uses them.

Make this number configurable in the advanced options menu along with max
low memory size.  If one wants 1 GB of lowmem, then it's typically
necessary to have four CAM entries.

Signed-off-by: Trent Piepho <tpiepho@freescale.com>
---
 arch/powerpc/Kconfig            |   16 ++++++++++++++++
 arch/powerpc/mm/fsl_booke_mmu.c |    6 +++++-
 2 files changed, 21 insertions(+), 1 deletions(-)
Kumar Gala - Jan. 13, 2009, 3:43 p.m.
On Dec 8, 2008, at 9:34 PM, Trent Piepho wrote:

> On booke processors, the code that maps low memory only uses up to  
> three
> CAM entries, even though there are sixteen and nothing else uses them.
>
> Make this number configurable in the advanced options menu along  
> with max
> low memory size.  If one wants 1 GB of lowmem, then it's typically
> necessary to have four CAM entries.
>
> Signed-off-by: Trent Piepho <tpiepho@freescale.com>
> ---
> arch/powerpc/Kconfig            |   16 ++++++++++++++++
> arch/powerpc/mm/fsl_booke_mmu.c |    6 +++++-
> 2 files changed, 21 insertions(+), 1 deletions(-)

applied

- k

Patch

diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index be4f99b..2bb645c 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -696,6 +696,22 @@  config LOWMEM_SIZE
 	hex "Maximum low memory size (in bytes)" if LOWMEM_SIZE_BOOL
 	default "0x30000000"
 
+config LOWMEM_CAM_NUM_BOOL
+	bool "Set number of CAMs to use to map low memory"
+	depends on ADVANCED_OPTIONS && FSL_BOOKE
+	help
+	  This option allows you to set the maximum number of CAM slots that
+	  will be used to map low memory.  There are a limited number of slots
+	  available and even more limited number that will fit in the L1 MMU.
+	  However, using more entries will allow mapping more low memory.  This
+	  can be useful in optimizing the layout of kernel virtual memory.
+
+	  Say N here unless you know what you are doing.
+
+config LOWMEM_CAM_NUM
+	int "Number of CAMs to use to map low memory" if LOWMEM_CAM_NUM_BOOL
+	default 3
+
 config RELOCATABLE
 	bool "Build a relocatable kernel (EXPERIMENTAL)"
 	depends on EXPERIMENTAL && ADVANCED_OPTIONS && FLATMEM && FSL_BOOKE
diff --git a/arch/powerpc/mm/fsl_booke_mmu.c b/arch/powerpc/mm/fsl_booke_mmu.c
index 1dabe1a..73aa9b7 100644
--- a/arch/powerpc/mm/fsl_booke_mmu.c
+++ b/arch/powerpc/mm/fsl_booke_mmu.c
@@ -56,10 +56,14 @@ 
 
 extern void loadcam_entry(unsigned int index);
 unsigned int tlbcam_index;
-static unsigned long cam[3];
+static unsigned long cam[CONFIG_LOWMEM_CAM_NUM];
 
 #define NUM_TLBCAMS	(16)
 
+#if defined(CONFIG_LOWMEM_CAM_NUM_BOOL) && (CONFIG_LOWMEM_CAM_NUM >= NUM_TLBCAMS)
+#error "LOWMEM_CAM_NUM must be less than NUM_TLBCAMS"
+#endif
+
 struct tlbcam TLBCAM[NUM_TLBCAMS];
 
 struct tlbcamrange {