Diff
Modified: trunk/arch/blackfin/Kconfig (5250 => 5251)
--- trunk/arch/blackfin/Kconfig 2008-09-08 04:12:33 UTC (rev 5250)
+++ trunk/arch/blackfin/Kconfig 2008-09-08 06:05:11 UTC (rev 5251)
@@ -622,6 +622,14 @@
If enabled, the CPLB Switch Tables are linked
into L1 data memory. (less latency)
+config KERNEL_STACKS_L1
+ bool "Locate kernel stacks in L1 Scratch Memory"
+ default y
+ depends on !BF531
+ help
+ If enabled the kernel stacks are located
+ into L1 scratch memory (less latency).
+
comment "Speed Optimizations"
config BFIN_INS_LOWOVERHEAD
bool "ins[bwl] low overhead, higher interrupt latency"
Modified: trunk/fs/binfmt_flat.c (5250 => 5251)
--- trunk/fs/binfmt_flat.c 2008-09-08 04:12:33 UTC (rev 5250)
+++ trunk/fs/binfmt_flat.c 2008-09-08 06:05:11 UTC (rev 5251)
@@ -417,6 +417,9 @@
unsigned long *extra_stack,
unsigned long *stack_base)
{
+#ifndef CONFIG_KERNEL_STACKS_L1
+ static int l1stk_disable_warn_once;
+#endif
struct flat_hdr * hdr;
unsigned long textpos = 0, datapos = 0, result;
unsigned long realdatastart = 0;
@@ -502,6 +505,13 @@
return -ENOMEM;
if (flags & FLAT_FLAG_L1STK) {
+#ifndef CONFIG_KERNEL_STACKS_L1
+ flags &= ~FLAT_FLAG_L1STK;
+ if (!l1stk_disable_warn_once) {
+ l1stk_disable_warn_once = 1;
+ printk(KERN_NOTICE "BINFMT_FLAT: L1 stack support disabled - will continue anyway\n");
+ }
+#else
if (stack_base == 0) {
printk ("BINFMT_FLAT: requesting L1 stack for shared library\n");
return -ENOEXEC;
@@ -512,6 +522,7 @@
return -ENOMEM;
}
*extra_stack = stack_len;
+#endif
}
/* Flush all traces of the currently running executable */
@@ -798,8 +809,10 @@
return 0;
out_fail:
+#ifdef CONFIG_KERNEL_STACKS_L1
if (flags & FLAT_FLAG_L1STK)
free_l1stack();
+#endif
return result;
}
@@ -920,6 +933,7 @@
/* Stash our initial stack pointer into the mm structure */
current->mm->start_stack = (unsigned long )sp;
+#ifdef CONFIG_KERNEL_STACKS_L1
if (l1stack_base) {
/* Find L1 stack pointer corresponding to the current bottom
of the stack in normal RAM. */
@@ -927,6 +941,7 @@
if (!activate_l1stack(current->mm, ramstack_top - stack_len))
l1stack_base = 0;
}
+#endif
DBG_FLT("start_thread(regs=0x%x, entry=0x%x, start_stack=0x%x, l1stk=0x%x, len 0x%x)\n",
(int)regs, (int)start_addr, (int)current->mm->start_stack, l1stack_base,
Modified: trunk/include/asm-blackfin/mmu_context.h (5250 => 5251)
--- trunk/include/asm-blackfin/mmu_context.h 2008-09-08 04:12:33 UTC (rev 5250)
+++ trunk/include/asm-blackfin/mmu_context.h 2008-09-08 06:05:11 UTC (rev 5251)
@@ -37,6 +37,8 @@
#include <asm/pgalloc.h>
#include <asm/cplbinit.h>
+#ifdef CONFIG_KERNEL_STACKS_L1
+
extern void *current_l1_stack_save;
extern int nr_l1stack_tasks;
extern void *l1_stack_base;
@@ -45,50 +47,13 @@
extern int l1sram_free(const void*);
extern void *l1sram_alloc_max(void*);
-static inline void enter_lazy_tlb(struct mm_struct *mm, struct task_struct *tsk)
-{
-}
-
-/* Called when creating a new context during fork() or execve(). */
-static inline int
-init_new_context(struct task_struct *tsk, struct mm_struct *mm)
-{
-#ifdef CONFIG_MPU
- unsigned long p = __get_free_pages(GFP_KERNEL, page_mask_order);
- mm->context.page_rwx_mask = (unsigned long *)p;
- memset(mm->context.page_rwx_mask, 0,
- page_mask_nelts * 3 * sizeof(long));
-#endif
- return 0;
-}
-
static inline void free_l1stack(void)
{
nr_l1stack_tasks--;
if (nr_l1stack_tasks == 0)
l1sram_free(l1_stack_base);
}
-static inline void destroy_context(struct mm_struct *mm)
-{
- struct sram_list_struct *tmp;
- if (current_l1_stack_save == mm->context.l1_stack_save)
- current_l1_stack_save = NULL;
- if (mm->context.l1_stack_save)
- free_l1stack();
-
- while ((tmp = mm->context.sram_list)) {
- mm->context.sram_list = tmp->next;
- sram_free(tmp->addr);
- kfree(tmp);
- }
-#ifdef CONFIG_MPU
- if (current_rwx_mask == mm->context.page_rwx_mask)
- current_rwx_mask = NULL;
- free_pages((unsigned long)mm->context.page_rwx_mask, page_mask_order);
-#endif
-}
-
static inline unsigned long
alloc_l1stack(unsigned long length, unsigned long *stack_base)
{
@@ -117,6 +82,7 @@
memcpy(l1_stack_base, current_l1_stack_save, l1_stack_len);
return 1;
}
+#endif /* CONFIG_KERNEL_STACKS_L1 */
#define deactivate_mm(tsk,mm) do { } while (0)
@@ -134,6 +100,7 @@
}
#endif
+#ifdef CONFIG_KERNEL_STACKS_L1
/* L1 stack switching. */
if (!next_mm->context.l1_stack_save)
return;
@@ -144,6 +111,7 @@
}
current_l1_stack_save = next_mm->context.l1_stack_save;
memcpy(l1_stack_base, current_l1_stack_save, l1_stack_len);
+#endif
}
#ifdef CONFIG_MPU
@@ -180,4 +148,44 @@
}
#endif
+static inline void enter_lazy_tlb(struct mm_struct *mm, struct task_struct *tsk)
+{
+}
+
+/* Called when creating a new context during fork() or execve(). */
+static inline int
+init_new_context(struct task_struct *tsk, struct mm_struct *mm)
+{
+#ifdef CONFIG_MPU
+ unsigned long p = __get_free_pages(GFP_KERNEL, page_mask_order);
+ mm->context.page_rwx_mask = (unsigned long *)p;
+ memset(mm->context.page_rwx_mask, 0,
+ page_mask_nelts * 3 * sizeof(long));
#endif
+ return 0;
+}
+
+static inline void destroy_context(struct mm_struct *mm)
+{
+ struct sram_list_struct *tmp;
+
+#ifdef CONFIG_KERNEL_STACKS_L1
+ if (current_l1_stack_save == mm->context.l1_stack_save)
+ current_l1_stack_save = 0;
+ if (mm->context.l1_stack_save)
+ free_l1stack();
+#endif
+
+ while ((tmp = mm->context.sram_list)) {
+ mm->context.sram_list = tmp->next;
+ sram_free(tmp->addr);
+ kfree(tmp);
+ }
+#ifdef CONFIG_MPU
+ if (current_rwx_mask == mm->context.page_rwx_mask)
+ current_rwx_mask = NULL;
+ free_pages((unsigned long)mm->context.page_rwx_mask, page_mask_order);
+#endif
+}
+
+#endif