diff options
author | Dan Williams <dan.j.williams@intel.com> | 2009-01-06 13:38:22 -0500 |
---|---|---|
committer | Dan Williams <dan.j.williams@intel.com> | 2009-01-06 13:38:22 -0500 |
commit | b9bdcbba010c2e49c8f837ea7a49fe006b636f41 (patch) | |
tree | 030af2c964995a691d33aab19c8f07b04c5c3437 /drivers | |
parent | 652afc27b26859a0ea5f6db681d80b83d2c43cf8 (diff) |
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: Dan Williams <dan.j.williams@intel.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/dma/ioat_dma.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/drivers/dma/ioat_dma.c b/drivers/dma/ioat_dma.c index e42e1aea0f18..b3759c4b6536 100644 --- a/drivers/dma/ioat_dma.c +++ b/drivers/dma/ioat_dma.c | |||
@@ -1340,12 +1340,11 @@ static void ioat_dma_start_null_desc(struct ioat_dma_chan *ioat_chan) | |||
1340 | */ | 1340 | */ |
1341 | #define IOAT_TEST_SIZE 2000 | 1341 | #define IOAT_TEST_SIZE 2000 |
1342 | 1342 | ||
1343 | DECLARE_COMPLETION(test_completion); | ||
1344 | static void ioat_dma_test_callback(void *dma_async_param) | 1343 | static void ioat_dma_test_callback(void *dma_async_param) |
1345 | { | 1344 | { |
1346 | printk(KERN_ERR "ioatdma: ioat_dma_test_callback(%p)\n", | 1345 | struct completion *cmp = dma_async_param; |
1347 | dma_async_param); | 1346 | |
1348 | complete(&test_completion); | 1347 | complete(cmp); |
1349 | } | 1348 | } |
1350 | 1349 | ||
1351 | /** | 1350 | /** |
@@ -1362,6 +1361,7 @@ static int ioat_dma_self_test(struct ioatdma_device *device) | |||
1362 | dma_addr_t dma_dest, dma_src; | 1361 | dma_addr_t dma_dest, dma_src; |
1363 | dma_cookie_t cookie; | 1362 | dma_cookie_t cookie; |
1364 | int err = 0; | 1363 | int err = 0; |
1364 | struct completion cmp; | ||
1365 | 1365 | ||
1366 | src = kzalloc(sizeof(u8) * IOAT_TEST_SIZE, GFP_KERNEL); | 1366 | src = kzalloc(sizeof(u8) * IOAT_TEST_SIZE, GFP_KERNEL); |
1367 | if (!src) | 1367 | if (!src) |
@@ -1401,8 +1401,9 @@ static int ioat_dma_self_test(struct ioatdma_device *device) | |||
1401 | } | 1401 | } |
1402 | 1402 | ||
1403 | async_tx_ack(tx); | 1403 | async_tx_ack(tx); |
1404 | init_completion(&cmp); | ||
1404 | tx->callback = ioat_dma_test_callback; | 1405 | tx->callback = ioat_dma_test_callback; |
1405 | tx->callback_param = (void *)0x8086; | 1406 | tx->callback_param = &cmp; |
1406 | cookie = tx->tx_submit(tx); | 1407 | cookie = tx->tx_submit(tx); |
1407 | if (cookie < 0) { | 1408 | if (cookie < 0) { |
1408 | dev_err(&device->pdev->dev, | 1409 | dev_err(&device->pdev->dev, |
@@ -1412,7 +1413,7 @@ static int ioat_dma_self_test(struct ioatdma_device *device) | |||
1412 | } | 1413 | } |
1413 | device->common.device_issue_pending(dma_chan); | 1414 | device->common.device_issue_pending(dma_chan); |
1414 | 1415 | ||
1415 | wait_for_completion_timeout(&test_completion, msecs_to_jiffies(3000)); | 1416 | wait_for_completion_timeout(&cmp, msecs_to_jiffies(3000)); |
1416 | 1417 | ||
1417 | if (device->common.device_is_tx_complete(dma_chan, cookie, NULL, NULL) | 1418 | if (device->common.device_is_tx_complete(dma_chan, cookie, NULL, NULL) |
1418 | != DMA_SUCCESS) { | 1419 | != DMA_SUCCESS) { |