From: Bruce Richardson <bruce.richardson@intel.com>
To: dev@dpdk.org
Cc: fengchengwen@huawei.com,
Bruce Richardson <bruce.richardson@intel.com>,
conor.walsh@intel.com, stable@dpdk.org,
Kevin Laatz <kevin.laatz@intel.com>
Subject: [PATCH v3 1/6] dma/ioat: fix device stop if no copies done
Date: Thu, 16 Feb 2023 11:09:14 +0000 [thread overview]
Message-ID: <20230216110919.373385-2-bruce.richardson@intel.com> (raw)
In-Reply-To: <20230216110919.373385-1-bruce.richardson@intel.com>
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
next prev parent reply other threads:[~2023-02-16 11:09 UTC|newest]
Thread overview: 43+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-16 15:37 [PATCH 0/5] dma/ioat: fix issues with stopping and restarting device Bruce Richardson
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
2023-01-16 15:37 ` [PATCH 3/5] test/dmadev: check result for device stop Bruce Richardson
2023-01-16 15:37 ` [PATCH 4/5] test/dmadev: create separate function for single copy test Bruce Richardson
2023-01-16 15:37 ` [PATCH 5/5] test/dmadev: add tests for stopping and restarting dev Bruce Richardson
2023-01-16 16:09 ` [PATCH 0/5] dma/ioat: fix issues with stopping and restarting device Walsh, Conor
2023-01-16 16:38 ` Bruce Richardson
2023-01-16 17:37 ` [PATCH v2 0/6] " Bruce Richardson
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
2023-01-16 17:37 ` [PATCH v2 4/6] test/dmadev: check result for device stop Bruce Richardson
2023-01-18 10:47 ` Walsh, Conor
2023-02-02 11:12 ` David Marchand
2023-02-14 16:04 ` Kevin Laatz
2023-02-15 1:26 ` fengchengwen
2023-02-15 11:58 ` Bruce Richardson
2023-01-16 17:37 ` [PATCH v2 5/6] test/dmadev: create separate function for single copy test Bruce Richardson
2023-02-14 16:04 ` Kevin Laatz
2023-02-15 1:28 ` fengchengwen
2023-01-16 17:37 ` [PATCH v2 6/6] test/dmadev: add tests for stopping and restarting dev Bruce Richardson
2023-02-14 16:04 ` Kevin Laatz
2023-02-15 1:59 ` fengchengwen
2023-02-15 11:57 ` Bruce Richardson
2023-02-16 1:24 ` fengchengwen
2023-02-16 9:24 ` Bruce Richardson
2023-02-16 11:09 ` [PATCH v3 0/6] dma/ioat: fix issues with stopping and restarting device Bruce Richardson
2023-02-16 11:09 ` Bruce Richardson [this message]
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
2023-02-16 11:09 ` [PATCH v3 4/6] test/dmadev: check result for device stop Bruce Richardson
2023-02-16 11:41 ` fengchengwen
2023-02-16 11:09 ` [PATCH v3 5/6] test/dmadev: create separate function for single copy test Bruce Richardson
2023-02-16 11:09 ` [PATCH v3 6/6] test/dmadev: add tests for stopping and restarting dev Bruce Richardson
2023-02-16 11:42 ` fengchengwen
2023-02-19 23:11 ` [PATCH v3 0/6] dma/ioat: fix issues with stopping and restarting device Thomas Monjalon
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230216110919.373385-2-bruce.richardson@intel.com \
--to=bruce.richardson@intel.com \
--cc=conor.walsh@intel.com \
--cc=dev@dpdk.org \
--cc=fengchengwen@huawei.com \
--cc=kevin.laatz@intel.com \
--cc=stable@dpdk.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).