Commit a3e8c919 authored by Damian Muszynski's avatar Damian Muszynski Committed by Herbert Xu

crypto: qat - add support for 402xx devices

QAT_402xx is a derivative of 4xxx. Add support for that device in the
qat_4xxx driver by including the DIDs (both PF and VF), extending the
probe and the firmware loader.

402xx uses different firmware images than 4xxx. To allow that the logic
that selects the firmware images was modified.
Signed-off-by: default avatarDamian Muszynski <damian.muszynski@intel.com>
Reviewed-by: default avatarGiovanni Cabiddu <giovanni.cabiddu@intel.com>
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
parent b2ca2950
...@@ -28,6 +28,18 @@ static struct adf_fw_config adf_4xxx_fw_dc_config[] = { ...@@ -28,6 +28,18 @@ static struct adf_fw_config adf_4xxx_fw_dc_config[] = {
{0x100, ADF_4XXX_ADMIN_OBJ}, {0x100, ADF_4XXX_ADMIN_OBJ},
}; };
static struct adf_fw_config adf_402xx_fw_cy_config[] = {
{0xF0, ADF_402XX_SYM_OBJ},
{0xF, ADF_402XX_ASYM_OBJ},
{0x100, ADF_402XX_ADMIN_OBJ},
};
static struct adf_fw_config adf_402xx_fw_dc_config[] = {
{0xF0, ADF_402XX_DC_OBJ},
{0xF, ADF_402XX_DC_OBJ},
{0x100, ADF_402XX_ADMIN_OBJ},
};
/* Worker thread to service arbiter mappings */ /* Worker thread to service arbiter mappings */
static const u32 thrd_to_arb_map[ADF_4XXX_MAX_ACCELENGINES] = { static const u32 thrd_to_arb_map[ADF_4XXX_MAX_ACCELENGINES] = {
0x5555555, 0x5555555, 0x5555555, 0x5555555, 0x5555555, 0x5555555, 0x5555555, 0x5555555,
...@@ -286,7 +298,7 @@ static u32 uof_get_num_objs(void) ...@@ -286,7 +298,7 @@ static u32 uof_get_num_objs(void)
return ARRAY_SIZE(adf_4xxx_fw_cy_config); return ARRAY_SIZE(adf_4xxx_fw_cy_config);
} }
static char *uof_get_name(struct adf_accel_dev *accel_dev, u32 obj_num) static char *uof_get_name_4xxx(struct adf_accel_dev *accel_dev, u32 obj_num)
{ {
switch (get_service_enabled(accel_dev)) { switch (get_service_enabled(accel_dev)) {
case SVC_CY: case SVC_CY:
...@@ -298,6 +310,18 @@ static char *uof_get_name(struct adf_accel_dev *accel_dev, u32 obj_num) ...@@ -298,6 +310,18 @@ static char *uof_get_name(struct adf_accel_dev *accel_dev, u32 obj_num)
return NULL; return NULL;
} }
static char *uof_get_name_402xx(struct adf_accel_dev *accel_dev, u32 obj_num)
{
switch (get_service_enabled(accel_dev)) {
case SVC_CY:
return adf_402xx_fw_cy_config[obj_num].obj_name;
case SVC_DC:
return adf_402xx_fw_dc_config[obj_num].obj_name;
}
return NULL;
}
static u32 uof_get_ae_mask(struct adf_accel_dev *accel_dev, u32 obj_num) static u32 uof_get_ae_mask(struct adf_accel_dev *accel_dev, u32 obj_num)
{ {
switch (get_service_enabled(accel_dev)) { switch (get_service_enabled(accel_dev)) {
...@@ -310,7 +334,7 @@ static u32 uof_get_ae_mask(struct adf_accel_dev *accel_dev, u32 obj_num) ...@@ -310,7 +334,7 @@ static u32 uof_get_ae_mask(struct adf_accel_dev *accel_dev, u32 obj_num)
return 0; return 0;
} }
void adf_init_hw_data_4xxx(struct adf_hw_device_data *hw_data) void adf_init_hw_data_4xxx(struct adf_hw_device_data *hw_data, u32 dev_id)
{ {
hw_data->dev_class = &adf_4xxx_class; hw_data->dev_class = &adf_4xxx_class;
hw_data->instance_id = adf_4xxx_class.instances++; hw_data->instance_id = adf_4xxx_class.instances++;
...@@ -337,8 +361,6 @@ void adf_init_hw_data_4xxx(struct adf_hw_device_data *hw_data) ...@@ -337,8 +361,6 @@ void adf_init_hw_data_4xxx(struct adf_hw_device_data *hw_data)
hw_data->get_admin_info = get_admin_info; hw_data->get_admin_info = get_admin_info;
hw_data->get_accel_cap = get_accel_cap; hw_data->get_accel_cap = get_accel_cap;
hw_data->get_sku = get_sku; hw_data->get_sku = get_sku;
hw_data->fw_name = ADF_4XXX_FW;
hw_data->fw_mmp_name = ADF_4XXX_MMP;
hw_data->init_admin_comms = adf_init_admin_comms; hw_data->init_admin_comms = adf_init_admin_comms;
hw_data->exit_admin_comms = adf_exit_admin_comms; hw_data->exit_admin_comms = adf_exit_admin_comms;
hw_data->send_admin_init = adf_send_admin_init; hw_data->send_admin_init = adf_send_admin_init;
...@@ -349,8 +371,19 @@ void adf_init_hw_data_4xxx(struct adf_hw_device_data *hw_data) ...@@ -349,8 +371,19 @@ void adf_init_hw_data_4xxx(struct adf_hw_device_data *hw_data)
hw_data->init_device = adf_init_device; hw_data->init_device = adf_init_device;
hw_data->reset_device = adf_reset_flr; hw_data->reset_device = adf_reset_flr;
hw_data->admin_ae_mask = ADF_4XXX_ADMIN_AE_MASK; hw_data->admin_ae_mask = ADF_4XXX_ADMIN_AE_MASK;
switch (dev_id) {
case ADF_402XX_PCI_DEVICE_ID:
hw_data->fw_name = ADF_402XX_FW;
hw_data->fw_mmp_name = ADF_402XX_MMP;
hw_data->uof_get_name = uof_get_name_402xx;
break;
default:
hw_data->fw_name = ADF_4XXX_FW;
hw_data->fw_mmp_name = ADF_4XXX_MMP;
hw_data->uof_get_name = uof_get_name_4xxx;
}
hw_data->uof_get_num_objs = uof_get_num_objs; 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->uof_get_ae_mask = uof_get_ae_mask;
hw_data->set_msix_rttable = set_msix_default_rttable; hw_data->set_msix_rttable = set_msix_default_rttable;
hw_data->set_ssm_wdtimer = adf_gen4_set_ssm_wdtimer; hw_data->set_ssm_wdtimer = adf_gen4_set_ssm_wdtimer;
......
...@@ -56,6 +56,13 @@ ...@@ -56,6 +56,13 @@
#define ADF_4XXX_DC_OBJ "qat_4xxx_dc.bin" #define ADF_4XXX_DC_OBJ "qat_4xxx_dc.bin"
#define ADF_4XXX_ASYM_OBJ "qat_4xxx_asym.bin" #define ADF_4XXX_ASYM_OBJ "qat_4xxx_asym.bin"
#define ADF_4XXX_ADMIN_OBJ "qat_4xxx_admin.bin" #define ADF_4XXX_ADMIN_OBJ "qat_4xxx_admin.bin"
/* Firmware for 402XXX */
#define ADF_402XX_FW "qat_402xx.bin"
#define ADF_402XX_MMP "qat_402xx_mmp.bin"
#define ADF_402XX_SYM_OBJ "qat_402xx_sym.bin"
#define ADF_402XX_DC_OBJ "qat_402xx_dc.bin"
#define ADF_402XX_ASYM_OBJ "qat_402xx_asym.bin"
#define ADF_402XX_ADMIN_OBJ "qat_402xx_admin.bin"
/* qat_4xxx fuse bits are different from old GENs, redefine them */ /* qat_4xxx fuse bits are different from old GENs, redefine them */
enum icp_qat_4xxx_slice_mask { enum icp_qat_4xxx_slice_mask {
...@@ -68,7 +75,7 @@ enum icp_qat_4xxx_slice_mask { ...@@ -68,7 +75,7 @@ enum icp_qat_4xxx_slice_mask {
ICP_ACCEL_4XXX_MASK_SMX_SLICE = BIT(6), ICP_ACCEL_4XXX_MASK_SMX_SLICE = BIT(6),
}; };
void adf_init_hw_data_4xxx(struct adf_hw_device_data *hw_data); void adf_init_hw_data_4xxx(struct adf_hw_device_data *hw_data, u32 dev_id);
void adf_clean_hw_data_4xxx(struct adf_hw_device_data *hw_data); void adf_clean_hw_data_4xxx(struct adf_hw_device_data *hw_data);
int adf_gen4_dev_config(struct adf_accel_dev *accel_dev); int adf_gen4_dev_config(struct adf_accel_dev *accel_dev);
......
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
static const struct pci_device_id adf_pci_tbl[] = { static const struct pci_device_id adf_pci_tbl[] = {
{ PCI_VDEVICE(INTEL, ADF_4XXX_PCI_DEVICE_ID), }, { PCI_VDEVICE(INTEL, ADF_4XXX_PCI_DEVICE_ID), },
{ PCI_VDEVICE(INTEL, ADF_401XX_PCI_DEVICE_ID), }, { PCI_VDEVICE(INTEL, ADF_401XX_PCI_DEVICE_ID), },
{ PCI_VDEVICE(INTEL, ADF_402XX_PCI_DEVICE_ID), },
{ } { }
}; };
MODULE_DEVICE_TABLE(pci, adf_pci_tbl); MODULE_DEVICE_TABLE(pci, adf_pci_tbl);
...@@ -330,7 +331,7 @@ static int adf_probe(struct pci_dev *pdev, const struct pci_device_id *ent) ...@@ -330,7 +331,7 @@ static int adf_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
} }
accel_dev->hw_device = hw_data; accel_dev->hw_device = hw_data;
adf_init_hw_data_4xxx(accel_dev->hw_device); adf_init_hw_data_4xxx(accel_dev->hw_device, ent->device);
pci_read_config_byte(pdev, PCI_REVISION_ID, &accel_pci_dev->revid); pci_read_config_byte(pdev, PCI_REVISION_ID, &accel_pci_dev->revid);
pci_read_config_dword(pdev, ADF_4XXX_FUSECTL4_OFFSET, &hw_data->fuses); pci_read_config_dword(pdev, ADF_4XXX_FUSECTL4_OFFSET, &hw_data->fuses);
......
...@@ -21,6 +21,8 @@ ...@@ -21,6 +21,8 @@
#define ADF_4XXXIOV_PCI_DEVICE_ID 0x4941 #define ADF_4XXXIOV_PCI_DEVICE_ID 0x4941
#define ADF_401XX_PCI_DEVICE_ID 0x4942 #define ADF_401XX_PCI_DEVICE_ID 0x4942
#define ADF_401XXIOV_PCI_DEVICE_ID 0x4943 #define ADF_401XXIOV_PCI_DEVICE_ID 0x4943
#define ADF_402XX_PCI_DEVICE_ID 0x4944
#define ADF_402XXIOV_PCI_DEVICE_ID 0x4945
#define ADF_DEVICE_FUSECTL_OFFSET 0x40 #define ADF_DEVICE_FUSECTL_OFFSET 0x40
#define ADF_DEVICE_LEGFUSE_OFFSET 0x4C #define ADF_DEVICE_LEGFUSE_OFFSET 0x4C
#define ADF_DEVICE_FUSECTL_MASK 0x80000000 #define ADF_DEVICE_FUSECTL_MASK 0x80000000
......
...@@ -696,6 +696,7 @@ static int qat_hal_chip_init(struct icp_qat_fw_loader_handle *handle, ...@@ -696,6 +696,7 @@ static int qat_hal_chip_init(struct icp_qat_fw_loader_handle *handle,
switch (handle->pci_dev->device) { switch (handle->pci_dev->device) {
case ADF_4XXX_PCI_DEVICE_ID: case ADF_4XXX_PCI_DEVICE_ID:
case ADF_401XX_PCI_DEVICE_ID: case ADF_401XX_PCI_DEVICE_ID:
case ADF_402XX_PCI_DEVICE_ID:
handle->chip_info->mmp_sram_size = 0; handle->chip_info->mmp_sram_size = 0;
handle->chip_info->nn = false; handle->chip_info->nn = false;
handle->chip_info->lm2lm3 = true; handle->chip_info->lm2lm3 = true;
......
...@@ -732,6 +732,7 @@ qat_uclo_get_dev_type(struct icp_qat_fw_loader_handle *handle) ...@@ -732,6 +732,7 @@ qat_uclo_get_dev_type(struct icp_qat_fw_loader_handle *handle)
return ICP_QAT_AC_C3XXX_DEV_TYPE; return ICP_QAT_AC_C3XXX_DEV_TYPE;
case ADF_4XXX_PCI_DEVICE_ID: case ADF_4XXX_PCI_DEVICE_ID:
case ADF_401XX_PCI_DEVICE_ID: case ADF_401XX_PCI_DEVICE_ID:
case ADF_402XX_PCI_DEVICE_ID:
return ICP_QAT_AC_4XXX_A_DEV_TYPE; return ICP_QAT_AC_4XXX_A_DEV_TYPE;
default: default:
pr_err("QAT: unsupported device 0x%x\n", pr_err("QAT: unsupported device 0x%x\n",
......
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