diff mbox

xive: Use for_each_available_cpu()

Message ID 1482989214.13332.7.camel@kernel.crashing.org
State Superseded
Headers show

Commit Message

Benjamin Herrenschmidt Dec. 29, 2016, 5:26 a.m. UTC
Don't use for_each_cpu() otherwise we try to access CPUs
that haven't been enabled by cronus/hostboot and nasty
errors ensure.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
---
 hw/xive.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Comments

Benjamin Herrenschmidt Dec. 29, 2016, 9:51 a.m. UTC | #1
On Thu, 2016-12-29 at 16:26 +1100, Benjamin Herrenschmidt wrote:
> Don't use for_each_cpu() otherwise we try to access CPUs
> that haven't been enabled by cronus/hostboot and nasty
> errors ensure.

Ignore, that won't work... cooking a better one. CPU aren't "available"
until they are called in and that is called before that.


> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
> ---
>  hw/xive.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/hw/xive.c b/hw/xive.c
> index b5f2af8..29d9f76 100644
> --- a/hw/xive.c
> +++ b/hw/xive.c
> @@ -3629,7 +3629,7 @@ static void xive_reset_one(struct xive *x)
>  	}
>  
>  	/* Take out all VPs from HW and reset all CPPRs to 0 */
> -	for_each_cpu(c) {
> +	for_each_available_cpu(c) {
>  		if (c->chip_id != x->chip_id)
>  			continue;
>  		if (!c->xstate)
> @@ -3672,7 +3672,7 @@ static void xive_reset_one(struct xive *x)
>  #endif
>  
>  	/* Re-configure the CPUs */
> -	for_each_cpu(c) {
> +	for_each_available_cpu(c) {
>  		struct xive_cpu_state *xs = c->xstate;
>  
>  		if (c->chip_id != x->chip_id || !xs)
> @@ -4004,11 +4004,11 @@ void init_xive(void)
>  	}
>  
>  	/* Initialize XICS emulation per-cpu structures */
> -	for_each_cpu(cpu) {
> +	for_each_available_cpu(cpu) {
>  		xive_init_cpu(cpu);
>  	}
>  	/* Add interrupts propertie to each CPU node */
> -	for_each_cpu(cpu) {
> +	for_each_available_cpu(cpu) {
>  		if (cpu_is_thread0(cpu))
>  			xive_init_cpu_properties(cpu);
>  	}
diff mbox

Patch

diff --git a/hw/xive.c b/hw/xive.c
index b5f2af8..29d9f76 100644
--- a/hw/xive.c
+++ b/hw/xive.c
@@ -3629,7 +3629,7 @@  static void xive_reset_one(struct xive *x)
 	}
 
 	/* Take out all VPs from HW and reset all CPPRs to 0 */
-	for_each_cpu(c) {
+	for_each_available_cpu(c) {
 		if (c->chip_id != x->chip_id)
 			continue;
 		if (!c->xstate)
@@ -3672,7 +3672,7 @@  static void xive_reset_one(struct xive *x)
 #endif
 
 	/* Re-configure the CPUs */
-	for_each_cpu(c) {
+	for_each_available_cpu(c) {
 		struct xive_cpu_state *xs = c->xstate;
 
 		if (c->chip_id != x->chip_id || !xs)
@@ -4004,11 +4004,11 @@  void init_xive(void)
 	}
 
 	/* Initialize XICS emulation per-cpu structures */
-	for_each_cpu(cpu) {
+	for_each_available_cpu(cpu) {
 		xive_init_cpu(cpu);
 	}
 	/* Add interrupts propertie to each CPU node */
-	for_each_cpu(cpu) {
+	for_each_available_cpu(cpu) {
 		if (cpu_is_thread0(cpu))
 			xive_init_cpu_properties(cpu);
 	}