Re: [PATCH] dmaengine: idxd: check device state before issue command

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

 




On 1/31/2021 11:11 PM, Vinod Koul wrote:
On 25-01-21, 15:05, Dave Jiang wrote:
Add device state check before executing command. Without the check the
command can be issued while device is in halt state and causes the driver to
block while waiting for the completion of the command.

Reported-by: Sanjay Kumar <sanjay.k.kumar@xxxxxxxxx>
Signed-off-by: Dave Jiang <dave.jiang@xxxxxxxxx>
Tested-by: Sanjay Kumar <sanjay.k.kumar@xxxxxxxxx>
Fixes: 0d5c10b4c84d ("dmaengine: idxd: add work queue drain support")
---
  drivers/dma/idxd/device.c |   25 ++++++++++++++++++++++++-
  drivers/dma/idxd/idxd.h   |    2 +-
  drivers/dma/idxd/init.c   |    5 ++++-
  3 files changed, 29 insertions(+), 3 deletions(-)

diff --git a/drivers/dma/idxd/device.c b/drivers/dma/idxd/device.c
index 95f94a3ed6be..45077727ce5b 100644
--- a/drivers/dma/idxd/device.c
+++ b/drivers/dma/idxd/device.c
@@ -398,17 +398,33 @@ static inline bool idxd_is_enabled(struct idxd_device *idxd)
  	return false;
  }
+static inline bool idxd_device_is_halted(struct idxd_device *idxd)
+{
+	union gensts_reg gensts;
+
+	gensts.bits = ioread32(idxd->reg_base + IDXD_GENSTATS_OFFSET);
+
+	if (gensts.state == IDXD_DEVICE_STATE_HALT)
+		return true;
+	return false;
return (gensts.state == IDXD_DEVICE_STATE_HALT) ??
Ok I'll send v2.



[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