Commit 25c6ffb2 authored by Tadeusz Struk's avatar Tadeusz Struk Committed by Herbert Xu

crypto: qat - check if PF is running

Before VF sends a signal to PF it should check if PF
is still running.
Tested-by: default avatarSuman Bangalore Sathyanarayana <sumanx.bangalore.sathyanarayana@intel.com>
Signed-off-by: default avatarTadeusz Struk <tadeusz.struk@intel.com>
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
parent 02dc8d63
...@@ -238,6 +238,8 @@ static int adf_probe(struct pci_dev *pdev, const struct pci_device_id *ent) ...@@ -238,6 +238,8 @@ static int adf_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
if (ret) if (ret)
goto out_err_free_reg; goto out_err_free_reg;
set_bit(ADF_STATUS_PF_RUNNING, &accel_dev->status);
ret = adf_dev_init(accel_dev); ret = adf_dev_init(accel_dev);
if (ret) if (ret)
goto out_err_dev_shutdown; goto out_err_dev_shutdown;
......
...@@ -238,6 +238,8 @@ static int adf_probe(struct pci_dev *pdev, const struct pci_device_id *ent) ...@@ -238,6 +238,8 @@ static int adf_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
if (ret) if (ret)
goto out_err_free_reg; goto out_err_free_reg;
set_bit(ADF_STATUS_PF_RUNNING, &accel_dev->status);
ret = adf_dev_init(accel_dev); ret = adf_dev_init(accel_dev);
if (ret) if (ret)
goto out_err_dev_shutdown; goto out_err_dev_shutdown;
......
...@@ -67,7 +67,7 @@ ...@@ -67,7 +67,7 @@
#define ADF_STATUS_AE_INITIALISED 4 #define ADF_STATUS_AE_INITIALISED 4
#define ADF_STATUS_AE_UCODE_LOADED 5 #define ADF_STATUS_AE_UCODE_LOADED 5
#define ADF_STATUS_AE_STARTED 6 #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 #define ADF_STATUS_IRQ_ALLOCATED 8
enum adf_dev_reset_mode { enum adf_dev_reset_mode {
......
...@@ -66,6 +66,7 @@ int adf_vf2pf_init(struct adf_accel_dev *accel_dev) ...@@ -66,6 +66,7 @@ int adf_vf2pf_init(struct adf_accel_dev *accel_dev)
"Failed to send Init event to PF\n"); "Failed to send Init event to PF\n");
return -EFAULT; return -EFAULT;
} }
set_bit(ADF_STATUS_PF_RUNNING, &accel_dev->status);
return 0; return 0;
} }
EXPORT_SYMBOL_GPL(adf_vf2pf_init); EXPORT_SYMBOL_GPL(adf_vf2pf_init);
...@@ -83,8 +84,9 @@ void adf_vf2pf_shutdown(struct adf_accel_dev *accel_dev) ...@@ -83,8 +84,9 @@ void adf_vf2pf_shutdown(struct adf_accel_dev *accel_dev)
u32 msg = (ADF_VF2PF_MSGORIGIN_SYSTEM | u32 msg = (ADF_VF2PF_MSGORIGIN_SYSTEM |
(ADF_VF2PF_MSGTYPE_SHUTDOWN << ADF_VF2PF_MSGTYPE_SHIFT)); (ADF_VF2PF_MSGTYPE_SHUTDOWN << ADF_VF2PF_MSGTYPE_SHIFT));
if (adf_iov_putmsg(accel_dev, msg, 0)) if (test_bit(ADF_STATUS_PF_RUNNING, &accel_dev->status))
dev_err(&GET_DEV(accel_dev), if (adf_iov_putmsg(accel_dev, msg, 0))
"Failed to send Shutdown event to PF\n"); dev_err(&GET_DEV(accel_dev),
"Failed to send Shutdown event to PF\n");
} }
EXPORT_SYMBOL_GPL(adf_vf2pf_shutdown); EXPORT_SYMBOL_GPL(adf_vf2pf_shutdown);
...@@ -135,6 +135,8 @@ static void adf_pf2vf_bh_handler(void *data) ...@@ -135,6 +135,8 @@ static void adf_pf2vf_bh_handler(void *data)
dev_dbg(&GET_DEV(accel_dev), dev_dbg(&GET_DEV(accel_dev),
"Restarting msg received from PF 0x%x\n", msg); "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); stop_data = kzalloc(sizeof(*stop_data), GFP_ATOMIC);
if (!stop_data) { if (!stop_data) {
dev_err(&GET_DEV(accel_dev), dev_err(&GET_DEV(accel_dev),
......
...@@ -238,6 +238,8 @@ static int adf_probe(struct pci_dev *pdev, const struct pci_device_id *ent) ...@@ -238,6 +238,8 @@ static int adf_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
if (ret) if (ret)
goto out_err_free_reg; goto out_err_free_reg;
set_bit(ADF_STATUS_PF_RUNNING, &accel_dev->status);
ret = adf_dev_init(accel_dev); ret = adf_dev_init(accel_dev);
if (ret) if (ret)
goto out_err_dev_shutdown; goto out_err_dev_shutdown;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment