]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
MIPS: memset: Fix CPU_DADDI_WORKAROUNDS `small_fixup' regression
authorMaciej W. Rozycki <macro@linux-mips.org>
Tue, 2 Oct 2018 11:50:11 +0000 (12:50 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 13 Nov 2018 19:12:47 +0000 (11:12 -0800)
commit5cd5e22d5b1d9093140e5c3ec2cb27332aade1ae
treed7978f4dc6f0dc377bcd1614c2d25df17445e784
parent163121109386e3876a472aeff31ab0428ee22d3e
MIPS: memset: Fix CPU_DADDI_WORKAROUNDS `small_fixup' regression

commit 2f7619ae90bf78cf576b5e72087aab0435266fdb upstream.

Fix a commit 8a8158c85e1e ("MIPS: memset.S: EVA & fault support for
small_memset") regression and remove assembly warnings:

arch/mips/lib/memset.S: Assembler messages:
arch/mips/lib/memset.S:243: Warning: Macro instruction expanded into multiple instructions in a branch delay slot

triggering with the CPU_DADDI_WORKAROUNDS option set and this code:

PTR_SUBU a2, t1, a0
jr ra
 PTR_ADDIU a2, 1

This is because with that option in place the DADDIU instruction, which
the PTR_ADDIU CPP macro expands to, becomes a GAS macro, which in turn
expands to an LI/DADDU (or actually ADDIU/DADDU) sequence:

 13c: 01a4302f  dsubu a2,t1,a0
 140: 03e00008  jr ra
 144: 24010001  li at,1
 148: 00c1302d  daddu a2,a2,at
...

Correct this by switching off the `noreorder' assembly mode and letting
GAS schedule this jump's delay slot, as there is nothing special about
it that would require manual scheduling.  With this change in place
correct code is produced:

 13c: 01a4302f  dsubu a2,t1,a0
 140: 24010001  li at,1
 144: 03e00008  jr ra
 148: 00c1302d  daddu a2,a2,at
...

Signed-off-by: Maciej W. Rozycki <macro@linux-mips.org>
Signed-off-by: Paul Burton <paul.burton@mips.com>
Fixes: 8a8158c85e1e ("MIPS: memset.S: EVA & fault support for small_memset")
Patchwork: https://patchwork.linux-mips.org/patch/20833/
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: stable@vger.kernel.org # 4.17+
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
arch/mips/lib/memset.S