aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJames Hogan <james.hogan@imgtec.com>2016-05-20 18:28:38 -0400
committerRalf Baechle <ralf@linux-mips.org>2016-05-28 06:35:10 -0400
commit1c48a177351ba8cbf6871f035496fce0e11d8fa3 (patch)
treef4598c46e110730ebcd864bab6622e222fa3b2e2
parent0dfa1c12f300d06f95d861d2718ef198e37473a6 (diff)
MIPS: Add missing VZ accessor microMIPS encodings
Toolchains may be used which support microMIPS but not VZ instructions (i.e. binutis 2.22 & 2.23), so extend the explicitly encoded versions of the guest COP0 register & guest TLB access macros to support microMIPS encodings too, using the new macros. This prevents non-microMIPS instructions being executed in microMIPS mode during CPU probe on cores supporting VZ (e.g. M5150), which cause reserved instruction exceptions early during boot. Fixes: bad50d79255a ("MIPS: Fix VZ probe gas errors with binutils <2.24") Signed-off-by: James Hogan <james.hogan@imgtec.com> Cc: linux-mips@linux-mips.org Patchwork: https://patchwork.linux-mips.org/patch/13311/ Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
-rw-r--r--arch/mips/include/asm/mipsregs.h27
1 files changed, 18 insertions, 9 deletions
diff --git a/arch/mips/include/asm/mipsregs.h b/arch/mips/include/asm/mipsregs.h
index 1ce2c72ab88d..98b289af6245 100644
--- a/arch/mips/include/asm/mipsregs.h
+++ b/arch/mips/include/asm/mipsregs.h
@@ -1773,7 +1773,8 @@ do { \
1773 ".set\tpush\n\t" \ 1773 ".set\tpush\n\t" \
1774 ".set\tnoat\n\t" \ 1774 ".set\tnoat\n\t" \
1775 "# mfgc0\t$1, $%1, %2\n\t" \ 1775 "# mfgc0\t$1, $%1, %2\n\t" \
1776 ".word\t(0x40610000 | %1 << 11 | %2)\n\t" \ 1776 _ASM_INSN_IF_MIPS(0x40610000 | %1 << 11 | %2) \
1777 _ASM_INSN32_IF_MM(0x002004fc | %1 << 16 | %2 << 11) \
1777 "move\t%0, $1\n\t" \ 1778 "move\t%0, $1\n\t" \
1778 ".set\tpop" \ 1779 ".set\tpop" \
1779 : "=r" (__res) \ 1780 : "=r" (__res) \
@@ -1787,7 +1788,8 @@ do { \
1787 ".set\tpush\n\t" \ 1788 ".set\tpush\n\t" \
1788 ".set\tnoat\n\t" \ 1789 ".set\tnoat\n\t" \
1789 "# dmfgc0\t$1, $%1, %2\n\t" \ 1790 "# dmfgc0\t$1, $%1, %2\n\t" \
1790 ".word\t(0x40610100 | %1 << 11 | %2)\n\t" \ 1791 _ASM_INSN_IF_MIPS(0x40610100 | %1 << 11 | %2) \
1792 _ASM_INSN32_IF_MM(0x582004fc | %1 << 16 | %2 << 11) \
1791 "move\t%0, $1\n\t" \ 1793 "move\t%0, $1\n\t" \
1792 ".set\tpop" \ 1794 ".set\tpop" \
1793 : "=r" (__res) \ 1795 : "=r" (__res) \
@@ -1802,7 +1804,8 @@ do { \
1802 ".set\tnoat\n\t" \ 1804 ".set\tnoat\n\t" \
1803 "move\t$1, %z0\n\t" \ 1805 "move\t$1, %z0\n\t" \
1804 "# mtgc0\t$1, $%1, %2\n\t" \ 1806 "# mtgc0\t$1, $%1, %2\n\t" \
1805 ".word\t(0x40610200 | %1 << 11 | %2)\n\t" \ 1807 _ASM_INSN_IF_MIPS(0x40610200 | %1 << 11 | %2) \
1808 _ASM_INSN32_IF_MM(0x002006fc | %1 << 16 | %2 << 11) \
1806 ".set\tpop" \ 1809 ".set\tpop" \
1807 : : "Jr" ((unsigned int)(value)), \ 1810 : : "Jr" ((unsigned int)(value)), \
1808 "i" (register), "i" (sel)); \ 1811 "i" (register), "i" (sel)); \
@@ -1815,7 +1818,8 @@ do { \
1815 ".set\tnoat\n\t" \ 1818 ".set\tnoat\n\t" \
1816 "move\t$1, %z0\n\t" \ 1819 "move\t$1, %z0\n\t" \
1817 "# dmtgc0\t$1, $%1, %2\n\t" \ 1820 "# dmtgc0\t$1, $%1, %2\n\t" \
1818 ".word\t(0x40610300 | %1 << 11 | %2)\n\t" \ 1821 _ASM_INSN_IF_MIPS(0x40610300 | %1 << 11 | %2) \
1822 _ASM_INSN32_IF_MM(0x582006fc | %1 << 16 | %2 << 11) \
1819 ".set\tpop" \ 1823 ".set\tpop" \
1820 : : "Jr" (value), \ 1824 : : "Jr" (value), \
1821 "i" (register), "i" (sel)); \ 1825 "i" (register), "i" (sel)); \
@@ -2586,28 +2590,32 @@ static inline void guest_tlb_probe(void)
2586{ 2590{
2587 __asm__ __volatile__( 2591 __asm__ __volatile__(
2588 "# tlbgp\n\t" 2592 "# tlbgp\n\t"
2589 ".word 0x42000010"); 2593 _ASM_INSN_IF_MIPS(0x42000010)
2594 _ASM_INSN32_IF_MM(0x0000017c));
2590} 2595}
2591 2596
2592static inline void guest_tlb_read(void) 2597static inline void guest_tlb_read(void)
2593{ 2598{
2594 __asm__ __volatile__( 2599 __asm__ __volatile__(
2595 "# tlbgr\n\t" 2600 "# tlbgr\n\t"
2596 ".word 0x42000009"); 2601 _ASM_INSN_IF_MIPS(0x42000009)
2602 _ASM_INSN32_IF_MM(0x0000117c));
2597} 2603}
2598 2604
2599static inline void guest_tlb_write_indexed(void) 2605static inline void guest_tlb_write_indexed(void)
2600{ 2606{
2601 __asm__ __volatile__( 2607 __asm__ __volatile__(
2602 "# tlbgwi\n\t" 2608 "# tlbgwi\n\t"
2603 ".word 0x4200000a"); 2609 _ASM_INSN_IF_MIPS(0x4200000a)
2610 _ASM_INSN32_IF_MM(0x0000217c));
2604} 2611}
2605 2612
2606static inline void guest_tlb_write_random(void) 2613static inline void guest_tlb_write_random(void)
2607{ 2614{
2608 __asm__ __volatile__( 2615 __asm__ __volatile__(
2609 "# tlbgwr\n\t" 2616 "# tlbgwr\n\t"
2610 ".word 0x4200000e"); 2617 _ASM_INSN_IF_MIPS(0x4200000e)
2618 _ASM_INSN32_IF_MM(0x0000317c));
2611} 2619}
2612 2620
2613/* 2621/*
@@ -2617,7 +2625,8 @@ static inline void guest_tlbinvf(void)
2617{ 2625{
2618 __asm__ __volatile__( 2626 __asm__ __volatile__(
2619 "# tlbginvf\n\t" 2627 "# tlbginvf\n\t"
2620 ".word 0x4200000c"); 2628 _ASM_INSN_IF_MIPS(0x4200000c)
2629 _ASM_INSN32_IF_MM(0x0000517c));
2621} 2630}
2622 2631
2623#endif /* !TOOLCHAIN_SUPPORTS_VIRT */ 2632#endif /* !TOOLCHAIN_SUPPORTS_VIRT */