aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/crypto/qat
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2014-12-13 16:33:26 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2014-12-13 16:33:26 -0500
commite3aa91a7cb21a595169b20c64f63ca39a91a0c43 (patch)
tree6a92a2e595629949a45336c770c2408abba8444d /drivers/crypto/qat
parent78a45c6f067824cf5d0a9fedea7339ac2e28603c (diff)
parent8606813a6c8997fd3bb805186056d78670eb86ca (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6
Pull crypto update from Herbert Xu: - The crypto API is now documented :) - Disallow arbitrary module loading through crypto API. - Allow get request with empty driver name through crypto_user. - Allow speed testing of arbitrary hash functions. - Add caam support for ctr(aes), gcm(aes) and their derivatives. - nx now supports concurrent hashing properly. - Add sahara support for SHA1/256. - Add ARM64 version of CRC32. - Misc fixes. * git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6: (77 commits) crypto: tcrypt - Allow speed testing of arbitrary hash functions crypto: af_alg - add user space interface for AEAD crypto: qat - fix problem with coalescing enable logic crypto: sahara - add support for SHA1/256 crypto: sahara - replace tasklets with kthread crypto: sahara - add support for i.MX53 crypto: sahara - fix spinlock initialization crypto: arm - replace memset by memzero_explicit crypto: powerpc - replace memset by memzero_explicit crypto: sha - replace memset by memzero_explicit crypto: sparc - replace memset by memzero_explicit crypto: algif_skcipher - initialize upon init request crypto: algif_skcipher - removed unneeded code crypto: algif_skcipher - Fixed blocking recvmsg crypto: drbg - use memzero_explicit() for clearing sensitive data crypto: drbg - use MODULE_ALIAS_CRYPTO crypto: include crypto- module prefix in template crypto: user - add MODULE_ALIAS crypto: sha-mb - remove a bogus NULL check crytpo: qat - Fix 64 bytes requests ...
Diffstat (limited to 'drivers/crypto/qat')
-rw-r--r--drivers/crypto/qat/qat_common/adf_accel_devices.h2
-rw-r--r--drivers/crypto/qat/qat_common/adf_aer.c2
-rw-r--r--drivers/crypto/qat/qat_common/adf_ctl_drv.c3
-rw-r--r--drivers/crypto/qat/qat_common/adf_dev_mgr.c6
-rw-r--r--drivers/crypto/qat/qat_common/adf_transport.c15
-rw-r--r--drivers/crypto/qat/qat_common/adf_transport_access_macros.h9
-rw-r--r--drivers/crypto/qat/qat_common/qat_algs.c37
-rw-r--r--drivers/crypto/qat/qat_common/qat_hal.c3
-rw-r--r--drivers/crypto/qat/qat_dh895xcc/adf_dh895xcc_hw_data.h2
-rw-r--r--drivers/crypto/qat/qat_dh895xcc/adf_isr.c12
10 files changed, 52 insertions, 39 deletions
diff --git a/drivers/crypto/qat/qat_common/adf_accel_devices.h b/drivers/crypto/qat/qat_common/adf_accel_devices.h
index fe7b3f06f6e6..2ed425664a16 100644
--- a/drivers/crypto/qat/qat_common/adf_accel_devices.h
+++ b/drivers/crypto/qat/qat_common/adf_accel_devices.h
@@ -56,8 +56,6 @@
56#define PCI_VENDOR_ID_INTEL 0x8086 56#define PCI_VENDOR_ID_INTEL 0x8086
57#define ADF_DH895XCC_DEVICE_NAME "dh895xcc" 57#define ADF_DH895XCC_DEVICE_NAME "dh895xcc"
58#define ADF_DH895XCC_PCI_DEVICE_ID 0x435 58#define ADF_DH895XCC_PCI_DEVICE_ID 0x435
59#define ADF_DH895XCC_PMISC_BAR 1
60#define ADF_DH895XCC_ETR_BAR 2
61#define ADF_PCI_MAX_BARS 3 59#define ADF_PCI_MAX_BARS 3
62#define ADF_DEVICE_NAME_LENGTH 32 60#define ADF_DEVICE_NAME_LENGTH 32
63#define ADF_ETR_MAX_RINGS_PER_BANK 16 61#define ADF_ETR_MAX_RINGS_PER_BANK 16
diff --git a/drivers/crypto/qat/qat_common/adf_aer.c b/drivers/crypto/qat/qat_common/adf_aer.c
index c29d4c3926bf..10ce4a2854ab 100644
--- a/drivers/crypto/qat/qat_common/adf_aer.c
+++ b/drivers/crypto/qat/qat_common/adf_aer.c
@@ -90,7 +90,7 @@ static void adf_dev_restore(struct adf_accel_dev *accel_dev)
90 uint16_t ppdstat = 0, bridge_ctl = 0; 90 uint16_t ppdstat = 0, bridge_ctl = 0;
91 int pending = 0; 91 int pending = 0;
92 92
93 pr_info("QAT: Reseting device qat_dev%d\n", accel_dev->accel_id); 93 pr_info("QAT: Resetting device qat_dev%d\n", accel_dev->accel_id);
94 pci_read_config_word(pdev, PPDSTAT_OFFSET, &ppdstat); 94 pci_read_config_word(pdev, PPDSTAT_OFFSET, &ppdstat);
95 pending = ppdstat & PCI_EXP_DEVSTA_TRPND; 95 pending = ppdstat & PCI_EXP_DEVSTA_TRPND;
96 if (pending) { 96 if (pending) {
diff --git a/drivers/crypto/qat/qat_common/adf_ctl_drv.c b/drivers/crypto/qat/qat_common/adf_ctl_drv.c
index 244d73378f0e..7ee93f881db6 100644
--- a/drivers/crypto/qat/qat_common/adf_ctl_drv.c
+++ b/drivers/crypto/qat/qat_common/adf_ctl_drv.c
@@ -52,6 +52,7 @@
52#include <linux/pci.h> 52#include <linux/pci.h>
53#include <linux/cdev.h> 53#include <linux/cdev.h>
54#include <linux/uaccess.h> 54#include <linux/uaccess.h>
55#include <linux/crypto.h>
55 56
56#include "adf_accel_devices.h" 57#include "adf_accel_devices.h"
57#include "adf_common_drv.h" 58#include "adf_common_drv.h"
@@ -487,4 +488,4 @@ module_exit(adf_unregister_ctl_device_driver);
487MODULE_LICENSE("Dual BSD/GPL"); 488MODULE_LICENSE("Dual BSD/GPL");
488MODULE_AUTHOR("Intel"); 489MODULE_AUTHOR("Intel");
489MODULE_DESCRIPTION("Intel(R) QuickAssist Technology"); 490MODULE_DESCRIPTION("Intel(R) QuickAssist Technology");
490MODULE_ALIAS("intel_qat"); 491MODULE_ALIAS_CRYPTO("intel_qat");
diff --git a/drivers/crypto/qat/qat_common/adf_dev_mgr.c b/drivers/crypto/qat/qat_common/adf_dev_mgr.c
index ae71555c0868..4a0a829d4500 100644
--- a/drivers/crypto/qat/qat_common/adf_dev_mgr.c
+++ b/drivers/crypto/qat/qat_common/adf_dev_mgr.c
@@ -129,12 +129,13 @@ struct adf_accel_dev *adf_devmgr_get_first(void)
129 * Function returns acceleration device associated with the given pci device. 129 * Function returns acceleration device associated with the given pci device.
130 * To be used by QAT device specific drivers. 130 * To be used by QAT device specific drivers.
131 * 131 *
132 * Return: pinter to accel_dev or NULL if not found. 132 * Return: pointer to accel_dev or NULL if not found.
133 */ 133 */
134struct adf_accel_dev *adf_devmgr_pci_to_accel_dev(struct pci_dev *pci_dev) 134struct adf_accel_dev *adf_devmgr_pci_to_accel_dev(struct pci_dev *pci_dev)
135{ 135{
136 struct list_head *itr; 136 struct list_head *itr;
137 137
138 mutex_lock(&table_lock);
138 list_for_each(itr, &accel_table) { 139 list_for_each(itr, &accel_table) {
139 struct adf_accel_dev *ptr = 140 struct adf_accel_dev *ptr =
140 list_entry(itr, struct adf_accel_dev, list); 141 list_entry(itr, struct adf_accel_dev, list);
@@ -144,6 +145,7 @@ struct adf_accel_dev *adf_devmgr_pci_to_accel_dev(struct pci_dev *pci_dev)
144 return ptr; 145 return ptr;
145 } 146 }
146 } 147 }
148 mutex_unlock(&table_lock);
147 return NULL; 149 return NULL;
148} 150}
149EXPORT_SYMBOL_GPL(adf_devmgr_pci_to_accel_dev); 151EXPORT_SYMBOL_GPL(adf_devmgr_pci_to_accel_dev);
@@ -152,6 +154,7 @@ struct adf_accel_dev *adf_devmgr_get_dev_by_id(uint32_t id)
152{ 154{
153 struct list_head *itr; 155 struct list_head *itr;
154 156
157 mutex_lock(&table_lock);
155 list_for_each(itr, &accel_table) { 158 list_for_each(itr, &accel_table) {
156 struct adf_accel_dev *ptr = 159 struct adf_accel_dev *ptr =
157 list_entry(itr, struct adf_accel_dev, list); 160 list_entry(itr, struct adf_accel_dev, list);
@@ -161,6 +164,7 @@ struct adf_accel_dev *adf_devmgr_get_dev_by_id(uint32_t id)
161 return ptr; 164 return ptr;
162 } 165 }
163 } 166 }
167 mutex_unlock(&table_lock);
164 return NULL; 168 return NULL;
165} 169}
166 170
diff --git a/drivers/crypto/qat/qat_common/adf_transport.c b/drivers/crypto/qat/qat_common/adf_transport.c
index 9dd2cb72a4e8..7dd54aaee9fa 100644
--- a/drivers/crypto/qat/qat_common/adf_transport.c
+++ b/drivers/crypto/qat/qat_common/adf_transport.c
@@ -376,8 +376,9 @@ static inline int adf_get_cfg_int(struct adf_accel_dev *accel_dev,
376 return 0; 376 return 0;
377} 377}
378 378
379static void adf_enable_coalesc(struct adf_etr_bank_data *bank, 379static void adf_get_coalesc_timer(struct adf_etr_bank_data *bank,
380 const char *section, uint32_t bank_num_in_accel) 380 const char *section,
381 uint32_t bank_num_in_accel)
381{ 382{
382 if (adf_get_cfg_int(bank->accel_dev, section, 383 if (adf_get_cfg_int(bank->accel_dev, section,
383 ADF_ETRMGR_COALESCE_TIMER_FORMAT, 384 ADF_ETRMGR_COALESCE_TIMER_FORMAT,
@@ -396,7 +397,7 @@ static int adf_init_bank(struct adf_accel_dev *accel_dev,
396 struct adf_hw_device_data *hw_data = accel_dev->hw_device; 397 struct adf_hw_device_data *hw_data = accel_dev->hw_device;
397 struct adf_etr_ring_data *ring; 398 struct adf_etr_ring_data *ring;
398 struct adf_etr_ring_data *tx_ring; 399 struct adf_etr_ring_data *tx_ring;
399 uint32_t i, coalesc_enabled; 400 uint32_t i, coalesc_enabled = 0;
400 401
401 memset(bank, 0, sizeof(*bank)); 402 memset(bank, 0, sizeof(*bank));
402 bank->bank_number = bank_num; 403 bank->bank_number = bank_num;
@@ -407,10 +408,10 @@ static int adf_init_bank(struct adf_accel_dev *accel_dev,
407 /* Enable IRQ coalescing always. This will allow to use 408 /* Enable IRQ coalescing always. This will allow to use
408 * the optimised flag and coalesc register. 409 * the optimised flag and coalesc register.
409 * If it is disabled in the config file just use min time value */ 410 * If it is disabled in the config file just use min time value */
410 if (adf_get_cfg_int(accel_dev, "Accelerator0", 411 if ((adf_get_cfg_int(accel_dev, "Accelerator0",
411 ADF_ETRMGR_COALESCING_ENABLED_FORMAT, 412 ADF_ETRMGR_COALESCING_ENABLED_FORMAT, bank_num,
412 bank_num, &coalesc_enabled) && coalesc_enabled) 413 &coalesc_enabled) == 0) && coalesc_enabled)
413 adf_enable_coalesc(bank, "Accelerator0", bank_num); 414 adf_get_coalesc_timer(bank, "Accelerator0", bank_num);
414 else 415 else
415 bank->irq_coalesc_timer = ADF_COALESCING_MIN_TIME; 416 bank->irq_coalesc_timer = ADF_COALESCING_MIN_TIME;
416 417
diff --git a/drivers/crypto/qat/qat_common/adf_transport_access_macros.h b/drivers/crypto/qat/qat_common/adf_transport_access_macros.h
index 91d88d676580..160c9a36c919 100644
--- a/drivers/crypto/qat/qat_common/adf_transport_access_macros.h
+++ b/drivers/crypto/qat/qat_common/adf_transport_access_macros.h
@@ -83,14 +83,14 @@
83#define ADF_MAX_RING_SIZE ADF_RING_SIZE_4M 83#define ADF_MAX_RING_SIZE ADF_RING_SIZE_4M
84#define ADF_DEFAULT_RING_SIZE ADF_RING_SIZE_16K 84#define ADF_DEFAULT_RING_SIZE ADF_RING_SIZE_16K
85 85
86/* Valid internal msg size values internal */ 86/* Valid internal msg size values */
87#define ADF_MSG_SIZE_32 0x01 87#define ADF_MSG_SIZE_32 0x01
88#define ADF_MSG_SIZE_64 0x02 88#define ADF_MSG_SIZE_64 0x02
89#define ADF_MSG_SIZE_128 0x04 89#define ADF_MSG_SIZE_128 0x04
90#define ADF_MIN_MSG_SIZE ADF_MSG_SIZE_32 90#define ADF_MIN_MSG_SIZE ADF_MSG_SIZE_32
91#define ADF_MAX_MSG_SIZE ADF_MSG_SIZE_128 91#define ADF_MAX_MSG_SIZE ADF_MSG_SIZE_128
92 92
93/* Size to bytes conversion macros for ring and msg values */ 93/* Size to bytes conversion macros for ring and msg size values */
94#define ADF_MSG_SIZE_TO_BYTES(SIZE) (SIZE << 5) 94#define ADF_MSG_SIZE_TO_BYTES(SIZE) (SIZE << 5)
95#define ADF_BYTES_TO_MSG_SIZE(SIZE) (SIZE >> 5) 95#define ADF_BYTES_TO_MSG_SIZE(SIZE) (SIZE >> 5)
96#define ADF_SIZE_TO_RING_SIZE_IN_BYTES(SIZE) ((1 << (SIZE - 1)) << 7) 96#define ADF_SIZE_TO_RING_SIZE_IN_BYTES(SIZE) ((1 << (SIZE - 1)) << 7)
@@ -100,8 +100,11 @@
100#define ADF_RING_SIZE_BYTES_MIN(SIZE) ((SIZE < ADF_RING_SIZE_4K) ? \ 100#define ADF_RING_SIZE_BYTES_MIN(SIZE) ((SIZE < ADF_RING_SIZE_4K) ? \
101 ADF_RING_SIZE_4K : SIZE) 101 ADF_RING_SIZE_4K : SIZE)
102#define ADF_RING_SIZE_MODULO(SIZE) (SIZE + 0x6) 102#define ADF_RING_SIZE_MODULO(SIZE) (SIZE + 0x6)
103#define ADF_SIZE_TO_POW(SIZE) ((((SIZE & 0x4) >> 1) | ((SIZE & 0x4) >> 2) | \
104 SIZE) & ~0x4)
105/* Max outstanding requests */
103#define ADF_MAX_INFLIGHTS(RING_SIZE, MSG_SIZE) \ 106#define ADF_MAX_INFLIGHTS(RING_SIZE, MSG_SIZE) \
104 ((((1 << (RING_SIZE - 1)) << 4) >> MSG_SIZE) - 1) 107 ((((1 << (RING_SIZE - 1)) << 3) >> ADF_SIZE_TO_POW(MSG_SIZE)) - 1)
105#define BUILD_RING_CONFIG(size) \ 108#define BUILD_RING_CONFIG(size) \
106 ((ADF_RING_NEAR_WATERMARK_0 << ADF_RING_CONFIG_NEAR_FULL_WM) \ 109 ((ADF_RING_NEAR_WATERMARK_0 << ADF_RING_CONFIG_NEAR_FULL_WM) \
107 | (ADF_RING_NEAR_WATERMARK_0 << ADF_RING_CONFIG_NEAR_EMPTY_WM) \ 110 | (ADF_RING_NEAR_WATERMARK_0 << ADF_RING_CONFIG_NEAR_EMPTY_WM) \
diff --git a/drivers/crypto/qat/qat_common/qat_algs.c b/drivers/crypto/qat/qat_common/qat_algs.c
index 9e9619cd4a79..19eea1c832ac 100644
--- a/drivers/crypto/qat/qat_common/qat_algs.c
+++ b/drivers/crypto/qat/qat_common/qat_algs.c
@@ -161,7 +161,7 @@ static int qat_alg_do_precomputes(struct icp_qat_hw_auth_algo_blk *hash,
161 __be64 *hash512_state_out; 161 __be64 *hash512_state_out;
162 int i, offset; 162 int i, offset;
163 163
164 memset(auth_state.data, '\0', MAX_AUTH_STATE_SIZE + 64); 164 memzero_explicit(auth_state.data, MAX_AUTH_STATE_SIZE + 64);
165 shash->tfm = ctx->hash_tfm; 165 shash->tfm = ctx->hash_tfm;
166 shash->flags = 0x0; 166 shash->flags = 0x0;
167 167
@@ -174,13 +174,13 @@ static int qat_alg_do_precomputes(struct icp_qat_hw_auth_algo_blk *hash,
174 174
175 memcpy(ipad, buff, digest_size); 175 memcpy(ipad, buff, digest_size);
176 memcpy(opad, buff, digest_size); 176 memcpy(opad, buff, digest_size);
177 memset(ipad + digest_size, 0, block_size - digest_size); 177 memzero_explicit(ipad + digest_size, block_size - digest_size);
178 memset(opad + digest_size, 0, block_size - digest_size); 178 memzero_explicit(opad + digest_size, block_size - digest_size);
179 } else { 179 } else {
180 memcpy(ipad, auth_key, auth_keylen); 180 memcpy(ipad, auth_key, auth_keylen);
181 memcpy(opad, auth_key, auth_keylen); 181 memcpy(opad, auth_key, auth_keylen);
182 memset(ipad + auth_keylen, 0, block_size - auth_keylen); 182 memzero_explicit(ipad + auth_keylen, block_size - auth_keylen);
183 memset(opad + auth_keylen, 0, block_size - auth_keylen); 183 memzero_explicit(opad + auth_keylen, block_size - auth_keylen);
184 } 184 }
185 185
186 for (i = 0; i < block_size; i++) { 186 for (i = 0; i < block_size; i++) {
@@ -254,6 +254,8 @@ static int qat_alg_do_precomputes(struct icp_qat_hw_auth_algo_blk *hash,
254 default: 254 default:
255 return -EFAULT; 255 return -EFAULT;
256 } 256 }
257 memzero_explicit(ipad, block_size);
258 memzero_explicit(opad, block_size);
257 return 0; 259 return 0;
258} 260}
259 261
@@ -466,7 +468,6 @@ static int qat_alg_init_sessions(struct qat_alg_session_ctx *ctx,
466 break; 468 break;
467 default: 469 default:
468 goto bad_key; 470 goto bad_key;
469 break;
470 } 471 }
471 472
472 if (qat_alg_init_enc_session(ctx, alg, &keys)) 473 if (qat_alg_init_enc_session(ctx, alg, &keys))
@@ -493,12 +494,12 @@ static int qat_alg_setkey(struct crypto_aead *tfm, const uint8_t *key,
493 if (ctx->enc_cd) { 494 if (ctx->enc_cd) {
494 /* rekeying */ 495 /* rekeying */
495 dev = &GET_DEV(ctx->inst->accel_dev); 496 dev = &GET_DEV(ctx->inst->accel_dev);
496 memset(ctx->enc_cd, 0, sizeof(struct qat_alg_cd)); 497 memzero_explicit(ctx->enc_cd, sizeof(struct qat_alg_cd));
497 memset(ctx->dec_cd, 0, sizeof(struct qat_alg_cd)); 498 memzero_explicit(ctx->dec_cd, sizeof(struct qat_alg_cd));
498 memset(&ctx->enc_fw_req_tmpl, 0, 499 memzero_explicit(&ctx->enc_fw_req_tmpl,
499 sizeof(struct icp_qat_fw_la_bulk_req)); 500 sizeof(struct icp_qat_fw_la_bulk_req));
500 memset(&ctx->dec_fw_req_tmpl, 0, 501 memzero_explicit(&ctx->dec_fw_req_tmpl,
501 sizeof(struct icp_qat_fw_la_bulk_req)); 502 sizeof(struct icp_qat_fw_la_bulk_req));
502 } else { 503 } else {
503 /* new key */ 504 /* new key */
504 int node = get_current_node(); 505 int node = get_current_node();
@@ -535,10 +536,12 @@ static int qat_alg_setkey(struct crypto_aead *tfm, const uint8_t *key,
535 return 0; 536 return 0;
536 537
537out_free_all: 538out_free_all:
539 memzero_explicit(ctx->dec_cd, sizeof(struct qat_alg_cd));
538 dma_free_coherent(dev, sizeof(struct qat_alg_cd), 540 dma_free_coherent(dev, sizeof(struct qat_alg_cd),
539 ctx->dec_cd, ctx->dec_cd_paddr); 541 ctx->dec_cd, ctx->dec_cd_paddr);
540 ctx->dec_cd = NULL; 542 ctx->dec_cd = NULL;
541out_free_enc: 543out_free_enc:
544 memzero_explicit(ctx->enc_cd, sizeof(struct qat_alg_cd));
542 dma_free_coherent(dev, sizeof(struct qat_alg_cd), 545 dma_free_coherent(dev, sizeof(struct qat_alg_cd),
543 ctx->enc_cd, ctx->enc_cd_paddr); 546 ctx->enc_cd, ctx->enc_cd_paddr);
544 ctx->enc_cd = NULL; 547 ctx->enc_cd = NULL;
@@ -836,7 +839,7 @@ static int qat_alg_init(struct crypto_tfm *tfm,
836{ 839{
837 struct qat_alg_session_ctx *ctx = crypto_tfm_ctx(tfm); 840 struct qat_alg_session_ctx *ctx = crypto_tfm_ctx(tfm);
838 841
839 memset(ctx, '\0', sizeof(*ctx)); 842 memzero_explicit(ctx, sizeof(*ctx));
840 ctx->hash_tfm = crypto_alloc_shash(hash_name, 0, 0); 843 ctx->hash_tfm = crypto_alloc_shash(hash_name, 0, 0);
841 if (IS_ERR(ctx->hash_tfm)) 844 if (IS_ERR(ctx->hash_tfm))
842 return -EFAULT; 845 return -EFAULT;
@@ -876,12 +879,16 @@ static void qat_alg_exit(struct crypto_tfm *tfm)
876 return; 879 return;
877 880
878 dev = &GET_DEV(inst->accel_dev); 881 dev = &GET_DEV(inst->accel_dev);
879 if (ctx->enc_cd) 882 if (ctx->enc_cd) {
883 memzero_explicit(ctx->enc_cd, sizeof(struct qat_alg_cd));
880 dma_free_coherent(dev, sizeof(struct qat_alg_cd), 884 dma_free_coherent(dev, sizeof(struct qat_alg_cd),
881 ctx->enc_cd, ctx->enc_cd_paddr); 885 ctx->enc_cd, ctx->enc_cd_paddr);
882 if (ctx->dec_cd) 886 }
887 if (ctx->dec_cd) {
888 memzero_explicit(ctx->dec_cd, sizeof(struct qat_alg_cd));
883 dma_free_coherent(dev, sizeof(struct qat_alg_cd), 889 dma_free_coherent(dev, sizeof(struct qat_alg_cd),
884 ctx->dec_cd, ctx->dec_cd_paddr); 890 ctx->dec_cd, ctx->dec_cd_paddr);
891 }
885 qat_crypto_put_instance(inst); 892 qat_crypto_put_instance(inst);
886} 893}
887 894
diff --git a/drivers/crypto/qat/qat_common/qat_hal.c b/drivers/crypto/qat/qat_common/qat_hal.c
index 9b8a31521ff3..b818c19713bf 100644
--- a/drivers/crypto/qat/qat_common/qat_hal.c
+++ b/drivers/crypto/qat/qat_common/qat_hal.c
@@ -679,7 +679,8 @@ int qat_hal_init(struct adf_accel_dev *accel_dev)
679 struct icp_qat_fw_loader_handle *handle; 679 struct icp_qat_fw_loader_handle *handle;
680 struct adf_accel_pci *pci_info = &accel_dev->accel_pci_dev; 680 struct adf_accel_pci *pci_info = &accel_dev->accel_pci_dev;
681 struct adf_hw_device_data *hw_data = accel_dev->hw_device; 681 struct adf_hw_device_data *hw_data = accel_dev->hw_device;
682 struct adf_bar *bar = &pci_info->pci_bars[ADF_DH895XCC_PMISC_BAR]; 682 struct adf_bar *bar =
683 &pci_info->pci_bars[hw_data->get_misc_bar_id(hw_data)];
683 684
684 handle = kzalloc(sizeof(*handle), GFP_KERNEL); 685 handle = kzalloc(sizeof(*handle), GFP_KERNEL);
685 if (!handle) 686 if (!handle)
diff --git a/drivers/crypto/qat/qat_dh895xcc/adf_dh895xcc_hw_data.h b/drivers/crypto/qat/qat_dh895xcc/adf_dh895xcc_hw_data.h
index 65dd1ff93d3b..01e0be21e93a 100644
--- a/drivers/crypto/qat/qat_dh895xcc/adf_dh895xcc_hw_data.h
+++ b/drivers/crypto/qat/qat_dh895xcc/adf_dh895xcc_hw_data.h
@@ -48,6 +48,8 @@
48#define ADF_DH895x_HW_DATA_H_ 48#define ADF_DH895x_HW_DATA_H_
49 49
50/* PCIe configuration space */ 50/* PCIe configuration space */
51#define ADF_DH895XCC_PMISC_BAR 1
52#define ADF_DH895XCC_ETR_BAR 2
51#define ADF_DH895XCC_RX_RINGS_OFFSET 8 53#define ADF_DH895XCC_RX_RINGS_OFFSET 8
52#define ADF_DH895XCC_TX_RINGS_MASK 0xFF 54#define ADF_DH895XCC_TX_RINGS_MASK 0xFF
53#define ADF_DH895XCC_FUSECTL_OFFSET 0x40 55#define ADF_DH895XCC_FUSECTL_OFFSET 0x40
diff --git a/drivers/crypto/qat/qat_dh895xcc/adf_isr.c b/drivers/crypto/qat/qat_dh895xcc/adf_isr.c
index d96ee21b9b77..fe8f89697ad8 100644
--- a/drivers/crypto/qat/qat_dh895xcc/adf_isr.c
+++ b/drivers/crypto/qat/qat_dh895xcc/adf_isr.c
@@ -186,10 +186,8 @@ static int adf_isr_alloc_msix_entry_table(struct adf_accel_dev *accel_dev)
186 accel_dev->accel_pci_dev.msix_entries.names = names; 186 accel_dev->accel_pci_dev.msix_entries.names = names;
187 return 0; 187 return 0;
188err: 188err:
189 for (i = 0; i < msix_num_entries; i++) { 189 for (i = 0; i < msix_num_entries; i++)
190 if (*(names + i)) 190 kfree(*(names + i));
191 kfree(*(names + i));
192 }
193 kfree(entries); 191 kfree(entries);
194 kfree(names); 192 kfree(names);
195 return -ENOMEM; 193 return -ENOMEM;
@@ -203,10 +201,8 @@ static void adf_isr_free_msix_entry_table(struct adf_accel_dev *accel_dev)
203 int i; 201 int i;
204 202
205 kfree(accel_dev->accel_pci_dev.msix_entries.entries); 203 kfree(accel_dev->accel_pci_dev.msix_entries.entries);
206 for (i = 0; i < msix_num_entries; i++) { 204 for (i = 0; i < msix_num_entries; i++)
207 if (*(names + i)) 205 kfree(*(names + i));
208 kfree(*(names + i));
209 }
210 kfree(names); 206 kfree(names);
211} 207}
212 208