Skip to content

Commit

Permalink
Merge pull request Xilinx#50 from jascondley/REF41_SCHED_ATOMIC
Browse files Browse the repository at this point in the history
Fixes a design error revealed by running on aarch64
  • Loading branch information
Karen Xie authored Feb 27, 2020
2 parents 54c1de2 + d1f334b commit 781c12f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
16 changes: 8 additions & 8 deletions XDMA/linux-kernel/libxdma/libxdma.c
Original file line number Diff line number Diff line change
Expand Up @@ -3514,7 +3514,7 @@ ssize_t xdma_xfer_submit(void *dev_hndl, int channel, bool write, u64 ep_addr,

sg = sgt->sgl;
nents = req->sw_desc_cnt;
spin_lock(&engine->desc_lock);
mutex_lock(&engine->desc_lock);

while (nents) {
unsigned long flags;
Expand All @@ -3523,7 +3523,7 @@ ssize_t xdma_xfer_submit(void *dev_hndl, int channel, bool write, u64 ep_addr,
/* build transfer */
rv = transfer_init(engine, req, &req->tfer[0]);
if (rv < 0) {
spin_unlock(&engine->desc_lock);
mutex_unlock(&engine->desc_lock);
goto unmap_sgl;
}
xfer = &req->tfer[0];
Expand All @@ -3547,7 +3547,7 @@ ssize_t xdma_xfer_submit(void *dev_hndl, int channel, bool write, u64 ep_addr,

rv = transfer_queue(engine, xfer);
if (rv < 0) {
spin_unlock(&engine->desc_lock);
mutex_unlock(&engine->desc_lock);
pr_info("unable to submit %s, %d.\n", engine->name, rv);
goto unmap_sgl;
}
Expand All @@ -3566,7 +3566,7 @@ ssize_t xdma_xfer_submit(void *dev_hndl, int channel, bool write, u64 ep_addr,
desc_count);
rv = engine_service_poll(engine, desc_count);
if (rv < 0) {
spin_unlock(&engine->desc_lock);
mutex_unlock(&engine->desc_lock);
pr_err("Failed to service polling\n");
goto unmap_sgl;
}
Expand Down Expand Up @@ -3649,11 +3649,11 @@ ssize_t xdma_xfer_submit(void *dev_hndl, int channel, bool write, u64 ep_addr,
tfer_idx++;

if (rv < 0) {
spin_unlock(&engine->desc_lock);
mutex_unlock(&engine->desc_lock);
goto unmap_sgl;
}
} /* while (sg) */
spin_unlock(&engine->desc_lock);
mutex_unlock(&engine->desc_lock);

unmap_sgl:
if (!dma_mapped && sgt->nents) {
Expand Down Expand Up @@ -4131,7 +4131,7 @@ static struct xdma_dev *alloc_dev_instance(struct pci_dev *pdev)
engine = xdev->engine_h2c;
for (i = 0; i < XDMA_CHANNEL_NUM_MAX; i++, engine++) {
spin_lock_init(&engine->lock);
spin_lock_init(&engine->desc_lock);
mutex_init(&engine->desc_lock);
INIT_LIST_HEAD(&engine->transfer_list);
#if KERNEL_VERSION(4, 6, 0) <= LINUX_VERSION_CODE
init_swait_queue_head(&engine->shutdown_wq);
Expand All @@ -4145,7 +4145,7 @@ static struct xdma_dev *alloc_dev_instance(struct pci_dev *pdev)
engine = xdev->engine_c2h;
for (i = 0; i < XDMA_CHANNEL_NUM_MAX; i++, engine++) {
spin_lock_init(&engine->lock);
spin_lock_init(&engine->desc_lock);
mutex_init(&engine->desc_lock);
INIT_LIST_HEAD(&engine->transfer_list);
#if KERNEL_VERSION(4, 6, 0) <= LINUX_VERSION_CODE
init_swait_queue_head(&engine->shutdown_wq);
Expand Down
2 changes: 1 addition & 1 deletion XDMA/linux-kernel/libxdma/libxdma.h
Original file line number Diff line number Diff line change
Expand Up @@ -511,7 +511,7 @@ struct xdma_engine {
u32 irq_bitmask; /* IRQ bit mask for this engine */
struct work_struct work; /* Work queue for interrupt handling */

spinlock_t desc_lock; /* protects concurrent access */
struct mutex desc_lock; /* protects concurrent access */
dma_addr_t desc_bus;
struct xdma_desc *desc;
int desc_idx; /* current descriptor index */
Expand Down

0 comments on commit 781c12f

Please sign in to comment.