Re: [PATCH] dmaengine: idxd: reset states after device disable or reset

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 





On 7/27/2020 2:17 AM, Vinod Koul wrote:
On 21-07-20, 11:57, Dave Jiang wrote:
The state for WQs should be reset to disabled when a device is reset or
disabled.

Fixes: da32b28c95a7 ("dmaengine: idxd: cleanup workqueue config after disabling")
Reported-by: Mona Hossain <mona.hossain@xxxxxxxxx>
Signed-off-by: Dave Jiang <dave.jiang@xxxxxxxxx>
---
  drivers/dma/idxd/device.c |   21 +++++++++++++++++++++
  1 file changed, 21 insertions(+)

diff --git a/drivers/dma/idxd/device.c b/drivers/dma/idxd/device.c
index 14b45853aa5f..d0290072d558 100644
--- a/drivers/dma/idxd/device.c
+++ b/drivers/dma/idxd/device.c
@@ -414,6 +414,7 @@ int idxd_device_disable(struct idxd_device *idxd)
  {
  	struct device *dev = &idxd->pdev->dev;
  	u32 status;
+	int i;
if (!idxd_is_enabled(idxd)) {
  		dev_dbg(dev, "Device is not enabled\n");
@@ -429,13 +430,33 @@ int idxd_device_disable(struct idxd_device *idxd)
  		return -ENXIO;
  	}
+ for (i = 0; i < idxd->max_wqs; i++) {
+		struct idxd_wq *wq = &idxd->wqs[i];
+
+		if (wq->state == IDXD_WQ_ENABLED) {
+			idxd_wq_disable_cleanup(wq);
+			wq->state = IDXD_WQ_DISABLED;
+		}
+	}
  	idxd->state = IDXD_DEV_CONF_READY;
  	return 0;
  }
void idxd_device_reset(struct idxd_device *idxd)
  {
+	int i;
+
  	idxd_cmd_exec(idxd, IDXD_CMD_RESET_DEVICE, 0, NULL);
+
+	for (i = 0; i < idxd->max_wqs; i++) {
+		struct idxd_wq *wq = &idxd->wqs[i];
+
+		if (wq->state == IDXD_WQ_ENABLED) {
+			idxd_wq_disable_cleanup(wq);
+			wq->state = IDXD_WQ_DISABLED;
+		}
+	}

Repeated, how about a helper for this?

Ok will fix.


+	idxd->state = IDXD_DEV_CONF_READY;
  }
/* Device configuration bits */




[Index of Archives]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux PCI]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux