linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] powerpc/6xx: fix setup and use of SPRN_PGDIR for hash32
@ 2019-03-08  7:05 Christophe Leroy
  2019-03-08 16:03 ` Segher Boessenkool
  0 siblings, 1 reply; 6+ messages in thread
From: Christophe Leroy @ 2019-03-08  7:05 UTC (permalink / raw)
  To: Benjamin Herrenschmidt, Paul Mackerras, Michael Ellerman, Guenter Roeck
  Cc: linux-kernel, linuxppc-dev

Not only the 603 but all 6xx need SPRN_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_PGDIR,
hash_page() shall not convert it to phys anymore.
This patch removes the conversion.

Fixes: 93c4a162b014("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>
---
 arch/powerpc/kernel/cpu_setup_6xx.S | 3 ---
 arch/powerpc/kernel/head_32.S       | 6 ++++++
 arch/powerpc/mm/hash_low_32.S       | 8 ++++----
 3 files changed, 10 insertions(+), 7 deletions(-)

diff --git a/arch/powerpc/kernel/cpu_setup_6xx.S b/arch/powerpc/kernel/cpu_setup_6xx.S
index 6f1c11e0691f..7534ecff5e92 100644
--- a/arch/powerpc/kernel/cpu_setup_6xx.S
+++ b/arch/powerpc/kernel/cpu_setup_6xx.S
@@ -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
diff --git a/arch/powerpc/kernel/head_32.S b/arch/powerpc/kernel/head_32.S
index ce6a972f2584..48051c8977c5 100644
--- a/arch/powerpc/kernel/head_32.S
+++ b/arch/powerpc/kernel/head_32.S
@@ -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
diff --git a/arch/powerpc/mm/hash_low_32.S b/arch/powerpc/mm/hash_low_32.S
index 1f13494efb2b..a6c491f18a04 100644
--- a/arch/powerpc/mm/hash_low_32.S
+++ b/arch/powerpc/mm/hash_low_32.S
@@ -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 */
-- 
2.13.3


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] powerpc/6xx: fix setup and use of SPRN_PGDIR for hash32
  2019-03-08  7:05 [PATCH] powerpc/6xx: fix setup and use of SPRN_PGDIR for hash32 Christophe Leroy
@ 2019-03-08 16:03 ` Segher Boessenkool
  2019-03-08 16:06   ` Christophe Leroy
  0 siblings, 1 reply; 6+ messages in thread
From: Segher Boessenkool @ 2019-03-08 16:03 UTC (permalink / raw)
  To: Christophe Leroy
  Cc: Benjamin Herrenschmidt, Paul Mackerras, Michael Ellerman,
	Guenter Roeck, linuxppc-dev, linux-kernel

On Fri, Mar 08, 2019 at 07:05:22AM +0000, Christophe Leroy wrote:
> Not only the 603 but all 6xx need SPRN_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.

I thought you meant an SPR I did not know about.  But you just misspelled
SPRN_SPRG_PGDIR :-)


Segher

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] powerpc/6xx: fix setup and use of SPRN_PGDIR for hash32
  2019-03-08 16:03 ` Segher Boessenkool
@ 2019-03-08 16:06   ` Christophe Leroy
  2019-03-15 13:20     ` Christophe Leroy
  0 siblings, 1 reply; 6+ messages in thread
From: Christophe Leroy @ 2019-03-08 16:06 UTC (permalink / raw)
  To: Segher Boessenkool, Michael Ellerman
  Cc: Benjamin Herrenschmidt, Paul Mackerras, Guenter Roeck,
	linuxppc-dev, linux-kernel



Le 08/03/2019 à 17:03, Segher Boessenkool a écrit :
> On Fri, Mar 08, 2019 at 07:05:22AM +0000, Christophe Leroy wrote:
>> Not only the 603 but all 6xx need SPRN_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.
> 
> I thought you meant an SPR I did not know about.  But you just misspelled
> SPRN_SPRG_PGDIR :-)
> 

Oops.

Michael, can you fix the commit text (and subject) when applying ?

Thanks
Christophe

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] powerpc/6xx: fix setup and use of SPRN_PGDIR for hash32
  2019-03-08 16:06   ` Christophe Leroy
@ 2019-03-15 13:20     ` Christophe Leroy
  2019-03-16 22:47       ` Guenter Roeck
  0 siblings, 1 reply; 6+ messages in thread
From: Christophe Leroy @ 2019-03-15 13:20 UTC (permalink / raw)
  To: Michael Ellerman
  Cc: Paul Mackerras, linuxppc-dev, Guenter Roeck, linux-kernel

Michael,

Are you able to get this merged before 5.1-rc1 comes out ?

Thanks
Christophe

Le 08/03/2019 à 17:06, Christophe Leroy a écrit :
> 
> 
> Le 08/03/2019 à 17:03, Segher Boessenkool a écrit :
>> On Fri, Mar 08, 2019 at 07:05:22AM +0000, Christophe Leroy wrote:
>>> Not only the 603 but all 6xx need SPRN_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.
>>
>> I thought you meant an SPR I did not know about.  But you just misspelled
>> SPRN_SPRG_PGDIR :-)
>>
> 
> Oops.
> 
> Michael, can you fix the commit text (and subject) when applying ?
> 



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] powerpc/6xx: fix setup and use of SPRN_PGDIR for hash32
  2019-03-15 13:20     ` Christophe Leroy
@ 2019-03-16 22:47       ` Guenter Roeck
  2019-03-18  9:54         ` Michael Ellerman
  0 siblings, 1 reply; 6+ messages in thread
From: Guenter Roeck @ 2019-03-16 22:47 UTC (permalink / raw)
  To: Christophe Leroy, Michael Ellerman
  Cc: Paul Mackerras, linuxppc-dev, linux-kernel

On 3/15/19 6:20 AM, Christophe Leroy wrote:
> Michael,
> 
> Are you able to get this merged before 5.1-rc1 comes out ?
> 

Looks like this patch got lost. I don't see it in Michael's most recent
pull request, the one that got merged today.

Guenter

> Thanks
> Christophe
> 
> Le 08/03/2019 à 17:06, Christophe Leroy a écrit :
>>
>>
>> Le 08/03/2019 à 17:03, Segher Boessenkool a écrit :
>>> On Fri, Mar 08, 2019 at 07:05:22AM +0000, Christophe Leroy wrote:
>>>> Not only the 603 but all 6xx need SPRN_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.
>>>
>>> I thought you meant an SPR I did not know about.  But you just misspelled
>>> SPRN_SPRG_PGDIR :-)
>>>
>>
>> Oops.
>>
>> Michael, can you fix the commit text (and subject) when applying ?
>>
> 
> 
> 


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] powerpc/6xx: fix setup and use of SPRN_PGDIR for hash32
  2019-03-16 22:47       ` Guenter Roeck
@ 2019-03-18  9:54         ` Michael Ellerman
  0 siblings, 0 replies; 6+ messages in thread
From: Michael Ellerman @ 2019-03-18  9:54 UTC (permalink / raw)
  To: Guenter Roeck, Christophe Leroy
  Cc: Paul Mackerras, linuxppc-dev, linux-kernel

Guenter Roeck <linux@roeck-us.net> writes:
> On 3/15/19 6:20 AM, Christophe Leroy wrote:
>> Michael,
>> 
>> Are you able to get this merged before 5.1-rc1 comes out ?
>
> Looks like this patch got lost. I don't see it in Michael's most recent
> pull request, the one that got merged today.

Sorry, will pick it up for fixes now.

cheers

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2019-03-18  9:55 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-08  7:05 [PATCH] powerpc/6xx: fix setup and use of SPRN_PGDIR for hash32 Christophe Leroy
2019-03-08 16:03 ` Segher Boessenkool
2019-03-08 16:06   ` Christophe Leroy
2019-03-15 13:20     ` Christophe Leroy
2019-03-16 22:47       ` Guenter Roeck
2019-03-18  9:54         ` Michael Ellerman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).