From c72aa0794a0ecc0b87ba9d5546215c26c8c80668 Mon Sep 17 00:00:00 2001 From: Graf Yang Date: Mon, 25 May 2009 04:44:00 +0000 Subject: Blackfin: merge sram init functions Now that the sram_init() function exists only to call the bfin_sram_init() after the punting of the reserve_pda() function, simply merge the two to avoid pointless overhead. Signed-off-by: Graf Yang Signed-off-by: Mike Frysinger --- arch/blackfin/mm/sram-alloc.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'arch/blackfin/mm/sram-alloc.c') diff --git a/arch/blackfin/mm/sram-alloc.c b/arch/blackfin/mm/sram-alloc.c index 530d1393a23..36376d8418f 100644 --- a/arch/blackfin/mm/sram-alloc.c +++ b/arch/blackfin/mm/sram-alloc.c @@ -223,7 +223,7 @@ static void __init l2_sram_init(void) spin_lock_init(&l2_sram_lock); } -void __init bfin_sram_init(void) +static int __init bfin_sram_init(void) { sram_piece_cache = kmem_cache_create("sram_piece_cache", sizeof(struct sram_piece), @@ -233,7 +233,10 @@ void __init bfin_sram_init(void) l1_data_sram_init(); l1_inst_sram_init(); l2_sram_init(); + + return 0; } +pure_initcall(bfin_sram_init); /* SRAM allocate function */ static void *_sram_alloc(size_t size, struct sram_piece *pfree_head, -- cgit v1.2.3-70-g09d2 From 89ecd506917ba6e86ede072efbef6c69d01db4dd Mon Sep 17 00:00:00 2001 From: Graf Yang Date: Mon, 25 May 2009 06:40:42 +0000 Subject: Blackfin: fix handling of initial L1 reservation This restores some L1 reservation logic that was lost during the Blackfin SMP merge. Signed-off-by: Graf Yang Signed-off-by: Mike Frysinger --- arch/blackfin/mm/sram-alloc.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'arch/blackfin/mm/sram-alloc.c') diff --git a/arch/blackfin/mm/sram-alloc.c b/arch/blackfin/mm/sram-alloc.c index 36376d8418f..fa54a4ee3d6 100644 --- a/arch/blackfin/mm/sram-alloc.c +++ b/arch/blackfin/mm/sram-alloc.c @@ -83,6 +83,14 @@ static struct kmem_cache *sram_piece_cache; static void __init l1sram_init(void) { unsigned int cpu; + unsigned long reserve; + +#ifdef CONFIG_SMP + reserve = 0; +#else + reserve = sizeof(struct l1_scratch_task_info); +#endif + for (cpu = 0; cpu < num_possible_cpus(); ++cpu) { per_cpu(free_l1_ssram_head, cpu).next = kmem_cache_alloc(sram_piece_cache, GFP_KERNEL); @@ -91,8 +99,8 @@ static void __init l1sram_init(void) return; } - per_cpu(free_l1_ssram_head, cpu).next->paddr = (void *)get_l1_scratch_start_cpu(cpu); - per_cpu(free_l1_ssram_head, cpu).next->size = L1_SCRATCH_LENGTH; + per_cpu(free_l1_ssram_head, cpu).next->paddr = (void *)get_l1_scratch_start_cpu(cpu) + reserve; + per_cpu(free_l1_ssram_head, cpu).next->size = L1_SCRATCH_LENGTH - reserve; per_cpu(free_l1_ssram_head, cpu).next->pid = 0; per_cpu(free_l1_ssram_head, cpu).next->next = NULL; -- cgit v1.2.3-70-g09d2 From f1db88d2a7f1c92284e64f5dbb5c7a316a22576d Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Tue, 2 Jun 2009 08:46:35 +0000 Subject: Blackfin: document the lsl variants of the L1 allocator Make sure the meaning of "lsl" is covered somewhere and it is clear why we somewhat duplicate the sram alloc/free functions. Signed-off-by: Mike Frysinger --- arch/blackfin/mm/sram-alloc.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'arch/blackfin/mm/sram-alloc.c') diff --git a/arch/blackfin/mm/sram-alloc.c b/arch/blackfin/mm/sram-alloc.c index fa54a4ee3d6..0bc3c4ef0aa 100644 --- a/arch/blackfin/mm/sram-alloc.c +++ b/arch/blackfin/mm/sram-alloc.c @@ -743,6 +743,10 @@ found: } EXPORT_SYMBOL(sram_free_with_lsl); +/* Allocate memory and keep in L1 SRAM List (lsl) so that the resources are + * tracked. These are designed for userspace so that when a process exits, + * we can safely reap their resources. + */ void *sram_alloc_with_lsl(size_t size, unsigned long flags) { void *addr = NULL; -- cgit v1.2.3-70-g09d2