diff options
Diffstat (limited to 'drivers/misc/cxl/native.c')
-rw-r--r-- | drivers/misc/cxl/native.c | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/drivers/misc/cxl/native.c b/drivers/misc/cxl/native.c index 9a5a442269a8..f2b37b41a0da 100644 --- a/drivers/misc/cxl/native.c +++ b/drivers/misc/cxl/native.c | |||
@@ -277,6 +277,7 @@ static int do_process_element_cmd(struct cxl_context *ctx, | |||
277 | u64 cmd, u64 pe_state) | 277 | u64 cmd, u64 pe_state) |
278 | { | 278 | { |
279 | u64 state; | 279 | u64 state; |
280 | unsigned long timeout = jiffies + (HZ * CXL_TIMEOUT); | ||
280 | 281 | ||
281 | WARN_ON(!ctx->afu->enabled); | 282 | WARN_ON(!ctx->afu->enabled); |
282 | 283 | ||
@@ -286,6 +287,10 @@ static int do_process_element_cmd(struct cxl_context *ctx, | |||
286 | smp_mb(); | 287 | smp_mb(); |
287 | cxl_p1n_write(ctx->afu, CXL_PSL_LLCMD_An, cmd | ctx->pe); | 288 | cxl_p1n_write(ctx->afu, CXL_PSL_LLCMD_An, cmd | ctx->pe); |
288 | while (1) { | 289 | while (1) { |
290 | if (time_after_eq(jiffies, timeout)) { | ||
291 | dev_warn(&ctx->afu->dev, "WARNING: Process Element Command timed out!\n"); | ||
292 | return -EBUSY; | ||
293 | } | ||
289 | state = be64_to_cpup(ctx->afu->sw_command_status); | 294 | state = be64_to_cpup(ctx->afu->sw_command_status); |
290 | if (state == ~0ULL) { | 295 | if (state == ~0ULL) { |
291 | pr_err("cxl: Error adding process element to AFU\n"); | 296 | pr_err("cxl: Error adding process element to AFU\n"); |
@@ -610,13 +615,6 @@ static inline int detach_process_native_dedicated(struct cxl_context *ctx) | |||
610 | return 0; | 615 | return 0; |
611 | } | 616 | } |
612 | 617 | ||
613 | /* | ||
614 | * TODO: handle case when this is called inside a rcu_read_lock() which may | ||
615 | * happen when we unbind the driver (ie. cxl_context_detach_all()) . Terminate | ||
616 | * & remove use a mutex lock and schedule which will not good with lock held. | ||
617 | * May need to write do_process_element_cmd() that handles outstanding page | ||
618 | * faults synchronously. | ||
619 | */ | ||
620 | static inline int detach_process_native_afu_directed(struct cxl_context *ctx) | 618 | static inline int detach_process_native_afu_directed(struct cxl_context *ctx) |
621 | { | 619 | { |
622 | if (!ctx->pe_inserted) | 620 | if (!ctx->pe_inserted) |