All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 1/2] powerpc32/booke: consistently return phys_addr_t in __pa()
@ 2019-12-30  7:26 ` yingjie_bai
  0 siblings, 0 replies; 4+ messages in thread
From: yingjie_bai @ 2019-12-30  7:26 UTC (permalink / raw)
  To: Scott Wood, Kumar Gala
  Cc: Bai Yingjie, Benjamin Herrenschmidt, Paul Mackerras,
	Michael Ellerman, Christophe Leroy, Aneesh Kumar K.V,
	Diana Craciun, Jason Yan, Nicolas Saenz Julienne,
	Nicholas Piggin, Thomas Gleixner, Allison Randal,
	Greg Kroah-Hartman, linuxppc-dev, linux-kernel

From: Bai Yingjie <byj.tea@gmail.com>

When CONFIG_RELOCATABLE=y is set, VIRT_PHYS_OFFSET is a 64bit variable,
thus __pa() returns as 64bit value.
But when CONFIG_RELOCATABLE=n, __pa() returns 32bit value.

We'd make __pa() consistently return phys_addr_t, even if the upper bits
are known to always be zero in a particular config.

Signed-off-by: Bai Yingjie <byj.tea@gmail.com>
---
 arch/powerpc/include/asm/page.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/powerpc/include/asm/page.h b/arch/powerpc/include/asm/page.h
index 7f1fd41e3065..86332080399a 100644
--- a/arch/powerpc/include/asm/page.h
+++ b/arch/powerpc/include/asm/page.h
@@ -209,7 +209,7 @@ static inline bool pfn_valid(unsigned long pfn)
  */
 #if defined(CONFIG_PPC32) && defined(CONFIG_BOOKE)
 #define __va(x) ((void *)(unsigned long)((phys_addr_t)(x) + VIRT_PHYS_OFFSET))
-#define __pa(x) ((unsigned long)(x) - VIRT_PHYS_OFFSET)
+#define __pa(x) ((phys_addr_t)(unsigned long)(x) - VIRT_PHYS_OFFSET)
 #else
 #ifdef CONFIG_PPC64
 /*
-- 
2.17.1


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

* [PATCH v2 1/2] powerpc32/booke: consistently return phys_addr_t in __pa()
@ 2019-12-30  7:26 ` yingjie_bai
  0 siblings, 0 replies; 4+ messages in thread
From: yingjie_bai @ 2019-12-30  7:26 UTC (permalink / raw)
  To: Scott Wood, Kumar Gala
  Cc: Jason Yan, Aneesh Kumar K.V, Greg Kroah-Hartman, Nicholas Piggin,
	linux-kernel, Diana Craciun, Paul Mackerras, Allison Randal,
	Bai Yingjie, Thomas Gleixner, linuxppc-dev,
	Nicolas Saenz Julienne

From: Bai Yingjie <byj.tea@gmail.com>

When CONFIG_RELOCATABLE=y is set, VIRT_PHYS_OFFSET is a 64bit variable,
thus __pa() returns as 64bit value.
But when CONFIG_RELOCATABLE=n, __pa() returns 32bit value.

We'd make __pa() consistently return phys_addr_t, even if the upper bits
are known to always be zero in a particular config.

Signed-off-by: Bai Yingjie <byj.tea@gmail.com>
---
 arch/powerpc/include/asm/page.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/powerpc/include/asm/page.h b/arch/powerpc/include/asm/page.h
index 7f1fd41e3065..86332080399a 100644
--- a/arch/powerpc/include/asm/page.h
+++ b/arch/powerpc/include/asm/page.h
@@ -209,7 +209,7 @@ static inline bool pfn_valid(unsigned long pfn)
  */
 #if defined(CONFIG_PPC32) && defined(CONFIG_BOOKE)
 #define __va(x) ((void *)(unsigned long)((phys_addr_t)(x) + VIRT_PHYS_OFFSET))
-#define __pa(x) ((unsigned long)(x) - VIRT_PHYS_OFFSET)
+#define __pa(x) ((phys_addr_t)(unsigned long)(x) - VIRT_PHYS_OFFSET)
 #else
 #ifdef CONFIG_PPC64
 /*
-- 
2.17.1


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

* [PATCH v2 2/2] powerpc/mpc85xx: also write addr_h to spin table for 64bit boot entry
  2019-12-30  7:26 ` yingjie_bai
@ 2019-12-30  7:26   ` yingjie_bai
  -1 siblings, 0 replies; 4+ messages in thread
From: yingjie_bai @ 2019-12-30  7:26 UTC (permalink / raw)
  To: Scott Wood, Kumar Gala
  Cc: Bai Yingjie, Benjamin Herrenschmidt, Paul Mackerras,
	Michael Ellerman, Christophe Leroy, Aneesh Kumar K.V, Jason Yan,
	Thomas Gleixner, Nicholas Piggin, Nicolas Saenz Julienne,
	Allison Randal, Greg Kroah-Hartman, linuxppc-dev, linux-kernel

From: Bai Yingjie <byj.tea@gmail.com>

CPU like P4080 has 36bit physical address, its DDR physical
start address can be configured above 4G by LAW registers.

For such systems in which their physical memory start address was
configured higher than 4G, we need also to write addr_h into the spin
table of the target secondary CPU, so that addr_h and addr_l together
represent a 64bit physical address.
Otherwise the secondary core can not get correct entry to start from.

This should do no harm for normal case where addr_h is all 0.

Signed-off-by: Bai Yingjie <byj.tea@gmail.com>
---
 arch/powerpc/platforms/85xx/smp.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/arch/powerpc/platforms/85xx/smp.c b/arch/powerpc/platforms/85xx/smp.c
index 8c7ea2486bc0..e241516ae013 100644
--- a/arch/powerpc/platforms/85xx/smp.c
+++ b/arch/powerpc/platforms/85xx/smp.c
@@ -252,6 +252,13 @@ static int smp_85xx_start_cpu(int cpu)
 	out_be64((u64 *)(&spin_table->addr_h),
 		__pa(ppc_function_entry(generic_secondary_smp_init)));
 #else
+	/*
+	 * We need also to write addr_h to spin table for systems
+	 * in which their physical memory start address was configured
+	 * to above 4G, otherwise the secondary core can not get
+	 * correct entry to start from.
+	 */
+	out_be32(&spin_table->addr_h, __pa(__early_start) >> 32);
 	out_be32(&spin_table->addr_l, __pa(__early_start));
 #endif
 	flush_spin_table(spin_table);
-- 
2.17.1


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

* [PATCH v2 2/2] powerpc/mpc85xx: also write addr_h to spin table for 64bit boot entry
@ 2019-12-30  7:26   ` yingjie_bai
  0 siblings, 0 replies; 4+ messages in thread
From: yingjie_bai @ 2019-12-30  7:26 UTC (permalink / raw)
  To: Scott Wood, Kumar Gala
  Cc: Jason Yan, Aneesh Kumar K.V, Greg Kroah-Hartman, Nicholas Piggin,
	linux-kernel, Paul Mackerras, Allison Randal, Bai Yingjie,
	Thomas Gleixner, linuxppc-dev, Nicolas Saenz Julienne

From: Bai Yingjie <byj.tea@gmail.com>

CPU like P4080 has 36bit physical address, its DDR physical
start address can be configured above 4G by LAW registers.

For such systems in which their physical memory start address was
configured higher than 4G, we need also to write addr_h into the spin
table of the target secondary CPU, so that addr_h and addr_l together
represent a 64bit physical address.
Otherwise the secondary core can not get correct entry to start from.

This should do no harm for normal case where addr_h is all 0.

Signed-off-by: Bai Yingjie <byj.tea@gmail.com>
---
 arch/powerpc/platforms/85xx/smp.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/arch/powerpc/platforms/85xx/smp.c b/arch/powerpc/platforms/85xx/smp.c
index 8c7ea2486bc0..e241516ae013 100644
--- a/arch/powerpc/platforms/85xx/smp.c
+++ b/arch/powerpc/platforms/85xx/smp.c
@@ -252,6 +252,13 @@ static int smp_85xx_start_cpu(int cpu)
 	out_be64((u64 *)(&spin_table->addr_h),
 		__pa(ppc_function_entry(generic_secondary_smp_init)));
 #else
+	/*
+	 * We need also to write addr_h to spin table for systems
+	 * in which their physical memory start address was configured
+	 * to above 4G, otherwise the secondary core can not get
+	 * correct entry to start from.
+	 */
+	out_be32(&spin_table->addr_h, __pa(__early_start) >> 32);
 	out_be32(&spin_table->addr_l, __pa(__early_start));
 #endif
 	flush_spin_table(spin_table);
-- 
2.17.1


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

end of thread, other threads:[~2019-12-30  8:05 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-30  7:26 [PATCH v2 1/2] powerpc32/booke: consistently return phys_addr_t in __pa() yingjie_bai
2019-12-30  7:26 ` yingjie_bai
2019-12-30  7:26 ` [PATCH v2 2/2] powerpc/mpc85xx: also write addr_h to spin table for 64bit boot entry yingjie_bai
2019-12-30  7:26   ` yingjie_bai

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.