diff mbox series

[4/4] Enable Driver compilation in crypto Kconfig and Makefile file

Message ID 20240305112831.3380896-5-pavitrakumarm@vayavyalabs.com
State Superseded
Headers show
Series Add spacc crypto driver support | expand

Commit Message

Pavitrakumar Managutte March 5, 2024, 11:28 a.m. UTC
Signed-off-by: Pavitrakumar M <pavitrakumarm@vayavyalabs.com>
Acked-by: Ruud Derwig <Ruud.Derwig@synopsys.com>
---
 drivers/crypto/Kconfig  | 1 +
 drivers/crypto/Makefile | 1 +
 2 files changed, 2 insertions(+)

Comments

kernel test robot March 6, 2024, 4:08 a.m. UTC | #1
Hi Pavitrakumar,

kernel test robot noticed the following build warnings:

[auto build test WARNING on herbert-cryptodev-2.6/master]
[also build test WARNING on herbert-crypto-2.6/master linus/master v6.8-rc7 next-20240305]
[cannot apply to xilinx-xlnx/master]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Pavitrakumar-M/Add-SPAcc-driver-to-Linux-kernel/20240305-193337
base:   https://git.kernel.org/pub/scm/linux/kernel/git/herbert/cryptodev-2.6.git master
patch link:    https://lore.kernel.org/r/20240305112831.3380896-5-pavitrakumarm%40vayavyalabs.com
patch subject: [PATCH 4/4] Enable Driver compilation in crypto Kconfig and Makefile file
config: x86_64-randconfig-121-20240306 (https://download.01.org/0day-ci/archive/20240306/202403061121.TsVV67xo-lkp@intel.com/config)
compiler: gcc-12 (Debian 12.2.0-14) 12.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240306/202403061121.TsVV67xo-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202403061121.TsVV67xo-lkp@intel.com/

sparse warnings: (new ones prefixed by >>)
>> drivers/crypto/dwc-spacc/spacc_core.c:1418:44: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void const volatile [noderef] __iomem *addr @@     got void * @@
   drivers/crypto/dwc-spacc/spacc_core.c:1418:44: sparse:     expected void const volatile [noderef] __iomem *addr
   drivers/crypto/dwc-spacc/spacc_core.c:1418:44: sparse:     got void *
   drivers/crypto/dwc-spacc/spacc_core.c:1421:44: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void const volatile [noderef] __iomem *addr @@     got void * @@
   drivers/crypto/dwc-spacc/spacc_core.c:1421:44: sparse:     expected void const volatile [noderef] __iomem *addr
   drivers/crypto/dwc-spacc/spacc_core.c:1421:44: sparse:     got void *
>> drivers/crypto/dwc-spacc/spacc_core.c:1550:47: sparse: sparse: incorrect type in argument 2 (different address spaces) @@     expected void volatile [noderef] __iomem *addr @@     got void * @@
   drivers/crypto/dwc-spacc/spacc_core.c:1550:47: sparse:     expected void volatile [noderef] __iomem *addr
   drivers/crypto/dwc-spacc/spacc_core.c:1550:47: sparse:     got void *
   drivers/crypto/dwc-spacc/spacc_core.c:1553:47: sparse: sparse: incorrect type in argument 2 (different address spaces) @@     expected void volatile [noderef] __iomem *addr @@     got void * @@
   drivers/crypto/dwc-spacc/spacc_core.c:1553:47: sparse:     expected void volatile [noderef] __iomem *addr
   drivers/crypto/dwc-spacc/spacc_core.c:1553:47: sparse:     got void *
   drivers/crypto/dwc-spacc/spacc_core.c:1562:38: sparse: sparse: incorrect type in argument 2 (different address spaces) @@     expected void volatile [noderef] __iomem *addr @@     got void * @@
   drivers/crypto/dwc-spacc/spacc_core.c:1562:38: sparse:     expected void volatile [noderef] __iomem *addr
   drivers/crypto/dwc-spacc/spacc_core.c:1562:38: sparse:     got void *
   drivers/crypto/dwc-spacc/spacc_core.c:1563:49: sparse: sparse: incorrect type in argument 2 (different address spaces) @@     expected void volatile [noderef] __iomem *addr @@     got void * @@
   drivers/crypto/dwc-spacc/spacc_core.c:1563:49: sparse:     expected void volatile [noderef] __iomem *addr
   drivers/crypto/dwc-spacc/spacc_core.c:1563:49: sparse:     got void *
   drivers/crypto/dwc-spacc/spacc_core.c:1650:49: sparse: sparse: incorrect type in argument 2 (different address spaces) @@     expected void volatile [noderef] __iomem *addr @@     got void * @@
   drivers/crypto/dwc-spacc/spacc_core.c:1650:49: sparse:     expected void volatile [noderef] __iomem *addr
   drivers/crypto/dwc-spacc/spacc_core.c:1650:49: sparse:     got void *
   drivers/crypto/dwc-spacc/spacc_core.c:1651:55: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void const volatile [noderef] __iomem *addr @@     got void * @@
   drivers/crypto/dwc-spacc/spacc_core.c:1651:55: sparse:     expected void const volatile [noderef] __iomem *addr
   drivers/crypto/dwc-spacc/spacc_core.c:1651:55: sparse:     got void *
   drivers/crypto/dwc-spacc/spacc_core.c:2513:50: sparse: sparse: incorrect type in argument 2 (different address spaces) @@     expected void volatile [noderef] __iomem *addr @@     got void * @@
   drivers/crypto/dwc-spacc/spacc_core.c:2513:50: sparse:     expected void volatile [noderef] __iomem *addr
   drivers/crypto/dwc-spacc/spacc_core.c:2513:50: sparse:     got void *
   drivers/crypto/dwc-spacc/spacc_core.c:2514:50: sparse: sparse: incorrect type in argument 2 (different address spaces) @@     expected void volatile [noderef] __iomem *addr @@     got void * @@
   drivers/crypto/dwc-spacc/spacc_core.c:2514:50: sparse:     expected void volatile [noderef] __iomem *addr
   drivers/crypto/dwc-spacc/spacc_core.c:2514:50: sparse:     got void *
   drivers/crypto/dwc-spacc/spacc_core.c:2515:34: sparse: sparse: incorrect type in argument 2 (different address spaces) @@     expected void volatile [noderef] __iomem *addr @@     got void * @@
   drivers/crypto/dwc-spacc/spacc_core.c:2515:34: sparse:     expected void volatile [noderef] __iomem *addr
   drivers/crypto/dwc-spacc/spacc_core.c:2515:34: sparse:     got void *
   drivers/crypto/dwc-spacc/spacc_core.c:2516:34: sparse: sparse: incorrect type in argument 2 (different address spaces) @@     expected void volatile [noderef] __iomem *addr @@     got void * @@
   drivers/crypto/dwc-spacc/spacc_core.c:2516:34: sparse:     expected void volatile [noderef] __iomem *addr
   drivers/crypto/dwc-spacc/spacc_core.c:2516:34: sparse:     got void *
   drivers/crypto/dwc-spacc/spacc_core.c:2517:34: sparse: sparse: incorrect type in argument 2 (different address spaces) @@     expected void volatile [noderef] __iomem *addr @@     got void * @@
   drivers/crypto/dwc-spacc/spacc_core.c:2517:34: sparse:     expected void volatile [noderef] __iomem *addr
   drivers/crypto/dwc-spacc/spacc_core.c:2517:34: sparse:     got void *
   drivers/crypto/dwc-spacc/spacc_core.c:2518:33: sparse: sparse: incorrect type in argument 2 (different address spaces) @@     expected void volatile [noderef] __iomem *addr @@     got void * @@
   drivers/crypto/dwc-spacc/spacc_core.c:2518:33: sparse:     expected void volatile [noderef] __iomem *addr
   drivers/crypto/dwc-spacc/spacc_core.c:2518:33: sparse:     got void *
   drivers/crypto/dwc-spacc/spacc_core.c:2519:33: sparse: sparse: incorrect type in argument 2 (different address spaces) @@     expected void volatile [noderef] __iomem *addr @@     got void * @@
   drivers/crypto/dwc-spacc/spacc_core.c:2519:33: sparse:     expected void volatile [noderef] __iomem *addr
   drivers/crypto/dwc-spacc/spacc_core.c:2519:33: sparse:     got void *
   drivers/crypto/dwc-spacc/spacc_core.c:2545:63: sparse: sparse: incorrect type in argument 2 (different address spaces) @@     expected void volatile [noderef] __iomem *addr @@     got void * @@
   drivers/crypto/dwc-spacc/spacc_core.c:2545:63: sparse:     expected void volatile [noderef] __iomem *addr
   drivers/crypto/dwc-spacc/spacc_core.c:2545:63: sparse:     got void *
   drivers/crypto/dwc-spacc/spacc_core.c:2550:60: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void const volatile [noderef] __iomem *addr @@     got void * @@
   drivers/crypto/dwc-spacc/spacc_core.c:2550:60: sparse:     expected void const volatile [noderef] __iomem *addr
   drivers/crypto/dwc-spacc/spacc_core.c:2550:60: sparse:     got void *
   drivers/crypto/dwc-spacc/spacc_core.c:2557:65: sparse: sparse: incorrect type in argument 2 (different address spaces) @@     expected void volatile [noderef] __iomem *addr @@     got void * @@
   drivers/crypto/dwc-spacc/spacc_core.c:2557:65: sparse:     expected void volatile [noderef] __iomem *addr
   drivers/crypto/dwc-spacc/spacc_core.c:2557:65: sparse:     got void *
   drivers/crypto/dwc-spacc/spacc_core.c:2560:68: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void const volatile [noderef] __iomem *addr @@     got void * @@
   drivers/crypto/dwc-spacc/spacc_core.c:2560:68: sparse:     expected void const volatile [noderef] __iomem *addr
   drivers/crypto/dwc-spacc/spacc_core.c:2560:68: sparse:     got void *
   drivers/crypto/dwc-spacc/spacc_core.c:2575:33: sparse: sparse: incorrect type in argument 2 (different address spaces) @@     expected void volatile [noderef] __iomem *addr @@     got void * @@
   drivers/crypto/dwc-spacc/spacc_core.c:2575:33: sparse:     expected void volatile [noderef] __iomem *addr
   drivers/crypto/dwc-spacc/spacc_core.c:2575:33: sparse:     got void *
   drivers/crypto/dwc-spacc/spacc_core.c:2576:33: sparse: sparse: incorrect type in argument 2 (different address spaces) @@     expected void volatile [noderef] __iomem *addr @@     got void * @@
   drivers/crypto/dwc-spacc/spacc_core.c:2576:33: sparse:     expected void volatile [noderef] __iomem *addr
   drivers/crypto/dwc-spacc/spacc_core.c:2576:33: sparse:     got void *
   drivers/crypto/dwc-spacc/spacc_core.c:2577:42: sparse: sparse: incorrect type in argument 2 (different address spaces) @@     expected void volatile [noderef] __iomem *addr @@     got void * @@
   drivers/crypto/dwc-spacc/spacc_core.c:2577:42: sparse:     expected void volatile [noderef] __iomem *addr
   drivers/crypto/dwc-spacc/spacc_core.c:2577:42: sparse:     got void *
   drivers/crypto/dwc-spacc/spacc_core.c:2579:33: sparse: sparse: incorrect type in argument 2 (different address spaces) @@     expected void volatile [noderef] __iomem *addr @@     got void * @@
   drivers/crypto/dwc-spacc/spacc_core.c:2579:33: sparse:     expected void volatile [noderef] __iomem *addr
   drivers/crypto/dwc-spacc/spacc_core.c:2579:33: sparse:     got void *
   drivers/crypto/dwc-spacc/spacc_core.c:2580:33: sparse: sparse: incorrect type in argument 2 (different address spaces) @@     expected void volatile [noderef] __iomem *addr @@     got void * @@
   drivers/crypto/dwc-spacc/spacc_core.c:2580:33: sparse:     expected void volatile [noderef] __iomem *addr
   drivers/crypto/dwc-spacc/spacc_core.c:2580:33: sparse:     got void *
   drivers/crypto/dwc-spacc/spacc_core.c:2581:33: sparse: sparse: incorrect type in argument 2 (different address spaces) @@     expected void volatile [noderef] __iomem *addr @@     got void * @@
   drivers/crypto/dwc-spacc/spacc_core.c:2581:33: sparse:     expected void volatile [noderef] __iomem *addr
   drivers/crypto/dwc-spacc/spacc_core.c:2581:33: sparse:     got void *
   drivers/crypto/dwc-spacc/spacc_core.c:2582:33: sparse: sparse: incorrect type in argument 2 (different address spaces) @@     expected void volatile [noderef] __iomem *addr @@     got void * @@
   drivers/crypto/dwc-spacc/spacc_core.c:2582:33: sparse:     expected void volatile [noderef] __iomem *addr
   drivers/crypto/dwc-spacc/spacc_core.c:2582:33: sparse:     got void *
   drivers/crypto/dwc-spacc/spacc_core.c:2583:33: sparse: sparse: incorrect type in argument 2 (different address spaces) @@     expected void volatile [noderef] __iomem *addr @@     got void * @@
   drivers/crypto/dwc-spacc/spacc_core.c:2583:33: sparse:     expected void volatile [noderef] __iomem *addr
   drivers/crypto/dwc-spacc/spacc_core.c:2583:33: sparse:     got void *
   drivers/crypto/dwc-spacc/spacc_core.c:2689:42: sparse: sparse: incorrect type in argument 2 (different address spaces) @@     expected void volatile [noderef] __iomem *addr @@     got void * @@
   drivers/crypto/dwc-spacc/spacc_core.c:2689:42: sparse:     expected void volatile [noderef] __iomem *addr
   drivers/crypto/dwc-spacc/spacc_core.c:2689:42: sparse:     got void *
   drivers/crypto/dwc-spacc/spacc_core.c:2690:58: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void const volatile [noderef] __iomem *addr @@     got void * @@
   drivers/crypto/dwc-spacc/spacc_core.c:2690:58: sparse:     expected void const volatile [noderef] __iomem *addr
   drivers/crypto/dwc-spacc/spacc_core.c:2690:58: sparse:     got void *
   drivers/crypto/dwc-spacc/spacc_core.c:2698:34: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void const volatile [noderef] __iomem *addr @@     got void * @@
   drivers/crypto/dwc-spacc/spacc_core.c:2698:34: sparse:     expected void const volatile [noderef] __iomem *addr
   drivers/crypto/dwc-spacc/spacc_core.c:2698:34: sparse:     got void *
   drivers/crypto/dwc-spacc/spacc_core.c:2716:42: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void const volatile [noderef] __iomem *addr @@     got void * @@
   drivers/crypto/dwc-spacc/spacc_core.c:2716:42: sparse:     expected void const volatile [noderef] __iomem *addr
   drivers/crypto/dwc-spacc/spacc_core.c:2716:42: sparse:     got void *
   drivers/crypto/dwc-spacc/spacc_core.c:2742:45: sparse: sparse: incorrect type in argument 2 (different address spaces) @@     expected void volatile [noderef] __iomem *addr @@     got void * @@
   drivers/crypto/dwc-spacc/spacc_core.c:2742:45: sparse:     expected void volatile [noderef] __iomem *addr
   drivers/crypto/dwc-spacc/spacc_core.c:2742:45: sparse:     got void *
   drivers/crypto/dwc-spacc/spacc_core.c:2743:45: sparse: sparse: incorrect type in argument 2 (different address spaces) @@     expected void volatile [noderef] __iomem *addr @@     got void * @@
   drivers/crypto/dwc-spacc/spacc_core.c:2743:45: sparse:     expected void volatile [noderef] __iomem *addr
   drivers/crypto/dwc-spacc/spacc_core.c:2743:45: sparse:     got void *
   drivers/crypto/dwc-spacc/spacc_core.c:2744:38: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void const volatile [noderef] __iomem *addr @@     got void * @@
   drivers/crypto/dwc-spacc/spacc_core.c:2744:38: sparse:     expected void const volatile [noderef] __iomem *addr
   drivers/crypto/dwc-spacc/spacc_core.c:2744:38: sparse:     got void *
   drivers/crypto/dwc-spacc/spacc_core.c:2746:38: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void const volatile [noderef] __iomem *addr @@     got void * @@
   drivers/crypto/dwc-spacc/spacc_core.c:2746:38: sparse:     expected void const volatile [noderef] __iomem *addr
   drivers/crypto/dwc-spacc/spacc_core.c:2746:38: sparse:     got void *
   drivers/crypto/dwc-spacc/spacc_core.c:2756:33: sparse: sparse: incorrect type in argument 2 (different address spaces) @@     expected void volatile [noderef] __iomem *addr @@     got void * @@
   drivers/crypto/dwc-spacc/spacc_core.c:2756:33: sparse:     expected void volatile [noderef] __iomem *addr

vim +1418 drivers/crypto/dwc-spacc/spacc_core.c

6ad822cec22644 Pavitrakumar M 2024-03-05  1414  
6ad822cec22644 Pavitrakumar M 2024-03-05  1415  static int _spacc_fifo_full(struct spacc_device *spacc, uint32_t prio)
6ad822cec22644 Pavitrakumar M 2024-03-05  1416  {
6ad822cec22644 Pavitrakumar M 2024-03-05  1417  	if (spacc->config.is_qos)
6ad822cec22644 Pavitrakumar M 2024-03-05 @1418  		return readl(spacc->regmap + SPACC_REG_FIFO_STAT) &
6ad822cec22644 Pavitrakumar M 2024-03-05  1419  			SPACC_FIFO_STAT_CMDX_FULL(prio);
6ad822cec22644 Pavitrakumar M 2024-03-05  1420  	else
6ad822cec22644 Pavitrakumar M 2024-03-05  1421  		return readl(spacc->regmap + SPACC_REG_FIFO_STAT) &
6ad822cec22644 Pavitrakumar M 2024-03-05  1422  			SPACC_FIFO_STAT_CMD0_FULL;
6ad822cec22644 Pavitrakumar M 2024-03-05  1423  }
6ad822cec22644 Pavitrakumar M 2024-03-05  1424  
6ad822cec22644 Pavitrakumar M 2024-03-05  1425  /* When proc_sz != 0 it overrides the ddt_len value
6ad822cec22644 Pavitrakumar M 2024-03-05  1426   * defined in the context referenced by 'job_idx'
6ad822cec22644 Pavitrakumar M 2024-03-05  1427   */
6ad822cec22644 Pavitrakumar M 2024-03-05  1428  int spacc_packet_enqueue_ddt_ex(struct spacc_device *spacc, int use_jb, int
6ad822cec22644 Pavitrakumar M 2024-03-05  1429  		job_idx, struct pdu_ddt *src_ddt, struct pdu_ddt *dst_ddt,
6ad822cec22644 Pavitrakumar M 2024-03-05  1430  		u32 proc_sz, uint32_t aad_offset, uint32_t pre_aad_sz,
6ad822cec22644 Pavitrakumar M 2024-03-05  1431  		u32 post_aad_sz, uint32_t iv_offset, uint32_t prio)
6ad822cec22644 Pavitrakumar M 2024-03-05  1432  {
6ad822cec22644 Pavitrakumar M 2024-03-05  1433  	int ret = CRYPTO_OK, proc_len;
6ad822cec22644 Pavitrakumar M 2024-03-05  1434  	struct spacc_job *job;
6ad822cec22644 Pavitrakumar M 2024-03-05  1435  
6ad822cec22644 Pavitrakumar M 2024-03-05  1436  	if (job_idx < 0 || job_idx > SPACC_MAX_JOBS)
6ad822cec22644 Pavitrakumar M 2024-03-05  1437  		return -ENXIO;
6ad822cec22644 Pavitrakumar M 2024-03-05  1438  
6ad822cec22644 Pavitrakumar M 2024-03-05  1439  	switch (prio)  {
6ad822cec22644 Pavitrakumar M 2024-03-05  1440  	case SPACC_SW_CTRL_PRIO_MED:
6ad822cec22644 Pavitrakumar M 2024-03-05  1441  		if (spacc->config.cmd1_fifo_depth == 0)
6ad822cec22644 Pavitrakumar M 2024-03-05  1442  			return -EINVAL;
6ad822cec22644 Pavitrakumar M 2024-03-05  1443  		break;
6ad822cec22644 Pavitrakumar M 2024-03-05  1444  	case SPACC_SW_CTRL_PRIO_LOW:
6ad822cec22644 Pavitrakumar M 2024-03-05  1445  		if (spacc->config.cmd2_fifo_depth == 0)
6ad822cec22644 Pavitrakumar M 2024-03-05  1446  			return -EINVAL;
6ad822cec22644 Pavitrakumar M 2024-03-05  1447  		break;
6ad822cec22644 Pavitrakumar M 2024-03-05  1448  	}
6ad822cec22644 Pavitrakumar M 2024-03-05  1449  
6ad822cec22644 Pavitrakumar M 2024-03-05  1450  	job = &spacc->job[job_idx];
6ad822cec22644 Pavitrakumar M 2024-03-05  1451  	if (!job) {
6ad822cec22644 Pavitrakumar M 2024-03-05  1452  		ret = -EIO;
6ad822cec22644 Pavitrakumar M 2024-03-05  1453  	} else {
6ad822cec22644 Pavitrakumar M 2024-03-05  1454  		/* process any jobs in the jb*/
6ad822cec22644 Pavitrakumar M 2024-03-05  1455  		if (use_jb && spacc_process_jb(spacc) != 0)
6ad822cec22644 Pavitrakumar M 2024-03-05  1456  			goto fifo_full;
6ad822cec22644 Pavitrakumar M 2024-03-05  1457  
6ad822cec22644 Pavitrakumar M 2024-03-05  1458  		if (_spacc_fifo_full(spacc, prio)) {
6ad822cec22644 Pavitrakumar M 2024-03-05  1459  			if (use_jb)
6ad822cec22644 Pavitrakumar M 2024-03-05  1460  				goto fifo_full;
6ad822cec22644 Pavitrakumar M 2024-03-05  1461  			else
6ad822cec22644 Pavitrakumar M 2024-03-05  1462  				return -EBUSY;
6ad822cec22644 Pavitrakumar M 2024-03-05  1463  		}
6ad822cec22644 Pavitrakumar M 2024-03-05  1464  
6ad822cec22644 Pavitrakumar M 2024-03-05  1465  		/* compute the length we must process, in decrypt mode
6ad822cec22644 Pavitrakumar M 2024-03-05  1466  		 * with an ICV (hash, hmac or CCM modes)
6ad822cec22644 Pavitrakumar M 2024-03-05  1467  		 * we must subtract the icv length from the buffer size
6ad822cec22644 Pavitrakumar M 2024-03-05  1468  		 */
6ad822cec22644 Pavitrakumar M 2024-03-05  1469  		if (proc_sz == SPACC_AUTO_SIZE) {
6ad822cec22644 Pavitrakumar M 2024-03-05  1470  			if (job->op == OP_DECRYPT &&
6ad822cec22644 Pavitrakumar M 2024-03-05  1471  			    (job->hash_mode > 0 || (job->enc_mode ==
6ad822cec22644 Pavitrakumar M 2024-03-05  1472  				    CRYPTO_MODE_AES_CCM || job->enc_mode ==
6ad822cec22644 Pavitrakumar M 2024-03-05  1473  				    CRYPTO_MODE_AES_GCM)) &&	!(job->ctrl &
6ad822cec22644 Pavitrakumar M 2024-03-05  1474  				    SPACC_CTRL_MASK(SPACC_CTRL_ICV_ENC))) {
6ad822cec22644 Pavitrakumar M 2024-03-05  1475  				proc_len = src_ddt->len - job->icv_len;
6ad822cec22644 Pavitrakumar M 2024-03-05  1476  			} else {
6ad822cec22644 Pavitrakumar M 2024-03-05  1477  				proc_len = src_ddt->len;
6ad822cec22644 Pavitrakumar M 2024-03-05  1478  			}
6ad822cec22644 Pavitrakumar M 2024-03-05  1479  		} else {
6ad822cec22644 Pavitrakumar M 2024-03-05  1480  			proc_len = proc_sz;
6ad822cec22644 Pavitrakumar M 2024-03-05  1481  		}
6ad822cec22644 Pavitrakumar M 2024-03-05  1482  
6ad822cec22644 Pavitrakumar M 2024-03-05  1483  		if (pre_aad_sz & SPACC_AADCOPY_FLAG) {
6ad822cec22644 Pavitrakumar M 2024-03-05  1484  			job->ctrl |= SPACC_CTRL_MASK(SPACC_CTRL_AAD_COPY);
6ad822cec22644 Pavitrakumar M 2024-03-05  1485  			pre_aad_sz &= ~(SPACC_AADCOPY_FLAG);
6ad822cec22644 Pavitrakumar M 2024-03-05  1486  		} else {
6ad822cec22644 Pavitrakumar M 2024-03-05  1487  			job->ctrl &= ~SPACC_CTRL_MASK(SPACC_CTRL_AAD_COPY);
6ad822cec22644 Pavitrakumar M 2024-03-05  1488  		}
6ad822cec22644 Pavitrakumar M 2024-03-05  1489  
6ad822cec22644 Pavitrakumar M 2024-03-05  1490  		job->pre_aad_sz  = pre_aad_sz;
6ad822cec22644 Pavitrakumar M 2024-03-05  1491  		job->post_aad_sz = post_aad_sz;
6ad822cec22644 Pavitrakumar M 2024-03-05  1492  
6ad822cec22644 Pavitrakumar M 2024-03-05  1493  		if (spacc->config.dma_type == SPACC_DMA_DDT) {
6ad822cec22644 Pavitrakumar M 2024-03-05  1494  			pdu_io_cached_write(spacc->regmap +
6ad822cec22644 Pavitrakumar M 2024-03-05  1495  					SPACC_REG_SRC_PTR,
6ad822cec22644 Pavitrakumar M 2024-03-05  1496  					(uint32_t)src_ddt->phys,
6ad822cec22644 Pavitrakumar M 2024-03-05  1497  					&spacc->cache.src_ptr);
6ad822cec22644 Pavitrakumar M 2024-03-05  1498  			pdu_io_cached_write(spacc->regmap +
6ad822cec22644 Pavitrakumar M 2024-03-05  1499  					SPACC_REG_DST_PTR,
6ad822cec22644 Pavitrakumar M 2024-03-05  1500  					(uint32_t)dst_ddt->phys,
6ad822cec22644 Pavitrakumar M 2024-03-05  1501  					&spacc->cache.dst_ptr);
6ad822cec22644 Pavitrakumar M 2024-03-05  1502  		} else if (spacc->config.dma_type == SPACC_DMA_LINEAR) {
6ad822cec22644 Pavitrakumar M 2024-03-05  1503  			pdu_io_cached_write(spacc->regmap +
6ad822cec22644 Pavitrakumar M 2024-03-05  1504  					SPACC_REG_SRC_PTR,
6ad822cec22644 Pavitrakumar M 2024-03-05  1505  					(uint32_t)src_ddt->virt[0],
6ad822cec22644 Pavitrakumar M 2024-03-05  1506  					&spacc->cache.src_ptr);
6ad822cec22644 Pavitrakumar M 2024-03-05  1507  			pdu_io_cached_write(spacc->regmap +
6ad822cec22644 Pavitrakumar M 2024-03-05  1508  					SPACC_REG_DST_PTR,
6ad822cec22644 Pavitrakumar M 2024-03-05  1509  					(uint32_t)dst_ddt->virt[0],
6ad822cec22644 Pavitrakumar M 2024-03-05  1510  					&spacc->cache.dst_ptr);
6ad822cec22644 Pavitrakumar M 2024-03-05  1511  		} else {
6ad822cec22644 Pavitrakumar M 2024-03-05  1512  			return -EIO;
6ad822cec22644 Pavitrakumar M 2024-03-05  1513  		}
6ad822cec22644 Pavitrakumar M 2024-03-05  1514  
6ad822cec22644 Pavitrakumar M 2024-03-05  1515  		pdu_io_cached_write(spacc->regmap +
6ad822cec22644 Pavitrakumar M 2024-03-05  1516  				SPACC_REG_PROC_LEN,     proc_len -
6ad822cec22644 Pavitrakumar M 2024-03-05  1517  				job->post_aad_sz,
6ad822cec22644 Pavitrakumar M 2024-03-05  1518  				&spacc->cache.proc_len);
6ad822cec22644 Pavitrakumar M 2024-03-05  1519  		pdu_io_cached_write(spacc->regmap +
6ad822cec22644 Pavitrakumar M 2024-03-05  1520  				SPACC_REG_ICV_LEN,      job->icv_len,
6ad822cec22644 Pavitrakumar M 2024-03-05  1521  				&spacc->cache.icv_len);
6ad822cec22644 Pavitrakumar M 2024-03-05  1522  		pdu_io_cached_write(spacc->regmap +
6ad822cec22644 Pavitrakumar M 2024-03-05  1523  				SPACC_REG_ICV_OFFSET,
6ad822cec22644 Pavitrakumar M 2024-03-05  1524  				job->icv_offset,
6ad822cec22644 Pavitrakumar M 2024-03-05  1525  				&spacc->cache.icv_offset);
6ad822cec22644 Pavitrakumar M 2024-03-05  1526  		pdu_io_cached_write(spacc->regmap +
6ad822cec22644 Pavitrakumar M 2024-03-05  1527  				SPACC_REG_PRE_AAD_LEN,
6ad822cec22644 Pavitrakumar M 2024-03-05  1528  				job->pre_aad_sz,
6ad822cec22644 Pavitrakumar M 2024-03-05  1529  				&spacc->cache.pre_aad);
6ad822cec22644 Pavitrakumar M 2024-03-05  1530  		pdu_io_cached_write(spacc->regmap +
6ad822cec22644 Pavitrakumar M 2024-03-05  1531  				SPACC_REG_POST_AAD_LEN,
6ad822cec22644 Pavitrakumar M 2024-03-05  1532  				job->post_aad_sz,
6ad822cec22644 Pavitrakumar M 2024-03-05  1533  				&spacc->cache.post_aad);
6ad822cec22644 Pavitrakumar M 2024-03-05  1534  		pdu_io_cached_write(spacc->regmap +
6ad822cec22644 Pavitrakumar M 2024-03-05  1535  				SPACC_REG_IV_OFFSET,    iv_offset,
6ad822cec22644 Pavitrakumar M 2024-03-05  1536  				&spacc->cache.iv_offset);
6ad822cec22644 Pavitrakumar M 2024-03-05  1537  		pdu_io_cached_write(spacc->regmap +
6ad822cec22644 Pavitrakumar M 2024-03-05  1538  				SPACC_REG_OFFSET,
6ad822cec22644 Pavitrakumar M 2024-03-05  1539  				aad_offset, &spacc->cache.offset);
6ad822cec22644 Pavitrakumar M 2024-03-05  1540  		pdu_io_cached_write(spacc->regmap +
6ad822cec22644 Pavitrakumar M 2024-03-05  1541  				SPACC_REG_AUX_INFO,
6ad822cec22644 Pavitrakumar M 2024-03-05  1542  				AUX_DIR(job->auxinfo_dir) |
6ad822cec22644 Pavitrakumar M 2024-03-05  1543  				AUX_BIT_ALIGN(job->auxinfo_bit_align) |
6ad822cec22644 Pavitrakumar M 2024-03-05  1544  				AUX_CBC_CS(job->auxinfo_cs_mode),
6ad822cec22644 Pavitrakumar M 2024-03-05  1545  				&spacc->cache.aux);
6ad822cec22644 Pavitrakumar M 2024-03-05  1546  
6ad822cec22644 Pavitrakumar M 2024-03-05  1547  		if (job->first_use == 1) {
6ad822cec22644 Pavitrakumar M 2024-03-05  1548  			writel(job->ckey_sz |
6ad822cec22644 Pavitrakumar M 2024-03-05  1549  				SPACC_SET_KEY_CTX(job->ctx_idx),
6ad822cec22644 Pavitrakumar M 2024-03-05 @1550  				spacc->regmap + SPACC_REG_KEY_SZ);
6ad822cec22644 Pavitrakumar M 2024-03-05  1551  			writel(job->hkey_sz |
6ad822cec22644 Pavitrakumar M 2024-03-05  1552  				SPACC_SET_KEY_CTX(job->ctx_idx),
6ad822cec22644 Pavitrakumar M 2024-03-05  1553  				spacc->regmap + SPACC_REG_KEY_SZ);
6ad822cec22644 Pavitrakumar M 2024-03-05  1554  		}
6ad822cec22644 Pavitrakumar M 2024-03-05  1555  
6ad822cec22644 Pavitrakumar M 2024-03-05  1556  		job->job_swid = spacc->job_next_swid;
6ad822cec22644 Pavitrakumar M 2024-03-05  1557  		spacc->job_lookup[job->job_swid] = job_idx;
6ad822cec22644 Pavitrakumar M 2024-03-05  1558  		spacc->job_next_swid = (spacc->job_next_swid + 1) %
6ad822cec22644 Pavitrakumar M 2024-03-05  1559  			SPACC_MAX_JOBS;
6ad822cec22644 Pavitrakumar M 2024-03-05  1560  		writel(SPACC_SW_CTRL_ID_SET(job->job_swid) |
6ad822cec22644 Pavitrakumar M 2024-03-05  1561  		       SPACC_SW_CTRL_PRIO_SET(prio),
6ad822cec22644 Pavitrakumar M 2024-03-05  1562  		       spacc->regmap + SPACC_REG_SW_CTRL);
6ad822cec22644 Pavitrakumar M 2024-03-05  1563  		writel(job->ctrl, spacc->regmap + SPACC_REG_CTRL);
6ad822cec22644 Pavitrakumar M 2024-03-05  1564  
6ad822cec22644 Pavitrakumar M 2024-03-05  1565  		/* Clear an expansion key after the first call*/
6ad822cec22644 Pavitrakumar M 2024-03-05  1566  		if (job->first_use == 1) {
6ad822cec22644 Pavitrakumar M 2024-03-05  1567  			job->first_use = 0;
6ad822cec22644 Pavitrakumar M 2024-03-05  1568  			job->ctrl &= ~SPACC_CTRL_MASK(SPACC_CTRL_KEY_EXP);
6ad822cec22644 Pavitrakumar M 2024-03-05  1569  		}
6ad822cec22644 Pavitrakumar M 2024-03-05  1570  	}
6ad822cec22644 Pavitrakumar M 2024-03-05  1571  
6ad822cec22644 Pavitrakumar M 2024-03-05  1572  
6ad822cec22644 Pavitrakumar M 2024-03-05  1573  	return ret;
6ad822cec22644 Pavitrakumar M 2024-03-05  1574  fifo_full:
6ad822cec22644 Pavitrakumar M 2024-03-05  1575  	/* try to add a job to the job buffers*/
6ad822cec22644 Pavitrakumar M 2024-03-05  1576  	{
6ad822cec22644 Pavitrakumar M 2024-03-05  1577  		int i;
6ad822cec22644 Pavitrakumar M 2024-03-05  1578  
6ad822cec22644 Pavitrakumar M 2024-03-05  1579  		i = spacc->jb_head + 1;
6ad822cec22644 Pavitrakumar M 2024-03-05  1580  		if (i == SPACC_MAX_JOB_BUFFERS)
6ad822cec22644 Pavitrakumar M 2024-03-05  1581  			i = 0;
6ad822cec22644 Pavitrakumar M 2024-03-05  1582  
6ad822cec22644 Pavitrakumar M 2024-03-05  1583  		if (i == spacc->jb_tail)
6ad822cec22644 Pavitrakumar M 2024-03-05  1584  			return -EBUSY;
6ad822cec22644 Pavitrakumar M 2024-03-05  1585  
6ad822cec22644 Pavitrakumar M 2024-03-05  1586  		spacc->job_buffer[spacc->jb_head] = (struct spacc_job_buffer) {
6ad822cec22644 Pavitrakumar M 2024-03-05  1587  			.active		= 1,
6ad822cec22644 Pavitrakumar M 2024-03-05  1588  			.job_idx	= job_idx,
6ad822cec22644 Pavitrakumar M 2024-03-05  1589  			.src		= src_ddt,
6ad822cec22644 Pavitrakumar M 2024-03-05  1590  			.dst		= dst_ddt,
6ad822cec22644 Pavitrakumar M 2024-03-05  1591  			.proc_sz	= proc_sz,
6ad822cec22644 Pavitrakumar M 2024-03-05  1592  			.aad_offset	= aad_offset,
6ad822cec22644 Pavitrakumar M 2024-03-05  1593  			.pre_aad_sz	= pre_aad_sz,
6ad822cec22644 Pavitrakumar M 2024-03-05  1594  			.post_aad_sz	= post_aad_sz,
6ad822cec22644 Pavitrakumar M 2024-03-05  1595  			.iv_offset	= iv_offset,
6ad822cec22644 Pavitrakumar M 2024-03-05  1596  			.prio		= prio
6ad822cec22644 Pavitrakumar M 2024-03-05  1597  		};
6ad822cec22644 Pavitrakumar M 2024-03-05  1598  
6ad822cec22644 Pavitrakumar M 2024-03-05  1599  		spacc->jb_head = i;
6ad822cec22644 Pavitrakumar M 2024-03-05  1600  
6ad822cec22644 Pavitrakumar M 2024-03-05  1601  		return CRYPTO_USED_JB;
6ad822cec22644 Pavitrakumar M 2024-03-05  1602  	}
6ad822cec22644 Pavitrakumar M 2024-03-05  1603  }
6ad822cec22644 Pavitrakumar M 2024-03-05  1604
kernel test robot March 6, 2024, 6:43 a.m. UTC | #2
Hi Pavitrakumar,

kernel test robot noticed the following build warnings:

[auto build test WARNING on herbert-cryptodev-2.6/master]
[also build test WARNING on herbert-crypto-2.6/master linus/master v6.8-rc7 next-20240305]
[cannot apply to xilinx-xlnx/master]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Pavitrakumar-M/Add-SPAcc-driver-to-Linux-kernel/20240305-193337
base:   https://git.kernel.org/pub/scm/linux/kernel/git/herbert/cryptodev-2.6.git master
patch link:    https://lore.kernel.org/r/20240305112831.3380896-5-pavitrakumarm%40vayavyalabs.com
patch subject: [PATCH 4/4] Enable Driver compilation in crypto Kconfig and Makefile file
config: csky-randconfig-r071-20240306 (https://download.01.org/0day-ci/archive/20240306/202403061413.rdjPqkel-lkp@intel.com/config)
compiler: csky-linux-gcc (GCC) 13.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240306/202403061413.rdjPqkel-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202403061413.rdjPqkel-lkp@intel.com/

All warnings (new ones prefixed by >>):

   drivers/crypto/dwc-spacc/spacc_core.c:2835:56: warning: 'reg_names' defined but not used [-Wunused-const-variable=]
    2835 | static const struct { unsigned int addr; char *name; } reg_names[] = {
         |                                                        ^~~~~~~~~
>> drivers/crypto/dwc-spacc/spacc_core.c:1395:12: warning: 'spacc_set_auxinfo' defined but not used [-Wunused-function]
    1395 | static int spacc_set_auxinfo(struct spacc_device *spacc, int jobid, uint32_t
         |            ^~~~~~~~~~~~~~~~~
   drivers/crypto/dwc-spacc/spacc_core.c:984:26: warning: 'names' defined but not used [-Wunused-const-variable=]
     984 | static const char *const names[] = {
         |                          ^~~~~
   In file included from <command-line>:
   In function 'spacc_sg_chain',
       inlined from 'fixup_sg' at drivers/crypto/dwc-spacc/spacc_core.c:1115:4,
       inlined from 'spacc_sgs_to_ddt' at drivers/crypto/dwc-spacc/spacc_core.c:1144:16:
   include/linux/compiler_types.h:435:45: error: call to '__compiletime_assert_240' declared with attribute error: BUILD_BUG_ON failed: IS_ENABLED(CONFIG_DEBUG_SG)
     435 |         _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
         |                                             ^
   include/linux/compiler_types.h:416:25: note: in definition of macro '__compiletime_assert'
     416 |                         prefix ## suffix();                             \
         |                         ^~~~~~
   include/linux/compiler_types.h:435:9: note: in expansion of macro '_compiletime_assert'
     435 |         _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
         |         ^~~~~~~~~~~~~~~~~~~
   include/linux/build_bug.h:39:37: note: in expansion of macro 'compiletime_assert'
      39 | #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
         |                                     ^~~~~~~~~~~~~~~~~~
   include/linux/build_bug.h:50:9: note: in expansion of macro 'BUILD_BUG_ON_MSG'
      50 |         BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: " #condition)
         |         ^~~~~~~~~~~~~~~~
   drivers/crypto/dwc-spacc/spacc_core.c:1082:9: note: in expansion of macro 'BUILD_BUG_ON'
    1082 |         BUILD_BUG_ON(IS_ENABLED(CONFIG_DEBUG_SG));
         |         ^~~~~~~~~~~~
   In function 'spacc_sg_chain',
       inlined from 'fixup_sg' at drivers/crypto/dwc-spacc/spacc_core.c:1115:4,
       inlined from 'spacc_sg_to_ddt' at drivers/crypto/dwc-spacc/spacc_core.c:1252:15:
   include/linux/compiler_types.h:435:45: error: call to '__compiletime_assert_240' declared with attribute error: BUILD_BUG_ON failed: IS_ENABLED(CONFIG_DEBUG_SG)
     435 |         _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
         |                                             ^
   include/linux/compiler_types.h:416:25: note: in definition of macro '__compiletime_assert'
     416 |                         prefix ## suffix();                             \
         |                         ^~~~~~
   include/linux/compiler_types.h:435:9: note: in expansion of macro '_compiletime_assert'
     435 |         _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
         |         ^~~~~~~~~~~~~~~~~~~
   include/linux/build_bug.h:39:37: note: in expansion of macro 'compiletime_assert'
      39 | #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
         |                                     ^~~~~~~~~~~~~~~~~~
   include/linux/build_bug.h:50:9: note: in expansion of macro 'BUILD_BUG_ON_MSG'
      50 |         BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: " #condition)
         |         ^~~~~~~~~~~~~~~~
   drivers/crypto/dwc-spacc/spacc_core.c:1082:9: note: in expansion of macro 'BUILD_BUG_ON'
    1082 |         BUILD_BUG_ON(IS_ENABLED(CONFIG_DEBUG_SG));
         |         ^~~~~~~~~~~~


vim +/spacc_set_auxinfo +1395 drivers/crypto/dwc-spacc/spacc_core.c

6ad822cec22644 Pavitrakumar M 2024-03-05  1394  
6ad822cec22644 Pavitrakumar M 2024-03-05 @1395  static int spacc_set_auxinfo(struct spacc_device *spacc, int jobid, uint32_t
6ad822cec22644 Pavitrakumar M 2024-03-05  1396  		direction, uint32_t bitsize)
6ad822cec22644 Pavitrakumar M 2024-03-05  1397  {
6ad822cec22644 Pavitrakumar M 2024-03-05  1398  	int ret = CRYPTO_OK;
6ad822cec22644 Pavitrakumar M 2024-03-05  1399  	struct spacc_job *job;
6ad822cec22644 Pavitrakumar M 2024-03-05  1400  
6ad822cec22644 Pavitrakumar M 2024-03-05  1401  	if (jobid < 0 || jobid > SPACC_MAX_JOBS)
6ad822cec22644 Pavitrakumar M 2024-03-05  1402  		return -ENXIO;
6ad822cec22644 Pavitrakumar M 2024-03-05  1403  
6ad822cec22644 Pavitrakumar M 2024-03-05  1404  	job = &spacc->job[jobid];
6ad822cec22644 Pavitrakumar M 2024-03-05  1405  	if (!job) {
6ad822cec22644 Pavitrakumar M 2024-03-05  1406  		ret = -EIO;
6ad822cec22644 Pavitrakumar M 2024-03-05  1407  	} else {
6ad822cec22644 Pavitrakumar M 2024-03-05  1408  		job->auxinfo_dir = direction;
6ad822cec22644 Pavitrakumar M 2024-03-05  1409  		job->auxinfo_bit_align = bitsize;
6ad822cec22644 Pavitrakumar M 2024-03-05  1410  	}
6ad822cec22644 Pavitrakumar M 2024-03-05  1411  
6ad822cec22644 Pavitrakumar M 2024-03-05  1412  	return ret;
6ad822cec22644 Pavitrakumar M 2024-03-05  1413  }
6ad822cec22644 Pavitrakumar M 2024-03-05  1414
kernel test robot March 6, 2024, 6:43 a.m. UTC | #3
Hi Pavitrakumar,

kernel test robot noticed the following build warnings:

[auto build test WARNING on herbert-cryptodev-2.6/master]
[also build test WARNING on herbert-crypto-2.6/master linus/master v6.8-rc7 next-20240305]
[cannot apply to xilinx-xlnx/master]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Pavitrakumar-M/Add-SPAcc-driver-to-Linux-kernel/20240305-193337
base:   https://git.kernel.org/pub/scm/linux/kernel/git/herbert/cryptodev-2.6.git master
patch link:    https://lore.kernel.org/r/20240305112831.3380896-5-pavitrakumarm%40vayavyalabs.com
patch subject: [PATCH 4/4] Enable Driver compilation in crypto Kconfig and Makefile file
config: i386-buildonly-randconfig-004-20240306 (https://download.01.org/0day-ci/archive/20240306/202403061443.w2hFEVfJ-lkp@intel.com/config)
compiler: clang version 17.0.6 (https://github.com/llvm/llvm-project 6009708b4367171ccdbf4b5905cb6a803753fe18)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240306/202403061443.w2hFEVfJ-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202403061443.w2hFEVfJ-lkp@intel.com/

All warnings (new ones prefixed by >>):

   drivers/crypto/dwc-spacc/spacc_ahash.c:271:9: warning: variable 'sgl_buffer' is uninitialized when used here [-Wuninitialized]
     271 |                                                   sgl_buffer,
         |                                                   ^~~~~~~~~~
   drivers/crypto/dwc-spacc/spacc_ahash.c:231:18: note: initialize the variable 'sgl_buffer' to silence this warning
     231 |         char *sgl_buffer;
         |                         ^
         |                          = NULL
   drivers/crypto/dwc-spacc/spacc_ahash.c:679:18: warning: variable 'priv' is uninitialized when used here [-Wuninitialized]
     679 |                                 spacc_close(&priv->spacc, tctx->handle);
         |                                              ^~~~
   drivers/crypto/dwc-spacc/spacc_ahash.c:666:25: note: initialize the variable 'priv' to silence this warning
     666 |         struct spacc_priv *priv;
         |                                ^
         |                                 = NULL
>> drivers/crypto/dwc-spacc/spacc_ahash.c:1008:6: warning: variable 'total_len' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized]
    1008 |         if (rc < 0)
         |             ^~~~~~
   drivers/crypto/dwc-spacc/spacc_ahash.c:1057:28: note: uninitialized use occurs here
    1057 |         ctx->fb.hash_req.nbytes = total_len;
         |                                   ^~~~~~~~~
   drivers/crypto/dwc-spacc/spacc_ahash.c:1008:2: note: remove the 'if' if its condition is always false
    1008 |         if (rc < 0)
         |         ^~~~~~~~~~~
    1009 |                 goto fallback;
         |                 ~~~~~~~~~~~~~
   drivers/crypto/dwc-spacc/spacc_ahash.c:1003:6: warning: variable 'total_len' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized]
    1003 |         if (tctx->handle < 0 || !tctx->ctx_valid ||
         |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    1004 |             req->nbytes > priv->max_msg_len)
         |             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/crypto/dwc-spacc/spacc_ahash.c:1057:28: note: uninitialized use occurs here
    1057 |         ctx->fb.hash_req.nbytes = total_len;
         |                                   ^~~~~~~~~
   drivers/crypto/dwc-spacc/spacc_ahash.c:1003:2: note: remove the 'if' if its condition is always false
    1003 |         if (tctx->handle < 0 || !tctx->ctx_valid ||
         |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    1004 |             req->nbytes > priv->max_msg_len)
         |             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    1005 |                 goto fallback;
         |                 ~~~~~~~~~~~~~
>> drivers/crypto/dwc-spacc/spacc_ahash.c:1003:6: warning: variable 'total_len' is used uninitialized whenever '||' condition is true [-Wsometimes-uninitialized]
    1003 |         if (tctx->handle < 0 || !tctx->ctx_valid ||
         |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/crypto/dwc-spacc/spacc_ahash.c:1057:28: note: uninitialized use occurs here
    1057 |         ctx->fb.hash_req.nbytes = total_len;
         |                                   ^~~~~~~~~
   drivers/crypto/dwc-spacc/spacc_ahash.c:1003:6: note: remove the '||' if its condition is always false
    1003 |         if (tctx->handle < 0 || !tctx->ctx_valid ||
         |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> drivers/crypto/dwc-spacc/spacc_ahash.c:1003:6: warning: variable 'total_len' is used uninitialized whenever '||' condition is true [-Wsometimes-uninitialized]
    1003 |         if (tctx->handle < 0 || !tctx->ctx_valid ||
         |             ^~~~~~~~~~~~~~~~
   drivers/crypto/dwc-spacc/spacc_ahash.c:1057:28: note: uninitialized use occurs here
    1057 |         ctx->fb.hash_req.nbytes = total_len;
         |                                   ^~~~~~~~~
   drivers/crypto/dwc-spacc/spacc_ahash.c:1003:6: note: remove the '||' if its condition is always false
    1003 |         if (tctx->handle < 0 || !tctx->ctx_valid ||
         |             ^~~~~~~~~~~~~~~~~~~
   drivers/crypto/dwc-spacc/spacc_ahash.c:985:19: note: initialize the variable 'total_len' to silence this warning
     985 |         int rc, total_len;
         |                          ^
         |                           = 0
   6 warnings generated.
--
   drivers/crypto/dwc-spacc/spacc_skcipher.c:149:16: warning: variable 'rc' set but not used [-Wunused-but-set-variable]
     149 |         int err = -1, rc;
         |                       ^
>> drivers/crypto/dwc-spacc/spacc_skcipher.c:176:40: warning: overlapping comparisons always evaluate to true [-Wtautological-overlap-compare]
     176 |         if (ctx->mode != CRYPTO_MODE_DES_ECB  ||
         |             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~
     177 |             ctx->mode != CRYPTO_MODE_DES_CBC  ||
         |             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/crypto/dwc-spacc/spacc_skcipher.c:400:6: warning: variable 'ivsize' set but not used [-Wunused-but-set-variable]
     400 |         int ivsize;
         |             ^
   3 warnings generated.
--
   drivers/crypto/dwc-spacc/spacc_core.c:984:26: warning: unused variable 'names' [-Wunused-const-variable]
     984 | static const char *const names[] = {
         |                          ^~~~~
>> drivers/crypto/dwc-spacc/spacc_core.c:2835:56: warning: unused variable 'reg_names' [-Wunused-const-variable]
    2835 | static const struct { unsigned int addr; char *name; } reg_names[] = {
         |                                                        ^~~~~~~~~
   2 warnings generated.


vim +1008 drivers/crypto/dwc-spacc/spacc_ahash.c

6ad822cec22644 Pavitrakumar M 2024-03-05   981  
6ad822cec22644 Pavitrakumar M 2024-03-05   982  static int spacc_hash_digest(struct ahash_request *req)
6ad822cec22644 Pavitrakumar M 2024-03-05   983  {
6ad822cec22644 Pavitrakumar M 2024-03-05   984  	int final = 0;
6ad822cec22644 Pavitrakumar M 2024-03-05   985  	int rc, total_len;
6ad822cec22644 Pavitrakumar M 2024-03-05   986  	struct crypto_ahash *reqtfm = crypto_ahash_reqtfm(req);
6ad822cec22644 Pavitrakumar M 2024-03-05   987  	struct spacc_crypto_ctx *tctx = crypto_ahash_ctx(reqtfm);
6ad822cec22644 Pavitrakumar M 2024-03-05   988  	struct spacc_crypto_reqctx *ctx = ahash_request_ctx(req);
6ad822cec22644 Pavitrakumar M 2024-03-05   989  	struct spacc_priv *priv = dev_get_drvdata(tctx->dev);
6ad822cec22644 Pavitrakumar M 2024-03-05   990  
6ad822cec22644 Pavitrakumar M 2024-03-05   991  	if (tctx->flag_ppp) {
6ad822cec22644 Pavitrakumar M 2024-03-05   992  		/* from finup */
6ad822cec22644 Pavitrakumar M 2024-03-05   993  		ctx->single_shot = 0;
6ad822cec22644 Pavitrakumar M 2024-03-05   994  		ctx->final_part_pck = 1;
6ad822cec22644 Pavitrakumar M 2024-03-05   995  		final = 2;
6ad822cec22644 Pavitrakumar M 2024-03-05   996  	} else {
6ad822cec22644 Pavitrakumar M 2024-03-05   997  		/* direct single shot digest call */
6ad822cec22644 Pavitrakumar M 2024-03-05   998  		ctx->single_shot = 1;
6ad822cec22644 Pavitrakumar M 2024-03-05   999  		ctx->rem_len = 0;
6ad822cec22644 Pavitrakumar M 2024-03-05  1000  		ctx->total_nents = sg_nents(req->src);
6ad822cec22644 Pavitrakumar M 2024-03-05  1001  	}
6ad822cec22644 Pavitrakumar M 2024-03-05  1002  
6ad822cec22644 Pavitrakumar M 2024-03-05 @1003  	if (tctx->handle < 0 || !tctx->ctx_valid ||
6ad822cec22644 Pavitrakumar M 2024-03-05  1004  	    req->nbytes > priv->max_msg_len)
6ad822cec22644 Pavitrakumar M 2024-03-05  1005  		goto fallback;
6ad822cec22644 Pavitrakumar M 2024-03-05  1006  
6ad822cec22644 Pavitrakumar M 2024-03-05  1007  	rc = spacc_hash_init_dma(tctx->dev, req, final);
6ad822cec22644 Pavitrakumar M 2024-03-05 @1008  	if (rc < 0)
6ad822cec22644 Pavitrakumar M 2024-03-05  1009  		goto fallback;
6ad822cec22644 Pavitrakumar M 2024-03-05  1010  
6ad822cec22644 Pavitrakumar M 2024-03-05  1011  	if (rc == 0)
6ad822cec22644 Pavitrakumar M 2024-03-05  1012  		return 0;
6ad822cec22644 Pavitrakumar M 2024-03-05  1013  
6ad822cec22644 Pavitrakumar M 2024-03-05  1014  	if (final) {
6ad822cec22644 Pavitrakumar M 2024-03-05  1015  		if (ctx->total_nents) {
6ad822cec22644 Pavitrakumar M 2024-03-05  1016  			/* INIT-UPDATE-UPDATE-FINUP/FINAL */
6ad822cec22644 Pavitrakumar M 2024-03-05  1017  			total_len = tctx->ppp_sgl[0].length;
6ad822cec22644 Pavitrakumar M 2024-03-05  1018  		} else if (req->src->length == 0 && ctx->total_nents == 0) {
6ad822cec22644 Pavitrakumar M 2024-03-05  1019  			/* zero msg handling */
6ad822cec22644 Pavitrakumar M 2024-03-05  1020  			total_len = 0;
6ad822cec22644 Pavitrakumar M 2024-03-05  1021  		} else {
6ad822cec22644 Pavitrakumar M 2024-03-05  1022  			/* handle INIT-FINUP sequence, process req->nbytes */
6ad822cec22644 Pavitrakumar M 2024-03-05  1023  			total_len = req->nbytes;
6ad822cec22644 Pavitrakumar M 2024-03-05  1024  		}
6ad822cec22644 Pavitrakumar M 2024-03-05  1025  
6ad822cec22644 Pavitrakumar M 2024-03-05  1026  		rc = spacc_packet_enqueue_ddt(&priv->spacc, ctx->acb.new_handle,
6ad822cec22644 Pavitrakumar M 2024-03-05  1027  				&ctx->src, &ctx->dst, total_len,
6ad822cec22644 Pavitrakumar M 2024-03-05  1028  				0, total_len, 0, 0, 0);
6ad822cec22644 Pavitrakumar M 2024-03-05  1029  	} else {
6ad822cec22644 Pavitrakumar M 2024-03-05  1030  		rc = spacc_packet_enqueue_ddt(&priv->spacc, ctx->acb.new_handle,
6ad822cec22644 Pavitrakumar M 2024-03-05  1031  				&ctx->src, &ctx->dst, req->nbytes,
6ad822cec22644 Pavitrakumar M 2024-03-05  1032  				0, req->nbytes, 0, 0, 0);
6ad822cec22644 Pavitrakumar M 2024-03-05  1033  	}
6ad822cec22644 Pavitrakumar M 2024-03-05  1034  
6ad822cec22644 Pavitrakumar M 2024-03-05  1035  	if (rc < 0) {
6ad822cec22644 Pavitrakumar M 2024-03-05  1036  		spacc_hash_cleanup_dma(tctx->dev, req);
6ad822cec22644 Pavitrakumar M 2024-03-05  1037  		spacc_close(&priv->spacc, ctx->acb.new_handle);
6ad822cec22644 Pavitrakumar M 2024-03-05  1038  
6ad822cec22644 Pavitrakumar M 2024-03-05  1039  		if (rc != -EBUSY) {
6ad822cec22644 Pavitrakumar M 2024-03-05  1040  			pr_debug("Failed to enqueue job, ERR: %d\n", rc);
6ad822cec22644 Pavitrakumar M 2024-03-05  1041  			return rc;
6ad822cec22644 Pavitrakumar M 2024-03-05  1042  		}
6ad822cec22644 Pavitrakumar M 2024-03-05  1043  
6ad822cec22644 Pavitrakumar M 2024-03-05  1044  		if (!(req->base.flags & CRYPTO_TFM_REQ_MAY_BACKLOG))
6ad822cec22644 Pavitrakumar M 2024-03-05  1045  			return -EBUSY;
6ad822cec22644 Pavitrakumar M 2024-03-05  1046  
6ad822cec22644 Pavitrakumar M 2024-03-05  1047  		goto fallback;
6ad822cec22644 Pavitrakumar M 2024-03-05  1048  	}
6ad822cec22644 Pavitrakumar M 2024-03-05  1049  
6ad822cec22644 Pavitrakumar M 2024-03-05  1050  	return -EINPROGRESS;
6ad822cec22644 Pavitrakumar M 2024-03-05  1051  
6ad822cec22644 Pavitrakumar M 2024-03-05  1052  fallback:
6ad822cec22644 Pavitrakumar M 2024-03-05  1053  	/* Start from scratch as init is not called before digest */
6ad822cec22644 Pavitrakumar M 2024-03-05  1054  	ctx->fb.hash_req.base = req->base;
6ad822cec22644 Pavitrakumar M 2024-03-05  1055  	ahash_request_set_tfm(&ctx->fb.hash_req, tctx->fb.hash);
6ad822cec22644 Pavitrakumar M 2024-03-05  1056  
6ad822cec22644 Pavitrakumar M 2024-03-05  1057  	ctx->fb.hash_req.nbytes = total_len;
6ad822cec22644 Pavitrakumar M 2024-03-05  1058  	ctx->fb.hash_req.src = req->src;
6ad822cec22644 Pavitrakumar M 2024-03-05  1059  	ctx->fb.hash_req.result = req->result;
6ad822cec22644 Pavitrakumar M 2024-03-05  1060  
6ad822cec22644 Pavitrakumar M 2024-03-05  1061  	return crypto_ahash_digest(&ctx->fb.hash_req);
6ad822cec22644 Pavitrakumar M 2024-03-05  1062  }
6ad822cec22644 Pavitrakumar M 2024-03-05  1063
kernel test robot March 6, 2024, 7:26 a.m. UTC | #4
Hi Pavitrakumar,

kernel test robot noticed the following build warnings:

[auto build test WARNING on herbert-cryptodev-2.6/master]
[also build test WARNING on herbert-crypto-2.6/master linus/master v6.8-rc7 next-20240305]
[cannot apply to xilinx-xlnx/master]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Pavitrakumar-M/Add-SPAcc-driver-to-Linux-kernel/20240305-193337
base:   https://git.kernel.org/pub/scm/linux/kernel/git/herbert/cryptodev-2.6.git master
patch link:    https://lore.kernel.org/r/20240305112831.3380896-5-pavitrakumarm%40vayavyalabs.com
patch subject: [PATCH 4/4] Enable Driver compilation in crypto Kconfig and Makefile file
config: x86_64-randconfig-122-20240306 (https://download.01.org/0day-ci/archive/20240306/202403061522.phoAmD4a-lkp@intel.com/config)
compiler: gcc-12 (Debian 12.2.0-14) 12.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240306/202403061522.phoAmD4a-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202403061522.phoAmD4a-lkp@intel.com/

sparse warnings: (new ones prefixed by >>)
>> drivers/crypto/dwc-spacc/spacc_interrupt.c:17:36: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void const volatile [noderef] __iomem *addr @@     got void * @@
   drivers/crypto/dwc-spacc/spacc_interrupt.c:17:36: sparse:     expected void const volatile [noderef] __iomem *addr
   drivers/crypto/dwc-spacc/spacc_interrupt.c:17:36: sparse:     got void *
>> drivers/crypto/dwc-spacc/spacc_interrupt.c:21:17: sparse: sparse: incorrect type in argument 2 (different address spaces) @@     expected void volatile [noderef] __iomem *addr @@     got void * @@
   drivers/crypto/dwc-spacc/spacc_interrupt.c:21:17: sparse:     expected void volatile [noderef] __iomem *addr
   drivers/crypto/dwc-spacc/spacc_interrupt.c:21:17: sparse:     got void *
   drivers/crypto/dwc-spacc/spacc_interrupt.c:46:63: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void const volatile [noderef] __iomem *addr @@     got void * @@
   drivers/crypto/dwc-spacc/spacc_interrupt.c:46:63: sparse:     expected void const volatile [noderef] __iomem *addr
   drivers/crypto/dwc-spacc/spacc_interrupt.c:46:63: sparse:     got void *
   drivers/crypto/dwc-spacc/spacc_interrupt.c:54:63: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void const volatile [noderef] __iomem *addr @@     got void * @@
   drivers/crypto/dwc-spacc/spacc_interrupt.c:54:63: sparse:     expected void const volatile [noderef] __iomem *addr
   drivers/crypto/dwc-spacc/spacc_interrupt.c:54:63: sparse:     got void *
   drivers/crypto/dwc-spacc/spacc_interrupt.c:65:25: sparse: sparse: incorrect type in argument 2 (different address spaces) @@     expected void volatile [noderef] __iomem *addr @@     got void * @@
   drivers/crypto/dwc-spacc/spacc_interrupt.c:65:25: sparse:     expected void volatile [noderef] __iomem *addr
   drivers/crypto/dwc-spacc/spacc_interrupt.c:65:25: sparse:     got void *
   drivers/crypto/dwc-spacc/spacc_interrupt.c:82:33: sparse: sparse: incorrect type in argument 2 (different address spaces) @@     expected void volatile [noderef] __iomem *addr @@     got void * @@
   drivers/crypto/dwc-spacc/spacc_interrupt.c:82:33: sparse:     expected void volatile [noderef] __iomem *addr
   drivers/crypto/dwc-spacc/spacc_interrupt.c:82:33: sparse:     got void *
   drivers/crypto/dwc-spacc/spacc_interrupt.c:97:35: sparse: sparse: incorrect type in argument 2 (different address spaces) @@     expected void volatile [noderef] __iomem *addr @@     got void * @@
   drivers/crypto/dwc-spacc/spacc_interrupt.c:97:35: sparse:     expected void volatile [noderef] __iomem *addr
   drivers/crypto/dwc-spacc/spacc_interrupt.c:97:35: sparse:     got void *
   drivers/crypto/dwc-spacc/spacc_interrupt.c:108:36: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void const volatile [noderef] __iomem *addr @@     got void * @@
   drivers/crypto/dwc-spacc/spacc_interrupt.c:108:36: sparse:     expected void const volatile [noderef] __iomem *addr
   drivers/crypto/dwc-spacc/spacc_interrupt.c:108:36: sparse:     got void *
   drivers/crypto/dwc-spacc/spacc_interrupt.c:112:39: sparse: sparse: incorrect type in argument 2 (different address spaces) @@     expected void volatile [noderef] __iomem *addr @@     got void * @@
   drivers/crypto/dwc-spacc/spacc_interrupt.c:112:39: sparse:     expected void volatile [noderef] __iomem *addr
   drivers/crypto/dwc-spacc/spacc_interrupt.c:112:39: sparse:     got void *
   drivers/crypto/dwc-spacc/spacc_interrupt.c:114:36: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void const volatile [noderef] __iomem *addr @@     got void * @@
   drivers/crypto/dwc-spacc/spacc_interrupt.c:114:36: sparse:     expected void const volatile [noderef] __iomem *addr
   drivers/crypto/dwc-spacc/spacc_interrupt.c:114:36: sparse:     got void *
   drivers/crypto/dwc-spacc/spacc_interrupt.c:116:47: sparse: sparse: incorrect type in argument 2 (different address spaces) @@     expected void volatile [noderef] __iomem *addr @@     got void * @@
   drivers/crypto/dwc-spacc/spacc_interrupt.c:116:47: sparse:     expected void volatile [noderef] __iomem *addr
   drivers/crypto/dwc-spacc/spacc_interrupt.c:116:47: sparse:     got void *
   drivers/crypto/dwc-spacc/spacc_interrupt.c:121:36: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void const volatile [noderef] __iomem *addr @@     got void * @@
   drivers/crypto/dwc-spacc/spacc_interrupt.c:121:36: sparse:     expected void const volatile [noderef] __iomem *addr
   drivers/crypto/dwc-spacc/spacc_interrupt.c:121:36: sparse:     got void *
   drivers/crypto/dwc-spacc/spacc_interrupt.c:123:39: sparse: sparse: incorrect type in argument 2 (different address spaces) @@     expected void volatile [noderef] __iomem *addr @@     got void * @@
   drivers/crypto/dwc-spacc/spacc_interrupt.c:123:39: sparse:     expected void volatile [noderef] __iomem *addr
   drivers/crypto/dwc-spacc/spacc_interrupt.c:123:39: sparse:     got void *
   drivers/crypto/dwc-spacc/spacc_interrupt.c:130:36: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void const volatile [noderef] __iomem *addr @@     got void * @@
   drivers/crypto/dwc-spacc/spacc_interrupt.c:130:36: sparse:     expected void const volatile [noderef] __iomem *addr
   drivers/crypto/dwc-spacc/spacc_interrupt.c:130:36: sparse:     got void *
   drivers/crypto/dwc-spacc/spacc_interrupt.c:139:36: sparse: sparse: incorrect type in argument 2 (different address spaces) @@     expected void volatile [noderef] __iomem *addr @@     got void * @@
   drivers/crypto/dwc-spacc/spacc_interrupt.c:139:36: sparse:     expected void volatile [noderef] __iomem *addr
   drivers/crypto/dwc-spacc/spacc_interrupt.c:139:36: sparse:     got void *
   drivers/crypto/dwc-spacc/spacc_interrupt.c:140:36: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void const volatile [noderef] __iomem *addr @@     got void * @@
   drivers/crypto/dwc-spacc/spacc_interrupt.c:140:36: sparse:     expected void const volatile [noderef] __iomem *addr
   drivers/crypto/dwc-spacc/spacc_interrupt.c:140:36: sparse:     got void *
   drivers/crypto/dwc-spacc/spacc_interrupt.c:142:47: sparse: sparse: incorrect type in argument 2 (different address spaces) @@     expected void volatile [noderef] __iomem *addr @@     got void * @@
   drivers/crypto/dwc-spacc/spacc_interrupt.c:142:47: sparse:     expected void volatile [noderef] __iomem *addr
   drivers/crypto/dwc-spacc/spacc_interrupt.c:142:47: sparse:     got void *
   drivers/crypto/dwc-spacc/spacc_interrupt.c:147:36: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void const volatile [noderef] __iomem *addr @@     got void * @@
   drivers/crypto/dwc-spacc/spacc_interrupt.c:147:36: sparse:     expected void const volatile [noderef] __iomem *addr
   drivers/crypto/dwc-spacc/spacc_interrupt.c:147:36: sparse:     got void *
   drivers/crypto/dwc-spacc/spacc_interrupt.c:149:47: sparse: sparse: incorrect type in argument 2 (different address spaces) @@     expected void volatile [noderef] __iomem *addr @@     got void * @@
   drivers/crypto/dwc-spacc/spacc_interrupt.c:149:47: sparse:     expected void volatile [noderef] __iomem *addr
   drivers/crypto/dwc-spacc/spacc_interrupt.c:149:47: sparse:     got void *
   drivers/crypto/dwc-spacc/spacc_interrupt.c:154:36: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void const volatile [noderef] __iomem *addr @@     got void * @@
   drivers/crypto/dwc-spacc/spacc_interrupt.c:154:36: sparse:     expected void const volatile [noderef] __iomem *addr
   drivers/crypto/dwc-spacc/spacc_interrupt.c:154:36: sparse:     got void *
   drivers/crypto/dwc-spacc/spacc_interrupt.c:156:47: sparse: sparse: incorrect type in argument 2 (different address spaces) @@     expected void volatile [noderef] __iomem *addr @@     got void * @@
   drivers/crypto/dwc-spacc/spacc_interrupt.c:156:47: sparse:     expected void volatile [noderef] __iomem *addr
   drivers/crypto/dwc-spacc/spacc_interrupt.c:156:47: sparse:     got void *
   drivers/crypto/dwc-spacc/spacc_interrupt.c:161:36: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void const volatile [noderef] __iomem *addr @@     got void * @@
   drivers/crypto/dwc-spacc/spacc_interrupt.c:161:36: sparse:     expected void const volatile [noderef] __iomem *addr
   drivers/crypto/dwc-spacc/spacc_interrupt.c:161:36: sparse:     got void *
   drivers/crypto/dwc-spacc/spacc_interrupt.c:163:47: sparse: sparse: incorrect type in argument 2 (different address spaces) @@     expected void volatile [noderef] __iomem *addr @@     got void * @@
   drivers/crypto/dwc-spacc/spacc_interrupt.c:163:47: sparse:     expected void volatile [noderef] __iomem *addr
   drivers/crypto/dwc-spacc/spacc_interrupt.c:163:47: sparse:     got void *
   drivers/crypto/dwc-spacc/spacc_interrupt.c:168:36: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void const volatile [noderef] __iomem *addr @@     got void * @@
   drivers/crypto/dwc-spacc/spacc_interrupt.c:168:36: sparse:     expected void const volatile [noderef] __iomem *addr
   drivers/crypto/dwc-spacc/spacc_interrupt.c:168:36: sparse:     got void *
   drivers/crypto/dwc-spacc/spacc_interrupt.c:170:47: sparse: sparse: incorrect type in argument 2 (different address spaces) @@     expected void volatile [noderef] __iomem *addr @@     got void * @@
   drivers/crypto/dwc-spacc/spacc_interrupt.c:170:47: sparse:     expected void volatile [noderef] __iomem *addr
   drivers/crypto/dwc-spacc/spacc_interrupt.c:170:47: sparse:     got void *
   drivers/crypto/dwc-spacc/spacc_interrupt.c:175:36: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void const volatile [noderef] __iomem *addr @@     got void * @@
   drivers/crypto/dwc-spacc/spacc_interrupt.c:175:36: sparse:     expected void const volatile [noderef] __iomem *addr
   drivers/crypto/dwc-spacc/spacc_interrupt.c:175:36: sparse:     got void *
   drivers/crypto/dwc-spacc/spacc_interrupt.c:177:47: sparse: sparse: incorrect type in argument 2 (different address spaces) @@     expected void volatile [noderef] __iomem *addr @@     got void * @@
   drivers/crypto/dwc-spacc/spacc_interrupt.c:177:47: sparse:     expected void volatile [noderef] __iomem *addr
   drivers/crypto/dwc-spacc/spacc_interrupt.c:177:47: sparse:     got void *
   drivers/crypto/dwc-spacc/spacc_interrupt.c:182:33: sparse: sparse: incorrect type in argument 2 (different address spaces) @@     expected void volatile [noderef] __iomem *addr @@     got void * @@
   drivers/crypto/dwc-spacc/spacc_interrupt.c:182:33: sparse:     expected void volatile [noderef] __iomem *addr
   drivers/crypto/dwc-spacc/spacc_interrupt.c:182:33: sparse:     got void *
>> drivers/crypto/dwc-spacc/spacc_interrupt.c:180:6: sparse: sparse: symbol 'spacc_disable_int' was not declared. Should it be static?
--
>> drivers/crypto/dwc-spacc/spacc_device.c:106:18: sparse: sparse: incorrect type in assignment (different address spaces) @@     expected void *baseaddr @@     got void [noderef] __iomem * @@
   drivers/crypto/dwc-spacc/spacc_device.c:106:18: sparse:     expected void *baseaddr
   drivers/crypto/dwc-spacc/spacc_device.c:106:18: sparse:     got void [noderef] __iomem *
>> drivers/crypto/dwc-spacc/spacc_device.c:227:36: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void const volatile [noderef] __iomem *addr @@     got void * @@
   drivers/crypto/dwc-spacc/spacc_device.c:227:36: sparse:     expected void const volatile [noderef] __iomem *addr
   drivers/crypto/dwc-spacc/spacc_device.c:227:36: sparse:     got void *
>> drivers/crypto/dwc-spacc/spacc_device.c:229:36: sparse: sparse: incorrect type in argument 2 (different address spaces) @@     expected void volatile [noderef] __iomem *addr @@     got void * @@
   drivers/crypto/dwc-spacc/spacc_device.c:229:36: sparse:     expected void volatile [noderef] __iomem *addr
   drivers/crypto/dwc-spacc/spacc_device.c:229:36: sparse:     got void *
   drivers/crypto/dwc-spacc/spacc_device.c:233:28: sparse: sparse: incorrect type in argument 2 (different address spaces) @@     expected void volatile [noderef] __iomem *addr @@     got void * @@
   drivers/crypto/dwc-spacc/spacc_device.c:233:28: sparse:     expected void volatile [noderef] __iomem *addr
   drivers/crypto/dwc-spacc/spacc_device.c:233:28: sparse:     got void *
--
>> drivers/crypto/dwc-spacc/spacc_skcipher.c:15:17: sparse: sparse: symbol 'possible_ciphers' was not declared. Should it be static?
>> drivers/crypto/dwc-spacc/spacc_skcipher.c:153:50: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void const volatile [noderef] __iomem *addr @@     got void * @@
   drivers/crypto/dwc-spacc/spacc_skcipher.c:153:50: sparse:     expected void const volatile [noderef] __iomem *addr
   drivers/crypto/dwc-spacc/spacc_skcipher.c:153:50: sparse:     got void *
   drivers/crypto/dwc-spacc/spacc_skcipher.c:477:44: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void const volatile [noderef] __iomem *addr @@     got void * @@
   drivers/crypto/dwc-spacc/spacc_skcipher.c:477:44: sparse:     expected void const volatile [noderef] __iomem *addr
   drivers/crypto/dwc-spacc/spacc_skcipher.c:477:44: sparse:     got void *
   drivers/crypto/dwc-spacc/spacc_skcipher.c:492:51: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void const volatile [noderef] __iomem *addr @@     got void * @@
   drivers/crypto/dwc-spacc/spacc_skcipher.c:492:51: sparse:     expected void const volatile [noderef] __iomem *addr
   drivers/crypto/dwc-spacc/spacc_skcipher.c:492:51: sparse:     got void *
   drivers/crypto/dwc-spacc/spacc_skcipher.c:509:51: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void const volatile [noderef] __iomem *addr @@     got void * @@
   drivers/crypto/dwc-spacc/spacc_skcipher.c:509:51: sparse:     expected void const volatile [noderef] __iomem *addr
   drivers/crypto/dwc-spacc/spacc_skcipher.c:509:51: sparse:     got void *
   drivers/crypto/dwc-spacc/spacc_skcipher.c:526:51: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void const volatile [noderef] __iomem *addr @@     got void * @@
   drivers/crypto/dwc-spacc/spacc_skcipher.c:526:51: sparse:     expected void const volatile [noderef] __iomem *addr
   drivers/crypto/dwc-spacc/spacc_skcipher.c:526:51: sparse:     got void *
>> drivers/crypto/dwc-spacc/spacc_skcipher.c:651:21: sparse: sparse: symbol 'spacc_skcipher_alg' was not declared. Should it be static?
   drivers/crypto/dwc-spacc/spacc_skcipher.c: note: in included file (through include/linux/smp.h, include/linux/lockdep.h, include/linux/spinlock.h, ...):
   include/linux/list.h:83:21: sparse: sparse: self-comparison always evaluates to true
--
>> drivers/crypto/dwc-spacc/spacc_aead.c:522:50: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void const volatile [noderef] __iomem *addr @@     got void * @@
   drivers/crypto/dwc-spacc/spacc_aead.c:522:50: sparse:     expected void const volatile [noderef] __iomem *addr
   drivers/crypto/dwc-spacc/spacc_aead.c:522:50: sparse:     got void *
>> drivers/crypto/dwc-spacc/spacc_aead.c:1246:17: sparse: sparse: symbol 'spacc_aead_algs' was not declared. Should it be static?
   drivers/crypto/dwc-spacc/spacc_aead.c: note: in included file (through include/linux/swait.h, include/linux/completion.h, include/linux/crypto.h, ...):
   include/linux/list.h:83:21: sparse: sparse: self-comparison always evaluates to true
--
>> drivers/crypto/dwc-spacc/spacc_ahash.c:1106:24: sparse: sparse: symbol 'spacc_hash_template' was not declared. Should it be static?
   drivers/crypto/dwc-spacc/spacc_ahash.c: note: in included file (through include/linux/swait.h, include/linux/completion.h, include/linux/crypto.h, ...):
   include/linux/list.h:83:21: sparse: sparse: self-comparison always evaluates to true
   include/linux/list.h:83:21: sparse: sparse: self-comparison always evaluates to true
--
>> drivers/crypto/dwc-spacc/spacc_hal.c:25:25: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void const volatile [noderef] __iomem *addr @@     got void * @@
   drivers/crypto/dwc-spacc/spacc_hal.c:25:25: sparse:     expected void const volatile [noderef] __iomem *addr
   drivers/crypto/dwc-spacc/spacc_hal.c:25:25: sparse:     got void *
>> drivers/crypto/dwc-spacc/spacc_hal.c:46:32: sparse: sparse: incorrect type in argument 2 (different address spaces) @@     expected void volatile [noderef] __iomem *addr @@     got void * @@
   drivers/crypto/dwc-spacc/spacc_hal.c:46:32: sparse:     expected void volatile [noderef] __iomem *addr
   drivers/crypto/dwc-spacc/spacc_hal.c:46:32: sparse:     got void *
   drivers/crypto/dwc-spacc/spacc_hal.c:48:23: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void const volatile [noderef] __iomem *addr @@     got void * @@
   drivers/crypto/dwc-spacc/spacc_hal.c:48:23: sparse:     expected void const volatile [noderef] __iomem *addr
   drivers/crypto/dwc-spacc/spacc_hal.c:48:23: sparse:     got void *
   drivers/crypto/dwc-spacc/spacc_hal.c:57:25: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void const volatile [noderef] __iomem *addr @@     got void * @@
   drivers/crypto/dwc-spacc/spacc_hal.c:57:25: sparse:     expected void const volatile [noderef] __iomem *addr
   drivers/crypto/dwc-spacc/spacc_hal.c:57:25: sparse:     got void *
   drivers/crypto/dwc-spacc/spacc_hal.c:66:25: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void const volatile [noderef] __iomem *addr @@     got void * @@
   drivers/crypto/dwc-spacc/spacc_hal.c:66:25: sparse:     expected void const volatile [noderef] __iomem *addr
   drivers/crypto/dwc-spacc/spacc_hal.c:66:25: sparse:     got void *
   drivers/crypto/dwc-spacc/spacc_hal.c:86:33: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void const volatile [noderef] __iomem *addr @@     got void * @@
   drivers/crypto/dwc-spacc/spacc_hal.c:86:33: sparse:     expected void const volatile [noderef] __iomem *addr
   drivers/crypto/dwc-spacc/spacc_hal.c:86:33: sparse:     got void *
   drivers/crypto/dwc-spacc/spacc_hal.c:92:31: sparse: sparse: incorrect type in argument 2 (different address spaces) @@     expected void volatile [noderef] __iomem *addr @@     got void * @@
   drivers/crypto/dwc-spacc/spacc_hal.c:92:31: sparse:     expected void volatile [noderef] __iomem *addr
   drivers/crypto/dwc-spacc/spacc_hal.c:92:31: sparse:     got void *
>> drivers/crypto/dwc-spacc/spacc_hal.c:103:32: sparse: sparse: incorrect type in argument 2 (different address spaces) @@     expected void volatile [noderef] __iomem *addr @@     got unsigned char *addr @@
   drivers/crypto/dwc-spacc/spacc_hal.c:103:32: sparse:     expected void volatile [noderef] __iomem *addr
   drivers/crypto/dwc-spacc/spacc_hal.c:103:32: sparse:     got unsigned char *addr
>> drivers/crypto/dwc-spacc/spacc_hal.c:113:32: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void const volatile [noderef] __iomem *addr @@     got unsigned char *addr @@
   drivers/crypto/dwc-spacc/spacc_hal.c:113:32: sparse:     expected void const volatile [noderef] __iomem *addr
   drivers/crypto/dwc-spacc/spacc_hal.c:113:32: sparse:     got unsigned char *addr
   drivers/crypto/dwc-spacc/spacc_hal.c:130:27: sparse: sparse: incorrect type in argument 2 (different address spaces) @@     expected void volatile [noderef] __iomem *addr @@     got unsigned char *addr @@
   drivers/crypto/dwc-spacc/spacc_hal.c:130:27: sparse:     expected void volatile [noderef] __iomem *addr
   drivers/crypto/dwc-spacc/spacc_hal.c:130:27: sparse:     got unsigned char *addr
   drivers/crypto/dwc-spacc/spacc_hal.c:142:27: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void const volatile [noderef] __iomem *addr @@     got unsigned char *addr @@
   drivers/crypto/dwc-spacc/spacc_hal.c:142:27: sparse:     expected void const volatile [noderef] __iomem *addr
   drivers/crypto/dwc-spacc/spacc_hal.c:142:27: sparse:     got unsigned char *addr
   drivers/crypto/dwc-spacc/spacc_hal.c:163:27: sparse: sparse: incorrect type in argument 2 (different address spaces) @@     expected void volatile [noderef] __iomem *addr @@     got unsigned char *addr @@
   drivers/crypto/dwc-spacc/spacc_hal.c:163:27: sparse:     expected void volatile [noderef] __iomem *addr
   drivers/crypto/dwc-spacc/spacc_hal.c:163:27: sparse:     got unsigned char *addr
   drivers/crypto/dwc-spacc/spacc_hal.c:175:27: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void const volatile [noderef] __iomem *addr @@     got unsigned char *addr @@
   drivers/crypto/dwc-spacc/spacc_hal.c:175:27: sparse:     expected void const volatile [noderef] __iomem *addr
   drivers/crypto/dwc-spacc/spacc_hal.c:175:27: sparse:     got unsigned char *addr
>> drivers/crypto/dwc-spacc/spacc_hal.c:212:21: sparse: sparse: incorrect type in argument 2 (different address spaces) @@     expected void volatile [noderef] __iomem *addr @@     got void *addr @@
   drivers/crypto/dwc-spacc/spacc_hal.c:212:21: sparse:     expected void volatile [noderef] __iomem *addr
   drivers/crypto/dwc-spacc/spacc_hal.c:212:21: sparse:     got void *addr

vim +17 drivers/crypto/dwc-spacc/spacc_interrupt.c

6ad822cec22644 Pavitrakumar M 2024-03-05    8  
6ad822cec22644 Pavitrakumar M 2024-03-05    9  uint32_t spacc_process_irq(struct spacc_device *spacc)
6ad822cec22644 Pavitrakumar M 2024-03-05   10  {
6ad822cec22644 Pavitrakumar M 2024-03-05   11  	u32 temp, tempreg;
6ad822cec22644 Pavitrakumar M 2024-03-05   12  	int x, cmd_max;
6ad822cec22644 Pavitrakumar M 2024-03-05   13  	unsigned long lock_flag;
6ad822cec22644 Pavitrakumar M 2024-03-05   14  
6ad822cec22644 Pavitrakumar M 2024-03-05   15  	spin_lock_irqsave(&spacc->lock, lock_flag);
6ad822cec22644 Pavitrakumar M 2024-03-05   16  
6ad822cec22644 Pavitrakumar M 2024-03-05  @17  	temp = readl(spacc->regmap + SPACC_REG_IRQ_STAT);
6ad822cec22644 Pavitrakumar M 2024-03-05   18  
6ad822cec22644 Pavitrakumar M 2024-03-05   19  	/* clear interrupt pin and run registered callback */
6ad822cec22644 Pavitrakumar M 2024-03-05   20  	if (temp & SPACC_IRQ_STAT_STAT) {
6ad822cec22644 Pavitrakumar M 2024-03-05  @21  		SPACC_IRQ_STAT_CLEAR_STAT(spacc);
6ad822cec22644 Pavitrakumar M 2024-03-05   22  		if (spacc->op_mode == SPACC_OP_MODE_IRQ) {
6ad822cec22644 Pavitrakumar M 2024-03-05   23  			spacc->config.fifo_cnt <<= 2;
6ad822cec22644 Pavitrakumar M 2024-03-05   24  			if (spacc->config.fifo_cnt >=
6ad822cec22644 Pavitrakumar M 2024-03-05   25  					spacc->config.stat_fifo_depth)
6ad822cec22644 Pavitrakumar M 2024-03-05   26  				spacc->config.fifo_cnt =
6ad822cec22644 Pavitrakumar M 2024-03-05   27  					spacc->config.stat_fifo_depth;
6ad822cec22644 Pavitrakumar M 2024-03-05   28  
6ad822cec22644 Pavitrakumar M 2024-03-05   29  			/* update fifo count to allow more stati to pile up*/
6ad822cec22644 Pavitrakumar M 2024-03-05   30  			spacc_irq_stat_enable(spacc, spacc->config.fifo_cnt);
6ad822cec22644 Pavitrakumar M 2024-03-05   31  			 /* reenable CMD0 empty interrupt*/
6ad822cec22644 Pavitrakumar M 2024-03-05   32  			spacc_irq_cmdx_enable(spacc, 0, 0);
6ad822cec22644 Pavitrakumar M 2024-03-05   33  		} else if (spacc->op_mode == SPACC_OP_MODE_WD) {
6ad822cec22644 Pavitrakumar M 2024-03-05   34  		}
6ad822cec22644 Pavitrakumar M 2024-03-05   35  		if (spacc->irq_cb_stat)
6ad822cec22644 Pavitrakumar M 2024-03-05   36  			spacc->irq_cb_stat(spacc);
6ad822cec22644 Pavitrakumar M 2024-03-05   37  	}
6ad822cec22644 Pavitrakumar M 2024-03-05   38  
6ad822cec22644 Pavitrakumar M 2024-03-05   39  	/* Watchdog IRQ */
6ad822cec22644 Pavitrakumar M 2024-03-05   40  	if (spacc->op_mode == SPACC_OP_MODE_WD) {
6ad822cec22644 Pavitrakumar M 2024-03-05   41  		if (temp & SPACC_IRQ_STAT_STAT_WD) {
6ad822cec22644 Pavitrakumar M 2024-03-05   42  			if (++spacc->wdcnt == SPACC_WD_LIMIT) {
6ad822cec22644 Pavitrakumar M 2024-03-05   43  				/* this happens when you get too many IRQs that
6ad822cec22644 Pavitrakumar M 2024-03-05   44  				 *  go unanswered
6ad822cec22644 Pavitrakumar M 2024-03-05   45  				 */
6ad822cec22644 Pavitrakumar M 2024-03-05   46  				tempreg = readl(spacc->regmap +
6ad822cec22644 Pavitrakumar M 2024-03-05   47  							SPACC_REG_IRQ_EN);
6ad822cec22644 Pavitrakumar M 2024-03-05   48  				spacc_irq_stat_wd_disable(spacc);
6ad822cec22644 Pavitrakumar M 2024-03-05   49  				 /* we set the STAT CNT to 1 so that every job
6ad822cec22644 Pavitrakumar M 2024-03-05   50  				  * generates an IRQ now
6ad822cec22644 Pavitrakumar M 2024-03-05   51  				  */
6ad822cec22644 Pavitrakumar M 2024-03-05   52  				spacc_irq_stat_enable(spacc, 1);
6ad822cec22644 Pavitrakumar M 2024-03-05   53  				spacc->op_mode = SPACC_OP_MODE_IRQ;
6ad822cec22644 Pavitrakumar M 2024-03-05   54  				tempreg = readl(spacc->regmap +
6ad822cec22644 Pavitrakumar M 2024-03-05   55  							SPACC_REG_IRQ_EN);
6ad822cec22644 Pavitrakumar M 2024-03-05   56  			} else if (spacc->config.wd_timer < (0xFFFFFFUL >> 4)) {
6ad822cec22644 Pavitrakumar M 2024-03-05   57  				/* if the timer isn't too high lets bump it up
6ad822cec22644 Pavitrakumar M 2024-03-05   58  				 * a bit so as to give the IRQ a chance to
6ad822cec22644 Pavitrakumar M 2024-03-05   59  				 * reply
6ad822cec22644 Pavitrakumar M 2024-03-05   60  				 */
6ad822cec22644 Pavitrakumar M 2024-03-05   61  				spacc_set_wd_count(spacc,
6ad822cec22644 Pavitrakumar M 2024-03-05   62  						   spacc->config.wd_timer << 4);
6ad822cec22644 Pavitrakumar M 2024-03-05   63  			}
6ad822cec22644 Pavitrakumar M 2024-03-05   64  
6ad822cec22644 Pavitrakumar M 2024-03-05   65  			SPACC_IRQ_STAT_CLEAR_STAT_WD(spacc);
6ad822cec22644 Pavitrakumar M 2024-03-05   66  			if (spacc->irq_cb_stat_wd)
6ad822cec22644 Pavitrakumar M 2024-03-05   67  				spacc->irq_cb_stat_wd(spacc);
6ad822cec22644 Pavitrakumar M 2024-03-05   68  		}
6ad822cec22644 Pavitrakumar M 2024-03-05   69  	}
6ad822cec22644 Pavitrakumar M 2024-03-05   70  
6ad822cec22644 Pavitrakumar M 2024-03-05   71  	if (spacc->op_mode == SPACC_OP_MODE_IRQ) {
6ad822cec22644 Pavitrakumar M 2024-03-05   72  		cmd_max = (spacc->config.is_qos ? SPACC_CMDX_MAX_QOS :
6ad822cec22644 Pavitrakumar M 2024-03-05   73  				SPACC_CMDX_MAX);
6ad822cec22644 Pavitrakumar M 2024-03-05   74  		for (x = 0; x < cmd_max; x++) {
6ad822cec22644 Pavitrakumar M 2024-03-05   75  			if (temp & SPACC_IRQ_STAT_CMDX(x)) {
6ad822cec22644 Pavitrakumar M 2024-03-05   76  				spacc->config.fifo_cnt = 1;
6ad822cec22644 Pavitrakumar M 2024-03-05   77  				/* disable CMD0 interrupt since STAT=1 */
6ad822cec22644 Pavitrakumar M 2024-03-05   78  				spacc_irq_cmdx_disable(spacc, x);
6ad822cec22644 Pavitrakumar M 2024-03-05   79  				spacc_irq_stat_enable(spacc,
6ad822cec22644 Pavitrakumar M 2024-03-05   80  						      spacc->config.fifo_cnt);
6ad822cec22644 Pavitrakumar M 2024-03-05   81  
6ad822cec22644 Pavitrakumar M 2024-03-05   82  				SPACC_IRQ_STAT_CLEAR_CMDX(spacc, x);
6ad822cec22644 Pavitrakumar M 2024-03-05   83  				/* run registered callback */
6ad822cec22644 Pavitrakumar M 2024-03-05   84  				if (spacc->irq_cb_cmdx)
6ad822cec22644 Pavitrakumar M 2024-03-05   85  					spacc->irq_cb_cmdx(spacc, x);
6ad822cec22644 Pavitrakumar M 2024-03-05   86  			}
6ad822cec22644 Pavitrakumar M 2024-03-05   87  		}
6ad822cec22644 Pavitrakumar M 2024-03-05   88  	}
6ad822cec22644 Pavitrakumar M 2024-03-05   89  
6ad822cec22644 Pavitrakumar M 2024-03-05   90  	spin_unlock_irqrestore(&spacc->lock, lock_flag);
6ad822cec22644 Pavitrakumar M 2024-03-05   91  
6ad822cec22644 Pavitrakumar M 2024-03-05   92  	return temp;
6ad822cec22644 Pavitrakumar M 2024-03-05   93  }
6ad822cec22644 Pavitrakumar M 2024-03-05   94  
6ad822cec22644 Pavitrakumar M 2024-03-05   95  void spacc_set_wd_count(struct spacc_device *spacc, uint32_t val)
6ad822cec22644 Pavitrakumar M 2024-03-05   96  {
6ad822cec22644 Pavitrakumar M 2024-03-05   97  	writel(val, spacc->regmap + SPACC_REG_STAT_WD_CTRL);
6ad822cec22644 Pavitrakumar M 2024-03-05   98  }
6ad822cec22644 Pavitrakumar M 2024-03-05   99  
6ad822cec22644 Pavitrakumar M 2024-03-05  100  /* cmdx and cmdx_cnt depend on HW config */
6ad822cec22644 Pavitrakumar M 2024-03-05  101  /* cmdx can be 0, 1 or 2 */
6ad822cec22644 Pavitrakumar M 2024-03-05  102  /* cmdx_cnt must be 2^6 or less */
6ad822cec22644 Pavitrakumar M 2024-03-05  103  void spacc_irq_cmdx_enable(struct spacc_device *spacc, int cmdx, int cmdx_cnt)
6ad822cec22644 Pavitrakumar M 2024-03-05  104  {
6ad822cec22644 Pavitrakumar M 2024-03-05  105  	u32 temp;
6ad822cec22644 Pavitrakumar M 2024-03-05  106  
6ad822cec22644 Pavitrakumar M 2024-03-05  107  	/* read the reg, clear the bit range and set the new value */
6ad822cec22644 Pavitrakumar M 2024-03-05  108  	temp = readl(spacc->regmap + SPACC_REG_IRQ_CTRL) &
6ad822cec22644 Pavitrakumar M 2024-03-05  109  		(~SPACC_IRQ_CTRL_CMDX_CNT_MASK(cmdx));
6ad822cec22644 Pavitrakumar M 2024-03-05  110  	temp |= SPACC_IRQ_CTRL_CMDX_CNT_SET(cmdx, cmdx_cnt);
6ad822cec22644 Pavitrakumar M 2024-03-05  111  	writel(temp | SPACC_IRQ_CTRL_CMDX_CNT_SET(cmdx, cmdx_cnt),
6ad822cec22644 Pavitrakumar M 2024-03-05  112  			spacc->regmap + SPACC_REG_IRQ_CTRL);
6ad822cec22644 Pavitrakumar M 2024-03-05  113  
6ad822cec22644 Pavitrakumar M 2024-03-05  114  	writel(readl(spacc->regmap + SPACC_REG_IRQ_EN) |
6ad822cec22644 Pavitrakumar M 2024-03-05  115  				SPACC_IRQ_EN_CMD(cmdx),
6ad822cec22644 Pavitrakumar M 2024-03-05  116  				spacc->regmap + SPACC_REG_IRQ_EN);
6ad822cec22644 Pavitrakumar M 2024-03-05  117  }
6ad822cec22644 Pavitrakumar M 2024-03-05  118  
6ad822cec22644 Pavitrakumar M 2024-03-05  119  void spacc_irq_cmdx_disable(struct spacc_device *spacc, int cmdx)
6ad822cec22644 Pavitrakumar M 2024-03-05  120  {
6ad822cec22644 Pavitrakumar M 2024-03-05  121  	writel(readl(spacc->regmap + SPACC_REG_IRQ_EN) &
6ad822cec22644 Pavitrakumar M 2024-03-05  122  			(~SPACC_IRQ_EN_CMD(cmdx)),
6ad822cec22644 Pavitrakumar M 2024-03-05  123  			spacc->regmap + SPACC_REG_IRQ_EN);
6ad822cec22644 Pavitrakumar M 2024-03-05  124  }
6ad822cec22644 Pavitrakumar M 2024-03-05  125  
6ad822cec22644 Pavitrakumar M 2024-03-05  126  void spacc_irq_stat_enable(struct spacc_device *spacc, int stat_cnt)
6ad822cec22644 Pavitrakumar M 2024-03-05  127  {
6ad822cec22644 Pavitrakumar M 2024-03-05  128  	u32 temp;
6ad822cec22644 Pavitrakumar M 2024-03-05  129  
6ad822cec22644 Pavitrakumar M 2024-03-05  130  	temp = readl(spacc->regmap + SPACC_REG_IRQ_CTRL);
6ad822cec22644 Pavitrakumar M 2024-03-05  131  	if (spacc->config.is_qos) {
6ad822cec22644 Pavitrakumar M 2024-03-05  132  		temp &= (~SPACC_IRQ_CTRL_STAT_CNT_MASK_QOS);
6ad822cec22644 Pavitrakumar M 2024-03-05  133  		temp |= SPACC_IRQ_CTRL_STAT_CNT_SET_QOS(stat_cnt);
6ad822cec22644 Pavitrakumar M 2024-03-05  134  	} else {
6ad822cec22644 Pavitrakumar M 2024-03-05  135  		temp &= (~SPACC_IRQ_CTRL_STAT_CNT_MASK);
6ad822cec22644 Pavitrakumar M 2024-03-05  136  		temp |= SPACC_IRQ_CTRL_STAT_CNT_SET(stat_cnt);
6ad822cec22644 Pavitrakumar M 2024-03-05  137  	}
6ad822cec22644 Pavitrakumar M 2024-03-05  138  
6ad822cec22644 Pavitrakumar M 2024-03-05  139  	writel(temp, spacc->regmap + SPACC_REG_IRQ_CTRL);
6ad822cec22644 Pavitrakumar M 2024-03-05  140  	writel(readl(spacc->regmap + SPACC_REG_IRQ_EN) |
6ad822cec22644 Pavitrakumar M 2024-03-05  141  				SPACC_IRQ_EN_STAT,
6ad822cec22644 Pavitrakumar M 2024-03-05  142  				spacc->regmap + SPACC_REG_IRQ_EN);
6ad822cec22644 Pavitrakumar M 2024-03-05  143  }
6ad822cec22644 Pavitrakumar M 2024-03-05  144  
6ad822cec22644 Pavitrakumar M 2024-03-05  145  void spacc_irq_stat_disable(struct spacc_device *spacc)
6ad822cec22644 Pavitrakumar M 2024-03-05  146  {
6ad822cec22644 Pavitrakumar M 2024-03-05  147  	writel(readl(spacc->regmap + SPACC_REG_IRQ_EN) &
6ad822cec22644 Pavitrakumar M 2024-03-05  148  				(~SPACC_IRQ_EN_STAT),
6ad822cec22644 Pavitrakumar M 2024-03-05  149  				spacc->regmap + SPACC_REG_IRQ_EN);
6ad822cec22644 Pavitrakumar M 2024-03-05  150  }
6ad822cec22644 Pavitrakumar M 2024-03-05  151  
6ad822cec22644 Pavitrakumar M 2024-03-05  152  void spacc_irq_stat_wd_enable(struct spacc_device *spacc)
6ad822cec22644 Pavitrakumar M 2024-03-05  153  {
6ad822cec22644 Pavitrakumar M 2024-03-05  154  	writel(readl(spacc->regmap + SPACC_REG_IRQ_EN) |
6ad822cec22644 Pavitrakumar M 2024-03-05  155  				SPACC_IRQ_EN_STAT_WD,
6ad822cec22644 Pavitrakumar M 2024-03-05  156  				spacc->regmap + SPACC_REG_IRQ_EN);
6ad822cec22644 Pavitrakumar M 2024-03-05  157  }
6ad822cec22644 Pavitrakumar M 2024-03-05  158  
6ad822cec22644 Pavitrakumar M 2024-03-05  159  void spacc_irq_stat_wd_disable(struct spacc_device *spacc)
6ad822cec22644 Pavitrakumar M 2024-03-05  160  {
6ad822cec22644 Pavitrakumar M 2024-03-05  161  	writel(readl(spacc->regmap + SPACC_REG_IRQ_EN) &
6ad822cec22644 Pavitrakumar M 2024-03-05  162  				(~SPACC_IRQ_EN_STAT_WD),
6ad822cec22644 Pavitrakumar M 2024-03-05  163  				spacc->regmap + SPACC_REG_IRQ_EN);
6ad822cec22644 Pavitrakumar M 2024-03-05  164  }
6ad822cec22644 Pavitrakumar M 2024-03-05  165  
6ad822cec22644 Pavitrakumar M 2024-03-05  166  void spacc_irq_glbl_enable(struct spacc_device *spacc)
6ad822cec22644 Pavitrakumar M 2024-03-05  167  {
6ad822cec22644 Pavitrakumar M 2024-03-05  168  	writel(readl(spacc->regmap + SPACC_REG_IRQ_EN) |
6ad822cec22644 Pavitrakumar M 2024-03-05  169  				SPACC_IRQ_EN_GLBL,
6ad822cec22644 Pavitrakumar M 2024-03-05  170  				spacc->regmap + SPACC_REG_IRQ_EN);
6ad822cec22644 Pavitrakumar M 2024-03-05  171  }
6ad822cec22644 Pavitrakumar M 2024-03-05  172  
6ad822cec22644 Pavitrakumar M 2024-03-05  173  void spacc_irq_glbl_disable(struct spacc_device *spacc)
6ad822cec22644 Pavitrakumar M 2024-03-05  174  {
6ad822cec22644 Pavitrakumar M 2024-03-05 @175  	writel(readl(spacc->regmap + SPACC_REG_IRQ_EN) &
6ad822cec22644 Pavitrakumar M 2024-03-05  176  				(~SPACC_IRQ_EN_GLBL),
6ad822cec22644 Pavitrakumar M 2024-03-05  177  				spacc->regmap + SPACC_REG_IRQ_EN);
6ad822cec22644 Pavitrakumar M 2024-03-05  178  }
6ad822cec22644 Pavitrakumar M 2024-03-05  179  
6ad822cec22644 Pavitrakumar M 2024-03-05 @180  void spacc_disable_int (struct spacc_device *spacc)
6ad822cec22644 Pavitrakumar M 2024-03-05  181  {
6ad822cec22644 Pavitrakumar M 2024-03-05  182  	writel(0, spacc->regmap + SPACC_REG_IRQ_EN);
6ad822cec22644 Pavitrakumar M 2024-03-05  183  }
6ad822cec22644 Pavitrakumar M 2024-03-05  184
Dan Carpenter March 7, 2024, 2:24 p.m. UTC | #5
Hi Pavitrakumar,

kernel test robot noticed the following build warnings:

https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Pavitrakumar-M/Add-SPAcc-driver-to-Linux-kernel/20240305-193337
base:   https://git.kernel.org/pub/scm/linux/kernel/git/herbert/cryptodev-2.6.git master
patch link:    https://lore.kernel.org/r/20240305112831.3380896-5-pavitrakumarm%40vayavyalabs.com
patch subject: [PATCH 4/4] Enable Driver compilation in crypto Kconfig and Makefile file
config: m68k-randconfig-r081-20240307 (https://download.01.org/0day-ci/archive/20240307/202403072256.em3Fk3At-lkp@intel.com/config)
compiler: m68k-linux-gcc (GCC) 13.2.0

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
| Closes: https://lore.kernel.org/r/202403072256.em3Fk3At-lkp@intel.com/

New smatch warnings:
drivers/crypto/dwc-spacc/spacc_ahash.c:1057 spacc_hash_digest() error: uninitialized symbol 'total_len'.

Old smatch warnings:
drivers/crypto/dwc-spacc/spacc_ahash.c:271 spacc_hash_init_dma() error: uninitialized symbol 'sgl_buffer'.

vim +/total_len +1057 drivers/crypto/dwc-spacc/spacc_ahash.c

6ad822cec22644 Pavitrakumar M 2024-03-05   981  
6ad822cec22644 Pavitrakumar M 2024-03-05   982  static int spacc_hash_digest(struct ahash_request *req)
6ad822cec22644 Pavitrakumar M 2024-03-05   983  {
6ad822cec22644 Pavitrakumar M 2024-03-05   984  	int final = 0;
6ad822cec22644 Pavitrakumar M 2024-03-05   985  	int rc, total_len;
6ad822cec22644 Pavitrakumar M 2024-03-05   986  	struct crypto_ahash *reqtfm = crypto_ahash_reqtfm(req);
6ad822cec22644 Pavitrakumar M 2024-03-05   987  	struct spacc_crypto_ctx *tctx = crypto_ahash_ctx(reqtfm);
6ad822cec22644 Pavitrakumar M 2024-03-05   988  	struct spacc_crypto_reqctx *ctx = ahash_request_ctx(req);
6ad822cec22644 Pavitrakumar M 2024-03-05   989  	struct spacc_priv *priv = dev_get_drvdata(tctx->dev);
6ad822cec22644 Pavitrakumar M 2024-03-05   990  
6ad822cec22644 Pavitrakumar M 2024-03-05   991  	if (tctx->flag_ppp) {
6ad822cec22644 Pavitrakumar M 2024-03-05   992  		/* from finup */
6ad822cec22644 Pavitrakumar M 2024-03-05   993  		ctx->single_shot = 0;
6ad822cec22644 Pavitrakumar M 2024-03-05   994  		ctx->final_part_pck = 1;
6ad822cec22644 Pavitrakumar M 2024-03-05   995  		final = 2;
6ad822cec22644 Pavitrakumar M 2024-03-05   996  	} else {
6ad822cec22644 Pavitrakumar M 2024-03-05   997  		/* direct single shot digest call */
6ad822cec22644 Pavitrakumar M 2024-03-05   998  		ctx->single_shot = 1;
6ad822cec22644 Pavitrakumar M 2024-03-05   999  		ctx->rem_len = 0;
6ad822cec22644 Pavitrakumar M 2024-03-05  1000  		ctx->total_nents = sg_nents(req->src);
6ad822cec22644 Pavitrakumar M 2024-03-05  1001  	}
6ad822cec22644 Pavitrakumar M 2024-03-05  1002  
6ad822cec22644 Pavitrakumar M 2024-03-05  1003  	if (tctx->handle < 0 || !tctx->ctx_valid ||
6ad822cec22644 Pavitrakumar M 2024-03-05  1004  	    req->nbytes > priv->max_msg_len)
6ad822cec22644 Pavitrakumar M 2024-03-05  1005  		goto fallback;

"total_len" not intialized for these gotos

6ad822cec22644 Pavitrakumar M 2024-03-05  1006  
6ad822cec22644 Pavitrakumar M 2024-03-05  1007  	rc = spacc_hash_init_dma(tctx->dev, req, final);
6ad822cec22644 Pavitrakumar M 2024-03-05  1008  	if (rc < 0)
6ad822cec22644 Pavitrakumar M 2024-03-05  1009  		goto fallback;
6ad822cec22644 Pavitrakumar M 2024-03-05  1010  
6ad822cec22644 Pavitrakumar M 2024-03-05  1011  	if (rc == 0)
6ad822cec22644 Pavitrakumar M 2024-03-05  1012  		return 0;
6ad822cec22644 Pavitrakumar M 2024-03-05  1013  
6ad822cec22644 Pavitrakumar M 2024-03-05  1014  	if (final) {
6ad822cec22644 Pavitrakumar M 2024-03-05  1015  		if (ctx->total_nents) {
6ad822cec22644 Pavitrakumar M 2024-03-05  1016  			/* INIT-UPDATE-UPDATE-FINUP/FINAL */
6ad822cec22644 Pavitrakumar M 2024-03-05  1017  			total_len = tctx->ppp_sgl[0].length;
6ad822cec22644 Pavitrakumar M 2024-03-05  1018  		} else if (req->src->length == 0 && ctx->total_nents == 0) {
6ad822cec22644 Pavitrakumar M 2024-03-05  1019  			/* zero msg handling */
6ad822cec22644 Pavitrakumar M 2024-03-05  1020  			total_len = 0;
6ad822cec22644 Pavitrakumar M 2024-03-05  1021  		} else {
6ad822cec22644 Pavitrakumar M 2024-03-05  1022  			/* handle INIT-FINUP sequence, process req->nbytes */
6ad822cec22644 Pavitrakumar M 2024-03-05  1023  			total_len = req->nbytes;
6ad822cec22644 Pavitrakumar M 2024-03-05  1024  		}
6ad822cec22644 Pavitrakumar M 2024-03-05  1025  
6ad822cec22644 Pavitrakumar M 2024-03-05  1026  		rc = spacc_packet_enqueue_ddt(&priv->spacc, ctx->acb.new_handle,
6ad822cec22644 Pavitrakumar M 2024-03-05  1027  				&ctx->src, &ctx->dst, total_len,
6ad822cec22644 Pavitrakumar M 2024-03-05  1028  				0, total_len, 0, 0, 0);
6ad822cec22644 Pavitrakumar M 2024-03-05  1029  	} else {
6ad822cec22644 Pavitrakumar M 2024-03-05  1030  		rc = spacc_packet_enqueue_ddt(&priv->spacc, ctx->acb.new_handle,
6ad822cec22644 Pavitrakumar M 2024-03-05  1031  				&ctx->src, &ctx->dst, req->nbytes,
6ad822cec22644 Pavitrakumar M 2024-03-05  1032  				0, req->nbytes, 0, 0, 0);
6ad822cec22644 Pavitrakumar M 2024-03-05  1033  	}
6ad822cec22644 Pavitrakumar M 2024-03-05  1034  
6ad822cec22644 Pavitrakumar M 2024-03-05  1035  	if (rc < 0) {
6ad822cec22644 Pavitrakumar M 2024-03-05  1036  		spacc_hash_cleanup_dma(tctx->dev, req);
6ad822cec22644 Pavitrakumar M 2024-03-05  1037  		spacc_close(&priv->spacc, ctx->acb.new_handle);
6ad822cec22644 Pavitrakumar M 2024-03-05  1038  
6ad822cec22644 Pavitrakumar M 2024-03-05  1039  		if (rc != -EBUSY) {
6ad822cec22644 Pavitrakumar M 2024-03-05  1040  			pr_debug("Failed to enqueue job, ERR: %d\n", rc);
6ad822cec22644 Pavitrakumar M 2024-03-05  1041  			return rc;
6ad822cec22644 Pavitrakumar M 2024-03-05  1042  		}
6ad822cec22644 Pavitrakumar M 2024-03-05  1043  
6ad822cec22644 Pavitrakumar M 2024-03-05  1044  		if (!(req->base.flags & CRYPTO_TFM_REQ_MAY_BACKLOG))
6ad822cec22644 Pavitrakumar M 2024-03-05  1045  			return -EBUSY;
6ad822cec22644 Pavitrakumar M 2024-03-05  1046  
6ad822cec22644 Pavitrakumar M 2024-03-05  1047  		goto fallback;
6ad822cec22644 Pavitrakumar M 2024-03-05  1048  	}
6ad822cec22644 Pavitrakumar M 2024-03-05  1049  
6ad822cec22644 Pavitrakumar M 2024-03-05  1050  	return -EINPROGRESS;
6ad822cec22644 Pavitrakumar M 2024-03-05  1051  
6ad822cec22644 Pavitrakumar M 2024-03-05  1052  fallback:
6ad822cec22644 Pavitrakumar M 2024-03-05  1053  	/* Start from scratch as init is not called before digest */
6ad822cec22644 Pavitrakumar M 2024-03-05  1054  	ctx->fb.hash_req.base = req->base;
6ad822cec22644 Pavitrakumar M 2024-03-05  1055  	ahash_request_set_tfm(&ctx->fb.hash_req, tctx->fb.hash);
6ad822cec22644 Pavitrakumar M 2024-03-05  1056  
6ad822cec22644 Pavitrakumar M 2024-03-05 @1057  	ctx->fb.hash_req.nbytes = total_len;
                                                                                  ^^^^^^^^^

6ad822cec22644 Pavitrakumar M 2024-03-05  1058  	ctx->fb.hash_req.src = req->src;
6ad822cec22644 Pavitrakumar M 2024-03-05  1059  	ctx->fb.hash_req.result = req->result;
6ad822cec22644 Pavitrakumar M 2024-03-05  1060  
6ad822cec22644 Pavitrakumar M 2024-03-05  1061  	return crypto_ahash_digest(&ctx->fb.hash_req);
6ad822cec22644 Pavitrakumar M 2024-03-05  1062  }
Dan Carpenter March 11, 2024, 7:40 a.m. UTC | #6
Hi Pavitrakumar,

kernel test robot noticed the following build warnings:

https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Pavitrakumar-M/Add-SPAcc-driver-to-Linux-kernel/20240305-193337
base:   https://git.kernel.org/pub/scm/linux/kernel/git/herbert/cryptodev-2.6.git master
patch link:    https://lore.kernel.org/r/20240305112831.3380896-5-pavitrakumarm%40vayavyalabs.com
patch subject: [PATCH 4/4] Enable Driver compilation in crypto Kconfig and Makefile file
config: i386-randconfig-141-20240308 (https://download.01.org/0day-ci/archive/20240311/202403111044.eqxBgcDl-lkp@intel.com/config)
compiler: gcc-12 (Debian 12.2.0-14) 12.2.0

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
| Closes: https://lore.kernel.org/r/202403111044.eqxBgcDl-lkp@intel.com/

New smatch warnings:
drivers/crypto/dwc-spacc/spacc_skcipher.c:176 spacc_cipher_cb() warn: was && intended here instead of ||?
drivers/crypto/dwc-spacc/spacc_aead.c:1131 spacc_aead_process() error: uninitialized symbol 'ptaadsize'.

vim +176 drivers/crypto/dwc-spacc/spacc_skcipher.c

6ad822cec22644 Pavitrakumar M 2024-03-05  146  static void spacc_cipher_cb(void *spacc, void *tfm)
6ad822cec22644 Pavitrakumar M 2024-03-05  147  {
6ad822cec22644 Pavitrakumar M 2024-03-05  148  	struct cipher_cb_data *cb = tfm;
6ad822cec22644 Pavitrakumar M 2024-03-05  149  	int err = -1, rc;
6ad822cec22644 Pavitrakumar M 2024-03-05  150  	int total_len;
6ad822cec22644 Pavitrakumar M 2024-03-05  151  	struct spacc_crypto_reqctx *ctx = skcipher_request_ctx(cb->req);
6ad822cec22644 Pavitrakumar M 2024-03-05  152  
6ad822cec22644 Pavitrakumar M 2024-03-05  153  	u32 status_reg = readl(cb->spacc->regmap + SPACC_REG_STATUS);
6ad822cec22644 Pavitrakumar M 2024-03-05  154  	u32 status_ret = (status_reg >> 24) & 0x03;
6ad822cec22644 Pavitrakumar M 2024-03-05  155  
6ad822cec22644 Pavitrakumar M 2024-03-05  156  	if (ctx->mode == CRYPTO_MODE_DES_CBC ||
6ad822cec22644 Pavitrakumar M 2024-03-05  157  	    ctx->mode == CRYPTO_MODE_3DES_CBC) {
6ad822cec22644 Pavitrakumar M 2024-03-05  158  		rc = spacc_read_context(cb->spacc, cb->tctx->handle,
6ad822cec22644 Pavitrakumar M 2024-03-05  159  					SPACC_CRYPTO_OPERATION, NULL, 0,
6ad822cec22644 Pavitrakumar M 2024-03-05  160  					cb->req->iv, 8);
6ad822cec22644 Pavitrakumar M 2024-03-05  161  	} else if (ctx->mode != CRYPTO_MODE_DES_ECB  &&
6ad822cec22644 Pavitrakumar M 2024-03-05  162  		   ctx->mode != CRYPTO_MODE_3DES_ECB &&
6ad822cec22644 Pavitrakumar M 2024-03-05  163  		   ctx->mode != CRYPTO_MODE_SM4_ECB  &&
6ad822cec22644 Pavitrakumar M 2024-03-05  164  		   ctx->mode != CRYPTO_MODE_AES_ECB  &&
6ad822cec22644 Pavitrakumar M 2024-03-05  165  		   ctx->mode != CRYPTO_MODE_SM4_XTS  &&
6ad822cec22644 Pavitrakumar M 2024-03-05  166  		   ctx->mode != CRYPTO_MODE_KASUMI_ECB) {
6ad822cec22644 Pavitrakumar M 2024-03-05  167  		if (status_ret == 0x3) {
6ad822cec22644 Pavitrakumar M 2024-03-05  168  			err = -EINVAL;
6ad822cec22644 Pavitrakumar M 2024-03-05  169  			goto REQ_DST_CP_SKIP;
6ad822cec22644 Pavitrakumar M 2024-03-05  170  		}
6ad822cec22644 Pavitrakumar M 2024-03-05  171  		rc = spacc_read_context(cb->spacc, cb->tctx->handle,
6ad822cec22644 Pavitrakumar M 2024-03-05  172  					SPACC_CRYPTO_OPERATION, NULL, 0,
6ad822cec22644 Pavitrakumar M 2024-03-05  173  					cb->req->iv, 16);
6ad822cec22644 Pavitrakumar M 2024-03-05  174  	}
6ad822cec22644 Pavitrakumar M 2024-03-05  175  
6ad822cec22644 Pavitrakumar M 2024-03-05 @176  	if (ctx->mode != CRYPTO_MODE_DES_ECB  ||
6ad822cec22644 Pavitrakumar M 2024-03-05  177  	    ctx->mode != CRYPTO_MODE_DES_CBC  ||
6ad822cec22644 Pavitrakumar M 2024-03-05  178  	    ctx->mode != CRYPTO_MODE_3DES_ECB ||
6ad822cec22644 Pavitrakumar M 2024-03-05  179  	    ctx->mode != CRYPTO_MODE_3DES_CBC) {

ctx->mode can't possibly be equal to multiple values at the same time
so this condition is always true.  && was intended.

6ad822cec22644 Pavitrakumar M 2024-03-05  180  		if (status_ret == 0x03) {
6ad822cec22644 Pavitrakumar M 2024-03-05  181  			err = -EINVAL;
6ad822cec22644 Pavitrakumar M 2024-03-05  182  			goto REQ_DST_CP_SKIP;
6ad822cec22644 Pavitrakumar M 2024-03-05  183  		}
6ad822cec22644 Pavitrakumar M 2024-03-05  184  	}
6ad822cec22644 Pavitrakumar M 2024-03-05  185  
6ad822cec22644 Pavitrakumar M 2024-03-05  186  	if (ctx->mode == CRYPTO_MODE_SM4_ECB && status_ret == 0x03) {
6ad822cec22644 Pavitrakumar M 2024-03-05  187  		err = -EINVAL;
6ad822cec22644 Pavitrakumar M 2024-03-05  188  		goto REQ_DST_CP_SKIP;
6ad822cec22644 Pavitrakumar M 2024-03-05  189  	}
6ad822cec22644 Pavitrakumar M 2024-03-05  190  
6ad822cec22644 Pavitrakumar M 2024-03-05  191  	total_len = cb->req->cryptlen;
6ad822cec22644 Pavitrakumar M 2024-03-05  192  	if (ctx->mode == CRYPTO_MODE_SM4_XTS && total_len != 16) {
6ad822cec22644 Pavitrakumar M 2024-03-05  193  		if (status_ret == 0x03) {
6ad822cec22644 Pavitrakumar M 2024-03-05  194  			err = -EINVAL;
6ad822cec22644 Pavitrakumar M 2024-03-05  195  			goto REQ_DST_CP_SKIP;
6ad822cec22644 Pavitrakumar M 2024-03-05  196  		}
6ad822cec22644 Pavitrakumar M 2024-03-05  197  	}
6ad822cec22644 Pavitrakumar M 2024-03-05  198  
6ad822cec22644 Pavitrakumar M 2024-03-05  199  	dma_sync_sg_for_cpu(cb->tctx->dev, cb->req->dst, ctx->dst_nents,
6ad822cec22644 Pavitrakumar M 2024-03-05  200  				DMA_FROM_DEVICE);
6ad822cec22644 Pavitrakumar M 2024-03-05  201  
6ad822cec22644 Pavitrakumar M 2024-03-05  202  	err = cb->spacc->job[cb->new_handle].job_err;
6ad822cec22644 Pavitrakumar M 2024-03-05  203  REQ_DST_CP_SKIP:
6ad822cec22644 Pavitrakumar M 2024-03-05  204  	spacc_cipher_cleanup_dma(cb->tctx->dev, cb->req);
6ad822cec22644 Pavitrakumar M 2024-03-05  205  	spacc_close(cb->spacc, cb->new_handle);
6ad822cec22644 Pavitrakumar M 2024-03-05  206  
6ad822cec22644 Pavitrakumar M 2024-03-05  207  	/* call complete */
6ad822cec22644 Pavitrakumar M 2024-03-05  208  	skcipher_request_complete(cb->req, err);
6ad822cec22644 Pavitrakumar M 2024-03-05  209  }
diff mbox series

Patch

diff --git a/drivers/crypto/Kconfig b/drivers/crypto/Kconfig
index 3d02702456a5..aa384d138ae1 100644
--- a/drivers/crypto/Kconfig
+++ b/drivers/crypto/Kconfig
@@ -704,6 +704,7 @@  config CRYPTO_DEV_BCM_SPU
 	  ahash, and aead algorithms with the kernel cryptographic API.
 
 source "drivers/crypto/stm32/Kconfig"
+source "drivers/crypto/dwc-spacc/Kconfig"
 
 config CRYPTO_DEV_SAFEXCEL
 	tristate "Inside Secure's SafeXcel cryptographic engine driver"
diff --git a/drivers/crypto/Makefile b/drivers/crypto/Makefile
index 95331bc6456b..4408927a5a0c 100644
--- a/drivers/crypto/Makefile
+++ b/drivers/crypto/Makefile
@@ -47,6 +47,7 @@  obj-$(CONFIG_CRYPTO_DEV_BCM_SPU) += bcm/
 obj-$(CONFIG_CRYPTO_DEV_SAFEXCEL) += inside-secure/
 obj-$(CONFIG_CRYPTO_DEV_ARTPEC6) += axis/
 obj-y += xilinx/
+obj-y += dwc-spacc/
 obj-y += hisilicon/
 obj-$(CONFIG_CRYPTO_DEV_AMLOGIC_GXL) += amlogic/
 obj-y += intel/