Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

powerpc/64: Move initial base and TOC pointer calculation

A later change moves the non-prom case to run at the virtual address
earlier, which calls for virtual TOC and kernel base. Split these two
calculations for prom and non-prom to make that change simpler.

Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
[mpe: Retain relative_toc call for start_initialization_book3e]
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://msgid.link/20230408021752.862660-2-npiggin@gmail.com

authored by

Nicholas Piggin and committed by
Michael Ellerman
4f18b9e6 40f7b523

+22 -9
+22 -9
arch/powerpc/kernel/head_64.S
··· 515 515 /* Zero r13 (paca) so early program check / mce don't use it */ 516 516 li r13,0 517 517 518 - /* Get TOC pointer (current runtime address) */ 519 - bl relative_toc 520 - 521 - /* find out where we are now */ 522 - bcl 20,31,$+4 523 - 0: mflr r26 /* r26 = runtime addr here */ 524 - addis r26,r26,(_stext - 0b)@ha 525 - addi r26,r26,(_stext - 0b)@l /* current runtime base addr */ 526 - 527 518 /* 528 519 * Are we booted from a PROM Of-type client-interface ? 529 520 */ ··· 531 540 mr r29,r9 532 541 #endif 533 542 543 + /* Get TOC pointer (current runtime address) */ 544 + bl relative_toc 545 + 534 546 #ifdef CONFIG_PPC_BOOK3E_64 535 547 bl start_initialization_book3e 536 548 #else 537 549 bl start_initialization_book3s 538 550 #endif /* CONFIG_PPC_BOOK3E_64 */ 551 + 552 + /* Get TOC pointer */ 553 + bl relative_toc 554 + 555 + /* find out where we are now */ 556 + bcl 20,31,$+4 557 + 0: mflr r26 /* r26 = runtime addr here */ 558 + addis r26,r26,(_stext - 0b)@ha 559 + addi r26,r26,(_stext - 0b)@l /* current runtime base addr */ 560 + 539 561 b __after_prom_start 540 562 541 563 __REF 542 564 __boot_from_prom: 543 565 #ifdef CONFIG_PPC_OF_BOOT_TRAMPOLINE 566 + /* Get TOC pointer */ 567 + bl relative_toc 568 + 569 + /* find out where we are now */ 570 + bcl 20,31,$+4 571 + 0: mflr r26 /* r26 = runtime addr here */ 572 + addis r26,r26,(_stext - 0b)@ha 573 + addi r26,r26,(_stext - 0b)@l /* current runtime base addr */ 574 + 544 575 /* Save parameters */ 545 576 mr r31,r3 546 577 mr r30,r4