dma/idxd: add reset in the init routine

Message ID 20230811021054.3848656-1-frank.du@intel.com (mailing list archive)
State Accepted, archived
Delegated to: Thomas Monjalon
Headers
Series dma/idxd: add reset in the init routine |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/github-robot: build success github build: passed
ci/loongarch-compilation success Compilation OK
ci/loongarch-unit-testing success Unit Testing PASS
ci/iol-unit-amd64-testing success Testing PASS
ci/iol-unit-arm64-testing success Testing PASS
ci/Intel-compilation success Compilation OK
ci/intel-Testing success Testing PASS
ci/intel-Functional success Functional PASS
ci/iol-compile-arm64-testing success Testing PASS
ci/iol-broadcom-Performance success Performance Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-sample-apps-testing success Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-broadcom-Functional success Functional Testing PASS
ci/iol-compile-amd64-testing success Testing PASS

Commit Message

Du, Frank Aug. 11, 2023, 2:10 a.m. UTC
  Fix for windows, no one reset the dev to a clear status. In Linux,
kernel driver will reset during the prob.

Signed-off-by: Frank Du <frank.du@intel.com>
---
 drivers/dma/idxd/idxd_pci.c | 8 ++++++++
 1 file changed, 8 insertions(+)
  

Comments

Bruce Richardson Aug. 14, 2023, 3:37 p.m. UTC | #1
On Fri, Aug 11, 2023 at 10:10:54AM +0800, Frank Du wrote:
> Fix for windows, no one reset the dev to a clear status. In Linux,
> kernel driver will reset during the prob.
> 
> Signed-off-by: Frank Du <frank.du@intel.com>
> ---
>  drivers/dma/idxd/idxd_pci.c | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 
Ran some sanity tests on Linux and saw no issues.

Acked-by: Bruce Richardson <bruce.richardson@intel.com>
  
Thomas Monjalon Oct. 17, 2023, 9:42 a.m. UTC | #2
14/08/2023 17:37, Bruce Richardson:
> On Fri, Aug 11, 2023 at 10:10:54AM +0800, Frank Du wrote:
> > Fix for windows, no one reset the dev to a clear status. In Linux,
> > kernel driver will reset during the prob.
> > 
> > Signed-off-by: Frank Du <frank.du@intel.com>
> > ---
> >  drivers/dma/idxd/idxd_pci.c | 8 ++++++++
> >  1 file changed, 8 insertions(+)
> > 
> Ran some sanity tests on Linux and saw no issues.
> 
> Acked-by: Bruce Richardson <bruce.richardson@intel.com>

Applied, thanks.
  

Patch

diff --git a/drivers/dma/idxd/idxd_pci.c b/drivers/dma/idxd/idxd_pci.c
index 3696c7f452..a78889a7ef 100644
--- a/drivers/dma/idxd/idxd_pci.c
+++ b/drivers/dma/idxd/idxd_pci.c
@@ -196,6 +196,14 @@  init_pci_device(struct rte_pci_device *dev, struct idxd_dmadev *idxd,
 	pci->portals = dev->mem_resource[2].addr;
 	pci->wq_cfg_sz = (pci->regs->wqcap >> 24) & 0x0F;
 
+	/* reset */
+	idxd->u.pci = pci;
+	err_code = idxd_pci_dev_command(idxd, idxd_reset_device);
+	if (err_code) {
+		IDXD_PMD_ERR("Error reset device: code %#x", err_code);
+		goto err;
+	}
+
 	/* sanity check device status */
 	if (pci->regs->gensts & GENSTS_DEV_STATE_MASK) {
 		/* need function-level-reset (FLR) or is enabled */