return (__force u64)ctx->irqs[irq].vtrig;
}
+/**
+ * ocxlflash_xsl_fault() - callback when translation error is triggered
+ * @data: Private data provided at callback registration, the context.
+ * @addr: Address that triggered the error.
+ * @dsisr: Value of dsisr register.
+ */
+static void ocxlflash_xsl_fault(void *data, u64 addr, u64 dsisr)
+{
+ struct ocxlflash_context *ctx = data;
+
+ spin_lock(&ctx->slock);
+ ctx->fault_addr = addr;
+ ctx->fault_dsisr = dsisr;
+ ctx->pending_fault = true;
+ spin_unlock(&ctx->slock);
+
+ wake_up_all(&ctx->wq);
+}
+
/**
* start_context() - local routine to start a context
* @ctx: Adapter context to be started.
mm = current->mm;
}
- rc = ocxl_link_add_pe(link_token, ctx->pe, pid, 0, 0, mm, NULL, NULL);
+ rc = ocxl_link_add_pe(link_token, ctx->pe, pid, 0, 0, mm,
+ ocxlflash_xsl_fault, ctx);
if (unlikely(rc)) {
dev_err(dev, "%s: ocxl_link_add_pe failed rc=%d\n",
__func__, rc);
ctx->hw_afu = afu;
ctx->irq_bitmap = 0;
ctx->pending_irq = false;
+ ctx->pending_fault = false;
out:
return ctx;
err2:
*/
static inline bool ctx_event_pending(struct ocxlflash_context *ctx)
{
- if (ctx->pending_irq)
+ if (ctx->pending_irq || ctx->pending_fault)
return true;
return false;
event.irq.irq = bit + 1;
if (bitmap_empty(&ctx->irq_bitmap, ctx->num_irqs))
ctx->pending_irq = false;
+ } else if (ctx->pending_fault) {
+ event.header.size += sizeof(struct cxl_event_data_storage);
+ event.header.type = CXL_EVENT_DATA_STORAGE;
+ event.fault.addr = ctx->fault_addr;
+ event.fault.dsisr = ctx->fault_dsisr;
+ ctx->pending_fault = false;
}
spin_unlock_irqrestore(&ctx->slock, lock_flags);