920-cache-wround.patch 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. --- a/arch/mips/include/asm/r4kcache.h
  2. +++ b/arch/mips/include/asm/r4kcache.h
  3. @@ -25,10 +25,28 @@ extern void (*r4k_blast_icache)(void);
  4. #ifdef CONFIG_BCM47XX
  5. #include <asm/paccess.h>
  6. #include <linux/ssb/ssb.h>
  7. -#define BCM4710_DUMMY_RREG() ((void) *((u8 *) KSEG1ADDR(SSB_ENUM_BASE)))
  8. +#define BCM4710_DUMMY_RREG() bcm4710_dummy_rreg()
  9. +
  10. +static inline unsigned long bcm4710_dummy_rreg(void)
  11. +{
  12. + return *(volatile unsigned long *)(KSEG1ADDR(SSB_ENUM_BASE));
  13. +}
  14. +
  15. +#define BCM4710_FILL_TLB(addr) bcm4710_fill_tlb((void *)(addr))
  16. +
  17. +static inline unsigned long bcm4710_fill_tlb(void *addr)
  18. +{
  19. + return *(unsigned long *)addr;
  20. +}
  21. +
  22. +#define BCM4710_PROTECTED_FILL_TLB(addr) bcm4710_protected_fill_tlb((void *)(addr))
  23. +
  24. +static inline void bcm4710_protected_fill_tlb(void *addr)
  25. +{
  26. + unsigned long x;
  27. + get_dbe(x, (unsigned long *)addr);;
  28. +}
  29. -#define BCM4710_FILL_TLB(addr) (*(volatile unsigned long *)(addr))
  30. -#define BCM4710_PROTECTED_FILL_TLB(addr) ({ unsigned long x; get_dbe(x, (volatile unsigned long *)(addr)); })
  31. #else
  32. #define BCM4710_DUMMY_RREG()
  33. --- a/arch/mips/mm/tlbex.c
  34. +++ b/arch/mips/mm/tlbex.c
  35. @@ -940,6 +940,9 @@ build_get_pgde32(u32 **p, unsigned int t
  36. uasm_i_srl(p, ptr, ptr, SMP_CPUID_PTRSHIFT);
  37. uasm_i_addu(p, ptr, tmp, ptr);
  38. #else
  39. +#ifdef CONFIG_BCM47XX
  40. + uasm_i_nop(p);
  41. +#endif
  42. UASM_i_LA_mostly(p, ptr, pgdc);
  43. #endif
  44. uasm_i_mfc0(p, tmp, C0_BADVADDR); /* get faulting address */
  45. @@ -1285,12 +1288,12 @@ static void build_r4000_tlb_refill_handl
  46. /* No need for uasm_i_nop */
  47. }
  48. -#ifdef CONFIG_BCM47XX
  49. - uasm_i_nop(&p);
  50. -#endif
  51. #ifdef CONFIG_64BIT
  52. build_get_pmde64(&p, &l, &r, K0, K1); /* get pmd in K1 */
  53. #else
  54. +# ifdef CONFIG_BCM47XX
  55. + uasm_i_nop(&p);
  56. +# endif
  57. build_get_pgde32(&p, K0, K1); /* get pgd in K1 */
  58. #endif
  59. @@ -1302,6 +1305,9 @@ static void build_r4000_tlb_refill_handl
  60. build_update_entries(&p, K0, K1);
  61. build_tlb_write_entry(&p, &l, &r, tlb_random);
  62. uasm_l_leave(&l, p);
  63. +#ifdef CONFIG_BCM47XX
  64. + uasm_i_nop(&p);
  65. +#endif
  66. uasm_i_eret(&p); /* return from trap */
  67. }
  68. #ifdef CONFIG_MIPS_HUGE_TLB_SUPPORT
  69. @@ -1850,12 +1856,12 @@ build_r4000_tlbchange_handler_head(u32 *
  70. {
  71. struct work_registers wr = build_get_work_registers(p);
  72. -#ifdef CONFIG_BCM47XX
  73. - uasm_i_nop(p);
  74. -#endif
  75. #ifdef CONFIG_64BIT
  76. build_get_pmde64(p, l, r, wr.r1, wr.r2); /* get pmd in ptr */
  77. #else
  78. +# ifdef CONFIG_BCM47XX
  79. + uasm_i_nop(p);
  80. +# endif
  81. build_get_pgde32(p, wr.r1, wr.r2); /* get pgd in ptr */
  82. #endif
  83. @@ -1902,6 +1908,9 @@ build_r4000_tlbchange_handler_tail(u32 *
  84. build_tlb_write_entry(p, l, r, tlb_indexed);
  85. uasm_l_leave(l, *p);
  86. build_restore_work_registers(p);
  87. +#ifdef CONFIG_BCM47XX
  88. + uasm_i_nop(p);
  89. +#endif
  90. uasm_i_eret(p); /* return from trap */
  91. #ifdef CONFIG_64BIT
  92. --- a/arch/mips/kernel/genex.S
  93. +++ b/arch/mips/kernel/genex.S
  94. @@ -21,6 +21,19 @@
  95. #include <asm/war.h>
  96. #include <asm/thread_info.h>
  97. +#ifdef CONFIG_BCM47XX
  98. +# ifdef eret
  99. +# undef eret
  100. +# endif
  101. +# define eret \
  102. + .set push; \
  103. + .set noreorder; \
  104. + nop; \
  105. + nop; \
  106. + eret; \
  107. + .set pop;
  108. +#endif
  109. +
  110. __INIT
  111. /*
  112. @@ -34,7 +47,6 @@ NESTED(except_vec3_generic, 0, sp)
  113. .set noat
  114. #ifdef CONFIG_BCM47XX
  115. nop
  116. - nop
  117. #endif
  118. #if R5432_CP0_INTERRUPT_WAR
  119. mfc0 k0, CP0_INDEX
  120. @@ -59,6 +71,9 @@ NESTED(except_vec3_r4000, 0, sp)
  121. .set push
  122. .set arch=r4000
  123. .set noat
  124. +#ifdef CONFIG_BCM47XX
  125. + nop
  126. +#endif
  127. mfc0 k1, CP0_CAUSE
  128. li k0, 31<<2
  129. andi k1, k1, 0x7c