ppc/8xxx: Add is_core_disabled to remove disabled cores from dtb
PATCH 1/1 ppc/8xxx: Add is_core_disabled to remove disabled cores from dtb
If we explicitly disabled a core remove it from the dtb we pass on to the kernel.
--- arch/powerpc/cpu/mpc85xx/mp.c | 25 +++++++++++++++++++++++++ arch/powerpc/cpu/mpc86xx/mp.c | 19 +++++++++++++++++++ arch/powerpc/cpu/mpc8xxx/fdt.c | 3 ++- arch/powerpc/include/asm/mp.h | 3 ++- 4 files changed, 48 insertions(+), 2 deletions(-)
arch/powerpc/cpu/mpc85xx/mp.c +25 -0
@@ -77,6 +77,13 @@ int cpu_disable(int nr) return 0; } + +int is_core_disabled (int nr) { +volatile ccsr_gur_t *gur = (void *)(CONFIG_SYS_MPC85xx_GUTS_ADDR); +u32 coredisrl =in_be32 (&gur->coredisrl); + +return (coredisrl & (1 << nr)); +}#else int cpu_disable (int nr) {
@@ -96,6 +103,24 @@ int cpu_disable(int nr)return 0 ; } + +int is_core_disabled (int nr) { +volatile ccsr_gur_t *gur = (void *)(CONFIG_SYS_MPC85xx_GUTS_ADDR); +u32 devdisr =in_be32 (&gur->devdisr); + +switch (nr) { +case 0 : +return (devdisr & MPC85xx_DEVDISR_CPU0); +break ; +case 1 : +return (devdisr & MPC85xx_DEVDISR_CPU1); +break ; +default : +printf ("Invalid cpu number for disable %d\n" , nr); + } + +return 0 ; +}#endif static u8 boot_entry_map[4 ] = {
arch/powerpc/cpu/mpc86xx/mp.c +19 -0
@@ -66,6 +66,25 @@ int cpu_disable(int nr)return 0 ; } +int is_core_disabled (int nr) { +volatile immap_t *immap = (immap_t *)CONFIG_SYS_CCSRBAR ; +volatile ccsr_gur_t *gur = &immap->im_gur; +u32 devdisr =in_be32 (&gur->devdisr); + +switch (nr) { +case 0 : +return (devdisr & MPC86xx_DEVDISR_CPU0); +break ; +case 1 : +return (devdisr & MPC86xx_DEVDISR_CPU1); +break ; +default : +printf ("Invalid cpu number for disable %d\n" , nr); + } + +return 0 ; +} +int cpu_release (int nr,int argc,char *argv[]) {/* dummy function so common/cmd_mp.c will build
arch/powerpc/cpu/mpc8xxx/fdt.c +2 -1
@@ -26,6 +26,7 @@#include <common.h> #include <libfdt.h> #include <fdt_support.h> +#include <asm/mp.h> #if defined(CONFIG_MPC85xx) || defined(CONFIG_MPC86xx)static int ft_del_cpuhandle (void *blob,int cpuhandle)
@@ -57,7 +58,7 @@ void ft_fixup_num_cores(void *blob) {while (off != -FDT_ERR_NOTFOUND ) {u32 *reg = (u32 *)fdt_getprop (blob, off,"reg" ,0 ); -if (*reg > num_cores-1 ) { +if ((*reg > num_cores-1 ) || (is_core_disabled (*reg))) {int ph =fdt_get_phandle (blob, off);/* Delete the cpu node once there are no cpu handles */
arch/powerpc/include/asm/mp.h +2 -1
@@ -1,5 +1,5 @@/* -* Copyright 2009 Freescale Semiconductor, Inc. +* Copyright 2009-2010 Freescale Semiconductor, Inc. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as
@@ -26,5 +26,6 @@void setup_mp (void );void cpu_mp_lmb_reserve (struct lmb *lmb);u32 determine_mp_bootpg (void ); +int is_core_disabled (int nr);#endif
Signature · 1 line
1.6.0.6
PATCH 1/1 ppc/8xxx: Add is_core_disabled to remove disabled cores from dtb
Quoted 3 lines · Kumar Gala
+int
is_core_disabled(int nr){
+ ? ? ? volatileccsr_gur_t*gur = (void *)(CONFIG_SYS_MPC85xx_GUTS_ADDR);
+ ? ? ? u32 coredisrl =in_be32(&gur->coredisrl);
You don't need to declare the variable as volatile if you use an I/O accessor.
Quoted 3 lines
+int
is_core_disabled(int nr){
+ ? ? ? volatileccsr_gur_t*gur = (void *)(CONFIG_SYS_MPC85xx_GUTS_ADDR);
+ ? ? ? u32 devdisr =in_be32(&gur->devdisr);
Same thing here.
Quoted 8 lines
+
+ ? ? ? switch (nr) {
+ ? ? ? case 0:
+ ? ? ? ? ? ? ? return (devdisr &MPC85xx_DEVDISR_CPU0);
+ ? ? ? ? ? ? ? break;
+ ? ? ? case 1:
+ ? ? ? ? ? ? ? return (devdisr &MPC85xx_DEVDISR_CPU1);
+ ? ? ? ? ? ? ? break;
And you don't need a 'break' after a 'return' in a switch-case statement. You also don't need parentheses around the expression in the 'return' statement.
Signature · 2 lines
Timur Tabi Linux kernel developer at Freescale
PATCH 1/1 ppc/8xxx: Add is_core_disabled to remove disabled cores from dtb
Quoted 6 lines · Timur Tabi
arch/powerpc/cpu/mpc85xx/mp.c int cpu_disable(int nr) · line 83
Quoted 3 lines · Kumar Gala
arch/powerpc/cpu/mpc85xx/mp.c +3
-0+int is_core_disabled (int nr) { +volatile ccsr_gur_t *gur = (void *)(CONFIG_SYS_MPC85xx_GUTS_ADDR); +u32 coredisrl =in_be32 (&gur->coredisrl);
Quoted 7 lines
You don't need to declare the variable as volatile if you use an I/O accessor.
arch/powerpc/cpu/mpc85xx/mp.c int cpu_disable(int nr) · line 109
Quoted 3 lines
arch/powerpc/cpu/mpc85xx/mp.c +3
-0+int is_core_disabled (int nr) { +volatile ccsr_gur_t *gur = (void *)(CONFIG_SYS_MPC85xx_GUTS_ADDR); +u32 devdisr =in_be32 (&gur->devdisr);Same thing here.
will fix.
Quoted 9 lines
arch/powerpc/cpu/mpc85xx/mp.c int cpu_disable(int nr) · line 117
Quoted 8 lines
arch/powerpc/cpu/mpc85xx/mp.c +8
-0+ +switch (nr) { +case 0 : +return (devdisr & MPC85xx_DEVDISR_CPU0); +break ; +case 1 : +return (devdisr & MPC85xx_DEVDISR_CPU1); +break ;
Quoted 3 lines
And you don't need a 'break' after a 'return' in a switch-case statement. You also don't need parentheses around the expression in the 'return' statement.
Going to leave the parens for readability, will drop the break's.
- k
PATCH v2 1/1 powerpc/8xxx: Add is_core_disabled to remove disabled cores from dtb
In reply to Kumar GalaIf we explicitly disabled a core remove it from the dtb we pass on to the kernel.
---
* Fix issues reported by Timur
arch/powerpc/cpu/mpc85xx/mp.c | 23 +++++++++++++++++++++++ arch/powerpc/cpu/mpc86xx/mp.c | 17 +++++++++++++++++ arch/powerpc/cpu/mpc8xxx/fdt.c | 3 ++- arch/powerpc/include/asm/mp.h | 3 ++- 4 files changed, 44 insertions(+), 2 deletions(-)
arch/powerpc/cpu/mpc85xx/mp.c +23 -0
@@ -77,6 +77,13 @@ int cpu_disable(int nr) return 0; } + +int is_core_disabled (int nr) { +ccsr_gur_t *gur = (void *)(CONFIG_SYS_MPC85xx_GUTS_ADDR); +u32 coredisrl =in_be32 (&gur->coredisrl); + +return (coredisrl & (1 << nr)); +}#else int cpu_disable (int nr) {
@@ -96,6 +103,22 @@ int cpu_disable(int nr)return 0 ; } + +int is_core_disabled (int nr) { +ccsr_gur_t *gur = (void *)(CONFIG_SYS_MPC85xx_GUTS_ADDR); +u32 devdisr =in_be32 (&gur->devdisr); + +switch (nr) { +case 0 : +return (devdisr & MPC85xx_DEVDISR_CPU0); +case 1 : +return (devdisr & MPC85xx_DEVDISR_CPU1); +default : +printf ("Invalid cpu number for disable %d\n" , nr); + } + +return 0 ; +}#endif static u8 boot_entry_map[4 ] = {
arch/powerpc/cpu/mpc86xx/mp.c +17 -0
@@ -66,6 +66,23 @@ int cpu_disable(int nr)return 0 ; } +int is_core_disabled (int nr) { +immap_t *immap = (immap_t *)CONFIG_SYS_CCSRBAR ; +ccsr_gur_t *gur = &immap->im_gur; +u32 devdisr =in_be32 (&gur->devdisr); + +switch (nr) { +case 0 : +return (devdisr & MPC86xx_DEVDISR_CPU0); +case 1 : +return (devdisr & MPC86xx_DEVDISR_CPU1); +default : +printf ("Invalid cpu number for disable %d\n" , nr); + } + +return 0 ; +} +int cpu_release (int nr,int argc,char *argv[]) {/* dummy function so common/cmd_mp.c will build
arch/powerpc/cpu/mpc8xxx/fdt.c +2 -1
@@ -26,6 +26,7 @@#include <common.h> #include <libfdt.h> #include <fdt_support.h> +#include <asm/mp.h> #if defined(CONFIG_MPC85xx) || defined(CONFIG_MPC86xx)static int ft_del_cpuhandle (void *blob,int cpuhandle)
@@ -57,7 +58,7 @@ void ft_fixup_num_cores(void *blob) {while (off != -FDT_ERR_NOTFOUND ) {u32 *reg = (u32 *)fdt_getprop (blob, off,"reg" ,0 ); -if (*reg > num_cores-1 ) { +if ((*reg > num_cores-1 ) || (is_core_disabled (*reg))) {int ph =fdt_get_phandle (blob, off);/* Delete the cpu node once there are no cpu handles */
arch/powerpc/include/asm/mp.h +2 -1
@@ -1,5 +1,5 @@/* -* Copyright 2009 Freescale Semiconductor, Inc. +* Copyright 2009-2010 Freescale Semiconductor, Inc. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as
@@ -26,5 +26,6 @@void setup_mp (void );void cpu_mp_lmb_reserve (struct lmb *lmb);u32 determine_mp_bootpg (void ); +int is_core_disabled (int nr);#endif
Signature · 1 line
1.6.0.6
Kumar Gala
AppliedPATCH v2 1/1 powerpc/8xxx: Add is_core_disabled to remove disabled cores from dtb
Quoted 4 lines · Kumar Gala
If we explicitly disabled a core remove it from the dtb we pass on to the kernel.
Signed-off-by Kumar Gala <[email protected]>
Quoted 8 lines
---
* Fix issues reported by Timurarch/powerpc/cpu/mpc85xx/mp.c | 23 +++++++++++++++++++++++ arch/powerpc/cpu/mpc86xx/mp.c | 17 +++++++++++++++++ arch/powerpc/cpu/mpc8xxx/fdt.c | 3 ++- arch/powerpc/include/asm/mp.h | 3 ++- 4 files changed, 44 insertions(+), 2 deletions(-)
applied to 85xx
- k