Skip to content

Commit 4622a2d

Browse files
chleroympe
authored andcommitted
powerpc/6xx: fix setup and use of SPRN_SPRG_PGDIR for hash32
Not only the 603 but all 6xx need SPRN_SPRG_PGDIR to be initialised at startup. This patch move it from __setup_cpu_603() to start_here() and __secondary_start(), close to the initialisation of SPRN_THREAD. Previously, virt addr of PGDIR was retrieved from thread struct. Now that it is the phys addr which is stored in SPRN_SPRG_PGDIR, hash_page() shall not convert it to phys anymore. This patch removes the conversion. Fixes: 93c4a16 ("powerpc/6xx: Store PGDIR physical address in a SPRG") Reported-by: Guenter Roeck <linux@roeck-us.net> Tested-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
1 parent b5b4453 commit 4622a2d

File tree

3 files changed

+10
-7
lines changed

3 files changed

+10
-7
lines changed

arch/powerpc/kernel/cpu_setup_6xx.S

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,6 @@ BEGIN_MMU_FTR_SECTION
2424
li r10,0
2525
mtspr SPRN_SPRG_603_LRU,r10 /* init SW LRU tracking */
2626
END_MMU_FTR_SECTION_IFSET(MMU_FTR_NEED_DTLB_SW_LRU)
27-
lis r10, (swapper_pg_dir - PAGE_OFFSET)@h
28-
ori r10, r10, (swapper_pg_dir - PAGE_OFFSET)@l
29-
mtspr SPRN_SPRG_PGDIR, r10
3027

3128
BEGIN_FTR_SECTION
3229
bl __init_fpu_registers

arch/powerpc/kernel/head_32.S

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -855,6 +855,9 @@ __secondary_start:
855855
li r3,0
856856
stw r3, RTAS_SP(r4) /* 0 => not in RTAS */
857857
#endif
858+
lis r4, (swapper_pg_dir - PAGE_OFFSET)@h
859+
ori r4, r4, (swapper_pg_dir - PAGE_OFFSET)@l
860+
mtspr SPRN_SPRG_PGDIR, r4
858861

859862
/* enable MMU and jump to start_secondary */
860863
li r4,MSR_KERNEL
@@ -942,6 +945,9 @@ start_here:
942945
li r3,0
943946
stw r3, RTAS_SP(r4) /* 0 => not in RTAS */
944947
#endif
948+
lis r4, (swapper_pg_dir - PAGE_OFFSET)@h
949+
ori r4, r4, (swapper_pg_dir - PAGE_OFFSET)@l
950+
mtspr SPRN_SPRG_PGDIR, r4
945951

946952
/* stack */
947953
lis r1,init_thread_union@ha

arch/powerpc/mm/hash_low_32.S

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,12 +70,12 @@ _GLOBAL(hash_page)
7070
lis r0,KERNELBASE@h /* check if kernel address */
7171
cmplw 0,r4,r0
7272
ori r3,r3,_PAGE_USER|_PAGE_PRESENT /* test low addresses as user */
73-
mfspr r5, SPRN_SPRG_PGDIR /* virt page-table root */
73+
mfspr r5, SPRN_SPRG_PGDIR /* phys page-table root */
7474
blt+ 112f /* assume user more likely */
75-
lis r5,swapper_pg_dir@ha /* if kernel address, use */
76-
addi r5,r5,swapper_pg_dir@l /* kernel page table */
75+
lis r5, (swapper_pg_dir - PAGE_OFFSET)@ha /* if kernel address, use */
76+
addi r5 ,r5 ,(swapper_pg_dir - PAGE_OFFSET)@l /* kernel page table */
7777
rlwimi r3,r9,32-12,29,29 /* MSR_PR -> _PAGE_USER */
78-
112: tophys(r5, r5)
78+
112:
7979
#ifndef CONFIG_PTE_64BIT
8080
rlwimi r5,r4,12,20,29 /* insert top 10 bits of address */
8181
lwz r8,0(r5) /* get pmd entry */

0 commit comments

Comments
 (0)