mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Aaron Sierra <asierra@xes-inc.com>
To: Kumar Gala <galak@kernel.crashing.org>
Cc: LKML <linux-kernel@vger.kernel.org>
Subject: [PATCH 2/2] powerpc/fsl-booke: Let lowmem use all CAM entries
Date: Tue, 08 Oct 2013 10:53:40 -0500 (CDT)	[thread overview]
Message-ID: <8946cc20-6c84-4ea8-bc14-0e1ed0c4d798@zimbra> (raw)
In-Reply-To: <adcc2e4b-d494-4de2-8f11-10dd73f24a3d@zimbra>

This patch essentially changes the sense of CONFIG_LOWMEM_CAM_NUM
so that all available TLB1 CAM entries can be used for mapping lowmem
unless the user specifies a specific number through CONFIG_LOWMEM_CAM_NUM.

This greatly simplifies using CONFIG_LOWMEM_SIZE with high granularity.

Signed-off-by: Aaron Sierra <asierra@xes-inc.com>
---
 arch/powerpc/mm/fsl_booke_mmu.c |   12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/arch/powerpc/mm/fsl_booke_mmu.c b/arch/powerpc/mm/fsl_booke_mmu.c
index 92685d8..44378ac 100644
--- a/arch/powerpc/mm/fsl_booke_mmu.c
+++ b/arch/powerpc/mm/fsl_booke_mmu.c
@@ -178,6 +178,14 @@ unsigned long map_mem_in_cams(unsigned long ram, int max_cam_idx)
 	phys_addr_t phys = memstart_addr;
 	unsigned long amount_mapped = 0;
 
+	/*
+	 * Allow finer resolution for user defined CONFIG_LOWMEM_SIZE by
+	 * allowing all TLB1 entries to be utilized if the user doesn't define
+	 * a specific max_cam_idx value via CONFIG_LOWMEM_CAM_NUM.
+	 */
+	if (!max_cam_idx)
+		max_cam_idx = mfspr(SPRN_TLB1CFG) & 0xfff;
+
 	/* Calculate CAM values */
 	for (i = 0; ram && i < max_cam_idx; i++) {
 		unsigned long cam_sz;
@@ -222,7 +230,11 @@ void __init adjust_total_lowmem(void)
 	/* adjust lowmem size to __max_low_memory */
 	ram = min((phys_addr_t)__max_low_memory, (phys_addr_t)total_lowmem);
 
+#ifdef CONFIG_LOWMEM_CAM_NUM_BOOL
 	__max_low_memory = map_mem_in_cams(ram, CONFIG_LOWMEM_CAM_NUM);
+#else
+	__max_low_memory = map_mem_in_cams(ram, 0);
+#endif
 
 	pr_info("Memory CAM mapping: ");
 	for (i = 0; i < tlbcam_index - 1; i++)
-- 
1.7.9.5


           reply	other threads:[~2013-10-08 16:18 UTC|newest]

Thread overview: expand[flat|nested]  mbox.gz  Atom feed
 [parent not found: <adcc2e4b-d494-4de2-8f11-10dd73f24a3d@zimbra>]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8946cc20-6c84-4ea8-bc14-0e1ed0c4d798@zimbra \
    --to=asierra@xes-inc.com \
    --cc=galak@kernel.crashing.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®