Skip to content

Commit

Permalink
xdma: explicitly stop engine on transfer completion
Browse files Browse the repository at this point in the history
When used with the eop_flush flag, the driver may be interrupted before
all descriptors has been processed by the XDMA core, and it may so
happen that during the interrupt processing, the engine has already
processed all descriptors, but the driver is not aware of it.

In libxdma.c:1139 there is a check if the engine is busy
    if ((engine->running && !(engine->status & XDMA_STAT_BUSY))
at the engine is stopped if it not busy.

When that code is executed, the engine may indeed be busy, but by the
time we get the descriptor count on line 1155, all descriptors may have
already been processed, and the engine is not busy anymore.

Since the running status of the engine in the driver has not changed
(engine->running == 1), subsequent transfers are only *queued*, but not
processed by the engine, which leads to an eventual timeout and error
512.

The proposed change explicitly stops the engine when a transfer is
complete.
  • Loading branch information
kgmayer authored and alonbl committed Feb 12, 2024
1 parent f326e72 commit c77722b
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions XDMA/linux-kernel/xdma/libxdma.c
Original file line number Diff line number Diff line change
Expand Up @@ -1002,6 +1002,7 @@ engine_service_final_transfer(struct xdma_engine *engine,
WARN_ON(*pdesc_completed > transfer->desc_num);
}
/* mark transfer as successfully completed */
engine_service_shutdown(engine);
transfer->state = TRANSFER_STATE_COMPLETED;
transfer->desc_cmpl = transfer->desc_num;
/* add dequeued number of descriptors during this run */
Expand Down

0 comments on commit c77722b

Please sign in to comment.