Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4622a2d4 authored by Christophe Leroy's avatar Christophe Leroy Committed by Michael Ellerman
Browse files

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: 93c4a162 ("powerpc/6xx: Store PGDIR physical address in a SPRG")
Reported-by: default avatarGuenter Roeck <linux@roeck-us.net>
Tested-by: default avatarGuenter Roeck <linux@roeck-us.net>
Signed-off-by: default avatarChristophe Leroy <christophe.leroy@c-s.fr>
Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
parent b5b4453e
Loading
Loading
Loading
Loading
+0 −3
Original line number Diff line number Diff line
@@ -24,9 +24,6 @@ BEGIN_MMU_FTR_SECTION
	li	r10,0
	mtspr	SPRN_SPRG_603_LRU,r10		/* init SW LRU tracking */
END_MMU_FTR_SECTION_IFSET(MMU_FTR_NEED_DTLB_SW_LRU)
	lis	r10, (swapper_pg_dir - PAGE_OFFSET)@h
	ori	r10, r10, (swapper_pg_dir - PAGE_OFFSET)@l
	mtspr	SPRN_SPRG_PGDIR, r10

BEGIN_FTR_SECTION
	bl	__init_fpu_registers
+6 −0
Original line number Diff line number Diff line
@@ -855,6 +855,9 @@ __secondary_start:
	li	r3,0
	stw	r3, RTAS_SP(r4)		/* 0 => not in RTAS */
#endif
	lis	r4, (swapper_pg_dir - PAGE_OFFSET)@h
	ori	r4, r4, (swapper_pg_dir - PAGE_OFFSET)@l
	mtspr	SPRN_SPRG_PGDIR, r4

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

	/* stack */
	lis	r1,init_thread_union@ha
+4 −4
Original line number Diff line number Diff line
@@ -70,12 +70,12 @@ _GLOBAL(hash_page)
	lis	r0,KERNELBASE@h		/* check if kernel address */
	cmplw	0,r4,r0
	ori	r3,r3,_PAGE_USER|_PAGE_PRESENT /* test low addresses as user */
	mfspr	r5, SPRN_SPRG_PGDIR	/* virt page-table root */
	mfspr	r5, SPRN_SPRG_PGDIR	/* phys page-table root */
	blt+	112f			/* assume user more likely */
	lis	r5,swapper_pg_dir@ha	/* if kernel address, use */
	addi	r5,r5,swapper_pg_dir@l	/* kernel page table */
	lis	r5, (swapper_pg_dir - PAGE_OFFSET)@ha	/* if kernel address, use */
	addi	r5 ,r5 ,(swapper_pg_dir - PAGE_OFFSET)@l	/* kernel page table */
	rlwimi	r3,r9,32-12,29,29	/* MSR_PR -> _PAGE_USER */
112:	tophys(r5, r5)
112:
#ifndef CONFIG_PTE_64BIT
	rlwimi	r5,r4,12,20,29		/* insert top 10 bits of address */
	lwz	r8,0(r5)		/* get pmd entry */