crypto: qat - check if PF is running
authorTadeusz Struk <tadeusz.struk@intel.com>
Fri, 15 Apr 2016 17:37:59 +0000 (10:37 -0700)
committerHerbert Xu <herbert@gondor.apana.org.au>
Mon, 18 Apr 2016 10:49:51 +0000 (18:49 +0800)
Before VF sends a signal to PF it should check if PF
is still running.

Tested-by: Suman Bangalore Sathyanarayana <sumanx.bangalore.sathyanarayana@intel.com>
Signed-off-by: Tadeusz Struk <tadeusz.struk@intel.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
drivers/crypto/qat/qat_c3xxxvf/adf_drv.c
drivers/crypto/qat/qat_c62xvf/adf_drv.c
drivers/crypto/qat/qat_common/adf_common_drv.h
drivers/crypto/qat/qat_common/adf_vf2pf_msg.c
drivers/crypto/qat/qat_common/adf_vf_isr.c
drivers/crypto/qat/qat_dh895xccvf/adf_drv.c

index a998981e9610b69e3173041c7d3291c987f62c7f..949d77b79fbe3d5cbf7ea92c7f2ae6dbfe43d97f 100644 (file)
@@ -238,6 +238,8 @@ static int adf_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
        if (ret)
                goto out_err_free_reg;
 
+       set_bit(ADF_STATUS_PF_RUNNING, &accel_dev->status);
+
        ret = adf_dev_init(accel_dev);
        if (ret)
                goto out_err_dev_shutdown;
index ccfb25e8a4a16e3ebed908399406c1a87cd0f1d7..7540ce13b0d067dd2d6b27bb53bf23e4e50f334f 100644 (file)
@@ -238,6 +238,8 @@ static int adf_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
        if (ret)
                goto out_err_free_reg;
 
+       set_bit(ADF_STATUS_PF_RUNNING, &accel_dev->status);
+
        ret = adf_dev_init(accel_dev);
        if (ret)
                goto out_err_dev_shutdown;
index a8100a37ee0ce2c86b6c459fd7b98af9cea0eb10..557ea361d385cb19cc071ff5d6fc68b63d09b2e1 100644 (file)
@@ -67,7 +67,7 @@
 #define ADF_STATUS_AE_INITIALISED 4
 #define ADF_STATUS_AE_UCODE_LOADED 5
 #define ADF_STATUS_AE_STARTED 6
-#define ADF_STATUS_ORPHAN_TH_RUNNING 7
+#define ADF_STATUS_PF_RUNNING 7
 #define ADF_STATUS_IRQ_ALLOCATED 8
 
 enum adf_dev_reset_mode {
index 5f1d863ae8022bb8423f3899f97ca0c802fe329c..cd5f37dffe8a61c9ade5503fb72483e3b0c1cf57 100644 (file)
@@ -66,6 +66,7 @@ int adf_vf2pf_init(struct adf_accel_dev *accel_dev)
                        "Failed to send Init event to PF\n");
                return -EFAULT;
        }
+       set_bit(ADF_STATUS_PF_RUNNING, &accel_dev->status);
        return 0;
 }
 EXPORT_SYMBOL_GPL(adf_vf2pf_init);
@@ -83,8 +84,9 @@ void adf_vf2pf_shutdown(struct adf_accel_dev *accel_dev)
        u32 msg = (ADF_VF2PF_MSGORIGIN_SYSTEM |
            (ADF_VF2PF_MSGTYPE_SHUTDOWN << ADF_VF2PF_MSGTYPE_SHIFT));
 
-       if (adf_iov_putmsg(accel_dev, msg, 0))
-               dev_err(&GET_DEV(accel_dev),
-                       "Failed to send Shutdown event to PF\n");
+       if (test_bit(ADF_STATUS_PF_RUNNING, &accel_dev->status))
+               if (adf_iov_putmsg(accel_dev, msg, 0))
+                       dev_err(&GET_DEV(accel_dev),
+                               "Failed to send Shutdown event to PF\n");
 }
 EXPORT_SYMBOL_GPL(adf_vf2pf_shutdown);
index c3d5016814665c90b6325291d24b040c1c3d7851..5d45796576eede51b11030e07a40918d782cb7d8 100644 (file)
@@ -135,6 +135,8 @@ static void adf_pf2vf_bh_handler(void *data)
                dev_dbg(&GET_DEV(accel_dev),
                        "Restarting msg received from PF 0x%x\n", msg);
 
+               clear_bit(ADF_STATUS_PF_RUNNING, &accel_dev->status);
+
                stop_data = kzalloc(sizeof(*stop_data), GFP_ATOMIC);
                if (!stop_data) {
                        dev_err(&GET_DEV(accel_dev),
index 1bf753244230fba097776f07524f308e8ee6c23a..60df98632fa2dc2d40f9e6e400f5b129cf300ae1 100644 (file)
@@ -238,6 +238,8 @@ static int adf_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
        if (ret)
                goto out_err_free_reg;
 
+       set_bit(ADF_STATUS_PF_RUNNING, &accel_dev->status);
+
        ret = adf_dev_init(accel_dev);
        if (ret)
                goto out_err_dev_shutdown;