diff options
author | James Bottomley <James.Bottomley@HansenPartnership.com> | 2010-12-22 11:22:11 -0500 |
---|---|---|
committer | James Bottomley <James.Bottomley@suse.de> | 2011-01-15 09:44:40 -0500 |
commit | f311847c2fcebd81912e2f0caf8a461dec28db41 (patch) | |
tree | 802ef2aa01bd0d662e60412366a40c827fd3e875 /arch/parisc/kernel/entry.S | |
parent | 38567333a6dabd0f2b4150e9fb6dd8e3ba2985e5 (diff) |
parisc: flush pages through tmpalias space
The kernel has an 8M tmpailas space (originally designed for copying
and clearing pages but now only used for clearing). The idea is
to place zeros into the cache above a physical page rather than into
the physical page and flush the cache, because often the zeros end up
being replaced quickly anyway.
We can also use the tmpalias space for flushing a page. The difference
here is that we have to do tmpalias processing in the non access data and
instruction traps. The principle is the same: as long as we know the physical
address and have a virtual address congruent to the real one, the flush will
be effective.
In order to use the tmpalias space, the icache miss path has to be enhanced to
check for the alias region to make the fic instruction effective.
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
Diffstat (limited to 'arch/parisc/kernel/entry.S')
-rw-r--r-- | arch/parisc/kernel/entry.S | 194 |
1 files changed, 142 insertions, 52 deletions
diff --git a/arch/parisc/kernel/entry.S b/arch/parisc/kernel/entry.S index 6337adef30f6..e8c119b61fc7 100644 --- a/arch/parisc/kernel/entry.S +++ b/arch/parisc/kernel/entry.S | |||
@@ -225,22 +225,13 @@ | |||
225 | #ifndef CONFIG_64BIT | 225 | #ifndef CONFIG_64BIT |
226 | /* | 226 | /* |
227 | * naitlb miss interruption handler (parisc 1.1 - 32 bit) | 227 | * naitlb miss interruption handler (parisc 1.1 - 32 bit) |
228 | * | ||
229 | * Note: naitlb misses will be treated | ||
230 | * as an ordinary itlb miss for now. | ||
231 | * However, note that naitlb misses | ||
232 | * have the faulting address in the | ||
233 | * IOR/ISR. | ||
234 | */ | 228 | */ |
235 | 229 | ||
236 | .macro naitlb_11 code | 230 | .macro naitlb_11 code |
237 | 231 | ||
238 | mfctl %isr,spc | 232 | mfctl %isr,spc |
239 | b itlb_miss_11 | 233 | b naitlb_miss_11 |
240 | mfctl %ior,va | 234 | mfctl %ior,va |
241 | /* FIXME: If user causes a naitlb miss, the priv level may not be in | ||
242 | * lower bits of va, where the itlb miss handler is expecting them | ||
243 | */ | ||
244 | 235 | ||
245 | .align 32 | 236 | .align 32 |
246 | .endm | 237 | .endm |
@@ -248,26 +239,17 @@ | |||
248 | 239 | ||
249 | /* | 240 | /* |
250 | * naitlb miss interruption handler (parisc 2.0) | 241 | * naitlb miss interruption handler (parisc 2.0) |
251 | * | ||
252 | * Note: naitlb misses will be treated | ||
253 | * as an ordinary itlb miss for now. | ||
254 | * However, note that naitlb misses | ||
255 | * have the faulting address in the | ||
256 | * IOR/ISR. | ||
257 | */ | 242 | */ |
258 | 243 | ||
259 | .macro naitlb_20 code | 244 | .macro naitlb_20 code |
260 | 245 | ||
261 | mfctl %isr,spc | 246 | mfctl %isr,spc |
262 | #ifdef CONFIG_64BIT | 247 | #ifdef CONFIG_64BIT |
263 | b itlb_miss_20w | 248 | b naitlb_miss_20w |
264 | #else | 249 | #else |
265 | b itlb_miss_20 | 250 | b naitlb_miss_20 |
266 | #endif | 251 | #endif |
267 | mfctl %ior,va | 252 | mfctl %ior,va |
268 | /* FIXME: If user causes a naitlb miss, the priv level may not be in | ||
269 | * lower bits of va, where the itlb miss handler is expecting them | ||
270 | */ | ||
271 | 253 | ||
272 | .align 32 | 254 | .align 32 |
273 | .endm | 255 | .endm |
@@ -581,7 +563,24 @@ | |||
581 | copy \va,\tmp1 | 563 | copy \va,\tmp1 |
582 | depi 0,31,23,\tmp1 | 564 | depi 0,31,23,\tmp1 |
583 | cmpb,COND(<>),n \tmp,\tmp1,\fault | 565 | cmpb,COND(<>),n \tmp,\tmp1,\fault |
584 | ldi (_PAGE_DIRTY|_PAGE_WRITE|_PAGE_READ),\prot | 566 | mfctl %cr19,\tmp /* iir */ |
567 | /* get the opcode (first six bits) into \tmp */ | ||
568 | extrw,u \tmp,5,6,\tmp | ||
569 | /* | ||
570 | * Only setting the T bit prevents data cache movein | ||
571 | * Setting access rights to zero prevents instruction cache movein | ||
572 | * | ||
573 | * Note subtlety here: _PAGE_GATEWAY, _PAGE_EXEC and _PAGE_WRITE go | ||
574 | * to type field and _PAGE_READ goes to top bit of PL1 | ||
575 | */ | ||
576 | ldi (_PAGE_REFTRAP|_PAGE_READ|_PAGE_WRITE),\prot | ||
577 | /* | ||
578 | * so if the opcode is one (i.e. this is a memory management | ||
579 | * instruction) nullify the next load so \prot is only T. | ||
580 | * Otherwise this is a normal data operation | ||
581 | */ | ||
582 | cmpiclr,= 0x01,\tmp,%r0 | ||
583 | ldi (_PAGE_DIRTY|_PAGE_READ|_PAGE_WRITE),\prot | ||
585 | depd,z \prot,8,7,\prot | 584 | depd,z \prot,8,7,\prot |
586 | /* | 585 | /* |
587 | * OK, it is in the temp alias region, check whether "from" or "to". | 586 | * OK, it is in the temp alias region, check whether "from" or "to". |
@@ -631,11 +630,7 @@ ENTRY(fault_vector_20) | |||
631 | def 13 | 630 | def 13 |
632 | def 14 | 631 | def 14 |
633 | dtlb_20 15 | 632 | dtlb_20 15 |
634 | #if 0 | ||
635 | naitlb_20 16 | 633 | naitlb_20 16 |
636 | #else | ||
637 | def 16 | ||
638 | #endif | ||
639 | nadtlb_20 17 | 634 | nadtlb_20 17 |
640 | def 18 | 635 | def 18 |
641 | def 19 | 636 | def 19 |
@@ -678,11 +673,7 @@ ENTRY(fault_vector_11) | |||
678 | def 13 | 673 | def 13 |
679 | def 14 | 674 | def 14 |
680 | dtlb_11 15 | 675 | dtlb_11 15 |
681 | #if 0 | ||
682 | naitlb_11 16 | 676 | naitlb_11 16 |
683 | #else | ||
684 | def 16 | ||
685 | #endif | ||
686 | nadtlb_11 17 | 677 | nadtlb_11 17 |
687 | def 18 | 678 | def 18 |
688 | def 19 | 679 | def 19 |
@@ -1203,7 +1194,7 @@ nadtlb_miss_20w: | |||
1203 | get_pgd spc,ptp | 1194 | get_pgd spc,ptp |
1204 | space_check spc,t0,nadtlb_fault | 1195 | space_check spc,t0,nadtlb_fault |
1205 | 1196 | ||
1206 | L3_ptep ptp,pte,t0,va,nadtlb_check_flush_20w | 1197 | L3_ptep ptp,pte,t0,va,nadtlb_check_alias_20w |
1207 | 1198 | ||
1208 | update_ptep ptp,pte,t0,t1 | 1199 | update_ptep ptp,pte,t0,t1 |
1209 | 1200 | ||
@@ -1214,6 +1205,14 @@ nadtlb_miss_20w: | |||
1214 | rfir | 1205 | rfir |
1215 | nop | 1206 | nop |
1216 | 1207 | ||
1208 | nadtlb_check_alias_20w: | ||
1209 | do_alias spc,t0,t1,va,pte,prot,nadtlb_check_flush_20w | ||
1210 | |||
1211 | idtlbt pte,prot | ||
1212 | |||
1213 | rfir | ||
1214 | nop | ||
1215 | |||
1217 | nadtlb_check_flush_20w: | 1216 | nadtlb_check_flush_20w: |
1218 | bb,>=,n pte,_PAGE_FLUSH_BIT,nadtlb_emulate | 1217 | bb,>=,n pte,_PAGE_FLUSH_BIT,nadtlb_emulate |
1219 | 1218 | ||
@@ -1255,25 +1254,7 @@ dtlb_miss_11: | |||
1255 | nop | 1254 | nop |
1256 | 1255 | ||
1257 | dtlb_check_alias_11: | 1256 | dtlb_check_alias_11: |
1258 | 1257 | do_alias spc,t0,t1,va,pte,prot,dtlb_fault | |
1259 | /* Check to see if fault is in the temporary alias region */ | ||
1260 | |||
1261 | cmpib,<>,n 0,spc,dtlb_fault /* forward */ | ||
1262 | ldil L%(TMPALIAS_MAP_START),t0 | ||
1263 | copy va,t1 | ||
1264 | depwi 0,31,23,t1 | ||
1265 | cmpb,<>,n t0,t1,dtlb_fault /* forward */ | ||
1266 | ldi (_PAGE_DIRTY|_PAGE_WRITE|_PAGE_READ),prot | ||
1267 | depw,z prot,8,7,prot | ||
1268 | |||
1269 | /* | ||
1270 | * OK, it is in the temp alias region, check whether "from" or "to". | ||
1271 | * Check "subtle" note in pacache.S re: r23/r26. | ||
1272 | */ | ||
1273 | |||
1274 | extrw,u,= va,9,1,r0 | ||
1275 | or,tr %r23,%r0,pte /* If "from" use "from" page */ | ||
1276 | or %r26,%r0,pte /* else "to", use "to" page */ | ||
1277 | 1258 | ||
1278 | idtlba pte,(va) | 1259 | idtlba pte,(va) |
1279 | idtlbp prot,(va) | 1260 | idtlbp prot,(va) |
@@ -1286,7 +1267,7 @@ nadtlb_miss_11: | |||
1286 | 1267 | ||
1287 | space_check spc,t0,nadtlb_fault | 1268 | space_check spc,t0,nadtlb_fault |
1288 | 1269 | ||
1289 | L2_ptep ptp,pte,t0,va,nadtlb_check_flush_11 | 1270 | L2_ptep ptp,pte,t0,va,nadtlb_check_alias_11 |
1290 | 1271 | ||
1291 | update_ptep ptp,pte,t0,t1 | 1272 | update_ptep ptp,pte,t0,t1 |
1292 | 1273 | ||
@@ -1304,6 +1285,15 @@ nadtlb_miss_11: | |||
1304 | rfir | 1285 | rfir |
1305 | nop | 1286 | nop |
1306 | 1287 | ||
1288 | nadtlb_check_alias_11: | ||
1289 | do_alias spc,t0,t1,va,pte,prot,nadtlb_check_flush_11 | ||
1290 | |||
1291 | idtlba pte,(va) | ||
1292 | idtlbp prot,(va) | ||
1293 | |||
1294 | rfir | ||
1295 | nop | ||
1296 | |||
1307 | nadtlb_check_flush_11: | 1297 | nadtlb_check_flush_11: |
1308 | bb,>=,n pte,_PAGE_FLUSH_BIT,nadtlb_emulate | 1298 | bb,>=,n pte,_PAGE_FLUSH_BIT,nadtlb_emulate |
1309 | 1299 | ||
@@ -1359,7 +1349,7 @@ nadtlb_miss_20: | |||
1359 | 1349 | ||
1360 | space_check spc,t0,nadtlb_fault | 1350 | space_check spc,t0,nadtlb_fault |
1361 | 1351 | ||
1362 | L2_ptep ptp,pte,t0,va,nadtlb_check_flush_20 | 1352 | L2_ptep ptp,pte,t0,va,nadtlb_check_alias_20 |
1363 | 1353 | ||
1364 | update_ptep ptp,pte,t0,t1 | 1354 | update_ptep ptp,pte,t0,t1 |
1365 | 1355 | ||
@@ -1372,6 +1362,14 @@ nadtlb_miss_20: | |||
1372 | rfir | 1362 | rfir |
1373 | nop | 1363 | nop |
1374 | 1364 | ||
1365 | nadtlb_check_alias_20: | ||
1366 | do_alias spc,t0,t1,va,pte,prot,nadtlb_check_flush_20 | ||
1367 | |||
1368 | idtlbt pte,prot | ||
1369 | |||
1370 | rfir | ||
1371 | nop | ||
1372 | |||
1375 | nadtlb_check_flush_20: | 1373 | nadtlb_check_flush_20: |
1376 | bb,>=,n pte,_PAGE_FLUSH_BIT,nadtlb_emulate | 1374 | bb,>=,n pte,_PAGE_FLUSH_BIT,nadtlb_emulate |
1377 | 1375 | ||
@@ -1484,6 +1482,36 @@ itlb_miss_20w: | |||
1484 | rfir | 1482 | rfir |
1485 | nop | 1483 | nop |
1486 | 1484 | ||
1485 | naitlb_miss_20w: | ||
1486 | |||
1487 | /* | ||
1488 | * I miss is a little different, since we allow users to fault | ||
1489 | * on the gateway page which is in the kernel address space. | ||
1490 | */ | ||
1491 | |||
1492 | space_adjust spc,va,t0 | ||
1493 | get_pgd spc,ptp | ||
1494 | space_check spc,t0,naitlb_fault | ||
1495 | |||
1496 | L3_ptep ptp,pte,t0,va,naitlb_check_alias_20w | ||
1497 | |||
1498 | update_ptep ptp,pte,t0,t1 | ||
1499 | |||
1500 | make_insert_tlb spc,pte,prot | ||
1501 | |||
1502 | iitlbt pte,prot | ||
1503 | |||
1504 | rfir | ||
1505 | nop | ||
1506 | |||
1507 | naitlb_check_alias_20w: | ||
1508 | do_alias spc,t0,t1,va,pte,prot,naitlb_fault | ||
1509 | |||
1510 | iitlbt pte,prot | ||
1511 | |||
1512 | rfir | ||
1513 | nop | ||
1514 | |||
1487 | #else | 1515 | #else |
1488 | 1516 | ||
1489 | itlb_miss_11: | 1517 | itlb_miss_11: |
@@ -1508,6 +1536,38 @@ itlb_miss_11: | |||
1508 | rfir | 1536 | rfir |
1509 | nop | 1537 | nop |
1510 | 1538 | ||
1539 | naitlb_miss_11: | ||
1540 | get_pgd spc,ptp | ||
1541 | |||
1542 | space_check spc,t0,naitlb_fault | ||
1543 | |||
1544 | L2_ptep ptp,pte,t0,va,naitlb_check_alias_11 | ||
1545 | |||
1546 | update_ptep ptp,pte,t0,t1 | ||
1547 | |||
1548 | make_insert_tlb_11 spc,pte,prot | ||
1549 | |||
1550 | mfsp %sr1,t0 /* Save sr1 so we can use it in tlb inserts */ | ||
1551 | mtsp spc,%sr1 | ||
1552 | |||
1553 | iitlba pte,(%sr1,va) | ||
1554 | iitlbp prot,(%sr1,va) | ||
1555 | |||
1556 | mtsp t0, %sr1 /* Restore sr1 */ | ||
1557 | |||
1558 | rfir | ||
1559 | nop | ||
1560 | |||
1561 | naitlb_check_alias_11: | ||
1562 | do_alias spc,t0,t1,va,pte,prot,itlb_fault | ||
1563 | |||
1564 | iitlba pte,(%sr0, va) | ||
1565 | iitlbp prot,(%sr0, va) | ||
1566 | |||
1567 | rfir | ||
1568 | nop | ||
1569 | |||
1570 | |||
1511 | itlb_miss_20: | 1571 | itlb_miss_20: |
1512 | get_pgd spc,ptp | 1572 | get_pgd spc,ptp |
1513 | 1573 | ||
@@ -1526,6 +1586,32 @@ itlb_miss_20: | |||
1526 | rfir | 1586 | rfir |
1527 | nop | 1587 | nop |
1528 | 1588 | ||
1589 | naitlb_miss_20: | ||
1590 | get_pgd spc,ptp | ||
1591 | |||
1592 | space_check spc,t0,naitlb_fault | ||
1593 | |||
1594 | L2_ptep ptp,pte,t0,va,naitlb_check_alias_20 | ||
1595 | |||
1596 | update_ptep ptp,pte,t0,t1 | ||
1597 | |||
1598 | make_insert_tlb spc,pte,prot | ||
1599 | |||
1600 | f_extend pte,t0 | ||
1601 | |||
1602 | iitlbt pte,prot | ||
1603 | |||
1604 | rfir | ||
1605 | nop | ||
1606 | |||
1607 | naitlb_check_alias_20: | ||
1608 | do_alias spc,t0,t1,va,pte,prot,naitlb_fault | ||
1609 | |||
1610 | iitlbt pte,prot | ||
1611 | |||
1612 | rfir | ||
1613 | nop | ||
1614 | |||
1529 | #endif | 1615 | #endif |
1530 | 1616 | ||
1531 | #ifdef CONFIG_64BIT | 1617 | #ifdef CONFIG_64BIT |
@@ -1662,6 +1748,10 @@ nadtlb_fault: | |||
1662 | b intr_save | 1748 | b intr_save |
1663 | ldi 17,%r8 | 1749 | ldi 17,%r8 |
1664 | 1750 | ||
1751 | naitlb_fault: | ||
1752 | b intr_save | ||
1753 | ldi 16,%r8 | ||
1754 | |||
1665 | dtlb_fault: | 1755 | dtlb_fault: |
1666 | b intr_save | 1756 | b intr_save |
1667 | ldi 15,%r8 | 1757 | ldi 15,%r8 |