commit: http://blackfin.uclinux.org/git/?p=linux-kernel;a=commitdiff;h=b93edf2c0285a0a1f233a9520018558aafaae1f4
branch: http://blackfin.uclinux.org/git/?p=linux-kernel;a=shortlog;h=refs/heads/2012R1

User can reserve L2 SRAM by kernel paramter icc_l2_mem=0x1000 when ICC
support is enabled in kernel. The reverved memory is at the begining of
L2 SRAM, which is used by ICC message queues and slave core code.

Signed-off-by: Sonic Zhang <[email protected]>
---
 arch/blackfin/kernel/vmlinux.lds.S |   16 +++++++++++++++-
 arch/blackfin/mm/sram-alloc.c      |   26 ++++++++++++++++++++++----
 2 files changed, 37 insertions(+), 5 deletions(-)

diff --git a/arch/blackfin/kernel/vmlinux.lds.S b/arch/blackfin/kernel/vmlinux.lds.S
index ba35864..09f6233 100644
--- a/arch/blackfin/kernel/vmlinux.lds.S
+++ b/arch/blackfin/kernel/vmlinux.lds.S
@@ -48,6 +48,9 @@ SECTIONS
 #if !L1_CODE_LENGTH
 		*(.l1.text)
 #endif
+#if !L2_LENGTH || CONFIG_ICC
+		*(.l2.text)
+#endif
 		__etext = .;
 	}
 
@@ -75,6 +78,9 @@ SECTIONS
 #if !L1_DATA_B_LENGTH
 		*(.l1.bss.B)
 #endif
+#if !L2_LENGTH || CONFIG_ICC
+		*(.l2i.bss)
+#endif
 		. = ALIGN(4);
 		___bss_stop = .;
 	}
@@ -97,7 +103,7 @@ SECTIONS
 #if !L1_DATA_B_LENGTH
 		*(.l1.data.B)
 #endif
-#if !L2_LENGTH
+#if !L2_LENGTH || CONFIG_ICC
 		. = ALIGN(32);
 		*(.data_l2.cacheline_aligned)
 		*(.l2.data)
@@ -224,21 +230,29 @@ SECTIONS
 	{
 		. = ALIGN(4);
 		__stext_l2 = .;
+#if !CONFIG_ICC
 		*(.l2.text)
+#endif
 		. = ALIGN(4);
 		__etext_l2 = .;
 
 		. = ALIGN(4);
 		__sdata_l2 = .;
+#if !CONFIG_ICC
 		*(.l2.data)
+#endif
 		__edata_l2 = .;
 
 		. = ALIGN(32);
+#if !CONFIG_ICC
 		*(.data_l2.cacheline_aligned)
+#endif
 
 		. = ALIGN(4);
 		__sbss_l2 = .;
+#if !CONFIG_ICC
 		*(.l2.bss)
+#endif
 		. = ALIGN(4);
 		__ebss_l2 = .;
 	}
diff --git a/arch/blackfin/mm/sram-alloc.c b/arch/blackfin/mm/sram-alloc.c
index 342e378..1ba5b0a 100644
--- a/arch/blackfin/mm/sram-alloc.c
+++ b/arch/blackfin/mm/sram-alloc.c
@@ -210,6 +210,10 @@ static irqreturn_t l2_ecc_err(int irq, void *dev_id)
 }
 #endif
 
+#ifdef CONFIG_ICC
+int _icc_l2_reserve;
+#endif
+
 static void __init l2_sram_init(void)
 {
 #if L2_LENGTH != 0
@@ -232,10 +236,20 @@ static void __init l2_sram_init(void)
 		return;
 	}
 
-	free_l2_sram_head.next->paddr =
-		(void *)L2_START + (_ebss_l2 - _stext_l2);
-	free_l2_sram_head.next->size =
-		L2_LENGTH - (_ebss_l2 - _stext_l2);
+#ifdef CONFIG_ICC
+	if (_icc_l2_reserve > L2_LENGTH)
+		_icc_l2_reserve = L2_LENGTH;
+#endif
+	free_l2_sram_head.next->paddr = (void *)L2_START
+#ifdef CONFIG_ICC
+		+ _icc_l2_reserve
+#endif
+		+ (_ebss_l2 - _stext_l2);
+	free_l2_sram_head.next->size = L2_LENGTH
+#ifdef CONFIG_ICC
+		- _icc_l2_reserve
+#endif
+		- (_ebss_l2 - _stext_l2);
 	free_l2_sram_head.next->pid = 0;
 	free_l2_sram_head.next->next = NULL;
 
@@ -265,6 +279,10 @@ static int __init bfin_sram_init(void)
 }
 pure_initcall(bfin_sram_init);
 
+#ifdef CONFIG_ICC
+core_param(icc_l2_mem, _icc_l2_reserve, int, 0644);
+#endif
+
 /* SRAM allocate function */
 static void *_sram_alloc(size_t size, struct sram_piece *pfree_head,
 		struct sram_piece *pused_head)
_______________________________________________
Linux-kernel-commits mailing list
[email protected]
https://blackfin.uclinux.org/mailman/listinfo/linux-kernel-commits

Reply via email to