diff options
-rw-r--r-- | arch/mips/mm/tlbex.c | 159 |
1 files changed, 71 insertions, 88 deletions
diff --git a/arch/mips/mm/tlbex.c b/arch/mips/mm/tlbex.c index e1a8139fc8fb..375e0991505d 100644 --- a/arch/mips/mm/tlbex.c +++ b/arch/mips/mm/tlbex.c | |||
@@ -5,7 +5,7 @@ | |||
5 | * | 5 | * |
6 | * Synthesize TLB refill handlers at runtime. | 6 | * Synthesize TLB refill handlers at runtime. |
7 | * | 7 | * |
8 | * Copyright (C) 2004,2005 by Thiemo Seufer | 8 | * Copyright (C) 2004,2005,2006 by Thiemo Seufer |
9 | * Copyright (C) 2005 Maciej W. Rozycki | 9 | * Copyright (C) 2005 Maciej W. Rozycki |
10 | * Copyright (C) 2006 Ralf Baechle (ralf@linux-mips.org) | 10 | * Copyright (C) 2006 Ralf Baechle (ralf@linux-mips.org) |
11 | * | 11 | * |
@@ -35,8 +35,6 @@ | |||
35 | #include <asm/smp.h> | 35 | #include <asm/smp.h> |
36 | #include <asm/war.h> | 36 | #include <asm/war.h> |
37 | 37 | ||
38 | /* #define DEBUG_TLB */ | ||
39 | |||
40 | static __init int __attribute__((unused)) r45k_bvahwbug(void) | 38 | static __init int __attribute__((unused)) r45k_bvahwbug(void) |
41 | { | 39 | { |
42 | /* XXX: We should probe for the presence of this bug, but we don't. */ | 40 | /* XXX: We should probe for the presence of this bug, but we don't. */ |
@@ -728,6 +726,7 @@ static void __init build_r3000_tlb_refill_handler(void) | |||
728 | { | 726 | { |
729 | long pgdc = (long)pgd_current; | 727 | long pgdc = (long)pgd_current; |
730 | u32 *p; | 728 | u32 *p; |
729 | int i; | ||
731 | 730 | ||
732 | memset(tlb_handler, 0, sizeof(tlb_handler)); | 731 | memset(tlb_handler, 0, sizeof(tlb_handler)); |
733 | p = tlb_handler; | 732 | p = tlb_handler; |
@@ -753,16 +752,14 @@ static void __init build_r3000_tlb_refill_handler(void) | |||
753 | if (p > tlb_handler + 32) | 752 | if (p > tlb_handler + 32) |
754 | panic("TLB refill handler space exceeded"); | 753 | panic("TLB refill handler space exceeded"); |
755 | 754 | ||
756 | printk("Synthesized TLB refill handler (%u instructions).\n", | 755 | pr_info("Synthesized TLB refill handler (%u instructions).\n", |
757 | (unsigned int)(p - tlb_handler)); | 756 | (unsigned int)(p - tlb_handler)); |
758 | #ifdef DEBUG_TLB | ||
759 | { | ||
760 | int i; | ||
761 | 757 | ||
762 | for (i = 0; i < (p - tlb_handler); i++) | 758 | pr_debug("\t.set push\n"); |
763 | printk("%08x\n", tlb_handler[i]); | 759 | pr_debug("\t.set noreorder\n"); |
764 | } | 760 | for (i = 0; i < (p - tlb_handler); i++) |
765 | #endif | 761 | pr_debug("\t.word 0x%08x\n", tlb_handler[i]); |
762 | pr_debug("\t.set pop\n"); | ||
766 | 763 | ||
767 | memcpy((void *)ebase, tlb_handler, 0x80); | 764 | memcpy((void *)ebase, tlb_handler, 0x80); |
768 | } | 765 | } |
@@ -1175,6 +1172,7 @@ static void __init build_r4000_tlb_refill_handler(void) | |||
1175 | struct reloc *r = relocs; | 1172 | struct reloc *r = relocs; |
1176 | u32 *f; | 1173 | u32 *f; |
1177 | unsigned int final_len; | 1174 | unsigned int final_len; |
1175 | int i; | ||
1178 | 1176 | ||
1179 | memset(tlb_handler, 0, sizeof(tlb_handler)); | 1177 | memset(tlb_handler, 0, sizeof(tlb_handler)); |
1180 | memset(labels, 0, sizeof(labels)); | 1178 | memset(labels, 0, sizeof(labels)); |
@@ -1272,24 +1270,21 @@ static void __init build_r4000_tlb_refill_handler(void) | |||
1272 | #endif /* CONFIG_64BIT */ | 1270 | #endif /* CONFIG_64BIT */ |
1273 | 1271 | ||
1274 | resolve_relocs(relocs, labels); | 1272 | resolve_relocs(relocs, labels); |
1275 | printk("Synthesized TLB refill handler (%u instructions).\n", | 1273 | pr_info("Synthesized TLB refill handler (%u instructions).\n", |
1276 | final_len); | 1274 | final_len); |
1277 | |||
1278 | #ifdef DEBUG_TLB | ||
1279 | { | ||
1280 | int i; | ||
1281 | 1275 | ||
1282 | f = final_handler; | 1276 | f = final_handler; |
1283 | #ifdef CONFIG_64BIT | 1277 | #ifdef CONFIG_64BIT |
1284 | if (final_len > 32) | 1278 | if (final_len > 32) |
1285 | final_len = 64; | 1279 | final_len = 64; |
1286 | else | 1280 | else |
1287 | f = final_handler + 32; | 1281 | f = final_handler + 32; |
1288 | #endif /* CONFIG_64BIT */ | 1282 | #endif /* CONFIG_64BIT */ |
1289 | for (i = 0; i < final_len; i++) | 1283 | pr_debug("\t.set push\n"); |
1290 | printk("%08x\n", f[i]); | 1284 | pr_debug("\t.set noreorder\n"); |
1291 | } | 1285 | for (i = 0; i < final_len; i++) |
1292 | #endif | 1286 | pr_debug("\t.word 0x%08x\n", f[i]); |
1287 | pr_debug("\t.set pop\n"); | ||
1293 | 1288 | ||
1294 | memcpy((void *)ebase, final_handler, 0x100); | 1289 | memcpy((void *)ebase, final_handler, 0x100); |
1295 | } | 1290 | } |
@@ -1522,6 +1517,7 @@ static void __init build_r3000_tlb_load_handler(void) | |||
1522 | u32 *p = handle_tlbl; | 1517 | u32 *p = handle_tlbl; |
1523 | struct label *l = labels; | 1518 | struct label *l = labels; |
1524 | struct reloc *r = relocs; | 1519 | struct reloc *r = relocs; |
1520 | int i; | ||
1525 | 1521 | ||
1526 | memset(handle_tlbl, 0, sizeof(handle_tlbl)); | 1522 | memset(handle_tlbl, 0, sizeof(handle_tlbl)); |
1527 | memset(labels, 0, sizeof(labels)); | 1523 | memset(labels, 0, sizeof(labels)); |
@@ -1541,17 +1537,14 @@ static void __init build_r3000_tlb_load_handler(void) | |||
1541 | panic("TLB load handler fastpath space exceeded"); | 1537 | panic("TLB load handler fastpath space exceeded"); |
1542 | 1538 | ||
1543 | resolve_relocs(relocs, labels); | 1539 | resolve_relocs(relocs, labels); |
1544 | printk("Synthesized TLB load handler fastpath (%u instructions).\n", | 1540 | pr_info("Synthesized TLB load handler fastpath (%u instructions).\n", |
1545 | (unsigned int)(p - handle_tlbl)); | 1541 | (unsigned int)(p - handle_tlbl)); |
1546 | |||
1547 | #ifdef DEBUG_TLB | ||
1548 | { | ||
1549 | int i; | ||
1550 | 1542 | ||
1551 | for (i = 0; i < (p - handle_tlbl); i++) | 1543 | pr_debug("\t.set push\n"); |
1552 | printk("%08x\n", handle_tlbl[i]); | 1544 | pr_debug("\t.set noreorder\n"); |
1553 | } | 1545 | for (i = 0; i < (p - handle_tlbl); i++) |
1554 | #endif | 1546 | pr_debug("\t.word 0x%08x\n", handle_tlbl[i]); |
1547 | pr_debug("\t.set pop\n"); | ||
1555 | } | 1548 | } |
1556 | 1549 | ||
1557 | static void __init build_r3000_tlb_store_handler(void) | 1550 | static void __init build_r3000_tlb_store_handler(void) |
@@ -1559,6 +1552,7 @@ static void __init build_r3000_tlb_store_handler(void) | |||
1559 | u32 *p = handle_tlbs; | 1552 | u32 *p = handle_tlbs; |
1560 | struct label *l = labels; | 1553 | struct label *l = labels; |
1561 | struct reloc *r = relocs; | 1554 | struct reloc *r = relocs; |
1555 | int i; | ||
1562 | 1556 | ||
1563 | memset(handle_tlbs, 0, sizeof(handle_tlbs)); | 1557 | memset(handle_tlbs, 0, sizeof(handle_tlbs)); |
1564 | memset(labels, 0, sizeof(labels)); | 1558 | memset(labels, 0, sizeof(labels)); |
@@ -1578,17 +1572,14 @@ static void __init build_r3000_tlb_store_handler(void) | |||
1578 | panic("TLB store handler fastpath space exceeded"); | 1572 | panic("TLB store handler fastpath space exceeded"); |
1579 | 1573 | ||
1580 | resolve_relocs(relocs, labels); | 1574 | resolve_relocs(relocs, labels); |
1581 | printk("Synthesized TLB store handler fastpath (%u instructions).\n", | 1575 | pr_info("Synthesized TLB store handler fastpath (%u instructions).\n", |
1582 | (unsigned int)(p - handle_tlbs)); | 1576 | (unsigned int)(p - handle_tlbs)); |
1583 | 1577 | ||
1584 | #ifdef DEBUG_TLB | 1578 | pr_debug("\t.set push\n"); |
1585 | { | 1579 | pr_debug("\t.set noreorder\n"); |
1586 | int i; | 1580 | for (i = 0; i < (p - handle_tlbs); i++) |
1587 | 1581 | pr_debug("\t.word 0x%08x\n", handle_tlbs[i]); | |
1588 | for (i = 0; i < (p - handle_tlbs); i++) | 1582 | pr_debug("\t.set pop\n"); |
1589 | printk("%08x\n", handle_tlbs[i]); | ||
1590 | } | ||
1591 | #endif | ||
1592 | } | 1583 | } |
1593 | 1584 | ||
1594 | static void __init build_r3000_tlb_modify_handler(void) | 1585 | static void __init build_r3000_tlb_modify_handler(void) |
@@ -1596,6 +1587,7 @@ static void __init build_r3000_tlb_modify_handler(void) | |||
1596 | u32 *p = handle_tlbm; | 1587 | u32 *p = handle_tlbm; |
1597 | struct label *l = labels; | 1588 | struct label *l = labels; |
1598 | struct reloc *r = relocs; | 1589 | struct reloc *r = relocs; |
1590 | int i; | ||
1599 | 1591 | ||
1600 | memset(handle_tlbm, 0, sizeof(handle_tlbm)); | 1592 | memset(handle_tlbm, 0, sizeof(handle_tlbm)); |
1601 | memset(labels, 0, sizeof(labels)); | 1593 | memset(labels, 0, sizeof(labels)); |
@@ -1615,17 +1607,14 @@ static void __init build_r3000_tlb_modify_handler(void) | |||
1615 | panic("TLB modify handler fastpath space exceeded"); | 1607 | panic("TLB modify handler fastpath space exceeded"); |
1616 | 1608 | ||
1617 | resolve_relocs(relocs, labels); | 1609 | resolve_relocs(relocs, labels); |
1618 | printk("Synthesized TLB modify handler fastpath (%u instructions).\n", | 1610 | pr_info("Synthesized TLB modify handler fastpath (%u instructions).\n", |
1619 | (unsigned int)(p - handle_tlbm)); | 1611 | (unsigned int)(p - handle_tlbm)); |
1620 | 1612 | ||
1621 | #ifdef DEBUG_TLB | 1613 | pr_debug("\t.set push\n"); |
1622 | { | 1614 | pr_debug("\t.set noreorder\n"); |
1623 | int i; | 1615 | for (i = 0; i < (p - handle_tlbm); i++) |
1624 | 1616 | pr_debug("\t.word 0x%08x\n", handle_tlbm[i]); | |
1625 | for (i = 0; i < (p - handle_tlbm); i++) | 1617 | pr_debug("\t.set pop\n"); |
1626 | printk("%08x\n", handle_tlbm[i]); | ||
1627 | } | ||
1628 | #endif | ||
1629 | } | 1618 | } |
1630 | 1619 | ||
1631 | /* | 1620 | /* |
@@ -1677,6 +1666,7 @@ static void __init build_r4000_tlb_load_handler(void) | |||
1677 | u32 *p = handle_tlbl; | 1666 | u32 *p = handle_tlbl; |
1678 | struct label *l = labels; | 1667 | struct label *l = labels; |
1679 | struct reloc *r = relocs; | 1668 | struct reloc *r = relocs; |
1669 | int i; | ||
1680 | 1670 | ||
1681 | memset(handle_tlbl, 0, sizeof(handle_tlbl)); | 1671 | memset(handle_tlbl, 0, sizeof(handle_tlbl)); |
1682 | memset(labels, 0, sizeof(labels)); | 1672 | memset(labels, 0, sizeof(labels)); |
@@ -1704,17 +1694,14 @@ static void __init build_r4000_tlb_load_handler(void) | |||
1704 | panic("TLB load handler fastpath space exceeded"); | 1694 | panic("TLB load handler fastpath space exceeded"); |
1705 | 1695 | ||
1706 | resolve_relocs(relocs, labels); | 1696 | resolve_relocs(relocs, labels); |
1707 | printk("Synthesized TLB load handler fastpath (%u instructions).\n", | 1697 | pr_info("Synthesized TLB load handler fastpath (%u instructions).\n", |
1708 | (unsigned int)(p - handle_tlbl)); | 1698 | (unsigned int)(p - handle_tlbl)); |
1709 | |||
1710 | #ifdef DEBUG_TLB | ||
1711 | { | ||
1712 | int i; | ||
1713 | 1699 | ||
1714 | for (i = 0; i < (p - handle_tlbl); i++) | 1700 | pr_debug("\t.set push\n"); |
1715 | printk("%08x\n", handle_tlbl[i]); | 1701 | pr_debug("\t.set noreorder\n"); |
1716 | } | 1702 | for (i = 0; i < (p - handle_tlbl); i++) |
1717 | #endif | 1703 | pr_debug("\t.word 0x%08x\n", handle_tlbl[i]); |
1704 | pr_debug("\t.set pop\n"); | ||
1718 | } | 1705 | } |
1719 | 1706 | ||
1720 | static void __init build_r4000_tlb_store_handler(void) | 1707 | static void __init build_r4000_tlb_store_handler(void) |
@@ -1722,6 +1709,7 @@ static void __init build_r4000_tlb_store_handler(void) | |||
1722 | u32 *p = handle_tlbs; | 1709 | u32 *p = handle_tlbs; |
1723 | struct label *l = labels; | 1710 | struct label *l = labels; |
1724 | struct reloc *r = relocs; | 1711 | struct reloc *r = relocs; |
1712 | int i; | ||
1725 | 1713 | ||
1726 | memset(handle_tlbs, 0, sizeof(handle_tlbs)); | 1714 | memset(handle_tlbs, 0, sizeof(handle_tlbs)); |
1727 | memset(labels, 0, sizeof(labels)); | 1715 | memset(labels, 0, sizeof(labels)); |
@@ -1740,17 +1728,14 @@ static void __init build_r4000_tlb_store_handler(void) | |||
1740 | panic("TLB store handler fastpath space exceeded"); | 1728 | panic("TLB store handler fastpath space exceeded"); |
1741 | 1729 | ||
1742 | resolve_relocs(relocs, labels); | 1730 | resolve_relocs(relocs, labels); |
1743 | printk("Synthesized TLB store handler fastpath (%u instructions).\n", | 1731 | pr_info("Synthesized TLB store handler fastpath (%u instructions).\n", |
1744 | (unsigned int)(p - handle_tlbs)); | 1732 | (unsigned int)(p - handle_tlbs)); |
1745 | |||
1746 | #ifdef DEBUG_TLB | ||
1747 | { | ||
1748 | int i; | ||
1749 | 1733 | ||
1750 | for (i = 0; i < (p - handle_tlbs); i++) | 1734 | pr_debug("\t.set push\n"); |
1751 | printk("%08x\n", handle_tlbs[i]); | 1735 | pr_debug("\t.set noreorder\n"); |
1752 | } | 1736 | for (i = 0; i < (p - handle_tlbs); i++) |
1753 | #endif | 1737 | pr_debug("\t.word 0x%08x\n", handle_tlbs[i]); |
1738 | pr_debug("\t.set pop\n"); | ||
1754 | } | 1739 | } |
1755 | 1740 | ||
1756 | static void __init build_r4000_tlb_modify_handler(void) | 1741 | static void __init build_r4000_tlb_modify_handler(void) |
@@ -1758,6 +1743,7 @@ static void __init build_r4000_tlb_modify_handler(void) | |||
1758 | u32 *p = handle_tlbm; | 1743 | u32 *p = handle_tlbm; |
1759 | struct label *l = labels; | 1744 | struct label *l = labels; |
1760 | struct reloc *r = relocs; | 1745 | struct reloc *r = relocs; |
1746 | int i; | ||
1761 | 1747 | ||
1762 | memset(handle_tlbm, 0, sizeof(handle_tlbm)); | 1748 | memset(handle_tlbm, 0, sizeof(handle_tlbm)); |
1763 | memset(labels, 0, sizeof(labels)); | 1749 | memset(labels, 0, sizeof(labels)); |
@@ -1777,17 +1763,14 @@ static void __init build_r4000_tlb_modify_handler(void) | |||
1777 | panic("TLB modify handler fastpath space exceeded"); | 1763 | panic("TLB modify handler fastpath space exceeded"); |
1778 | 1764 | ||
1779 | resolve_relocs(relocs, labels); | 1765 | resolve_relocs(relocs, labels); |
1780 | printk("Synthesized TLB modify handler fastpath (%u instructions).\n", | 1766 | pr_info("Synthesized TLB modify handler fastpath (%u instructions).\n", |
1781 | (unsigned int)(p - handle_tlbm)); | 1767 | (unsigned int)(p - handle_tlbm)); |
1782 | 1768 | ||
1783 | #ifdef DEBUG_TLB | 1769 | pr_debug("\t.set push\n"); |
1784 | { | 1770 | pr_debug("\t.set noreorder\n"); |
1785 | int i; | 1771 | for (i = 0; i < (p - handle_tlbm); i++) |
1786 | 1772 | pr_debug("\t.word 0x%08x\n", handle_tlbm[i]); | |
1787 | for (i = 0; i < (p - handle_tlbm); i++) | 1773 | pr_debug("\t.set pop\n"); |
1788 | printk("%08x\n", handle_tlbm[i]); | ||
1789 | } | ||
1790 | #endif | ||
1791 | } | 1774 | } |
1792 | 1775 | ||
1793 | void __init build_tlb_refill_handler(void) | 1776 | void __init build_tlb_refill_handler(void) |