Lines Matching refs:afu
7 int ocxl_context_alloc(struct ocxl_context **context, struct ocxl_afu *afu, in ocxl_context_alloc() argument
17 ctx->afu = afu; in ocxl_context_alloc()
18 mutex_lock(&afu->contexts_lock); in ocxl_context_alloc()
19 pasid = idr_alloc(&afu->contexts_idr, ctx, afu->pasid_base, in ocxl_context_alloc()
20 afu->pasid_base + afu->pasid_max, GFP_KERNEL); in ocxl_context_alloc()
22 mutex_unlock(&afu->contexts_lock); in ocxl_context_alloc()
26 afu->pasid_count++; in ocxl_context_alloc()
27 mutex_unlock(&afu->contexts_lock); in ocxl_context_alloc()
44 ocxl_afu_get(afu); in ocxl_context_alloc()
85 dev = to_pci_dev(ctx->afu->fn->dev.parent); in ocxl_context_attach()
86 rc = ocxl_link_add_pe(ctx->afu->fn->link, ctx->pasid, pidr, ctx->tidr, in ocxl_context_attach()
118 if (offset >= ctx->afu->config.pp_mmio_stride) in map_pp_mmio()
129 pasid_off = ctx->pasid - ctx->afu->pasid_base; in map_pp_mmio()
130 pp_mmio_addr = ctx->afu->pp_mmio_start + in map_pp_mmio()
131 pasid_off * ctx->afu->config.pp_mmio_stride + in map_pp_mmio()
150 if (offset < ctx->afu->irq_base_offset) in ocxl_mmap_fault()
191 (ctx->afu->config.pp_mmio_stride >> PAGE_SHIFT)) in check_mmap_mmio()
200 if ((vma->vm_pgoff << PAGE_SHIFT) < ctx->afu->irq_base_offset) in ocxl_context_mmap()
227 dev = to_pci_dev(ctx->afu->fn->dev.parent); in ocxl_context_detach()
228 afu_control_pos = ctx->afu->config.dvsec_afu_control_pos; in ocxl_context_detach()
230 mutex_lock(&ctx->afu->afu_control_lock); in ocxl_context_detach()
232 mutex_unlock(&ctx->afu->afu_control_lock); in ocxl_context_detach()
251 rc = ocxl_link_remove_pe(ctx->afu->fn->link, ctx->pasid); in ocxl_context_detach()
260 void ocxl_context_detach_all(struct ocxl_afu *afu) in ocxl_context_detach_all() argument
265 mutex_lock(&afu->contexts_lock); in ocxl_context_detach_all()
266 idr_for_each_entry(&afu->contexts_idr, ctx, tmp) { in ocxl_context_detach_all()
280 mutex_unlock(&afu->contexts_lock); in ocxl_context_detach_all()
285 mutex_lock(&ctx->afu->contexts_lock); in ocxl_context_free()
286 ctx->afu->pasid_count--; in ocxl_context_free()
287 idr_remove(&ctx->afu->contexts_idr, ctx->pasid); in ocxl_context_free()
288 mutex_unlock(&ctx->afu->contexts_lock); in ocxl_context_free()
293 ocxl_afu_put(ctx->afu); in ocxl_context_free()