* [PATCH 1/5] dma/ioat: fix device stop if no copies done [not found] <20230116153714.554470-1-bruce.richardson@intel.com> @ 2023-01-16 15:37 ` Bruce Richardson 2023-01-16 15:37 ` [PATCH 2/5] dma/ioat: fix incorrectly set indexes after restart Bruce Richardson ` (2 subsequent siblings) 3 siblings, 0 replies; 14+ messages in thread From: Bruce Richardson @ 2023-01-16 15:37 UTC (permalink / raw) To: dev; +Cc: Bruce Richardson, conor.walsh, stable, Kevin Laatz The HW DMA devices supported by IOAT driver do not transition to the "active" state until the first operation is started by the HW. Therefore, if the user calls "rte_dma_stop()" on a device without triggering any operations, the sequence of commands to be sent to the HW is different, as is the final device state. Update the IOAT driver "stop" function to take account of this difference. 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 | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/drivers/dma/ioat/ioat_dmadev.c b/drivers/dma/ioat/ioat_dmadev.c index 5906eb45aa..aff7bbbfde 100644 --- a/drivers/dma/ioat/ioat_dmadev.c +++ b/drivers/dma/ioat/ioat_dmadev.c @@ -166,17 +166,28 @@ static int ioat_dev_stop(struct rte_dma_dev *dev) { struct ioat_dmadev *ioat = dev->fp_obj->dev_private; + unsigned int chansts; uint32_t retry = 0; - ioat->regs->chancmd = IOAT_CHANCMD_SUSPEND; + chansts = (unsigned int)(ioat->regs->chansts & IOAT_CHANSTS_STATUS); + if (chansts == IOAT_CHANSTS_ACTIVE || chansts == IOAT_CHANSTS_IDLE) + ioat->regs->chancmd = IOAT_CHANCMD_SUSPEND; + else + ioat->regs->chancmd = IOAT_CHANCMD_RESET; do { rte_pause(); retry++; - } while ((ioat->regs->chansts & IOAT_CHANSTS_STATUS) != IOAT_CHANSTS_SUSPENDED - && retry < 200); + chansts = (unsigned int)(ioat->regs->chansts & IOAT_CHANSTS_STATUS); + } while (chansts != IOAT_CHANSTS_SUSPENDED && + chansts != IOAT_CHANSTS_HALTED && retry < 200); + + if (chansts == IOAT_CHANSTS_SUSPENDED || chansts == IOAT_CHANSTS_HALTED) + return 0; - return ((ioat->regs->chansts & IOAT_CHANSTS_STATUS) == IOAT_CHANSTS_SUSPENDED) ? 0 : -1; + IOAT_PMD_WARN("Channel could not be suspended on stop. (chansts = %u [%s])", + chansts, chansts_readable[chansts]); + return -1; } /* Get device information of a device. */ -- 2.37.2 ^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH 2/5] dma/ioat: fix incorrectly set indexes after restart [not found] <20230116153714.554470-1-bruce.richardson@intel.com> 2023-01-16 15:37 ` [PATCH 1/5] dma/ioat: fix device stop if no copies done Bruce Richardson @ 2023-01-16 15:37 ` Bruce Richardson [not found] ` <20230116173738.562322-1-bruce.richardson@intel.com> [not found] ` <20230216110919.373385-1-bruce.richardson@intel.com> 3 siblings, 0 replies; 14+ messages in thread From: Bruce Richardson @ 2023-01-16 15:37 UTC (permalink / raw) To: dev; +Cc: Bruce Richardson, conor.walsh, stable, Kevin Laatz As part of the process of restarting a dma instance, the IOAT driver will reset the HW addresses and state values. The read and write indexes for SW use need to be similarly reset to keep HW and SW in sync. 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 | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/dma/ioat/ioat_dmadev.c b/drivers/dma/ioat/ioat_dmadev.c index aff7bbbfde..072eb17cd9 100644 --- a/drivers/dma/ioat/ioat_dmadev.c +++ b/drivers/dma/ioat/ioat_dmadev.c @@ -146,6 +146,13 @@ ioat_dev_start(struct rte_dma_dev *dev) /* Prime the status register to be set to the last element. */ ioat->status = ioat->ring_addr + ((ioat->qcfg.nb_desc - 1) * DESC_SZ); + /* reset all counters */ + ioat->next_read = 0; + ioat->next_write = 0; + ioat->last_write = 0; + ioat->offset = 0; + ioat->failure = 0; + printf("IOAT.status: %s [0x%"PRIx64"]\n", chansts_readable[ioat->status & IOAT_CHANSTS_STATUS], ioat->status); -- 2.37.2 ^ permalink raw reply [flat|nested] 14+ messages in thread
[parent not found: <20230116173738.562322-1-bruce.richardson@intel.com>]
* [PATCH v2 1/6] dma/ioat: fix device stop if no copies done [not found] ` <20230116173738.562322-1-bruce.richardson@intel.com> @ 2023-01-16 17:37 ` Bruce Richardson 2023-01-18 10:47 ` Walsh, Conor 2023-02-14 16:04 ` Kevin Laatz 2023-01-16 17:37 ` [PATCH v2 2/6] dma/ioat: fix incorrectly set indexes after restart Bruce Richardson 2023-01-16 17:37 ` [PATCH v2 3/6] dma/ioat: fix incorrect error reporting on restart Bruce Richardson 2 siblings, 2 replies; 14+ messages in thread From: Bruce Richardson @ 2023-01-16 17:37 UTC (permalink / raw) To: dev; +Cc: Bruce Richardson, conor.walsh, stable, Kevin Laatz The HW DMA devices supported by IOAT driver do not transition to the "active" state until the first operation is started by the HW. Therefore, if the user calls "rte_dma_stop()" on a device without triggering any operations, the sequence of commands to be sent to the HW is different, as is the final device state. Update the IOAT driver "stop" function to take account of this difference. 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 | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/drivers/dma/ioat/ioat_dmadev.c b/drivers/dma/ioat/ioat_dmadev.c index 5906eb45aa..aff7bbbfde 100644 --- a/drivers/dma/ioat/ioat_dmadev.c +++ b/drivers/dma/ioat/ioat_dmadev.c @@ -166,17 +166,28 @@ static int ioat_dev_stop(struct rte_dma_dev *dev) { struct ioat_dmadev *ioat = dev->fp_obj->dev_private; + unsigned int chansts; uint32_t retry = 0; - ioat->regs->chancmd = IOAT_CHANCMD_SUSPEND; + chansts = (unsigned int)(ioat->regs->chansts & IOAT_CHANSTS_STATUS); + if (chansts == IOAT_CHANSTS_ACTIVE || chansts == IOAT_CHANSTS_IDLE) + ioat->regs->chancmd = IOAT_CHANCMD_SUSPEND; + else + ioat->regs->chancmd = IOAT_CHANCMD_RESET; do { rte_pause(); retry++; - } while ((ioat->regs->chansts & IOAT_CHANSTS_STATUS) != IOAT_CHANSTS_SUSPENDED - && retry < 200); + chansts = (unsigned int)(ioat->regs->chansts & IOAT_CHANSTS_STATUS); + } while (chansts != IOAT_CHANSTS_SUSPENDED && + chansts != IOAT_CHANSTS_HALTED && retry < 200); + + if (chansts == IOAT_CHANSTS_SUSPENDED || chansts == IOAT_CHANSTS_HALTED) + return 0; - return ((ioat->regs->chansts & IOAT_CHANSTS_STATUS) == IOAT_CHANSTS_SUSPENDED) ? 0 : -1; + IOAT_PMD_WARN("Channel could not be suspended on stop. (chansts = %u [%s])", + chansts, chansts_readable[chansts]); + return -1; } /* Get device information of a device. */ -- 2.37.2 ^ permalink raw reply [flat|nested] 14+ messages in thread
* RE: [PATCH v2 1/6] dma/ioat: fix device stop if no copies done 2023-01-16 17:37 ` [PATCH v2 1/6] dma/ioat: fix device stop if no copies done Bruce Richardson @ 2023-01-18 10:47 ` Walsh, Conor 2023-02-14 16:04 ` Kevin Laatz 1 sibling, 0 replies; 14+ messages in thread From: Walsh, Conor @ 2023-01-18 10:47 UTC (permalink / raw) To: Richardson, Bruce, dev; +Cc: stable, Laatz, Kevin > The HW DMA devices supported by IOAT driver do not transition to > the "active" state until the first operation is started by the HW. > Therefore, if the user calls "rte_dma_stop()" on a device without > triggering any operations, the sequence of commands to be sent to > the HW is different, as is the final device state. > > Update the IOAT driver "stop" function to take account of this > difference. > > 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> ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH v2 1/6] dma/ioat: fix device stop if no copies done 2023-01-16 17:37 ` [PATCH v2 1/6] dma/ioat: fix device stop if no copies done Bruce Richardson 2023-01-18 10:47 ` Walsh, Conor @ 2023-02-14 16:04 ` Kevin Laatz 1 sibling, 0 replies; 14+ messages in thread From: Kevin Laatz @ 2023-02-14 16:04 UTC (permalink / raw) To: Bruce Richardson, dev; +Cc: conor.walsh, stable On 16/01/2023 17:37, Bruce Richardson wrote: > The HW DMA devices supported by IOAT driver do not transition to > the "active" state until the first operation is started by the HW. > Therefore, if the user calls "rte_dma_stop()" on a device without > triggering any operations, the sequence of commands to be sent to > the HW is different, as is the final device state. > > Update the IOAT driver "stop" function to take account of this > difference. > > 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 | 19 +++++++++++++++---- > 1 file changed, 15 insertions(+), 4 deletions(-) > Acked-by: Kevin Laatz <kevin.laatz@intel.com> ^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH v2 2/6] dma/ioat: fix incorrectly set indexes after restart [not found] ` <20230116173738.562322-1-bruce.richardson@intel.com> 2023-01-16 17:37 ` [PATCH v2 1/6] dma/ioat: fix device stop if no copies done Bruce Richardson @ 2023-01-16 17:37 ` Bruce Richardson 2023-01-18 10:47 ` Walsh, Conor 2023-02-14 16:04 ` Kevin Laatz 2023-01-16 17:37 ` [PATCH v2 3/6] dma/ioat: fix incorrect error reporting on restart Bruce Richardson 2 siblings, 2 replies; 14+ messages in thread From: Bruce Richardson @ 2023-01-16 17:37 UTC (permalink / raw) To: dev; +Cc: Bruce Richardson, conor.walsh, stable, Kevin Laatz As part of the process of restarting a dma instance, the IOAT driver will reset the HW addresses and state values. The read and write indexes for SW use need to be similarly reset to keep HW and SW in sync. 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 | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/dma/ioat/ioat_dmadev.c b/drivers/dma/ioat/ioat_dmadev.c index aff7bbbfde..072eb17cd9 100644 --- a/drivers/dma/ioat/ioat_dmadev.c +++ b/drivers/dma/ioat/ioat_dmadev.c @@ -146,6 +146,13 @@ ioat_dev_start(struct rte_dma_dev *dev) /* Prime the status register to be set to the last element. */ ioat->status = ioat->ring_addr + ((ioat->qcfg.nb_desc - 1) * DESC_SZ); + /* reset all counters */ + ioat->next_read = 0; + ioat->next_write = 0; + ioat->last_write = 0; + ioat->offset = 0; + ioat->failure = 0; + printf("IOAT.status: %s [0x%"PRIx64"]\n", chansts_readable[ioat->status & IOAT_CHANSTS_STATUS], ioat->status); -- 2.37.2 ^ permalink raw reply [flat|nested] 14+ messages in thread
* RE: [PATCH v2 2/6] dma/ioat: fix incorrectly set indexes after restart 2023-01-16 17:37 ` [PATCH v2 2/6] dma/ioat: fix incorrectly set indexes after restart Bruce Richardson @ 2023-01-18 10:47 ` Walsh, Conor 2023-02-14 16:04 ` Kevin Laatz 1 sibling, 0 replies; 14+ messages in thread From: Walsh, Conor @ 2023-01-18 10:47 UTC (permalink / raw) To: Richardson, Bruce, dev; +Cc: stable, Laatz, Kevin > As part of the process of restarting a dma instance, the IOAT driver > will reset the HW addresses and state values. The read and write > indexes for SW use need to be similarly reset to keep HW and SW in > sync. > > 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> ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH v2 2/6] dma/ioat: fix incorrectly set indexes after restart 2023-01-16 17:37 ` [PATCH v2 2/6] dma/ioat: fix incorrectly set indexes after restart Bruce Richardson 2023-01-18 10:47 ` Walsh, Conor @ 2023-02-14 16:04 ` Kevin Laatz 1 sibling, 0 replies; 14+ messages in thread From: Kevin Laatz @ 2023-02-14 16:04 UTC (permalink / raw) To: Bruce Richardson, dev; +Cc: conor.walsh, stable On 16/01/2023 17:37, Bruce Richardson wrote: > As part of the process of restarting a dma instance, the IOAT driver > will reset the HW addresses and state values. The read and write > indexes for SW use need to be similarly reset to keep HW and SW in > sync. > > 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 | 7 +++++++ > 1 file changed, 7 insertions(+) Acked-by: Kevin Laatz <kevin.laatz@intel.com> ^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH v2 3/6] dma/ioat: fix incorrect error reporting on restart [not found] ` <20230116173738.562322-1-bruce.richardson@intel.com> 2023-01-16 17:37 ` [PATCH v2 1/6] dma/ioat: fix device stop if no copies done Bruce Richardson 2023-01-16 17:37 ` [PATCH v2 2/6] dma/ioat: fix incorrectly set indexes after restart Bruce Richardson @ 2023-01-16 17:37 ` Bruce Richardson 2023-01-18 10:47 ` Walsh, Conor 2023-02-14 16:04 ` Kevin Laatz 2 siblings, 2 replies; 14+ messages in thread From: Bruce Richardson @ 2023-01-16 17:37 UTC (permalink / raw) To: dev; +Cc: Bruce Richardson, conor.walsh, stable, Kevin Laatz 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(-) 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; -- 2.37.2 ^ permalink raw reply [flat|nested] 14+ messages in thread
* RE: [PATCH v2 3/6] dma/ioat: fix incorrect error reporting on restart 2023-01-16 17:37 ` [PATCH v2 3/6] dma/ioat: fix incorrect error reporting on restart Bruce Richardson @ 2023-01-18 10:47 ` Walsh, Conor 2023-02-14 16:04 ` Kevin Laatz 1 sibling, 0 replies; 14+ messages in thread From: Walsh, Conor @ 2023-01-18 10:47 UTC (permalink / raw) To: Richardson, Bruce, dev; +Cc: stable, Laatz, Kevin > 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> ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH v2 3/6] dma/ioat: fix incorrect error reporting on restart 2023-01-16 17:37 ` [PATCH v2 3/6] dma/ioat: fix incorrect error reporting on restart Bruce Richardson 2023-01-18 10:47 ` Walsh, Conor @ 2023-02-14 16:04 ` Kevin Laatz 1 sibling, 0 replies; 14+ messages in thread From: Kevin Laatz @ 2023-02-14 16:04 UTC (permalink / raw) To: Bruce Richardson, dev; +Cc: conor.walsh, stable 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> ^ permalink raw reply [flat|nested] 14+ messages in thread
[parent not found: <20230216110919.373385-1-bruce.richardson@intel.com>]
* [PATCH v3 1/6] dma/ioat: fix device stop if no copies done [not found] ` <20230216110919.373385-1-bruce.richardson@intel.com> @ 2023-02-16 11:09 ` Bruce Richardson 2023-02-16 11:09 ` [PATCH v3 2/6] dma/ioat: fix incorrectly set indexes after restart Bruce Richardson 2023-02-16 11:09 ` [PATCH v3 3/6] dma/ioat: fix incorrect error reporting on restart Bruce Richardson 2 siblings, 0 replies; 14+ messages in thread From: Bruce Richardson @ 2023-02-16 11:09 UTC (permalink / raw) To: dev; +Cc: fengchengwen, Bruce Richardson, conor.walsh, stable, Kevin Laatz The HW DMA devices supported by IOAT driver do not transition to the "active" state until the first operation is started by the HW. Therefore, if the user calls "rte_dma_stop()" on a device without triggering any operations, the sequence of commands to be sent to the HW is different, as is the final device state. Update the IOAT driver "stop" function to take account of this difference. 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> Acked-by: Kevin Laatz <kevin.laatz@intel.com> --- drivers/dma/ioat/ioat_dmadev.c | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/drivers/dma/ioat/ioat_dmadev.c b/drivers/dma/ioat/ioat_dmadev.c index 5906eb45aa..aff7bbbfde 100644 --- a/drivers/dma/ioat/ioat_dmadev.c +++ b/drivers/dma/ioat/ioat_dmadev.c @@ -166,17 +166,28 @@ static int ioat_dev_stop(struct rte_dma_dev *dev) { struct ioat_dmadev *ioat = dev->fp_obj->dev_private; + unsigned int chansts; uint32_t retry = 0; - ioat->regs->chancmd = IOAT_CHANCMD_SUSPEND; + chansts = (unsigned int)(ioat->regs->chansts & IOAT_CHANSTS_STATUS); + if (chansts == IOAT_CHANSTS_ACTIVE || chansts == IOAT_CHANSTS_IDLE) + ioat->regs->chancmd = IOAT_CHANCMD_SUSPEND; + else + ioat->regs->chancmd = IOAT_CHANCMD_RESET; do { rte_pause(); retry++; - } while ((ioat->regs->chansts & IOAT_CHANSTS_STATUS) != IOAT_CHANSTS_SUSPENDED - && retry < 200); + chansts = (unsigned int)(ioat->regs->chansts & IOAT_CHANSTS_STATUS); + } while (chansts != IOAT_CHANSTS_SUSPENDED && + chansts != IOAT_CHANSTS_HALTED && retry < 200); + + if (chansts == IOAT_CHANSTS_SUSPENDED || chansts == IOAT_CHANSTS_HALTED) + return 0; - return ((ioat->regs->chansts & IOAT_CHANSTS_STATUS) == IOAT_CHANSTS_SUSPENDED) ? 0 : -1; + IOAT_PMD_WARN("Channel could not be suspended on stop. (chansts = %u [%s])", + chansts, chansts_readable[chansts]); + return -1; } /* Get device information of a device. */ -- 2.37.2 ^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH v3 2/6] dma/ioat: fix incorrectly set indexes after restart [not found] ` <20230216110919.373385-1-bruce.richardson@intel.com> 2023-02-16 11:09 ` [PATCH v3 1/6] dma/ioat: fix device stop if no copies done Bruce Richardson @ 2023-02-16 11:09 ` Bruce Richardson 2023-02-16 11:09 ` [PATCH v3 3/6] dma/ioat: fix incorrect error reporting on restart Bruce Richardson 2 siblings, 0 replies; 14+ messages in thread From: Bruce Richardson @ 2023-02-16 11:09 UTC (permalink / raw) To: dev; +Cc: fengchengwen, Bruce Richardson, conor.walsh, stable, Kevin Laatz As part of the process of restarting a dma instance, the IOAT driver will reset the HW addresses and state values. The read and write indexes for SW use need to be similarly reset to keep HW and SW in sync. 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> Acked-by: Kevin Laatz <kevin.laatz@intel.com> --- drivers/dma/ioat/ioat_dmadev.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/dma/ioat/ioat_dmadev.c b/drivers/dma/ioat/ioat_dmadev.c index aff7bbbfde..072eb17cd9 100644 --- a/drivers/dma/ioat/ioat_dmadev.c +++ b/drivers/dma/ioat/ioat_dmadev.c @@ -146,6 +146,13 @@ ioat_dev_start(struct rte_dma_dev *dev) /* Prime the status register to be set to the last element. */ ioat->status = ioat->ring_addr + ((ioat->qcfg.nb_desc - 1) * DESC_SZ); + /* reset all counters */ + ioat->next_read = 0; + ioat->next_write = 0; + ioat->last_write = 0; + ioat->offset = 0; + ioat->failure = 0; + printf("IOAT.status: %s [0x%"PRIx64"]\n", chansts_readable[ioat->status & IOAT_CHANSTS_STATUS], ioat->status); -- 2.37.2 ^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH v3 3/6] dma/ioat: fix incorrect error reporting on restart [not found] ` <20230216110919.373385-1-bruce.richardson@intel.com> 2023-02-16 11:09 ` [PATCH v3 1/6] dma/ioat: fix device stop if no copies done Bruce Richardson 2023-02-16 11:09 ` [PATCH v3 2/6] dma/ioat: fix incorrectly set indexes after restart Bruce Richardson @ 2023-02-16 11:09 ` Bruce Richardson 2 siblings, 0 replies; 14+ messages in thread From: Bruce Richardson @ 2023-02-16 11:09 UTC (permalink / raw) To: dev; +Cc: fengchengwen, Bruce Richardson, conor.walsh, stable, Kevin Laatz 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> Acked-by: Kevin Laatz <kevin.laatz@intel.com> --- drivers/dma/ioat/ioat_dmadev.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) 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; -- 2.37.2 ^ permalink raw reply [flat|nested] 14+ messages in thread
end of thread, other threads:[~2023-02-16 11:09 UTC | newest] Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- [not found] <20230116153714.554470-1-bruce.richardson@intel.com> 2023-01-16 15:37 ` [PATCH 1/5] dma/ioat: fix device stop if no copies done Bruce Richardson 2023-01-16 15:37 ` [PATCH 2/5] dma/ioat: fix incorrectly set indexes after restart Bruce Richardson [not found] ` <20230116173738.562322-1-bruce.richardson@intel.com> 2023-01-16 17:37 ` [PATCH v2 1/6] dma/ioat: fix device stop if no copies done Bruce Richardson 2023-01-18 10:47 ` Walsh, Conor 2023-02-14 16:04 ` Kevin Laatz 2023-01-16 17:37 ` [PATCH v2 2/6] dma/ioat: fix incorrectly set indexes after restart Bruce Richardson 2023-01-18 10:47 ` Walsh, Conor 2023-02-14 16:04 ` Kevin Laatz 2023-01-16 17:37 ` [PATCH v2 3/6] dma/ioat: fix incorrect error reporting on restart Bruce Richardson 2023-01-18 10:47 ` Walsh, Conor 2023-02-14 16:04 ` Kevin Laatz [not found] ` <20230216110919.373385-1-bruce.richardson@intel.com> 2023-02-16 11:09 ` [PATCH v3 1/6] dma/ioat: fix device stop if no copies done Bruce Richardson 2023-02-16 11:09 ` [PATCH v3 2/6] dma/ioat: fix incorrectly set indexes after restart Bruce Richardson 2023-02-16 11:09 ` [PATCH v3 3/6] dma/ioat: fix incorrect error reporting on restart Bruce Richardson
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).