Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

+45 -9
+2
arch/blackfin/include/asm/def_LPBlackfin.h
··· 622 622 #define PAGE_SIZE_4KB 0x00010000 /* 4 KB page size */ 623 623 #define PAGE_SIZE_1MB 0x00020000 /* 1 MB page size */ 624 624 #define PAGE_SIZE_4MB 0x00030000 /* 4 MB page size */ 625 + #ifdef CONFIG_BF60x 625 626 #define PAGE_SIZE_16KB 0x00040000 /* 16 KB page size */ 626 627 #define PAGE_SIZE_64KB 0x00050000 /* 64 KB page size */ 627 628 #define PAGE_SIZE_16MB 0x00060000 /* 16 MB page size */ 628 629 #define PAGE_SIZE_64MB 0x00070000 /* 64 MB page size */ 630 + #endif 629 631 #define CPLB_L1SRAM 0x00000020 /* 0=SRAM mapped in L1, 0=SRAM not 630 632 * mapped to L1 631 633 */
+13 -3
arch/blackfin/kernel/cplb-nompu/cplbinit.c
··· 30 30 { 31 31 int i_d, i_i; 32 32 unsigned long addr; 33 + unsigned long cplb_pageflags, cplb_pagesize; 33 34 34 35 struct cplb_entry *d_tbl = dcplb_tbl[cpu]; 35 36 struct cplb_entry *i_tbl = icplb_tbl[cpu]; ··· 50 49 /* Cover kernel memory with 4M pages. */ 51 50 addr = 0; 52 51 53 - for (; addr < memory_start; addr += 4 * 1024 * 1024) { 52 + #ifdef PAGE_SIZE_16MB 53 + cplb_pageflags = PAGE_SIZE_16MB; 54 + cplb_pagesize = SIZE_16M; 55 + #else 56 + cplb_pageflags = PAGE_SIZE_4MB; 57 + cplb_pagesize = SIZE_4M; 58 + #endif 59 + 60 + 61 + for (; addr < memory_start; addr += cplb_pagesize) { 54 62 d_tbl[i_d].addr = addr; 55 - d_tbl[i_d++].data = SDRAM_DGENERIC | PAGE_SIZE_4MB; 63 + d_tbl[i_d++].data = SDRAM_DGENERIC | cplb_pageflags; 56 64 i_tbl[i_i].addr = addr; 57 - i_tbl[i_i++].data = SDRAM_IGENERIC | PAGE_SIZE_4MB; 65 + i_tbl[i_i++].data = SDRAM_IGENERIC | cplb_pageflags; 58 66 } 59 67 60 68 #ifdef CONFIG_ROMKERNEL
+23 -4
arch/blackfin/kernel/cplb-nompu/cplbmgr.c
··· 145 145 unsigned long addr = bfin_read_DCPLB_FAULT_ADDR(); 146 146 int status = bfin_read_DCPLB_STATUS(); 147 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 150 nr_dcplb_miss[cpu]++; 151 151 if (unlikely(status & FAULT_USERSUPV)) ··· 167 167 if (unlikely(d_data == 0)) 168 168 return CPLB_NO_ADDR_MATCH; 169 169 170 - addr1 = addr & ~(SIZE_4M - 1); 171 170 addr &= ~(SIZE_1M - 1); 172 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 186 * This works because 176 187 * (PAGE_SIZE_4MB & PAGE_SIZE_1MB) == PAGE_SIZE_1MB. 177 188 */ 178 - d_data |= PAGE_SIZE_4MB; 189 + d_data |= cplb_pageflags; 179 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 201 #ifdef CONFIG_BF60x 183 202 if ((addr >= ASYNC_BANK0_BASE) 184 203 && (addr < ASYNC_BANK3_BASE + ASYNC_BANK3_SIZE))
+7 -2
arch/blackfin/kernel/cplbinfo.c
··· 17 17 #include <asm/cplbinit.h> 18 18 #include <asm/blackfin.h> 19 19 20 - static char const page_strtbl[][3] = { "1K", "4K", "1M", "4M" }; 21 - #define page(flags) (((flags) & 0x30000) >> 16) 20 + static char const page_strtbl[][4] = { 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 27 #define strpage(flags) page_strtbl[page(flags)] 23 28 24 29 struct cplbinfo_data {