linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] powerpc: don't flush/invalidate the d/icache for an unknown relocation type
@ 2013-06-27  1:09 Kevin Hao
  2013-06-27  6:36 ` Suzuki K. Poulose
  0 siblings, 1 reply; 2+ messages in thread
From: Kevin Hao @ 2013-06-27  1:09 UTC (permalink / raw)
  To: Benjamin Herrenschmidt; +Cc: linuxppc, Suzuki Poulose

For an unknown relocation type since the value of r4 is just the 8bit
relocation type, the sum of r4 and r7 may yield an invalid memory
address. For example:
    In normal case:
             r4 = c00xxxxx
             r7 = 40000000
             r4 + r7 = 000xxxxx

    For an unknown relocation type:
             r4 = 000000xx
             r7 = 40000000
             r4 + r7 = 400000xx
   400000xx is an invalid memory address for a board which has just
   512M memory.

And for operations such as dcbst or icbi may cause bus error for an
invalid memory address on some platforms and then cause the board
reset. So we should skip the flush/invalidate the d/icache for
an unknown relocation type.

Signed-off-by: Kevin Hao <haokexin@gmail.com>
---
 arch/powerpc/kernel/reloc_32.S | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/arch/powerpc/kernel/reloc_32.S b/arch/powerpc/kernel/reloc_32.S
index ef46ba6..f366fed 100644
--- a/arch/powerpc/kernel/reloc_32.S
+++ b/arch/powerpc/kernel/reloc_32.S
@@ -166,7 +166,7 @@ ha16:
 	/* R_PPC_ADDR16_LO */
 lo16:
 	cmpwi	r4, R_PPC_ADDR16_LO
-	bne	nxtrela
+	bne	unknown_type
 	lwz	r4, 0(r9)	/* r_offset */
 	lwz	r0, 8(r9)	/* r_addend */
 	add	r0, r0, r3
@@ -191,6 +191,7 @@ nxtrela:
 	dcbst	r4,r7
 	sync			/* Ensure the data is flushed before icbi */
 	icbi	r4,r7
+unknown_type:
 	cmpwi	r8, 0		/* relasz = 0 ? */
 	ble	done
 	add	r9, r9, r6	/* move to next entry in the .rela table */
-- 
1.8.1.4

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] powerpc: don't flush/invalidate the d/icache for an unknown relocation type
  2013-06-27  1:09 [PATCH] powerpc: don't flush/invalidate the d/icache for an unknown relocation type Kevin Hao
@ 2013-06-27  6:36 ` Suzuki K. Poulose
  0 siblings, 0 replies; 2+ messages in thread
From: Suzuki K. Poulose @ 2013-06-27  6:36 UTC (permalink / raw)
  To: Kevin Hao; +Cc: linuxppc

On 06/27/2013 06:39 AM, Kevin Hao wrote:
> For an unknown relocation type since the value of r4 is just the 8bit
> relocation type, the sum of r4 and r7 may yield an invalid memory
> address. For example:
>      In normal case:
>               r4 = c00xxxxx
>               r7 = 40000000
>               r4 + r7 = 000xxxxx
>
>      For an unknown relocation type:
>               r4 = 000000xx
>               r7 = 40000000
>               r4 + r7 = 400000xx
>     400000xx is an invalid memory address for a board which has just
>     512M memory.
>
> And for operations such as dcbst or icbi may cause bus error for an
> invalid memory address on some platforms and then cause the board
> reset. So we should skip the flush/invalidate the d/icache for
> an unknown relocation type.
>

Good catch. Thanks for the fix.

Acked-by: Suzuki K. Poulose <suzuki@in.ibm.com>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-06-27  6:36 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-06-27  1:09 [PATCH] powerpc: don't flush/invalidate the d/icache for an unknown relocation type Kevin Hao
2013-06-27  6:36 ` Suzuki K. Poulose

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).