cxl: Adapter failure handling
Check the AFU state whenever an API is called. The hypervisor may issue a reset of the adapter when it detects a fault. When it happens, it launches an error recovery which will either move the AFU to a permanent failure state, or in the disabled state. If the AFU is found to be disabled, detach all existing contexts from it before issuing a AFU reset to re-enable it. Before detaching contexts, notify any kernel driver through the EEH callbacks of the AFU pci device. Co-authored-by: Frederic Barrat <fbarrat@linux.vnet.ibm.com> Signed-off-by: Frederic Barrat <fbarrat@linux.vnet.ibm.com> Signed-off-by: Christophe Lombard <clombard@linux.vnet.ibm.com> Reviewed-by: Manoj Kumar <manoj@linux.vnet.ibm.com> Acked-by: Ian Munsie <imunsie@au1.ibm.com> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
This commit is contained in:

committed by
Michael Ellerman

parent
d601ea918b
commit
0d400f77c1
@@ -76,7 +76,7 @@ static int __afu_open(struct inode *inode, struct file *file, bool master)
|
||||
if (!afu->current_mode)
|
||||
goto err_put_afu;
|
||||
|
||||
if (!cxl_ops->link_ok(adapter)) {
|
||||
if (!cxl_ops->link_ok(adapter, afu)) {
|
||||
rc = -EIO;
|
||||
goto err_put_afu;
|
||||
}
|
||||
@@ -257,7 +257,7 @@ long afu_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
|
||||
if (ctx->status == CLOSED)
|
||||
return -EIO;
|
||||
|
||||
if (!cxl_ops->link_ok(ctx->afu->adapter))
|
||||
if (!cxl_ops->link_ok(ctx->afu->adapter, ctx->afu))
|
||||
return -EIO;
|
||||
|
||||
pr_devel("afu_ioctl\n");
|
||||
@@ -287,7 +287,7 @@ int afu_mmap(struct file *file, struct vm_area_struct *vm)
|
||||
if (ctx->status != STARTED)
|
||||
return -EIO;
|
||||
|
||||
if (!cxl_ops->link_ok(ctx->afu->adapter))
|
||||
if (!cxl_ops->link_ok(ctx->afu->adapter, ctx->afu))
|
||||
return -EIO;
|
||||
|
||||
return cxl_context_iomap(ctx, vm);
|
||||
@@ -334,7 +334,7 @@ ssize_t afu_read(struct file *file, char __user *buf, size_t count,
|
||||
int rc;
|
||||
DEFINE_WAIT(wait);
|
||||
|
||||
if (!cxl_ops->link_ok(ctx->afu->adapter))
|
||||
if (!cxl_ops->link_ok(ctx->afu->adapter, ctx->afu))
|
||||
return -EIO;
|
||||
|
||||
if (count < CXL_READ_MIN_SIZE)
|
||||
@@ -347,7 +347,7 @@ ssize_t afu_read(struct file *file, char __user *buf, size_t count,
|
||||
if (ctx_event_pending(ctx))
|
||||
break;
|
||||
|
||||
if (!cxl_ops->link_ok(ctx->afu->adapter)) {
|
||||
if (!cxl_ops->link_ok(ctx->afu->adapter, ctx->afu)) {
|
||||
rc = -EIO;
|
||||
goto out;
|
||||
}
|
||||
|
Reference in New Issue
Block a user