crypto: qat - cumulative fixes
cover crypto: qat - cumulative fixes
This is a collection of various fixes and improvements, mostly related to PFVF, from various authors.
A previous version of this set was already sent to this list a few weeks ago. I didn't call this V2 since a number of patches were added/removed to the set and the order of the patches changed.
Ahsan Atta (1):
crypto: qat - flush vf workqueue at driver removal
Giovanni Cabiddu (7):
crypto: qat - use proper type for vf_mask
crypto: qat - do not ignore errors from enable_vf2pf_comms()
crypto: qat - handle both source of interrupt in VF ISR
crypto: qat - prevent spurious MSI interrupt in VF
crypto: qat - move IO virtualization functions
crypto: qat - do not export adf_iov_putmsg()
crypto: qat - store vf.compatible flag
Kanchana Velusamy (1):
crypto: qat - protect interrupt mask CSRs with a spinlock
Marco Chiappero (10):
crypto: qat - remove empty sriov_configure()
crypto: qat - enable interrupts only after ISR allocation
crypto: qat - prevent spurious MSI interrupt in PF
crypto: qat - rename compatibility version definition
crypto: qat - fix reuse of completion variable
crypto: qat - move pf2vf interrupt [en|dis]able to adf_vf_isr.c
crypto: qat - fix naming for init/shutdown VF to PF notifications
crypto: qat - complete all the init steps before service notification
crypto: qat - fix naming of PF/VF enable functions
crypto: qat - remove the unnecessary get_vintmsk_offset()
Svyatoslav Pankratov (1):
crypto: qat - remove intermediate tasklet for vf2pf
.../crypto/qat/qat_4xxx/adf_4xxx_hw_data.c | 8 +- .../crypto/qat/qat_c3xxx/adf_c3xxx_hw_data.c | 19 ++--- .../crypto/qat/qat_c3xxx/adf_c3xxx_hw_data.h | 1 - .../qat/qat_c3xxxvf/adf_c3xxxvf_hw_data.c | 14 +--- .../qat/qat_c3xxxvf/adf_c3xxxvf_hw_data.h | 1 - drivers/crypto/qat/qat_c3xxxvf/adf_drv.c | 1 + .../crypto/qat/qat_c62x/adf_c62x_hw_data.c | 19 ++--- .../crypto/qat/qat_c62x/adf_c62x_hw_data.h | 1 - .../qat/qat_c62xvf/adf_c62xvf_hw_data.c | 14 +--- .../qat/qat_c62xvf/adf_c62xvf_hw_data.h | 1 - drivers/crypto/qat/qat_c62xvf/adf_drv.c | 1 + .../crypto/qat/qat_common/adf_accel_devices.h | 8 +- .../crypto/qat/qat_common/adf_common_drv.h | 21 +++-- drivers/crypto/qat/qat_common/adf_init.c | 13 ++-- drivers/crypto/qat/qat_common/adf_isr.c | 42 ++++++---- drivers/crypto/qat/qat_common/adf_pf2vf_msg.c | 78 +++++++++++-------- drivers/crypto/qat/qat_common/adf_pf2vf_msg.h | 2 +- drivers/crypto/qat/qat_common/adf_sriov.c | 8 +- drivers/crypto/qat/qat_common/adf_vf2pf_msg.c | 12 +-- drivers/crypto/qat/qat_common/adf_vf_isr.c | 64 ++++++++++++++- .../qat/qat_dh895xcc/adf_dh895xcc_hw_data.c | 19 ++--- .../qat/qat_dh895xcc/adf_dh895xcc_hw_data.h | 1 - .../qat_dh895xccvf/adf_dh895xccvf_hw_data.c | 14 +--- .../qat_dh895xccvf/adf_dh895xccvf_hw_data.h | 1 - drivers/crypto/qat/qat_dh895xccvf/adf_drv.c | 1 + 25 files changed, 207 insertions(+), 157 deletions(-)
Signature · 1 line
2.31.1
PATCH 1/20 crypto: qat - use proper type for vf_mask
Replace vf_mask type with unsigned long to avoid a stack-out-of-bound.
This is to fix the following warning reported by KASAN the first time adf_msix_isr_ae() gets called.
[ 692.091987] BUG: KASAN: stack-out-of-bounds in find_first_bit+0x28/0x50
[ 692.092017] Read of size 8 at addr ffff88afdf789e60 by task swapper/32/0
[ 692.092076] Call Trace:
[ 692.092089] <IRQ>
[ 692.092101] dump_stack+0x9c/0xcf
[ 692.092132] print_address_description.constprop.0+0x18/0x130
[ 692.092164] ? find_first_bit+0x28/0x50
[ 692.092185] kasan_report.cold+0x7f/0x111
[ 692.092213] ? static_obj+0x10/0x80
[ 692.092234] ? find_first_bit+0x28/0x50
[ 692.092262] find_first_bit+0x28/0x50
[ 692.092288] adf_msix_isr_ae+0x16e/0x230 [intel_qat]--- drivers/crypto/qat/qat_common/adf_isr.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/crypto/qat/qat_common/adf_isr.c +4 -3
@@ -15,6 +15,8 @@#include "adf_transport_access_macros.h" #include "adf_transport_internal.h" +#define ADF_MAX_NUM_VFS 32 +static int adf_enable_msix (struct adf_accel_dev *accel_dev) {struct adf_accel_pci *pci_dev_info = &accel_dev->accel_pci_dev;
@@ -72,7 +74,7 @@ static irqreturn_t adf_msix_isr_ae(int irq, void *dev_ptr)struct adf_bar *pmisc = &GET_BARS (accel_dev)[hw_data->get_misc_bar_id (hw_data)];void __iomem *pmisc_bar_addr = pmisc->virt_addr; -u32 vf_mask; +unsigned long vf_mask;/* Get the interrupt sources triggered by VFs */ vf_mask = ((ADF_CSR_RD(pmisc_bar_addr, ADF_ERRSOU5) &
@@ -93,8 +95,7 @@ static irqreturn_t adf_msix_isr_ae(int irq, void *dev_ptr)* unless the VF is malicious and is attempting to * flood the host OS with VF2PF interrupts. */ -for_each_set_bit (i, (const unsigned long *)&vf_mask, - (sizeof (vf_mask) *BITS_PER_BYTE )) { +for_each_set_bit (i, &vf_mask,ADF_MAX_NUM_VFS ) { vf_info = accel_dev->pf.vf_info + i;if (!__ratelimit (&vf_info->vf2pf_ratelimit)) {
Signature · 1 line
2.31.1
PATCH 2/20 crypto: qat - remove empty sriov_configure()
In reply to Giovanni CabidduFrom: Marco Chiappero <[email protected]>
Remove the empty implementation of sriov_configure() and set the sriov_configure member of the pci_driver structure to NULL. This way, if a user tries to enable VFs on a device, when kernel and driver are built with CONFIG_PCI_IOV=n, the kernel reports an error message saying that the driver does not support SRIOV configuration via sysfs.
--- drivers/crypto/qat/qat_common/adf_common_drv.h | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/crypto/qat/qat_common/adf_common_drv.h +1 -4
@@ -205,10 +205,7 @@ void adf_exit_pf_wq(void);int adf_init_vf_wq (void );void adf_exit_vf_wq (void );#else -static inline int adf_sriov_configure (struct pci_dev *pdev,int numvfs) -{ -return 0 ; -} +#define adf_sriov_configure NULLstatic inline void adf_disable_sriov (struct adf_accel_dev *accel_dev) {
Signature · 1 line
2.31.1
PATCH 3/20 crypto: qat - enable interrupts only after ISR allocation
In reply to Giovanni CabidduFrom: Marco Chiappero <[email protected]>
Enable device interrupts after the setup of the interrupt handlers.
--- drivers/crypto/qat/qat_common/adf_init.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/crypto/qat/qat_common/adf_init.c +2 -2
@@ -88,8 +88,6 @@ int adf_dev_init(struct adf_accel_dev *accel_dev)return -EFAULT ; } - hw_data->enable_ints (accel_dev); -if (adf_ae_init (accel_dev)) {dev_err (&GET_DEV (accel_dev),"Failed to initialise Acceleration Engine\n" );
@@ -110,6 +108,8 @@ int adf_dev_init(struct adf_accel_dev *accel_dev) }set_bit (ADF_STATUS_IRQ_ALLOCATED , &accel_dev->status); + hw_data->enable_ints (accel_dev); +/* * Subservice initialisation is divided into two stages: init and start. * This is to facilitate any ordering dependencies between services
Signature · 1 line
2.31.1
PATCH 4/20 crypto: qat - do not ignore errors from enable_vf2pf_comms()
In reply to Giovanni CabidduThe function adf_dev_init() ignores the error code reported by enable_vf2pf_comms(). If the latter fails, e.g. the VF is not compatible with the pf, then the load of the VF driver progresses.
This patch changes adf_dev_init() so that the error code from enable_vf2pf_comms() is returned to the caller.
--- drivers/crypto/qat/qat_common/adf_init.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/crypto/qat/qat_common/adf_init.c +3 -2
@@ -61,6 +61,7 @@ int adf_dev_init(struct adf_accel_dev *accel_dev)struct service_hndl *service;struct list_head *list_itr;struct adf_hw_device_data *hw_data = accel_dev->hw_device; +int ret;if (!hw_data) { dev_err(&GET_DEV(accel_dev),
@@ -127,9 +128,9 @@ int adf_dev_init(struct adf_accel_dev *accel_dev) } hw_data->enable_error_correction (accel_dev); - hw_data->enable_vf2pf_comms (accel_dev); + ret = hw_data->enable_vf2pf_comms (accel_dev); -return 0 ; +return ret; }EXPORT_SYMBOL_GPL (adf_dev_init);
Signature · 1 line
2.31.1
PATCH 5/20 crypto: qat - handle both source of interrupt in VF ISR
In reply to Giovanni CabidduThe top half of the VF drivers handled only a source at the time. If an interrupt for PF2VF and bundle occurred at the same time, the ISR scheduled only the bottom half for PF2VF.
This patch fixes the VF top half so that if both sources of interrupt trigger at the same time, both bottom halves are scheduled.
This patch is based on earlier work done by Conor McLoughlin.
--- drivers/crypto/qat/qat_common/adf_vf_isr.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/crypto/qat/qat_common/adf_vf_isr.c +4 -3
@@ -160,6 +160,7 @@ static irqreturn_t adf_isr(int irq, void *privdata)struct adf_bar *pmisc = &GET_BARS (accel_dev)[hw_data->get_misc_bar_id (hw_data)];void __iomem *pmisc_bar_addr = pmisc->virt_addr; +bool handled = false;u32 v_int;/* Read VF INT source CSR to determine the source of VF interrupt */
@@ -172,7 +173,7 @@ static irqreturn_t adf_isr(int irq, void *privdata)/* Schedule tasklet to handle interrupt BH */ tasklet_hi_schedule (&accel_dev->vf.pf2vf_bh_tasklet); -return IRQ_HANDLED ; + handled = true; }/* Check bundle interrupt */
@@ -184,10 +185,10 @@ static irqreturn_t adf_isr(int irq, void *privdata) csr_ops->write_csr_int_flag_and_col (bank->csr_addr, bank->bank_number,0 );tasklet_hi_schedule (&bank->resp_handler); -return IRQ_HANDLED ; + handled = true; } -return IRQ_NONE ; +return handled ?IRQ_HANDLED :IRQ_NONE ; }static int adf_request_msi_irq (struct adf_accel_dev *accel_dev)
Signature · 1 line
2.31.1
PATCH 6/20 crypto: qat - prevent spurious MSI interrupt in VF
In reply to Giovanni CabidduQAT GEN2 devices suffer from a defect where the MSI interrupt can be sent multiple times.
If the second (spurious) interrupt is handled before the bottom half handler runs, then the extra interrupt is effectively ignored because the bottom half is only scheduled once.
However, if the top half runs again after the bottom half runs, this will appear as a spurious PF to VF interrupt.
This can be avoided by checking the interrupt mask register in addition to the interrupt source register in the interrupt handler.
This patch is based on earlier work done by Conor McLoughlin.
--- drivers/crypto/qat/qat_common/adf_vf_isr.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-)
drivers/crypto/qat/qat_common/adf_vf_isr.c +11 -1
@@ -18,6 +18,7 @@#include "adf_pf2vf_msg.h" #define ADF_VINTSOU_OFFSET 0x204 +#define ADF_VINTMSK_OFFSET 0x208#define ADF_VINTSOU_BUN BIT(0)#define ADF_VINTSOU_PF2VF BIT(1)
@@ -161,11 +162,20 @@ static irqreturn_t adf_isr(int irq, void *privdata) &GET_BARS (accel_dev)[hw_data->get_misc_bar_id (hw_data)];void __iomem *pmisc_bar_addr = pmisc->virt_addr;bool handled = false; -u32 v_int; +u32 v_int, v_mask;/* Read VF INT source CSR to determine the source of VF interrupt */ v_int =ADF_CSR_RD (pmisc_bar_addr,ADF_VINTSOU_OFFSET ); +/* Read VF INT mask CSR to determine which sources are masked */ + v_mask =ADF_CSR_RD (pmisc_bar_addr,ADF_VINTMSK_OFFSET ); + +/* +* Recompute v_int ignoring sources that are masked. This is to +* avoid rescheduling the tasklet for interrupts already handled +*/ + v_int &= ~v_mask; +/* Check for PF2VF interrupt */ if (v_int &ADF_VINTSOU_PF2VF ) {/* Disable PF to VF interrupt */
Signature · 1 line
2.31.1
PATCH 7/20 crypto: qat - prevent spurious MSI interrupt in PF
In reply to Giovanni CabidduFrom: Marco Chiappero <[email protected]>
There is a chance that the PFVF handler, adf_vf2pf_req_hndl(), runs twice for the same request when multiple interrupts come simultaneously from different VFs.
Since the source VF is identified by a positional bit set in the ERRSOU registers and that is not cleared until the bottom half completes, new top halves from other VFs may reschedule a second bottom half for previous interrupts.
This patch solves the problem in the ISR handler by not considering sources with already disabled interrupts (and processing pending), as set in the ERRMSK registers.
Also, move some definitions where actually needed.
--- .../crypto/qat/qat_common/adf_accel_devices.h | 2 -- drivers/crypto/qat/qat_common/adf_isr.c | 25 +++++++++++++++---- 2 files changed, 20 insertions(+), 7 deletions(-)
drivers/crypto/qat/qat_common/adf_accel_devices.h +0 -2
@@ -18,8 +18,6 @@#define ADF_4XXX_DEVICE_NAME "4xxx"#define ADF_4XXX_PCI_DEVICE_ID 0x4940#define ADF_4XXXIOV_PCI_DEVICE_ID 0x4941 -#define ADF_ERRSOU3 (0x3A000 + 0x0C) -#define ADF_ERRSOU5 (0x3A000 + 0xD8)#define ADF_DEVICE_FUSECTL_OFFSET 0x40#define ADF_DEVICE_LEGFUSE_OFFSET 0x4C#define ADF_DEVICE_FUSECTL_MASK 0x80000000
drivers/crypto/qat/qat_common/adf_isr.c +20 -5
@@ -16,6 +16,12 @@#include "adf_transport_internal.h" #define ADF_MAX_NUM_VFS 32 +#define ADF_ERRSOU3 (0x3A000 + 0x0C) +#define ADF_ERRSOU5 (0x3A000 + 0xD8) +#define ADF_ERRMSK3 (0x3A000 + 0x1C) +#define ADF_ERRMSK5 (0x3A000 + 0xDC) +#define ADF_ERR_REG_VF2PF_L (vf_src) (((vf_src) & 0x01FFFE00) >> 9) +#define ADF_ERR_REG_VF2PF_U (vf_src) (((vf_src) & 0x0000FFFF) << 16)static int adf_enable_msix (struct adf_accel_dev *accel_dev) {
@@ -73,14 +79,23 @@ static irqreturn_t adf_msix_isr_ae(int irq, void *dev_ptr)struct adf_hw_device_data *hw_data = accel_dev->hw_device;struct adf_bar *pmisc = &GET_BARS (accel_dev)[hw_data->get_misc_bar_id (hw_data)]; -void __iomem *pmisc_bar_addr = pmisc->virt_addr; +void __iomem *pmisc_addr = pmisc->virt_addr; +u32 errsou3, errsou5, errmsk3, errmsk5;unsigned long vf_mask;/* Get the interrupt sources triggered by VFs */ - vf_mask = ((ADF_CSR_RD (pmisc_bar_addr,ADF_ERRSOU5 ) & -0x0000FFFF ) <<16 ) | - ((ADF_CSR_RD (pmisc_bar_addr,ADF_ERRSOU3 ) & -0x01FFFE00 ) >>9 ); + errsou3 =ADF_CSR_RD (pmisc_addr,ADF_ERRSOU3 ); + errsou5 =ADF_CSR_RD (pmisc_addr,ADF_ERRSOU5 ); + vf_mask =ADF_ERR_REG_VF2PF_L (errsou3); + vf_mask |=ADF_ERR_REG_VF2PF_U (errsou5); + +/* To avoid adding duplicate entries to work queue, clear +* vf_int_mask_sets bits that are already masked in ERRMSK register. +*/ + errmsk3 =ADF_CSR_RD (pmisc_addr,ADF_ERRMSK3 ); + errmsk5 =ADF_CSR_RD (pmisc_addr,ADF_ERRMSK5 ); + vf_mask &= ~ADF_ERR_REG_VF2PF_L (errmsk3); + vf_mask &= ~ADF_ERR_REG_VF2PF_U (errmsk5);if (vf_mask) {struct adf_accel_vf_info *vf_info;
Signature · 1 line
2.31.1
PATCH 8/20 crypto: qat - rename compatibility version definition
In reply to Giovanni CabidduFrom: Marco Chiappero <[email protected]>
Rename ADF_PFVF_COMPATIBILITY_VERSION in ADF_PFVF_COMPAT_THIS_VERSION since it is used to indicate the current version of the PFVF protocol.
--- drivers/crypto/qat/qat_4xxx/adf_4xxx_hw_data.c | 2 +- .../crypto/qat/qat_c3xxx/adf_c3xxx_hw_data.c | 2 +- .../qat/qat_c3xxxvf/adf_c3xxxvf_hw_data.c | 2 +- drivers/crypto/qat/qat_c62x/adf_c62x_hw_data.c | 2 +- .../crypto/qat/qat_c62xvf/adf_c62xvf_hw_data.c | 2 +- drivers/crypto/qat/qat_common/adf_pf2vf_msg.c | 18 +++++++++--------- drivers/crypto/qat/qat_common/adf_pf2vf_msg.h | 2 +- .../qat/qat_dh895xcc/adf_dh895xcc_hw_data.c | 2 +- .../qat_dh895xccvf/adf_dh895xccvf_hw_data.c | 2 +- 9 files changed, 17 insertions(+), 17 deletions(-)
drivers/crypto/qat/qat_4xxx/adf_4xxx_hw_data.c +1 -1
@@ -218,7 +218,7 @@ void adf_init_hw_data_4xxx(struct adf_hw_device_data *hw_data) hw_data->enable_ints = adf_enable_ints; hw_data->enable_vf2pf_comms = adf_pf_enable_vf2pf_comms; hw_data->reset_device = adf_reset_flr; - hw_data->min_iov_compat_ver =ADF_PFVF_COMPATIBILITY_VERSION ; + hw_data->min_iov_compat_ver =ADF_PFVF_COMPAT_THIS_VERSION ; hw_data->admin_ae_mask =ADF_4XXX_ADMIN_AE_MASK ; hw_data->uof_get_num_objs = uof_get_num_objs; hw_data->uof_get_name = uof_get_name;
drivers/crypto/qat/qat_c3xxx/adf_c3xxx_hw_data.c +1 -1
@@ -211,7 +211,7 @@ void adf_init_hw_data_c3xxx(struct adf_hw_device_data *hw_data) hw_data->enable_ints = adf_enable_ints; hw_data->enable_vf2pf_comms = adf_pf_enable_vf2pf_comms; hw_data->reset_device = adf_reset_flr; - hw_data->min_iov_compat_ver =ADF_PFVF_COMPATIBILITY_VERSION ; + hw_data->min_iov_compat_ver =ADF_PFVF_COMPAT_THIS_VERSION ; hw_data->set_ssm_wdtimer = adf_gen2_set_ssm_wdtimer;adf_gen2_init_hw_csr_ops (&hw_data->csr_ops); }
drivers/crypto/qat/qat_c3xxxvf/adf_c3xxxvf_hw_data.c +1 -1
@@ -96,7 +96,7 @@ void adf_init_hw_data_c3xxxiov(struct adf_hw_device_data *hw_data) hw_data->get_sku = get_sku; hw_data->enable_ints = adf_vf_void_noop; hw_data->enable_vf2pf_comms = adf_enable_vf2pf_comms; - hw_data->min_iov_compat_ver =ADF_PFVF_COMPATIBILITY_VERSION ; + hw_data->min_iov_compat_ver =ADF_PFVF_COMPAT_THIS_VERSION ; hw_data->dev_class->instances++;adf_devmgr_update_class_index (hw_data);adf_gen2_init_hw_csr_ops (&hw_data->csr_ops);
drivers/crypto/qat/qat_c62x/adf_c62x_hw_data.c +1 -1
@@ -213,7 +213,7 @@ void adf_init_hw_data_c62x(struct adf_hw_device_data *hw_data) hw_data->enable_ints = adf_enable_ints; hw_data->enable_vf2pf_comms = adf_pf_enable_vf2pf_comms; hw_data->reset_device = adf_reset_flr; - hw_data->min_iov_compat_ver =ADF_PFVF_COMPATIBILITY_VERSION ; + hw_data->min_iov_compat_ver =ADF_PFVF_COMPAT_THIS_VERSION ; hw_data->set_ssm_wdtimer = adf_gen2_set_ssm_wdtimer;adf_gen2_init_hw_csr_ops (&hw_data->csr_ops); }
drivers/crypto/qat/qat_c62xvf/adf_c62xvf_hw_data.c +1 -1
@@ -96,7 +96,7 @@ void adf_init_hw_data_c62xiov(struct adf_hw_device_data *hw_data) hw_data->get_sku = get_sku; hw_data->enable_ints = adf_vf_void_noop; hw_data->enable_vf2pf_comms = adf_enable_vf2pf_comms; - hw_data->min_iov_compat_ver =ADF_PFVF_COMPATIBILITY_VERSION ; + hw_data->min_iov_compat_ver =ADF_PFVF_COMPAT_THIS_VERSION ; hw_data->dev_class->instances++;adf_devmgr_update_class_index (hw_data);adf_gen2_init_hw_csr_ops (&hw_data->csr_ops);
drivers/crypto/qat/qat_common/adf_pf2vf_msg.c +9 -9
@@ -216,7 +216,7 @@ void adf_vf2pf_req_hndl(struct adf_accel_vf_info *vf_info) resp = (ADF_PF2VF_MSGORIGIN_SYSTEM | (ADF_PF2VF_MSGTYPE_VERSION_RESP <<ADF_PF2VF_MSGTYPE_SHIFT ) | - (ADF_PFVF_COMPATIBILITY_VERSION << + (ADF_PFVF_COMPAT_THIS_VERSION <<ADF_PF2VF_VERSION_RESP_VERS_SHIFT )); dev_dbg(&GET_DEV(accel_dev),
@@ -226,19 +226,19 @@ void adf_vf2pf_req_hndl(struct adf_accel_vf_info *vf_info)if (vf_compat_ver < hw_data->min_iov_compat_ver) {dev_err (&GET_DEV (accel_dev),"VF (vers %d) incompatible with PF (vers %d)\n" , - vf_compat_ver,ADF_PFVF_COMPATIBILITY_VERSION ); + vf_compat_ver,ADF_PFVF_COMPAT_THIS_VERSION ); resp |=ADF_PF2VF_VF_INCOMPATIBLE <<ADF_PF2VF_VERSION_RESP_RESULT_SHIFT ; - }else if (vf_compat_ver >ADF_PFVF_COMPATIBILITY_VERSION ) { + }else if (vf_compat_ver >ADF_PFVF_COMPAT_THIS_VERSION ) {dev_err (&GET_DEV (accel_dev),"VF (vers %d) compat with PF (vers %d) unkn.\n" , - vf_compat_ver,ADF_PFVF_COMPATIBILITY_VERSION ); + vf_compat_ver,ADF_PFVF_COMPAT_THIS_VERSION ); resp |=ADF_PF2VF_VF_COMPAT_UNKNOWN <<ADF_PF2VF_VERSION_RESP_RESULT_SHIFT ; }else {dev_dbg (&GET_DEV (accel_dev),"VF (vers %d) compatible with PF (vers %d)\n" , - vf_compat_ver,ADF_PFVF_COMPATIBILITY_VERSION ); + vf_compat_ver,ADF_PFVF_COMPAT_THIS_VERSION ); resp |=ADF_PF2VF_VF_COMPATIBLE <<ADF_PF2VF_VERSION_RESP_RESULT_SHIFT ; }
@@ -251,7 +251,7 @@ void adf_vf2pf_req_hndl(struct adf_accel_vf_info *vf_info) resp = (ADF_PF2VF_MSGORIGIN_SYSTEM | (ADF_PF2VF_MSGTYPE_VERSION_RESP <<ADF_PF2VF_MSGTYPE_SHIFT ) | - (ADF_PFVF_COMPATIBILITY_VERSION << + (ADF_PFVF_COMPAT_THIS_VERSION <<ADF_PF2VF_VERSION_RESP_VERS_SHIFT )); resp |=ADF_PF2VF_VF_COMPATIBLE <<ADF_PF2VF_VERSION_RESP_RESULT_SHIFT ;
@@ -313,8 +313,8 @@ static int adf_vf2pf_request_version(struct adf_accel_dev *accel_dev) msg =ADF_VF2PF_MSGORIGIN_SYSTEM ; msg |=ADF_VF2PF_MSGTYPE_COMPAT_VER_REQ <<ADF_VF2PF_MSGTYPE_SHIFT ; - msg |=ADF_PFVF_COMPATIBILITY_VERSION <<ADF_VF2PF_COMPAT_VER_REQ_SHIFT ; -BUILD_BUG_ON (ADF_PFVF_COMPATIBILITY_VERSION >255 ); + msg |=ADF_PFVF_COMPAT_THIS_VERSION <<ADF_VF2PF_COMPAT_VER_REQ_SHIFT ; +BUILD_BUG_ON (ADF_PFVF_COMPAT_THIS_VERSION >255 );/* Send request from VF to PF */ ret =adf_iov_putmsg (accel_dev, msg,0 );
@@ -345,7 +345,7 @@ static int adf_vf2pf_request_version(struct adf_accel_dev *accel_dev)dev_err (&GET_DEV (accel_dev),"PF (vers %d) and VF (vers %d) are not compatible\n" , accel_dev->vf.pf_version, -ADF_PFVF_COMPATIBILITY_VERSION ); +ADF_PFVF_COMPAT_THIS_VERSION );return -EINVAL ;default : dev_err(&GET_DEV(accel_dev),
drivers/crypto/qat/qat_common/adf_pf2vf_msg.h +1 -1
@@ -52,7 +52,7 @@* IN_USE_BY pattern as part of a collision control scheme (see adf_iov_putmsg). */ -#define ADF_PFVF_COMPATIBILITY_VERSION 0x1/* PF<->VF compat */ +#define ADF_PFVF_COMPAT_THIS_VERSION 0x1/* PF<->VF compat */ /* PF->VF messages */ #define ADF_PF2VF_INT BIT(0)
drivers/crypto/qat/qat_dh895xcc/adf_dh895xcc_hw_data.c +1 -1
@@ -232,7 +232,7 @@ void adf_init_hw_data_dh895xcc(struct adf_hw_device_data *hw_data) hw_data->enable_ints = adf_enable_ints; hw_data->enable_vf2pf_comms = adf_pf_enable_vf2pf_comms; hw_data->reset_device = adf_reset_sbr; - hw_data->min_iov_compat_ver =ADF_PFVF_COMPATIBILITY_VERSION ; + hw_data->min_iov_compat_ver =ADF_PFVF_COMPAT_THIS_VERSION ;adf_gen2_init_hw_csr_ops (&hw_data->csr_ops); }
drivers/crypto/qat/qat_dh895xccvf/adf_dh895xccvf_hw_data.c +1 -1
@@ -96,7 +96,7 @@ void adf_init_hw_data_dh895xcciov(struct adf_hw_device_data *hw_data) hw_data->get_sku = get_sku; hw_data->enable_ints = adf_vf_void_noop; hw_data->enable_vf2pf_comms = adf_enable_vf2pf_comms; - hw_data->min_iov_compat_ver =ADF_PFVF_COMPATIBILITY_VERSION ; + hw_data->min_iov_compat_ver =ADF_PFVF_COMPAT_THIS_VERSION ; hw_data->dev_class->instances++;adf_devmgr_update_class_index (hw_data);adf_gen2_init_hw_csr_ops (&hw_data->csr_ops);
Signature · 1 line
2.31.1
PATCH 9/20 crypto: qat - remove intermediate tasklet for vf2pf
In reply to Giovanni CabidduFrom: Svyatoslav Pankratov <[email protected]>
The PF driver uses the tasklet vf2pf_bh_tasklet to schedule a workqueue to handle the vf2vf protocol (pf2vf_resp_wq).
Since the tasklet is only used to schedule the workqueue, this patch removes it and schedules the pf2vf_resp_wq workqueue directly for the top half.
--- drivers/crypto/qat/qat_common/adf_accel_devices.h | 1 - drivers/crypto/qat/qat_common/adf_common_drv.h | 1 + drivers/crypto/qat/qat_common/adf_isr.c | 8 +++----- drivers/crypto/qat/qat_common/adf_sriov.c | 8 +------- 4 files changed, 5 insertions(+), 13 deletions(-)
drivers/crypto/qat/qat_common/adf_accel_devices.h +0 -1
@@ -225,7 +225,6 @@ struct adf_fw_loader_data {struct adf_accel_vf_info {struct adf_accel_dev *accel_dev; -struct tasklet_struct vf2pf_bh_tasklet;struct mutex pf2vf_lock;/* protect CSR access for PF2VF messages */ struct ratelimit_state vf2pf_ratelimit;u32 vf_nr;
drivers/crypto/qat/qat_common/adf_common_drv.h +1 -0
@@ -197,6 +197,7 @@ void adf_enable_vf2pf_interrupts(struct adf_accel_dev *accel_dev, u32 vf_mask);void adf_enable_pf2vf_interrupts (struct adf_accel_dev *accel_dev);void adf_disable_pf2vf_interrupts (struct adf_accel_dev *accel_dev); +void adf_schedule_vf2pf_handler (struct adf_accel_vf_info *vf_info);int adf_vf2pf_init (struct adf_accel_dev *accel_dev);void adf_vf2pf_shutdown (struct adf_accel_dev *accel_dev);
drivers/crypto/qat/qat_common/adf_isr.c +3 -5
@@ -106,9 +106,8 @@ static irqreturn_t adf_msix_isr_ae(int irq, void *dev_ptr)adf_disable_vf2pf_interrupts (accel_dev, vf_mask);/* -* Schedule tasklets to handle VF2PF interrupt BHs -* unless the VF is malicious and is attempting to -* flood the host OS with VF2PF interrupts. +* Handle VF2PF interrupt unless the VF is malicious and +* is attempting to flood the host OS with VF2PF interrupts. */ for_each_set_bit (i, &vf_mask,ADF_MAX_NUM_VFS ) { vf_info = accel_dev->pf.vf_info + i;
@@ -120,8 +119,7 @@ static irqreturn_t adf_msix_isr_ae(int irq, void *dev_ptr)continue ; } -/* Tasklet will re-enable ints from this VF */ -tasklet_hi_schedule (&vf_info->vf2pf_bh_tasklet); +adf_schedule_vf2pf_handler (vf_info); irq_handled = true; }
drivers/crypto/qat/qat_common/adf_sriov.c +1 -7
@@ -24,9 +24,8 @@ static void adf_iov_send_resp(struct work_struct *work)kfree (pf2vf_resp); } -static void adf_vf2pf_bh_handler (void *data) +void adf_schedule_vf2pf_handler (struct adf_accel_vf_info *vf_info) { -struct adf_accel_vf_info *vf_info = (struct adf_accel_vf_info *)data;struct adf_pf2vf_resp *pf2vf_resp; pf2vf_resp =kzalloc (sizeof (*pf2vf_resp),GFP_ATOMIC );
@@ -52,9 +51,6 @@ static int adf_enable_sriov(struct adf_accel_dev *accel_dev) vf_info->accel_dev = accel_dev; vf_info->vf_nr = i; -tasklet_init (&vf_info->vf2pf_bh_tasklet, - (void *)adf_vf2pf_bh_handler, - (unsigned long )vf_info);mutex_init (&vf_info->pf2vf_lock); ratelimit_state_init(&vf_info->vf2pf_ratelimit, DEFAULT_RATELIMIT_INTERVAL,
@@ -110,8 +106,6 @@ void adf_disable_sriov(struct adf_accel_dev *accel_dev) hw_data->configure_iov_threads (accel_dev, false);for (i =0 , vf = accel_dev->pf.vf_info; i < totalvfs; i++, vf++) { -tasklet_disable (&vf->vf2pf_bh_tasklet); -tasklet_kill (&vf->vf2pf_bh_tasklet);mutex_destroy (&vf->pf2vf_lock); }
Signature · 1 line
2.31.1
PATCH 10/20 crypto: qat - fix reuse of completion variable
In reply to Giovanni CabidduFrom: Marco Chiappero <[email protected]>
Use reinit_completion() to set to a clean state a completion variable, used to coordinate the VF to PF request-response flow, before every new VF request.
--- drivers/crypto/qat/qat_common/adf_pf2vf_msg.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/crypto/qat/qat_common/adf_pf2vf_msg.c +2 -0
@@ -316,6 +316,8 @@ static int adf_vf2pf_request_version(struct adf_accel_dev *accel_dev) msg |=ADF_PFVF_COMPAT_THIS_VERSION <<ADF_VF2PF_COMPAT_VER_REQ_SHIFT ;BUILD_BUG_ON (ADF_PFVF_COMPAT_THIS_VERSION >255 ); +reinit_completion (&accel_dev->vf.iov_msg_completion); +/* Send request from VF to PF */ ret =adf_iov_putmsg (accel_dev, msg,0 );if (ret) {
Signature · 1 line
2.31.1
PATCH 11/20 crypto: qat - move pf2vf interrupt [en|dis]able to adf_vf_isr.c
In reply to Giovanni CabidduFrom: Marco Chiappero <[email protected]>
Interrupt code to enable interrupts from PF does not belong to the protocol code, so move it to the interrupt handling specific file for better code organization.
--- drivers/crypto/qat/qat_common/adf_pf2vf_msg.c | 20 ------------------- drivers/crypto/qat/qat_common/adf_vf_isr.c | 20 +++++++++++++++++++ 2 files changed, 20 insertions(+), 20 deletions(-)
drivers/crypto/qat/qat_common/adf_pf2vf_msg.c +0 -20
@@ -11,26 +11,6 @@#define ADF_DH895XCC_ERRMSK5 (ADF_DH895XCC_EP_OFFSET + 0xDC)#define ADF_DH895XCC_ERRMSK5_VF2PF_U_MASK (vf_mask) (vf_mask >> 16) -void adf_enable_pf2vf_interrupts (struct adf_accel_dev *accel_dev) -{ -struct adf_accel_pci *pci_info = &accel_dev->accel_pci_dev; -struct adf_hw_device_data *hw_data = accel_dev->hw_device; -void __iomem *pmisc_bar_addr = - pci_info->pci_bars[hw_data->get_misc_bar_id (hw_data)].virt_addr; - -ADF_CSR_WR (pmisc_bar_addr, hw_data->get_vintmsk_offset (0 ),0x0 ); -} - -void adf_disable_pf2vf_interrupts (struct adf_accel_dev *accel_dev) -{ -struct adf_accel_pci *pci_info = &accel_dev->accel_pci_dev; -struct adf_hw_device_data *hw_data = accel_dev->hw_device; -void __iomem *pmisc_bar_addr = - pci_info->pci_bars[hw_data->get_misc_bar_id (hw_data)].virt_addr; - -ADF_CSR_WR (pmisc_bar_addr, hw_data->get_vintmsk_offset (0 ),0x2 ); -} -void adf_enable_vf2pf_interrupts (struct adf_accel_dev *accel_dev,u32 vf_mask) {
drivers/crypto/qat/qat_common/adf_vf_isr.c +20 -0
@@ -29,6 +29,26 @@ struct adf_vf_stop_data {struct work_struct work; }; +void adf_enable_pf2vf_interrupts (struct adf_accel_dev *accel_dev) +{ +struct adf_accel_pci *pci_info = &accel_dev->accel_pci_dev; +struct adf_hw_device_data *hw_data = accel_dev->hw_device; +void __iomem *pmisc_bar_addr = + pci_info->pci_bars[hw_data->get_misc_bar_id (hw_data)].virt_addr; + +ADF_CSR_WR (pmisc_bar_addr, hw_data->get_vintmsk_offset (0 ),0x0 ); +} + +void adf_disable_pf2vf_interrupts (struct adf_accel_dev *accel_dev) +{ +struct adf_accel_pci *pci_info = &accel_dev->accel_pci_dev; +struct adf_hw_device_data *hw_data = accel_dev->hw_device; +void __iomem *pmisc_bar_addr = + pci_info->pci_bars[hw_data->get_misc_bar_id (hw_data)].virt_addr; + +ADF_CSR_WR (pmisc_bar_addr, hw_data->get_vintmsk_offset (0 ),0x2 ); +} +static int adf_enable_msi (struct adf_accel_dev *accel_dev) {struct adf_accel_pci *pci_dev_info = &accel_dev->accel_pci_dev;
Signature · 1 line
2.31.1
PATCH 12/20 crypto: qat - protect interrupt mask CSRs with a spinlock
In reply to Giovanni CabidduFrom: Kanchana Velusamy <[email protected]>
In the PF interrupt handler, the interrupt is disabled for a set of VFs by writing to the interrupt source mask register, ERRMSK. The interrupt is re-enabled in the bottom half handler by writing to the same CSR. This is done through the functions enable_vf2pf_interrupts() and disable_vf2pf_interrupts() which perform a read-modify-write operation on the ERRMSK registers to mask and unmask the source of interrupt.
There can be a race condition where the top half handler for one VF interrupt runs just as the bottom half for another VF is about to re-enable the interrupt. Depending on whether the top or bottom half updates the CSR first, this would result either in a spurious interrupt or in the interrupt not being re-enabled.
This patch protects the access of ERRMSK with a spinlock.
The functions adf_enable_vf2pf_interrupts() and adf_disable_vf2pf_interrupts() have been changed to acquire a spin lock before accessing and modifying the ERRMSK registers. These functions use spin_lock_irqsave() to disable IRQs and avoid potential deadlocks. In addition, the function adf_disable_vf2pf_interrupts_irq() has been added. This uses spin_lock() and it is meant to be used in the top half only.
--- .../crypto/qat/qat_c3xxx/adf_c3xxx_hw_data.c | 2 ++ .../crypto/qat/qat_c62x/adf_c62x_hw_data.c | 2 ++ .../crypto/qat/qat_common/adf_accel_devices.h | 2 ++ .../crypto/qat/qat_common/adf_common_drv.h | 2 ++ drivers/crypto/qat/qat_common/adf_isr.c | 2 +- drivers/crypto/qat/qat_common/adf_pf2vf_msg.c | 33 +++++++++++++++++-- .../qat/qat_dh895xcc/adf_dh895xcc_hw_data.c | 2 ++ 7 files changed, 41 insertions(+), 4 deletions(-)
drivers/crypto/qat/qat_c3xxx/adf_c3xxx_hw_data.c +2 -0
@@ -161,6 +161,8 @@ static void adf_enable_ints(struct adf_accel_dev *accel_dev)static int adf_pf_enable_vf2pf_comms (struct adf_accel_dev *accel_dev) { +spin_lock_init (&accel_dev->pf.vf2pf_ints_lock); +return 0 ; }
drivers/crypto/qat/qat_c62x/adf_c62x_hw_data.c +2 -0
@@ -163,6 +163,8 @@ static void adf_enable_ints(struct adf_accel_dev *accel_dev)static int adf_pf_enable_vf2pf_comms (struct adf_accel_dev *accel_dev) { +spin_lock_init (&accel_dev->pf.vf2pf_ints_lock); +return 0 ; }
drivers/crypto/qat/qat_common/adf_accel_devices.h +2 -0
@@ -246,6 +246,8 @@ struct adf_accel_dev {struct adf_accel_pci accel_pci_dev;union {struct { +/* protects VF2PF interrupts access */ +spinlock_t vf2pf_ints_lock;/* vf_info is non-zero when SR-IOV is init'ed */ struct adf_accel_vf_info *vf_info; } pf;
drivers/crypto/qat/qat_common/adf_common_drv.h +2 -0
@@ -193,6 +193,8 @@ int adf_sriov_configure(struct pci_dev *pdev, int numvfs);void adf_disable_sriov (struct adf_accel_dev *accel_dev);void adf_disable_vf2pf_interrupts (struct adf_accel_dev *accel_dev,u32 vf_mask); +void adf_disable_vf2pf_interrupts_irq (struct adf_accel_dev *accel_dev, +u32 vf_mask);void adf_enable_vf2pf_interrupts (struct adf_accel_dev *accel_dev,u32 vf_mask);void adf_enable_pf2vf_interrupts (struct adf_accel_dev *accel_dev);
drivers/crypto/qat/qat_common/adf_isr.c +1 -1
@@ -103,7 +103,7 @@ static irqreturn_t adf_msix_isr_ae(int irq, void *dev_ptr)int i;/* Disable VF2PF interrupts for VFs with pending ints */ -adf_disable_vf2pf_interrupts (accel_dev, vf_mask); +adf_disable_vf2pf_interrupts_irq (accel_dev, vf_mask);/* * Handle VF2PF interrupt unless the VF is malicious and
drivers/crypto/qat/qat_common/adf_pf2vf_msg.c +30 -3
@@ -11,8 +11,8 @@#define ADF_DH895XCC_ERRMSK5 (ADF_DH895XCC_EP_OFFSET + 0xDC)#define ADF_DH895XCC_ERRMSK5_VF2PF_U_MASK (vf_mask) (vf_mask >> 16) -void adf_enable_vf2pf_interrupts (struct adf_accel_dev *accel_dev, -u32 vf_mask) +static void __adf_enable_vf2pf_interrupts (struct adf_accel_dev *accel_dev, +u32 vf_mask) {struct adf_hw_device_data *hw_data = accel_dev->hw_device; struct adf_bar *pmisc =
@@ -35,7 +35,17 @@ void adf_enable_vf2pf_interrupts(struct adf_accel_dev *accel_dev, } } -void adf_disable_vf2pf_interrupts (struct adf_accel_dev *accel_dev,u32 vf_mask) +void adf_enable_vf2pf_interrupts (struct adf_accel_dev *accel_dev,u32 vf_mask) +{ +unsigned long flags; + +spin_lock_irqsave (&accel_dev->pf.vf2pf_ints_lock, flags); +__adf_enable_vf2pf_interrupts (accel_dev, vf_mask); +spin_unlock_irqrestore (&accel_dev->pf.vf2pf_ints_lock, flags); +} + +static void __adf_disable_vf2pf_interrupts (struct adf_accel_dev *accel_dev, +u32 vf_mask) {struct adf_hw_device_data *hw_data = accel_dev->hw_device; struct adf_bar *pmisc =
@@ -58,6 +68,22 @@ void adf_disable_vf2pf_interrupts(struct adf_accel_dev *accel_dev, u32 vf_mask) } } +void adf_disable_vf2pf_interrupts (struct adf_accel_dev *accel_dev,u32 vf_mask) +{ +unsigned long flags; + +spin_lock_irqsave (&accel_dev->pf.vf2pf_ints_lock, flags); +__adf_disable_vf2pf_interrupts (accel_dev, vf_mask); +spin_unlock_irqrestore (&accel_dev->pf.vf2pf_ints_lock, flags); +} + +void adf_disable_vf2pf_interrupts_irq (struct adf_accel_dev *accel_dev,u32 vf_mask) +{ +spin_lock (&accel_dev->pf.vf2pf_ints_lock); +__adf_disable_vf2pf_interrupts (accel_dev, vf_mask); +spin_unlock (&accel_dev->pf.vf2pf_ints_lock); +} +static int __adf_iov_putmsg (struct adf_accel_dev *accel_dev,u32 msg,u8 vf_nr) {struct adf_accel_pci *pci_info = &accel_dev->accel_pci_dev;
@@ -264,6 +290,7 @@ void adf_vf2pf_req_hndl(struct adf_accel_vf_info *vf_info)/* re-enable interrupt on PF from this VF */ adf_enable_vf2pf_interrupts (accel_dev, (1 << vf_nr)); +return ; err: dev_dbg(&GET_DEV(accel_dev), "Unknown message from VF%d (0x%x);\n",
drivers/crypto/qat/qat_dh895xcc/adf_dh895xcc_hw_data.c +2 -0
@@ -182,6 +182,8 @@ static void adf_enable_ints(struct adf_accel_dev *accel_dev)static int adf_pf_enable_vf2pf_comms (struct adf_accel_dev *accel_dev) { +spin_lock_init (&accel_dev->pf.vf2pf_ints_lock); +return 0 ; }
Signature · 1 line
2.31.1
PATCH 13/20 crypto: qat - fix naming for init/shutdown VF to PF notifications
In reply to Giovanni CabidduFrom: Marco Chiappero <[email protected]>
At start and shutdown, VFs notify the PF about their state. These notifications are carried out through a message exchange using the PFVF protocol.
Function names lead to believe they do perform init or shutdown logic. This is to fix the naming to better reflect their purpose.
--- drivers/crypto/qat/qat_c3xxxvf/adf_c3xxxvf_hw_data.c | 4 ++-- drivers/crypto/qat/qat_c62xvf/adf_c62xvf_hw_data.c | 4 ++-- drivers/crypto/qat/qat_common/adf_common_drv.h | 8 ++++---- drivers/crypto/qat/qat_common/adf_vf2pf_msg.c | 12 ++++++------ .../qat/qat_dh895xccvf/adf_dh895xccvf_hw_data.c | 4 ++-- 5 files changed, 16 insertions(+), 16 deletions(-)
drivers/crypto/qat/qat_c3xxxvf/adf_c3xxxvf_hw_data.c +2 -2
@@ -81,10 +81,10 @@ void adf_init_hw_data_c3xxxiov(struct adf_hw_device_data *hw_data) hw_data->enable_error_correction = adf_vf_void_noop; hw_data->init_admin_comms = adf_vf_int_noop; hw_data->exit_admin_comms = adf_vf_void_noop; - hw_data->send_admin_init = adf_vf2pf_init; + hw_data->send_admin_init = adf_vf2pf_notify_init; hw_data->init_arb = adf_vf_int_noop; hw_data->exit_arb = adf_vf_void_noop; - hw_data->disable_iov = adf_vf2pf_shutdown; + hw_data->disable_iov = adf_vf2pf_notify_shutdown; hw_data->get_accel_mask = get_accel_mask; hw_data->get_ae_mask = get_ae_mask; hw_data->get_num_accels = get_num_accels;
drivers/crypto/qat/qat_c62xvf/adf_c62xvf_hw_data.c +2 -2
@@ -81,10 +81,10 @@ void adf_init_hw_data_c62xiov(struct adf_hw_device_data *hw_data) hw_data->enable_error_correction = adf_vf_void_noop; hw_data->init_admin_comms = adf_vf_int_noop; hw_data->exit_admin_comms = adf_vf_void_noop; - hw_data->send_admin_init = adf_vf2pf_init; + hw_data->send_admin_init = adf_vf2pf_notify_init; hw_data->init_arb = adf_vf_int_noop; hw_data->exit_arb = adf_vf_void_noop; - hw_data->disable_iov = adf_vf2pf_shutdown; + hw_data->disable_iov = adf_vf2pf_notify_shutdown; hw_data->get_accel_mask = get_accel_mask; hw_data->get_ae_mask = get_ae_mask; hw_data->get_num_accels = get_num_accels;
drivers/crypto/qat/qat_common/adf_common_drv.h +4 -4
@@ -201,8 +201,8 @@ void adf_enable_pf2vf_interrupts(struct adf_accel_dev *accel_dev);void adf_disable_pf2vf_interrupts (struct adf_accel_dev *accel_dev);void adf_schedule_vf2pf_handler (struct adf_accel_vf_info *vf_info); -int adf_vf2pf_init (struct adf_accel_dev *accel_dev); -void adf_vf2pf_shutdown (struct adf_accel_dev *accel_dev); +int adf_vf2pf_notify_init (struct adf_accel_dev *accel_dev); +void adf_vf2pf_notify_shutdown (struct adf_accel_dev *accel_dev);int adf_init_pf_wq (void );void adf_exit_pf_wq (void );int adf_init_vf_wq (void );
@@ -222,12 +222,12 @@ static inline void adf_disable_pf2vf_interrupts(struct adf_accel_dev *accel_dev) { } -static inline int adf_vf2pf_init (struct adf_accel_dev *accel_dev) +static inline int adf_vf2pf_notify_init (struct adf_accel_dev *accel_dev) {return 0 ; } -static inline void adf_vf2pf_shutdown (struct adf_accel_dev *accel_dev) +static inline void adf_vf2pf_notify_shutdown (struct adf_accel_dev *accel_dev) { }
drivers/crypto/qat/qat_common/adf_vf2pf_msg.c +6 -6
@@ -5,14 +5,14 @@#include "adf_pf2vf_msg.h" /** -* adf_vf2pf_init() - send init msg to PF +* adf_vf2pf_notify_init() - send init msg to PF * @accel_dev: Pointer to acceleration VF device. * * Function sends an init message from the VF to a PF * * Return: 0 on success, error code otherwise. */ -int adf_vf2pf_init (struct adf_accel_dev *accel_dev) +int adf_vf2pf_notify_init (struct adf_accel_dev *accel_dev) {u32 msg = (ADF_VF2PF_MSGORIGIN_SYSTEM | (ADF_VF2PF_MSGTYPE_INIT <<ADF_VF2PF_MSGTYPE_SHIFT ));
@@ -25,17 +25,17 @@ int adf_vf2pf_init(struct adf_accel_dev *accel_dev)set_bit (ADF_STATUS_PF_RUNNING , &accel_dev->status);return 0 ; } -EXPORT_SYMBOL_GPL (adf_vf2pf_init); +EXPORT_SYMBOL_GPL (adf_vf2pf_notify_init);/** -* adf_vf2pf_shutdown() - send shutdown msg to PF +* adf_vf2pf_notify_shutdown() - send shutdown msg to PF * @accel_dev: Pointer to acceleration VF device. * * Function sends a shutdown message from the VF to a PF * * Return: void */ -void adf_vf2pf_shutdown (struct adf_accel_dev *accel_dev) +void adf_vf2pf_notify_shutdown (struct adf_accel_dev *accel_dev) {u32 msg = (ADF_VF2PF_MSGORIGIN_SYSTEM | (ADF_VF2PF_MSGTYPE_SHUTDOWN <<ADF_VF2PF_MSGTYPE_SHIFT ));
@@ -45,4 +45,4 @@ void adf_vf2pf_shutdown(struct adf_accel_dev *accel_dev)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_notify_shutdown);
drivers/crypto/qat/qat_dh895xccvf/adf_dh895xccvf_hw_data.c +2 -2
@@ -81,10 +81,10 @@ void adf_init_hw_data_dh895xcciov(struct adf_hw_device_data *hw_data) hw_data->enable_error_correction = adf_vf_void_noop; hw_data->init_admin_comms = adf_vf_int_noop; hw_data->exit_admin_comms = adf_vf_void_noop; - hw_data->send_admin_init = adf_vf2pf_init; + hw_data->send_admin_init = adf_vf2pf_notify_init; hw_data->init_arb = adf_vf_int_noop; hw_data->exit_arb = adf_vf_void_noop; - hw_data->disable_iov = adf_vf2pf_shutdown; + hw_data->disable_iov = adf_vf2pf_notify_shutdown; hw_data->get_accel_mask = get_accel_mask; hw_data->get_ae_mask = get_ae_mask; hw_data->get_num_accels = get_num_accels;
Signature · 1 line
2.31.1
PATCH 14/20 crypto: qat - move IO virtualization functions
In reply to Giovanni CabidduMove IOV functions at the end of hw_data so that PFVF functions related functions are group together.
--- drivers/crypto/qat/qat_4xxx/adf_4xxx_hw_data.c | 6 +++--- drivers/crypto/qat/qat_c3xxx/adf_c3xxx_hw_data.c | 9 +++++---- drivers/crypto/qat/qat_c62x/adf_c62x_hw_data.c | 10 +++++----- drivers/crypto/qat/qat_dh895xcc/adf_dh895xcc_hw_data.c | 7 ++++--- 4 files changed, 17 insertions(+), 15 deletions(-)
drivers/crypto/qat/qat_4xxx/adf_4xxx_hw_data.c +3 -3
@@ -210,21 +210,21 @@ void adf_init_hw_data_4xxx(struct adf_hw_device_data *hw_data) hw_data->fw_mmp_name =ADF_4XXX_MMP ; hw_data->init_admin_comms = adf_init_admin_comms; hw_data->exit_admin_comms = adf_exit_admin_comms; - hw_data->disable_iov = adf_disable_sriov; hw_data->send_admin_init = adf_send_admin_init; hw_data->init_arb = adf_init_arb; hw_data->exit_arb = adf_exit_arb; hw_data->get_arb_mapping = adf_get_arbiter_mapping; hw_data->enable_ints = adf_enable_ints; - hw_data->enable_vf2pf_comms = adf_pf_enable_vf2pf_comms; hw_data->reset_device = adf_reset_flr; - hw_data->min_iov_compat_ver =ADF_PFVF_COMPAT_THIS_VERSION ; hw_data->admin_ae_mask =ADF_4XXX_ADMIN_AE_MASK ; hw_data->uof_get_num_objs = uof_get_num_objs; hw_data->uof_get_name = uof_get_name; hw_data->uof_get_ae_mask = uof_get_ae_mask; hw_data->set_msix_rttable = set_msix_default_rttable; hw_data->set_ssm_wdtimer = adf_gen4_set_ssm_wdtimer; + hw_data->enable_vf2pf_comms = adf_pf_enable_vf2pf_comms; + hw_data->disable_iov = adf_disable_sriov; + hw_data->min_iov_compat_ver =ADF_PFVF_COMPAT_THIS_VERSION ;adf_gen4_init_hw_csr_ops (&hw_data->csr_ops); }
drivers/crypto/qat/qat_c3xxx/adf_c3xxx_hw_data.c +5 -4
@@ -195,7 +195,6 @@ void adf_init_hw_data_c3xxx(struct adf_hw_device_data *hw_data) hw_data->get_sram_bar_id = get_sram_bar_id; hw_data->get_etr_bar_id = get_etr_bar_id; hw_data->get_misc_bar_id = get_misc_bar_id; - hw_data->get_pf2vf_offset = get_pf2vf_offset; hw_data->get_vintmsk_offset = get_vintmsk_offset; hw_data->get_admin_info = adf_gen2_get_admin_info; hw_data->get_arb_info = adf_gen2_get_arb_info;
@@ -205,16 +204,18 @@ void adf_init_hw_data_c3xxx(struct adf_hw_device_data *hw_data) hw_data->init_admin_comms = adf_init_admin_comms; hw_data->exit_admin_comms = adf_exit_admin_comms; hw_data->configure_iov_threads = configure_iov_threads; - hw_data->disable_iov = adf_disable_sriov; hw_data->send_admin_init = adf_send_admin_init; hw_data->init_arb = adf_init_arb; hw_data->exit_arb = adf_exit_arb; hw_data->get_arb_mapping = adf_get_arbiter_mapping; hw_data->enable_ints = adf_enable_ints; - hw_data->enable_vf2pf_comms = adf_pf_enable_vf2pf_comms; hw_data->reset_device = adf_reset_flr; - hw_data->min_iov_compat_ver =ADF_PFVF_COMPAT_THIS_VERSION ; hw_data->set_ssm_wdtimer = adf_gen2_set_ssm_wdtimer; + hw_data->get_pf2vf_offset = get_pf2vf_offset; + hw_data->enable_vf2pf_comms = adf_pf_enable_vf2pf_comms; + hw_data->disable_iov = adf_disable_sriov; + hw_data->min_iov_compat_ver =ADF_PFVF_COMPAT_THIS_VERSION ; +adf_gen2_init_hw_csr_ops (&hw_data->csr_ops); }
drivers/crypto/qat/qat_c62x/adf_c62x_hw_data.c +5 -5
@@ -112,7 +112,6 @@ static u32 get_pf2vf_offset(u32 i) {return ADF_C62X_PF2VF_OFFSET (i); } -static u32 get_vintmsk_offset (u32 i) {return ADF_C62X_VINTMSK_OFFSET (i);
@@ -197,7 +196,6 @@ void adf_init_hw_data_c62x(struct adf_hw_device_data *hw_data) hw_data->get_sram_bar_id = get_sram_bar_id; hw_data->get_etr_bar_id = get_etr_bar_id; hw_data->get_misc_bar_id = get_misc_bar_id; - hw_data->get_pf2vf_offset = get_pf2vf_offset; hw_data->get_vintmsk_offset = get_vintmsk_offset; hw_data->get_admin_info = adf_gen2_get_admin_info; hw_data->get_arb_info = adf_gen2_get_arb_info;
@@ -207,16 +205,18 @@ void adf_init_hw_data_c62x(struct adf_hw_device_data *hw_data) hw_data->init_admin_comms = adf_init_admin_comms; hw_data->exit_admin_comms = adf_exit_admin_comms; hw_data->configure_iov_threads = configure_iov_threads; - hw_data->disable_iov = adf_disable_sriov; hw_data->send_admin_init = adf_send_admin_init; hw_data->init_arb = adf_init_arb; hw_data->exit_arb = adf_exit_arb; hw_data->get_arb_mapping = adf_get_arbiter_mapping; hw_data->enable_ints = adf_enable_ints; - hw_data->enable_vf2pf_comms = adf_pf_enable_vf2pf_comms; hw_data->reset_device = adf_reset_flr; - hw_data->min_iov_compat_ver =ADF_PFVF_COMPAT_THIS_VERSION ; hw_data->set_ssm_wdtimer = adf_gen2_set_ssm_wdtimer; + hw_data->get_pf2vf_offset = get_pf2vf_offset; + hw_data->enable_vf2pf_comms = adf_pf_enable_vf2pf_comms; + hw_data->disable_iov = adf_disable_sriov; + hw_data->min_iov_compat_ver =ADF_PFVF_COMPAT_THIS_VERSION ; +adf_gen2_init_hw_csr_ops (&hw_data->csr_ops); }
drivers/crypto/qat/qat_dh895xcc/adf_dh895xcc_hw_data.c +4 -3
@@ -215,7 +215,6 @@ void adf_init_hw_data_dh895xcc(struct adf_hw_device_data *hw_data) hw_data->get_num_aes = get_num_aes; hw_data->get_etr_bar_id = get_etr_bar_id; hw_data->get_misc_bar_id = get_misc_bar_id; - hw_data->get_pf2vf_offset = get_pf2vf_offset; hw_data->get_vintmsk_offset = get_vintmsk_offset; hw_data->get_admin_info = adf_gen2_get_admin_info; hw_data->get_arb_info = adf_gen2_get_arb_info;
@@ -226,15 +225,17 @@ void adf_init_hw_data_dh895xcc(struct adf_hw_device_data *hw_data) hw_data->init_admin_comms = adf_init_admin_comms; hw_data->exit_admin_comms = adf_exit_admin_comms; hw_data->configure_iov_threads = configure_iov_threads; - hw_data->disable_iov = adf_disable_sriov; hw_data->send_admin_init = adf_send_admin_init; hw_data->init_arb = adf_init_arb; hw_data->exit_arb = adf_exit_arb; hw_data->get_arb_mapping = adf_get_arbiter_mapping; hw_data->enable_ints = adf_enable_ints; - hw_data->enable_vf2pf_comms = adf_pf_enable_vf2pf_comms; hw_data->reset_device = adf_reset_sbr; + hw_data->get_pf2vf_offset = get_pf2vf_offset; + hw_data->enable_vf2pf_comms = adf_pf_enable_vf2pf_comms; + hw_data->disable_iov = adf_disable_sriov; hw_data->min_iov_compat_ver =ADF_PFVF_COMPAT_THIS_VERSION ; +adf_gen2_init_hw_csr_ops (&hw_data->csr_ops); }
Signature · 1 line
2.31.1
PATCH 15/20 crypto: qat - complete all the init steps before service notification
In reply to Giovanni CabidduFrom: Marco Chiappero <[email protected]>
Make sure all the steps in the initialization sequence are complete before any completion event notification.
--- drivers/crypto/qat/qat_common/adf_init.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
drivers/crypto/qat/qat_common/adf_init.c +6 -4
@@ -110,6 +110,11 @@ int adf_dev_init(struct adf_accel_dev *accel_dev)set_bit (ADF_STATUS_IRQ_ALLOCATED , &accel_dev->status); hw_data->enable_ints (accel_dev); + hw_data->enable_error_correction (accel_dev); + + ret = hw_data->enable_vf2pf_comms (accel_dev); +if (ret) +return ret;/* * Subservice initialisation is divided into two stages: init and start.
@@ -127,10 +132,7 @@ int adf_dev_init(struct adf_accel_dev *accel_dev)set_bit (accel_dev->accel_id, service->init_status); } - hw_data->enable_error_correction (accel_dev); - ret = hw_data->enable_vf2pf_comms (accel_dev); - -return ret; +return 0 ; }EXPORT_SYMBOL_GPL (adf_dev_init);
Signature · 1 line
2.31.1
PATCH 16/20 crypto: qat - fix naming of PF/VF enable functions
In reply to Giovanni CabidduFrom: Marco Chiappero <[email protected]>
Currently all the functions related to the activation of the PFVF protocol, both on PF and VF, include the direction specific "vf2pf" name.
Replace the existing naming schema with:
- a direction agnostic naming, that applies to both PF and VF, for the function pointer ("pfvf")
- a direction specific naming schema for the implementations ("pf2vf" or
"vf2pf")
In particular this patch renames:
- adf_pf_enable_vf2pf_comms() in adf_enable_pf2vf_comms()
- enable_vf2pf_comms() in enable_pfvf_comms()
--- drivers/crypto/qat/qat_4xxx/adf_4xxx_hw_data.c | 4 ++-- drivers/crypto/qat/qat_c3xxx/adf_c3xxx_hw_data.c | 4 ++-- drivers/crypto/qat/qat_c3xxxvf/adf_c3xxxvf_hw_data.c | 2 +- drivers/crypto/qat/qat_c62x/adf_c62x_hw_data.c | 4 ++-- drivers/crypto/qat/qat_c62xvf/adf_c62xvf_hw_data.c | 2 +- drivers/crypto/qat/qat_common/adf_accel_devices.h | 2 +- drivers/crypto/qat/qat_common/adf_init.c | 2 +- drivers/crypto/qat/qat_dh895xcc/adf_dh895xcc_hw_data.c | 4 ++-- drivers/crypto/qat/qat_dh895xccvf/adf_dh895xccvf_hw_data.c | 2 +- 9 files changed, 13 insertions(+), 13 deletions(-)
drivers/crypto/qat/qat_4xxx/adf_4xxx_hw_data.c +2 -2
@@ -161,7 +161,7 @@ static void adf_enable_ints(struct adf_accel_dev *accel_dev)ADF_CSR_WR (addr,ADF_4XXX_SMIAPF_MASK_OFFSET ,0 ); } -static int adf_pf_enable_vf2pf_comms (struct adf_accel_dev *accel_dev) +static int adf_enable_pf2vf_comms (struct adf_accel_dev *accel_dev) {return 0 ; }
@@ -222,7 +222,7 @@ void adf_init_hw_data_4xxx(struct adf_hw_device_data *hw_data) hw_data->uof_get_ae_mask = uof_get_ae_mask; hw_data->set_msix_rttable = set_msix_default_rttable; hw_data->set_ssm_wdtimer = adf_gen4_set_ssm_wdtimer; - hw_data->enable_vf2pf_comms = adf_pf_enable_vf2pf_comms; + hw_data->enable_pfvf_comms = adf_enable_pf2vf_comms; hw_data->disable_iov = adf_disable_sriov; hw_data->min_iov_compat_ver =ADF_PFVF_COMPAT_THIS_VERSION ;
drivers/crypto/qat/qat_c3xxx/adf_c3xxx_hw_data.c +2 -2
@@ -159,7 +159,7 @@ static void adf_enable_ints(struct adf_accel_dev *accel_dev) ADF_C3XXX_SMIA1_MASK); } -static int adf_pf_enable_vf2pf_comms (struct adf_accel_dev *accel_dev) +static int adf_enable_pf2vf_comms (struct adf_accel_dev *accel_dev) {spin_lock_init (&accel_dev->pf.vf2pf_ints_lock);
@@ -212,7 +212,7 @@ void adf_init_hw_data_c3xxx(struct adf_hw_device_data *hw_data) hw_data->reset_device = adf_reset_flr; hw_data->set_ssm_wdtimer = adf_gen2_set_ssm_wdtimer; hw_data->get_pf2vf_offset = get_pf2vf_offset; - hw_data->enable_vf2pf_comms = adf_pf_enable_vf2pf_comms; + hw_data->enable_pfvf_comms = adf_enable_pf2vf_comms; hw_data->disable_iov = adf_disable_sriov; hw_data->min_iov_compat_ver =ADF_PFVF_COMPAT_THIS_VERSION ;
drivers/crypto/qat/qat_c3xxxvf/adf_c3xxxvf_hw_data.c +1 -1
@@ -95,7 +95,7 @@ void adf_init_hw_data_c3xxxiov(struct adf_hw_device_data *hw_data) hw_data->get_vintmsk_offset = get_vintmsk_offset; hw_data->get_sku = get_sku; hw_data->enable_ints = adf_vf_void_noop; - hw_data->enable_vf2pf_comms = adf_enable_vf2pf_comms; + hw_data->enable_pfvf_comms = adf_enable_vf2pf_comms; hw_data->min_iov_compat_ver =ADF_PFVF_COMPAT_THIS_VERSION ; hw_data->dev_class->instances++;adf_devmgr_update_class_index (hw_data);
drivers/crypto/qat/qat_c62x/adf_c62x_hw_data.c +2 -2
@@ -160,7 +160,7 @@ static void adf_enable_ints(struct adf_accel_dev *accel_dev) ADF_C62X_SMIA1_MASK); } -static int adf_pf_enable_vf2pf_comms (struct adf_accel_dev *accel_dev) +static int adf_enable_pf2vf_comms (struct adf_accel_dev *accel_dev) {spin_lock_init (&accel_dev->pf.vf2pf_ints_lock);
@@ -213,7 +213,7 @@ void adf_init_hw_data_c62x(struct adf_hw_device_data *hw_data) hw_data->reset_device = adf_reset_flr; hw_data->set_ssm_wdtimer = adf_gen2_set_ssm_wdtimer; hw_data->get_pf2vf_offset = get_pf2vf_offset; - hw_data->enable_vf2pf_comms = adf_pf_enable_vf2pf_comms; + hw_data->enable_pfvf_comms = adf_enable_pf2vf_comms; hw_data->disable_iov = adf_disable_sriov; hw_data->min_iov_compat_ver =ADF_PFVF_COMPAT_THIS_VERSION ;
drivers/crypto/qat/qat_c62xvf/adf_c62xvf_hw_data.c +1 -1
@@ -95,7 +95,7 @@ void adf_init_hw_data_c62xiov(struct adf_hw_device_data *hw_data) hw_data->get_vintmsk_offset = get_vintmsk_offset; hw_data->get_sku = get_sku; hw_data->enable_ints = adf_vf_void_noop; - hw_data->enable_vf2pf_comms = adf_enable_vf2pf_comms; + hw_data->enable_pfvf_comms = adf_enable_vf2pf_comms; hw_data->min_iov_compat_ver =ADF_PFVF_COMPAT_THIS_VERSION ; hw_data->dev_class->instances++;adf_devmgr_update_class_index (hw_data);
drivers/crypto/qat/qat_common/adf_accel_devices.h +1 -1
@@ -172,7 +172,7 @@ struct adf_hw_device_data { bool enable);void (*enable_ints)(struct adf_accel_dev *accel_dev);void (*set_ssm_wdtimer)(struct adf_accel_dev *accel_dev); -int (*enable_vf2pf_comms)(struct adf_accel_dev *accel_dev); +int (*enable_pfvf_comms)(struct adf_accel_dev *accel_dev);void (*reset_device)(struct adf_accel_dev *accel_dev);void (*set_msix_rttable)(struct adf_accel_dev *accel_dev);char *(*uof_get_name)(u32 obj_num);
drivers/crypto/qat/qat_common/adf_init.c +1 -1
@@ -112,7 +112,7 @@ int adf_dev_init(struct adf_accel_dev *accel_dev) hw_data->enable_ints (accel_dev); hw_data->enable_error_correction (accel_dev); - ret = hw_data->enable_vf2pf_comms (accel_dev); + ret = hw_data->enable_pfvf_comms (accel_dev);if (ret)return ret;
drivers/crypto/qat/qat_dh895xcc/adf_dh895xcc_hw_data.c +2 -2
@@ -180,7 +180,7 @@ static void adf_enable_ints(struct adf_accel_dev *accel_dev) ADF_DH895XCC_SMIA1_MASK); } -static int adf_pf_enable_vf2pf_comms (struct adf_accel_dev *accel_dev) +static int adf_enable_pf2vf_comms (struct adf_accel_dev *accel_dev) {spin_lock_init (&accel_dev->pf.vf2pf_ints_lock);
@@ -232,7 +232,7 @@ void adf_init_hw_data_dh895xcc(struct adf_hw_device_data *hw_data) hw_data->enable_ints = adf_enable_ints; hw_data->reset_device = adf_reset_sbr; hw_data->get_pf2vf_offset = get_pf2vf_offset; - hw_data->enable_vf2pf_comms = adf_pf_enable_vf2pf_comms; + hw_data->enable_pfvf_comms = adf_enable_pf2vf_comms; hw_data->disable_iov = adf_disable_sriov; hw_data->min_iov_compat_ver =ADF_PFVF_COMPAT_THIS_VERSION ;
drivers/crypto/qat/qat_dh895xccvf/adf_dh895xccvf_hw_data.c +1 -1
@@ -95,7 +95,7 @@ void adf_init_hw_data_dh895xcciov(struct adf_hw_device_data *hw_data) hw_data->get_vintmsk_offset = get_vintmsk_offset; hw_data->get_sku = get_sku; hw_data->enable_ints = adf_vf_void_noop; - hw_data->enable_vf2pf_comms = adf_enable_vf2pf_comms; + hw_data->enable_pfvf_comms = adf_enable_vf2pf_comms; hw_data->min_iov_compat_ver =ADF_PFVF_COMPAT_THIS_VERSION ; hw_data->dev_class->instances++;adf_devmgr_update_class_index (hw_data);
Signature · 1 line
2.31.1
PATCH 17/20 crypto: qat - remove the unnecessary get_vintmsk_offset()
In reply to Giovanni CabidduFrom: Marco Chiappero <[email protected]>
All QAT GEN2 devices share the same register offset for masking interrupts, so they don't need any complex device specific infrastructure.
Remove this function in favor of a constant in order to simplify the code. Also, future generations may require a more complex device specific handling, making the current approach obsolete anyway.
--- drivers/crypto/qat/qat_c3xxx/adf_c3xxx_hw_data.c | 6 ------ drivers/crypto/qat/qat_c3xxx/adf_c3xxx_hw_data.h | 1 - drivers/crypto/qat/qat_c3xxxvf/adf_c3xxxvf_hw_data.c | 6 ------ drivers/crypto/qat/qat_c3xxxvf/adf_c3xxxvf_hw_data.h | 1 - drivers/crypto/qat/qat_c62x/adf_c62x_hw_data.c | 5 ----- drivers/crypto/qat/qat_c62x/adf_c62x_hw_data.h | 1 - drivers/crypto/qat/qat_c62xvf/adf_c62xvf_hw_data.c | 6 ------ drivers/crypto/qat/qat_c62xvf/adf_c62xvf_hw_data.h | 1 - drivers/crypto/qat/qat_common/adf_accel_devices.h | 1 - drivers/crypto/qat/qat_common/adf_vf_isr.c | 4 ++-- drivers/crypto/qat/qat_dh895xcc/adf_dh895xcc_hw_data.c | 6 ------ drivers/crypto/qat/qat_dh895xcc/adf_dh895xcc_hw_data.h | 1 - drivers/crypto/qat/qat_dh895xccvf/adf_dh895xccvf_hw_data.c | 6 ------ drivers/crypto/qat/qat_dh895xccvf/adf_dh895xccvf_hw_data.h | 1 - 14 files changed, 2 insertions(+), 44 deletions(-)
drivers/crypto/qat/qat_c3xxx/adf_c3xxx_hw_data.c +0 -6
@@ -111,11 +111,6 @@ static u32 get_pf2vf_offset(u32 i)return ADF_C3XXX_PF2VF_OFFSET (i); } -static u32 get_vintmsk_offset (u32 i) -{ -return ADF_C3XXX_VINTMSK_OFFSET (i); -} -static void adf_enable_error_correction (struct adf_accel_dev *accel_dev) {struct adf_hw_device_data *hw_device = accel_dev->hw_device;
@@ -195,7 +190,6 @@ void adf_init_hw_data_c3xxx(struct adf_hw_device_data *hw_data) hw_data->get_sram_bar_id = get_sram_bar_id; hw_data->get_etr_bar_id = get_etr_bar_id; hw_data->get_misc_bar_id = get_misc_bar_id; - hw_data->get_vintmsk_offset = get_vintmsk_offset; hw_data->get_admin_info = adf_gen2_get_admin_info; hw_data->get_arb_info = adf_gen2_get_arb_info; hw_data->get_sku = get_sku;
drivers/crypto/qat/qat_c3xxx/adf_c3xxx_hw_data.h +0 -1
@@ -29,7 +29,6 @@#define ADF_C3XXX_ERRSSMSH_EN BIT(3)#define ADF_C3XXX_PF2VF_OFFSET (i) (0x3A000 + 0x280 + ((i) * 0x04)) -#define ADF_C3XXX_VINTMSK_OFFSET (i) (0x3A000 + 0x200 + ((i) * 0x04))/* AE to function mapping */ #define ADF_C3XXX_AE2FUNC_MAP_GRP_A_NUM_REGS 48
drivers/crypto/qat/qat_c3xxxvf/adf_c3xxxvf_hw_data.c +0 -6
@@ -52,11 +52,6 @@ static u32 get_pf2vf_offset(u32 i)return ADF_C3XXXIOV_PF2VF_OFFSET ; } -static u32 get_vintmsk_offset (u32 i) -{ -return ADF_C3XXXIOV_VINTMSK_OFFSET ; -} -static int adf_vf_int_noop (struct adf_accel_dev *accel_dev) {return 0 ;
@@ -92,7 +87,6 @@ void adf_init_hw_data_c3xxxiov(struct adf_hw_device_data *hw_data) hw_data->get_etr_bar_id = get_etr_bar_id; hw_data->get_misc_bar_id = get_misc_bar_id; hw_data->get_pf2vf_offset = get_pf2vf_offset; - hw_data->get_vintmsk_offset = get_vintmsk_offset; hw_data->get_sku = get_sku; hw_data->enable_ints = adf_vf_void_noop; hw_data->enable_pfvf_comms = adf_enable_vf2pf_comms;
drivers/crypto/qat/qat_c3xxxvf/adf_c3xxxvf_hw_data.h +0 -1
@@ -13,7 +13,6 @@#define ADF_C3XXXIOV_ETR_BAR 0#define ADF_C3XXXIOV_ETR_MAX_BANKS 1#define ADF_C3XXXIOV_PF2VF_OFFSET 0x200 -#define ADF_C3XXXIOV_VINTMSK_OFFSET 0x208void adf_init_hw_data_c3xxxiov (struct adf_hw_device_data *hw_data);void adf_clean_hw_data_c3xxxiov (struct adf_hw_device_data *hw_data);
drivers/crypto/qat/qat_c62x/adf_c62x_hw_data.c +0 -5
@@ -112,10 +112,6 @@ static u32 get_pf2vf_offset(u32 i) {return ADF_C62X_PF2VF_OFFSET (i); } -static u32 get_vintmsk_offset (u32 i) -{ -return ADF_C62X_VINTMSK_OFFSET (i); -}static void adf_enable_error_correction (struct adf_accel_dev *accel_dev) {
@@ -196,7 +192,6 @@ void adf_init_hw_data_c62x(struct adf_hw_device_data *hw_data) hw_data->get_sram_bar_id = get_sram_bar_id; hw_data->get_etr_bar_id = get_etr_bar_id; hw_data->get_misc_bar_id = get_misc_bar_id; - hw_data->get_vintmsk_offset = get_vintmsk_offset; hw_data->get_admin_info = adf_gen2_get_admin_info; hw_data->get_arb_info = adf_gen2_get_arb_info; hw_data->get_sku = get_sku;
drivers/crypto/qat/qat_c62x/adf_c62x_hw_data.h +0 -1
@@ -30,7 +30,6 @@#define ADF_C62X_ERRSSMSH_EN BIT(3)#define ADF_C62X_PF2VF_OFFSET (i) (0x3A000 + 0x280 + ((i) * 0x04)) -#define ADF_C62X_VINTMSK_OFFSET (i) (0x3A000 + 0x200 + ((i) * 0x04))/* AE to function mapping */ #define ADF_C62X_AE2FUNC_MAP_GRP_A_NUM_REGS 80
drivers/crypto/qat/qat_c62xvf/adf_c62xvf_hw_data.c +0 -6
@@ -52,11 +52,6 @@ static u32 get_pf2vf_offset(u32 i)return ADF_C62XIOV_PF2VF_OFFSET ; } -static u32 get_vintmsk_offset (u32 i) -{ -return ADF_C62XIOV_VINTMSK_OFFSET ; -} -static int adf_vf_int_noop (struct adf_accel_dev *accel_dev) {return 0 ;
@@ -92,7 +87,6 @@ void adf_init_hw_data_c62xiov(struct adf_hw_device_data *hw_data) hw_data->get_etr_bar_id = get_etr_bar_id; hw_data->get_misc_bar_id = get_misc_bar_id; hw_data->get_pf2vf_offset = get_pf2vf_offset; - hw_data->get_vintmsk_offset = get_vintmsk_offset; hw_data->get_sku = get_sku; hw_data->enable_ints = adf_vf_void_noop; hw_data->enable_pfvf_comms = adf_enable_vf2pf_comms;
drivers/crypto/qat/qat_c62xvf/adf_c62xvf_hw_data.h +0 -1
@@ -13,7 +13,6 @@#define ADF_C62XIOV_ETR_BAR 0#define ADF_C62XIOV_ETR_MAX_BANKS 1#define ADF_C62XIOV_PF2VF_OFFSET 0x200 -#define ADF_C62XIOV_VINTMSK_OFFSET 0x208void adf_init_hw_data_c62xiov (struct adf_hw_device_data *hw_data);void adf_clean_hw_data_c62xiov (struct adf_hw_device_data *hw_data);
drivers/crypto/qat/qat_common/adf_accel_devices.h +0 -1
@@ -154,7 +154,6 @@ struct adf_hw_device_data {u32 (*get_num_aes)(struct adf_hw_device_data *self);u32 (*get_num_accels)(struct adf_hw_device_data *self);u32 (*get_pf2vf_offset)(u32 i); -u32 (*get_vintmsk_offset)(u32 i);void (*get_arb_info)(struct arb_info *arb_csrs_info);void (*get_admin_info)(struct admin_info *admin_csrs_info);enum dev_sku_info (*get_sku)(struct adf_hw_device_data *self);
drivers/crypto/qat/qat_common/adf_vf_isr.c +2 -2
@@ -36,7 +36,7 @@ void adf_enable_pf2vf_interrupts(struct adf_accel_dev *accel_dev)void __iomem *pmisc_bar_addr = pci_info->pci_bars[hw_data->get_misc_bar_id (hw_data)].virt_addr; -ADF_CSR_WR (pmisc_bar_addr, hw_data->get_vintmsk_offset (0 ),0x0 ); +ADF_CSR_WR (pmisc_bar_addr,ADF_VINTMSK_OFFSET ,0x0 ); }void adf_disable_pf2vf_interrupts (struct adf_accel_dev *accel_dev)
@@ -46,7 +46,7 @@ void adf_disable_pf2vf_interrupts(struct adf_accel_dev *accel_dev)void __iomem *pmisc_bar_addr = pci_info->pci_bars[hw_data->get_misc_bar_id (hw_data)].virt_addr; -ADF_CSR_WR (pmisc_bar_addr, hw_data->get_vintmsk_offset (0 ),0x2 ); +ADF_CSR_WR (pmisc_bar_addr,ADF_VINTMSK_OFFSET ,0x2 ); }static int adf_enable_msi (struct adf_accel_dev *accel_dev)
drivers/crypto/qat/qat_dh895xcc/adf_dh895xcc_hw_data.c +0 -6
@@ -131,11 +131,6 @@ static u32 get_pf2vf_offset(u32 i)return ADF_DH895XCC_PF2VF_OFFSET (i); } -static u32 get_vintmsk_offset (u32 i) -{ -return ADF_DH895XCC_VINTMSK_OFFSET (i); -} -static void adf_enable_error_correction (struct adf_accel_dev *accel_dev) {struct adf_hw_device_data *hw_device = accel_dev->hw_device;
@@ -215,7 +210,6 @@ void adf_init_hw_data_dh895xcc(struct adf_hw_device_data *hw_data) hw_data->get_num_aes = get_num_aes; hw_data->get_etr_bar_id = get_etr_bar_id; hw_data->get_misc_bar_id = get_misc_bar_id; - hw_data->get_vintmsk_offset = get_vintmsk_offset; hw_data->get_admin_info = adf_gen2_get_admin_info; hw_data->get_arb_info = adf_gen2_get_arb_info; hw_data->get_sram_bar_id = get_sram_bar_id;
drivers/crypto/qat/qat_dh895xcc/adf_dh895xcc_hw_data.h +0 -1
@@ -35,7 +35,6 @@#define ADF_DH895XCC_ERRSSMSH_EN BIT(3)#define ADF_DH895XCC_PF2VF_OFFSET (i) (0x3A000 + 0x280 + ((i) * 0x04)) -#define ADF_DH895XCC_VINTMSK_OFFSET (i) (0x3A000 + 0x200 + ((i) * 0x04))/* AE to function mapping */ #define ADF_DH895XCC_AE2FUNC_MAP_GRP_A_NUM_REGS 96
drivers/crypto/qat/qat_dh895xccvf/adf_dh895xccvf_hw_data.c +0 -6
@@ -52,11 +52,6 @@ static u32 get_pf2vf_offset(u32 i)return ADF_DH895XCCIOV_PF2VF_OFFSET ; } -static u32 get_vintmsk_offset (u32 i) -{ -return ADF_DH895XCCIOV_VINTMSK_OFFSET ; -} -static int adf_vf_int_noop (struct adf_accel_dev *accel_dev) {return 0 ;
@@ -92,7 +87,6 @@ void adf_init_hw_data_dh895xcciov(struct adf_hw_device_data *hw_data) hw_data->get_etr_bar_id = get_etr_bar_id; hw_data->get_misc_bar_id = get_misc_bar_id; hw_data->get_pf2vf_offset = get_pf2vf_offset; - hw_data->get_vintmsk_offset = get_vintmsk_offset; hw_data->get_sku = get_sku; hw_data->enable_ints = adf_vf_void_noop; hw_data->enable_pfvf_comms = adf_enable_vf2pf_comms;
drivers/crypto/qat/qat_dh895xccvf/adf_dh895xccvf_hw_data.h +0 -1
@@ -13,7 +13,6 @@#define ADF_DH895XCCIOV_ETR_BAR 0#define ADF_DH895XCCIOV_ETR_MAX_BANKS 1#define ADF_DH895XCCIOV_PF2VF_OFFSET 0x200 -#define ADF_DH895XCCIOV_VINTMSK_OFFSET 0x208void adf_init_hw_data_dh895xcciov (struct adf_hw_device_data *hw_data);void adf_clean_hw_data_dh895xcciov (struct adf_hw_device_data *hw_data);
Signature · 1 line
2.31.1
PATCH 18/20 crypto: qat - flush vf workqueue at driver removal
In reply to Giovanni CabidduFrom: Ahsan Atta <[email protected]>
There is a race condition during shutdown in adf_disable_sriov() where both the PF and the VF drivers are loaded on the host system. The PF notifies a VF with a "RESTARTING" message due to which the VF starts an asynchronous worker to stop and shutdown itself. At the same time the PF calls pci_disable_sriov() which invokes the remove() routine on the VF device driver triggering the shutdown flow again.
This change fixes the problem by ensuring that the VF flushes the worker that performs stop()/shutdown() before these two functions are called in the remove(). To make sure that no additional PV/VF messages are processed by the VF, interrupts are disabled before flushing the workqueue.
--- drivers/crypto/qat/qat_c3xxxvf/adf_drv.c | 1 + drivers/crypto/qat/qat_c62xvf/adf_drv.c | 1 + .../crypto/qat/qat_common/adf_common_drv.h | 5 ++++ drivers/crypto/qat/qat_common/adf_vf_isr.c | 25 +++++++++++++++++++ drivers/crypto/qat/qat_dh895xccvf/adf_drv.c | 1 + 5 files changed, 33 insertions(+)
drivers/crypto/qat/qat_c3xxxvf/adf_drv.c +1 -0
@@ -218,6 +218,7 @@ static void adf_remove(struct pci_dev *pdev)pr_err ("QAT: Driver removal failed\n" );return ; } +adf_flush_vf_wq (accel_dev);adf_dev_stop (accel_dev);adf_dev_shutdown (accel_dev);adf_cleanup_accel (accel_dev);
drivers/crypto/qat/qat_c62xvf/adf_drv.c +1 -0
@@ -218,6 +218,7 @@ static void adf_remove(struct pci_dev *pdev)pr_err ("QAT: Driver removal failed\n" );return ; } +adf_flush_vf_wq (accel_dev);adf_dev_stop (accel_dev);adf_dev_shutdown (accel_dev);adf_cleanup_accel (accel_dev);
drivers/crypto/qat/qat_common/adf_common_drv.h +5 -0
@@ -207,6 +207,7 @@ int adf_init_pf_wq(void);void adf_exit_pf_wq (void );int adf_init_vf_wq (void );void adf_exit_vf_wq (void ); +void adf_flush_vf_wq (struct adf_accel_dev *accel_dev);#else #define adf_sriov_configure NULL
@@ -249,5 +250,9 @@ static inline void adf_exit_vf_wq(void) { } +static inline void adf_flush_vf_wq (struct adf_accel_dev *accel_dev) +{ +} +#endif #endif
drivers/crypto/qat/qat_common/adf_vf_isr.c +25 -0
@@ -48,6 +48,7 @@ void adf_disable_pf2vf_interrupts(struct adf_accel_dev *accel_dev)ADF_CSR_WR (pmisc_bar_addr,ADF_VINTMSK_OFFSET ,0x2 ); } +EXPORT_SYMBOL_GPL (adf_disable_pf2vf_interrupts);static int adf_enable_msi (struct adf_accel_dev *accel_dev) {
@@ -316,6 +317,30 @@ int adf_vf_isr_resource_alloc(struct adf_accel_dev *accel_dev) }EXPORT_SYMBOL_GPL (adf_vf_isr_resource_alloc); +/** +* adf_flush_vf_wq() - Flush workqueue for VF +* @accel_dev: Pointer to acceleration device. +* +* Function disables the PF/VF interrupts on the VF so that no new messages +* are received and flushes the workqueue 'adf_vf_stop_wq'. +* +* Return: void. +*/ +void adf_flush_vf_wq (struct adf_accel_dev *accel_dev) +{ +adf_disable_pf2vf_interrupts (accel_dev); + +flush_workqueue (adf_vf_stop_wq); +} +EXPORT_SYMBOL_GPL (adf_flush_vf_wq); + +/** +* adf_init_vf_wq() - Init workqueue for VF +* +* Function init workqueue 'adf_vf_stop_wq' for VF. +* +* Return: 0 on success, error code otherwise. +*/ int __init adf_init_vf_wq (void ) { adf_vf_stop_wq =alloc_workqueue ("adf_vf_stop_wq" ,WQ_MEM_RECLAIM ,0 );
drivers/crypto/qat/qat_dh895xccvf/adf_drv.c +1 -0
@@ -218,6 +218,7 @@ static void adf_remove(struct pci_dev *pdev)pr_err ("QAT: Driver removal failed\n" );return ; } +adf_flush_vf_wq (accel_dev);adf_dev_stop (accel_dev);adf_dev_shutdown (accel_dev);adf_cleanup_accel (accel_dev);
Signature · 1 line
2.31.1
PATCH 19/20 crypto: qat - do not export adf_iov_putmsg()
In reply to Giovanni CabidduThe function adf_iov_putmsg() is only used inside the intel_qat module therefore should not be exported.
Remove EXPORT_SYMBOL for the function adf_iov_putmsg().
--- drivers/crypto/qat/qat_common/adf_pf2vf_msg.c | 1 - 1 file changed, 1 deletion(-)
drivers/crypto/qat/qat_common/adf_pf2vf_msg.c +0 -1
@@ -192,7 +192,6 @@ int adf_iov_putmsg(struct adf_accel_dev *accel_dev, u32 msg, u8 vf_nr)return ret; } -EXPORT_SYMBOL_GPL (adf_iov_putmsg);void adf_vf2pf_req_hndl (struct adf_accel_vf_info *vf_info) {
Signature · 1 line
2.31.1
PATCH 20/20 crypto: qat - store vf.compatible flag
In reply to Giovanni CabidduIf the VF is newer than the PF, it decides whether it is compatible or not. In case it is compatible, store that information in the vf.compatible flag in the accel_dev structure.
--- drivers/crypto/qat/qat_common/adf_pf2vf_msg.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/crypto/qat/qat_common/adf_pf2vf_msg.c +3 -1
@@ -346,8 +346,10 @@ static int adf_vf2pf_request_version(struct adf_accel_dev *accel_dev)break ;case ADF_PF2VF_VF_COMPAT_UNKNOWN :/* VF is newer than PF and decides whether it is compatible */ -if (accel_dev->vf.pf_version >= hw_data->min_iov_compat_ver) +if (accel_dev->vf.pf_version >= hw_data->min_iov_compat_ver) { + accel_dev->vf.compatible =ADF_PF2VF_VF_COMPATIBLE ;break ; + } fallthrough;case ADF_PF2VF_VF_INCOMPATIBLE : dev_err(&GET_DEV(accel_dev),
Signature · 1 line
2.31.1
Herbert Xu
maintainerQuoted 54 lines · Giovanni Cabiddu
This is a collection of various fixes and improvements, mostly related to PFVF, from various authors.
A previous version of this set was already sent to this list a few weeks ago. I didn't call this V2 since a number of patches were added/removed to the set and the order of the patches changed.Ahsan Atta (1):
crypto: qat - flush vf workqueue at driver removalGiovanni Cabiddu (7):
crypto: qat - use proper type forvf_mask
crypto: qat - do not ignore errors fromenable_vf2pf_comms()
crypto: qat - handle both source of interrupt in VF ISR
crypto: qat - prevent spurious MSI interrupt in VF
crypto: qat - move IO virtualization functions
crypto: qat - do not exportadf_iov_putmsg()
crypto: qat - store vf.compatible flagKanchana Velusamy (1):
crypto: qat - protect interrupt mask CSRs with a spinlockMarco Chiappero (10):
crypto: qat - remove emptysriov_configure()
crypto: qat - enable interrupts only after ISR allocation
crypto: qat - prevent spurious MSI interrupt in PF
crypto: qat - rename compatibility version definition
crypto: qat - fix reuse of completion variable
crypto: qat - move pf2vf interrupt [en|dis]able toadf_vf_isr.c
crypto: qat - fix naming for init/shutdown VF to PF notifications
crypto: qat - complete all the init steps before service notification
crypto: qat - fix naming of PF/VF enable functions
crypto: qat - remove the unnecessaryget_vintmsk_offset()Svyatoslav Pankratov (1):
crypto: qat - remove intermediate tasklet for vf2pf.../crypto/qat/qat_4xxx/adf_4xxx_hw_data.c | 8 +- .../crypto/qat/qat_c3xxx/adf_c3xxx_hw_data.c | 19 ++--- .../crypto/qat/qat_c3xxx/adf_c3xxx_hw_data.h | 1 - .../qat/qat_c3xxxvf/adf_c3xxxvf_hw_data.c | 14 +--- .../qat/qat_c3xxxvf/adf_c3xxxvf_hw_data.h | 1 - drivers/crypto/qat/qat_c3xxxvf/adf_drv.c | 1 + .../crypto/qat/qat_c62x/adf_c62x_hw_data.c | 19 ++--- .../crypto/qat/qat_c62x/adf_c62x_hw_data.h | 1 - .../qat/qat_c62xvf/adf_c62xvf_hw_data.c | 14 +--- .../qat/qat_c62xvf/adf_c62xvf_hw_data.h | 1 - drivers/crypto/qat/qat_c62xvf/adf_drv.c | 1 + .../crypto/qat/qat_common/adf_accel_devices.h | 8 +- .../crypto/qat/qat_common/adf_common_drv.h | 21 +++-- drivers/crypto/qat/qat_common/adf_init.c | 13 ++-- drivers/crypto/qat/qat_common/adf_isr.c | 42 ++++++---- drivers/crypto/qat/qat_common/adf_pf2vf_msg.c | 78 +++++++++++-------- drivers/crypto/qat/qat_common/adf_pf2vf_msg.h | 2 +- drivers/crypto/qat/qat_common/adf_sriov.c | 8 +-
Quoted 8 lines
drivers/crypto/qat/qat_common/adf_vf2pf_msg.c | 12 +-- drivers/crypto/qat/qat_common/adf_vf_isr.c | 64 ++++++++++++++- .../qat/qat_dh895xcc/adf_dh895xcc_hw_data.c | 19 ++--- .../qat/qat_dh895xcc/adf_dh895xcc_hw_data.h | 1 - .../qat_dh895xccvf/adf_dh895xccvf_hw_data.c | 14 +--- .../qat_dh895xccvf/adf_dh895xccvf_hw_data.h | 1 - drivers/crypto/qat/qat_dh895xccvf/adf_drv.c | 1 + 25 files changed, 207 insertions(+), 157 deletions(-)
All applied. Thanks.
Signature · 3 lines
Email: Herbert Xu <[email protected]> Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt