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 | |
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')
-rw-r--r-- | arch/blackfin/include/asm/def_LPBlackfin.h | 2 | ||||
-rw-r--r-- | arch/blackfin/kernel/cplb-nompu/cplbinit.c | 16 | ||||
-rw-r--r-- | arch/blackfin/kernel/cplb-nompu/cplbmgr.c | 27 | ||||
-rw-r--r-- | arch/blackfin/kernel/cplbinfo.c | 9 |
4 files changed, 45 insertions, 9 deletions
diff --git a/arch/blackfin/include/asm/def_LPBlackfin.h b/arch/blackfin/include/asm/def_LPBlackfin.h index fe0ca03a1cb2..ca67145c6a45 100644 --- a/arch/blackfin/include/asm/def_LPBlackfin.h +++ b/arch/blackfin/include/asm/def_LPBlackfin.h | |||
@@ -622,10 +622,12 @@ do { \ | |||
622 | #define PAGE_SIZE_4KB 0x00010000 /* 4 KB page size */ | 622 | #define PAGE_SIZE_4KB 0x00010000 /* 4 KB page size */ |
623 | #define PAGE_SIZE_1MB 0x00020000 /* 1 MB page size */ | 623 | #define PAGE_SIZE_1MB 0x00020000 /* 1 MB page size */ |
624 | #define PAGE_SIZE_4MB 0x00030000 /* 4 MB page size */ | 624 | #define PAGE_SIZE_4MB 0x00030000 /* 4 MB page size */ |
625 | #ifdef CONFIG_BF60x | ||
625 | #define PAGE_SIZE_16KB 0x00040000 /* 16 KB page size */ | 626 | #define PAGE_SIZE_16KB 0x00040000 /* 16 KB page size */ |
626 | #define PAGE_SIZE_64KB 0x00050000 /* 64 KB page size */ | 627 | #define PAGE_SIZE_64KB 0x00050000 /* 64 KB page size */ |
627 | #define PAGE_SIZE_16MB 0x00060000 /* 16 MB page size */ | 628 | #define PAGE_SIZE_16MB 0x00060000 /* 16 MB page size */ |
628 | #define PAGE_SIZE_64MB 0x00070000 /* 64 MB page size */ | 629 | #define PAGE_SIZE_64MB 0x00070000 /* 64 MB page size */ |
630 | #endif | ||
629 | #define CPLB_L1SRAM 0x00000020 /* 0=SRAM mapped in L1, 0=SRAM not | 631 | #define CPLB_L1SRAM 0x00000020 /* 0=SRAM mapped in L1, 0=SRAM not |
630 | * mapped to L1 | 632 | * mapped to L1 |
631 | */ | 633 | */ |
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)) |
diff --git a/arch/blackfin/kernel/cplbinfo.c b/arch/blackfin/kernel/cplbinfo.c index e1d0b24c6070..49b28ed29737 100644 --- a/arch/blackfin/kernel/cplbinfo.c +++ b/arch/blackfin/kernel/cplbinfo.c | |||
@@ -17,8 +17,13 @@ | |||
17 | #include <asm/cplbinit.h> | 17 | #include <asm/cplbinit.h> |
18 | #include <asm/blackfin.h> | 18 | #include <asm/blackfin.h> |
19 | 19 | ||
20 | static char const page_strtbl[][3] = { "1K", "4K", "1M", "4M" }; | 20 | static char const page_strtbl[][4] = { |
21 | #define page(flags) (((flags) & 0x30000) >> 16) | 21 | "1K", "4K", "1M", "4M", |
22 | #ifdef CONFIG_BF60x | ||
23 | "16K", "64K", "16M", "64M", | ||
24 | #endif | ||
25 | }; | ||
26 | #define page(flags) (((flags) & 0x70000) >> 16) | ||
22 | #define strpage(flags) page_strtbl[page(flags)] | 27 | #define strpage(flags) page_strtbl[page(flags)] |
23 | 28 | ||
24 | struct cplbinfo_data { | 29 | struct cplbinfo_data { |