Replace user types and remove packed
cover Replace user types and remove packed
Remove user types across qat code base and replace packed attribute in etr ring struct which causes a split lock.
These changes are on top of "crypto: qat - fix parameter check in aead encryption" (https://patchwork.kernel.org/patch/11574001/)
Giovanni Cabiddu (1):
crypto: qat - remove packed attribute in etr structs
Wojciech Ziemba (2):
crypto: qat - replace user types with kernel u types
crypto: qat - replace user types with kernel ABI __u types
.../crypto/qat/qat_common/adf_accel_devices.h | 54 +++--- .../crypto/qat/qat_common/adf_accel_engine.c | 4 +- drivers/crypto/qat/qat_common/adf_aer.c | 2 +- .../crypto/qat/qat_common/adf_cfg_common.h | 24 +-- drivers/crypto/qat/qat_common/adf_cfg_user.h | 10 +- .../crypto/qat/qat_common/adf_common_drv.h | 12 +- drivers/crypto/qat/qat_common/adf_ctl_drv.c | 4 +- drivers/crypto/qat/qat_common/adf_dev_mgr.c | 8 +- drivers/crypto/qat/qat_common/adf_transport.c | 62 +++---- drivers/crypto/qat/qat_common/adf_transport.h | 4 +- .../qat_common/adf_transport_access_macros.h | 6 +- .../qat/qat_common/adf_transport_internal.h | 27 ++- drivers/crypto/qat/qat_common/icp_qat_fw.h | 58 +++---- .../qat/qat_common/icp_qat_fw_init_admin.h | 46 ++--- drivers/crypto/qat/qat_common/icp_qat_fw_la.h | 158 +++++++++--------- .../crypto/qat/qat_common/icp_qat_fw_pke.h | 52 +++--- drivers/crypto/qat/qat_common/icp_qat_hw.h | 16 +- drivers/crypto/qat/qat_common/icp_qat_uclo.h | 6 +- drivers/crypto/qat/qat_common/qat_algs.c | 54 +++--- drivers/crypto/qat/qat_common/qat_asym_algs.c | 12 +- drivers/crypto/qat/qat_common/qat_hal.c | 40 ++--- drivers/crypto/qat/qat_common/qat_uclo.c | 20 +-- .../qat/qat_dh895xcc/adf_dh895xcc_hw_data.c | 26 +-- 23 files changed, 352 insertions(+), 353 deletions(-)
Signature · 1 line
2.26.2
PATCH 1/3 crypto: qat - replace user types with kernel u types
From: Wojciech Ziemba <[email protected]>
Kernel source code should not include stdint.h types.
This patch replaces uintXX_t types with respective ones defined in kernel headers.
--- .../crypto/qat/qat_common/adf_accel_devices.h | 54 ++++++++-------- .../crypto/qat/qat_common/adf_accel_engine.c | 4 +- drivers/crypto/qat/qat_common/adf_aer.c | 2 +- .../crypto/qat/qat_common/adf_common_drv.h | 12 ++-- drivers/crypto/qat/qat_common/adf_ctl_drv.c | 4 +- drivers/crypto/qat/qat_common/adf_dev_mgr.c | 8 +-- drivers/crypto/qat/qat_common/adf_transport.c | 62 +++++++++---------- drivers/crypto/qat/qat_common/adf_transport.h | 4 +- .../qat_common/adf_transport_access_macros.h | 6 +- .../qat/qat_common/adf_transport_internal.h | 20 +++--- drivers/crypto/qat/qat_common/icp_qat_uclo.h | 6 +- drivers/crypto/qat/qat_common/qat_algs.c | 54 ++++++++-------- drivers/crypto/qat/qat_common/qat_asym_algs.c | 12 ++-- drivers/crypto/qat/qat_common/qat_hal.c | 40 ++++++------ drivers/crypto/qat/qat_common/qat_uclo.c | 20 +++--- .../qat/qat_dh895xcc/adf_dh895xcc_hw_data.c | 26 ++++---- 16 files changed, 167 insertions(+), 167 deletions(-)
drivers/crypto/qat/qat_common/adf_accel_devices.h +27 -27
@@ -59,8 +59,8 @@ struct adf_accel_pci {struct pci_dev *pci_dev;struct adf_accel_msix msix_entries;struct adf_bar pci_bars[ADF_PCI_MAX_BARS ]; -uint8_t revid; -uint8_t sku; +u8 revid; +u8 sku; } __packed;enum dev_state {
@@ -100,7 +100,7 @@ static inline const char *get_sku_info(enum dev_sku_info info)struct adf_hw_device_class {const char *name;const enum adf_device_type type; -uint32_t instances; +u32 instances; } __packed;struct adf_cfg_device_data ;
@@ -110,15 +110,15 @@ struct adf_etr_ring_data;struct adf_hw_device_data {struct adf_hw_device_class *dev_class; -uint32_t (*get_accel_mask)(uint32_t fuse); -uint32_t (*get_ae_mask)(uint32_t fuse); -uint32_t (*get_sram_bar_id)(struct adf_hw_device_data *self); -uint32_t (*get_misc_bar_id)(struct adf_hw_device_data *self); -uint32_t (*get_etr_bar_id)(struct adf_hw_device_data *self); -uint32_t (*get_num_aes)(struct adf_hw_device_data *self); -uint32_t (*get_num_accels)(struct adf_hw_device_data *self); -uint32_t (*get_pf2vf_offset)(uint32_t i); -uint32_t (*get_vintmsk_offset)(uint32_t i); +u32 (*get_accel_mask)(u32 fuse); +u32 (*get_ae_mask)(u32 fuse); +u32 (*get_sram_bar_id)(struct adf_hw_device_data *self); +u32 (*get_misc_bar_id)(struct adf_hw_device_data *self); +u32 (*get_etr_bar_id)(struct adf_hw_device_data *self); +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);enum dev_sku_info (*get_sku)(struct adf_hw_device_data *self);int (*alloc_irq)(struct adf_accel_dev *accel_dev);void (*free_irq)(struct adf_accel_dev *accel_dev);
@@ -129,25 +129,25 @@ struct adf_hw_device_data {int (*init_arb)(struct adf_accel_dev *accel_dev);void (*exit_arb)(struct adf_accel_dev *accel_dev);void (*get_arb_mapping)(struct adf_accel_dev *accel_dev, -const uint32_t **cfg); +const u32 **cfg);void (*disable_iov)(struct adf_accel_dev *accel_dev);void (*enable_ints)(struct adf_accel_dev *accel_dev);int (*enable_vf2pf_comms)(struct adf_accel_dev *accel_dev);void (*reset_device)(struct adf_accel_dev *accel_dev);const char *fw_name;const char *fw_mmp_name; -uint32_t fuses; -uint32_t accel_capabilities_mask; -uint32_t instance_id; -uint16_t accel_mask; -uint16_t ae_mask; -uint16_t tx_rings_mask; -uint8_t tx_rx_gap; -uint8_t num_banks; -uint8_t num_accel; -uint8_t num_logical_accel; -uint8_t num_engines; -uint8_t min_iov_compat_ver; +u32 fuses; +u32 accel_capabilities_mask; +u32 instance_id; +u16 accel_mask; +u16 ae_mask; +u16 tx_rings_mask; +u8 tx_rx_gap; +u8 num_banks; +u8 num_accel; +u8 num_logical_accel; +u8 num_engines; +u8 min_iov_compat_ver; } __packed;/* CSR write macro */
@@ -204,8 +204,8 @@ struct adf_accel_dev {struct tasklet_struct pf2vf_bh_tasklet;struct mutex vf2pf_lock;/* protect CSR access */ struct completion iov_msg_completion; -uint8_t compatible; -uint8_t pf_version; +u8 compatible; +u8 pf_version; } vf; };bool is_vf;
drivers/crypto/qat/qat_common/adf_accel_engine.c +2 -2
@@ -74,7 +74,7 @@ int adf_ae_start(struct adf_accel_dev *accel_dev) {struct adf_fw_loader_data *loader_data = accel_dev->fw_loader;struct adf_hw_device_data *hw_data = accel_dev->hw_device; -uint32_t ae_ctr, ae, max_aes =GET_MAX_ACCELENGINES (accel_dev); +u32 ae_ctr, ae, max_aes =GET_MAX_ACCELENGINES (accel_dev);if (!hw_data->fw_name)return 0 ;
@@ -95,7 +95,7 @@ int adf_ae_stop(struct adf_accel_dev *accel_dev) {struct adf_fw_loader_data *loader_data = accel_dev->fw_loader;struct adf_hw_device_data *hw_data = accel_dev->hw_device; -uint32_t ae_ctr, ae, max_aes =GET_MAX_ACCELENGINES (accel_dev); +u32 ae_ctr, ae, max_aes =GET_MAX_ACCELENGINES (accel_dev);if (!hw_data->fw_name)return 0 ;
drivers/crypto/qat/qat_common/adf_aer.c +1 -1
@@ -42,7 +42,7 @@ void adf_reset_sbr(struct adf_accel_dev *accel_dev) {struct pci_dev *pdev =accel_to_pci_dev (accel_dev);struct pci_dev *parent = pdev->bus->self; -uint16_t bridge_ctl =0 ; +u16 bridge_ctl =0 ;if (!parent) parent = pdev;
drivers/crypto/qat/qat_common/adf_common_drv.h +6 -6
@@ -79,11 +79,11 @@ int adf_devmgr_add_dev(struct adf_accel_dev *accel_dev,void adf_devmgr_rm_dev (struct adf_accel_dev *accel_dev,struct adf_accel_dev *pf);struct list_head *adf_devmgr_get_head (void ); -struct adf_accel_dev *adf_devmgr_get_dev_by_id (uint32_t id); +struct adf_accel_dev *adf_devmgr_get_dev_by_id (u32 id);struct adf_accel_dev *adf_devmgr_get_first (void );struct adf_accel_dev *adf_devmgr_pci_to_accel_dev (struct pci_dev *pci_dev); -int adf_devmgr_verify_id (uint32_t id); -void adf_devmgr_get_num_dev (uint32_t *num); +int adf_devmgr_verify_id (u32 id); +void adf_devmgr_get_num_dev (u32 *num);int adf_devmgr_in_reset (struct adf_accel_dev *accel_dev);int adf_dev_started (struct adf_accel_dev *accel_dev);int adf_dev_restarting_notify (struct adf_accel_dev *accel_dev);
@@ -154,7 +154,7 @@ void qat_hal_set_pc(struct icp_qat_fw_loader_handle *handle, unsigned char ae, unsigned int ctx_mask, unsigned int upc);void qat_hal_wr_uwords (struct icp_qat_fw_loader_handle *handle,unsigned char ae,unsigned int uaddr, -unsigned int words_num,uint64_t *uword); +unsigned int words_num,u64 *uword);void qat_hal_wr_umem (struct icp_qat_fw_loader_handle *handle,unsigned char ae,unsigned int uword_addr,unsigned int words_num,unsigned int *data);
@@ -189,9 +189,9 @@ int qat_uclo_map_obj(struct icp_qat_fw_loader_handle *handle,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, -uint32_t vf_mask); +u32 vf_mask);void adf_enable_vf2pf_interrupts (struct adf_accel_dev *accel_dev, -uint32_t vf_mask); +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);
drivers/crypto/qat/qat_common/adf_ctl_drv.c +2 -2
@@ -226,7 +226,7 @@ static int adf_ctl_is_device_in_use(int id)return 0 ; } -static void adf_ctl_stop_devices (uint32_t id) +static void adf_ctl_stop_devices (u32 id) {struct adf_accel_dev *accel_dev;
@@ -330,7 +330,7 @@ static int adf_ctl_ioctl_dev_start(struct file *fp, unsigned int cmd,static int adf_ctl_ioctl_get_num_devices (struct file *fp,unsigned int cmd,unsigned long arg) { -uint32_t num_devices =0 ; +u32 num_devices =0 ;adf_devmgr_get_num_dev (&num_devices);if (copy_to_user ((void __user *)arg, &num_devices,sizeof (num_devices)))
drivers/crypto/qat/qat_common/adf_dev_mgr.c +4 -4
@@ -8,7 +8,7 @@static LIST_HEAD (accel_table);static LIST_HEAD (vfs_table);static DEFINE_MUTEX (table_lock); -static uint32_t num_devices; +static u32 num_devices;static u8 id_map[ADF_MAX_DEVICES ];struct vf_id_map {
@@ -311,7 +311,7 @@ struct adf_accel_dev *adf_devmgr_pci_to_accel_dev(struct pci_dev *pci_dev) }EXPORT_SYMBOL_GPL (adf_devmgr_pci_to_accel_dev); -struct adf_accel_dev *adf_devmgr_get_dev_by_id (uint32_t id) +struct adf_accel_dev *adf_devmgr_get_dev_by_id (u32 id) {struct list_head *itr;int real_id;
@@ -336,7 +336,7 @@ struct adf_accel_dev *adf_devmgr_get_dev_by_id(uint32_t id)return NULL ; } -int adf_devmgr_verify_id (uint32_t id) +int adf_devmgr_verify_id (u32 id) {if (id ==ADF_CFG_ALL_DEVICES )return 0 ;
@@ -363,7 +363,7 @@ static int adf_get_num_dettached_vfs(void)return vfs; } -void adf_devmgr_get_num_dev (uint32_t *num) +void adf_devmgr_get_num_dev (u32 *num) { *num = num_devices -adf_get_num_dettached_vfs (); }
drivers/crypto/qat/qat_common/adf_transport.c +31 -31
205 lines not on this page · raw message
drivers/crypto/qat/qat_common/adf_transport.h +2 -2
@@ -10,10 +10,10 @@ struct adf_etr_ring_data;typedef void (*adf_callback_fn )(void *resp_msg);int adf_create_ring (struct adf_accel_dev *accel_dev,const char *section, -uint32_t bank_num,uint32_t num_mgs,uint32_t msg_size, +u32 bank_num,u32 num_mgs,u32 msg_size,const char *ring_name,adf_callback_fn callback,int poll_mode,struct adf_etr_ring_data **ring_ptr); -int adf_send_message (struct adf_etr_ring_data *ring,uint32_t *msg); +int adf_send_message (struct adf_etr_ring_data *ring,u32 *msg);void adf_remove_ring (struct adf_etr_ring_data *ring);#endif
drivers/crypto/qat/qat_common/adf_transport_access_macros.h +3 -3
@@ -88,9 +88,9 @@ ADF_RING_CSR_RING_CONFIG + (ring << 2), value)#define WRITE_CSR_RING_BASE (csr_base_addr, bank, ring, value) \ do { \ - uint32_t l_base = 0, u_base = 0; \ - l_base = (uint32_t)(value & 0xFFFFFFFF); \ - u_base = (uint32_t)((value & 0xFFFFFFFF00000000ULL) >> 32); \ + u32 l_base = 0, u_base = 0; \ + l_base = (u32)(value & 0xFFFFFFFF); \ + u_base = (u32)((value & 0xFFFFFFFF00000000ULL) >> 32); \ ADF_CSR_WR(csr_base_addr, (ADF_RING_BUNDLE_SIZE * bank) + \ ADF_RING_CSR_RING_LBASE + (ring << 2), l_base); \ ADF_CSR_WR(csr_base_addr, (ADF_RING_BUNDLE_SIZE * bank) + \
drivers/crypto/qat/qat_common/adf_transport_internal.h +10 -10
@@ -19,12 +19,12 @@ struct adf_etr_ring_data {adf_callback_fn callback;struct adf_etr_bank_data *bank;dma_addr_t dma_addr; -uint16_t head; -uint16_t tail; -uint8_t ring_number; -uint8_t ring_size; -uint8_t msg_size; -uint8_t reserved; +u16 head; +u16 tail; +u8 ring_number; +u8 ring_size; +u8 msg_size; +u8 reserved;struct adf_etr_ring_debug_entry *ring_debug; } __packed;
@@ -33,13 +33,13 @@ struct adf_etr_bank_data {struct tasklet_struct resp_handler;void __iomem *csr_addr;struct adf_accel_dev *accel_dev; -uint32_t irq_coalesc_timer; -uint16_t ring_mask; -uint16_t irq_mask; +u32 irq_coalesc_timer; +u16 ring_mask; +u16 irq_mask;spinlock_t lock;/* protects bank data struct */ struct dentry *bank_debug_dir;struct dentry *bank_debug_cfg; -uint32_t bank_number; +u32 bank_number; } __packed;struct adf_etr_data {
drivers/crypto/qat/qat_common/icp_qat_uclo.h +3 -3
@@ -132,7 +132,7 @@ struct icp_qat_uof_encap_obj {struct icp_qat_uclo_encap_uwblock {unsigned int start_addr;unsigned int words_num; -uint64_t micro_words; +u64 micro_words; };struct icp_qat_uclo_encap_page {
@@ -171,7 +171,7 @@ struct icp_qat_uclo_objhdr {struct icp_qat_uof_strtable {unsigned int table_len;unsigned int reserved; -uint64_t strings; +u64 strings; };struct icp_qat_uclo_objhandle {
@@ -191,7 +191,7 @@ struct icp_qat_uclo_objhandle {unsigned int ae_num;unsigned int ustore_phy_size;void *obj_buf; -uint64_t *uword_buf; +u64 *uword_buf; };struct icp_qat_uof_uword_block {
drivers/crypto/qat/qat_common/qat_algs.c +27 -27
183 lines not on this page · raw message
drivers/crypto/qat/qat_common/qat_asym_algs.c +6 -6
@@ -339,12 +339,12 @@ static int qat_dh_compute_value(struct kpp_request *req) msg->pke_mid.src_data_addr = qat_req->phy_in; msg->pke_mid.dest_data_addr = qat_req->phy_out; - msg->pke_mid.opaque = (uint64_t )(__force long )qat_req; + msg->pke_mid.opaque = (u64 )(__force long )qat_req; msg->input_param_count = n_input_params; msg->output_param_count =1 ;do { - ret =adf_send_message (ctx->inst->pke_tx, (uint32_t *)msg); + ret =adf_send_message (ctx->inst->pke_tx, (u32 *)msg); }while (ret == -EBUSY && ctr++ <100 );if (!ret)
@@ -734,11 +734,11 @@ static int qat_rsa_enc(struct akcipher_request *req) msg->pke_mid.src_data_addr = qat_req->phy_in; msg->pke_mid.dest_data_addr = qat_req->phy_out; - msg->pke_mid.opaque = (uint64_t )(__force long )qat_req; + msg->pke_mid.opaque = (u64 )(__force long )qat_req; msg->input_param_count =3 ; msg->output_param_count =1 ;do { - ret =adf_send_message (ctx->inst->pke_tx, (uint32_t *)msg); + ret =adf_send_message (ctx->inst->pke_tx, (u32 *)msg); }while (ret == -EBUSY && ctr++ <100 );if (!ret)
@@ -882,7 +882,7 @@ static int qat_rsa_dec(struct akcipher_request *req) msg->pke_mid.src_data_addr = qat_req->phy_in; msg->pke_mid.dest_data_addr = qat_req->phy_out; - msg->pke_mid.opaque = (uint64_t )(__force long )qat_req; + msg->pke_mid.opaque = (u64 )(__force long )qat_req;if (ctx->crt_mode) msg->input_param_count =6 ;else
@@ -890,7 +890,7 @@ static int qat_rsa_dec(struct akcipher_request *req) msg->output_param_count =1 ;do { - ret =adf_send_message (ctx->inst->pke_tx, (uint32_t *)msg); + ret =adf_send_message (ctx->inst->pke_tx, (u32 *)msg); }while (ret == -EBUSY && ctr++ <100 );if (!ret)
drivers/crypto/qat/qat_common/qat_hal.c +20 -20
@@ -34,13 +34,13 @@#define AE (handle, ae) handle->hal_handle->aes[ae] -static const uint64_t inst_4b[] = { +static const u64 inst_4b[] = {0x0F0400C0000ull ,0x0F4400C0000ull ,0x0F040000300ull ,0x0F440000300ull ,0x0FC066C0000ull ,0x0F0000C0300ull ,0x0F0000C0300ull ,0x0F0000C0300ull ,0x0A021000000ull }; -static const uint64_t inst[] = { +static const u64 inst[] = {0x0F0000C0000ull ,0x0F000000380ull ,0x0D805000011ull ,0x0FC082C0300ull ,0x0F0000C0300ull ,0x0F0000C0300ull ,0x0F0000C0300ull ,0x0F0000C0300ull ,0x0A0643C0000ull ,0x0BAC0000301ull ,0x0D802000101ull ,0x0F0000C0001ull ,
@@ -502,7 +502,7 @@ static void qat_hal_disable_ctx(struct icp_qat_fw_loader_handle *handle,qat_hal_wr_ae_csr (handle, ae,CTX_ENABLES , ctx); } -static uint64_t qat_hal_parity_64bit (uint64_t word) +static u64 qat_hal_parity_64bit (u64 word) { word ^= word >>1 ; word ^= word >>2 ;
@@ -513,9 +513,9 @@ static uint64_t qat_hal_parity_64bit(uint64_t word)return word &1 ; } -static uint64_t qat_hal_set_uword_ecc (uint64_t uword) +static u64 qat_hal_set_uword_ecc (u64 uword) { -uint64_t bit0_mask =0xff800007fffULL , bit1_mask =0x1f801ff801fULL , +u64 bit0_mask =0xff800007fffULL , bit1_mask =0x1f801ff801fULL , bit2_mask =0xe387e0781e1ULL , bit3_mask =0x7cb8e388e22ULL , bit4_mask =0xaf5b2c93244ULL , bit5_mask =0xf56d5525488ULL , bit6_mask =0xdaf69a46910ULL ;
@@ -534,7 +534,7 @@ static uint64_t qat_hal_set_uword_ecc(uint64_t uword)void qat_hal_wr_uwords (struct icp_qat_fw_loader_handle *handle,unsigned char ae,unsigned int uaddr, -unsigned int words_num,uint64_t *uword) +unsigned int words_num,u64 *uword) {unsigned int ustore_addr;unsigned int i;
@@ -544,7 +544,7 @@ void qat_hal_wr_uwords(struct icp_qat_fw_loader_handle *handle,qat_hal_wr_ae_csr (handle, ae,USTORE_ADDRESS , uaddr);for (i =0 ; i < words_num; i++) {unsigned int uwrd_lo, uwrd_hi; -uint64_t tmp; +u64 tmp; tmp =qat_hal_set_uword_ecc (uword[i]); uwrd_lo = (unsigned int )(tmp &0xffffffff );
@@ -600,7 +600,7 @@ static int qat_hal_clear_gpr(struct icp_qat_fw_loader_handle *handle) csr_val |=CE_NN_MODE ;qat_hal_wr_ae_csr (handle, ae,CTX_ENABLES , csr_val);qat_hal_wr_uwords (handle, ae,0 ,ARRAY_SIZE (inst), - (uint64_t *)inst); + (u64 *)inst);qat_hal_wr_indr_csr (handle, ae, ctx_mask,CTX_STS_INDIRECT , handle->hal_handle->upc_mask &INIT_PC_VALUE );
@@ -777,7 +777,7 @@ void qat_hal_set_pc(struct icp_qat_fw_loader_handle *handle,static void qat_hal_get_uwords (struct icp_qat_fw_loader_handle *handle,unsigned char ae,unsigned int uaddr, -unsigned int words_num,uint64_t *uword) +unsigned int words_num,u64 *uword) {unsigned int i, uwrd_lo, uwrd_hi;unsigned int ustore_addr, misc_control;
@@ -827,11 +827,11 @@ void qat_hal_wr_umem(struct icp_qat_fw_loader_handle *handle,#define MAX_EXEC_INST 100static int qat_hal_exec_micro_inst (struct icp_qat_fw_loader_handle *handle,unsigned char ae,unsigned char ctx, -uint64_t *micro_inst,unsigned int inst_num, +u64 *micro_inst,unsigned int inst_num,int code_off,unsigned int max_cycle,unsigned int *endpc) { -uint64_t savuwords[MAX_EXEC_INST ]; +u64 savuwords[MAX_EXEC_INST ];unsigned int ind_lm_addr0, ind_lm_addr1;unsigned int ind_lm_addr_byte0, ind_lm_addr_byte1;unsigned int ind_cnt_sig;
@@ -928,7 +928,7 @@ static int qat_hal_rd_rel_reg(struct icp_qat_fw_loader_handle *handle,unsigned int ctxarb_cntl, ustore_addr, ctx_enables;unsigned short reg_addr;int status =0 ; -uint64_t insts, savuword; +u64 insts, savuword; reg_addr =qat_hal_get_reg_addr (reg_type, reg_num);if (reg_addr ==BAD_REGADDR ) {
@@ -940,7 +940,7 @@ static int qat_hal_rd_rel_reg(struct icp_qat_fw_loader_handle *handle, insts =0xA070000000ull | (reg_addr &0x3ff );break ;default : - insts = (uint64_t )0xA030000000ull | ((reg_addr &0x3ff ) <<10 ); + insts = (u64 )0xA030000000ull | ((reg_addr &0x3ff ) <<10 );break ; } savctx =qat_hal_rd_ae_csr (handle, ae,ACTIVE_CTX_STATUS );
@@ -986,7 +986,7 @@ static int qat_hal_wr_rel_reg(struct icp_qat_fw_loader_handle *handle, unsigned short reg_num, unsigned int data) {unsigned short src_hiaddr, src_lowaddr, dest_addr, data16hi, data16lo; -uint64_t insts[] = { +u64 insts[] = {0x0F440000000ull ,0x0F040000000ull ,0x0F0000C0300ull ,
@@ -1032,13 +1032,13 @@ int qat_hal_get_ins_num(void)return ARRAY_SIZE (inst_4b); } -static int qat_hal_concat_micro_code (uint64_t *micro_inst, +static int qat_hal_concat_micro_code (u64 *micro_inst,unsigned int inst_num,unsigned int size,unsigned int addr,unsigned int *value) {int i;unsigned int cur_value; -const uint64_t *inst_arr; +const u64 *inst_arr;int fixup_offset;int usize =0 ;int orig_num;
@@ -1063,7 +1063,7 @@ static int qat_hal_concat_micro_code(uint64_t *micro_inst,static int qat_hal_exec_micro_init_lm (struct icp_qat_fw_loader_handle *handle,unsigned char ae,unsigned char ctx, -int *pfirst_exec,uint64_t *micro_inst, +int *pfirst_exec,u64 *micro_inst,unsigned int inst_num) {int stat =0 ;
@@ -1096,7 +1096,7 @@ int qat_hal_batch_wr_lm(struct icp_qat_fw_loader_handle *handle, struct icp_qat_uof_batch_init *lm_init_header) {struct icp_qat_uof_batch_init *plm_init; -uint64_t *micro_inst_arry; +u64 *micro_inst_arry;int micro_inst_num;int alloc_inst_size;int first_exec =1 ;
@@ -1106,7 +1106,7 @@ int qat_hal_batch_wr_lm(struct icp_qat_fw_loader_handle *handle, alloc_inst_size = lm_init_header->size;if ((unsigned int )alloc_inst_size > handle->hal_handle->max_ustore) alloc_inst_size = handle->hal_handle->max_ustore; - micro_inst_arry =kmalloc_array (alloc_inst_size,sizeof (uint64_t ), + micro_inst_arry =kmalloc_array (alloc_inst_size,sizeof (u64),GFP_KERNEL );if (!micro_inst_arry)return -ENOMEM ;
@@ -1185,7 +1185,7 @@ static int qat_hal_put_rel_wr_xfer(struct icp_qat_fw_loader_handle *handle, data16low;unsigned short reg_mask;int status =0 ; -uint64_t micro_inst[] = { +u64 micro_inst[] = {0x0F440000000ull ,0x0F040000000ull ,0x0A000000000ull ,
drivers/crypto/qat/qat_common/qat_uclo.c +10 -10
@@ -367,16 +367,16 @@ static int qat_uclo_init_ustore(struct icp_qat_fw_loader_handle *handle,unsigned int ustore_size;unsigned int patt_pos;struct icp_qat_uclo_objhandle *obj_handle = handle->obj_handle; -uint64_t *fill_data; +u64 *fill_data; uof_image = image->img_ptr; - fill_data =kcalloc (ICP_QAT_UCLO_MAX_USTORE ,sizeof (uint64_t ), + fill_data =kcalloc (ICP_QAT_UCLO_MAX_USTORE ,sizeof (u64),GFP_KERNEL );if (!fill_data)return -ENOMEM ;for (i =0 ; i <ICP_QAT_UCLO_MAX_USTORE ; i++)memcpy (&fill_data[i], &uof_image->fill_pattern, -sizeof (uint64_t )); +sizeof (u64)); page = image->page;for (ae =0 ; ae < handle->hal_handle->ae_max_num; ae++) {
@@ -937,7 +937,7 @@ static int qat_uclo_parse_uof_obj(struct icp_qat_fw_loader_handle *handle)pr_err ("QAT: UOF incompatible\n" );return -EINVAL ; } - obj_handle->uword_buf =kcalloc (UWORD_CPYBUF_SIZE ,sizeof (uint64_t ), + obj_handle->uword_buf =kcalloc (UWORD_CPYBUF_SIZE ,sizeof (u64),GFP_KERNEL );if (!obj_handle->uword_buf)return -ENOMEM ;
@@ -1141,7 +1141,7 @@ static int qat_uclo_map_suof(struct icp_qat_fw_loader_handle *handle,return 0 ; } -#define ADD_ADDR (high, low) ((((uint64_t)high) << 32) + low) +#define ADD_ADDR (high, low) ((((u64)high) << 32) + low)#define BITS_IN_DWORD 32 static int qat_uclo_auth_fw(struct icp_qat_fw_loader_handle *handle,
@@ -1470,10 +1470,10 @@ void qat_uclo_del_uof_obj(struct icp_qat_fw_loader_handle *handle)static void qat_uclo_fill_uwords (struct icp_qat_uclo_objhandle *obj_handle,struct icp_qat_uclo_encap_page *encap_page, -uint64_t *uword,unsigned int addr_p, -unsigned int raddr,uint64_t fill) +u64 *uword,unsigned int addr_p, +unsigned int raddr,u64 fill) { -uint64_t uwrd =0 ; +u64 uwrd =0 ;unsigned int i;if (!encap_page) {
@@ -1503,12 +1503,12 @@ static void qat_uclo_wr_uimage_raw_page(struct icp_qat_fw_loader_handle *handle, {unsigned int uw_physical_addr, uw_relative_addr, i, words_num, cpylen;struct icp_qat_uclo_objhandle *obj_handle = handle->obj_handle; -uint64_t fill_pat; +u64 fill_pat;/* load the page starting at appropriate ustore address */ /* get fill-pattern from an image -- they are all the same */ memcpy (&fill_pat, obj_handle->ae_uimage[0 ].img_ptr->fill_pattern, -sizeof (uint64_t )); +sizeof (u64)); uw_physical_addr = encap_page->beg_addr_p; uw_relative_addr =0 ; words_num = encap_page->micro_words_num;
drivers/crypto/qat/qat_dh895xcc/adf_dh895xcc_hw_data.c +13 -13
@@ -6,13 +6,13 @@#include "adf_dh895xcc_hw_data.h" /* Worker thread to service arbiter mappings based on dev SKUs */ -static const uint32_t thrd_to_arb_map_sku4[] = { +static const u32 thrd_to_arb_map_sku4[] = {0x12222AAA ,0x11666666 ,0x12222AAA ,0x11666666 ,0x12222AAA ,0x11222222 ,0x12222AAA ,0x11222222 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 }; -static const uint32_t thrd_to_arb_map_sku6[] = { +static const u32 thrd_to_arb_map_sku6[] = {0x12222AAA ,0x11666666 ,0x12222AAA ,0x11666666 ,0x12222AAA ,0x11222222 ,0x12222AAA ,0x11222222 ,0x12222AAA ,0x11222222 ,0x12222AAA ,0x11222222
@@ -24,20 +24,20 @@ static struct adf_hw_device_class dh895xcc_class = { .instances = 0 }; -static uint32_t get_accel_mask (uint32_t fuse) +static u32 get_accel_mask (u32 fuse) {return (~fuse) >>ADF_DH895XCC_ACCELERATORS_REG_OFFSET &ADF_DH895XCC_ACCELERATORS_MASK ; } -static uint32_t get_ae_mask (uint32_t fuse) +static u32 get_ae_mask (u32 fuse) {return (~fuse) &ADF_DH895XCC_ACCELENGINES_MASK ; } -static uint32_t get_num_accels (struct adf_hw_device_data *self) +static u32 get_num_accels (struct adf_hw_device_data *self) { -uint32_t i, ctr =0 ; +u32 i, ctr =0 ;if (!self || !self->accel_mask)return 0 ;
@@ -49,9 +49,9 @@ static uint32_t get_num_accels(struct adf_hw_device_data *self)return ctr; } -static uint32_t get_num_aes (struct adf_hw_device_data *self) +static u32 get_num_aes (struct adf_hw_device_data *self) { -uint32_t i, ctr =0 ; +u32 i, ctr =0 ;if (!self || !self->ae_mask)return 0 ;
@@ -63,17 +63,17 @@ static uint32_t get_num_aes(struct adf_hw_device_data *self)return ctr; } -static uint32_t get_misc_bar_id (struct adf_hw_device_data *self) +static u32 get_misc_bar_id (struct adf_hw_device_data *self) {return ADF_DH895XCC_PMISC_BAR ; } -static uint32_t get_etr_bar_id (struct adf_hw_device_data *self) +static u32 get_etr_bar_id (struct adf_hw_device_data *self) {return ADF_DH895XCC_ETR_BAR ; } -static uint32_t get_sram_bar_id (struct adf_hw_device_data *self) +static u32 get_sram_bar_id (struct adf_hw_device_data *self) {return ADF_DH895XCC_SRAM_BAR ; }
@@ -117,12 +117,12 @@ static void adf_get_arbiter_mapping(struct adf_accel_dev *accel_dev, } } -static uint32_t get_pf2vf_offset (uint32_t i) +static u32 get_pf2vf_offset (u32 i) {return ADF_DH895XCC_PF2VF_OFFSET (i); } -static uint32_t get_vintmsk_offset (uint32_t i) +static u32 get_vintmsk_offset (u32 i) {return ADF_DH895XCC_VINTMSK_OFFSET (i); }
Signature · 1 line
2.26.2
PATCH 2/3 crypto: qat - replace user types with kernel ABI __u types
In reply to Giovanni CabidduFrom: Wojciech Ziemba <[email protected]>
Kernel source code should not contain stdint.h types. This patch replaces uintXX_t types with kernel space ABI types.
--- .../crypto/qat/qat_common/adf_cfg_common.h | 24 +-- drivers/crypto/qat/qat_common/adf_cfg_user.h | 10 +- drivers/crypto/qat/qat_common/icp_qat_fw.h | 58 +++---- .../qat/qat_common/icp_qat_fw_init_admin.h | 46 ++--- drivers/crypto/qat/qat_common/icp_qat_fw_la.h | 158 +++++++++--------- .../crypto/qat/qat_common/icp_qat_fw_pke.h | 52 +++--- drivers/crypto/qat/qat_common/icp_qat_hw.h | 16 +- 7 files changed, 182 insertions(+), 182 deletions(-)
drivers/crypto/qat/qat_common/adf_cfg_common.h +12 -12
@@ -37,16 +37,16 @@ enum adf_device_type {struct adf_dev_status_info {enum adf_device_type type; -u32 accel_id; -u32 instance_id; -uint8_t num_ae; -uint8_t num_accel; -uint8_t num_logical_accel; -uint8_t banks_per_accel; -uint8_t state; -uint8_t bus; -uint8_t dev; -uint8_t fun; +__u32 accel_id; +__u32 instance_id; +__u8 num_ae; +__u8 num_accel; +__u8 num_logical_accel; +__u8 banks_per_accel; +__u8 state; +__u8 bus; +__u8 dev; +__u8 fun;char name[MAX_DEVICE_NAME_SIZE ]; };
@@ -57,6 +57,6 @@ struct adf_dev_status_info { struct adf_user_cfg_ctl_data)#define IOCTL_START_ACCEL_DEV _IOW(ADF_CTL_IOC_MAGIC, 2, \ struct adf_user_cfg_ctl_data) -#define IOCTL_STATUS_ACCEL_DEV _IOW(ADF_CTL_IOC_MAGIC, 3, uint32_t) -#define IOCTL_GET_NUM_DEVICES _IOW(ADF_CTL_IOC_MAGIC, 4, int32_t) +#define IOCTL_STATUS_ACCEL_DEV _IOW(ADF_CTL_IOC_MAGIC, 3, __u32) +#define IOCTL_GET_NUM_DEVICES _IOW(ADF_CTL_IOC_MAGIC, 4, __s32)#endif
drivers/crypto/qat/qat_common/adf_cfg_user.h +5 -5
@@ -11,7 +11,7 @@ struct adf_user_cfg_key_val {char val[ADF_CFG_MAX_VAL_LEN_IN_BYTES ];union {struct adf_user_cfg_key_val *next; -uint64_t padding3; +__u64 padding3; };enum adf_cfg_val_type type; } __packed;
@@ -20,19 +20,19 @@ struct adf_user_cfg_section {char name[ADF_CFG_MAX_SECTION_LEN_IN_BYTES ];union {struct adf_user_cfg_key_val *params; -uint64_t padding1; +__u64 padding1; };union {struct adf_user_cfg_section *next; -uint64_t padding3; +__u64 padding3; }; } __packed;struct adf_user_cfg_ctl_data {union {struct adf_user_cfg_section *config_section; -uint64_t padding; +__u64 padding; }; -uint8_t device_id; +__u8 device_id; } __packed;#endif
drivers/crypto/qat/qat_common/icp_qat_fw.h +29 -29
94 lines not on this page · raw message
drivers/crypto/qat/qat_common/icp_qat_fw_init_admin.h +23 -23
71 lines not on this page · raw message
drivers/crypto/qat/qat_common/icp_qat_fw_la.h +79 -79
211 lines not on this page · raw message
drivers/crypto/qat/qat_common/icp_qat_fw_pke.h +26 -26
77 lines not on this page · raw message
drivers/crypto/qat/qat_common/icp_qat_hw.h +8 -8
@@ -61,8 +61,8 @@ enum icp_qat_hw_auth_mode { };struct icp_qat_hw_auth_config { -uint32_t config; -uint32_t reserved; +__u32 config; +__u32 reserved; };#define QAT_AUTH_MODE_BITPOS 4
@@ -87,7 +87,7 @@ struct icp_qat_hw_auth_config {struct icp_qat_hw_auth_counter {__be32 counter; -uint32_t reserved; +__u32 reserved; };#define QAT_AUTH_COUNT_MASK 0xFFFFFFFF
@@ -147,9 +147,9 @@ struct icp_qat_hw_auth_setup {struct icp_qat_hw_auth_sha512 {struct icp_qat_hw_auth_setup inner_setup; -uint8_t state1[ICP_QAT_HW_SHA512_STATE1_SZ ]; +__u8 state1[ICP_QAT_HW_SHA512_STATE1_SZ ];struct icp_qat_hw_auth_setup outer_setup; -uint8_t state2[ICP_QAT_HW_SHA512_STATE2_SZ ]; +__u8 state2[ICP_QAT_HW_SHA512_STATE2_SZ ]; };struct icp_qat_hw_auth_algo_blk {
@@ -183,8 +183,8 @@ enum icp_qat_hw_cipher_mode { };struct icp_qat_hw_cipher_config { -uint32_t val; -uint32_t reserved; +__u32 val; +__u32 reserved; };enum icp_qat_hw_cipher_dir {
@@ -252,7 +252,7 @@ enum icp_qat_hw_cipher_convert {struct icp_qat_hw_cipher_aes256_f8 {struct icp_qat_hw_cipher_config cipher_config; -uint8_t key[ICP_QAT_HW_AES_256_F8_KEY_SZ ]; +__u8 key[ICP_QAT_HW_AES_256_F8_KEY_SZ ]; };struct icp_qat_hw_cipher_algo_blk {
Signature · 1 line
2.26.2
PATCH 3/3 crypto: qat - remove packed attribute in etr structs
In reply to Giovanni CabidduRemove packed attribute in adf_etr_bank_data and adf_etr_ring_data. Fields in these structures are reordered in order to avoid holes.
--- .../crypto/qat/qat_common/adf_transport_internal.h | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-)
drivers/crypto/qat/qat_common/adf_transport_internal.h +6 -7
@@ -15,32 +15,31 @@ struct adf_etr_ring_debug_entry {struct adf_etr_ring_data {void *base_addr;atomic_t *inflights; -spinlock_t lock;/* protects ring data struct */ adf_callback_fn callback;struct adf_etr_bank_data *bank;dma_addr_t dma_addr; +struct adf_etr_ring_debug_entry *ring_debug; +spinlock_t lock;/* protects ring data struct */ u16 head;u16 tail;u8 ring_number;u8 ring_size;u8 msg_size; -u8 reserved; -struct adf_etr_ring_debug_entry *ring_debug; -} __packed; +};struct adf_etr_bank_data {struct adf_etr_ring_data rings[ADF_ETR_MAX_RINGS_PER_BANK ];struct tasklet_struct resp_handler;void __iomem *csr_addr; -struct adf_accel_dev *accel_dev;u32 irq_coalesc_timer; +u32 bank_number;u16 ring_mask;u16 irq_mask;spinlock_t lock;/* protects bank data struct */ +struct adf_accel_dev *accel_dev;struct dentry *bank_debug_dir;struct dentry *bank_debug_cfg; -u32 bank_number; -} __packed; +};struct adf_etr_data {struct adf_etr_bank_data *banks;
Signature · 1 line
2.26.2
Herbert Xu
maintainerQuoted 29 lines · Giovanni Cabiddu
Remove user types across qat code base and replace packed attribute in etr ring struct which causes a split lock.
These changes are on top of "crypto: qat - fix parameter check in aead encryption" (https://patchwork.kernel.org/patch/11574001/)
Giovanni Cabiddu (1):
crypto: qat - remove packed attribute in etr structsWojciech Ziemba (2):
crypto: qat - replace user types with kernel u types
crypto: qat - replace user types with kernel ABI__utypes.../crypto/qat/qat_common/adf_accel_devices.h | 54 +++--- .../crypto/qat/qat_common/adf_accel_engine.c | 4 +- drivers/crypto/qat/qat_common/adf_aer.c | 2 +- .../crypto/qat/qat_common/adf_cfg_common.h | 24 +-- drivers/crypto/qat/qat_common/adf_cfg_user.h | 10 +- .../crypto/qat/qat_common/adf_common_drv.h | 12 +- drivers/crypto/qat/qat_common/adf_ctl_drv.c | 4 +- drivers/crypto/qat/qat_common/adf_dev_mgr.c | 8 +- drivers/crypto/qat/qat_common/adf_transport.c | 62 +++---- drivers/crypto/qat/qat_common/adf_transport.h | 4 +- .../qat_common/adf_transport_access_macros.h | 6 +- .../qat/qat_common/adf_transport_internal.h | 27 ++- drivers/crypto/qat/qat_common/icp_qat_fw.h | 58 +++---- .../qat/qat_common/icp_qat_fw_init_admin.h | 46 ++--- drivers/crypto/qat/qat_common/icp_qat_fw_la.h | 158 +++++++++--------- .../crypto/qat/qat_common/icp_qat_fw_pke.h | 52 +++---
Quoted 8 lines
drivers/crypto/qat/qat_common/icp_qat_hw.h | 16 +- drivers/crypto/qat/qat_common/icp_qat_uclo.h | 6 +- drivers/crypto/qat/qat_common/qat_algs.c | 54 +++--- drivers/crypto/qat/qat_common/qat_asym_algs.c | 12 +- drivers/crypto/qat/qat_common/qat_hal.c | 40 ++--- drivers/crypto/qat/qat_common/qat_uclo.c | 20 +-- .../qat/qat_dh895xcc/adf_dh895xcc_hw_data.c | 26 +-- 23 files changed, 352 insertions(+), 353 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