[v2,3/6] dma/ioat: fix incorrect error reporting on restart

Message ID 20230116173738.562322-4-bruce.richardson@intel.com (mailing list archive)
State Superseded, archived
Delegated to: David Marchand
Headers
Series dma/ioat: fix issues with stopping and restarting device |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Bruce Richardson Jan. 16, 2023, 5:37 p.m. UTC
  When the DMA device was stopped and restarted by the driver, the control
register specifying the behaviour on error was not getting correctly
reset. This caused unit tests to fail as explicitly introduced errors
were got getting reported back.

Fix by moving the setting of the register to the start function from the
probe function.

Fixes: 583f046dd404 ("dma/ioat: add start and stop")
Cc: conor.walsh@intel.com
Cc: stable@dpdk.org

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
---
 drivers/dma/ioat/ioat_dmadev.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
  

Comments

Conor Walsh Jan. 18, 2023, 10:47 a.m. UTC | #1
> When the DMA device was stopped and restarted by the driver, the control
> register specifying the behaviour on error was not getting correctly
> reset. This caused unit tests to fail as explicitly introduced errors
> were got getting reported back.
> 
> Fix by moving the setting of the register to the start function from the
> probe function.
> 
> Fixes: 583f046dd404 ("dma/ioat: add start and stop")
> Cc: conor.walsh@intel.com
> Cc: stable@dpdk.org
> 
> Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>

Reviewed-by: Conor Walsh <conor.walsh@intel.com>
  
Kevin Laatz Feb. 14, 2023, 4:04 p.m. UTC | #2
On 16/01/2023 17:37, Bruce Richardson wrote:
> When the DMA device was stopped and restarted by the driver, the control
> register specifying the behaviour on error was not getting correctly
> reset. This caused unit tests to fail as explicitly introduced errors
> were got getting reported back.
>
> Fix by moving the setting of the register to the start function from the
> probe function.
>
> Fixes: 583f046dd404 ("dma/ioat: add start and stop")
> Cc: conor.walsh@intel.com
> Cc: stable@dpdk.org
>
> Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
> ---
>   drivers/dma/ioat/ioat_dmadev.c | 5 +++--
>   1 file changed, 3 insertions(+), 2 deletions(-)
>
Acked-by: Kevin Laatz <kevin.laatz@intel.com>
  

Patch

diff --git a/drivers/dma/ioat/ioat_dmadev.c b/drivers/dma/ioat/ioat_dmadev.c
index 072eb17cd9..57c18c081d 100644
--- a/drivers/dma/ioat/ioat_dmadev.c
+++ b/drivers/dma/ioat/ioat_dmadev.c
@@ -142,6 +142,9 @@  ioat_dev_start(struct rte_dma_dev *dev)
 	ioat->regs->chainaddr = ioat->ring_addr;
 	/* Inform hardware of where to write the status/completions. */
 	ioat->regs->chancmp = ioat->status_addr;
+	/* Ensure channel control is set to abort on error, so we get status writeback. */
+	ioat->regs->chanctrl = IOAT_CHANCTRL_ANY_ERR_ABORT_EN |
+			IOAT_CHANCTRL_ERR_COMPLETION_EN;
 
 	/* Prime the status register to be set to the last element. */
 	ioat->status = ioat->ring_addr + ((ioat->qcfg.nb_desc - 1) * DESC_SZ);
@@ -682,8 +685,6 @@  ioat_dmadev_create(const char *name, struct rte_pci_device *dev)
 			return -EIO;
 		}
 	}
-	ioat->regs->chanctrl = IOAT_CHANCTRL_ANY_ERR_ABORT_EN |
-			IOAT_CHANCTRL_ERR_COMPLETION_EN;
 
 	dmadev->fp_obj->dev_private = ioat;