DMA Engine development
 help / color / mirror / Atom feed
From: Vinod Koul <vkoul@kernel.org>
To: Dave Jiang <dave.jiang@intel.com>
Cc: Sanjay Kumar <sanjay.k.kumar@intel.com>, dmaengine@vger.kernel.org
Subject: Re: [PATCH] dmaengine: idxd: check device state before issue command
Date: Mon, 1 Feb 2021 11:41:40 +0530	[thread overview]
Message-ID: <20210201061140.GL2771@vkoul-mobl> (raw)
In-Reply-To: <161161231309.406594.6061304765472136401.stgit@djiang5-desk3.ch.intel.com>

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@intel.com>
> Signed-off-by: Dave Jiang <dave.jiang@intel.com>
> Tested-by: Sanjay Kumar <sanjay.k.kumar@intel.com>
> 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) ??

-- 
~Vinod

  reply	other threads:[~2021-02-01  6:29 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-25 22:05 [PATCH] dmaengine: idxd: check device state before issue command Dave Jiang
2021-02-01  6:11 ` Vinod Koul [this message]
2021-02-01 15:05   ` Dave Jiang

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=20210201061140.GL2771@vkoul-mobl \
    --to=vkoul@kernel.org \
    --cc=dave.jiang@intel.com \
    --cc=dmaengine@vger.kernel.org \
    --cc=sanjay.k.kumar@intel.com \
    /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