2017-06-27 19:22:29

by Karl Beldan

[permalink] [raw]
Subject: [RESEND PATCH] MIPS: head: Reorder instructions missing a delay slot

In this sequence the 'move' is assumed in the delay slot of the 'beq',
but head.S is in reorder mode and the former gets pushed one 'nop'
farther by the assembler.

The corrected behavior made booting with an UHI supplied dtb erratic.

Fixes: 15f37e158892 ("MIPS: store the appended dtb address in a variable")
Cc: <[email protected]>
Cc: Ralf Baechle <[email protected]>
Cc: Jonas Gorski <[email protected]>
Signed-off-by: Karl Beldan <[email protected]>
---
arch/mips/kernel/head.S | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/mips/kernel/head.S b/arch/mips/kernel/head.S
index cf05220..d1bb506 100644
--- a/arch/mips/kernel/head.S
+++ b/arch/mips/kernel/head.S
@@ -106,8 +106,8 @@ NESTED(kernel_entry, 16, sp) # kernel entry point
beq t0, t1, dtb_found
#endif
li t1, -2
- beq a0, t1, dtb_found
move t2, a1
+ beq a0, t1, dtb_found

li t2, 0
dtb_found:
--
2.10.1


2017-06-27 20:31:42

by James Hogan

[permalink] [raw]
Subject: Re: [RESEND PATCH] MIPS: head: Reorder instructions missing a delay slot

On Tue, Jun 27, 2017 at 07:22:16PM +0000, Karl Beldan wrote:
> In this sequence the 'move' is assumed in the delay slot of the 'beq',
> but head.S is in reorder mode and the former gets pushed one 'nop'
> farther by the assembler.
>
> The corrected behavior made booting with an UHI supplied dtb erratic.
>
> Fixes: 15f37e158892 ("MIPS: store the appended dtb address in a variable")
> Cc: <[email protected]>
> Cc: Ralf Baechle <[email protected]>
> Cc: Jonas Gorski <[email protected]>
> Signed-off-by: Karl Beldan <[email protected]>

Ouch, nice catch.

Reviewed-by: James Hogan <[email protected]>

Cheers
James

> ---
> arch/mips/kernel/head.S | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/mips/kernel/head.S b/arch/mips/kernel/head.S
> index cf05220..d1bb506 100644
> --- a/arch/mips/kernel/head.S
> +++ b/arch/mips/kernel/head.S
> @@ -106,8 +106,8 @@ NESTED(kernel_entry, 16, sp) # kernel entry point
> beq t0, t1, dtb_found
> #endif
> li t1, -2
> - beq a0, t1, dtb_found
> move t2, a1
> + beq a0, t1, dtb_found
>
> li t2, 0
> dtb_found:
> --
> 2.10.1
>
>


Attachments:
(No filename) (1.11 kB)
signature.asc (833.00 B)
Digital signature
Download all attachments

2017-06-27 21:40:36

by Ralf Baechle

[permalink] [raw]
Subject: Re: [RESEND PATCH] MIPS: head: Reorder instructions missing a delay slot

On Tue, Jun 27, 2017 at 07:22:16PM +0000, Karl Beldan wrote:

> In this sequence the 'move' is assumed in the delay slot of the 'beq',
> but head.S is in reorder mode and the former gets pushed one 'nop'
> farther by the assembler.
>
> The corrected behavior made booting with an UHI supplied dtb erratic.

Excellent catch, patch applied!

Thanks Karl,

Ralf