Skip to content

Commit 194e2e1

Browse files
committed
crypto: qat - remove BITS_IN_DWORD()
JIRA: https://issues.redhat.com/browse/RHEL-72768 Upstream Status: merged into herbert/crypto-2.6.git commit 1b58e2b Author: Suman Kumar Chakraborty <suman.kumar.chakraborty@intel.com> Date: Fri Mar 28 10:33:02 2025 +0000 crypto: qat - remove BITS_IN_DWORD() The BITS_IN_DWORD() macro, which represents the number of bits in the registers accessed by the firmware loader, is currently defined as 32. For consistency and readability, replace this macro with the existing BITS_PER_TYPE() macro, which serves the same purpose. This does not introduce any functional change. Signed-off-by: Suman Kumar Chakraborty <suman.kumar.chakraborty@intel.com> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Reviewed-by: Giovanni Cabiddu <giovanni.cabiddu@intel.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> Signed-off-by: Vladis Dronov <vdronov@redhat.com>
1 parent 4e07b56 commit 194e2e1

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

drivers/crypto/intel/qat/qat_common/qat_uclo.c

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0-only)
22
/* Copyright(c) 2014 - 2020 Intel Corporation */
33
#include <linux/align.h>
4+
#include <linux/bitops.h>
45
#include <linux/slab.h>
56
#include <linux/ctype.h>
67
#include <linux/kernel.h>
@@ -1205,7 +1206,6 @@ static int qat_uclo_map_suof(struct icp_qat_fw_loader_handle *handle,
12051206
}
12061207

12071208
#define ADD_ADDR(high, low) ((((u64)high) << 32) + low)
1208-
#define BITS_IN_DWORD 32
12091209

12101210
static int qat_uclo_auth_fw(struct icp_qat_fw_loader_handle *handle,
12111211
struct icp_qat_fw_auth_desc *desc)
@@ -1223,7 +1223,7 @@ static int qat_uclo_auth_fw(struct icp_qat_fw_loader_handle *handle,
12231223
fcu_dram_hi_csr = handle->chip_info->fcu_dram_addr_hi;
12241224
fcu_dram_lo_csr = handle->chip_info->fcu_dram_addr_lo;
12251225

1226-
SET_CAP_CSR(handle, fcu_dram_hi_csr, (bus_addr >> BITS_IN_DWORD));
1226+
SET_CAP_CSR(handle, fcu_dram_hi_csr, bus_addr >> BITS_PER_TYPE(u32));
12271227
SET_CAP_CSR(handle, fcu_dram_lo_csr, bus_addr);
12281228
SET_CAP_CSR(handle, fcu_ctl_csr, FCU_CTRL_CMD_AUTH);
12291229

@@ -1438,7 +1438,7 @@ static int qat_uclo_map_auth_fw(struct icp_qat_fw_loader_handle *handle,
14381438
virt_base = (uintptr_t)img_desc.dram_base_addr_v + simg_offset;
14391439
bus_addr = img_desc.dram_bus_addr + simg_offset;
14401440
auth_desc = img_desc.dram_base_addr_v;
1441-
auth_desc->css_hdr_high = (unsigned int)(bus_addr >> BITS_IN_DWORD);
1441+
auth_desc->css_hdr_high = (unsigned int)(bus_addr >> BITS_PER_TYPE(u32));
14421442
auth_desc->css_hdr_low = (unsigned int)bus_addr;
14431443
virt_addr = virt_base;
14441444

@@ -1448,7 +1448,7 @@ static int qat_uclo_map_auth_fw(struct icp_qat_fw_loader_handle *handle,
14481448
sizeof(*css_hdr);
14491449
virt_addr = virt_addr + sizeof(*css_hdr);
14501450

1451-
auth_desc->fwsk_pub_high = (unsigned int)(bus_addr >> BITS_IN_DWORD);
1451+
auth_desc->fwsk_pub_high = (unsigned int)(bus_addr >> BITS_PER_TYPE(u32));
14521452
auth_desc->fwsk_pub_low = (unsigned int)bus_addr;
14531453

14541454
memcpy((void *)(uintptr_t)virt_addr,
@@ -1470,7 +1470,7 @@ static int qat_uclo_map_auth_fw(struct icp_qat_fw_loader_handle *handle,
14701470
auth_desc->fwsk_pub_low) +
14711471
ICP_QAT_CSS_FWSK_PUB_LEN(handle);
14721472
virt_addr = virt_addr + ICP_QAT_CSS_FWSK_PUB_LEN(handle);
1473-
auth_desc->signature_high = (unsigned int)(bus_addr >> BITS_IN_DWORD);
1473+
auth_desc->signature_high = (unsigned int)(bus_addr >> BITS_PER_TYPE(u32));
14741474
auth_desc->signature_low = (unsigned int)bus_addr;
14751475

14761476
memcpy((void *)(uintptr_t)virt_addr,
@@ -1484,7 +1484,7 @@ static int qat_uclo_map_auth_fw(struct icp_qat_fw_loader_handle *handle,
14841484
ICP_QAT_CSS_SIGNATURE_LEN(handle);
14851485
virt_addr += ICP_QAT_CSS_SIGNATURE_LEN(handle);
14861486

1487-
auth_desc->img_high = (unsigned int)(bus_addr >> BITS_IN_DWORD);
1487+
auth_desc->img_high = (unsigned int)(bus_addr >> BITS_PER_TYPE(u32));
14881488
auth_desc->img_low = (unsigned int)bus_addr;
14891489
auth_desc->img_len = size - ICP_QAT_AE_IMG_OFFSET(handle);
14901490
if (bus_addr + auth_desc->img_len > img_desc.dram_bus_addr +
@@ -1507,12 +1507,12 @@ static int qat_uclo_map_auth_fw(struct icp_qat_fw_loader_handle *handle,
15071507
auth_desc->img_ae_mode_data_low) +
15081508
sizeof(struct icp_qat_simg_ae_mode);
15091509

1510-
auth_desc->img_ae_init_data_high = (unsigned int)
1511-
(bus_addr >> BITS_IN_DWORD);
1510+
auth_desc->img_ae_init_data_high =
1511+
(unsigned int)(bus_addr >> BITS_PER_TYPE(u32));
15121512
auth_desc->img_ae_init_data_low = (unsigned int)bus_addr;
15131513
bus_addr += ICP_QAT_SIMG_AE_INIT_SEQ_LEN;
1514-
auth_desc->img_ae_insts_high = (unsigned int)
1515-
(bus_addr >> BITS_IN_DWORD);
1514+
auth_desc->img_ae_insts_high =
1515+
(unsigned int)(bus_addr >> BITS_PER_TYPE(u32));
15161516
auth_desc->img_ae_insts_low = (unsigned int)bus_addr;
15171517
virt_addr += sizeof(struct icp_qat_css_hdr);
15181518
virt_addr += ICP_QAT_CSS_FWSK_PUB_LEN(handle);

0 commit comments

Comments
 (0)