forked from Minki/linux
crypto: qat - fix ETR sources enabled by default on GEN2 devices
When the driver starts the device, it enables all the necessary interrupts. However interrupts associated to host rings are enabled by default on all GEN2 devices (except for dh895x) even when SR-IOV is active. Fix this behaviour by checking if data structures associated to VFs have been allocated to determine whether to enable such interrupts or not. Since the logic for the fix is the same across GEN2 devices, replace the function to be fixed (adf_enable_ints()) with a single one (adf_gen2_enable_ints()) in the common GEN2 code in adf_gen2_hw_data.c. Likewise, remove the unnecessary duplication of defines too. Signed-off-by: Marco Chiappero <marco.chiappero@intel.com> Reviewed-by: Giovanni Cabiddu <giovanni.cabiddu@intel.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
This commit is contained in:
parent
0eaa515432
commit
9ff9139b5d
@ -78,19 +78,6 @@ static const u32 *adf_get_arbiter_mapping(void)
|
||||
return thrd_to_arb_map;
|
||||
}
|
||||
|
||||
static void adf_enable_ints(struct adf_accel_dev *accel_dev)
|
||||
{
|
||||
void __iomem *addr;
|
||||
|
||||
addr = (&GET_BARS(accel_dev)[ADF_C3XXX_PMISC_BAR])->virt_addr;
|
||||
|
||||
/* Enable bundle and misc interrupts */
|
||||
ADF_CSR_WR(addr, ADF_C3XXX_SMIAPF0_MASK_OFFSET,
|
||||
ADF_C3XXX_SMIA0_MASK);
|
||||
ADF_CSR_WR(addr, ADF_C3XXX_SMIAPF1_MASK_OFFSET,
|
||||
ADF_C3XXX_SMIA1_MASK);
|
||||
}
|
||||
|
||||
static void configure_iov_threads(struct adf_accel_dev *accel_dev, bool enable)
|
||||
{
|
||||
adf_gen2_cfg_iov_thds(accel_dev, enable,
|
||||
@ -133,7 +120,7 @@ void adf_init_hw_data_c3xxx(struct adf_hw_device_data *hw_data)
|
||||
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_ints = adf_gen2_enable_ints;
|
||||
hw_data->reset_device = adf_reset_flr;
|
||||
hw_data->set_ssm_wdtimer = adf_gen2_set_ssm_wdtimer;
|
||||
hw_data->disable_iov = adf_disable_sriov;
|
||||
|
@ -13,10 +13,6 @@
|
||||
#define ADF_C3XXX_ACCELERATORS_MASK 0x7
|
||||
#define ADF_C3XXX_ACCELENGINES_MASK 0x3F
|
||||
#define ADF_C3XXX_ETR_MAX_BANKS 16
|
||||
#define ADF_C3XXX_SMIAPF0_MASK_OFFSET (0x3A000 + 0x28)
|
||||
#define ADF_C3XXX_SMIAPF1_MASK_OFFSET (0x3A000 + 0x30)
|
||||
#define ADF_C3XXX_SMIA0_MASK 0xFFFF
|
||||
#define ADF_C3XXX_SMIA1_MASK 0x1
|
||||
#define ADF_C3XXX_SOFTSTRAP_CSR_OFFSET 0x2EC
|
||||
|
||||
/* AE to function mapping */
|
||||
|
@ -80,19 +80,6 @@ static const u32 *adf_get_arbiter_mapping(void)
|
||||
return thrd_to_arb_map;
|
||||
}
|
||||
|
||||
static void adf_enable_ints(struct adf_accel_dev *accel_dev)
|
||||
{
|
||||
void __iomem *addr;
|
||||
|
||||
addr = (&GET_BARS(accel_dev)[ADF_C62X_PMISC_BAR])->virt_addr;
|
||||
|
||||
/* Enable bundle and misc interrupts */
|
||||
ADF_CSR_WR(addr, ADF_C62X_SMIAPF0_MASK_OFFSET,
|
||||
ADF_C62X_SMIA0_MASK);
|
||||
ADF_CSR_WR(addr, ADF_C62X_SMIAPF1_MASK_OFFSET,
|
||||
ADF_C62X_SMIA1_MASK);
|
||||
}
|
||||
|
||||
static void configure_iov_threads(struct adf_accel_dev *accel_dev, bool enable)
|
||||
{
|
||||
adf_gen2_cfg_iov_thds(accel_dev, enable,
|
||||
@ -135,7 +122,7 @@ void adf_init_hw_data_c62x(struct adf_hw_device_data *hw_data)
|
||||
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_ints = adf_gen2_enable_ints;
|
||||
hw_data->reset_device = adf_reset_flr;
|
||||
hw_data->set_ssm_wdtimer = adf_gen2_set_ssm_wdtimer;
|
||||
hw_data->disable_iov = adf_disable_sriov;
|
||||
|
@ -13,10 +13,6 @@
|
||||
#define ADF_C62X_ACCELERATORS_MASK 0x1F
|
||||
#define ADF_C62X_ACCELENGINES_MASK 0x3FF
|
||||
#define ADF_C62X_ETR_MAX_BANKS 16
|
||||
#define ADF_C62X_SMIAPF0_MASK_OFFSET (0x3A000 + 0x28)
|
||||
#define ADF_C62X_SMIAPF1_MASK_OFFSET (0x3A000 + 0x30)
|
||||
#define ADF_C62X_SMIA0_MASK 0xFFFF
|
||||
#define ADF_C62X_SMIA1_MASK 0x1
|
||||
#define ADF_C62X_SOFTSTRAP_CSR_OFFSET 0x2EC
|
||||
|
||||
/* AE to function mapping */
|
||||
|
@ -98,6 +98,19 @@ void adf_gen2_get_arb_info(struct arb_info *arb_info)
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(adf_gen2_get_arb_info);
|
||||
|
||||
void adf_gen2_enable_ints(struct adf_accel_dev *accel_dev)
|
||||
{
|
||||
void __iomem *addr = adf_get_pmisc_base(accel_dev);
|
||||
u32 val;
|
||||
|
||||
val = accel_dev->pf.vf_info ? 0 : BIT_ULL(GET_MAX_BANKS(accel_dev)) - 1;
|
||||
|
||||
/* Enable bundle and misc interrupts */
|
||||
ADF_CSR_WR(addr, ADF_GEN2_SMIAPF0_MASK_OFFSET, val);
|
||||
ADF_CSR_WR(addr, ADF_GEN2_SMIAPF1_MASK_OFFSET, ADF_GEN2_SMIA1_MASK);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(adf_gen2_enable_ints);
|
||||
|
||||
static u64 build_csr_ring_base_addr(dma_addr_t addr, u32 size)
|
||||
{
|
||||
return BUILD_RING_BASE_ADDR(addr, size);
|
||||
|
@ -145,6 +145,11 @@ do { \
|
||||
#define ADF_GEN2_CERRSSMSH(i) ((i) * 0x4000 + 0x10)
|
||||
#define ADF_GEN2_ERRSSMSH_EN BIT(3)
|
||||
|
||||
/* Interrupts */
|
||||
#define ADF_GEN2_SMIAPF0_MASK_OFFSET (0x3A000 + 0x28)
|
||||
#define ADF_GEN2_SMIAPF1_MASK_OFFSET (0x3A000 + 0x30)
|
||||
#define ADF_GEN2_SMIA1_MASK 0x1
|
||||
|
||||
u32 adf_gen2_get_num_accels(struct adf_hw_device_data *self);
|
||||
u32 adf_gen2_get_num_aes(struct adf_hw_device_data *self);
|
||||
void adf_gen2_enable_error_correction(struct adf_accel_dev *accel_dev);
|
||||
@ -153,6 +158,7 @@ void adf_gen2_cfg_iov_thds(struct adf_accel_dev *accel_dev, bool enable,
|
||||
void adf_gen2_init_hw_csr_ops(struct adf_hw_csr_ops *csr_ops);
|
||||
void adf_gen2_get_admin_info(struct admin_info *admin_csrs_info);
|
||||
void adf_gen2_get_arb_info(struct arb_info *arb_info);
|
||||
void adf_gen2_enable_ints(struct adf_accel_dev *accel_dev);
|
||||
u32 adf_gen2_get_accel_cap(struct adf_accel_dev *accel_dev);
|
||||
void adf_gen2_set_ssm_wdtimer(struct adf_accel_dev *accel_dev);
|
||||
|
||||
|
@ -107,20 +107,6 @@ static const u32 *adf_get_arbiter_mapping(void)
|
||||
return thrd_to_arb_map;
|
||||
}
|
||||
|
||||
static void adf_enable_ints(struct adf_accel_dev *accel_dev)
|
||||
{
|
||||
void __iomem *addr;
|
||||
|
||||
addr = (&GET_BARS(accel_dev)[ADF_DH895XCC_PMISC_BAR])->virt_addr;
|
||||
|
||||
/* Enable bundle and misc interrupts */
|
||||
ADF_CSR_WR(addr, ADF_DH895XCC_SMIAPF0_MASK_OFFSET,
|
||||
accel_dev->pf.vf_info ? 0 :
|
||||
BIT_ULL(GET_MAX_BANKS(accel_dev)) - 1);
|
||||
ADF_CSR_WR(addr, ADF_DH895XCC_SMIAPF1_MASK_OFFSET,
|
||||
ADF_DH895XCC_SMIA1_MASK);
|
||||
}
|
||||
|
||||
static u32 get_vf2pf_sources(void __iomem *pmisc_bar)
|
||||
{
|
||||
u32 errsou3, errmsk3, errsou5, errmsk5, vf_int_mask;
|
||||
@ -222,7 +208,7 @@ void adf_init_hw_data_dh895xcc(struct adf_hw_device_data *hw_data)
|
||||
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_ints = adf_gen2_enable_ints;
|
||||
hw_data->reset_device = adf_reset_sbr;
|
||||
hw_data->disable_iov = adf_disable_sriov;
|
||||
|
||||
|
@ -19,10 +19,6 @@
|
||||
#define ADF_DH895XCC_ACCELERATORS_MASK 0x3F
|
||||
#define ADF_DH895XCC_ACCELENGINES_MASK 0xFFF
|
||||
#define ADF_DH895XCC_ETR_MAX_BANKS 32
|
||||
#define ADF_DH895XCC_SMIAPF0_MASK_OFFSET (0x3A000 + 0x28)
|
||||
#define ADF_DH895XCC_SMIAPF1_MASK_OFFSET (0x3A000 + 0x30)
|
||||
#define ADF_DH895XCC_SMIA0_MASK 0xFFFFFFFF
|
||||
#define ADF_DH895XCC_SMIA1_MASK 0x1
|
||||
|
||||
/* Masks for VF2PF interrupts */
|
||||
#define ADF_DH895XCC_ERR_REG_VF2PF_L(vf_src) (((vf_src) & 0x01FFFE00) >> 9)
|
||||
|
Loading…
Reference in New Issue
Block a user