diff options
Diffstat (limited to 'arch/blackfin/mm/sram-alloc.c')
-rw-r--r-- | arch/blackfin/mm/sram-alloc.c | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/arch/blackfin/mm/sram-alloc.c b/arch/blackfin/mm/sram-alloc.c index 530d1393a232..0bc3c4ef0aad 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; | |||
83 | static void __init l1sram_init(void) | 83 | static void __init l1sram_init(void) |
84 | { | 84 | { |
85 | unsigned int cpu; | 85 | unsigned int cpu; |
86 | unsigned long reserve; | ||
87 | |||
88 | #ifdef CONFIG_SMP | ||
89 | reserve = 0; | ||
90 | #else | ||
91 | reserve = sizeof(struct l1_scratch_task_info); | ||
92 | #endif | ||
93 | |||
86 | for (cpu = 0; cpu < num_possible_cpus(); ++cpu) { | 94 | for (cpu = 0; cpu < num_possible_cpus(); ++cpu) { |
87 | per_cpu(free_l1_ssram_head, cpu).next = | 95 | per_cpu(free_l1_ssram_head, cpu).next = |
88 | kmem_cache_alloc(sram_piece_cache, GFP_KERNEL); | 96 | kmem_cache_alloc(sram_piece_cache, GFP_KERNEL); |
@@ -91,8 +99,8 @@ static void __init l1sram_init(void) | |||
91 | return; | 99 | return; |
92 | } | 100 | } |
93 | 101 | ||
94 | per_cpu(free_l1_ssram_head, cpu).next->paddr = (void *)get_l1_scratch_start_cpu(cpu); | 102 | per_cpu(free_l1_ssram_head, cpu).next->paddr = (void *)get_l1_scratch_start_cpu(cpu) + reserve; |
95 | per_cpu(free_l1_ssram_head, cpu).next->size = L1_SCRATCH_LENGTH; | 103 | per_cpu(free_l1_ssram_head, cpu).next->size = L1_SCRATCH_LENGTH - reserve; |
96 | per_cpu(free_l1_ssram_head, cpu).next->pid = 0; | 104 | per_cpu(free_l1_ssram_head, cpu).next->pid = 0; |
97 | per_cpu(free_l1_ssram_head, cpu).next->next = NULL; | 105 | per_cpu(free_l1_ssram_head, cpu).next->next = NULL; |
98 | 106 | ||
@@ -223,7 +231,7 @@ static void __init l2_sram_init(void) | |||
223 | spin_lock_init(&l2_sram_lock); | 231 | spin_lock_init(&l2_sram_lock); |
224 | } | 232 | } |
225 | 233 | ||
226 | void __init bfin_sram_init(void) | 234 | static int __init bfin_sram_init(void) |
227 | { | 235 | { |
228 | sram_piece_cache = kmem_cache_create("sram_piece_cache", | 236 | sram_piece_cache = kmem_cache_create("sram_piece_cache", |
229 | sizeof(struct sram_piece), | 237 | sizeof(struct sram_piece), |
@@ -233,7 +241,10 @@ void __init bfin_sram_init(void) | |||
233 | l1_data_sram_init(); | 241 | l1_data_sram_init(); |
234 | l1_inst_sram_init(); | 242 | l1_inst_sram_init(); |
235 | l2_sram_init(); | 243 | l2_sram_init(); |
244 | |||
245 | return 0; | ||
236 | } | 246 | } |
247 | pure_initcall(bfin_sram_init); | ||
237 | 248 | ||
238 | /* SRAM allocate function */ | 249 | /* SRAM allocate function */ |
239 | static void *_sram_alloc(size_t size, struct sram_piece *pfree_head, | 250 | static void *_sram_alloc(size_t size, struct sram_piece *pfree_head, |
@@ -732,6 +743,10 @@ found: | |||
732 | } | 743 | } |
733 | EXPORT_SYMBOL(sram_free_with_lsl); | 744 | EXPORT_SYMBOL(sram_free_with_lsl); |
734 | 745 | ||
746 | /* Allocate memory and keep in L1 SRAM List (lsl) so that the resources are | ||
747 | * tracked. These are designed for userspace so that when a process exits, | ||
748 | * we can safely reap their resources. | ||
749 | */ | ||
735 | void *sram_alloc_with_lsl(size_t size, unsigned long flags) | 750 | void *sram_alloc_with_lsl(size_t size, unsigned long flags) |
736 | { | 751 | { |
737 | void *addr = NULL; | 752 | void *addr = NULL; |