powerpc: prepare for pcrel addressing patches
Subsystems (2)
Nicholas Piggin
reviewercover powerpc: prepare for pcrel addressing patches
Here's a few of the easier preparation patches from the pcrel addressing series.
Thanks,
Nick
Nicholas Piggin (3):
crypto: powerpc - Use address generation helper for asm powerpc/64s: Refactor initialisation after prom powerpc/64e: Simplify address calculation in secondary hold loop
arch/powerpc/crypto/crc32-vpmsum_core.S | 13 ++----- arch/powerpc/kernel/head_64.S | 50 +++++++++++++------------ 2 files changed, 30 insertions(+), 33 deletions(-)
Signature · 1 line
2.37.2
Nicholas Piggin
reviewerPATCH 1/3 crypto: powerpc - Use address generation helper for asm
Replace open-coded toc-relative address calculation with helper macros, commit dab3b8f4fd09 ("powerpc/64: asm use consistent global variable declaration and access") made similar conversions already but missed this one.
This allows data addressing model to be changed more easily.
--- arch/powerpc/crypto/crc32-vpmsum_core.S | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-)
arch/powerpc/crypto/crc32-vpmsum_core.S +4 -9
@@ -113,9 +113,7 @@ FUNC_START(CRC_FUNCTION_NAME) #endif #ifdef BYTESWAP_DATA - addis r3,r2,.byteswap_constant@toc@ha - addi r3,r3,.byteswap_constant@toc@l - + LOAD_REG_ADDR(r3, .byteswap_constant) lvx byteswap,0,r3 addi r3,r3,16 #endif
@@ -150,8 +148,7 @@ FUNC_START(CRC_FUNCTION_NAME) addi r7,r7,-1 mtctr r7 - addis r3,r2,.constants@toc@ha - addi r3,r3,.constants@toc@l + LOAD_REG_ADDR(r3, .constants) /* Find the start of our constants */ add r3,r3,r8
@@ -506,8 +503,7 @@ FUNC_START(CRC_FUNCTION_NAME) .Lbarrett_reduction: /* Barrett constants */ - addis r3,r2,.barrett_constants@toc@ha - addi r3,r3,.barrett_constants@toc@l + LOAD_REG_ADDR(r3, .barrett_constants) lvx const1,0,r3 lvx const2,off16,r3
@@ -610,8 +606,7 @@ FUNC_START(CRC_FUNCTION_NAME) cmpdi r5,0 beq .Lzero - addis r3,r2,.short_constants@toc@ha - addi r3,r3,.short_constants@toc@l + LOAD_REG_ADDR(r3, .short_constants) /* Calculate where in the constant table we need to start */ subfic r6,r5,256
Signature · 1 line
2.37.2
Nicholas Piggin
reviewerPATCH 2/3 powerpc/64s: Refactor initialisation after prom
In reply to Nicholas PigginMove some basic Book3S initialisation after prom to a function similar to what Book3E looks like. Book3E returns from this function at the virtual address mapping, and Book3S will do the same in a later change, so making them look similar helps with that.
--- arch/powerpc/kernel/head_64.S | 44 ++++++++++++++++++++--------------- 1 file changed, 25 insertions(+), 19 deletions(-)
arch/powerpc/kernel/head_64.S +25 -19
@@ -475,8 +475,30 @@ SYM_FUNC_START_LOCAL(__mmu_off) rfid b . /* prevent speculative execution */ SYM_FUNC_END(__mmu_off) -#endif +start_initialization_book3s: + mflr r25 + + /* Setup some critical 970 SPRs before switching MMU off */ + mfspr r0,SPRN_PVR + srwi r0,r0,16 + cmpwi r0,0x39 /* 970 */ + beq 1f + cmpwi r0,0x3c /* 970FX */ + beq 1f + cmpwi r0,0x44 /* 970MP */ + beq 1f + cmpwi r0,0x45 /* 970GX */ + bne 2f +1: bl __cpu_preinit_ppc970 +2: + + /* Switch off MMU if not already off */ + bl __mmu_off + + mtlr r25 + blr +#endif /* * Here is our main kernel entry point. We support currently 2 kind of entries
@@ -523,26 +545,10 @@ __start_initialization_multiplatform: #ifdef CONFIG_PPC_BOOK3E_64 bl start_initialization_book3e - b __after_prom_start #else - /* Setup some critical 970 SPRs before switching MMU off */ - mfspr r0,SPRN_PVR - srwi r0,r0,16 - cmpwi r0,0x39 /* 970 */ - beq 1f - cmpwi r0,0x3c /* 970FX */ - beq 1f - cmpwi r0,0x44 /* 970MP */ - beq 1f - cmpwi r0,0x45 /* 970GX */ - bne 2f -1: bl __cpu_preinit_ppc970 -2: - - /* Switch off MMU if not already off */ - bl __mmu_off - b __after_prom_start + bl start_initialization_book3s #endif /* CONFIG_PPC_BOOK3E_64 */ + b __after_prom_start __REF __boot_from_prom:
Signature · 1 line
2.37.2
Nicholas Piggin
reviewerPATCH 3/3 powerpc/64e: Simplify address calculation in secondary hold loop
In reply to Nicholas PigginAs the earlier comment explains, __secondary_hold_spinloop does not have to be accessed at its virtual address, slightly simplifying code.
--- arch/powerpc/kernel/head_64.S | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-)
arch/powerpc/kernel/head_64.S +1 -5
@@ -160,12 +160,8 @@ __secondary_hold: std r24,(ABS_ADDR(__secondary_hold_acknowledge, first_256B))(0) sync - li r26,0 -#ifdef CONFIG_PPC_BOOK3E_64 - tovirt(r26,r26) -#endif /* All secondary cpus wait here until told to start. */ -100: ld r12,(ABS_ADDR(__secondary_hold_spinloop, first_256B))(r26) +100: ld r12,(ABS_ADDR(__secondary_hold_spinloop, first_256B))(0) cmpdi 0,r12,0 beq 100b
Signature · 1 line
2.37.2
Michael Ellerman
AppliedQuoted 6 lines · Nicholas Piggin
Here's a few of the easier preparation patches from the pcrel addressing series.
Thanks,
Nick
Quoted 6 lines
Nicholas Piggin (3):
crypto: powerpc - Use address generation helper for asm powerpc/64s: Refactor initialisation after prom powerpc/64e: Simplify address calculation in secondary hold loop[...]
Applied to powerpc/next.
[1/3] crypto: powerpc - Use address generation helper for asm
https://git.kernel.org/powerpc/c/26d53a9c89a8486c5c637cc587e1933a786747d0 [2/3] powerpc/64s: Refactor initialisation after prom https://git.kernel.org/powerpc/c/58f24eea5278cb6078552e16063fdd8b0a1b9676 [3/3] powerpc/64e: Simplify address calculation in secondary hold loop https://git.kernel.org/powerpc/c/ffc8e90decc531a2dd59ef9e1e6f16a52057ab62
cheers