[Skiboot] [PATCH] xive: Use for_each_available_cpu()

Benjamin Herrenschmidt benh at au1.ibm.com
Thu Dec 29 20:51:38 AEDT 2016


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 at 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);
>  	}



More information about the Skiboot mailing list