Commit 605b84ae authored by Wojciech Ziemba's avatar Wojciech Ziemba Committed by Herbert Xu

crypto: qat - add misc workqueue

In an effort to reduce the amount of workqueues, scattered across
the QAT driver, introduce the misc workqueue. This queue will be used
to handle bottom halves, Power Management and more in the future.

The function adf_misc_wq_queue_work() has been added to simplify
the enqueuing of jobs.
Signed-off-by: default avatarWojciech Ziemba <wojciech.ziemba@intel.com>
Reviewed-by: default avatarGiovanni Cabiddu <giovanni.cabiddu@intel.com>
Reviewed-by: default avatarMarco Chiappero <marco.chiappero@intel.com>
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
parent f60bbbbe
...@@ -188,6 +188,9 @@ int qat_uclo_map_obj(struct icp_qat_fw_loader_handle *handle, ...@@ -188,6 +188,9 @@ int qat_uclo_map_obj(struct icp_qat_fw_loader_handle *handle,
void *addr_ptr, u32 mem_size, char *obj_name); void *addr_ptr, u32 mem_size, char *obj_name);
int qat_uclo_set_cfg_ae_mask(struct icp_qat_fw_loader_handle *handle, int qat_uclo_set_cfg_ae_mask(struct icp_qat_fw_loader_handle *handle,
unsigned int cfg_ae_mask); unsigned int cfg_ae_mask);
int adf_init_misc_wq(void);
void adf_exit_misc_wq(void);
bool adf_misc_wq_queue_work(struct work_struct *work);
#if defined(CONFIG_PCI_IOV) #if defined(CONFIG_PCI_IOV)
int adf_sriov_configure(struct pci_dev *pdev, int numvfs); int adf_sriov_configure(struct pci_dev *pdev, int numvfs);
void adf_disable_sriov(struct adf_accel_dev *accel_dev); void adf_disable_sriov(struct adf_accel_dev *accel_dev);
......
...@@ -419,6 +419,9 @@ static int __init adf_register_ctl_device_driver(void) ...@@ -419,6 +419,9 @@ static int __init adf_register_ctl_device_driver(void)
if (adf_chr_drv_create()) if (adf_chr_drv_create())
goto err_chr_dev; goto err_chr_dev;
if (adf_init_misc_wq())
goto err_misc_wq;
if (adf_init_aer()) if (adf_init_aer())
goto err_aer; goto err_aer;
...@@ -440,6 +443,8 @@ static int __init adf_register_ctl_device_driver(void) ...@@ -440,6 +443,8 @@ static int __init adf_register_ctl_device_driver(void)
err_pf_wq: err_pf_wq:
adf_exit_aer(); adf_exit_aer();
err_aer: err_aer:
adf_exit_misc_wq();
err_misc_wq:
adf_chr_drv_destroy(); adf_chr_drv_destroy();
err_chr_dev: err_chr_dev:
mutex_destroy(&adf_ctl_lock); mutex_destroy(&adf_ctl_lock);
...@@ -449,6 +454,7 @@ static int __init adf_register_ctl_device_driver(void) ...@@ -449,6 +454,7 @@ static int __init adf_register_ctl_device_driver(void)
static void __exit adf_unregister_ctl_device_driver(void) static void __exit adf_unregister_ctl_device_driver(void)
{ {
adf_chr_drv_destroy(); adf_chr_drv_destroy();
adf_exit_misc_wq();
adf_exit_aer(); adf_exit_aer();
adf_exit_vf_wq(); adf_exit_vf_wq();
adf_exit_pf_wq(); adf_exit_pf_wq();
......
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
#include "adf_transport_internal.h" #include "adf_transport_internal.h"
#define ADF_MAX_NUM_VFS 32 #define ADF_MAX_NUM_VFS 32
static struct workqueue_struct *adf_misc_wq;
static int adf_enable_msix(struct adf_accel_dev *accel_dev) static int adf_enable_msix(struct adf_accel_dev *accel_dev)
{ {
...@@ -341,3 +342,30 @@ int adf_isr_resource_alloc(struct adf_accel_dev *accel_dev) ...@@ -341,3 +342,30 @@ int adf_isr_resource_alloc(struct adf_accel_dev *accel_dev)
return ret; return ret;
} }
EXPORT_SYMBOL_GPL(adf_isr_resource_alloc); EXPORT_SYMBOL_GPL(adf_isr_resource_alloc);
/**
* adf_init_misc_wq() - Init misc workqueue
*
* Function init workqueue 'qat_misc_wq' for general purpose.
*
* Return: 0 on success, error code otherwise.
*/
int __init adf_init_misc_wq(void)
{
adf_misc_wq = alloc_workqueue("qat_misc_wq", WQ_MEM_RECLAIM, 0);
return !adf_misc_wq ? -ENOMEM : 0;
}
void adf_exit_misc_wq(void)
{
if (adf_misc_wq)
destroy_workqueue(adf_misc_wq);
adf_misc_wq = NULL;
}
bool adf_misc_wq_queue_work(struct work_struct *work)
{
return queue_work(adf_misc_wq, work);
}
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