From: Fredrik Noring <noring@nocrew.org> To: Paul Burton <paul.burton@mips.com>, linux-mips@vger.kernel.org Cc: "Maciej W. Rozycki" <macro@linux-mips.org>, "Jürgen Urban" <JuergenUrban@gmx.de> Subject: [PATCH 009/120] MIPS: R5900: Add mandatory SYNC.P to all M[FT]C0 instructions Date: Sun, 1 Sep 2019 17:39:32 +0200 Message-ID: <4775699bfc809a6a8b40749f82be890515303bdd.1567326213.git.noring@nocrew.org> (raw) In-Reply-To: <cover.1567326213.git.noring@nocrew.org> The Toshiba TX79 manual specifies that all MTC0 instructions must be followed by a SYNC.P instruction as a barrier to guarantee COP0 register updates[1]. There is one exception to this rule: An MTC0 instruction which loads the EntryHi COP0 register can be followed by a TLBWI or a TLBWR instruction without having an intervening SYNC.P. This special case is handled by a hardware interlock. References: [1] "TX System RISC TX79 Core Architecture" manual, revision 2.0, Toshiba Corporation, p. C-28, https://wiki.qemu.org/File:C790.pdf Signed-off-by: Fredrik Noring <noring@nocrew.org> --- The Linux 2.6 port to the PlayStation 2 has SYNC.P preceding all MFC0 instructions, but I have not found any documentation stating that is necessary. Perhaps this case can be removed? --- arch/mips/include/asm/asmmacro.h | 12 ++++++ arch/mips/include/asm/irqflags.h | 15 +++++++ arch/mips/include/asm/mipsregs.h | 69 ++++++++++++++++++++++++++++++ arch/mips/include/asm/stackframe.h | 54 +++++++++++++++++++++++ arch/mips/kernel/genex.S | 60 ++++++++++++++++++++++++++ arch/mips/kernel/head.S | 9 ++++ arch/mips/kernel/r4k_switch.S | 9 ++++ arch/mips/mm/cex-gen.S | 6 +++ arch/mips/mm/tlbex-fault.S | 3 ++ arch/mips/mm/tlbex.c | 14 ++++-- 10 files changed, 247 insertions(+), 4 deletions(-) diff --git a/arch/mips/include/asm/asmmacro.h b/arch/mips/include/asm/asmmacro.h index aa58474c739f..67e77c0b64aa 100644 --- a/arch/mips/include/asm/asmmacro.h +++ b/arch/mips/include/asm/asmmacro.h @@ -56,9 +56,15 @@ .endm #else .macro local_irq_enable reg=t0 +#ifdef CONFIG_CPU_R5900 + sync.p +#endif mfc0 \reg, CP0_STATUS ori \reg, \reg, 1 mtc0 \reg, CP0_STATUS +#ifdef CONFIG_CPU_R5900 + sync.p +#endif irq_enable_hazard .endm @@ -67,11 +73,17 @@ lw \reg, TI_PRE_COUNT($28) addi \reg, \reg, 1 sw \reg, TI_PRE_COUNT($28) +#endif +#ifdef CONFIG_CPU_R5900 + sync.p #endif mfc0 \reg, CP0_STATUS ori \reg, \reg, 1 xori \reg, \reg, 1 mtc0 \reg, CP0_STATUS +#ifdef CONFIG_CPU_R5900 + sync.p +#endif irq_disable_hazard #ifdef CONFIG_PREEMPT lw \reg, TI_PRE_COUNT($28) diff --git a/arch/mips/include/asm/irqflags.h b/arch/mips/include/asm/irqflags.h index f0b862a83816..e0c0265b2719 100644 --- a/arch/mips/include/asm/irqflags.h +++ b/arch/mips/include/asm/irqflags.h @@ -78,9 +78,15 @@ static inline void arch_local_irq_restore(unsigned long flags) /* * Fast, dangerous. Life is fun, life is good. */ +#ifdef CONFIG_CPU_R5900 + " sync.p \n" +#endif " mfc0 $1, $12 \n" " ins $1, %[flags], 0, 1 \n" " mtc0 $1, $12 \n" +#ifdef CONFIG_CPU_R5900 + " sync.p \n" +#endif #endif " " __stringify(__irq_disable_hazard) " \n" " .set pop \n" @@ -105,10 +111,16 @@ static inline void arch_local_irq_enable(void) #if defined(CONFIG_CPU_MIPSR2) || defined(CONFIG_CPU_MIPSR6) " ei \n" #else +#ifdef CONFIG_CPU_R5900 + " sync.p \n" +#endif " mfc0 $1,$12 \n" " ori $1,0x1f \n" " xori $1,0x1e \n" " mtc0 $1,$12 \n" +#ifdef CONFIG_CPU_R5900 + " sync.p \n" +#endif #endif " " __stringify(__irq_enable_hazard) " \n" " .set pop \n" @@ -124,6 +136,9 @@ static inline unsigned long arch_local_save_flags(void) asm __volatile__( " .set push \n" " .set reorder \n" +#ifdef CONFIG_CPU_R5900 + " sync.p \n" +#endif " mfc0 %[flags], $12 \n" " .set pop \n" : [flags] "=r" (flags)); diff --git a/arch/mips/include/asm/mipsregs.h b/arch/mips/include/asm/mipsregs.h index 1e6966e8527e..2aa947b3d0d1 100644 --- a/arch/mips/include/asm/mipsregs.h +++ b/arch/mips/include/asm/mipsregs.h @@ -1345,6 +1345,29 @@ do { \ * Macros to access the system control coprocessor */ +#ifdef CONFIG_CPU_R5900 +#define ___read_32bit_c0_register(source, sel, vol) \ +({ int __res; \ + if (sel == 0) \ + __asm__ vol( \ + ".set push\n\t" \ + ".set noreorder\n\t" \ + "sync.p\n\t" \ + "mfc0\t%0, " #source "\n\t" \ + ".set pop\n\t" \ + : "=r" (__res)); \ + else \ + __asm__ vol( \ + ".set push\n\t" \ + ".set noreorder\n\t" \ + ".set\tmips32\n\t" \ + "sync.p\n\t" \ + "mfc0\t%0, " #source ", " #sel "\n\t" \ + ".set pop\n\t" \ + : "=r" (__res)); \ + __res; \ +}) +#else #define ___read_32bit_c0_register(source, sel, vol) \ ({ unsigned int __res; \ if (sel == 0) \ @@ -1360,6 +1383,7 @@ do { \ : "=r" (__res)); \ __res; \ }) +#endif #define ___read_64bit_c0_register(source, sel, vol) \ ({ unsigned long long __res; \ @@ -1394,6 +1418,28 @@ do { \ #define __read_const_64bit_c0_register(source, sel) \ ___read_64bit_c0_register(source, sel,) +#ifdef CONFIG_CPU_R5900 +#define __write_32bit_c0_register(register, sel, value) \ +do { \ + if (sel == 0) \ + __asm__ __volatile__( \ + ".set push\n\t" \ + ".set noreorder\n\t" \ + "mtc0\t%z0, " #register "\n\t" \ + "sync.p\n\t" \ + ".set pop\n\t" \ + : : "Jr" ((unsigned int)(value))); \ + else \ + __asm__ __volatile__( \ + ".set push\n\t" \ + ".set noreorder\n\t" \ + ".set\tmips32\n\t" \ + "mtc0\t%z0, " #register ", " #sel "\n\t" \ + "sync.p\n\t" \ + ".set pop\n\t" \ + : : "Jr" ((unsigned int)(value))); \ +} while (0) +#else #define __write_32bit_c0_register(register, sel, value) \ do { \ if (sel == 0) \ @@ -1408,6 +1454,7 @@ do { \ ".set\tpop" \ : : "Jr" ((unsigned int)(value))); \ } while (0) +#endif #define __write_64bit_c0_register(register, sel, value) \ do { \ @@ -2649,6 +2696,14 @@ static inline void tlb_probe(void) __asm__ __volatile__( ".set noreorder\n\t" "tlbp\n\t" +#ifdef CONFIG_CPU_R5900 + /* No memory access behind the tlbp instruction. */ + "sync.p\n\t" + "nop\n\t" + "nop\n\t" + "nop\n\t" + "nop\n\t" +#endif ".set reorder"); } @@ -2674,6 +2729,14 @@ static inline void tlb_read(void) __asm__ __volatile__( ".set noreorder\n\t" "tlbr\n\t" +#ifdef CONFIG_CPU_R5900 + "sync.p\n\t" + /* No branch behind tlbr. */ + "nop\n\t" + "nop\n\t" + "nop\n\t" + "nop\n\t" +#endif ".set reorder"); #if MIPS34K_MISSED_ITLB_WAR @@ -2694,6 +2757,9 @@ static inline void tlb_write_indexed(void) __asm__ __volatile__( ".set noreorder\n\t" "tlbwi\n\t" +#ifdef CONFIG_CPU_R5900 + "sync.p\n\t" +#endif ".set reorder"); } @@ -2702,6 +2768,9 @@ static inline void tlb_write_random(void) __asm__ __volatile__( ".set noreorder\n\t" "tlbwr\n\t" +#ifdef CONFIG_CPU_R5900 + "sync.p\n\t" +#endif ".set reorder"); } diff --git a/arch/mips/include/asm/stackframe.h b/arch/mips/include/asm/stackframe.h index 2fbead2e86d1..4a0f6639fde8 100644 --- a/arch/mips/include/asm/stackframe.h +++ b/arch/mips/include/asm/stackframe.h @@ -116,6 +116,9 @@ /* SMP variation */ .macro get_saved_sp docfi=0 tosp=0 +#ifdef CONFIG_CPU_R5900 + sync.p +#endif ASM_CPUID_MFC0 k0, ASM_SMP_CPUID_REG #if defined(CONFIG_32BIT) || defined(KBUILD_64BIT_SYM32) lui k1, %hi(kernelsp) @@ -140,6 +143,9 @@ .endm .macro set_saved_sp stackp temp temp2 +#ifdef CONFIG_CPU_R5900 + sync.p +#endif ASM_CPUID_MFC0 \temp, ASM_SMP_CPUID_REG LONG_SRL \temp, SMP_CPUID_PTRSHIFT LONG_S \stackp, kernelsp(\temp) @@ -165,6 +171,9 @@ 1: move ra, k0 li k0, 3 mtc0 k0, $22 +#ifdef CONFIG_CPU_R5900 + sync.p +#endif #endif /* CONFIG_CPU_JUMP_WORKAROUNDS */ #if defined(CONFIG_32BIT) || defined(KBUILD_64BIT_SYM32) lui k1, %hi(kernelsp) @@ -195,6 +204,9 @@ .set push .set noat .set reorder +#ifdef CONFIG_CPU_R5900 + sync.p +#endif mfc0 k0, CP0_STATUS sll k0, 3 /* extract cu0 bit */ .set noreorder @@ -251,15 +263,24 @@ * need it to operate correctly */ LONG_S $0, PT_R0(sp) +#ifdef CONFIG_CPU_R5900 + sync.p +#endif mfc0 v1, CP0_STATUS cfi_st v0, PT_R2, \docfi LONG_S v1, PT_STATUS(sp) cfi_st $4, PT_R4, \docfi +#ifdef CONFIG_CPU_R5900 + sync.p +#endif mfc0 v1, CP0_CAUSE cfi_st $5, PT_R5, \docfi LONG_S v1, PT_CAUSE(sp) cfi_st $6, PT_R6, \docfi cfi_st ra, PT_R31, \docfi +#ifdef CONFIG_CPU_R5900 + sync.p +#endif MFC0 ra, CP0_EPC cfi_st $7, PT_R7, \docfi #ifdef CONFIG_64BIT @@ -273,6 +294,9 @@ cfi_st $25, PT_R25, \docfi cfi_st $28, PT_R28, \docfi +#ifdef CONFIG_CPU_R5900 + sync.p +#endif /* Set thread_info if we're coming from user mode */ mfc0 k0, CP0_STATUS sll k0, 3 /* extract cu0 bit */ @@ -447,10 +471,16 @@ .set reorder .set noat RESET_MMR +#ifdef CONFIG_CPU_R5900 + sync.p +#endif mfc0 a0, CP0_STATUS ori a0, STATMASK xori a0, STATMASK mtc0 a0, CP0_STATUS +#ifdef CONFIG_CPU_R5900 + sync.p +#endif li v1, ST0_CU1 | ST0_FR | ST0_IM and a0, v1 LONG_L v0, PT_STATUS(sp) @@ -458,8 +488,14 @@ and v0, v1 or v0, a0 mtc0 v0, CP0_STATUS +#ifdef CONFIG_CPU_R5900 + sync.p +#endif LONG_L v1, PT_EPC(sp) MTC0 v1, CP0_EPC +#ifdef CONFIG_CPU_R5900 + sync.p +#endif cfi_ld $31, PT_R31, \docfi cfi_ld $28, PT_R28, \docfi cfi_ld $25, PT_R25, \docfi @@ -503,11 +539,17 @@ * Set cp0 enable bit as sign that we're running on the kernel stack */ .macro CLI +#ifdef CONFIG_CPU_R5900 + sync.p +#endif mfc0 t0, CP0_STATUS li t1, ST0_CU0 | STATMASK or t0, t1 xori t0, STATMASK mtc0 t0, CP0_STATUS +#ifdef CONFIG_CPU_R5900 + sync.p +#endif irq_disable_hazard .endm @@ -516,11 +558,17 @@ * Set cp0 enable bit as sign that we're running on the kernel stack */ .macro STI +#ifdef CONFIG_CPU_R5900 + sync.p +#endif mfc0 t0, CP0_STATUS li t1, ST0_CU0 | STATMASK or t0, t1 xori t0, STATMASK & ~1 mtc0 t0, CP0_STATUS +#ifdef CONFIG_CPU_R5900 + sync.p +#endif irq_enable_hazard .endm @@ -530,6 +578,9 @@ * Set cp0 enable bit as sign that we're running on the kernel stack */ .macro KMODE +#ifdef CONFIG_CPU_R5900 + sync.p +#endif mfc0 t0, CP0_STATUS li t1, ST0_CU0 | (STATMASK & ~1) #if defined(CONFIG_CPU_R3000) || defined(CONFIG_CPU_TX39XX) @@ -540,6 +591,9 @@ or t0, t1 xori t0, STATMASK & ~1 mtc0 t0, CP0_STATUS +#ifdef CONFIG_CPU_R5900 + sync.p +#endif irq_disable_hazard .endm diff --git a/arch/mips/kernel/genex.S b/arch/mips/kernel/genex.S index 398b905b027d..6eaf057e5d95 100644 --- a/arch/mips/kernel/genex.S +++ b/arch/mips/kernel/genex.S @@ -33,7 +33,13 @@ NESTED(except_vec3_generic, 0, sp) .set push .set noat #if R5432_CP0_INTERRUPT_WAR +#ifdef CONFIG_CPU_R5900 + sync.p +#endif mfc0 k0, CP0_INDEX +#endif +#ifdef CONFIG_CPU_R5900 + sync.p #endif mfc0 k1, CP0_CAUSE andi k1, k1, 0x7c @@ -55,6 +61,9 @@ NESTED(except_vec3_r4000, 0, sp) .set push .set arch=r4000 .set noat +#ifdef CONFIG_CPU_R5900 + sync.p +#endif mfc0 k1, CP0_CAUSE li k0, 31<<2 andi k1, k1, 0x7c @@ -78,10 +87,16 @@ NESTED(except_vec3_r4000, 0, sp) * load / store will be re-executed. */ handle_vced: +#ifdef CONFIG_CPU_R5900 + sync.p +#endif MFC0 k0, CP0_BADVADDR li k1, -4 # Is this ... and k0, k1 # ... really needed? mtc0 zero, CP0_TAGLO +#ifdef CONFIG_CPU_R5900 + sync.p +#endif cache Index_Store_Tag_D, (k0) cache Hit_Writeback_Inv_SD, (k0) #ifdef CONFIG_PROC_FS @@ -93,6 +108,9 @@ handle_vced: eret handle_vcei: +#ifdef CONFIG_CPU_R5900 + sync.p +#endif MFC0 k0, CP0_BADVADDR cache Hit_Writeback_Inv_SD, (k0) # also cleans pi #ifdef CONFIG_PROC_FS @@ -138,12 +156,18 @@ LEAF(__r4k_wait) FEXPORT(rollback_\handler) .set push .set noat +#ifdef CONFIG_CPU_R5900 + sync.p +#endif MFC0 k0, CP0_EPC PTR_LA k1, __r4k_wait ori k0, 0x1f /* 32 byte rollback region */ xori k0, 0x1f bne k0, k1, \handler MTC0 k0, CP0_EPC +#ifdef CONFIG_CPU_R5900 + sync.p +#endif .set pop .endm @@ -164,11 +188,17 @@ NESTED(handle_int, PT_SIZE, sp) */ .set push .set noat +#ifdef CONFIG_CPU_R5900 + sync.p +#endif mfc0 k0, CP0_STATUS #if defined(CONFIG_CPU_R3000) || defined(CONFIG_CPU_TX39XX) and k0, ST0_IEP bnez k0, 1f +#ifdef CONFIG_CPU_R5900 + sync.p +#endif mfc0 k0, CP0_EPC .set noreorder j k0 @@ -349,6 +379,9 @@ NESTED(ejtag_debug_handler, PT_SIZE, sp) .set push .set noat MTC0 k0, CP0_DESAVE +#ifdef CONFIG_CPU_R5900 + sync.p +#endif mfc0 k0, CP0_DEBUG sll k0, k0, 30 # Check for SDBBP. @@ -404,6 +437,9 @@ NESTED(ejtag_debug_handler, PT_SIZE, sp) ejtag_return: back_to_back_c0_hazard +#ifdef CONFIG_CPU_R5900 + sync.p +#endif MFC0 k0, CP0_DESAVE .set mips32 deret @@ -494,6 +530,9 @@ NESTED(nmi_handler, PT_SIZE, sp) .endm .macro __build_clear_ade +#ifdef CONFIG_CPU_R5900 + sync.p +#endif MFC0 t0, CP0_BADVADDR PTR_S t0, PT_BVADDR(sp) KMODE @@ -579,16 +618,28 @@ NESTED(nmi_handler, PT_SIZE, sp) .set noat .set noreorder /* check if TLB contains a entry for EPC */ +#ifdef CONFIG_CPU_R5900 + sync.p +#endif MFC0 k1, CP0_ENTRYHI andi k1, MIPS_ENTRYHI_ASID | MIPS_ENTRYHI_ASIDX +#ifdef CONFIG_CPU_R5900 + sync.p +#endif MFC0 k0, CP0_EPC PTR_SRL k0, _PAGE_SHIFT + 1 PTR_SLL k0, _PAGE_SHIFT + 1 or k1, k0 MTC0 k1, CP0_ENTRYHI +#ifdef CONFIG_CPU_R5900 + sync.p +#endif mtc0_tlbw_hazard tlbp tlb_probe_hazard +#ifdef CONFIG_CPU_R5900 + sync.p +#endif mfc0 k1, CP0_INDEX .set pop bltz k1, handle_ri /* slow path */ @@ -601,6 +652,9 @@ NESTED(nmi_handler, PT_SIZE, sp) .set noreorder /* MIPS32: 0x7c03e83b: rdhwr v1,$29 */ /* microMIPS: 0x007d6b3c: rdhwr v1,$29 */ +#ifdef CONFIG_CPU_R5900 + sync.p +#endif MFC0 k1, CP0_EPC #if defined(CONFIG_CPU_MICROMIPS) || defined(CONFIG_CPU_MIPS32_R2) || defined(CONFIG_CPU_MIPS64_R2) and k0, k1, 1 @@ -631,6 +685,9 @@ isrdhwr: /* The insn is rdhwr. No need to check CAUSE.BD here. */ get_saved_sp /* k1 := current_thread_info */ .set noreorder +#ifdef CONFIG_CPU_R5900 + sync.p +#endif MFC0 k0, CP0_EPC #if defined(CONFIG_CPU_R3000) || defined(CONFIG_CPU_TX39XX) ori k1, _THREAD_MASK @@ -648,6 +705,9 @@ isrdhwr: .set noat #endif MTC0 k0, CP0_EPC +#ifdef CONFIG_CPU_R5900 + sync.p +#endif /* I hope three instructions between MTC0 and ERET are enough... */ ori k1, _THREAD_MASK xori k1, _THREAD_MASK diff --git a/arch/mips/kernel/head.S b/arch/mips/kernel/head.S index 351d40fe0859..aae4b17a33d0 100644 --- a/arch/mips/kernel/head.S +++ b/arch/mips/kernel/head.S @@ -34,10 +34,16 @@ */ .macro setup_c0_status set clr .set push +#ifdef CONFIG_CPU_R5900 + sync.p +#endif mfc0 t0, CP0_STATUS or t0, ST0_CU0|\set|0x1f|\clr xor t0, 0x1f|\clr mtc0 t0, CP0_STATUS +#ifdef CONFIG_CPU_R5900 + sync.p +#endif .set noreorder sll zero,3 # ehb .set pop @@ -132,6 +138,9 @@ dtb_found: #endif MTC0 zero, CP0_CONTEXT # clear context register +#ifdef CONFIG_CPU_R5900 + sync.p +#endif PTR_LA $28, init_thread_union /* Set the SP after an empty pt_regs. */ PTR_LI sp, _THREAD_SIZE - 32 - PT_SIZE diff --git a/arch/mips/kernel/r4k_switch.S b/arch/mips/kernel/r4k_switch.S index 58232ae6cfae..de4a1880e9a8 100644 --- a/arch/mips/kernel/r4k_switch.S +++ b/arch/mips/kernel/r4k_switch.S @@ -26,6 +26,9 @@ */ .align 5 LEAF(resume) +#ifdef CONFIG_CPU_R5900 + sync.p +#endif mfc0 t1, CP0_STATUS LONG_S t1, THREAD_STATUS(a0) cpu_save_nonscratch a0 @@ -46,6 +49,9 @@ PTR_ADDU t0, $28, _THREAD_SIZE - 32 set_saved_sp t0, t1, t2 +#ifdef CONFIG_CPU_R5900 + sync.p +#endif mfc0 t1, CP0_STATUS /* Do we really need this? */ li a3, 0xff01 and t1, a3 @@ -54,6 +60,9 @@ and a2, a3 or a2, t1 mtc0 a2, CP0_STATUS +#ifdef CONFIG_CPU_R5900 + sync.p +#endif move v0, a0 jr ra END(resume) diff --git a/arch/mips/mm/cex-gen.S b/arch/mips/mm/cex-gen.S index 45dff5cd4b8e..c5075651229c 100644 --- a/arch/mips/mm/cex-gen.S +++ b/arch/mips/mm/cex-gen.S @@ -27,11 +27,17 @@ * in the cache, we may not be able to recover. As a * first-order desperate measure, turn off KSEG0 cacheing. */ +#ifdef CONFIG_CPU_R5900 + sync.p +#endif mfc0 k0,CP0_CONFIG li k1,~CONF_CM_CMASK and k0,k0,k1 ori k0,k0,CONF_CM_UNCACHED mtc0 k0,CP0_CONFIG +#ifdef CONFIG_CPU_R5900 + sync.p +#endif /* Give it a few cycles to sink in... */ nop nop diff --git a/arch/mips/mm/tlbex-fault.S b/arch/mips/mm/tlbex-fault.S index 77db401fc620..fe2b2c61cca7 100644 --- a/arch/mips/mm/tlbex-fault.S +++ b/arch/mips/mm/tlbex-fault.S @@ -14,6 +14,9 @@ NESTED(tlb_do_page_fault_\write, PT_SIZE, sp) .cfi_signal_frame SAVE_ALL docfi=1 +#ifdef CONFIG_CPU_R5900 + sync.p +#endif MFC0 a2, CP0_BADVADDR KMODE move a0, sp diff --git a/arch/mips/mm/tlbex.c b/arch/mips/mm/tlbex.c index 144ceb0fba88..543ddb22b0d9 100644 --- a/arch/mips/mm/tlbex.c +++ b/arch/mips/mm/tlbex.c @@ -691,6 +691,9 @@ static void build_restore_pagemask(u32 **p, struct uasm_reloc **r, uasm_i_mtc0(p, 0, C0_PAGEMASK); } } +#ifdef CONFIG_CPU_R5900 + uasm_i_syncp(p); +#endif } static void build_huge_tlb_write_entry(u32 **p, struct uasm_label **l, @@ -703,6 +706,9 @@ static void build_huge_tlb_write_entry(u32 **p, struct uasm_label **l, uasm_i_lui(p, tmp, PM_HUGE_MASK >> 16); uasm_i_ori(p, tmp, tmp, PM_HUGE_MASK & 0xffff); uasm_i_mtc0(p, tmp, C0_PAGEMASK); +#ifdef CONFIG_CPU_R5900 + uasm_i_syncp(p); +#endif build_tlb_write_entry(p, l, r, wmode); @@ -963,21 +969,21 @@ void build_get_pgde32(u32 **p, unsigned int tmp, unsigned int ptr) { if (pgd_reg != -1) { /* pgd is in pgd_reg */ - uasm_i_mfc0(p, ptr, c0_kscratch(), pgd_reg); - uasm_i_mfc0(p, tmp, C0_BADVADDR); /* get faulting address */ + UASM_i_MFC0(p, ptr, c0_kscratch(), pgd_reg); + UASM_i_MFC0(p, tmp, C0_BADVADDR); /* get faulting address */ } else { long pgdc = (long)pgd_current; /* 32 bit SMP has smp_processor_id() stored in CONTEXT. */ #ifdef CONFIG_SMP - uasm_i_mfc0(p, ptr, SMP_CPUID_REG); + UASM_i_MFC0(p, ptr, SMP_CPUID_REG); UASM_i_LA_mostly(p, tmp, pgdc); uasm_i_srl(p, ptr, ptr, SMP_CPUID_PTRSHIFT); uasm_i_addu(p, ptr, tmp, ptr); #else UASM_i_LA_mostly(p, ptr, pgdc); #endif - uasm_i_mfc0(p, tmp, C0_BADVADDR); /* get faulting address */ + UASM_i_MFC0(p, tmp, C0_BADVADDR); /* get faulting address */ uasm_i_lw(p, ptr, uasm_rel_lo(pgdc), ptr); } uasm_i_srl(p, tmp, tmp, PGDIR_SHIFT); /* get pgd only bits */ -- 2.21.0
next prev parent reply index Thread overview: 160+ messages / expand[flat|nested] mbox.gz Atom feed top 2019-09-01 15:35 [PATCH 000/120] Linux for the PlayStation 2 Fredrik Noring 2019-09-01 15:35 ` [PATCH 001/120] MIPS: R5900: Initial support for the Emotion Engine in " Fredrik Noring 2019-09-01 21:14 ` Maciej W. Rozycki 2019-09-02 15:09 ` Fredrik Noring 2019-09-01 15:36 ` [PATCH 002/120] MIPS: R5900: Trap the RDHWR instruction as an SQ address exception Fredrik Noring 2019-09-01 22:00 ` Maciej W. Rozycki 2020-11-19 7:15 ` Philippe Mathieu-Daudé 2020-11-19 13:28 ` Maciej W. Rozycki 2020-11-19 13:42 ` Maciej W. Rozycki 2020-12-12 10:58 ` Fredrik Noring 2020-12-12 11:36 ` Maciej W. Rozycki 2020-12-12 12:14 ` Fredrik Noring 2020-12-13 11:43 ` Fredrik Noring 2019-09-01 15:36 ` [PATCH 003/120] MIPS: R5900: Sign-extend o32 system call registers Fredrik Noring 2019-09-01 15:37 ` [PATCH 004/120] MIPS: R5900: Reset bits 127..64 of GPRs in RESTORE_SOME Fredrik Noring 2019-09-01 15:38 ` [PATCH 005/120] MIPS: R5900: Reset the funnel shift amount (SA) register " Fredrik Noring 2019-09-01 15:38 ` [PATCH 006/120] MIPS: R5900: Workaround for the short loop bug Fredrik Noring 2019-09-01 15:39 ` [PATCH 007/120] MIPS: R5900: Add the SYNC.P instruction Fredrik Noring 2019-09-01 15:39 ` [PATCH 008/120] MIPS: R5900: Add implicit SYNC.P to the UASM_i_M[FT]C0 macros Fredrik Noring 2019-09-01 15:39 ` Fredrik Noring [this message] 2019-09-01 15:39 ` [PATCH 010/120] MIPS: R5900: Workaround exception NOP execution bug (FLX05) Fredrik Noring 2019-09-01 23:01 ` Philippe Mathieu-Daudé 2019-09-01 15:40 ` [PATCH 011/120] MIPS: R5900: Avoid pipeline hazard with the TLBP instruction Fredrik Noring 2019-09-01 17:15 ` Sergei Shtylyov 2019-09-01 17:36 ` Fredrik Noring 2019-09-01 15:40 ` [PATCH 012/120] MIPS: R5900: Avoid pipeline hazards with the TLBW[IR] instructions Fredrik Noring 2019-09-01 15:40 ` [PATCH 013/120] MIPS: R5900: Avoid pipeline hazard with the TLBR instruction Fredrik Noring 2019-09-01 15:41 ` [PATCH 014/120] MIPS: R5900: Install final length of TLB refill handler rather than 256 bytes Fredrik Noring 2019-09-01 15:41 ` [PATCH 015/120] MIPS: R5900: Verify that the TLB refill handler does not overflow Fredrik Noring 2019-09-01 15:41 ` [PATCH 016/120] MIPS: R5900: The ERET instruction has issues with delay slot and CACHE Fredrik Noring 2019-09-01 15:42 ` [PATCH 017/120] MIPS: R5900: Define CACHE instruction operation field encodings Fredrik Noring 2019-09-01 15:42 ` [PATCH 018/120] MIPS: R5900: Workaround where MSB must be 0 for the instruction cache Fredrik Noring 2019-09-01 15:42 ` [PATCH 019/120] MIPS: R5900: Use SYNC.L for data cache and SYNC.P for " Fredrik Noring 2019-09-01 15:43 ` [PATCH 020/120] MIPS: R5900: Define CP0.Config register fields Fredrik Noring 2019-09-01 23:04 ` Philippe Mathieu-Daudé 2019-09-01 15:43 ` [PATCH 021/120] MIPS: R5900: Workaround for CACHE instruction near branch delay slot Fredrik Noring 2019-09-01 15:46 ` [PATCH 022/120] MIPS: R5900: Support 64-bit inq() and outq() macros in 32-bit kernels Fredrik Noring 2019-09-04 1:04 ` Jiaxun Yang 2019-09-04 16:00 ` Maciej W. Rozycki 2019-09-01 15:46 ` [PATCH 023/120] MIPS: R5900: Add MFSA and MTSA instructions for the special SA register Fredrik Noring 2019-09-01 15:46 ` [PATCH 024/120] MIPS: PS2: Define PlayStation 2 I/O port, ROM and RAM address spaces Fredrik Noring 2019-09-01 15:47 ` [PATCH 025/120] MIPS: PS2: Define interrupt controller, DMA and timer IRQs Fredrik Noring 2019-09-01 15:47 ` [PATCH 026/120] MIPS: PS2: Interrupt controller (INTC) IRQ support Fredrik Noring 2019-09-01 15:47 ` [PATCH 027/120] MIPS: PS2: DMAC: Define DMA controller registers Fredrik Noring 2019-09-01 15:47 ` [PATCH 028/120] MIPS: PS2: DMAC: Define tag structures Fredrik Noring 2019-09-01 15:48 ` [PATCH 029/120] MIPS: PS2: DMAC: IRQ support Fredrik Noring 2019-09-01 15:48 ` [PATCH 030/120] MIPS: PS2: Timer support Fredrik Noring 2019-09-01 15:48 ` [PATCH 031/120] MIPS: PS2: SCMD: System command support Fredrik Noring 2019-09-01 15:48 ` [PATCH 032/120] MIPS: PS2: SCMD: System power off command Fredrik Noring 2019-09-01 15:48 ` [PATCH 033/120] MIPS: PS2: SCMD: Read system machine name command Fredrik Noring 2019-09-01 15:49 ` [PATCH 034/120] MIPS: PS2: SCMD: Read system command for the real-time clock (RTC) Fredrik Noring 2019-09-01 15:49 ` [PATCH 035/120] MIPS: PS2: SCMD: Set " Fredrik Noring 2019-09-01 15:49 ` [PATCH 036/120] MIPS: PS2: ROM: Iterate over the files in a given ROM directory Fredrik Noring 2019-09-01 15:49 ` [PATCH 037/120] MIPS: PS2: ROM: Find ROM files with a given name, if they exist Fredrik Noring 2019-09-01 15:50 ` [PATCH 038/120] MIPS: PS2: ROM: Read data for a given ROM file name Fredrik Noring 2019-09-02 9:05 ` Sergei Shtylyov 2019-09-04 11:46 ` Sergei Shtylyov 2019-09-06 13:07 ` Fredrik Noring 2019-09-01 15:50 ` [PATCH 039/120] MIPS: PS2: ROM: Read extended information for a given ROM file Fredrik Noring 2019-09-01 15:50 ` [PATCH 040/120] MIPS: PS2: ROM: Read and decode the ROMVER file Fredrik Noring 2019-09-01 15:52 ` [PATCH 041/120] MIPS: PS2: ROM: Resolve the name for the type in " Fredrik Noring 2019-09-01 15:52 ` [PATCH 042/120] MIPS: PS2: ROM: Resolve the name for the region " Fredrik Noring 2019-09-01 15:53 ` [PATCH 043/120] MIPS: PS2: ROM: Permit /dev/mem to access read-only memory Fredrik Noring 2019-09-01 15:53 ` [PATCH 044/120] MIPS: PS2: ROM: Sysfs module to inspect ROM files Fredrik Noring 2019-09-01 15:54 ` [PATCH 045/120] MIPS: PS2: ROM: Provide extended file information via sysfs Fredrik Noring 2019-09-01 15:54 ` [PATCH 046/120] MIPS: PS2: Identify the machine by model name Fredrik Noring 2019-09-01 15:54 ` [PATCH 047/120] MIPS: PS2: Let the system type be Sony PlayStation 2 Fredrik Noring 2019-09-01 23:09 ` Philippe Mathieu-Daudé 2019-09-01 15:55 ` [PATCH 048/120] MIPS: Define and use cpu_relax_forever() for various halting loops Fredrik Noring 2019-09-01 15:55 ` [PATCH 049/120] MIPS: PS2: Power off support Fredrik Noring 2019-09-01 15:55 ` [PATCH 050/120] MIPS: PS2: Real-time clock (RTC) driver Fredrik Noring 2019-09-01 15:56 ` [PATCH 051/120] MIPS: PS2: IOP: I/O processor DMA register PCR2 set and clear Fredrik Noring 2019-09-01 15:57 ` [PATCH 052/120] MIPS: PS2: SIF: Sub-system interface reset of the I/O processor (IOP) Fredrik Noring 2019-09-01 15:57 ` [PATCH 053/120] MIPS: PS2: IOP: Define error numbers, descriptions and errno mapping Fredrik Noring 2019-09-01 15:58 ` [PATCH 054/120] MIPS: PS2: SIF: SIF register write command support Fredrik Noring 2019-09-01 15:58 ` [PATCH 055/120] MIPS: PS2: SIF: Respond to remote procedure call (RPC) bind command Fredrik Noring 2019-09-01 15:58 ` [PATCH 056/120] MIPS: PS2: SIF: Respond to RPC bind end command Fredrik Noring 2019-09-01 15:59 ` [PATCH 057/120] MIPS: PS2: SIF: Reset the SIF0 (sub-to-main) DMA controller Fredrik Noring 2019-09-01 15:59 ` [PATCH 058/120] MIPS: PS2: SIF: Handle SIF0 (sub-to-main) RPCs via interrupts Fredrik Noring 2019-09-01 15:59 ` [PATCH 059/120] MIPS: PS2: SIF: Enable the IOP to issue SIF commands Fredrik Noring 2019-09-01 16:00 ` [PATCH 060/120] MIPS: PS2: SIF: Enable the IOP to issue SIF RPCs Fredrik Noring 2019-09-01 16:01 ` [PATCH 061/120] MIPS: PS2: SIF: sif_rpc_bind() to request an RPC server connection Fredrik Noring 2019-09-01 16:02 ` [PATCH 062/120] MIPS: PS2: SIF: sif_rpc_unbind() to release " Fredrik Noring 2019-09-01 16:02 ` [PATCH 063/120] MIPS: PS2: SIF: sif_rpc() to issue a remote procedure call Fredrik Noring 2019-09-01 16:03 ` [PATCH 064/120] MIPS: PS2: IOP: Permit /dev/mem to access IOP memory Fredrik Noring 2019-09-01 16:03 ` [PATCH 065/120] MIPS: PS2: IOP: I/O processor memory support Fredrik Noring 2019-09-01 16:10 ` [PATCH 066/120] FIXME: Export _dma_cache_{wback,wback_inv,inv} Fredrik Noring 2019-09-01 16:10 ` [PATCH 067/120] MIPS: PS2: IOP: Module linking support Fredrik Noring 2019-09-01 16:11 ` [PATCH 068/120] MIPS: PS2: IOP: Verify that modules are IRX objects Fredrik Noring 2019-09-01 16:11 ` [PATCH 069/120] MIPS: PS2: IOP: Module version compatibility verification Fredrik Noring 2019-09-01 16:11 ` [PATCH 070/120] MIPS: PS2: IOP: Avoid linking already linked library modules Fredrik Noring 2019-09-01 16:12 ` [PATCH 071/120] MIPS: PS2: IOP: Resolve module dependencies Fredrik Noring 2019-09-01 16:12 ` [PATCH 072/120] MIPS: PS2: IOP: SIF printk command support Fredrik Noring 2019-09-01 17:44 ` Sergei Shtylyov 2019-09-01 18:08 ` Fredrik Noring 2019-09-01 16:16 ` [PATCH 073/120] MIPS: PS2: IOP: Heap memory allocate and free Fredrik Noring 2019-09-01 16:16 ` [PATCH 074/120] MIPS: PS2: SIF: Request RPC IRQ command Fredrik Noring 2019-09-01 16:17 ` [PATCH 075/120] MIPS: PS2: IOP: IRQ support Fredrik Noring 2019-09-01 16:17 ` [PATCH 076/120] MIPS: PS2: GS: Define privileged Graphics Synthesizer registers Fredrik Noring 2019-09-01 16:18 ` [PATCH 077/120] MIPS: PS2: GS: Write privileged registers Fredrik Noring 2019-09-01 16:18 ` [PATCH 078/120] MIPS: PS2: GS: Read " Fredrik Noring 2019-09-01 16:18 ` [PATCH 079/120] MIPS: PS2: GS: Define privileged register structures Fredrik Noring 2019-09-01 16:19 ` [PATCH 080/120] MIPS: PS2: GS: Define gs_xorq_imr() Fredrik Noring 2019-09-01 16:20 ` [PATCH 081/120] MIPS: PS2: GS: Privileged register write macros with named fields Fredrik Noring 2019-09-01 16:20 ` [PATCH 082/120] MIPS: PS2: GS: IRQ support Fredrik Noring 2019-09-01 16:21 ` [PATCH 083/120] MIPS: PS2: GS: Define Graphics Synthesizer primitive structures Fredrik Noring 2019-09-01 16:21 ` [PATCH 084/120] MIPS: PS2: GIF: Define Graphics Synthesizer interface structures Fredrik Noring 2019-09-01 16:22 ` [PATCH 085/120] MIPS: PS2: GIF: Graphics Synthesizer interface support Fredrik Noring 2019-09-01 16:22 ` [PATCH 086/120] MIPS: PS2: GS: Graphics Synthesizer device init and video clock Fredrik Noring 2019-09-01 16:23 ` [PATCH 087/120] MIPS: PS2: GS: Compute block count and indices Fredrik Noring 2019-09-01 16:23 ` [PATCH 088/120] MIPS: PS2: GS: Primitive and texel coordinate transformations Fredrik Noring 2019-09-01 16:23 ` [PATCH 089/120] MIPS: PS2: GS: Approximate video region with ROM region Fredrik Noring 2019-09-01 16:24 ` [PATCH 090/120] macro: Extend COUNT_ARGS() from 12 to 32 arguments Fredrik Noring 2019-09-01 16:25 ` [PATCH 091/120] MIPS: PS2: GS: Show privileged registers with sysfs Fredrik Noring 2019-09-01 16:25 ` [PATCH 092/120] MIPS: PS2: GS: Store " Fredrik Noring 2019-09-01 16:25 ` [PATCH 093/120] fbdev: Add fb_warn_once() variant that only prints a warning once Fredrik Noring 2019-09-01 23:12 ` Philippe Mathieu-Daudé 2019-09-01 16:26 ` [PATCH 094/120] MIPS: PS2: FB: Frame buffer driver for the PlayStation 2 Fredrik Noring 2019-09-02 1:12 ` Jiaxun Yang 2019-09-02 14:40 ` Fredrik Noring 2019-09-02 17:47 ` Aaro Koskinen 2019-09-03 14:32 ` Fredrik Noring 2019-09-03 4:01 ` Jiaxun Yang 2019-09-03 17:42 ` Fredrik Noring 2019-09-03 17:59 ` Maciej W. Rozycki 2019-09-03 18:46 ` Fredrik Noring 2020-12-13 13:20 ` Fredrik Noring 2019-09-01 16:30 ` [PATCH 095/120] MIPS: PS2: FB: fb_set_par() standard-definition television support Fredrik Noring 2019-09-01 16:30 ` [PATCH 096/120] MIPS: PS2: FB: fb_set_par() high-definition " Fredrik Noring 2019-09-01 16:31 ` [PATCH 097/120] MIPS: PS2: FB: fb_set_par() VESA computer display mode support Fredrik Noring 2019-09-01 16:31 ` [PATCH 098/120] MIPS: PS2: FB: Preconfigure standard PAL, NTSC and VESA display modes Fredrik Noring 2019-09-01 16:31 ` [PATCH 099/120] MIPS: PS2: FB: Reset the Graphics Synthesizer drawing environment Fredrik Noring 2019-09-01 16:32 ` [PATCH 100/120] MIPS: PS2: FB: Clear the display buffer when changing video modes Fredrik Noring 2019-09-01 16:32 ` [PATCH 101/120] MIPS: PS2: FB: fb_setcolreg() 256 colour pseudo palette support Fredrik Noring 2019-09-01 16:32 ` [PATCH 102/120] MIPS: PS2: FB: fb_settile() with font stored as palette indexed textures Fredrik Noring 2019-09-01 16:32 ` [PATCH 103/120] MIPS: PS2: FB: Hardware accelerated fb_tilecopy() support Fredrik Noring 2019-09-01 16:33 ` [PATCH 104/120] MIPS: PS2: FB: Hardware accelerated fb_tilefill() support Fredrik Noring 2019-09-01 16:33 ` [PATCH 105/120] MIPS: PS2: FB: Simplified fb_tileblit() support Fredrik Noring 2019-09-01 16:33 ` [PATCH 106/120] MIPS: PS2: FB: fb_tilecursor() placeholder Fredrik Noring 2019-09-01 16:33 ` [PATCH 107/120] MIPS: PS2: FB: Hardware accelerated fb_pan_display() support Fredrik Noring 2019-09-01 16:34 ` [PATCH 108/120] MIPS: PS2: FB: fb_blank() display power management signaling (DPMS) Fredrik Noring 2019-09-01 16:34 ` [PATCH 109/120] MIPS: PS2: FB: Disable GIF DMA completion interrupts Fredrik Noring 2019-09-01 16:34 ` [PATCH 110/120] MIPS: PS2: FB: PAL and NTSC grayscale support Fredrik Noring 2019-09-01 16:34 ` [PATCH 111/120] MIPS: PS2: FB: Analogue display mode adjustment module parameter Fredrik Noring 2019-09-01 16:35 ` [PATCH 112/120] USB: OHCI: Support for the PlayStation 2 Fredrik Noring 2019-09-01 16:35 ` [PATCH 113/120] USB: OHCI: OHCI_INTR_MIE workaround for freeze on " Fredrik Noring 2019-09-01 16:35 ` [PATCH 114/120] MIPS: PS2: Workaround for unexpected uLaunchELF CP0 Status user mode Fredrik Noring 2019-09-01 16:35 ` [PATCH 115/120] MIPS: PS2: Define initial PlayStation 2 devices Fredrik Noring 2019-09-01 16:35 ` [PATCH 116/120] MIPS: PS2: Define workarounds related to the PlayStation 2 Fredrik Noring 2019-09-01 16:36 ` [PATCH 117/120] MIPS: PS2: Define R5900 feature overrides Fredrik Noring 2019-09-01 16:36 ` [PATCH 118/120] MIPS: PS2: Define the PlayStation 2 platform Fredrik Noring 2019-09-01 16:36 ` [PATCH 119/120] MIPS: PS2: Initial support for the Sony PlayStation 2 Fredrik Noring 2019-09-01 16:37 ` [PATCH 120/120] MIPS: Fix name of BOOT_MEM_ROM_DATA Fredrik Noring 2019-09-01 23:15 ` Philippe Mathieu-Daudé 2019-09-02 1:02 ` Jiaxun Yang 2019-09-02 15:26 ` Fredrik Noring 2019-09-03 3:50 ` Jiaxun Yang 2019-09-03 16:06 ` Fredrik Noring 2019-09-04 14:19 ` [PATCH 000/120] Linux for the PlayStation 2 Paul Burton 2019-09-05 18:32 ` Fredrik Noring
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=4775699bfc809a6a8b40749f82be890515303bdd.1567326213.git.noring@nocrew.org \ --to=noring@nocrew.org \ --cc=JuergenUrban@gmx.de \ --cc=linux-mips@vger.kernel.org \ --cc=macro@linux-mips.org \ --cc=paul.burton@mips.com \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
Linux-MIPS Archive on lore.kernel.org Archives are clonable: git clone --mirror https://lore.kernel.org/linux-mips/0 linux-mips/git/0.git # If you have public-inbox 1.1+ installed, you may # initialize and index your mirror using the following commands: public-inbox-init -V2 linux-mips linux-mips/ https://lore.kernel.org/linux-mips \ linux-mips@vger.kernel.org public-inbox-index linux-mips Example config snippet for mirrors Newsgroup available over NNTP: nntp://nntp.lore.kernel.org/org.kernel.vger.linux-mips AGPL code for this site: git clone https://public-inbox.org/public-inbox.git