[PATCH] cxl: Ensure PSL interrupt is configured for contexts with no AFU IRQs

Frederic Barrat fbarrat at linux.vnet.ibm.com
Thu May 5 00:26:09 AEST 2016


Hi Ian,


> diff --git a/drivers/misc/cxl/guest.c b/drivers/misc/cxl/guest.c
> index c0cdf3c..04f6dff 100644
> --- a/drivers/misc/cxl/guest.c
> +++ b/drivers/misc/cxl/guest.c
> @@ -552,6 +552,17 @@ static int attach_afu_directed(struct cxl_context *ctx, u64 wed, u64 amr)
>
>   	elem->common.sstp0  = cpu_to_be64(ctx->sstp0);
>   	elem->common.sstp1  = cpu_to_be64(ctx->sstp1);
> +
> +	/*
> +	 * Ensure we have at least one interrupt allocated to take faults for
> +	 * kernel contexts that may not have allocated any AFU IRQs at all:
> +	 */
> +	if (ctx->irqs.range[0] == 0) {
> +		rc = afu_register_irqs(ctx, 0);
> +		if (rc)
> +			goto out_free;
> +	}
> +

I believe there's a potential problem there for powerVM guest.
In afu_allocate_irqs(), the allocation of the bitmap for the AFU 
interrupts should return NULL (since count = 0). Therefore we'll skip 
the allocation for the irq names. Yet we need one for the PSL interrupt. 
I'm not too sure of what the effect of calling cxl_map_irq with a NULL 
name is (later, in afu_register_hwirqs), but it's likely not very good.
That is admittedly a latent pb introduced by the powerVM patch, only 
revealed here.
Of course, this is highly theoretical. pHyp only supports cxlflash, so 
count is not supposed to be null. Still...

Other than that, the patch looks good to me.

   Fred



More information about the Linuxppc-dev mailing list