Lines Matching +full:irqs +full:- +full:reserved

1 // SPDX-License-Identifier: GPL-2.0-or-later
14 #include <misc/cxl-base.h>
28 ctx->dsisr = dsisr; in schedule_cxl_fault()
29 ctx->dar = dar; in schedule_cxl_fault()
30 schedule_work(&ctx->fault_work); in schedule_cxl_fault()
38 dsisr = irq_info->dsisr; in cxl_irq_psl9()
39 dar = irq_info->dar; in cxl_irq_psl9()
43 pr_devel("CXL interrupt %i for afu pe: %i DSISR: %#llx DAR: %#llx\n", irq, ctx->pe, dsisr, dar); in cxl_irq_psl9()
46 pr_devel("CXL interrupt: Scheduling translation fault handling for later (pe: %i)\n", ctx->pe); in cxl_irq_psl9()
51 return cxl_ops->handle_psl_slice_error(ctx, dsisr, in cxl_irq_psl9()
52 irq_info->errstat); in cxl_irq_psl9()
54 pr_devel("CXL interrupt: AFU Error 0x%016llx\n", irq_info->afu_err); in cxl_irq_psl9()
56 if (ctx->pending_afu_err) { in cxl_irq_psl9()
58 * This shouldn't happen - the PSL treats these errors in cxl_irq_psl9()
64 dev_err_ratelimited(&ctx->afu->dev, "CXL AFU Error undelivered to pe %i: 0x%016llx\n", in cxl_irq_psl9()
65 ctx->pe, irq_info->afu_err); in cxl_irq_psl9()
67 spin_lock(&ctx->lock); in cxl_irq_psl9()
68 ctx->afu_err = irq_info->afu_err; in cxl_irq_psl9()
69 ctx->pending_afu_err = 1; in cxl_irq_psl9()
70 spin_unlock(&ctx->lock); in cxl_irq_psl9()
72 wake_up_all(&ctx->wq); in cxl_irq_psl9()
75 cxl_ops->ack_irq(ctx, CXL_PSL_TFC_An_A, 0); in cxl_irq_psl9()
89 dsisr = irq_info->dsisr; in cxl_irq_psl8()
90 dar = irq_info->dar; in cxl_irq_psl8()
94 pr_devel("CXL interrupt %i for afu pe: %i DSISR: %#llx DAR: %#llx\n", irq, ctx->pe, dsisr, dar); in cxl_irq_psl8()
107 pr_devel("Scheduling segment miss handling for later pe: %i\n", ctx->pe); in cxl_irq_psl8()
128 pr_devel("Scheduling page fault handling for later pe: %i\n", ctx->pe); in cxl_irq_psl8()
136 return cxl_ops->handle_psl_slice_error(ctx, dsisr, in cxl_irq_psl8()
137 irq_info->errstat); in cxl_irq_psl8()
139 pr_devel("CXL interrupt: AFU Error 0x%016llx\n", irq_info->afu_err); in cxl_irq_psl8()
141 if (ctx->pending_afu_err) { in cxl_irq_psl8()
143 * This shouldn't happen - the PSL treats these errors in cxl_irq_psl8()
149 dev_err_ratelimited(&ctx->afu->dev, "CXL AFU Error " in cxl_irq_psl8()
151 ctx->pe, irq_info->afu_err); in cxl_irq_psl8()
153 spin_lock(&ctx->lock); in cxl_irq_psl8()
154 ctx->afu_err = irq_info->afu_err; in cxl_irq_psl8()
155 ctx->pending_afu_err = true; in cxl_irq_psl8()
156 spin_unlock(&ctx->lock); in cxl_irq_psl8()
158 wake_up_all(&ctx->wq); in cxl_irq_psl8()
161 cxl_ops->ack_irq(ctx, CXL_PSL_TFC_An_A, 0); in cxl_irq_psl8()
181 * On bare-metal, we know range 0 only contains the PSL in cxl_irq_afu()
188 * For code-readability, it just seems easier to go over all in cxl_irq_afu()
189 * the ranges on bare-metal and guest. The end result is the same. in cxl_irq_afu()
192 irq_off = hwirq - ctx->irqs.offset[r]; in cxl_irq_afu()
193 range = ctx->irqs.range[r]; in cxl_irq_afu()
202 ctx->pe, irq, hwirq); in cxl_irq_afu()
208 afu_irq, ctx->pe, irq, hwirq); in cxl_irq_afu()
210 if (unlikely(!ctx->irq_bitmap)) { in cxl_irq_afu()
214 spin_lock(&ctx->lock); in cxl_irq_afu()
215 set_bit(afu_irq - 1, ctx->irq_bitmap); in cxl_irq_afu()
216 ctx->pending_irq = true; in cxl_irq_afu()
217 spin_unlock(&ctx->lock); in cxl_irq_afu()
219 wake_up_all(&ctx->wq); in cxl_irq_afu()
233 dev_warn(&adapter->dev, "cxl_map_irq: irq_create_mapping failed\n"); in cxl_map_irq()
237 if (cxl_ops->setup_irq) in cxl_map_irq()
238 cxl_ops->setup_irq(adapter, hwirq, virq); in cxl_map_irq()
244 dev_warn(&adapter->dev, "cxl_map_irq: request_irq failed: %i\n", result); in cxl_map_irq()
265 if ((hwirq = cxl_ops->alloc_one_irq(adapter)) < 0) in cxl_register_one_irq()
277 cxl_ops->release_one_irq(adapter, hwirq); in cxl_register_one_irq()
278 return -ENOMEM; in cxl_register_one_irq()
285 list_for_each_entry_safe(irq_name, tmp, &ctx->irq_names, list) { in afu_irq_name_free()
286 kfree(irq_name->name); in afu_irq_name_free()
287 list_del(&irq_name->list); in afu_irq_name_free()
299 * In native mode, range 0 is reserved for the multiplexed in afu_allocate_irqs()
302 * In a guest, the PSL interrupt is not mutliplexed, but per-context, in afu_allocate_irqs()
311 if ((rc = cxl_ops->alloc_irq_ranges(&ctx->irqs, ctx->afu->adapter, in afu_allocate_irqs()
317 ctx->irqs.offset[0] = ctx->afu->native->psl_hwirq; in afu_allocate_irqs()
318 ctx->irqs.range[0] = 1; in afu_allocate_irqs()
321 ctx->irq_count = count; in afu_allocate_irqs()
322 ctx->irq_bitmap = bitmap_zalloc(count, 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()
352 bitmap_free(ctx->irq_bitmap); in afu_allocate_irqs()
354 return -ENOMEM; in afu_allocate_irqs()
365 irq_name = list_first_entry(&ctx->irq_names, struct cxl_irq_name, list); in afu_register_hwirqs()
367 hwirq = ctx->irqs.offset[r]; in afu_register_hwirqs()
368 for (i = 0; i < ctx->irqs.range[r]; hwirq++, i++) { in afu_register_hwirqs()
376 * On bare-metal, the PSL interrupt is in afu_register_hwirqs()
380 handler = cxl_ops->psl_interrupt; in afu_register_hwirqs()
383 cxl_map_irq(ctx->afu->adapter, hwirq, handler, ctx, in afu_register_hwirqs()
384 irq_name->name); in afu_register_hwirqs()
409 hwirq = ctx->irqs.offset[r]; in afu_release_irqs()
410 for (i = 0; i < ctx->irqs.range[r]; hwirq++, i++) { in afu_release_irqs()
418 cxl_ops->release_irq_ranges(&ctx->irqs, ctx->afu->adapter); in afu_release_irqs()
420 ctx->irq_count = 0; in afu_release_irqs()
425 dev_crit(&afu->dev, in cxl_afu_decode_psl_serr()
427 dev_crit(&afu->dev, "PSL_SERR_An: 0x%016llx\n", serr); in cxl_afu_decode_psl_serr()
429 dev_crit(&afu->dev, "AFU MMIO Timeout\n"); in cxl_afu_decode_psl_serr()
431 dev_crit(&afu->dev, in cxl_afu_decode_psl_serr()
434 dev_crit(&afu->dev, "AFU CTAG Overflow\n"); in cxl_afu_decode_psl_serr()
436 dev_crit(&afu->dev, "Bad Interrupt Source\n"); in cxl_afu_decode_psl_serr()
438 dev_crit(&afu->dev, "Bad Context Handle\n"); in cxl_afu_decode_psl_serr()
440 dev_crit(&afu->dev, "LLCMD to Disabled AFU\n"); in cxl_afu_decode_psl_serr()
442 dev_crit(&afu->dev, "LLCMD Timeout to AFU\n"); in cxl_afu_decode_psl_serr()
444 dev_crit(&afu->dev, "AFU MMIO Parity Error\n"); in cxl_afu_decode_psl_serr()
446 dev_crit(&afu->dev, "AFU MMIO Duplicate CTAG Error\n"); in cxl_afu_decode_psl_serr()
448 dev_crit(&afu->dev, in cxl_afu_decode_psl_serr()