int cxl_allocate_afu_irqs(struct cxl_context *ctx, int num) { int res; irq_hw_number_t hwirq; if (num == 0) num = ctx->afu->pp_irqs; res = afu_allocate_irqs(ctx, num); if (res) return res; if (!cpu_has_feature(CPU_FTR_HVMODE)) { /* In a guest, the PSL interrupt is not multiplexed. It was * allocated above, and we need to set its handler */ hwirq = cxl_find_afu_irq(ctx, 0); if (hwirq) cxl_map_irq(ctx->afu->adapter, hwirq, cxl_ops->psl_interrupt, ctx, "psl"); } if (ctx->status == STARTED) { if (cxl_ops->update_ivtes) cxl_ops->update_ivtes(ctx); else WARN(1, "BUG: cxl_allocate_afu_irqs must be called prior to starting the context on this platform\n"); } return res; }
void cxl_unmap_afu_irq(struct cxl_context *ctx, int num, void *cookie) { irq_hw_number_t hwirq; unsigned int virq; hwirq = cxl_find_afu_irq(ctx, num); if (!hwirq) return; virq = irq_find_mapping(NULL, hwirq); if (virq) cxl_unmap_irq(virq, cookie); }
int cxl_map_afu_irq(struct cxl_context *ctx, int num, irq_handler_t handler, void *cookie, char *name) { irq_hw_number_t hwirq; /* * Find interrupt we are to register. */ hwirq = cxl_find_afu_irq(ctx, num); if (!hwirq) return -ENOENT; return cxl_map_irq(ctx->afu->adapter, hwirq, handler, cookie, name); }
void cxl_free_afu_irqs(struct cxl_context *ctx) { irq_hw_number_t hwirq; unsigned int virq; if (!cpu_has_feature(CPU_FTR_HVMODE)) { hwirq = cxl_find_afu_irq(ctx, 0); if (hwirq) { virq = irq_find_mapping(NULL, hwirq); if (virq) cxl_unmap_irq(virq, ctx); } } afu_irq_name_free(ctx); cxl_ops->release_irq_ranges(&ctx->irqs, ctx->afu->adapter); }