lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20201009134807.GQ8133@xsang-OptiPlex-9020>
Date:   Fri, 9 Oct 2020 21:48:07 +0800
From:   kernel test robot <lkp@...el.com>
To:     Luo bin <luobin9@...wei.com>
Cc:     kbuild-all@...ts.01.org, linux-kernel@...r.kernel.org
Subject: drivers/net/ethernet/huawei/hinic/hinic_hw_mbox.c:543:54: sparse:
 got unsigned char COPYING CREDITS Documentation Kbuild Kconfig LICENSES
 MAINTAINERS Makefile README arch block certs crypto drivers fs include init
 ipc kernel lib mm net samples scripts security sound tools usr virt

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   d3d45f8220d60a0b2aaaacf8fb2be4e6ffd9008e
commit: a425b6e1c69ba907b72b737a4d44f8cfbc43ce3c hinic: add mailbox function support
date:   5 months ago
:::::: branch date: 6 hours ago
:::::: commit date: 5 months ago
config: x86_64-randconfig-s022-20201003 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0
reproduce:
        # apt-get install sparse
        # sparse version: v0.6.2-201-g24bdaac6-dirty
        # https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=a425b6e1c69ba907b72b737a4d44f8cfbc43ce3c
        git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
        git fetch --no-tags linus master
        git checkout a425b6e1c69ba907b72b737a4d44f8cfbc43ce3c
        # save the attached .config to linux build tree
        make W=1 C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=x86_64 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@...el.com>

	echo
	echo "sparse warnings: (new ones prefixed by >>)"
	echo
   drivers/net/ethernet/huawei/hinic/hinic_hw_mbox.c:543:54: sparse: sparse: incorrect type in argument 2 (different address spaces) @@     expected void volatile [noderef] <asn:2> *addr @@     got unsigned char [usertype] * @@
   drivers/net/ethernet/huawei/hinic/hinic_hw_mbox.c:543:54: sparse:     expected void volatile [noderef] <asn:2> *addr
>> drivers/net/ethernet/huawei/hinic/hinic_hw_mbox.c:543:54: sparse:     got unsigned char [usertype] *
   drivers/net/ethernet/huawei/hinic/hinic_hw_mbox.c:566:58: sparse: sparse: incorrect type in argument 2 (different address spaces) @@     expected void volatile [noderef] <asn:2> *addr @@     got unsigned char [usertype] * @@
   drivers/net/ethernet/huawei/hinic/hinic_hw_mbox.c:566:58: sparse:     expected void volatile [noderef] <asn:2> *addr
   drivers/net/ethernet/huawei/hinic/hinic_hw_mbox.c:566:58: sparse:     got unsigned char [usertype] *
   drivers/net/ethernet/huawei/hinic/hinic_hw_mbox.c:601:6: sparse: sparse: symbol 'dump_mox_reg' was not declared. Should it be static?
>> drivers/net/ethernet/huawei/hinic/hinic_hw_mbox.c:618:22: sparse: sparse: cast to restricted __be64
>> drivers/net/ethernet/huawei/hinic/hinic_hw_mbox.c:618:22: sparse: sparse: cast to restricted __be64
>> drivers/net/ethernet/huawei/hinic/hinic_hw_mbox.c:618:22: sparse: sparse: cast to restricted __be64
>> drivers/net/ethernet/huawei/hinic/hinic_hw_mbox.c:618:22: sparse: sparse: cast to restricted __be64
>> drivers/net/ethernet/huawei/hinic/hinic_hw_mbox.c:618:22: sparse: sparse: cast to restricted __be64
>> drivers/net/ethernet/huawei/hinic/hinic_hw_mbox.c:618:22: sparse: sparse: cast to restricted __be64
>> drivers/net/ethernet/huawei/hinic/hinic_hw_mbox.c:618:22: sparse: sparse: cast to restricted __be64
>> drivers/net/ethernet/huawei/hinic/hinic_hw_mbox.c:618:22: sparse: sparse: cast to restricted __be64
>> drivers/net/ethernet/huawei/hinic/hinic_hw_mbox.c:618:22: sparse: sparse: cast to restricted __be64
>> drivers/net/ethernet/huawei/hinic/hinic_hw_mbox.c:618:22: sparse: sparse: cast to restricted __be64
   drivers/net/ethernet/huawei/hinic/hinic_hw_mbox.c:1057:25: sparse: sparse: incorrect type in assignment (different address spaces) @@     expected unsigned char [usertype] *data @@     got void [noderef] <asn:2> * @@
>> drivers/net/ethernet/huawei/hinic/hinic_hw_mbox.c:1057:25: sparse:     expected unsigned char [usertype] *data
   drivers/net/ethernet/huawei/hinic/hinic_hw_mbox.c:1057:25: sparse:     got void [noderef] <asn:2> *
   drivers/net/ethernet/huawei/hinic/hinic_hw_mbox.c: note: in included file:
   drivers/net/ethernet/huawei/hinic/hinic_hw_if.h:256:16: sparse: sparse: incorrect type in argument 1 (different base types) @@     expected unsigned int val @@     got restricted __be32 [usertype] @@
   drivers/net/ethernet/huawei/hinic/hinic_hw_if.h:256:16: sparse:     expected unsigned int val
   drivers/net/ethernet/huawei/hinic/hinic_hw_if.h:256:16: sparse:     got restricted __be32 [usertype]
   drivers/net/ethernet/huawei/hinic/hinic_hw_if.h:256:16: sparse: sparse: incorrect type in argument 1 (different base types) @@     expected unsigned int val @@     got restricted __be32 [usertype] @@
   drivers/net/ethernet/huawei/hinic/hinic_hw_if.h:256:16: sparse:     expected unsigned int val
   drivers/net/ethernet/huawei/hinic/hinic_hw_if.h:256:16: sparse:     got restricted __be32 [usertype]
   drivers/net/ethernet/huawei/hinic/hinic_hw_if.h:250:16: sparse: sparse: cast to restricted __be32
   drivers/net/ethernet/huawei/hinic/hinic_hw_if.h:250:16: sparse: sparse: cast to restricted __be32
   drivers/net/ethernet/huawei/hinic/hinic_hw_if.h:250:16: sparse: sparse: cast to restricted __be32
   drivers/net/ethernet/huawei/hinic/hinic_hw_if.h:250:16: sparse: sparse: cast to restricted __be32
   drivers/net/ethernet/huawei/hinic/hinic_hw_if.h:250:16: sparse: sparse: cast to restricted __be32
   drivers/net/ethernet/huawei/hinic/hinic_hw_if.h:250:16: sparse: sparse: cast to restricted __be32
   drivers/net/ethernet/huawei/hinic/hinic_hw_if.h:250:16: sparse: sparse: cast to restricted __be32
   drivers/net/ethernet/huawei/hinic/hinic_hw_if.h:250:16: sparse: sparse: cast to restricted __be32
   drivers/net/ethernet/huawei/hinic/hinic_hw_if.h:250:16: sparse: sparse: cast to restricted __be32
   drivers/net/ethernet/huawei/hinic/hinic_hw_if.h:250:16: sparse: sparse: cast to restricted __be32
   drivers/net/ethernet/huawei/hinic/hinic_hw_if.h:250:16: sparse: sparse: cast to restricted __be32
   drivers/net/ethernet/huawei/hinic/hinic_hw_if.h:250:16: sparse: sparse: cast to restricted __be32
   drivers/net/ethernet/huawei/hinic/hinic_hw_if.h:256:16: sparse: sparse: incorrect type in argument 1 (different base types) @@     expected unsigned int val @@     got restricted __be32 [usertype] @@
   drivers/net/ethernet/huawei/hinic/hinic_hw_if.h:256:16: sparse:     expected unsigned int val
   drivers/net/ethernet/huawei/hinic/hinic_hw_if.h:256:16: sparse:     got restricted __be32 [usertype]
   drivers/net/ethernet/huawei/hinic/hinic_hw_if.h:256:16: sparse: sparse: incorrect type in argument 1 (different base types) @@     expected unsigned int val @@     got restricted __be32 [usertype] @@
   drivers/net/ethernet/huawei/hinic/hinic_hw_if.h:256:16: sparse:     expected unsigned int val
   drivers/net/ethernet/huawei/hinic/hinic_hw_if.h:256:16: sparse:     got restricted __be32 [usertype]
   drivers/net/ethernet/huawei/hinic/hinic_hw_if.h:256:16: sparse: sparse: incorrect type in argument 1 (different base types) @@     expected unsigned int val @@     got restricted __be32 [usertype] @@
   drivers/net/ethernet/huawei/hinic/hinic_hw_if.h:256:16: sparse:     expected unsigned int val
   drivers/net/ethernet/huawei/hinic/hinic_hw_if.h:256:16: sparse:     got restricted __be32 [usertype]
   drivers/net/ethernet/huawei/hinic/hinic_hw_if.h:256:16: sparse: sparse: incorrect type in argument 1 (different base types) @@     expected unsigned int val @@     got restricted __be32 [usertype] @@
   drivers/net/ethernet/huawei/hinic/hinic_hw_if.h:256:16: sparse:     expected unsigned int val
   drivers/net/ethernet/huawei/hinic/hinic_hw_if.h:256:16: sparse:     got restricted __be32 [usertype]

vim +543 drivers/net/ethernet/huawei/hinic/hinic_hw_mbox.c

a425b6e1c69ba90 Luo bin 2020-04-25  535  
a425b6e1c69ba90 Luo bin 2020-04-25  536  static void mbox_copy_header(struct hinic_hwdev *hwdev,
a425b6e1c69ba90 Luo bin 2020-04-25  537  			     struct hinic_send_mbox *mbox, u64 *header)
a425b6e1c69ba90 Luo bin 2020-04-25  538  {
a425b6e1c69ba90 Luo bin 2020-04-25  539  	u32 i, idx_max = MBOX_HEADER_SZ / sizeof(u32);
a425b6e1c69ba90 Luo bin 2020-04-25  540  	u32 *data = (u32 *)header;
a425b6e1c69ba90 Luo bin 2020-04-25  541  
a425b6e1c69ba90 Luo bin 2020-04-25  542  	for (i = 0; i < idx_max; i++)
a425b6e1c69ba90 Luo bin 2020-04-25 @543  		__raw_writel(*(data + i), mbox->data + i * sizeof(u32));
a425b6e1c69ba90 Luo bin 2020-04-25  544  }
a425b6e1c69ba90 Luo bin 2020-04-25  545  
a425b6e1c69ba90 Luo bin 2020-04-25  546  static void mbox_copy_send_data(struct hinic_hwdev *hwdev,
a425b6e1c69ba90 Luo bin 2020-04-25  547  				struct hinic_send_mbox *mbox, void *seg,
a425b6e1c69ba90 Luo bin 2020-04-25  548  				u16 seg_len)
a425b6e1c69ba90 Luo bin 2020-04-25  549  {
a425b6e1c69ba90 Luo bin 2020-04-25  550  	u8 mbox_max_buf[MBOX_SEG_LEN] = {0};
a425b6e1c69ba90 Luo bin 2020-04-25  551  	u32 data_len, chk_sz = sizeof(u32);
a425b6e1c69ba90 Luo bin 2020-04-25  552  	u32 *data = seg;
a425b6e1c69ba90 Luo bin 2020-04-25  553  	u32 i, idx_max;
a425b6e1c69ba90 Luo bin 2020-04-25  554  
a425b6e1c69ba90 Luo bin 2020-04-25  555  	/* The mbox message should be aligned in 4 bytes. */
a425b6e1c69ba90 Luo bin 2020-04-25  556  	if (seg_len % chk_sz) {
a425b6e1c69ba90 Luo bin 2020-04-25  557  		memcpy(mbox_max_buf, seg, seg_len);
a425b6e1c69ba90 Luo bin 2020-04-25  558  		data = (u32 *)mbox_max_buf;
a425b6e1c69ba90 Luo bin 2020-04-25  559  	}
a425b6e1c69ba90 Luo bin 2020-04-25  560  
a425b6e1c69ba90 Luo bin 2020-04-25  561  	data_len = seg_len;
a425b6e1c69ba90 Luo bin 2020-04-25  562  	idx_max = ALIGN(data_len, chk_sz) / chk_sz;
a425b6e1c69ba90 Luo bin 2020-04-25  563  
a425b6e1c69ba90 Luo bin 2020-04-25  564  	for (i = 0; i < idx_max; i++)
a425b6e1c69ba90 Luo bin 2020-04-25  565  		__raw_writel(*(data + i),
a425b6e1c69ba90 Luo bin 2020-04-25  566  			     mbox->data + MBOX_HEADER_SZ + i * sizeof(u32));
a425b6e1c69ba90 Luo bin 2020-04-25  567  }
a425b6e1c69ba90 Luo bin 2020-04-25  568  
a425b6e1c69ba90 Luo bin 2020-04-25  569  static void write_mbox_msg_attr(struct hinic_mbox_func_to_func *func_to_func,
a425b6e1c69ba90 Luo bin 2020-04-25  570  				u16 dst_func, u16 dst_aeqn, u16 seg_len,
a425b6e1c69ba90 Luo bin 2020-04-25  571  				int poll)
a425b6e1c69ba90 Luo bin 2020-04-25  572  {
a425b6e1c69ba90 Luo bin 2020-04-25  573  	u16 rsp_aeq = (dst_aeqn == 0) ? 0 : HINIC_MBOX_RSP_AEQN;
a425b6e1c69ba90 Luo bin 2020-04-25  574  	u32 mbox_int, mbox_ctrl;
a425b6e1c69ba90 Luo bin 2020-04-25  575  
a425b6e1c69ba90 Luo bin 2020-04-25  576  	mbox_int = HINIC_MBOX_INT_SET(dst_func, DST_FUNC) |
a425b6e1c69ba90 Luo bin 2020-04-25  577  		   HINIC_MBOX_INT_SET(dst_aeqn, DST_AEQN) |
a425b6e1c69ba90 Luo bin 2020-04-25  578  		   HINIC_MBOX_INT_SET(rsp_aeq, SRC_RESP_AEQN) |
a425b6e1c69ba90 Luo bin 2020-04-25  579  		   HINIC_MBOX_INT_SET(NO_DMA_ATTRIBUTE_VAL, STAT_DMA) |
a425b6e1c69ba90 Luo bin 2020-04-25  580  		   HINIC_MBOX_INT_SET(ALIGN(MBOX_SEG_LEN + MBOX_HEADER_SZ +
a425b6e1c69ba90 Luo bin 2020-04-25  581  				      MBOX_INFO_SZ, MBOX_SEG_LEN_ALIGN) >> 2,
a425b6e1c69ba90 Luo bin 2020-04-25  582  				      TX_SIZE) |
a425b6e1c69ba90 Luo bin 2020-04-25  583  		   HINIC_MBOX_INT_SET(STRONG_ORDER, STAT_DMA_SO_RO) |
a425b6e1c69ba90 Luo bin 2020-04-25  584  		   HINIC_MBOX_INT_SET(WRITE_BACK, WB_EN);
a425b6e1c69ba90 Luo bin 2020-04-25  585  
a425b6e1c69ba90 Luo bin 2020-04-25  586  	hinic_hwif_write_reg(func_to_func->hwif,
a425b6e1c69ba90 Luo bin 2020-04-25  587  			     HINIC_FUNC_CSR_MAILBOX_INT_OFFSET_OFF, mbox_int);
a425b6e1c69ba90 Luo bin 2020-04-25  588  
a425b6e1c69ba90 Luo bin 2020-04-25  589  	wmb(); /* writing the mbox int attributes */
a425b6e1c69ba90 Luo bin 2020-04-25  590  	mbox_ctrl = HINIC_MBOX_CTRL_SET(TX_NOT_DONE, TX_STATUS);
a425b6e1c69ba90 Luo bin 2020-04-25  591  
a425b6e1c69ba90 Luo bin 2020-04-25  592  	if (poll)
a425b6e1c69ba90 Luo bin 2020-04-25  593  		mbox_ctrl |= HINIC_MBOX_CTRL_SET(NOT_TRIGGER, TRIGGER_AEQE);
a425b6e1c69ba90 Luo bin 2020-04-25  594  	else
a425b6e1c69ba90 Luo bin 2020-04-25  595  		mbox_ctrl |= HINIC_MBOX_CTRL_SET(TRIGGER, TRIGGER_AEQE);
a425b6e1c69ba90 Luo bin 2020-04-25  596  
a425b6e1c69ba90 Luo bin 2020-04-25  597  	hinic_hwif_write_reg(func_to_func->hwif,
a425b6e1c69ba90 Luo bin 2020-04-25  598  			     HINIC_FUNC_CSR_MAILBOX_CONTROL_OFF, mbox_ctrl);
a425b6e1c69ba90 Luo bin 2020-04-25  599  }
a425b6e1c69ba90 Luo bin 2020-04-25  600  
a425b6e1c69ba90 Luo bin 2020-04-25  601  void dump_mox_reg(struct hinic_hwdev *hwdev)
a425b6e1c69ba90 Luo bin 2020-04-25  602  {
a425b6e1c69ba90 Luo bin 2020-04-25  603  	u32 val;
a425b6e1c69ba90 Luo bin 2020-04-25  604  
a425b6e1c69ba90 Luo bin 2020-04-25  605  	val = hinic_hwif_read_reg(hwdev->hwif,
a425b6e1c69ba90 Luo bin 2020-04-25  606  				  HINIC_FUNC_CSR_MAILBOX_CONTROL_OFF);
a425b6e1c69ba90 Luo bin 2020-04-25  607  	dev_err(&hwdev->hwif->pdev->dev, "Mailbox control reg: 0x%x\n", val);
a425b6e1c69ba90 Luo bin 2020-04-25  608  
a425b6e1c69ba90 Luo bin 2020-04-25  609  	val = hinic_hwif_read_reg(hwdev->hwif,
a425b6e1c69ba90 Luo bin 2020-04-25  610  				  HINIC_FUNC_CSR_MAILBOX_INT_OFFSET_OFF);
a425b6e1c69ba90 Luo bin 2020-04-25  611  	dev_err(&hwdev->hwif->pdev->dev, "Mailbox interrupt offset: 0x%x\n",
a425b6e1c69ba90 Luo bin 2020-04-25  612  		val);
a425b6e1c69ba90 Luo bin 2020-04-25  613  }
a425b6e1c69ba90 Luo bin 2020-04-25  614  
a425b6e1c69ba90 Luo bin 2020-04-25  615  static u16 get_mbox_status(struct hinic_send_mbox *mbox)
a425b6e1c69ba90 Luo bin 2020-04-25  616  {
a425b6e1c69ba90 Luo bin 2020-04-25  617  	/* write back is 16B, but only use first 4B */
a425b6e1c69ba90 Luo bin 2020-04-25 @618  	u64 wb_val = be64_to_cpu(*mbox->wb_status);
a425b6e1c69ba90 Luo bin 2020-04-25  619  
a425b6e1c69ba90 Luo bin 2020-04-25  620  	rmb(); /* verify reading before check */
a425b6e1c69ba90 Luo bin 2020-04-25  621  
a425b6e1c69ba90 Luo bin 2020-04-25  622  	return (u16)(wb_val & MBOX_WB_STATUS_ERRCODE_MASK);
a425b6e1c69ba90 Luo bin 2020-04-25  623  }
a425b6e1c69ba90 Luo bin 2020-04-25  624  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

Download attachment ".config.gz" of type "application/gzip" (36890 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ