diff mbox series

powerpc/32s: Use relocation offset when setting early hash table

Message ID 9e225a856a8b22e0e77587ee22ab7a2f5bca8753.1604740029.git.christophe.leroy@csgroup.eu (mailing list archive)
State Accepted
Commit 01776f070ffcbf336be3bf1672bd3c589548d6c4
Headers show
Series powerpc/32s: Use relocation offset when setting early hash table | expand

Checks

Context Check Description
snowpatch_ozlabs/apply_patch success Successfully applied on branch powerpc/merge (f924bf2a58108816db1c95e08af4b1f99c90afa3)
snowpatch_ozlabs/build-ppc64le success Build succeeded
snowpatch_ozlabs/build-ppc64be success Build succeeded
snowpatch_ozlabs/build-ppc64e success Build succeeded
snowpatch_ozlabs/build-pmac32 success Build succeeded
snowpatch_ozlabs/checkpatch success total: 0 errors, 0 warnings, 0 checks, 15 lines checked
snowpatch_ozlabs/needsstable success Patch fixes a commit that hasn't been released yet

Commit Message

Christophe Leroy Nov. 7, 2020, 9:07 a.m. UTC
When calling early_hash_table(), the kernel hasn't been yet
relocated to its linking address, so data must be addressed
with relocation offset.

Add relocation offset to write into Hash in early_hash_table().

Reported-by: Erhard Furtner <erhard_f@mailbox.org>
Reported-by: Andreas Schwab <schwab@linux-m68k.org>
Fixes: 69a1593abdbc ("powerpc/32s: Setup the early hash table at all time.")
Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
---
 arch/powerpc/kernel/head_book3s_32.S | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Serge Belyshev Nov. 7, 2020, 9:53 a.m. UTC | #1
Christophe Leroy <christophe.leroy@csgroup.eu> writes:

> When calling early_hash_table(), the kernel hasn't been yet
> relocated to its linking address, so data must be addressed
> with relocation offset.
>
> Add relocation offset to write into Hash in early_hash_table().
>
> Reported-by: Erhard Furtner <erhard_f@mailbox.org>
> Reported-by: Andreas Schwab <schwab@linux-m68k.org>
> Fixes: 69a1593abdbc ("powerpc/32s: Setup the early hash table at all time.")
> Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>

Tested-by: Serge Belyshev <belyshev@depni.sinp.msu.ru>
Andreas Schwab Nov. 7, 2020, 1:24 p.m. UTC | #2
On Nov 07 2020, Serge Belyshev wrote:

> Christophe Leroy <christophe.leroy@csgroup.eu> writes:
>
>> When calling early_hash_table(), the kernel hasn't been yet
>> relocated to its linking address, so data must be addressed
>> with relocation offset.
>>
>> Add relocation offset to write into Hash in early_hash_table().
>>
>> Reported-by: Erhard Furtner <erhard_f@mailbox.org>
>> Reported-by: Andreas Schwab <schwab@linux-m68k.org>
>> Fixes: 69a1593abdbc ("powerpc/32s: Setup the early hash table at all time.")
>> Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
>
> Tested-by: Serge Belyshev <belyshev@depni.sinp.msu.ru>

Works here as well.

Thanks, Andreas.
Michael Ellerman Nov. 8, 2020, 10:29 a.m. UTC | #3
On Sat, 7 Nov 2020 09:07:40 +0000 (UTC), Christophe Leroy wrote:
> When calling early_hash_table(), the kernel hasn't been yet
> relocated to its linking address, so data must be addressed
> with relocation offset.
> 
> Add relocation offset to write into Hash in early_hash_table().

Applied to powerpc/fixes.

[1/1] powerpc/32s: Use relocation offset when setting early hash table
      https://git.kernel.org/powerpc/c/01776f070ffcbf336be3bf1672bd3c589548d6c4

cheers
diff mbox series

Patch

diff --git a/arch/powerpc/kernel/head_book3s_32.S b/arch/powerpc/kernel/head_book3s_32.S
index 5eb9eedac920..8aa7eb11754e 100644
--- a/arch/powerpc/kernel/head_book3s_32.S
+++ b/arch/powerpc/kernel/head_book3s_32.S
@@ -156,6 +156,7 @@  __after_mmu_off:
 	bl	initial_bats
 	bl	load_segment_registers
 BEGIN_MMU_FTR_SECTION
+	bl	reloc_offset
 	bl	early_hash_table
 END_MMU_FTR_SECTION_IFSET(MMU_FTR_HPTE_TABLE)
 #if defined(CONFIG_BOOTX_TEXT)
@@ -932,7 +933,7 @@  early_hash_table:
 	ori	r6, r6, 3	/* 256kB table */
 	mtspr	SPRN_SDR1, r6
 	lis	r6, early_hash@h
-	lis	r3, Hash@ha
+	addis	r3, r3, Hash@ha
 	stw	r6, Hash@l(r3)
 	blr