aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/misc/cxl/file.c
diff options
context:
space:
mode:
authorChristophe Lombard <clombard@linux.vnet.ibm.com>2016-03-04 06:26:41 -0500
committerMichael Ellerman <mpe@ellerman.id.au>2016-03-09 07:40:00 -0500
commit0d400f77c19e8d2606f8194846bcf18ebdc9df2a (patch)
tree307436d00d93f55e2aa27d2233c91346c14e8961 /drivers/misc/cxl/file.c
parentd601ea918b878582e60b773f2f943d8d292b2abf (diff)
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>
Diffstat (limited to 'drivers/misc/cxl/file.c')
-rw-r--r--drivers/misc/cxl/file.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/drivers/misc/cxl/file.c b/drivers/misc/cxl/file.c
index e16046292dd6..eec468f1612f 100644
--- a/drivers/misc/cxl/file.c
+++ b/drivers/misc/cxl/file.c
@@ -76,7 +76,7 @@ static int __afu_open(struct inode *inode, struct file *file, bool master)
76 if (!afu->current_mode) 76 if (!afu->current_mode)
77 goto err_put_afu; 77 goto err_put_afu;
78 78
79 if (!cxl_ops->link_ok(adapter)) { 79 if (!cxl_ops->link_ok(adapter, afu)) {
80 rc = -EIO; 80 rc = -EIO;
81 goto err_put_afu; 81 goto err_put_afu;
82 } 82 }
@@ -257,7 +257,7 @@ long afu_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
257 if (ctx->status == CLOSED) 257 if (ctx->status == CLOSED)
258 return -EIO; 258 return -EIO;
259 259
260 if (!cxl_ops->link_ok(ctx->afu->adapter)) 260 if (!cxl_ops->link_ok(ctx->afu->adapter, ctx->afu))
261 return -EIO; 261 return -EIO;
262 262
263 pr_devel("afu_ioctl\n"); 263 pr_devel("afu_ioctl\n");
@@ -287,7 +287,7 @@ int afu_mmap(struct file *file, struct vm_area_struct *vm)
287 if (ctx->status != STARTED) 287 if (ctx->status != STARTED)
288 return -EIO; 288 return -EIO;
289 289
290 if (!cxl_ops->link_ok(ctx->afu->adapter)) 290 if (!cxl_ops->link_ok(ctx->afu->adapter, ctx->afu))
291 return -EIO; 291 return -EIO;
292 292
293 return cxl_context_iomap(ctx, vm); 293 return cxl_context_iomap(ctx, vm);
@@ -334,7 +334,7 @@ ssize_t afu_read(struct file *file, char __user *buf, size_t count,
334 int rc; 334 int rc;
335 DEFINE_WAIT(wait); 335 DEFINE_WAIT(wait);
336 336
337 if (!cxl_ops->link_ok(ctx->afu->adapter)) 337 if (!cxl_ops->link_ok(ctx->afu->adapter, ctx->afu))
338 return -EIO; 338 return -EIO;
339 339
340 if (count < CXL_READ_MIN_SIZE) 340 if (count < CXL_READ_MIN_SIZE)
@@ -347,7 +347,7 @@ ssize_t afu_read(struct file *file, char __user *buf, size_t count,
347 if (ctx_event_pending(ctx)) 347 if (ctx_event_pending(ctx))
348 break; 348 break;
349 349
350 if (!cxl_ops->link_ok(ctx->afu->adapter)) { 350 if (!cxl_ops->link_ok(ctx->afu->adapter, ctx->afu)) {
351 rc = -EIO; 351 rc = -EIO;
352 goto out; 352 goto out;
353 } 353 }