Lines Matching +full:irqs +full:- +full:reserved
1 // SPDX-License-Identifier: GPL-2.0-or-later
13 #include <misc/cxl-base.h>
27 ctx->dsisr = dsisr; in schedule_cxl_fault()
28 ctx->dar = dar; in schedule_cxl_fault()
29 schedule_work(&ctx->fault_work); in schedule_cxl_fault()
37 dsisr = irq_info->dsisr; in cxl_irq_psl9()
38 dar = irq_info->dar; in cxl_irq_psl9()
42 pr_devel("CXL interrupt %i for afu pe: %i DSISR: %#llx DAR: %#llx\n", irq, ctx->pe, dsisr, dar); in cxl_irq_psl9()
45 pr_devel("CXL interrupt: Scheduling translation fault handling for later (pe: %i)\n", ctx->pe); in cxl_irq_psl9()
50 return cxl_ops->handle_psl_slice_error(ctx, dsisr, in cxl_irq_psl9()
51 irq_info->errstat); in cxl_irq_psl9()
53 pr_devel("CXL interrupt: AFU Error 0x%016llx\n", irq_info->afu_err); in cxl_irq_psl9()
55 if (ctx->pending_afu_err) { in cxl_irq_psl9()
57 * This shouldn't happen - the PSL treats these errors in cxl_irq_psl9()
63 dev_err_ratelimited(&ctx->afu->dev, "CXL AFU Error undelivered to pe %i: 0x%016llx\n", in cxl_irq_psl9()
64 ctx->pe, irq_info->afu_err); in cxl_irq_psl9()
66 spin_lock(&ctx->lock); in cxl_irq_psl9()
67 ctx->afu_err = irq_info->afu_err; in cxl_irq_psl9()
68 ctx->pending_afu_err = 1; in cxl_irq_psl9()
69 spin_unlock(&ctx->lock); in cxl_irq_psl9()
71 wake_up_all(&ctx->wq); in cxl_irq_psl9()
74 cxl_ops->ack_irq(ctx, CXL_PSL_TFC_An_A, 0); in cxl_irq_psl9()
88 dsisr = irq_info->dsisr; in cxl_irq_psl8()
89 dar = irq_info->dar; in cxl_irq_psl8()
93 pr_devel("CXL interrupt %i for afu pe: %i DSISR: %#llx DAR: %#llx\n", irq, ctx->pe, dsisr, dar); in cxl_irq_psl8()
106 pr_devel("Scheduling segment miss handling for later pe: %i\n", ctx->pe); in cxl_irq_psl8()
127 pr_devel("Scheduling page fault handling for later pe: %i\n", ctx->pe); in cxl_irq_psl8()
135 return cxl_ops->handle_psl_slice_error(ctx, dsisr, in cxl_irq_psl8()
136 irq_info->errstat); in cxl_irq_psl8()
138 pr_devel("CXL interrupt: AFU Error 0x%016llx\n", irq_info->afu_err); in cxl_irq_psl8()
140 if (ctx->pending_afu_err) { in cxl_irq_psl8()
142 * This shouldn't happen - the PSL treats these errors in cxl_irq_psl8()
148 dev_err_ratelimited(&ctx->afu->dev, "CXL AFU Error " in cxl_irq_psl8()
150 ctx->pe, irq_info->afu_err); in cxl_irq_psl8()
152 spin_lock(&ctx->lock); in cxl_irq_psl8()
153 ctx->afu_err = irq_info->afu_err; in cxl_irq_psl8()
154 ctx->pending_afu_err = true; in cxl_irq_psl8()
155 spin_unlock(&ctx->lock); in cxl_irq_psl8()
157 wake_up_all(&ctx->wq); in cxl_irq_psl8()
160 cxl_ops->ack_irq(ctx, CXL_PSL_TFC_An_A, 0); in cxl_irq_psl8()
180 * On bare-metal, we know range 0 only contains the PSL in cxl_irq_afu()
187 * For code-readability, it just seems easier to go over all in cxl_irq_afu()
188 * the ranges on bare-metal and guest. The end result is the same. in cxl_irq_afu()
191 irq_off = hwirq - ctx->irqs.offset[r]; in cxl_irq_afu()
192 range = ctx->irqs.range[r]; in cxl_irq_afu()
201 ctx->pe, irq, hwirq); in cxl_irq_afu()
207 afu_irq, ctx->pe, irq, hwirq); in cxl_irq_afu()
209 if (unlikely(!ctx->irq_bitmap)) { in cxl_irq_afu()
213 spin_lock(&ctx->lock); in cxl_irq_afu()
214 set_bit(afu_irq - 1, ctx->irq_bitmap); in cxl_irq_afu()
215 ctx->pending_irq = true; in cxl_irq_afu()
216 spin_unlock(&ctx->lock); in cxl_irq_afu()
218 wake_up_all(&ctx->wq); in cxl_irq_afu()
232 dev_warn(&adapter->dev, "cxl_map_irq: irq_create_mapping failed\n"); in cxl_map_irq()
236 if (cxl_ops->setup_irq) in cxl_map_irq()
237 cxl_ops->setup_irq(adapter, hwirq, virq); in cxl_map_irq()
243 dev_warn(&adapter->dev, "cxl_map_irq: request_irq failed: %i\n", result); in cxl_map_irq()
264 if ((hwirq = cxl_ops->alloc_one_irq(adapter)) < 0) in cxl_register_one_irq()
276 cxl_ops->release_one_irq(adapter, hwirq); in cxl_register_one_irq()
277 return -ENOMEM; in cxl_register_one_irq()
284 list_for_each_entry_safe(irq_name, tmp, &ctx->irq_names, list) { in afu_irq_name_free()
285 kfree(irq_name->name); in afu_irq_name_free()
286 list_del(&irq_name->list); in afu_irq_name_free()
298 * In native mode, range 0 is reserved for the multiplexed in afu_allocate_irqs()
301 * In a guest, the PSL interrupt is not mutliplexed, but per-context, in afu_allocate_irqs()
310 if ((rc = cxl_ops->alloc_irq_ranges(&ctx->irqs, ctx->afu->adapter, in afu_allocate_irqs()
316 ctx->irqs.offset[0] = ctx->afu->native->psl_hwirq; in afu_allocate_irqs()
317 ctx->irqs.range[0] = 1; in afu_allocate_irqs()
320 ctx->irq_count = count; in afu_allocate_irqs()
321 ctx->irq_bitmap = kcalloc(BITS_TO_LONGS(count), in afu_allocate_irqs()
322 sizeof(*ctx->irq_bitmap), GFP_KERNEL); in afu_allocate_irqs()
323 if (!ctx->irq_bitmap) in afu_allocate_irqs()
328 * actual hardware IRQs. in afu_allocate_irqs()
331 for (i = 0; i < ctx->irqs.range[r]; i++) { in afu_allocate_irqs()
336 irq_name->name = kasprintf(GFP_KERNEL, "cxl-%s-pe%i-%i", in afu_allocate_irqs()
337 dev_name(&ctx->afu->dev), in afu_allocate_irqs()
338 ctx->pe, j); in afu_allocate_irqs()
339 if (!irq_name->name) { in afu_allocate_irqs()
344 list_add_tail(&irq_name->list, &ctx->irq_names); in afu_allocate_irqs()
351 cxl_ops->release_irq_ranges(&ctx->irqs, ctx->afu->adapter); in afu_allocate_irqs()
353 return -ENOMEM; in afu_allocate_irqs()
364 irq_name = list_first_entry(&ctx->irq_names, struct cxl_irq_name, list); in afu_register_hwirqs()
366 hwirq = ctx->irqs.offset[r]; in afu_register_hwirqs()
367 for (i = 0; i < ctx->irqs.range[r]; hwirq++, i++) { in afu_register_hwirqs()
375 * On bare-metal, the PSL interrupt is in afu_register_hwirqs()
379 handler = cxl_ops->psl_interrupt; in afu_register_hwirqs()
382 cxl_map_irq(ctx->afu->adapter, hwirq, handler, ctx, in afu_register_hwirqs()
383 irq_name->name); in afu_register_hwirqs()
408 hwirq = ctx->irqs.offset[r]; in afu_release_irqs()
409 for (i = 0; i < ctx->irqs.range[r]; hwirq++, i++) { in afu_release_irqs()
417 cxl_ops->release_irq_ranges(&ctx->irqs, ctx->afu->adapter); in afu_release_irqs()
419 ctx->irq_count = 0; in afu_release_irqs()
424 dev_crit(&afu->dev, in cxl_afu_decode_psl_serr()
426 dev_crit(&afu->dev, "PSL_SERR_An: 0x%016llx\n", serr); in cxl_afu_decode_psl_serr()
428 dev_crit(&afu->dev, "AFU MMIO Timeout\n"); in cxl_afu_decode_psl_serr()
430 dev_crit(&afu->dev, in cxl_afu_decode_psl_serr()
433 dev_crit(&afu->dev, "AFU CTAG Overflow\n"); in cxl_afu_decode_psl_serr()
435 dev_crit(&afu->dev, "Bad Interrupt Source\n"); in cxl_afu_decode_psl_serr()
437 dev_crit(&afu->dev, "Bad Context Handle\n"); in cxl_afu_decode_psl_serr()
439 dev_crit(&afu->dev, "LLCMD to Disabled AFU\n"); in cxl_afu_decode_psl_serr()
441 dev_crit(&afu->dev, "LLCMD Timeout to AFU\n"); in cxl_afu_decode_psl_serr()
443 dev_crit(&afu->dev, "AFU MMIO Parity Error\n"); in cxl_afu_decode_psl_serr()
445 dev_crit(&afu->dev, "AFU MMIO Duplicate CTAG Error\n"); in cxl_afu_decode_psl_serr()
447 dev_crit(&afu->dev, in cxl_afu_decode_psl_serr()