dmaengine.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dave Jiang <dave.jiang@intel.com>
To: Vinod Koul <vkoul@kernel.org>
Cc: Mona Hossain <mona.hossain@intel.com>, dmaengine@vger.kernel.org
Subject: Re: [PATCH] dmaengine: idxd: reset states after device disable or reset
Date: Mon, 27 Jul 2020 07:47:40 -0700	[thread overview]
Message-ID: <3e41f488-4015-f980-53e4-ea58c31f253b@intel.com> (raw)
In-Reply-To: <20200727091757.GT12965@vkoul-mobl>



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@intel.com>
>> Signed-off-by: Dave Jiang <dave.jiang@intel.com>
>> ---
>>   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 */
> 

      reply	other threads:[~2020-07-27 14:47 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-21 18:57 [PATCH] dmaengine: idxd: reset states after device disable or reset Dave Jiang
2020-07-27  9:17 ` Vinod Koul
2020-07-27 14:47   ` Dave Jiang [this message]

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=3e41f488-4015-f980-53e4-ea58c31f253b@intel.com \
    --to=dave.jiang@intel.com \
    --cc=dmaengine@vger.kernel.org \
    --cc=mona.hossain@intel.com \
    --cc=vkoul@kernel.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).