aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mn10300
diff options
context:
space:
mode:
authorAkira Takeuchi <takeuchi.akr@jp.panasonic.com>2010-10-27 12:28:50 -0400
committerDavid Howells <dhowells@redhat.com>2010-10-27 12:28:50 -0400
commitdccbf4853a31a3f774f38c402209d23388d99f52 (patch)
treeec13031e27ee4ee5687dc2e178e6edcf86227e4c /arch/mn10300
parenta9bc60ebfd5766ce5f6095d0fed3d9978990122f (diff)
MN10300: Use the [ID]PTEL2 registers rather than [ID]PTEL for TLB control
Use the [ID]PTEL2 registers rather than [ID]PTEL for TLB control as the bits are a more suitable layout. Signed-off-by: Akira Takeuchi <takeuchi.akr@jp.panasonic.com> Signed-off-by: Kiyoshi Owada <owada.kiyoshi@jp.panasonic.com> Signed-off-by: David Howells <dhowells@redhat.com>
Diffstat (limited to 'arch/mn10300')
-rw-r--r--arch/mn10300/include/asm/cpu-regs.h19
-rw-r--r--arch/mn10300/include/asm/pgtable.h66
-rw-r--r--arch/mn10300/mm/tlb-mn10300.S27
3 files changed, 65 insertions, 47 deletions
diff --git a/arch/mn10300/include/asm/cpu-regs.h b/arch/mn10300/include/asm/cpu-regs.h
index 00e306ce52c..90ed4a365c9 100644
--- a/arch/mn10300/include/asm/cpu-regs.h
+++ b/arch/mn10300/include/asm/cpu-regs.h
@@ -252,14 +252,6 @@ asm(" .am33_2\n");
252#define xPTEL_PS_4Mb 0x00000c00 /* - 4Mb page */ 252#define xPTEL_PS_4Mb 0x00000c00 /* - 4Mb page */
253#define xPTEL_PPN 0xfffff006 /* physical page number */ 253#define xPTEL_PPN 0xfffff006 /* physical page number */
254 254
255#define xPTEL_V_BIT 0 /* bit numbers corresponding to above masks */
256#define xPTEL_UNUSED1_BIT 1
257#define xPTEL_UNUSED2_BIT 2
258#define xPTEL_C_BIT 3
259#define xPTEL_PV_BIT 4
260#define xPTEL_D_BIT 5
261#define xPTEL_G_BIT 9
262
263#define IPTEU __SYSREG(0xc00000a4, u32) /* instruction TLB virtual addr */ 255#define IPTEU __SYSREG(0xc00000a4, u32) /* instruction TLB virtual addr */
264#define DPTEU __SYSREG(0xc00000b4, u32) /* data TLB virtual addr */ 256#define DPTEU __SYSREG(0xc00000b4, u32) /* data TLB virtual addr */
265#define xPTEU_VPN 0xfffffc00 /* virtual page number */ 257#define xPTEU_VPN 0xfffffc00 /* virtual page number */
@@ -283,7 +275,16 @@ asm(" .am33_2\n");
283#define xPTEL2_PS_128Kb 0x00000100 /* - 128Kb page */ 275#define xPTEL2_PS_128Kb 0x00000100 /* - 128Kb page */
284#define xPTEL2_PS_1Kb 0x00000200 /* - 1Kb page */ 276#define xPTEL2_PS_1Kb 0x00000200 /* - 1Kb page */
285#define xPTEL2_PS_4Mb 0x00000300 /* - 4Mb page */ 277#define xPTEL2_PS_4Mb 0x00000300 /* - 4Mb page */
286#define xPTEL2_PPN 0xfffffc00 /* physical page number */ 278#define xPTEL2_CWT 0x00000400 /* cacheable write-through */
279#define xPTEL2_UNUSED1 0x00000800 /* unused bit (broadcast mask) */
280#define xPTEL2_PPN 0xfffff000 /* physical page number */
281
282#define xPTEL2_V_BIT 0 /* bit numbers corresponding to above masks */
283#define xPTEL2_C_BIT 1
284#define xPTEL2_PV_BIT 2
285#define xPTEL2_D_BIT 3
286#define xPTEL2_G_BIT 7
287#define xPTEL2_UNUSED1_BIT 11
287 288
288#define MMUFCR __SYSREGC(0xc000009c, u32) /* MMU exception cause */ 289#define MMUFCR __SYSREGC(0xc000009c, u32) /* MMU exception cause */
289#define MMUFCR_IFC __SYSREGC(0xc000009c, u16) /* MMU instruction excep cause */ 290#define MMUFCR_IFC __SYSREGC(0xc000009c, u16) /* MMU instruction excep cause */
diff --git a/arch/mn10300/include/asm/pgtable.h b/arch/mn10300/include/asm/pgtable.h
index b049a8bd157..05dda641af8 100644
--- a/arch/mn10300/include/asm/pgtable.h
+++ b/arch/mn10300/include/asm/pgtable.h
@@ -98,38 +98,44 @@ extern pgd_t swapper_pg_dir[PTRS_PER_PGD];
98extern pte_t kernel_vmalloc_ptes[(VMALLOC_END - VMALLOC_START) / PAGE_SIZE]; 98extern pte_t kernel_vmalloc_ptes[(VMALLOC_END - VMALLOC_START) / PAGE_SIZE];
99#endif 99#endif
100 100
101/* IPTEL/DPTEL bit assignments */ 101/* IPTEL2/DPTEL2 bit assignments */
102#define _PAGE_BIT_VALID xPTEL_V_BIT 102#define _PAGE_BIT_VALID xPTEL2_V_BIT
103#define _PAGE_BIT_ACCESSED xPTEL_UNUSED1_BIT /* mustn't be loaded into IPTEL/DPTEL */ 103#define _PAGE_BIT_CACHE xPTEL2_C_BIT
104#define _PAGE_BIT_NX xPTEL_UNUSED2_BIT /* mustn't be loaded into IPTEL/DPTEL */ 104#define _PAGE_BIT_PRESENT xPTEL2_PV_BIT
105#define _PAGE_BIT_CACHE xPTEL_C_BIT 105#define _PAGE_BIT_DIRTY xPTEL2_D_BIT
106#define _PAGE_BIT_PRESENT xPTEL_PV_BIT 106#define _PAGE_BIT_GLOBAL xPTEL2_G_BIT
107#define _PAGE_BIT_DIRTY xPTEL_D_BIT 107#define _PAGE_BIT_ACCESSED xPTEL2_UNUSED1_BIT /* mustn't be loaded into IPTEL2/DPTEL2 */
108#define _PAGE_BIT_GLOBAL xPTEL_G_BIT 108
109 109#define _PAGE_VALID xPTEL2_V
110#define _PAGE_VALID xPTEL_V 110#define _PAGE_CACHE xPTEL2_C
111#define _PAGE_ACCESSED xPTEL_UNUSED1 111#define _PAGE_PRESENT xPTEL2_PV
112#define _PAGE_NX xPTEL_UNUSED2 /* no-execute bit */ 112#define _PAGE_DIRTY xPTEL2_D
113#define _PAGE_CACHE xPTEL_C 113#define _PAGE_PROT xPTEL2_PR
114#define _PAGE_PRESENT xPTEL_PV 114#define _PAGE_PROT_RKNU xPTEL2_PR_ROK
115#define _PAGE_DIRTY xPTEL_D 115#define _PAGE_PROT_WKNU xPTEL2_PR_RWK
116#define _PAGE_PROT xPTEL_PR 116#define _PAGE_PROT_RKRU xPTEL2_PR_ROK_ROU
117#define _PAGE_PROT_RKNU xPTEL_PR_ROK 117#define _PAGE_PROT_WKRU xPTEL2_PR_RWK_ROU
118#define _PAGE_PROT_WKNU xPTEL_PR_RWK 118#define _PAGE_PROT_WKWU xPTEL2_PR_RWK_RWU
119#define _PAGE_PROT_RKRU xPTEL_PR_ROK_ROU 119#define _PAGE_GLOBAL xPTEL2_G
120#define _PAGE_PROT_WKRU xPTEL_PR_RWK_ROU 120#define _PAGE_PS_MASK xPTEL2_PS
121#define _PAGE_PROT_WKWU xPTEL_PR_RWK_RWU 121#define _PAGE_PS_4Kb xPTEL2_PS_4Kb
122#define _PAGE_GLOBAL xPTEL_G 122#define _PAGE_PS_128Kb xPTEL2_PS_128Kb
123#define _PAGE_PSE xPTEL_PS_4Mb /* 4MB page */ 123#define _PAGE_PS_1Kb xPTEL2_PS_1Kb
124 124#define _PAGE_PS_4Mb xPTEL2_PS_4Mb
125#define _PAGE_FILE xPTEL_UNUSED1_BIT /* set:pagecache unset:swap */ 125#define _PAGE_PSE xPTEL2_PS_4Mb /* 4MB page */
126 126#define _PAGE_CACHE_WT xPTEL2_CWT
127#define __PAGE_PROT_UWAUX 0x040 127#define _PAGE_ACCESSED xPTEL2_UNUSED1
128#define __PAGE_PROT_USER 0x080 128#define _PAGE_NX 0 /* no-execute bit */
129#define __PAGE_PROT_WRITE 0x100 129
130/* If _PAGE_VALID is clear, we use these: */
131#define _PAGE_FILE xPTEL2_C /* set:pagecache unset:swap */
132#define _PAGE_PROTNONE 0x000 /* If not present */
133
134#define __PAGE_PROT_UWAUX 0x010
135#define __PAGE_PROT_USER 0x020
136#define __PAGE_PROT_WRITE 0x040
130 137
131#define _PAGE_PRESENTV (_PAGE_PRESENT|_PAGE_VALID) 138#define _PAGE_PRESENTV (_PAGE_PRESENT|_PAGE_VALID)
132#define _PAGE_PROTNONE 0x000 /* If not present */
133 139
134#ifndef __ASSEMBLY__ 140#ifndef __ASSEMBLY__
135 141
diff --git a/arch/mn10300/mm/tlb-mn10300.S b/arch/mn10300/mm/tlb-mn10300.S
index ccf622999a5..b9940177d81 100644
--- a/arch/mn10300/mm/tlb-mn10300.S
+++ b/arch/mn10300/mm/tlb-mn10300.S
@@ -61,10 +61,16 @@ ENTRY(itlb_miss)
61 btst _PAGE_VALID,d2 61 btst _PAGE_VALID,d2
62 beq itlb_miss_fault # jump if doesn't point to a page 62 beq itlb_miss_fault # jump if doesn't point to a page
63 # (might be a swap id) 63 # (might be a swap id)
64#if ((_PAGE_ACCESSED & 0xffffff00) == 0)
64 bset _PAGE_ACCESSED,(0,a2) 65 bset _PAGE_ACCESSED,(0,a2)
65 and ~(xPTEL_UNUSED1|xPTEL_UNUSED2),d2 66#elif ((_PAGE_ACCESSED & 0xffff00ff) == 0)
67 bset +(_PAGE_ACCESSED >> 8),(1,a2)
68#else
69#error "_PAGE_ACCESSED value is out of range"
70#endif
71 and ~xPTEL2_UNUSED1,d2
66itlb_miss_set: 72itlb_miss_set:
67 mov d2,(IPTEL) # change the TLB 73 mov d2,(IPTEL2) # change the TLB
68#ifdef CONFIG_GDBSTUB 74#ifdef CONFIG_GDBSTUB
69 movm (sp),[d2,d3,a2] 75 movm (sp),[d2,d3,a2]
70#endif 76#endif
@@ -118,10 +124,16 @@ ENTRY(dtlb_miss)
118 btst _PAGE_VALID,d2 124 btst _PAGE_VALID,d2
119 beq dtlb_miss_fault # jump if doesn't point to a page 125 beq dtlb_miss_fault # jump if doesn't point to a page
120 # (might be a swap id) 126 # (might be a swap id)
127#if ((_PAGE_ACCESSED & 0xffffff00) == 0)
121 bset _PAGE_ACCESSED,(0,a2) 128 bset _PAGE_ACCESSED,(0,a2)
122 and ~(xPTEL_UNUSED1|xPTEL_UNUSED2),d2 129#elif ((_PAGE_ACCESSED & 0xffff00ff) == 0)
130 bset +(_PAGE_ACCESSED >> 8),(1,a2)
131#else
132#error "_PAGE_ACCESSED value is out of range"
133#endif
134 and ~xPTEL2_UNUSED1,d2
123dtlb_miss_set: 135dtlb_miss_set:
124 mov d2,(DPTEL) # change the TLB 136 mov d2,(DPTEL2) # change the TLB
125#ifdef CONFIG_GDBSTUB 137#ifdef CONFIG_GDBSTUB
126 movm (sp),[d2,d3,a2] 138 movm (sp),[d2,d3,a2]
127#endif 139#endif
@@ -156,13 +168,12 @@ ENTRY(itlb_aerror)
156 or 0x00010000,d1 # it's an instruction fetch 168 or 0x00010000,d1 # it's an instruction fetch
157 169
158 # determine the page address 170 # determine the page address
159 mov (IPTEU),a2 171 mov (IPTEU),d0
160 mov a2,d0
161 and PAGE_MASK,d0 172 and PAGE_MASK,d0
162 mov d0,(12,sp) 173 mov d0,(12,sp)
163 174
164 clr d0 175 clr d0
165 mov d0,(IPTEL) 176 mov d0,(IPTEL2)
166 177
167 or EPSW_IE,epsw 178 or EPSW_IE,epsw
168 mov fp,d0 179 mov fp,d0
@@ -199,7 +210,7 @@ ENTRY(dtlb_aerror)
199 mov d0,(12,sp) 210 mov d0,(12,sp)
200 211
201 clr d0 212 clr d0
202 mov d0,(DPTEL) 213 mov d0,(DPTEL2)
203 214
204 or EPSW_IE,epsw 215 or EPSW_IE,epsw
205 mov fp,d0 216 mov fp,d0