summaryrefslogtreecommitdiff
path: root/drivers/crypto/qat
diff options
context:
space:
mode:
authorTadeusz Struk <tadeusz.struk@intel.com>2016-03-29 10:20:52 -0700
committerHerbert Xu <herbert@gondor.apana.org.au>2016-04-05 20:35:53 +0800
commitcb00bca42f8b819498b2647f24b6148d65ec9aa4 (patch)
tree468089b98bb5f57865f3ec3a139cfb2ead49a089 /drivers/crypto/qat
parent4218ebe8cab421c72f134cca1374e0985303f34a (diff)
crypto: qat - explicitly stop all VFs first
When stopping devices it is not enought to loop backwards. We need to explicitly stop all VFs first. Signed-off-by: Tadeusz Struk <tadeusz.struk@intel.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'drivers/crypto/qat')
-rw-r--r--drivers/crypto/qat/qat_common/adf_ctl_drv.c21
1 files changed, 20 insertions, 1 deletions
diff --git a/drivers/crypto/qat/qat_common/adf_ctl_drv.c b/drivers/crypto/qat/qat_common/adf_ctl_drv.c
index 5c897e6e7994..740335630c57 100644
--- a/drivers/crypto/qat/qat_common/adf_ctl_drv.c
+++ b/drivers/crypto/qat/qat_common/adf_ctl_drv.c
@@ -275,7 +275,26 @@ static int adf_ctl_stop_devices(uint32_t id)
struct adf_accel_dev *accel_dev;
int ret = 0;
- list_for_each_entry_reverse(accel_dev, adf_devmgr_get_head(), list) {
+ list_for_each_entry(accel_dev, adf_devmgr_get_head(), list) {
+ if (id == accel_dev->accel_id || id == ADF_CFG_ALL_DEVICES) {
+ if (!adf_dev_started(accel_dev))
+ continue;
+
+ /* First stop all VFs */
+ if (!accel_dev->is_vf)
+ continue;
+
+ if (adf_dev_stop(accel_dev)) {
+ dev_err(&GET_DEV(accel_dev),
+ "Failed to stop qat_dev%d\n", id);
+ ret = -EFAULT;
+ } else {
+ adf_dev_shutdown(accel_dev);
+ }
+ }
+ }
+
+ list_for_each_entry(accel_dev, adf_devmgr_get_head(), list) {
if (id == accel_dev->accel_id || id == ADF_CFG_ALL_DEVICES) {
if (!adf_dev_started(accel_dev))
continue;