Skip to content

Commit 854da23

Browse files
committed
Merge tag 'mips_fixes_4.17_1' of git://git.kernel.org/pub/scm/linux/kernel/git/jhogan/mips
Pull MIPS fixes from James Hogan: - io: Add barriers to read*() & write*() - dts: Fix boston PCI bus DTC warnings (4.17) - memset: Several corner case fixes (one 3.10, others longer) * tag 'mips_fixes_4.17_1' of git://git.kernel.org/pub/scm/linux/kernel/git/jhogan/mips: MIPS: uaccess: Add micromips clobbers to bzero invocation MIPS: memset.S: Fix clobber of v1 in last_fixup MIPS: memset.S: Fix return of __clear_user from Lpartial_fixup MIPS: memset.S: EVA & fault support for small_memset MIPS: dts: Boston: Fix PCI bus dtc warnings: MIPS: io: Add barrier after register read in readX() MIPS: io: Prevent compiler reordering writeX()
2 parents d08de37 + b3d7e55 commit 854da23

File tree

4 files changed

+26
-6
lines changed

4 files changed

+26
-6
lines changed

arch/mips/boot/dts/img/boston.dts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@
5151
ranges = <0x02000000 0 0x40000000
5252
0x40000000 0 0x40000000>;
5353

54+
bus-range = <0x00 0xff>;
55+
5456
interrupt-map-mask = <0 0 0 7>;
5557
interrupt-map = <0 0 0 1 &pci0_intc 1>,
5658
<0 0 0 2 &pci0_intc 2>,
@@ -79,6 +81,8 @@
7981
ranges = <0x02000000 0 0x20000000
8082
0x20000000 0 0x20000000>;
8183

84+
bus-range = <0x00 0xff>;
85+
8286
interrupt-map-mask = <0 0 0 7>;
8387
interrupt-map = <0 0 0 1 &pci1_intc 1>,
8488
<0 0 0 2 &pci1_intc 2>,
@@ -107,6 +111,8 @@
107111
ranges = <0x02000000 0 0x16000000
108112
0x16000000 0 0x100000>;
109113

114+
bus-range = <0x00 0xff>;
115+
110116
interrupt-map-mask = <0 0 0 7>;
111117
interrupt-map = <0 0 0 1 &pci2_intc 1>,
112118
<0 0 0 2 &pci2_intc 2>,

arch/mips/include/asm/io.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,7 @@ static inline void iounmap(const volatile void __iomem *addr)
307307
#if defined(CONFIG_CPU_CAVIUM_OCTEON) || defined(CONFIG_LOONGSON3_ENHANCEMENT)
308308
#define war_io_reorder_wmb() wmb()
309309
#else
310-
#define war_io_reorder_wmb() do { } while (0)
310+
#define war_io_reorder_wmb() barrier()
311311
#endif
312312

313313
#define __BUILD_MEMORY_SINGLE(pfx, bwlq, type, irq) \
@@ -377,6 +377,8 @@ static inline type pfx##read##bwlq(const volatile void __iomem *mem) \
377377
BUG(); \
378378
} \
379379
\
380+
/* prevent prefetching of coherent DMA data prematurely */ \
381+
rmb(); \
380382
return pfx##ioswab##bwlq(__mem, __val); \
381383
}
382384

arch/mips/include/asm/uaccess.h

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -654,6 +654,13 @@ __clear_user(void __user *addr, __kernel_size_t size)
654654
{
655655
__kernel_size_t res;
656656

657+
#ifdef CONFIG_CPU_MICROMIPS
658+
/* micromips memset / bzero also clobbers t7 & t8 */
659+
#define bzero_clobbers "$4", "$5", "$6", __UA_t0, __UA_t1, "$15", "$24", "$31"
660+
#else
661+
#define bzero_clobbers "$4", "$5", "$6", __UA_t0, __UA_t1, "$31"
662+
#endif /* CONFIG_CPU_MICROMIPS */
663+
657664
if (eva_kernel_access()) {
658665
__asm__ __volatile__(
659666
"move\t$4, %1\n\t"
@@ -663,7 +670,7 @@ __clear_user(void __user *addr, __kernel_size_t size)
663670
"move\t%0, $6"
664671
: "=r" (res)
665672
: "r" (addr), "r" (size)
666-
: "$4", "$5", "$6", __UA_t0, __UA_t1, "$31");
673+
: bzero_clobbers);
667674
} else {
668675
might_fault();
669676
__asm__ __volatile__(
@@ -674,7 +681,7 @@ __clear_user(void __user *addr, __kernel_size_t size)
674681
"move\t%0, $6"
675682
: "=r" (res)
676683
: "r" (addr), "r" (size)
677-
: "$4", "$5", "$6", __UA_t0, __UA_t1, "$31");
684+
: bzero_clobbers);
678685
}
679686

680687
return res;

arch/mips/lib/memset.S

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@
219219
1: PTR_ADDIU a0, 1 /* fill bytewise */
220220
R10KCBARRIER(0(ra))
221221
bne t1, a0, 1b
222-
sb a1, -1(a0)
222+
EX(sb, a1, -1(a0), .Lsmall_fixup\@)
223223

224224
2: jr ra /* done */
225225
move a2, zero
@@ -252,13 +252,18 @@
252252
PTR_L t0, TI_TASK($28)
253253
andi a2, STORMASK
254254
LONG_L t0, THREAD_BUADDR(t0)
255-
LONG_ADDU a2, t1
255+
LONG_ADDU a2, a0
256256
jr ra
257257
LONG_SUBU a2, t0
258258

259259
.Llast_fixup\@:
260260
jr ra
261-
andi v1, a2, STORMASK
261+
nop
262+
263+
.Lsmall_fixup\@:
264+
PTR_SUBU a2, t1, a0
265+
jr ra
266+
PTR_ADDIU a2, 1
262267

263268
.endm
264269

0 commit comments

Comments
 (0)