diff options
author | Steven Miao <realmz6@gmail.com> | 2013-04-19 06:22:21 -0400 |
---|---|---|
committer | Steven Miao <realmz6@gmail.com> | 2013-05-09 06:22:45 -0400 |
commit | 5ae89ee043ce96e3790e6c75f3807c8e37d98634 (patch) | |
tree | c54cc18e61006fe4bed77fb2a15e58e6afb12348 /arch/blackfin/kernel/cplb-nompu | |
parent | 5b0830914ae423c840a01ccdfac2dbf1dd1a426b (diff) |
bfin cache: dcplb map: add 16M dcplb map for BF60x
use 16M data cplb map on BF60x to avoid too much dcplb miss overhead
cleanup cplb info
Signed-off-by: Steven Miao <realmz6@gmail.com>
Diffstat (limited to 'arch/blackfin/kernel/cplb-nompu')
-rw-r--r-- | arch/blackfin/kernel/cplb-nompu/cplbinit.c | 16 | ||||
-rw-r--r-- | arch/blackfin/kernel/cplb-nompu/cplbmgr.c | 27 |
2 files changed, 36 insertions, 7 deletions
diff --git a/arch/blackfin/kernel/cplb-nompu/cplbinit.c b/arch/blackfin/kernel/cplb-nompu/cplbinit.c index 34e96ce02aa9..b49a53b583d5 100644 --- a/arch/blackfin/kernel/cplb-nompu/cplbinit.c +++ b/arch/blackfin/kernel/cplb-nompu/cplbinit.c | |||
@@ -30,6 +30,7 @@ void __init generate_cplb_tables_cpu(unsigned int cpu) | |||
30 | { | 30 | { |
31 | int i_d, i_i; | 31 | int i_d, i_i; |
32 | unsigned long addr; | 32 | unsigned long addr; |
33 | unsigned long cplb_pageflags, cplb_pagesize; | ||
33 | 34 | ||
34 | struct cplb_entry *d_tbl = dcplb_tbl[cpu]; | 35 | struct cplb_entry *d_tbl = dcplb_tbl[cpu]; |
35 | struct cplb_entry *i_tbl = icplb_tbl[cpu]; | 36 | struct cplb_entry *i_tbl = icplb_tbl[cpu]; |
@@ -49,11 +50,20 @@ void __init generate_cplb_tables_cpu(unsigned int cpu) | |||
49 | /* Cover kernel memory with 4M pages. */ | 50 | /* Cover kernel memory with 4M pages. */ |
50 | addr = 0; | 51 | addr = 0; |
51 | 52 | ||
52 | for (; addr < memory_start; addr += 4 * 1024 * 1024) { | 53 | #ifdef PAGE_SIZE_16MB |
54 | cplb_pageflags = PAGE_SIZE_16MB; | ||
55 | cplb_pagesize = SIZE_16M; | ||
56 | #else | ||
57 | cplb_pageflags = PAGE_SIZE_4MB; | ||
58 | cplb_pagesize = SIZE_4M; | ||
59 | #endif | ||
60 | |||
61 | |||
62 | for (; addr < memory_start; addr += cplb_pagesize) { | ||
53 | d_tbl[i_d].addr = addr; | 63 | d_tbl[i_d].addr = addr; |
54 | d_tbl[i_d++].data = SDRAM_DGENERIC | PAGE_SIZE_4MB; | 64 | d_tbl[i_d++].data = SDRAM_DGENERIC | cplb_pageflags; |
55 | i_tbl[i_i].addr = addr; | 65 | i_tbl[i_i].addr = addr; |
56 | i_tbl[i_i++].data = SDRAM_IGENERIC | PAGE_SIZE_4MB; | 66 | i_tbl[i_i++].data = SDRAM_IGENERIC | cplb_pageflags; |
57 | } | 67 | } |
58 | 68 | ||
59 | #ifdef CONFIG_ROMKERNEL | 69 | #ifdef CONFIG_ROMKERNEL |
diff --git a/arch/blackfin/kernel/cplb-nompu/cplbmgr.c b/arch/blackfin/kernel/cplb-nompu/cplbmgr.c index e854f9066cbd..79cc0f6dcdd5 100644 --- a/arch/blackfin/kernel/cplb-nompu/cplbmgr.c +++ b/arch/blackfin/kernel/cplb-nompu/cplbmgr.c | |||
@@ -145,7 +145,7 @@ MGR_ATTR static int dcplb_miss(int cpu) | |||
145 | unsigned long addr = bfin_read_DCPLB_FAULT_ADDR(); | 145 | unsigned long addr = bfin_read_DCPLB_FAULT_ADDR(); |
146 | int status = bfin_read_DCPLB_STATUS(); | 146 | int status = bfin_read_DCPLB_STATUS(); |
147 | int idx; | 147 | int idx; |
148 | unsigned long d_data, base, addr1, eaddr; | 148 | unsigned long d_data, base, addr1, eaddr, cplb_pagesize, cplb_pageflags; |
149 | 149 | ||
150 | nr_dcplb_miss[cpu]++; | 150 | nr_dcplb_miss[cpu]++; |
151 | if (unlikely(status & FAULT_USERSUPV)) | 151 | if (unlikely(status & FAULT_USERSUPV)) |
@@ -167,18 +167,37 @@ MGR_ATTR static int dcplb_miss(int cpu) | |||
167 | if (unlikely(d_data == 0)) | 167 | if (unlikely(d_data == 0)) |
168 | return CPLB_NO_ADDR_MATCH; | 168 | return CPLB_NO_ADDR_MATCH; |
169 | 169 | ||
170 | addr1 = addr & ~(SIZE_4M - 1); | ||
171 | addr &= ~(SIZE_1M - 1); | 170 | addr &= ~(SIZE_1M - 1); |
172 | d_data |= PAGE_SIZE_1MB; | 171 | d_data |= PAGE_SIZE_1MB; |
173 | if (addr1 >= base && (addr1 + SIZE_4M) <= eaddr) { | 172 | |
173 | /* BF60x support large than 4M CPLB page size */ | ||
174 | #ifdef PAGE_SIZE_16MB | ||
175 | cplb_pageflags = PAGE_SIZE_16MB; | ||
176 | cplb_pagesize = SIZE_16M; | ||
177 | #else | ||
178 | cplb_pageflags = PAGE_SIZE_4MB; | ||
179 | cplb_pagesize = SIZE_4M; | ||
180 | #endif | ||
181 | |||
182 | find_pagesize: | ||
183 | addr1 = addr & ~(cplb_pagesize - 1); | ||
184 | if (addr1 >= base && (addr1 + cplb_pagesize) <= eaddr) { | ||
174 | /* | 185 | /* |
175 | * This works because | 186 | * This works because |
176 | * (PAGE_SIZE_4MB & PAGE_SIZE_1MB) == PAGE_SIZE_1MB. | 187 | * (PAGE_SIZE_4MB & PAGE_SIZE_1MB) == PAGE_SIZE_1MB. |
177 | */ | 188 | */ |
178 | d_data |= PAGE_SIZE_4MB; | 189 | d_data |= cplb_pageflags; |
179 | addr = addr1; | 190 | addr = addr1; |
191 | goto found_pagesize; | ||
192 | } else { | ||
193 | if (cplb_pagesize > SIZE_4M) { | ||
194 | cplb_pageflags = PAGE_SIZE_4MB; | ||
195 | cplb_pagesize = SIZE_4M; | ||
196 | goto find_pagesize; | ||
197 | } | ||
180 | } | 198 | } |
181 | 199 | ||
200 | found_pagesize: | ||
182 | #ifdef CONFIG_BF60x | 201 | #ifdef CONFIG_BF60x |
183 | if ((addr >= ASYNC_BANK0_BASE) | 202 | if ((addr >= ASYNC_BANK0_BASE) |
184 | && (addr < ASYNC_BANK3_BASE + ASYNC_BANK3_SIZE)) | 203 | && (addr < ASYNC_BANK3_BASE + ASYNC_BANK3_SIZE)) |