diff options
author | Paul Burton <paul.burton@mips.com> | 2019-08-31 11:40:43 -0400 |
---|---|---|
committer | Paul Burton <paul.burton@mips.com> | 2019-09-03 09:20:43 -0400 |
commit | 5474682934753827d61d1226ba74ea75787b923d (patch) | |
tree | fb4e214cd30494841d865732b936179ea8d0b9c7 | |
parent | 813cafc4109c63a666e244c89f080ae27e4310b4 (diff) |
MIPS: Select R3k-style TLB in Kconfig
Currently areas where we need to determine whether the TLB is R3k-style
need to check for either of CONFIG_CPU_R3000 || CONFIG_CPU_TX39XX.
Introduce a new CONFIG_CPU_R3K_TLB & select it from both of the above,
allowing us to simplify checks for R3k-style TLBs by only checking for
this new Kconfig option.
Signed-off-by: Paul Burton <paul.burton@mips.com>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Cc: linux-mips@vger.kernel.org
-rw-r--r-- | arch/mips/Kconfig | 7 | ||||
-rw-r--r-- | arch/mips/include/asm/pgtable-32.h | 4 | ||||
-rw-r--r-- | arch/mips/include/asm/pgtable-bits.h | 6 | ||||
-rw-r--r-- | arch/mips/include/asm/pgtable.h | 4 | ||||
-rw-r--r-- | arch/mips/mm/Makefile | 5 |
5 files changed, 16 insertions, 10 deletions
diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig index 31c7044e34e6..3f18aa018a0c 100644 --- a/arch/mips/Kconfig +++ b/arch/mips/Kconfig | |||
@@ -1575,6 +1575,7 @@ config CPU_R3000 | |||
1575 | depends on SYS_HAS_CPU_R3000 | 1575 | depends on SYS_HAS_CPU_R3000 |
1576 | select CPU_HAS_WB | 1576 | select CPU_HAS_WB |
1577 | select CPU_HAS_LOAD_STORE_LR | 1577 | select CPU_HAS_LOAD_STORE_LR |
1578 | select CPU_R3K_TLB | ||
1578 | select CPU_SUPPORTS_32BIT_KERNEL | 1579 | select CPU_SUPPORTS_32BIT_KERNEL |
1579 | select CPU_SUPPORTS_HIGHMEM | 1580 | select CPU_SUPPORTS_HIGHMEM |
1580 | help | 1581 | help |
@@ -1590,6 +1591,7 @@ config CPU_TX39XX | |||
1590 | depends on SYS_HAS_CPU_TX39XX | 1591 | depends on SYS_HAS_CPU_TX39XX |
1591 | select CPU_SUPPORTS_32BIT_KERNEL | 1592 | select CPU_SUPPORTS_32BIT_KERNEL |
1592 | select CPU_HAS_LOAD_STORE_LR | 1593 | select CPU_HAS_LOAD_STORE_LR |
1594 | select CPU_R3K_TLB | ||
1593 | 1595 | ||
1594 | config CPU_VR41XX | 1596 | config CPU_VR41XX |
1595 | bool "R41xx" | 1597 | bool "R41xx" |
@@ -2280,6 +2282,9 @@ config CPU_R2300_FPU | |||
2280 | depends on MIPS_FP_SUPPORT | 2282 | depends on MIPS_FP_SUPPORT |
2281 | default y if CPU_R3000 || CPU_TX39XX | 2283 | default y if CPU_R3000 || CPU_TX39XX |
2282 | 2284 | ||
2285 | config CPU_R3K_TLB | ||
2286 | bool | ||
2287 | |||
2283 | config CPU_R4K_FPU | 2288 | config CPU_R4K_FPU |
2284 | bool | 2289 | bool |
2285 | depends on MIPS_FP_SUPPORT | 2290 | depends on MIPS_FP_SUPPORT |
@@ -2287,7 +2292,7 @@ config CPU_R4K_FPU | |||
2287 | 2292 | ||
2288 | config CPU_R4K_CACHE_TLB | 2293 | config CPU_R4K_CACHE_TLB |
2289 | bool | 2294 | bool |
2290 | default y if !(CPU_R3000 || CPU_SB1 || CPU_TX39XX || CPU_CAVIUM_OCTEON) | 2295 | default y if !(CPU_R3K_TLB || CPU_SB1 || CPU_CAVIUM_OCTEON) |
2291 | 2296 | ||
2292 | config MIPS_MT_SMP | 2297 | config MIPS_MT_SMP |
2293 | bool "MIPS MT SMP support (1 TC on each available VPE)" | 2298 | bool "MIPS MT SMP support (1 TC on each available VPE)" |
diff --git a/arch/mips/include/asm/pgtable-32.h b/arch/mips/include/asm/pgtable-32.h index e600570789f4..ba967148b016 100644 --- a/arch/mips/include/asm/pgtable-32.h +++ b/arch/mips/include/asm/pgtable-32.h | |||
@@ -221,7 +221,7 @@ static inline pte_t pfn_pte(unsigned long pfn, pgprot_t prot) | |||
221 | ((pte_t *)page_address(pmd_page(*(dir))) + __pte_offset(address)) | 221 | ((pte_t *)page_address(pmd_page(*(dir))) + __pte_offset(address)) |
222 | #define pte_unmap(pte) ((void)(pte)) | 222 | #define pte_unmap(pte) ((void)(pte)) |
223 | 223 | ||
224 | #if defined(CONFIG_CPU_R3000) || defined(CONFIG_CPU_TX39XX) | 224 | #if defined(CONFIG_CPU_R3K_TLB) |
225 | 225 | ||
226 | /* Swap entries must have VALID bit cleared. */ | 226 | /* Swap entries must have VALID bit cleared. */ |
227 | #define __swp_type(x) (((x).val >> 10) & 0x1f) | 227 | #define __swp_type(x) (((x).val >> 10) & 0x1f) |
@@ -266,6 +266,6 @@ static inline pte_t pfn_pte(unsigned long pfn, pgprot_t prot) | |||
266 | 266 | ||
267 | #endif /* defined(CONFIG_PHYS_ADDR_T_64BIT) && defined(CONFIG_CPU_MIPS32) */ | 267 | #endif /* defined(CONFIG_PHYS_ADDR_T_64BIT) && defined(CONFIG_CPU_MIPS32) */ |
268 | 268 | ||
269 | #endif /* defined(CONFIG_CPU_R3000) || defined(CONFIG_CPU_TX39XX) */ | 269 | #endif /* defined(CONFIG_CPU_R3K_TLB) */ |
270 | 270 | ||
271 | #endif /* _ASM_PGTABLE_32_H */ | 271 | #endif /* _ASM_PGTABLE_32_H */ |
diff --git a/arch/mips/include/asm/pgtable-bits.h b/arch/mips/include/asm/pgtable-bits.h index c2c1060b43ef..5f1ced8cba07 100644 --- a/arch/mips/include/asm/pgtable-bits.h +++ b/arch/mips/include/asm/pgtable-bits.h | |||
@@ -82,7 +82,7 @@ enum pgtable_bits { | |||
82 | _PAGE_SPECIAL_SHIFT, | 82 | _PAGE_SPECIAL_SHIFT, |
83 | }; | 83 | }; |
84 | 84 | ||
85 | #elif defined(CONFIG_CPU_R3000) || defined(CONFIG_CPU_TX39XX) | 85 | #elif defined(CONFIG_CPU_R3K_TLB) |
86 | 86 | ||
87 | /* Page table bits used for r3k systems */ | 87 | /* Page table bits used for r3k systems */ |
88 | enum pgtable_bits { | 88 | enum pgtable_bits { |
@@ -151,7 +151,7 @@ enum pgtable_bits { | |||
151 | #define _PAGE_GLOBAL (1 << _PAGE_GLOBAL_SHIFT) | 151 | #define _PAGE_GLOBAL (1 << _PAGE_GLOBAL_SHIFT) |
152 | #define _PAGE_VALID (1 << _PAGE_VALID_SHIFT) | 152 | #define _PAGE_VALID (1 << _PAGE_VALID_SHIFT) |
153 | #define _PAGE_DIRTY (1 << _PAGE_DIRTY_SHIFT) | 153 | #define _PAGE_DIRTY (1 << _PAGE_DIRTY_SHIFT) |
154 | #if defined(CONFIG_CPU_R3000) || defined(CONFIG_CPU_TX39XX) | 154 | #if defined(CONFIG_CPU_R3K_TLB) |
155 | # define _CACHE_UNCACHED (1 << _CACHE_UNCACHED_SHIFT) | 155 | # define _CACHE_UNCACHED (1 << _CACHE_UNCACHED_SHIFT) |
156 | # define _CACHE_MASK _CACHE_UNCACHED | 156 | # define _CACHE_MASK _CACHE_UNCACHED |
157 | # define _PFN_SHIFT PAGE_SHIFT | 157 | # define _PFN_SHIFT PAGE_SHIFT |
@@ -209,7 +209,7 @@ static inline uint64_t pte_to_entrylo(unsigned long pte_val) | |||
209 | /* | 209 | /* |
210 | * Cache attributes | 210 | * Cache attributes |
211 | */ | 211 | */ |
212 | #if defined(CONFIG_CPU_R3000) || defined(CONFIG_CPU_TX39XX) | 212 | #if defined(CONFIG_CPU_R3K_TLB) |
213 | 213 | ||
214 | #define _CACHE_CACHABLE_NONCOHERENT 0 | 214 | #define _CACHE_CACHABLE_NONCOHERENT 0 |
215 | #define _CACHE_UNCACHED_ACCELERATED _CACHE_UNCACHED | 215 | #define _CACHE_UNCACHED_ACCELERATED _CACHE_UNCACHED |
diff --git a/arch/mips/include/asm/pgtable.h b/arch/mips/include/asm/pgtable.h index d60f47a9088c..4dca733d5076 100644 --- a/arch/mips/include/asm/pgtable.h +++ b/arch/mips/include/asm/pgtable.h | |||
@@ -199,7 +199,7 @@ static inline void pte_clear(struct mm_struct *mm, unsigned long addr, pte_t *pt | |||
199 | static inline void set_pte(pte_t *ptep, pte_t pteval) | 199 | static inline void set_pte(pte_t *ptep, pte_t pteval) |
200 | { | 200 | { |
201 | *ptep = pteval; | 201 | *ptep = pteval; |
202 | #if !defined(CONFIG_CPU_R3000) && !defined(CONFIG_CPU_TX39XX) | 202 | #if !defined(CONFIG_CPU_R3K_TLB) |
203 | if (pte_val(pteval) & _PAGE_GLOBAL) { | 203 | if (pte_val(pteval) & _PAGE_GLOBAL) { |
204 | pte_t *buddy = ptep_buddy(ptep); | 204 | pte_t *buddy = ptep_buddy(ptep); |
205 | /* | 205 | /* |
@@ -218,7 +218,7 @@ static inline void set_pte(pte_t *ptep, pte_t pteval) | |||
218 | static inline void pte_clear(struct mm_struct *mm, unsigned long addr, pte_t *ptep) | 218 | static inline void pte_clear(struct mm_struct *mm, unsigned long addr, pte_t *ptep) |
219 | { | 219 | { |
220 | htw_stop(); | 220 | htw_stop(); |
221 | #if !defined(CONFIG_CPU_R3000) && !defined(CONFIG_CPU_TX39XX) | 221 | #if !defined(CONFIG_CPU_R3K_TLB) |
222 | /* Preserve global status for the pair */ | 222 | /* Preserve global status for the pair */ |
223 | if (pte_val(*ptep_buddy(ptep)) & _PAGE_GLOBAL) | 223 | if (pte_val(*ptep_buddy(ptep)) & _PAGE_GLOBAL) |
224 | set_pte_at(mm, addr, ptep, __pte(_PAGE_GLOBAL)); | 224 | set_pte_at(mm, addr, ptep, __pte(_PAGE_GLOBAL)); |
diff --git a/arch/mips/mm/Makefile b/arch/mips/mm/Makefile index 949d43eefda1..46f483e952c8 100644 --- a/arch/mips/mm/Makefile +++ b/arch/mips/mm/Makefile | |||
@@ -28,10 +28,11 @@ obj-$(CONFIG_HIGHMEM) += highmem.o | |||
28 | obj-$(CONFIG_HUGETLB_PAGE) += hugetlbpage.o | 28 | obj-$(CONFIG_HUGETLB_PAGE) += hugetlbpage.o |
29 | obj-$(CONFIG_DMA_NONCOHERENT) += dma-noncoherent.o | 29 | obj-$(CONFIG_DMA_NONCOHERENT) += dma-noncoherent.o |
30 | 30 | ||
31 | obj-$(CONFIG_CPU_R3K_TLB) += tlb-r3k.o | ||
31 | obj-$(CONFIG_CPU_R4K_CACHE_TLB) += c-r4k.o cex-gen.o tlb-r4k.o | 32 | obj-$(CONFIG_CPU_R4K_CACHE_TLB) += c-r4k.o cex-gen.o tlb-r4k.o |
32 | obj-$(CONFIG_CPU_R3000) += c-r3k.o tlb-r3k.o | 33 | obj-$(CONFIG_CPU_R3000) += c-r3k.o |
33 | obj-$(CONFIG_CPU_SB1) += c-r4k.o cerr-sb1.o cex-sb1.o tlb-r4k.o | 34 | obj-$(CONFIG_CPU_SB1) += c-r4k.o cerr-sb1.o cex-sb1.o tlb-r4k.o |
34 | obj-$(CONFIG_CPU_TX39XX) += c-tx39.o tlb-r3k.o | 35 | obj-$(CONFIG_CPU_TX39XX) += c-tx39.o |
35 | obj-$(CONFIG_CPU_CAVIUM_OCTEON) += c-octeon.o cex-oct.o tlb-r4k.o | 36 | obj-$(CONFIG_CPU_CAVIUM_OCTEON) += c-octeon.o cex-oct.o tlb-r4k.o |
36 | 37 | ||
37 | obj-$(CONFIG_IP22_CPU_SCACHE) += sc-ip22.o | 38 | obj-$(CONFIG_IP22_CPU_SCACHE) += sc-ip22.o |