[PATCH v3 08/18] cxl: IRQ allocation for guests

Ian Munsie imunsie at au1.ibm.com
Wed Feb 10 18:23:57 AEDT 2016


Acked-by: Ian Munsie <imunsie at au1.ibm.com>

> +    /*
> +     * Look for the interrupt number.
> +     * On bare-metal, we know the range 0 only contains the PSL
> +     * interrupt so, we could start counting at range 1 and initialize
> +     * afu_irq at 1.
> +     * In a guest, range 0 also contains AFU interrupts, so it must
> +     * be counted for, but we initialize afu_irq at 0 to take into
> +     * account the PSL interrupt.
> +     *
> +     * For code-readability, it just seems easier to go over all
> +     * the ranges.
> +     */

Thanks for adding that explanation :)

> +    if (cpu_has_feature(CPU_FTR_HVMODE))
> +        alloc_count = count;
> +    else
> +        alloc_count = count + 1;

Almost a shame you can't reuse the afu_irq_range_start function you
defined for this, but doing so would probably make the code less
readable, so fine to leave this as is.

>      /* We've allocated all memory now, so let's do the irq allocations */
>      irq_name = list_first_entry(&ctx->irq_names, struct cxl_irq_name, list);
> -    for (r = 1; r < CXL_IRQ_RANGES; r++) {
> +    for (r = afu_irq_range_start(); r < CXL_IRQ_RANGES; r++) {
>          hwirq = ctx->irqs.offset[r];
>          for (i = 0; i < ctx->irqs.range[r]; hwirq++, i++) {
> -            cxl_map_irq(ctx->afu->adapter, hwirq,
> -                    cxl_irq_afu, ctx, irq_name->name);
> +            if (r == 0 && i == 0)
> +                /* PSL interrupt, only for guest */

That comment is perhaps not as clear as it could be - the interrupt is
used on either, but it's only allocated per context on PowerVM guests.

Cheers,
-Ian



More information about the Linuxppc-dev mailing list