Commit b9bdcbba authored by Dan Williams's avatar Dan Williams

ioat: fix self test for multi-channel case

In the multiple device case we need to re-arm the completion and protect
against concurrent self-tests.  The printk from the test callback is
removed as it can arbitrarily delay completion of the test.

Cc: <stable@kernel.org>
Cc: Maciej Sosnowski <maciej.sosnowski@intel.com>
Signed-off-by: default avatarDan Williams <dan.j.williams@intel.com>
parent 652afc27
...@@ -1340,12 +1340,11 @@ static void ioat_dma_start_null_desc(struct ioat_dma_chan *ioat_chan) ...@@ -1340,12 +1340,11 @@ static void ioat_dma_start_null_desc(struct ioat_dma_chan *ioat_chan)
*/ */
#define IOAT_TEST_SIZE 2000 #define IOAT_TEST_SIZE 2000
DECLARE_COMPLETION(test_completion);
static void ioat_dma_test_callback(void *dma_async_param) static void ioat_dma_test_callback(void *dma_async_param)
{ {
printk(KERN_ERR "ioatdma: ioat_dma_test_callback(%p)\n", struct completion *cmp = dma_async_param;
dma_async_param);
complete(&test_completion); complete(cmp);
} }
/** /**
...@@ -1362,6 +1361,7 @@ static int ioat_dma_self_test(struct ioatdma_device *device) ...@@ -1362,6 +1361,7 @@ static int ioat_dma_self_test(struct ioatdma_device *device)
dma_addr_t dma_dest, dma_src; dma_addr_t dma_dest, dma_src;
dma_cookie_t cookie; dma_cookie_t cookie;
int err = 0; int err = 0;
struct completion cmp;
src = kzalloc(sizeof(u8) * IOAT_TEST_SIZE, GFP_KERNEL); src = kzalloc(sizeof(u8) * IOAT_TEST_SIZE, GFP_KERNEL);
if (!src) if (!src)
...@@ -1401,8 +1401,9 @@ static int ioat_dma_self_test(struct ioatdma_device *device) ...@@ -1401,8 +1401,9 @@ static int ioat_dma_self_test(struct ioatdma_device *device)
} }
async_tx_ack(tx); async_tx_ack(tx);
init_completion(&cmp);
tx->callback = ioat_dma_test_callback; tx->callback = ioat_dma_test_callback;
tx->callback_param = (void *)0x8086; tx->callback_param = &cmp;
cookie = tx->tx_submit(tx); cookie = tx->tx_submit(tx);
if (cookie < 0) { if (cookie < 0) {
dev_err(&device->pdev->dev, dev_err(&device->pdev->dev,
...@@ -1412,7 +1413,7 @@ static int ioat_dma_self_test(struct ioatdma_device *device) ...@@ -1412,7 +1413,7 @@ static int ioat_dma_self_test(struct ioatdma_device *device)
} }
device->common.device_issue_pending(dma_chan); device->common.device_issue_pending(dma_chan);
wait_for_completion_timeout(&test_completion, msecs_to_jiffies(3000)); wait_for_completion_timeout(&cmp, msecs_to_jiffies(3000));
if (device->common.device_is_tx_complete(dma_chan, cookie, NULL, NULL) if (device->common.device_is_tx_complete(dma_chan, cookie, NULL, NULL)
!= DMA_SUCCESS) { != DMA_SUCCESS) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment