linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* drivers/scsi/fnic/vnic_dev.c:332:32: sparse: sparse: incorrect type in argument 1 (different address spaces)
@ 2020-12-24 12:23 kernel test robot
  0 siblings, 0 replies; 17+ messages in thread
From: kernel test robot @ 2020-12-24 12:23 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: kbuild-all, linux-kernel, Andrew Morton,
	Linux Memory Management List, Geert Uytterhoeven, Arnd Bergmann

[-- Attachment #1: Type: text/plain, Size: 10604 bytes --]

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   58cf05f597b03a8212d9ecf2c79ee046d3ee8ad9
commit: 8f28ca6bd8211214faf717677bbffe375c2a6072 iomap: constify ioreadX() iomem argument (as in generic implementation)
date:   4 months ago
config: i386-randconfig-s001-20201220 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0
reproduce:
        # apt-get install sparse
        # sparse version: v0.6.3-184-g1b896707-dirty
        # https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=8f28ca6bd8211214faf717677bbffe375c2a6072
        git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
        git fetch --no-tags linus master
        git checkout 8f28ca6bd8211214faf717677bbffe375c2a6072
        # save the attached .config to linux build tree
        make W=1 C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=i386 

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


"sparse warnings: (new ones prefixed by >>)"
>> drivers/scsi/fnic/vnic_dev.c:332:32: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void const [noderef] __iomem * @@     got unsigned int * @@
   drivers/scsi/fnic/vnic_dev.c:332:32: sparse:     expected void const [noderef] __iomem *
   drivers/scsi/fnic/vnic_dev.c:332:32: sparse:     got unsigned int *
   drivers/scsi/fnic/vnic_dev.c:333:37: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void const [noderef] __iomem * @@     got unsigned int * @@
   drivers/scsi/fnic/vnic_dev.c:333:37: sparse:     expected void const [noderef] __iomem *
   drivers/scsi/fnic/vnic_dev.c:333:37: sparse:     got unsigned int *
   drivers/scsi/fnic/vnic_dev.c:373:36: sparse: sparse: incorrect type in argument 2 (different address spaces) @@     expected void [noderef] __iomem * @@     got unsigned int * @@
   drivers/scsi/fnic/vnic_dev.c:373:36: sparse:     expected void [noderef] __iomem *
   drivers/scsi/fnic/vnic_dev.c:373:36: sparse:     got unsigned int *
   drivers/scsi/fnic/vnic_dev.c:469:32: sparse: sparse: incorrect type in assignment (different address spaces) @@     expected struct vnic_wq_ctrl *wq_ctrl @@     got struct vnic_wq_ctrl [noderef] __iomem *ctrl @@
   drivers/scsi/fnic/vnic_dev.c:469:32: sparse:     expected struct vnic_wq_ctrl *wq_ctrl
   drivers/scsi/fnic/vnic_dev.c:469:32: sparse:     got struct vnic_wq_ctrl [noderef] __iomem *ctrl
   drivers/scsi/fnic/vnic_dev.c:943:11: sparse: sparse: incorrect type in assignment (different address spaces) @@     expected void *p @@     got void [noderef] __iomem * @@
   drivers/scsi/fnic/vnic_dev.c:943:11: sparse:     expected void *p
   drivers/scsi/fnic/vnic_dev.c:943:11: sparse:     got void [noderef] __iomem *

vim +332 drivers/scsi/fnic/vnic_dev.c

5df6d737dd4b0fe Abhijeet Joglekar 2009-04-17  318  
363f4d937501ba4 Jason Yan         2020-04-15  319  static int vnic_dev_cmd2(struct vnic_dev *vdev, enum vnic_devcmd_cmd cmd,
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  320  		int wait)
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  321  {
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  322  	struct devcmd2_controller *dc2c = vdev->devcmd2;
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  323  	struct devcmd2_result *result;
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  324  	u8 color;
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  325  	unsigned int i;
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  326  	int delay;
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  327  	int err;
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  328  	u32 fetch_index;
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  329  	u32 posted;
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  330  	u32 new_posted;
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  331  
0a2fdd2215e1fa3 Satish Kharat     2019-01-18 @332  	posted = ioread32(&dc2c->wq_ctrl->posted_index);
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  333  	fetch_index = ioread32(&dc2c->wq_ctrl->fetch_index);
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  334  
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  335  	if (posted == 0xFFFFFFFF || fetch_index == 0xFFFFFFFF) {
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  336  		/* Hardware surprise removal: return error */
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  337  		pr_err("%s: devcmd2 invalid posted or fetch index on cmd %d\n",
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  338  				pci_name(vdev->pdev), _CMD_N(cmd));
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  339  		pr_err("%s: fetch index: %u, posted index: %u\n",
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  340  				pci_name(vdev->pdev), fetch_index, posted);
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  341  
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  342  		return -ENODEV;
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  343  
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  344  	}
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  345  
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  346  	new_posted = (posted + 1) % DEVCMD2_RING_SIZE;
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  347  
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  348  	if (new_posted == fetch_index) {
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  349  		pr_err("%s: devcmd2 wq full while issuing cmd %d\n",
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  350  				pci_name(vdev->pdev), _CMD_N(cmd));
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  351  		pr_err("%s: fetch index: %u, posted index: %u\n",
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  352  				pci_name(vdev->pdev), fetch_index, posted);
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  353  		return -EBUSY;
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  354  
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  355  	}
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  356  	dc2c->cmd_ring[posted].cmd = cmd;
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  357  	dc2c->cmd_ring[posted].flags = 0;
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  358  
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  359  	if ((_CMD_FLAGS(cmd) & _CMD_FLAGS_NOWAIT))
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  360  		dc2c->cmd_ring[posted].flags |= DEVCMD2_FNORESULT;
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  361  	if (_CMD_DIR(cmd) & _CMD_DIR_WRITE) {
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  362  		for (i = 0; i < VNIC_DEVCMD_NARGS; i++)
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  363  			dc2c->cmd_ring[posted].args[i] = vdev->args[i];
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  364  
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  365  	}
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  366  
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  367  	/* Adding write memory barrier prevents compiler and/or CPU
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  368  	 * reordering, thus avoiding descriptor posting before
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  369  	 * descriptor is initialized. Otherwise, hardware can read
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  370  	 * stale descriptor fields.
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  371  	 */
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  372  	wmb();
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  373  	iowrite32(new_posted, &dc2c->wq_ctrl->posted_index);
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  374  
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  375  	if (dc2c->cmd_ring[posted].flags & DEVCMD2_FNORESULT)
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  376  		return 0;
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  377  
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  378  	result = dc2c->result + dc2c->next_result;
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  379  	color = dc2c->color;
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  380  
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  381  	dc2c->next_result++;
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  382  	if (dc2c->next_result == dc2c->result_size) {
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  383  		dc2c->next_result = 0;
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  384  		dc2c->color = dc2c->color ? 0 : 1;
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  385  	}
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  386  
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  387  	for (delay = 0; delay < wait; delay++) {
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  388  		udelay(100);
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  389  		if (result->color == color) {
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  390  			if (result->error) {
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  391  				err = -(int) result->error;
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  392  				if (err != ERR_ECMDUNKNOWN ||
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  393  						cmd != CMD_CAPABILITY)
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  394  					pr_err("%s:Error %d devcmd %d\n",
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  395  						pci_name(vdev->pdev),
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  396  						err, _CMD_N(cmd));
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  397  				return err;
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  398  			}
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  399  			if (_CMD_DIR(cmd) & _CMD_DIR_READ) {
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  400  				rmb(); /*prevent reorder while reding result*/
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  401  				for (i = 0; i < VNIC_DEVCMD_NARGS; i++)
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  402  					vdev->args[i] = result->results[i];
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  403  			}
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  404  			return 0;
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  405  		}
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  406  	}
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  407  
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  408  	pr_err("%s:Timed out devcmd %d\n", pci_name(vdev->pdev), _CMD_N(cmd));
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  409  
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  410  	return -ETIMEDOUT;
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  411  }
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  412  

:::::: The code at line 332 was first introduced by commit
:::::: 0a2fdd2215e1fa3b417792bd6e9cb719822cbfb6 scsi: fnic: Adding devcmd2 init and posting interfaces

:::::: TO: Satish Kharat <satishkh@cisco.com>
:::::: CC: Martin K. Petersen <martin.petersen@oracle.com>

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

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 38067 bytes --]

^ permalink raw reply	[flat|nested] 17+ messages in thread

* drivers/scsi/fnic/vnic_dev.c:332:32: sparse: sparse: incorrect type in argument 1 (different address spaces)
@ 2023-12-09 12:06 kernel test robot
  0 siblings, 0 replies; 17+ messages in thread
From: kernel test robot @ 2023-12-09 12:06 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: oe-kbuild-all, linux-kernel, Andrew Morton,
	Linux Memory Management List, Geert Uytterhoeven, Arnd Bergmann

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   f2e8a57ee9036c7d5443382b6c3c09b51a92ec7e
commit: 8f28ca6bd8211214faf717677bbffe375c2a6072 iomap: constify ioreadX() iomem argument (as in generic implementation)
date:   3 years, 4 months ago
config: x86_64-randconfig-123-20231025 (https://download.01.org/0day-ci/archive/20231209/202312091944.YpTxxc5g-lkp@intel.com/config)
compiler: gcc-11 (Debian 11.3.0-12) 11.3.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20231209/202312091944.YpTxxc5g-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/202312091944.YpTxxc5g-lkp@intel.com/

sparse warnings: (new ones prefixed by >>)
>> drivers/scsi/fnic/vnic_dev.c:332:32: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void const [noderef] __iomem * @@     got unsigned int * @@
   drivers/scsi/fnic/vnic_dev.c:332:32: sparse:     expected void const [noderef] __iomem *
   drivers/scsi/fnic/vnic_dev.c:332:32: sparse:     got unsigned int *
   drivers/scsi/fnic/vnic_dev.c:333:37: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void const [noderef] __iomem * @@     got unsigned int * @@
   drivers/scsi/fnic/vnic_dev.c:333:37: sparse:     expected void const [noderef] __iomem *
   drivers/scsi/fnic/vnic_dev.c:333:37: sparse:     got unsigned int *
   drivers/scsi/fnic/vnic_dev.c:373:36: sparse: sparse: incorrect type in argument 2 (different address spaces) @@     expected void [noderef] __iomem * @@     got unsigned int * @@
   drivers/scsi/fnic/vnic_dev.c:373:36: sparse:     expected void [noderef] __iomem *
   drivers/scsi/fnic/vnic_dev.c:373:36: sparse:     got unsigned int *
   drivers/scsi/fnic/vnic_dev.c:469:32: sparse: sparse: incorrect type in assignment (different address spaces) @@     expected struct vnic_wq_ctrl *wq_ctrl @@     got struct vnic_wq_ctrl [noderef] __iomem *ctrl @@
   drivers/scsi/fnic/vnic_dev.c:469:32: sparse:     expected struct vnic_wq_ctrl *wq_ctrl
   drivers/scsi/fnic/vnic_dev.c:469:32: sparse:     got struct vnic_wq_ctrl [noderef] __iomem *ctrl
   drivers/scsi/fnic/vnic_dev.c:943:11: sparse: sparse: incorrect type in assignment (different address spaces) @@     expected void *p @@     got void [noderef] __iomem * @@
   drivers/scsi/fnic/vnic_dev.c:943:11: sparse:     expected void *p
   drivers/scsi/fnic/vnic_dev.c:943:11: sparse:     got void [noderef] __iomem *

vim +332 drivers/scsi/fnic/vnic_dev.c

5df6d737dd4b0f Abhijeet Joglekar 2009-04-17  318  
363f4d937501ba Jason Yan         2020-04-15  319  static int vnic_dev_cmd2(struct vnic_dev *vdev, enum vnic_devcmd_cmd cmd,
0a2fdd2215e1fa Satish Kharat     2019-01-18  320  		int wait)
0a2fdd2215e1fa Satish Kharat     2019-01-18  321  {
0a2fdd2215e1fa Satish Kharat     2019-01-18  322  	struct devcmd2_controller *dc2c = vdev->devcmd2;
0a2fdd2215e1fa Satish Kharat     2019-01-18  323  	struct devcmd2_result *result;
0a2fdd2215e1fa Satish Kharat     2019-01-18  324  	u8 color;
0a2fdd2215e1fa Satish Kharat     2019-01-18  325  	unsigned int i;
0a2fdd2215e1fa Satish Kharat     2019-01-18  326  	int delay;
0a2fdd2215e1fa Satish Kharat     2019-01-18  327  	int err;
0a2fdd2215e1fa Satish Kharat     2019-01-18  328  	u32 fetch_index;
0a2fdd2215e1fa Satish Kharat     2019-01-18  329  	u32 posted;
0a2fdd2215e1fa Satish Kharat     2019-01-18  330  	u32 new_posted;
0a2fdd2215e1fa Satish Kharat     2019-01-18  331  
0a2fdd2215e1fa Satish Kharat     2019-01-18 @332  	posted = ioread32(&dc2c->wq_ctrl->posted_index);
0a2fdd2215e1fa Satish Kharat     2019-01-18  333  	fetch_index = ioread32(&dc2c->wq_ctrl->fetch_index);
0a2fdd2215e1fa Satish Kharat     2019-01-18  334  
0a2fdd2215e1fa Satish Kharat     2019-01-18  335  	if (posted == 0xFFFFFFFF || fetch_index == 0xFFFFFFFF) {
0a2fdd2215e1fa Satish Kharat     2019-01-18  336  		/* Hardware surprise removal: return error */
0a2fdd2215e1fa Satish Kharat     2019-01-18  337  		pr_err("%s: devcmd2 invalid posted or fetch index on cmd %d\n",
0a2fdd2215e1fa Satish Kharat     2019-01-18  338  				pci_name(vdev->pdev), _CMD_N(cmd));
0a2fdd2215e1fa Satish Kharat     2019-01-18  339  		pr_err("%s: fetch index: %u, posted index: %u\n",
0a2fdd2215e1fa Satish Kharat     2019-01-18  340  				pci_name(vdev->pdev), fetch_index, posted);
0a2fdd2215e1fa Satish Kharat     2019-01-18  341  
0a2fdd2215e1fa Satish Kharat     2019-01-18  342  		return -ENODEV;
0a2fdd2215e1fa Satish Kharat     2019-01-18  343  
0a2fdd2215e1fa Satish Kharat     2019-01-18  344  	}
0a2fdd2215e1fa Satish Kharat     2019-01-18  345  
0a2fdd2215e1fa Satish Kharat     2019-01-18  346  	new_posted = (posted + 1) % DEVCMD2_RING_SIZE;
0a2fdd2215e1fa Satish Kharat     2019-01-18  347  
0a2fdd2215e1fa Satish Kharat     2019-01-18  348  	if (new_posted == fetch_index) {
0a2fdd2215e1fa Satish Kharat     2019-01-18  349  		pr_err("%s: devcmd2 wq full while issuing cmd %d\n",
0a2fdd2215e1fa Satish Kharat     2019-01-18  350  				pci_name(vdev->pdev), _CMD_N(cmd));
0a2fdd2215e1fa Satish Kharat     2019-01-18  351  		pr_err("%s: fetch index: %u, posted index: %u\n",
0a2fdd2215e1fa Satish Kharat     2019-01-18  352  				pci_name(vdev->pdev), fetch_index, posted);
0a2fdd2215e1fa Satish Kharat     2019-01-18  353  		return -EBUSY;
0a2fdd2215e1fa Satish Kharat     2019-01-18  354  
0a2fdd2215e1fa Satish Kharat     2019-01-18  355  	}
0a2fdd2215e1fa Satish Kharat     2019-01-18  356  	dc2c->cmd_ring[posted].cmd = cmd;
0a2fdd2215e1fa Satish Kharat     2019-01-18  357  	dc2c->cmd_ring[posted].flags = 0;
0a2fdd2215e1fa Satish Kharat     2019-01-18  358  
0a2fdd2215e1fa Satish Kharat     2019-01-18  359  	if ((_CMD_FLAGS(cmd) & _CMD_FLAGS_NOWAIT))
0a2fdd2215e1fa Satish Kharat     2019-01-18  360  		dc2c->cmd_ring[posted].flags |= DEVCMD2_FNORESULT;
0a2fdd2215e1fa Satish Kharat     2019-01-18  361  	if (_CMD_DIR(cmd) & _CMD_DIR_WRITE) {
0a2fdd2215e1fa Satish Kharat     2019-01-18  362  		for (i = 0; i < VNIC_DEVCMD_NARGS; i++)
0a2fdd2215e1fa Satish Kharat     2019-01-18  363  			dc2c->cmd_ring[posted].args[i] = vdev->args[i];
0a2fdd2215e1fa Satish Kharat     2019-01-18  364  
0a2fdd2215e1fa Satish Kharat     2019-01-18  365  	}
0a2fdd2215e1fa Satish Kharat     2019-01-18  366  
0a2fdd2215e1fa Satish Kharat     2019-01-18  367  	/* Adding write memory barrier prevents compiler and/or CPU
0a2fdd2215e1fa Satish Kharat     2019-01-18  368  	 * reordering, thus avoiding descriptor posting before
0a2fdd2215e1fa Satish Kharat     2019-01-18  369  	 * descriptor is initialized. Otherwise, hardware can read
0a2fdd2215e1fa Satish Kharat     2019-01-18  370  	 * stale descriptor fields.
0a2fdd2215e1fa Satish Kharat     2019-01-18  371  	 */
0a2fdd2215e1fa Satish Kharat     2019-01-18  372  	wmb();
0a2fdd2215e1fa Satish Kharat     2019-01-18  373  	iowrite32(new_posted, &dc2c->wq_ctrl->posted_index);
0a2fdd2215e1fa Satish Kharat     2019-01-18  374  
0a2fdd2215e1fa Satish Kharat     2019-01-18  375  	if (dc2c->cmd_ring[posted].flags & DEVCMD2_FNORESULT)
0a2fdd2215e1fa Satish Kharat     2019-01-18  376  		return 0;
0a2fdd2215e1fa Satish Kharat     2019-01-18  377  
0a2fdd2215e1fa Satish Kharat     2019-01-18  378  	result = dc2c->result + dc2c->next_result;
0a2fdd2215e1fa Satish Kharat     2019-01-18  379  	color = dc2c->color;
0a2fdd2215e1fa Satish Kharat     2019-01-18  380  
0a2fdd2215e1fa Satish Kharat     2019-01-18  381  	dc2c->next_result++;
0a2fdd2215e1fa Satish Kharat     2019-01-18  382  	if (dc2c->next_result == dc2c->result_size) {
0a2fdd2215e1fa Satish Kharat     2019-01-18  383  		dc2c->next_result = 0;
0a2fdd2215e1fa Satish Kharat     2019-01-18  384  		dc2c->color = dc2c->color ? 0 : 1;
0a2fdd2215e1fa Satish Kharat     2019-01-18  385  	}
0a2fdd2215e1fa Satish Kharat     2019-01-18  386  
0a2fdd2215e1fa Satish Kharat     2019-01-18  387  	for (delay = 0; delay < wait; delay++) {
0a2fdd2215e1fa Satish Kharat     2019-01-18  388  		udelay(100);
0a2fdd2215e1fa Satish Kharat     2019-01-18  389  		if (result->color == color) {
0a2fdd2215e1fa Satish Kharat     2019-01-18  390  			if (result->error) {
0a2fdd2215e1fa Satish Kharat     2019-01-18  391  				err = -(int) result->error;
0a2fdd2215e1fa Satish Kharat     2019-01-18  392  				if (err != ERR_ECMDUNKNOWN ||
0a2fdd2215e1fa Satish Kharat     2019-01-18  393  						cmd != CMD_CAPABILITY)
0a2fdd2215e1fa Satish Kharat     2019-01-18  394  					pr_err("%s:Error %d devcmd %d\n",
0a2fdd2215e1fa Satish Kharat     2019-01-18  395  						pci_name(vdev->pdev),
0a2fdd2215e1fa Satish Kharat     2019-01-18  396  						err, _CMD_N(cmd));
0a2fdd2215e1fa Satish Kharat     2019-01-18  397  				return err;
0a2fdd2215e1fa Satish Kharat     2019-01-18  398  			}
0a2fdd2215e1fa Satish Kharat     2019-01-18  399  			if (_CMD_DIR(cmd) & _CMD_DIR_READ) {
0a2fdd2215e1fa Satish Kharat     2019-01-18  400  				rmb(); /*prevent reorder while reding result*/
0a2fdd2215e1fa Satish Kharat     2019-01-18  401  				for (i = 0; i < VNIC_DEVCMD_NARGS; i++)
0a2fdd2215e1fa Satish Kharat     2019-01-18  402  					vdev->args[i] = result->results[i];
0a2fdd2215e1fa Satish Kharat     2019-01-18  403  			}
0a2fdd2215e1fa Satish Kharat     2019-01-18  404  			return 0;
0a2fdd2215e1fa Satish Kharat     2019-01-18  405  		}
0a2fdd2215e1fa Satish Kharat     2019-01-18  406  	}
0a2fdd2215e1fa Satish Kharat     2019-01-18  407  
0a2fdd2215e1fa Satish Kharat     2019-01-18  408  	pr_err("%s:Timed out devcmd %d\n", pci_name(vdev->pdev), _CMD_N(cmd));
0a2fdd2215e1fa Satish Kharat     2019-01-18  409  
0a2fdd2215e1fa Satish Kharat     2019-01-18  410  	return -ETIMEDOUT;
0a2fdd2215e1fa Satish Kharat     2019-01-18  411  }
0a2fdd2215e1fa Satish Kharat     2019-01-18  412  

:::::: The code at line 332 was first introduced by commit
:::::: 0a2fdd2215e1fa3b417792bd6e9cb719822cbfb6 scsi: fnic: Adding devcmd2 init and posting interfaces

:::::: TO: Satish Kharat <satishkh@cisco.com>
:::::: CC: Martin K. Petersen <martin.petersen@oracle.com>

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki


^ permalink raw reply	[flat|nested] 17+ messages in thread

* drivers/scsi/fnic/vnic_dev.c:332:32: sparse: sparse: incorrect type in argument 1 (different address spaces)
@ 2023-12-04 23:49 kernel test robot
  0 siblings, 0 replies; 17+ messages in thread
From: kernel test robot @ 2023-12-04 23:49 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: oe-kbuild-all, linux-kernel, Andrew Morton,
	Linux Memory Management List, Geert Uytterhoeven, Arnd Bergmann

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   bee0e7762ad2c6025b9f5245c040fcc36ef2bde8
commit: 8f28ca6bd8211214faf717677bbffe375c2a6072 iomap: constify ioreadX() iomem argument (as in generic implementation)
date:   3 years, 4 months ago
config: x86_64-randconfig-123-20231025 (https://download.01.org/0day-ci/archive/20231205/202312050758.btNPkqxI-lkp@intel.com/config)
compiler: gcc-11 (Debian 11.3.0-12) 11.3.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20231205/202312050758.btNPkqxI-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/202312050758.btNPkqxI-lkp@intel.com/

sparse warnings: (new ones prefixed by >>)
>> drivers/scsi/fnic/vnic_dev.c:332:32: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void const [noderef] __iomem * @@     got unsigned int * @@
   drivers/scsi/fnic/vnic_dev.c:332:32: sparse:     expected void const [noderef] __iomem *
   drivers/scsi/fnic/vnic_dev.c:332:32: sparse:     got unsigned int *
   drivers/scsi/fnic/vnic_dev.c:333:37: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void const [noderef] __iomem * @@     got unsigned int * @@
   drivers/scsi/fnic/vnic_dev.c:333:37: sparse:     expected void const [noderef] __iomem *
   drivers/scsi/fnic/vnic_dev.c:333:37: sparse:     got unsigned int *
   drivers/scsi/fnic/vnic_dev.c:373:36: sparse: sparse: incorrect type in argument 2 (different address spaces) @@     expected void [noderef] __iomem * @@     got unsigned int * @@
   drivers/scsi/fnic/vnic_dev.c:373:36: sparse:     expected void [noderef] __iomem *
   drivers/scsi/fnic/vnic_dev.c:373:36: sparse:     got unsigned int *
   drivers/scsi/fnic/vnic_dev.c:469:32: sparse: sparse: incorrect type in assignment (different address spaces) @@     expected struct vnic_wq_ctrl *wq_ctrl @@     got struct vnic_wq_ctrl [noderef] __iomem *ctrl @@
   drivers/scsi/fnic/vnic_dev.c:469:32: sparse:     expected struct vnic_wq_ctrl *wq_ctrl
   drivers/scsi/fnic/vnic_dev.c:469:32: sparse:     got struct vnic_wq_ctrl [noderef] __iomem *ctrl
   drivers/scsi/fnic/vnic_dev.c:943:11: sparse: sparse: incorrect type in assignment (different address spaces) @@     expected void *p @@     got void [noderef] __iomem * @@
   drivers/scsi/fnic/vnic_dev.c:943:11: sparse:     expected void *p
   drivers/scsi/fnic/vnic_dev.c:943:11: sparse:     got void [noderef] __iomem *

vim +332 drivers/scsi/fnic/vnic_dev.c

5df6d737dd4b0f Abhijeet Joglekar 2009-04-17  318  
363f4d937501ba Jason Yan         2020-04-15  319  static int vnic_dev_cmd2(struct vnic_dev *vdev, enum vnic_devcmd_cmd cmd,
0a2fdd2215e1fa Satish Kharat     2019-01-18  320  		int wait)
0a2fdd2215e1fa Satish Kharat     2019-01-18  321  {
0a2fdd2215e1fa Satish Kharat     2019-01-18  322  	struct devcmd2_controller *dc2c = vdev->devcmd2;
0a2fdd2215e1fa Satish Kharat     2019-01-18  323  	struct devcmd2_result *result;
0a2fdd2215e1fa Satish Kharat     2019-01-18  324  	u8 color;
0a2fdd2215e1fa Satish Kharat     2019-01-18  325  	unsigned int i;
0a2fdd2215e1fa Satish Kharat     2019-01-18  326  	int delay;
0a2fdd2215e1fa Satish Kharat     2019-01-18  327  	int err;
0a2fdd2215e1fa Satish Kharat     2019-01-18  328  	u32 fetch_index;
0a2fdd2215e1fa Satish Kharat     2019-01-18  329  	u32 posted;
0a2fdd2215e1fa Satish Kharat     2019-01-18  330  	u32 new_posted;
0a2fdd2215e1fa Satish Kharat     2019-01-18  331  
0a2fdd2215e1fa Satish Kharat     2019-01-18 @332  	posted = ioread32(&dc2c->wq_ctrl->posted_index);
0a2fdd2215e1fa Satish Kharat     2019-01-18  333  	fetch_index = ioread32(&dc2c->wq_ctrl->fetch_index);
0a2fdd2215e1fa Satish Kharat     2019-01-18  334  
0a2fdd2215e1fa Satish Kharat     2019-01-18  335  	if (posted == 0xFFFFFFFF || fetch_index == 0xFFFFFFFF) {
0a2fdd2215e1fa Satish Kharat     2019-01-18  336  		/* Hardware surprise removal: return error */
0a2fdd2215e1fa Satish Kharat     2019-01-18  337  		pr_err("%s: devcmd2 invalid posted or fetch index on cmd %d\n",
0a2fdd2215e1fa Satish Kharat     2019-01-18  338  				pci_name(vdev->pdev), _CMD_N(cmd));
0a2fdd2215e1fa Satish Kharat     2019-01-18  339  		pr_err("%s: fetch index: %u, posted index: %u\n",
0a2fdd2215e1fa Satish Kharat     2019-01-18  340  				pci_name(vdev->pdev), fetch_index, posted);
0a2fdd2215e1fa Satish Kharat     2019-01-18  341  
0a2fdd2215e1fa Satish Kharat     2019-01-18  342  		return -ENODEV;
0a2fdd2215e1fa Satish Kharat     2019-01-18  343  
0a2fdd2215e1fa Satish Kharat     2019-01-18  344  	}
0a2fdd2215e1fa Satish Kharat     2019-01-18  345  
0a2fdd2215e1fa Satish Kharat     2019-01-18  346  	new_posted = (posted + 1) % DEVCMD2_RING_SIZE;
0a2fdd2215e1fa Satish Kharat     2019-01-18  347  
0a2fdd2215e1fa Satish Kharat     2019-01-18  348  	if (new_posted == fetch_index) {
0a2fdd2215e1fa Satish Kharat     2019-01-18  349  		pr_err("%s: devcmd2 wq full while issuing cmd %d\n",
0a2fdd2215e1fa Satish Kharat     2019-01-18  350  				pci_name(vdev->pdev), _CMD_N(cmd));
0a2fdd2215e1fa Satish Kharat     2019-01-18  351  		pr_err("%s: fetch index: %u, posted index: %u\n",
0a2fdd2215e1fa Satish Kharat     2019-01-18  352  				pci_name(vdev->pdev), fetch_index, posted);
0a2fdd2215e1fa Satish Kharat     2019-01-18  353  		return -EBUSY;
0a2fdd2215e1fa Satish Kharat     2019-01-18  354  
0a2fdd2215e1fa Satish Kharat     2019-01-18  355  	}
0a2fdd2215e1fa Satish Kharat     2019-01-18  356  	dc2c->cmd_ring[posted].cmd = cmd;
0a2fdd2215e1fa Satish Kharat     2019-01-18  357  	dc2c->cmd_ring[posted].flags = 0;
0a2fdd2215e1fa Satish Kharat     2019-01-18  358  
0a2fdd2215e1fa Satish Kharat     2019-01-18  359  	if ((_CMD_FLAGS(cmd) & _CMD_FLAGS_NOWAIT))
0a2fdd2215e1fa Satish Kharat     2019-01-18  360  		dc2c->cmd_ring[posted].flags |= DEVCMD2_FNORESULT;
0a2fdd2215e1fa Satish Kharat     2019-01-18  361  	if (_CMD_DIR(cmd) & _CMD_DIR_WRITE) {
0a2fdd2215e1fa Satish Kharat     2019-01-18  362  		for (i = 0; i < VNIC_DEVCMD_NARGS; i++)
0a2fdd2215e1fa Satish Kharat     2019-01-18  363  			dc2c->cmd_ring[posted].args[i] = vdev->args[i];
0a2fdd2215e1fa Satish Kharat     2019-01-18  364  
0a2fdd2215e1fa Satish Kharat     2019-01-18  365  	}
0a2fdd2215e1fa Satish Kharat     2019-01-18  366  
0a2fdd2215e1fa Satish Kharat     2019-01-18  367  	/* Adding write memory barrier prevents compiler and/or CPU
0a2fdd2215e1fa Satish Kharat     2019-01-18  368  	 * reordering, thus avoiding descriptor posting before
0a2fdd2215e1fa Satish Kharat     2019-01-18  369  	 * descriptor is initialized. Otherwise, hardware can read
0a2fdd2215e1fa Satish Kharat     2019-01-18  370  	 * stale descriptor fields.
0a2fdd2215e1fa Satish Kharat     2019-01-18  371  	 */
0a2fdd2215e1fa Satish Kharat     2019-01-18  372  	wmb();
0a2fdd2215e1fa Satish Kharat     2019-01-18  373  	iowrite32(new_posted, &dc2c->wq_ctrl->posted_index);
0a2fdd2215e1fa Satish Kharat     2019-01-18  374  
0a2fdd2215e1fa Satish Kharat     2019-01-18  375  	if (dc2c->cmd_ring[posted].flags & DEVCMD2_FNORESULT)
0a2fdd2215e1fa Satish Kharat     2019-01-18  376  		return 0;
0a2fdd2215e1fa Satish Kharat     2019-01-18  377  
0a2fdd2215e1fa Satish Kharat     2019-01-18  378  	result = dc2c->result + dc2c->next_result;
0a2fdd2215e1fa Satish Kharat     2019-01-18  379  	color = dc2c->color;
0a2fdd2215e1fa Satish Kharat     2019-01-18  380  
0a2fdd2215e1fa Satish Kharat     2019-01-18  381  	dc2c->next_result++;
0a2fdd2215e1fa Satish Kharat     2019-01-18  382  	if (dc2c->next_result == dc2c->result_size) {
0a2fdd2215e1fa Satish Kharat     2019-01-18  383  		dc2c->next_result = 0;
0a2fdd2215e1fa Satish Kharat     2019-01-18  384  		dc2c->color = dc2c->color ? 0 : 1;
0a2fdd2215e1fa Satish Kharat     2019-01-18  385  	}
0a2fdd2215e1fa Satish Kharat     2019-01-18  386  
0a2fdd2215e1fa Satish Kharat     2019-01-18  387  	for (delay = 0; delay < wait; delay++) {
0a2fdd2215e1fa Satish Kharat     2019-01-18  388  		udelay(100);
0a2fdd2215e1fa Satish Kharat     2019-01-18  389  		if (result->color == color) {
0a2fdd2215e1fa Satish Kharat     2019-01-18  390  			if (result->error) {
0a2fdd2215e1fa Satish Kharat     2019-01-18  391  				err = -(int) result->error;
0a2fdd2215e1fa Satish Kharat     2019-01-18  392  				if (err != ERR_ECMDUNKNOWN ||
0a2fdd2215e1fa Satish Kharat     2019-01-18  393  						cmd != CMD_CAPABILITY)
0a2fdd2215e1fa Satish Kharat     2019-01-18  394  					pr_err("%s:Error %d devcmd %d\n",
0a2fdd2215e1fa Satish Kharat     2019-01-18  395  						pci_name(vdev->pdev),
0a2fdd2215e1fa Satish Kharat     2019-01-18  396  						err, _CMD_N(cmd));
0a2fdd2215e1fa Satish Kharat     2019-01-18  397  				return err;
0a2fdd2215e1fa Satish Kharat     2019-01-18  398  			}
0a2fdd2215e1fa Satish Kharat     2019-01-18  399  			if (_CMD_DIR(cmd) & _CMD_DIR_READ) {
0a2fdd2215e1fa Satish Kharat     2019-01-18  400  				rmb(); /*prevent reorder while reding result*/
0a2fdd2215e1fa Satish Kharat     2019-01-18  401  				for (i = 0; i < VNIC_DEVCMD_NARGS; i++)
0a2fdd2215e1fa Satish Kharat     2019-01-18  402  					vdev->args[i] = result->results[i];
0a2fdd2215e1fa Satish Kharat     2019-01-18  403  			}
0a2fdd2215e1fa Satish Kharat     2019-01-18  404  			return 0;
0a2fdd2215e1fa Satish Kharat     2019-01-18  405  		}
0a2fdd2215e1fa Satish Kharat     2019-01-18  406  	}
0a2fdd2215e1fa Satish Kharat     2019-01-18  407  
0a2fdd2215e1fa Satish Kharat     2019-01-18  408  	pr_err("%s:Timed out devcmd %d\n", pci_name(vdev->pdev), _CMD_N(cmd));
0a2fdd2215e1fa Satish Kharat     2019-01-18  409  
0a2fdd2215e1fa Satish Kharat     2019-01-18  410  	return -ETIMEDOUT;
0a2fdd2215e1fa Satish Kharat     2019-01-18  411  }
0a2fdd2215e1fa Satish Kharat     2019-01-18  412  

:::::: The code at line 332 was first introduced by commit
:::::: 0a2fdd2215e1fa3b417792bd6e9cb719822cbfb6 scsi: fnic: Adding devcmd2 init and posting interfaces

:::::: TO: Satish Kharat <satishkh@cisco.com>
:::::: CC: Martin K. Petersen <martin.petersen@oracle.com>

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki


^ permalink raw reply	[flat|nested] 17+ messages in thread

* drivers/scsi/fnic/vnic_dev.c:332:32: sparse: sparse: incorrect type in argument 1 (different address spaces)
@ 2023-11-16  1:29 kernel test robot
  0 siblings, 0 replies; 17+ messages in thread
From: kernel test robot @ 2023-11-16  1:29 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: oe-kbuild-all, linux-kernel, Andrew Morton,
	Linux Memory Management List, Geert Uytterhoeven, Arnd Bergmann

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   c42d9eeef8e5ba9292eda36fd8e3c11f35ee065c
commit: 8f28ca6bd8211214faf717677bbffe375c2a6072 iomap: constify ioreadX() iomem argument (as in generic implementation)
date:   3 years, 3 months ago
config: x86_64-randconfig-123-20231025 (https://download.01.org/0day-ci/archive/20231116/202311160925.myxbPCA4-lkp@intel.com/config)
compiler: gcc-11 (Debian 11.3.0-12) 11.3.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20231116/202311160925.myxbPCA4-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/202311160925.myxbPCA4-lkp@intel.com/

sparse warnings: (new ones prefixed by >>)
>> drivers/scsi/fnic/vnic_dev.c:332:32: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void const [noderef] __iomem * @@     got unsigned int * @@
   drivers/scsi/fnic/vnic_dev.c:332:32: sparse:     expected void const [noderef] __iomem *
   drivers/scsi/fnic/vnic_dev.c:332:32: sparse:     got unsigned int *
   drivers/scsi/fnic/vnic_dev.c:333:37: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void const [noderef] __iomem * @@     got unsigned int * @@
   drivers/scsi/fnic/vnic_dev.c:333:37: sparse:     expected void const [noderef] __iomem *
   drivers/scsi/fnic/vnic_dev.c:333:37: sparse:     got unsigned int *
   drivers/scsi/fnic/vnic_dev.c:373:36: sparse: sparse: incorrect type in argument 2 (different address spaces) @@     expected void [noderef] __iomem * @@     got unsigned int * @@
   drivers/scsi/fnic/vnic_dev.c:373:36: sparse:     expected void [noderef] __iomem *
   drivers/scsi/fnic/vnic_dev.c:373:36: sparse:     got unsigned int *
   drivers/scsi/fnic/vnic_dev.c:469:32: sparse: sparse: incorrect type in assignment (different address spaces) @@     expected struct vnic_wq_ctrl *wq_ctrl @@     got struct vnic_wq_ctrl [noderef] __iomem *ctrl @@
   drivers/scsi/fnic/vnic_dev.c:469:32: sparse:     expected struct vnic_wq_ctrl *wq_ctrl
   drivers/scsi/fnic/vnic_dev.c:469:32: sparse:     got struct vnic_wq_ctrl [noderef] __iomem *ctrl
   drivers/scsi/fnic/vnic_dev.c:943:11: sparse: sparse: incorrect type in assignment (different address spaces) @@     expected void *p @@     got void [noderef] __iomem * @@
   drivers/scsi/fnic/vnic_dev.c:943:11: sparse:     expected void *p
   drivers/scsi/fnic/vnic_dev.c:943:11: sparse:     got void [noderef] __iomem *

vim +332 drivers/scsi/fnic/vnic_dev.c

5df6d737dd4b0fe9 Abhijeet Joglekar 2009-04-17  318  
363f4d937501ba46 Jason Yan         2020-04-15  319  static int vnic_dev_cmd2(struct vnic_dev *vdev, enum vnic_devcmd_cmd cmd,
0a2fdd2215e1fa3b Satish Kharat     2019-01-18  320  		int wait)
0a2fdd2215e1fa3b Satish Kharat     2019-01-18  321  {
0a2fdd2215e1fa3b Satish Kharat     2019-01-18  322  	struct devcmd2_controller *dc2c = vdev->devcmd2;
0a2fdd2215e1fa3b Satish Kharat     2019-01-18  323  	struct devcmd2_result *result;
0a2fdd2215e1fa3b Satish Kharat     2019-01-18  324  	u8 color;
0a2fdd2215e1fa3b Satish Kharat     2019-01-18  325  	unsigned int i;
0a2fdd2215e1fa3b Satish Kharat     2019-01-18  326  	int delay;
0a2fdd2215e1fa3b Satish Kharat     2019-01-18  327  	int err;
0a2fdd2215e1fa3b Satish Kharat     2019-01-18  328  	u32 fetch_index;
0a2fdd2215e1fa3b Satish Kharat     2019-01-18  329  	u32 posted;
0a2fdd2215e1fa3b Satish Kharat     2019-01-18  330  	u32 new_posted;
0a2fdd2215e1fa3b Satish Kharat     2019-01-18  331  
0a2fdd2215e1fa3b Satish Kharat     2019-01-18 @332  	posted = ioread32(&dc2c->wq_ctrl->posted_index);
0a2fdd2215e1fa3b Satish Kharat     2019-01-18  333  	fetch_index = ioread32(&dc2c->wq_ctrl->fetch_index);
0a2fdd2215e1fa3b Satish Kharat     2019-01-18  334  
0a2fdd2215e1fa3b Satish Kharat     2019-01-18  335  	if (posted == 0xFFFFFFFF || fetch_index == 0xFFFFFFFF) {
0a2fdd2215e1fa3b Satish Kharat     2019-01-18  336  		/* Hardware surprise removal: return error */
0a2fdd2215e1fa3b Satish Kharat     2019-01-18  337  		pr_err("%s: devcmd2 invalid posted or fetch index on cmd %d\n",
0a2fdd2215e1fa3b Satish Kharat     2019-01-18  338  				pci_name(vdev->pdev), _CMD_N(cmd));
0a2fdd2215e1fa3b Satish Kharat     2019-01-18  339  		pr_err("%s: fetch index: %u, posted index: %u\n",
0a2fdd2215e1fa3b Satish Kharat     2019-01-18  340  				pci_name(vdev->pdev), fetch_index, posted);
0a2fdd2215e1fa3b Satish Kharat     2019-01-18  341  
0a2fdd2215e1fa3b Satish Kharat     2019-01-18  342  		return -ENODEV;
0a2fdd2215e1fa3b Satish Kharat     2019-01-18  343  
0a2fdd2215e1fa3b Satish Kharat     2019-01-18  344  	}
0a2fdd2215e1fa3b Satish Kharat     2019-01-18  345  
0a2fdd2215e1fa3b Satish Kharat     2019-01-18  346  	new_posted = (posted + 1) % DEVCMD2_RING_SIZE;
0a2fdd2215e1fa3b Satish Kharat     2019-01-18  347  
0a2fdd2215e1fa3b Satish Kharat     2019-01-18  348  	if (new_posted == fetch_index) {
0a2fdd2215e1fa3b Satish Kharat     2019-01-18  349  		pr_err("%s: devcmd2 wq full while issuing cmd %d\n",
0a2fdd2215e1fa3b Satish Kharat     2019-01-18  350  				pci_name(vdev->pdev), _CMD_N(cmd));
0a2fdd2215e1fa3b Satish Kharat     2019-01-18  351  		pr_err("%s: fetch index: %u, posted index: %u\n",
0a2fdd2215e1fa3b Satish Kharat     2019-01-18  352  				pci_name(vdev->pdev), fetch_index, posted);
0a2fdd2215e1fa3b Satish Kharat     2019-01-18  353  		return -EBUSY;
0a2fdd2215e1fa3b Satish Kharat     2019-01-18  354  
0a2fdd2215e1fa3b Satish Kharat     2019-01-18  355  	}
0a2fdd2215e1fa3b Satish Kharat     2019-01-18  356  	dc2c->cmd_ring[posted].cmd = cmd;
0a2fdd2215e1fa3b Satish Kharat     2019-01-18  357  	dc2c->cmd_ring[posted].flags = 0;
0a2fdd2215e1fa3b Satish Kharat     2019-01-18  358  
0a2fdd2215e1fa3b Satish Kharat     2019-01-18  359  	if ((_CMD_FLAGS(cmd) & _CMD_FLAGS_NOWAIT))
0a2fdd2215e1fa3b Satish Kharat     2019-01-18  360  		dc2c->cmd_ring[posted].flags |= DEVCMD2_FNORESULT;
0a2fdd2215e1fa3b Satish Kharat     2019-01-18  361  	if (_CMD_DIR(cmd) & _CMD_DIR_WRITE) {
0a2fdd2215e1fa3b Satish Kharat     2019-01-18  362  		for (i = 0; i < VNIC_DEVCMD_NARGS; i++)
0a2fdd2215e1fa3b Satish Kharat     2019-01-18  363  			dc2c->cmd_ring[posted].args[i] = vdev->args[i];
0a2fdd2215e1fa3b Satish Kharat     2019-01-18  364  
0a2fdd2215e1fa3b Satish Kharat     2019-01-18  365  	}
0a2fdd2215e1fa3b Satish Kharat     2019-01-18  366  
0a2fdd2215e1fa3b Satish Kharat     2019-01-18  367  	/* Adding write memory barrier prevents compiler and/or CPU
0a2fdd2215e1fa3b Satish Kharat     2019-01-18  368  	 * reordering, thus avoiding descriptor posting before
0a2fdd2215e1fa3b Satish Kharat     2019-01-18  369  	 * descriptor is initialized. Otherwise, hardware can read
0a2fdd2215e1fa3b Satish Kharat     2019-01-18  370  	 * stale descriptor fields.
0a2fdd2215e1fa3b Satish Kharat     2019-01-18  371  	 */
0a2fdd2215e1fa3b Satish Kharat     2019-01-18  372  	wmb();
0a2fdd2215e1fa3b Satish Kharat     2019-01-18  373  	iowrite32(new_posted, &dc2c->wq_ctrl->posted_index);
0a2fdd2215e1fa3b Satish Kharat     2019-01-18  374  
0a2fdd2215e1fa3b Satish Kharat     2019-01-18  375  	if (dc2c->cmd_ring[posted].flags & DEVCMD2_FNORESULT)
0a2fdd2215e1fa3b Satish Kharat     2019-01-18  376  		return 0;
0a2fdd2215e1fa3b Satish Kharat     2019-01-18  377  
0a2fdd2215e1fa3b Satish Kharat     2019-01-18  378  	result = dc2c->result + dc2c->next_result;
0a2fdd2215e1fa3b Satish Kharat     2019-01-18  379  	color = dc2c->color;
0a2fdd2215e1fa3b Satish Kharat     2019-01-18  380  
0a2fdd2215e1fa3b Satish Kharat     2019-01-18  381  	dc2c->next_result++;
0a2fdd2215e1fa3b Satish Kharat     2019-01-18  382  	if (dc2c->next_result == dc2c->result_size) {
0a2fdd2215e1fa3b Satish Kharat     2019-01-18  383  		dc2c->next_result = 0;
0a2fdd2215e1fa3b Satish Kharat     2019-01-18  384  		dc2c->color = dc2c->color ? 0 : 1;
0a2fdd2215e1fa3b Satish Kharat     2019-01-18  385  	}
0a2fdd2215e1fa3b Satish Kharat     2019-01-18  386  
0a2fdd2215e1fa3b Satish Kharat     2019-01-18  387  	for (delay = 0; delay < wait; delay++) {
0a2fdd2215e1fa3b Satish Kharat     2019-01-18  388  		udelay(100);
0a2fdd2215e1fa3b Satish Kharat     2019-01-18  389  		if (result->color == color) {
0a2fdd2215e1fa3b Satish Kharat     2019-01-18  390  			if (result->error) {
0a2fdd2215e1fa3b Satish Kharat     2019-01-18  391  				err = -(int) result->error;
0a2fdd2215e1fa3b Satish Kharat     2019-01-18  392  				if (err != ERR_ECMDUNKNOWN ||
0a2fdd2215e1fa3b Satish Kharat     2019-01-18  393  						cmd != CMD_CAPABILITY)
0a2fdd2215e1fa3b Satish Kharat     2019-01-18  394  					pr_err("%s:Error %d devcmd %d\n",
0a2fdd2215e1fa3b Satish Kharat     2019-01-18  395  						pci_name(vdev->pdev),
0a2fdd2215e1fa3b Satish Kharat     2019-01-18  396  						err, _CMD_N(cmd));
0a2fdd2215e1fa3b Satish Kharat     2019-01-18  397  				return err;
0a2fdd2215e1fa3b Satish Kharat     2019-01-18  398  			}
0a2fdd2215e1fa3b Satish Kharat     2019-01-18  399  			if (_CMD_DIR(cmd) & _CMD_DIR_READ) {
0a2fdd2215e1fa3b Satish Kharat     2019-01-18  400  				rmb(); /*prevent reorder while reding result*/
0a2fdd2215e1fa3b Satish Kharat     2019-01-18  401  				for (i = 0; i < VNIC_DEVCMD_NARGS; i++)
0a2fdd2215e1fa3b Satish Kharat     2019-01-18  402  					vdev->args[i] = result->results[i];
0a2fdd2215e1fa3b Satish Kharat     2019-01-18  403  			}
0a2fdd2215e1fa3b Satish Kharat     2019-01-18  404  			return 0;
0a2fdd2215e1fa3b Satish Kharat     2019-01-18  405  		}
0a2fdd2215e1fa3b Satish Kharat     2019-01-18  406  	}
0a2fdd2215e1fa3b Satish Kharat     2019-01-18  407  
0a2fdd2215e1fa3b Satish Kharat     2019-01-18  408  	pr_err("%s:Timed out devcmd %d\n", pci_name(vdev->pdev), _CMD_N(cmd));
0a2fdd2215e1fa3b Satish Kharat     2019-01-18  409  
0a2fdd2215e1fa3b Satish Kharat     2019-01-18  410  	return -ETIMEDOUT;
0a2fdd2215e1fa3b Satish Kharat     2019-01-18  411  }
0a2fdd2215e1fa3b Satish Kharat     2019-01-18  412  

:::::: The code at line 332 was first introduced by commit
:::::: 0a2fdd2215e1fa3b417792bd6e9cb719822cbfb6 scsi: fnic: Adding devcmd2 init and posting interfaces

:::::: TO: Satish Kharat <satishkh@cisco.com>
:::::: CC: Martin K. Petersen <martin.petersen@oracle.com>

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki


^ permalink raw reply	[flat|nested] 17+ messages in thread

* drivers/scsi/fnic/vnic_dev.c:332:32: sparse: sparse: incorrect type in argument 1 (different address spaces)
@ 2023-11-15 19:01 kernel test robot
  0 siblings, 0 replies; 17+ messages in thread
From: kernel test robot @ 2023-11-15 19:01 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: oe-kbuild-all, linux-kernel, Andrew Morton,
	Linux Memory Management List, Geert Uytterhoeven, Arnd Bergmann

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   c42d9eeef8e5ba9292eda36fd8e3c11f35ee065c
commit: 8f28ca6bd8211214faf717677bbffe375c2a6072 iomap: constify ioreadX() iomem argument (as in generic implementation)
date:   3 years, 3 months ago
config: x86_64-randconfig-123-20231025 (https://download.01.org/0day-ci/archive/20231116/202311160232.mIryRAok-lkp@intel.com/config)
compiler: gcc-11 (Debian 11.3.0-12) 11.3.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20231116/202311160232.mIryRAok-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/202311160232.mIryRAok-lkp@intel.com/

sparse warnings: (new ones prefixed by >>)
>> drivers/scsi/fnic/vnic_dev.c:332:32: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void const [noderef] __iomem * @@     got unsigned int * @@
   drivers/scsi/fnic/vnic_dev.c:332:32: sparse:     expected void const [noderef] __iomem *
   drivers/scsi/fnic/vnic_dev.c:332:32: sparse:     got unsigned int *
   drivers/scsi/fnic/vnic_dev.c:333:37: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void const [noderef] __iomem * @@     got unsigned int * @@
   drivers/scsi/fnic/vnic_dev.c:333:37: sparse:     expected void const [noderef] __iomem *
   drivers/scsi/fnic/vnic_dev.c:333:37: sparse:     got unsigned int *
   drivers/scsi/fnic/vnic_dev.c:373:36: sparse: sparse: incorrect type in argument 2 (different address spaces) @@     expected void [noderef] __iomem * @@     got unsigned int * @@
   drivers/scsi/fnic/vnic_dev.c:373:36: sparse:     expected void [noderef] __iomem *
   drivers/scsi/fnic/vnic_dev.c:373:36: sparse:     got unsigned int *
   drivers/scsi/fnic/vnic_dev.c:469:32: sparse: sparse: incorrect type in assignment (different address spaces) @@     expected struct vnic_wq_ctrl *wq_ctrl @@     got struct vnic_wq_ctrl [noderef] __iomem *ctrl @@
   drivers/scsi/fnic/vnic_dev.c:469:32: sparse:     expected struct vnic_wq_ctrl *wq_ctrl
   drivers/scsi/fnic/vnic_dev.c:469:32: sparse:     got struct vnic_wq_ctrl [noderef] __iomem *ctrl
   drivers/scsi/fnic/vnic_dev.c:943:11: sparse: sparse: incorrect type in assignment (different address spaces) @@     expected void *p @@     got void [noderef] __iomem * @@
   drivers/scsi/fnic/vnic_dev.c:943:11: sparse:     expected void *p
   drivers/scsi/fnic/vnic_dev.c:943:11: sparse:     got void [noderef] __iomem *

vim +332 drivers/scsi/fnic/vnic_dev.c

5df6d737dd4b0f Abhijeet Joglekar 2009-04-17  318  
363f4d937501ba Jason Yan         2020-04-15  319  static int vnic_dev_cmd2(struct vnic_dev *vdev, enum vnic_devcmd_cmd cmd,
0a2fdd2215e1fa Satish Kharat     2019-01-18  320  		int wait)
0a2fdd2215e1fa Satish Kharat     2019-01-18  321  {
0a2fdd2215e1fa Satish Kharat     2019-01-18  322  	struct devcmd2_controller *dc2c = vdev->devcmd2;
0a2fdd2215e1fa Satish Kharat     2019-01-18  323  	struct devcmd2_result *result;
0a2fdd2215e1fa Satish Kharat     2019-01-18  324  	u8 color;
0a2fdd2215e1fa Satish Kharat     2019-01-18  325  	unsigned int i;
0a2fdd2215e1fa Satish Kharat     2019-01-18  326  	int delay;
0a2fdd2215e1fa Satish Kharat     2019-01-18  327  	int err;
0a2fdd2215e1fa Satish Kharat     2019-01-18  328  	u32 fetch_index;
0a2fdd2215e1fa Satish Kharat     2019-01-18  329  	u32 posted;
0a2fdd2215e1fa Satish Kharat     2019-01-18  330  	u32 new_posted;
0a2fdd2215e1fa Satish Kharat     2019-01-18  331  
0a2fdd2215e1fa Satish Kharat     2019-01-18 @332  	posted = ioread32(&dc2c->wq_ctrl->posted_index);
0a2fdd2215e1fa Satish Kharat     2019-01-18  333  	fetch_index = ioread32(&dc2c->wq_ctrl->fetch_index);
0a2fdd2215e1fa Satish Kharat     2019-01-18  334  
0a2fdd2215e1fa Satish Kharat     2019-01-18  335  	if (posted == 0xFFFFFFFF || fetch_index == 0xFFFFFFFF) {
0a2fdd2215e1fa Satish Kharat     2019-01-18  336  		/* Hardware surprise removal: return error */
0a2fdd2215e1fa Satish Kharat     2019-01-18  337  		pr_err("%s: devcmd2 invalid posted or fetch index on cmd %d\n",
0a2fdd2215e1fa Satish Kharat     2019-01-18  338  				pci_name(vdev->pdev), _CMD_N(cmd));
0a2fdd2215e1fa Satish Kharat     2019-01-18  339  		pr_err("%s: fetch index: %u, posted index: %u\n",
0a2fdd2215e1fa Satish Kharat     2019-01-18  340  				pci_name(vdev->pdev), fetch_index, posted);
0a2fdd2215e1fa Satish Kharat     2019-01-18  341  
0a2fdd2215e1fa Satish Kharat     2019-01-18  342  		return -ENODEV;
0a2fdd2215e1fa Satish Kharat     2019-01-18  343  
0a2fdd2215e1fa Satish Kharat     2019-01-18  344  	}
0a2fdd2215e1fa Satish Kharat     2019-01-18  345  
0a2fdd2215e1fa Satish Kharat     2019-01-18  346  	new_posted = (posted + 1) % DEVCMD2_RING_SIZE;
0a2fdd2215e1fa Satish Kharat     2019-01-18  347  
0a2fdd2215e1fa Satish Kharat     2019-01-18  348  	if (new_posted == fetch_index) {
0a2fdd2215e1fa Satish Kharat     2019-01-18  349  		pr_err("%s: devcmd2 wq full while issuing cmd %d\n",
0a2fdd2215e1fa Satish Kharat     2019-01-18  350  				pci_name(vdev->pdev), _CMD_N(cmd));
0a2fdd2215e1fa Satish Kharat     2019-01-18  351  		pr_err("%s: fetch index: %u, posted index: %u\n",
0a2fdd2215e1fa Satish Kharat     2019-01-18  352  				pci_name(vdev->pdev), fetch_index, posted);
0a2fdd2215e1fa Satish Kharat     2019-01-18  353  		return -EBUSY;
0a2fdd2215e1fa Satish Kharat     2019-01-18  354  
0a2fdd2215e1fa Satish Kharat     2019-01-18  355  	}
0a2fdd2215e1fa Satish Kharat     2019-01-18  356  	dc2c->cmd_ring[posted].cmd = cmd;
0a2fdd2215e1fa Satish Kharat     2019-01-18  357  	dc2c->cmd_ring[posted].flags = 0;
0a2fdd2215e1fa Satish Kharat     2019-01-18  358  
0a2fdd2215e1fa Satish Kharat     2019-01-18  359  	if ((_CMD_FLAGS(cmd) & _CMD_FLAGS_NOWAIT))
0a2fdd2215e1fa Satish Kharat     2019-01-18  360  		dc2c->cmd_ring[posted].flags |= DEVCMD2_FNORESULT;
0a2fdd2215e1fa Satish Kharat     2019-01-18  361  	if (_CMD_DIR(cmd) & _CMD_DIR_WRITE) {
0a2fdd2215e1fa Satish Kharat     2019-01-18  362  		for (i = 0; i < VNIC_DEVCMD_NARGS; i++)
0a2fdd2215e1fa Satish Kharat     2019-01-18  363  			dc2c->cmd_ring[posted].args[i] = vdev->args[i];
0a2fdd2215e1fa Satish Kharat     2019-01-18  364  
0a2fdd2215e1fa Satish Kharat     2019-01-18  365  	}
0a2fdd2215e1fa Satish Kharat     2019-01-18  366  
0a2fdd2215e1fa Satish Kharat     2019-01-18  367  	/* Adding write memory barrier prevents compiler and/or CPU
0a2fdd2215e1fa Satish Kharat     2019-01-18  368  	 * reordering, thus avoiding descriptor posting before
0a2fdd2215e1fa Satish Kharat     2019-01-18  369  	 * descriptor is initialized. Otherwise, hardware can read
0a2fdd2215e1fa Satish Kharat     2019-01-18  370  	 * stale descriptor fields.
0a2fdd2215e1fa Satish Kharat     2019-01-18  371  	 */
0a2fdd2215e1fa Satish Kharat     2019-01-18  372  	wmb();
0a2fdd2215e1fa Satish Kharat     2019-01-18  373  	iowrite32(new_posted, &dc2c->wq_ctrl->posted_index);
0a2fdd2215e1fa Satish Kharat     2019-01-18  374  
0a2fdd2215e1fa Satish Kharat     2019-01-18  375  	if (dc2c->cmd_ring[posted].flags & DEVCMD2_FNORESULT)
0a2fdd2215e1fa Satish Kharat     2019-01-18  376  		return 0;
0a2fdd2215e1fa Satish Kharat     2019-01-18  377  
0a2fdd2215e1fa Satish Kharat     2019-01-18  378  	result = dc2c->result + dc2c->next_result;
0a2fdd2215e1fa Satish Kharat     2019-01-18  379  	color = dc2c->color;
0a2fdd2215e1fa Satish Kharat     2019-01-18  380  
0a2fdd2215e1fa Satish Kharat     2019-01-18  381  	dc2c->next_result++;
0a2fdd2215e1fa Satish Kharat     2019-01-18  382  	if (dc2c->next_result == dc2c->result_size) {
0a2fdd2215e1fa Satish Kharat     2019-01-18  383  		dc2c->next_result = 0;
0a2fdd2215e1fa Satish Kharat     2019-01-18  384  		dc2c->color = dc2c->color ? 0 : 1;
0a2fdd2215e1fa Satish Kharat     2019-01-18  385  	}
0a2fdd2215e1fa Satish Kharat     2019-01-18  386  
0a2fdd2215e1fa Satish Kharat     2019-01-18  387  	for (delay = 0; delay < wait; delay++) {
0a2fdd2215e1fa Satish Kharat     2019-01-18  388  		udelay(100);
0a2fdd2215e1fa Satish Kharat     2019-01-18  389  		if (result->color == color) {
0a2fdd2215e1fa Satish Kharat     2019-01-18  390  			if (result->error) {
0a2fdd2215e1fa Satish Kharat     2019-01-18  391  				err = -(int) result->error;
0a2fdd2215e1fa Satish Kharat     2019-01-18  392  				if (err != ERR_ECMDUNKNOWN ||
0a2fdd2215e1fa Satish Kharat     2019-01-18  393  						cmd != CMD_CAPABILITY)
0a2fdd2215e1fa Satish Kharat     2019-01-18  394  					pr_err("%s:Error %d devcmd %d\n",
0a2fdd2215e1fa Satish Kharat     2019-01-18  395  						pci_name(vdev->pdev),
0a2fdd2215e1fa Satish Kharat     2019-01-18  396  						err, _CMD_N(cmd));
0a2fdd2215e1fa Satish Kharat     2019-01-18  397  				return err;
0a2fdd2215e1fa Satish Kharat     2019-01-18  398  			}
0a2fdd2215e1fa Satish Kharat     2019-01-18  399  			if (_CMD_DIR(cmd) & _CMD_DIR_READ) {
0a2fdd2215e1fa Satish Kharat     2019-01-18  400  				rmb(); /*prevent reorder while reding result*/
0a2fdd2215e1fa Satish Kharat     2019-01-18  401  				for (i = 0; i < VNIC_DEVCMD_NARGS; i++)
0a2fdd2215e1fa Satish Kharat     2019-01-18  402  					vdev->args[i] = result->results[i];
0a2fdd2215e1fa Satish Kharat     2019-01-18  403  			}
0a2fdd2215e1fa Satish Kharat     2019-01-18  404  			return 0;
0a2fdd2215e1fa Satish Kharat     2019-01-18  405  		}
0a2fdd2215e1fa Satish Kharat     2019-01-18  406  	}
0a2fdd2215e1fa Satish Kharat     2019-01-18  407  
0a2fdd2215e1fa Satish Kharat     2019-01-18  408  	pr_err("%s:Timed out devcmd %d\n", pci_name(vdev->pdev), _CMD_N(cmd));
0a2fdd2215e1fa Satish Kharat     2019-01-18  409  
0a2fdd2215e1fa Satish Kharat     2019-01-18  410  	return -ETIMEDOUT;
0a2fdd2215e1fa Satish Kharat     2019-01-18  411  }
0a2fdd2215e1fa Satish Kharat     2019-01-18  412  

:::::: The code at line 332 was first introduced by commit
:::::: 0a2fdd2215e1fa3b417792bd6e9cb719822cbfb6 scsi: fnic: Adding devcmd2 init and posting interfaces

:::::: TO: Satish Kharat <satishkh@cisco.com>
:::::: CC: Martin K. Petersen <martin.petersen@oracle.com>

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki


^ permalink raw reply	[flat|nested] 17+ messages in thread

* drivers/scsi/fnic/vnic_dev.c:332:32: sparse: sparse: incorrect type in argument 1 (different address spaces)
@ 2021-04-12 22:02 kernel test robot
  0 siblings, 0 replies; 17+ messages in thread
From: kernel test robot @ 2021-04-12 22:02 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: kbuild-all, linux-kernel, Andrew Morton,
	Linux Memory Management List, Geert Uytterhoeven, Arnd Bergmann

[-- Attachment #1: Type: text/plain, Size: 10511 bytes --]

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   89698becf06d341a700913c3d89ce2a914af69a2
commit: 8f28ca6bd8211214faf717677bbffe375c2a6072 iomap: constify ioreadX() iomem argument (as in generic implementation)
date:   8 months ago
config: x86_64-randconfig-s021-20210413 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
reproduce:
        # apt-get install sparse
        # sparse version: v0.6.3-280-g2cd6d34e-dirty
        # https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=8f28ca6bd8211214faf717677bbffe375c2a6072
        git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
        git fetch --no-tags linus master
        git checkout 8f28ca6bd8211214faf717677bbffe375c2a6072
        # 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@intel.com>


sparse warnings: (new ones prefixed by >>)
>> drivers/scsi/fnic/vnic_dev.c:332:32: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void const [noderef] __iomem * @@     got unsigned int * @@
   drivers/scsi/fnic/vnic_dev.c:332:32: sparse:     expected void const [noderef] __iomem *
   drivers/scsi/fnic/vnic_dev.c:332:32: sparse:     got unsigned int *
   drivers/scsi/fnic/vnic_dev.c:333:37: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void const [noderef] __iomem * @@     got unsigned int * @@
   drivers/scsi/fnic/vnic_dev.c:333:37: sparse:     expected void const [noderef] __iomem *
   drivers/scsi/fnic/vnic_dev.c:333:37: sparse:     got unsigned int *
   drivers/scsi/fnic/vnic_dev.c:373:36: sparse: sparse: incorrect type in argument 2 (different address spaces) @@     expected void [noderef] __iomem * @@     got unsigned int * @@
   drivers/scsi/fnic/vnic_dev.c:373:36: sparse:     expected void [noderef] __iomem *
   drivers/scsi/fnic/vnic_dev.c:373:36: sparse:     got unsigned int *
   drivers/scsi/fnic/vnic_dev.c:469:32: sparse: sparse: incorrect type in assignment (different address spaces) @@     expected struct vnic_wq_ctrl *wq_ctrl @@     got struct vnic_wq_ctrl [noderef] __iomem *ctrl @@
   drivers/scsi/fnic/vnic_dev.c:469:32: sparse:     expected struct vnic_wq_ctrl *wq_ctrl
   drivers/scsi/fnic/vnic_dev.c:469:32: sparse:     got struct vnic_wq_ctrl [noderef] __iomem *ctrl
   drivers/scsi/fnic/vnic_dev.c:943:11: sparse: sparse: incorrect type in assignment (different address spaces) @@     expected void *p @@     got void [noderef] __iomem * @@
   drivers/scsi/fnic/vnic_dev.c:943:11: sparse:     expected void *p
   drivers/scsi/fnic/vnic_dev.c:943:11: sparse:     got void [noderef] __iomem *

vim +332 drivers/scsi/fnic/vnic_dev.c

5df6d737dd4b0f Abhijeet Joglekar 2009-04-17  318  
363f4d937501ba Jason Yan         2020-04-15  319  static int vnic_dev_cmd2(struct vnic_dev *vdev, enum vnic_devcmd_cmd cmd,
0a2fdd2215e1fa Satish Kharat     2019-01-18  320  		int wait)
0a2fdd2215e1fa Satish Kharat     2019-01-18  321  {
0a2fdd2215e1fa Satish Kharat     2019-01-18  322  	struct devcmd2_controller *dc2c = vdev->devcmd2;
0a2fdd2215e1fa Satish Kharat     2019-01-18  323  	struct devcmd2_result *result;
0a2fdd2215e1fa Satish Kharat     2019-01-18  324  	u8 color;
0a2fdd2215e1fa Satish Kharat     2019-01-18  325  	unsigned int i;
0a2fdd2215e1fa Satish Kharat     2019-01-18  326  	int delay;
0a2fdd2215e1fa Satish Kharat     2019-01-18  327  	int err;
0a2fdd2215e1fa Satish Kharat     2019-01-18  328  	u32 fetch_index;
0a2fdd2215e1fa Satish Kharat     2019-01-18  329  	u32 posted;
0a2fdd2215e1fa Satish Kharat     2019-01-18  330  	u32 new_posted;
0a2fdd2215e1fa Satish Kharat     2019-01-18  331  
0a2fdd2215e1fa Satish Kharat     2019-01-18 @332  	posted = ioread32(&dc2c->wq_ctrl->posted_index);
0a2fdd2215e1fa Satish Kharat     2019-01-18  333  	fetch_index = ioread32(&dc2c->wq_ctrl->fetch_index);
0a2fdd2215e1fa Satish Kharat     2019-01-18  334  
0a2fdd2215e1fa Satish Kharat     2019-01-18  335  	if (posted == 0xFFFFFFFF || fetch_index == 0xFFFFFFFF) {
0a2fdd2215e1fa Satish Kharat     2019-01-18  336  		/* Hardware surprise removal: return error */
0a2fdd2215e1fa Satish Kharat     2019-01-18  337  		pr_err("%s: devcmd2 invalid posted or fetch index on cmd %d\n",
0a2fdd2215e1fa Satish Kharat     2019-01-18  338  				pci_name(vdev->pdev), _CMD_N(cmd));
0a2fdd2215e1fa Satish Kharat     2019-01-18  339  		pr_err("%s: fetch index: %u, posted index: %u\n",
0a2fdd2215e1fa Satish Kharat     2019-01-18  340  				pci_name(vdev->pdev), fetch_index, posted);
0a2fdd2215e1fa Satish Kharat     2019-01-18  341  
0a2fdd2215e1fa Satish Kharat     2019-01-18  342  		return -ENODEV;
0a2fdd2215e1fa Satish Kharat     2019-01-18  343  
0a2fdd2215e1fa Satish Kharat     2019-01-18  344  	}
0a2fdd2215e1fa Satish Kharat     2019-01-18  345  
0a2fdd2215e1fa Satish Kharat     2019-01-18  346  	new_posted = (posted + 1) % DEVCMD2_RING_SIZE;
0a2fdd2215e1fa Satish Kharat     2019-01-18  347  
0a2fdd2215e1fa Satish Kharat     2019-01-18  348  	if (new_posted == fetch_index) {
0a2fdd2215e1fa Satish Kharat     2019-01-18  349  		pr_err("%s: devcmd2 wq full while issuing cmd %d\n",
0a2fdd2215e1fa Satish Kharat     2019-01-18  350  				pci_name(vdev->pdev), _CMD_N(cmd));
0a2fdd2215e1fa Satish Kharat     2019-01-18  351  		pr_err("%s: fetch index: %u, posted index: %u\n",
0a2fdd2215e1fa Satish Kharat     2019-01-18  352  				pci_name(vdev->pdev), fetch_index, posted);
0a2fdd2215e1fa Satish Kharat     2019-01-18  353  		return -EBUSY;
0a2fdd2215e1fa Satish Kharat     2019-01-18  354  
0a2fdd2215e1fa Satish Kharat     2019-01-18  355  	}
0a2fdd2215e1fa Satish Kharat     2019-01-18  356  	dc2c->cmd_ring[posted].cmd = cmd;
0a2fdd2215e1fa Satish Kharat     2019-01-18  357  	dc2c->cmd_ring[posted].flags = 0;
0a2fdd2215e1fa Satish Kharat     2019-01-18  358  
0a2fdd2215e1fa Satish Kharat     2019-01-18  359  	if ((_CMD_FLAGS(cmd) & _CMD_FLAGS_NOWAIT))
0a2fdd2215e1fa Satish Kharat     2019-01-18  360  		dc2c->cmd_ring[posted].flags |= DEVCMD2_FNORESULT;
0a2fdd2215e1fa Satish Kharat     2019-01-18  361  	if (_CMD_DIR(cmd) & _CMD_DIR_WRITE) {
0a2fdd2215e1fa Satish Kharat     2019-01-18  362  		for (i = 0; i < VNIC_DEVCMD_NARGS; i++)
0a2fdd2215e1fa Satish Kharat     2019-01-18  363  			dc2c->cmd_ring[posted].args[i] = vdev->args[i];
0a2fdd2215e1fa Satish Kharat     2019-01-18  364  
0a2fdd2215e1fa Satish Kharat     2019-01-18  365  	}
0a2fdd2215e1fa Satish Kharat     2019-01-18  366  
0a2fdd2215e1fa Satish Kharat     2019-01-18  367  	/* Adding write memory barrier prevents compiler and/or CPU
0a2fdd2215e1fa Satish Kharat     2019-01-18  368  	 * reordering, thus avoiding descriptor posting before
0a2fdd2215e1fa Satish Kharat     2019-01-18  369  	 * descriptor is initialized. Otherwise, hardware can read
0a2fdd2215e1fa Satish Kharat     2019-01-18  370  	 * stale descriptor fields.
0a2fdd2215e1fa Satish Kharat     2019-01-18  371  	 */
0a2fdd2215e1fa Satish Kharat     2019-01-18  372  	wmb();
0a2fdd2215e1fa Satish Kharat     2019-01-18  373  	iowrite32(new_posted, &dc2c->wq_ctrl->posted_index);
0a2fdd2215e1fa Satish Kharat     2019-01-18  374  
0a2fdd2215e1fa Satish Kharat     2019-01-18  375  	if (dc2c->cmd_ring[posted].flags & DEVCMD2_FNORESULT)
0a2fdd2215e1fa Satish Kharat     2019-01-18  376  		return 0;
0a2fdd2215e1fa Satish Kharat     2019-01-18  377  
0a2fdd2215e1fa Satish Kharat     2019-01-18  378  	result = dc2c->result + dc2c->next_result;
0a2fdd2215e1fa Satish Kharat     2019-01-18  379  	color = dc2c->color;
0a2fdd2215e1fa Satish Kharat     2019-01-18  380  
0a2fdd2215e1fa Satish Kharat     2019-01-18  381  	dc2c->next_result++;
0a2fdd2215e1fa Satish Kharat     2019-01-18  382  	if (dc2c->next_result == dc2c->result_size) {
0a2fdd2215e1fa Satish Kharat     2019-01-18  383  		dc2c->next_result = 0;
0a2fdd2215e1fa Satish Kharat     2019-01-18  384  		dc2c->color = dc2c->color ? 0 : 1;
0a2fdd2215e1fa Satish Kharat     2019-01-18  385  	}
0a2fdd2215e1fa Satish Kharat     2019-01-18  386  
0a2fdd2215e1fa Satish Kharat     2019-01-18  387  	for (delay = 0; delay < wait; delay++) {
0a2fdd2215e1fa Satish Kharat     2019-01-18  388  		udelay(100);
0a2fdd2215e1fa Satish Kharat     2019-01-18  389  		if (result->color == color) {
0a2fdd2215e1fa Satish Kharat     2019-01-18  390  			if (result->error) {
0a2fdd2215e1fa Satish Kharat     2019-01-18  391  				err = -(int) result->error;
0a2fdd2215e1fa Satish Kharat     2019-01-18  392  				if (err != ERR_ECMDUNKNOWN ||
0a2fdd2215e1fa Satish Kharat     2019-01-18  393  						cmd != CMD_CAPABILITY)
0a2fdd2215e1fa Satish Kharat     2019-01-18  394  					pr_err("%s:Error %d devcmd %d\n",
0a2fdd2215e1fa Satish Kharat     2019-01-18  395  						pci_name(vdev->pdev),
0a2fdd2215e1fa Satish Kharat     2019-01-18  396  						err, _CMD_N(cmd));
0a2fdd2215e1fa Satish Kharat     2019-01-18  397  				return err;
0a2fdd2215e1fa Satish Kharat     2019-01-18  398  			}
0a2fdd2215e1fa Satish Kharat     2019-01-18  399  			if (_CMD_DIR(cmd) & _CMD_DIR_READ) {
0a2fdd2215e1fa Satish Kharat     2019-01-18  400  				rmb(); /*prevent reorder while reding result*/
0a2fdd2215e1fa Satish Kharat     2019-01-18  401  				for (i = 0; i < VNIC_DEVCMD_NARGS; i++)
0a2fdd2215e1fa Satish Kharat     2019-01-18  402  					vdev->args[i] = result->results[i];
0a2fdd2215e1fa Satish Kharat     2019-01-18  403  			}
0a2fdd2215e1fa Satish Kharat     2019-01-18  404  			return 0;
0a2fdd2215e1fa Satish Kharat     2019-01-18  405  		}
0a2fdd2215e1fa Satish Kharat     2019-01-18  406  	}
0a2fdd2215e1fa Satish Kharat     2019-01-18  407  
0a2fdd2215e1fa Satish Kharat     2019-01-18  408  	pr_err("%s:Timed out devcmd %d\n", pci_name(vdev->pdev), _CMD_N(cmd));
0a2fdd2215e1fa Satish Kharat     2019-01-18  409  
0a2fdd2215e1fa Satish Kharat     2019-01-18  410  	return -ETIMEDOUT;
0a2fdd2215e1fa Satish Kharat     2019-01-18  411  }
0a2fdd2215e1fa Satish Kharat     2019-01-18  412  

:::::: The code at line 332 was first introduced by commit
:::::: 0a2fdd2215e1fa3b417792bd6e9cb719822cbfb6 scsi: fnic: Adding devcmd2 init and posting interfaces

:::::: TO: Satish Kharat <satishkh@cisco.com>
:::::: CC: Martin K. Petersen <martin.petersen@oracle.com>

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

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 36071 bytes --]

^ permalink raw reply	[flat|nested] 17+ messages in thread

* drivers/scsi/fnic/vnic_dev.c:332:32: sparse: sparse: incorrect type in argument 1 (different address spaces)
@ 2021-03-07  6:14 kernel test robot
  0 siblings, 0 replies; 17+ messages in thread
From: kernel test robot @ 2021-03-07  6:14 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: kbuild-all, linux-kernel, Andrew Morton,
	Linux Memory Management List, Geert Uytterhoeven, Arnd Bergmann

[-- Attachment #1: Type: text/plain, Size: 10513 bytes --]

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   a38fd8748464831584a19438cbb3082b5a2dab15
commit: 8f28ca6bd8211214faf717677bbffe375c2a6072 iomap: constify ioreadX() iomem argument (as in generic implementation)
date:   7 months ago
config: x86_64-randconfig-s021-20210307 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
reproduce:
        # apt-get install sparse
        # sparse version: v0.6.3-245-gacc5c298-dirty
        # https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=8f28ca6bd8211214faf717677bbffe375c2a6072
        git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
        git fetch --no-tags linus master
        git checkout 8f28ca6bd8211214faf717677bbffe375c2a6072
        # 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@intel.com>


"sparse warnings: (new ones prefixed by >>)"
>> drivers/scsi/fnic/vnic_dev.c:332:32: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void const [noderef] __iomem * @@     got unsigned int * @@
   drivers/scsi/fnic/vnic_dev.c:332:32: sparse:     expected void const [noderef] __iomem *
   drivers/scsi/fnic/vnic_dev.c:332:32: sparse:     got unsigned int *
   drivers/scsi/fnic/vnic_dev.c:333:37: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void const [noderef] __iomem * @@     got unsigned int * @@
   drivers/scsi/fnic/vnic_dev.c:333:37: sparse:     expected void const [noderef] __iomem *
   drivers/scsi/fnic/vnic_dev.c:333:37: sparse:     got unsigned int *
   drivers/scsi/fnic/vnic_dev.c:373:36: sparse: sparse: incorrect type in argument 2 (different address spaces) @@     expected void [noderef] __iomem * @@     got unsigned int * @@
   drivers/scsi/fnic/vnic_dev.c:373:36: sparse:     expected void [noderef] __iomem *
   drivers/scsi/fnic/vnic_dev.c:373:36: sparse:     got unsigned int *
   drivers/scsi/fnic/vnic_dev.c:469:32: sparse: sparse: incorrect type in assignment (different address spaces) @@     expected struct vnic_wq_ctrl *wq_ctrl @@     got struct vnic_wq_ctrl [noderef] __iomem *ctrl @@
   drivers/scsi/fnic/vnic_dev.c:469:32: sparse:     expected struct vnic_wq_ctrl *wq_ctrl
   drivers/scsi/fnic/vnic_dev.c:469:32: sparse:     got struct vnic_wq_ctrl [noderef] __iomem *ctrl
   drivers/scsi/fnic/vnic_dev.c:943:11: sparse: sparse: incorrect type in assignment (different address spaces) @@     expected void *p @@     got void [noderef] __iomem * @@
   drivers/scsi/fnic/vnic_dev.c:943:11: sparse:     expected void *p
   drivers/scsi/fnic/vnic_dev.c:943:11: sparse:     got void [noderef] __iomem *

vim +332 drivers/scsi/fnic/vnic_dev.c

5df6d737dd4b0f Abhijeet Joglekar 2009-04-17  318  
363f4d937501ba Jason Yan         2020-04-15  319  static int vnic_dev_cmd2(struct vnic_dev *vdev, enum vnic_devcmd_cmd cmd,
0a2fdd2215e1fa Satish Kharat     2019-01-18  320  		int wait)
0a2fdd2215e1fa Satish Kharat     2019-01-18  321  {
0a2fdd2215e1fa Satish Kharat     2019-01-18  322  	struct devcmd2_controller *dc2c = vdev->devcmd2;
0a2fdd2215e1fa Satish Kharat     2019-01-18  323  	struct devcmd2_result *result;
0a2fdd2215e1fa Satish Kharat     2019-01-18  324  	u8 color;
0a2fdd2215e1fa Satish Kharat     2019-01-18  325  	unsigned int i;
0a2fdd2215e1fa Satish Kharat     2019-01-18  326  	int delay;
0a2fdd2215e1fa Satish Kharat     2019-01-18  327  	int err;
0a2fdd2215e1fa Satish Kharat     2019-01-18  328  	u32 fetch_index;
0a2fdd2215e1fa Satish Kharat     2019-01-18  329  	u32 posted;
0a2fdd2215e1fa Satish Kharat     2019-01-18  330  	u32 new_posted;
0a2fdd2215e1fa Satish Kharat     2019-01-18  331  
0a2fdd2215e1fa Satish Kharat     2019-01-18 @332  	posted = ioread32(&dc2c->wq_ctrl->posted_index);
0a2fdd2215e1fa Satish Kharat     2019-01-18  333  	fetch_index = ioread32(&dc2c->wq_ctrl->fetch_index);
0a2fdd2215e1fa Satish Kharat     2019-01-18  334  
0a2fdd2215e1fa Satish Kharat     2019-01-18  335  	if (posted == 0xFFFFFFFF || fetch_index == 0xFFFFFFFF) {
0a2fdd2215e1fa Satish Kharat     2019-01-18  336  		/* Hardware surprise removal: return error */
0a2fdd2215e1fa Satish Kharat     2019-01-18  337  		pr_err("%s: devcmd2 invalid posted or fetch index on cmd %d\n",
0a2fdd2215e1fa Satish Kharat     2019-01-18  338  				pci_name(vdev->pdev), _CMD_N(cmd));
0a2fdd2215e1fa Satish Kharat     2019-01-18  339  		pr_err("%s: fetch index: %u, posted index: %u\n",
0a2fdd2215e1fa Satish Kharat     2019-01-18  340  				pci_name(vdev->pdev), fetch_index, posted);
0a2fdd2215e1fa Satish Kharat     2019-01-18  341  
0a2fdd2215e1fa Satish Kharat     2019-01-18  342  		return -ENODEV;
0a2fdd2215e1fa Satish Kharat     2019-01-18  343  
0a2fdd2215e1fa Satish Kharat     2019-01-18  344  	}
0a2fdd2215e1fa Satish Kharat     2019-01-18  345  
0a2fdd2215e1fa Satish Kharat     2019-01-18  346  	new_posted = (posted + 1) % DEVCMD2_RING_SIZE;
0a2fdd2215e1fa Satish Kharat     2019-01-18  347  
0a2fdd2215e1fa Satish Kharat     2019-01-18  348  	if (new_posted == fetch_index) {
0a2fdd2215e1fa Satish Kharat     2019-01-18  349  		pr_err("%s: devcmd2 wq full while issuing cmd %d\n",
0a2fdd2215e1fa Satish Kharat     2019-01-18  350  				pci_name(vdev->pdev), _CMD_N(cmd));
0a2fdd2215e1fa Satish Kharat     2019-01-18  351  		pr_err("%s: fetch index: %u, posted index: %u\n",
0a2fdd2215e1fa Satish Kharat     2019-01-18  352  				pci_name(vdev->pdev), fetch_index, posted);
0a2fdd2215e1fa Satish Kharat     2019-01-18  353  		return -EBUSY;
0a2fdd2215e1fa Satish Kharat     2019-01-18  354  
0a2fdd2215e1fa Satish Kharat     2019-01-18  355  	}
0a2fdd2215e1fa Satish Kharat     2019-01-18  356  	dc2c->cmd_ring[posted].cmd = cmd;
0a2fdd2215e1fa Satish Kharat     2019-01-18  357  	dc2c->cmd_ring[posted].flags = 0;
0a2fdd2215e1fa Satish Kharat     2019-01-18  358  
0a2fdd2215e1fa Satish Kharat     2019-01-18  359  	if ((_CMD_FLAGS(cmd) & _CMD_FLAGS_NOWAIT))
0a2fdd2215e1fa Satish Kharat     2019-01-18  360  		dc2c->cmd_ring[posted].flags |= DEVCMD2_FNORESULT;
0a2fdd2215e1fa Satish Kharat     2019-01-18  361  	if (_CMD_DIR(cmd) & _CMD_DIR_WRITE) {
0a2fdd2215e1fa Satish Kharat     2019-01-18  362  		for (i = 0; i < VNIC_DEVCMD_NARGS; i++)
0a2fdd2215e1fa Satish Kharat     2019-01-18  363  			dc2c->cmd_ring[posted].args[i] = vdev->args[i];
0a2fdd2215e1fa Satish Kharat     2019-01-18  364  
0a2fdd2215e1fa Satish Kharat     2019-01-18  365  	}
0a2fdd2215e1fa Satish Kharat     2019-01-18  366  
0a2fdd2215e1fa Satish Kharat     2019-01-18  367  	/* Adding write memory barrier prevents compiler and/or CPU
0a2fdd2215e1fa Satish Kharat     2019-01-18  368  	 * reordering, thus avoiding descriptor posting before
0a2fdd2215e1fa Satish Kharat     2019-01-18  369  	 * descriptor is initialized. Otherwise, hardware can read
0a2fdd2215e1fa Satish Kharat     2019-01-18  370  	 * stale descriptor fields.
0a2fdd2215e1fa Satish Kharat     2019-01-18  371  	 */
0a2fdd2215e1fa Satish Kharat     2019-01-18  372  	wmb();
0a2fdd2215e1fa Satish Kharat     2019-01-18  373  	iowrite32(new_posted, &dc2c->wq_ctrl->posted_index);
0a2fdd2215e1fa Satish Kharat     2019-01-18  374  
0a2fdd2215e1fa Satish Kharat     2019-01-18  375  	if (dc2c->cmd_ring[posted].flags & DEVCMD2_FNORESULT)
0a2fdd2215e1fa Satish Kharat     2019-01-18  376  		return 0;
0a2fdd2215e1fa Satish Kharat     2019-01-18  377  
0a2fdd2215e1fa Satish Kharat     2019-01-18  378  	result = dc2c->result + dc2c->next_result;
0a2fdd2215e1fa Satish Kharat     2019-01-18  379  	color = dc2c->color;
0a2fdd2215e1fa Satish Kharat     2019-01-18  380  
0a2fdd2215e1fa Satish Kharat     2019-01-18  381  	dc2c->next_result++;
0a2fdd2215e1fa Satish Kharat     2019-01-18  382  	if (dc2c->next_result == dc2c->result_size) {
0a2fdd2215e1fa Satish Kharat     2019-01-18  383  		dc2c->next_result = 0;
0a2fdd2215e1fa Satish Kharat     2019-01-18  384  		dc2c->color = dc2c->color ? 0 : 1;
0a2fdd2215e1fa Satish Kharat     2019-01-18  385  	}
0a2fdd2215e1fa Satish Kharat     2019-01-18  386  
0a2fdd2215e1fa Satish Kharat     2019-01-18  387  	for (delay = 0; delay < wait; delay++) {
0a2fdd2215e1fa Satish Kharat     2019-01-18  388  		udelay(100);
0a2fdd2215e1fa Satish Kharat     2019-01-18  389  		if (result->color == color) {
0a2fdd2215e1fa Satish Kharat     2019-01-18  390  			if (result->error) {
0a2fdd2215e1fa Satish Kharat     2019-01-18  391  				err = -(int) result->error;
0a2fdd2215e1fa Satish Kharat     2019-01-18  392  				if (err != ERR_ECMDUNKNOWN ||
0a2fdd2215e1fa Satish Kharat     2019-01-18  393  						cmd != CMD_CAPABILITY)
0a2fdd2215e1fa Satish Kharat     2019-01-18  394  					pr_err("%s:Error %d devcmd %d\n",
0a2fdd2215e1fa Satish Kharat     2019-01-18  395  						pci_name(vdev->pdev),
0a2fdd2215e1fa Satish Kharat     2019-01-18  396  						err, _CMD_N(cmd));
0a2fdd2215e1fa Satish Kharat     2019-01-18  397  				return err;
0a2fdd2215e1fa Satish Kharat     2019-01-18  398  			}
0a2fdd2215e1fa Satish Kharat     2019-01-18  399  			if (_CMD_DIR(cmd) & _CMD_DIR_READ) {
0a2fdd2215e1fa Satish Kharat     2019-01-18  400  				rmb(); /*prevent reorder while reding result*/
0a2fdd2215e1fa Satish Kharat     2019-01-18  401  				for (i = 0; i < VNIC_DEVCMD_NARGS; i++)
0a2fdd2215e1fa Satish Kharat     2019-01-18  402  					vdev->args[i] = result->results[i];
0a2fdd2215e1fa Satish Kharat     2019-01-18  403  			}
0a2fdd2215e1fa Satish Kharat     2019-01-18  404  			return 0;
0a2fdd2215e1fa Satish Kharat     2019-01-18  405  		}
0a2fdd2215e1fa Satish Kharat     2019-01-18  406  	}
0a2fdd2215e1fa Satish Kharat     2019-01-18  407  
0a2fdd2215e1fa Satish Kharat     2019-01-18  408  	pr_err("%s:Timed out devcmd %d\n", pci_name(vdev->pdev), _CMD_N(cmd));
0a2fdd2215e1fa Satish Kharat     2019-01-18  409  
0a2fdd2215e1fa Satish Kharat     2019-01-18  410  	return -ETIMEDOUT;
0a2fdd2215e1fa Satish Kharat     2019-01-18  411  }
0a2fdd2215e1fa Satish Kharat     2019-01-18  412  

:::::: The code at line 332 was first introduced by commit
:::::: 0a2fdd2215e1fa3b417792bd6e9cb719822cbfb6 scsi: fnic: Adding devcmd2 init and posting interfaces

:::::: TO: Satish Kharat <satishkh@cisco.com>
:::::: CC: Martin K. Petersen <martin.petersen@oracle.com>

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

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 39055 bytes --]

^ permalink raw reply	[flat|nested] 17+ messages in thread

* drivers/scsi/fnic/vnic_dev.c:332:32: sparse: sparse: incorrect type in argument 1 (different address spaces)
@ 2021-02-12 23:27 kernel test robot
  0 siblings, 0 replies; 17+ messages in thread
From: kernel test robot @ 2021-02-12 23:27 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: kbuild-all, linux-kernel, Andrew Morton,
	Linux Memory Management List, Geert Uytterhoeven, Arnd Bergmann

[-- Attachment #1: Type: text/plain, Size: 10509 bytes --]

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   dcc0b49040c70ad827a7f3d58a21b01fdb14e749
commit: 8f28ca6bd8211214faf717677bbffe375c2a6072 iomap: constify ioreadX() iomem argument (as in generic implementation)
date:   6 months ago
config: i386-randconfig-s002-20210213 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0
reproduce:
        # apt-get install sparse
        # sparse version: v0.6.3-215-g0fb77bb6-dirty
        # https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=8f28ca6bd8211214faf717677bbffe375c2a6072
        git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
        git fetch --no-tags linus master
        git checkout 8f28ca6bd8211214faf717677bbffe375c2a6072
        # save the attached .config to linux build tree
        make W=1 C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=i386 

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


"sparse warnings: (new ones prefixed by >>)"
>> drivers/scsi/fnic/vnic_dev.c:332:32: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void const [noderef] __iomem * @@     got unsigned int * @@
   drivers/scsi/fnic/vnic_dev.c:332:32: sparse:     expected void const [noderef] __iomem *
   drivers/scsi/fnic/vnic_dev.c:332:32: sparse:     got unsigned int *
   drivers/scsi/fnic/vnic_dev.c:333:37: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void const [noderef] __iomem * @@     got unsigned int * @@
   drivers/scsi/fnic/vnic_dev.c:333:37: sparse:     expected void const [noderef] __iomem *
   drivers/scsi/fnic/vnic_dev.c:333:37: sparse:     got unsigned int *
   drivers/scsi/fnic/vnic_dev.c:373:36: sparse: sparse: incorrect type in argument 2 (different address spaces) @@     expected void [noderef] __iomem * @@     got unsigned int * @@
   drivers/scsi/fnic/vnic_dev.c:373:36: sparse:     expected void [noderef] __iomem *
   drivers/scsi/fnic/vnic_dev.c:373:36: sparse:     got unsigned int *
   drivers/scsi/fnic/vnic_dev.c:469:32: sparse: sparse: incorrect type in assignment (different address spaces) @@     expected struct vnic_wq_ctrl *wq_ctrl @@     got struct vnic_wq_ctrl [noderef] __iomem *ctrl @@
   drivers/scsi/fnic/vnic_dev.c:469:32: sparse:     expected struct vnic_wq_ctrl *wq_ctrl
   drivers/scsi/fnic/vnic_dev.c:469:32: sparse:     got struct vnic_wq_ctrl [noderef] __iomem *ctrl
   drivers/scsi/fnic/vnic_dev.c:943:11: sparse: sparse: incorrect type in assignment (different address spaces) @@     expected void *p @@     got void [noderef] __iomem * @@
   drivers/scsi/fnic/vnic_dev.c:943:11: sparse:     expected void *p
   drivers/scsi/fnic/vnic_dev.c:943:11: sparse:     got void [noderef] __iomem *

vim +332 drivers/scsi/fnic/vnic_dev.c

5df6d737dd4b0f Abhijeet Joglekar 2009-04-17  318  
363f4d937501ba Jason Yan         2020-04-15  319  static int vnic_dev_cmd2(struct vnic_dev *vdev, enum vnic_devcmd_cmd cmd,
0a2fdd2215e1fa Satish Kharat     2019-01-18  320  		int wait)
0a2fdd2215e1fa Satish Kharat     2019-01-18  321  {
0a2fdd2215e1fa Satish Kharat     2019-01-18  322  	struct devcmd2_controller *dc2c = vdev->devcmd2;
0a2fdd2215e1fa Satish Kharat     2019-01-18  323  	struct devcmd2_result *result;
0a2fdd2215e1fa Satish Kharat     2019-01-18  324  	u8 color;
0a2fdd2215e1fa Satish Kharat     2019-01-18  325  	unsigned int i;
0a2fdd2215e1fa Satish Kharat     2019-01-18  326  	int delay;
0a2fdd2215e1fa Satish Kharat     2019-01-18  327  	int err;
0a2fdd2215e1fa Satish Kharat     2019-01-18  328  	u32 fetch_index;
0a2fdd2215e1fa Satish Kharat     2019-01-18  329  	u32 posted;
0a2fdd2215e1fa Satish Kharat     2019-01-18  330  	u32 new_posted;
0a2fdd2215e1fa Satish Kharat     2019-01-18  331  
0a2fdd2215e1fa Satish Kharat     2019-01-18 @332  	posted = ioread32(&dc2c->wq_ctrl->posted_index);
0a2fdd2215e1fa Satish Kharat     2019-01-18  333  	fetch_index = ioread32(&dc2c->wq_ctrl->fetch_index);
0a2fdd2215e1fa Satish Kharat     2019-01-18  334  
0a2fdd2215e1fa Satish Kharat     2019-01-18  335  	if (posted == 0xFFFFFFFF || fetch_index == 0xFFFFFFFF) {
0a2fdd2215e1fa Satish Kharat     2019-01-18  336  		/* Hardware surprise removal: return error */
0a2fdd2215e1fa Satish Kharat     2019-01-18  337  		pr_err("%s: devcmd2 invalid posted or fetch index on cmd %d\n",
0a2fdd2215e1fa Satish Kharat     2019-01-18  338  				pci_name(vdev->pdev), _CMD_N(cmd));
0a2fdd2215e1fa Satish Kharat     2019-01-18  339  		pr_err("%s: fetch index: %u, posted index: %u\n",
0a2fdd2215e1fa Satish Kharat     2019-01-18  340  				pci_name(vdev->pdev), fetch_index, posted);
0a2fdd2215e1fa Satish Kharat     2019-01-18  341  
0a2fdd2215e1fa Satish Kharat     2019-01-18  342  		return -ENODEV;
0a2fdd2215e1fa Satish Kharat     2019-01-18  343  
0a2fdd2215e1fa Satish Kharat     2019-01-18  344  	}
0a2fdd2215e1fa Satish Kharat     2019-01-18  345  
0a2fdd2215e1fa Satish Kharat     2019-01-18  346  	new_posted = (posted + 1) % DEVCMD2_RING_SIZE;
0a2fdd2215e1fa Satish Kharat     2019-01-18  347  
0a2fdd2215e1fa Satish Kharat     2019-01-18  348  	if (new_posted == fetch_index) {
0a2fdd2215e1fa Satish Kharat     2019-01-18  349  		pr_err("%s: devcmd2 wq full while issuing cmd %d\n",
0a2fdd2215e1fa Satish Kharat     2019-01-18  350  				pci_name(vdev->pdev), _CMD_N(cmd));
0a2fdd2215e1fa Satish Kharat     2019-01-18  351  		pr_err("%s: fetch index: %u, posted index: %u\n",
0a2fdd2215e1fa Satish Kharat     2019-01-18  352  				pci_name(vdev->pdev), fetch_index, posted);
0a2fdd2215e1fa Satish Kharat     2019-01-18  353  		return -EBUSY;
0a2fdd2215e1fa Satish Kharat     2019-01-18  354  
0a2fdd2215e1fa Satish Kharat     2019-01-18  355  	}
0a2fdd2215e1fa Satish Kharat     2019-01-18  356  	dc2c->cmd_ring[posted].cmd = cmd;
0a2fdd2215e1fa Satish Kharat     2019-01-18  357  	dc2c->cmd_ring[posted].flags = 0;
0a2fdd2215e1fa Satish Kharat     2019-01-18  358  
0a2fdd2215e1fa Satish Kharat     2019-01-18  359  	if ((_CMD_FLAGS(cmd) & _CMD_FLAGS_NOWAIT))
0a2fdd2215e1fa Satish Kharat     2019-01-18  360  		dc2c->cmd_ring[posted].flags |= DEVCMD2_FNORESULT;
0a2fdd2215e1fa Satish Kharat     2019-01-18  361  	if (_CMD_DIR(cmd) & _CMD_DIR_WRITE) {
0a2fdd2215e1fa Satish Kharat     2019-01-18  362  		for (i = 0; i < VNIC_DEVCMD_NARGS; i++)
0a2fdd2215e1fa Satish Kharat     2019-01-18  363  			dc2c->cmd_ring[posted].args[i] = vdev->args[i];
0a2fdd2215e1fa Satish Kharat     2019-01-18  364  
0a2fdd2215e1fa Satish Kharat     2019-01-18  365  	}
0a2fdd2215e1fa Satish Kharat     2019-01-18  366  
0a2fdd2215e1fa Satish Kharat     2019-01-18  367  	/* Adding write memory barrier prevents compiler and/or CPU
0a2fdd2215e1fa Satish Kharat     2019-01-18  368  	 * reordering, thus avoiding descriptor posting before
0a2fdd2215e1fa Satish Kharat     2019-01-18  369  	 * descriptor is initialized. Otherwise, hardware can read
0a2fdd2215e1fa Satish Kharat     2019-01-18  370  	 * stale descriptor fields.
0a2fdd2215e1fa Satish Kharat     2019-01-18  371  	 */
0a2fdd2215e1fa Satish Kharat     2019-01-18  372  	wmb();
0a2fdd2215e1fa Satish Kharat     2019-01-18  373  	iowrite32(new_posted, &dc2c->wq_ctrl->posted_index);
0a2fdd2215e1fa Satish Kharat     2019-01-18  374  
0a2fdd2215e1fa Satish Kharat     2019-01-18  375  	if (dc2c->cmd_ring[posted].flags & DEVCMD2_FNORESULT)
0a2fdd2215e1fa Satish Kharat     2019-01-18  376  		return 0;
0a2fdd2215e1fa Satish Kharat     2019-01-18  377  
0a2fdd2215e1fa Satish Kharat     2019-01-18  378  	result = dc2c->result + dc2c->next_result;
0a2fdd2215e1fa Satish Kharat     2019-01-18  379  	color = dc2c->color;
0a2fdd2215e1fa Satish Kharat     2019-01-18  380  
0a2fdd2215e1fa Satish Kharat     2019-01-18  381  	dc2c->next_result++;
0a2fdd2215e1fa Satish Kharat     2019-01-18  382  	if (dc2c->next_result == dc2c->result_size) {
0a2fdd2215e1fa Satish Kharat     2019-01-18  383  		dc2c->next_result = 0;
0a2fdd2215e1fa Satish Kharat     2019-01-18  384  		dc2c->color = dc2c->color ? 0 : 1;
0a2fdd2215e1fa Satish Kharat     2019-01-18  385  	}
0a2fdd2215e1fa Satish Kharat     2019-01-18  386  
0a2fdd2215e1fa Satish Kharat     2019-01-18  387  	for (delay = 0; delay < wait; delay++) {
0a2fdd2215e1fa Satish Kharat     2019-01-18  388  		udelay(100);
0a2fdd2215e1fa Satish Kharat     2019-01-18  389  		if (result->color == color) {
0a2fdd2215e1fa Satish Kharat     2019-01-18  390  			if (result->error) {
0a2fdd2215e1fa Satish Kharat     2019-01-18  391  				err = -(int) result->error;
0a2fdd2215e1fa Satish Kharat     2019-01-18  392  				if (err != ERR_ECMDUNKNOWN ||
0a2fdd2215e1fa Satish Kharat     2019-01-18  393  						cmd != CMD_CAPABILITY)
0a2fdd2215e1fa Satish Kharat     2019-01-18  394  					pr_err("%s:Error %d devcmd %d\n",
0a2fdd2215e1fa Satish Kharat     2019-01-18  395  						pci_name(vdev->pdev),
0a2fdd2215e1fa Satish Kharat     2019-01-18  396  						err, _CMD_N(cmd));
0a2fdd2215e1fa Satish Kharat     2019-01-18  397  				return err;
0a2fdd2215e1fa Satish Kharat     2019-01-18  398  			}
0a2fdd2215e1fa Satish Kharat     2019-01-18  399  			if (_CMD_DIR(cmd) & _CMD_DIR_READ) {
0a2fdd2215e1fa Satish Kharat     2019-01-18  400  				rmb(); /*prevent reorder while reding result*/
0a2fdd2215e1fa Satish Kharat     2019-01-18  401  				for (i = 0; i < VNIC_DEVCMD_NARGS; i++)
0a2fdd2215e1fa Satish Kharat     2019-01-18  402  					vdev->args[i] = result->results[i];
0a2fdd2215e1fa Satish Kharat     2019-01-18  403  			}
0a2fdd2215e1fa Satish Kharat     2019-01-18  404  			return 0;
0a2fdd2215e1fa Satish Kharat     2019-01-18  405  		}
0a2fdd2215e1fa Satish Kharat     2019-01-18  406  	}
0a2fdd2215e1fa Satish Kharat     2019-01-18  407  
0a2fdd2215e1fa Satish Kharat     2019-01-18  408  	pr_err("%s:Timed out devcmd %d\n", pci_name(vdev->pdev), _CMD_N(cmd));
0a2fdd2215e1fa Satish Kharat     2019-01-18  409  
0a2fdd2215e1fa Satish Kharat     2019-01-18  410  	return -ETIMEDOUT;
0a2fdd2215e1fa Satish Kharat     2019-01-18  411  }
0a2fdd2215e1fa Satish Kharat     2019-01-18  412  

:::::: The code at line 332 was first introduced by commit
:::::: 0a2fdd2215e1fa3b417792bd6e9cb719822cbfb6 scsi: fnic: Adding devcmd2 init and posting interfaces

:::::: TO: Satish Kharat <satishkh@cisco.com>
:::::: CC: Martin K. Petersen <martin.petersen@oracle.com>

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

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 38561 bytes --]

^ permalink raw reply	[flat|nested] 17+ messages in thread

* drivers/scsi/fnic/vnic_dev.c:332:32: sparse: sparse: incorrect type in argument 1 (different address spaces)
@ 2021-01-06 10:13 kernel test robot
  0 siblings, 0 replies; 17+ messages in thread
From: kernel test robot @ 2021-01-06 10:13 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: kbuild-all, linux-kernel, Andrew Morton,
	Linux Memory Management List, Geert Uytterhoeven, Arnd Bergmann

[-- Attachment #1: Type: text/plain, Size: 10608 bytes --]

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   e71ba9452f0b5b2e8dc8aa5445198cd9214a6a62
commit: 8f28ca6bd8211214faf717677bbffe375c2a6072 iomap: constify ioreadX() iomem argument (as in generic implementation)
date:   5 months ago
config: x86_64-randconfig-s032-20210106 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0
reproduce:
        # apt-get install sparse
        # sparse version: v0.6.3-208-g46a52ca4-dirty
        # https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=8f28ca6bd8211214faf717677bbffe375c2a6072
        git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
        git fetch --no-tags linus master
        git checkout 8f28ca6bd8211214faf717677bbffe375c2a6072
        # 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@intel.com>


"sparse warnings: (new ones prefixed by >>)"
>> drivers/scsi/fnic/vnic_dev.c:332:32: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void const [noderef] __iomem * @@     got unsigned int * @@
   drivers/scsi/fnic/vnic_dev.c:332:32: sparse:     expected void const [noderef] __iomem *
   drivers/scsi/fnic/vnic_dev.c:332:32: sparse:     got unsigned int *
   drivers/scsi/fnic/vnic_dev.c:333:37: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void const [noderef] __iomem * @@     got unsigned int * @@
   drivers/scsi/fnic/vnic_dev.c:333:37: sparse:     expected void const [noderef] __iomem *
   drivers/scsi/fnic/vnic_dev.c:333:37: sparse:     got unsigned int *
   drivers/scsi/fnic/vnic_dev.c:373:36: sparse: sparse: incorrect type in argument 2 (different address spaces) @@     expected void [noderef] __iomem * @@     got unsigned int * @@
   drivers/scsi/fnic/vnic_dev.c:373:36: sparse:     expected void [noderef] __iomem *
   drivers/scsi/fnic/vnic_dev.c:373:36: sparse:     got unsigned int *
   drivers/scsi/fnic/vnic_dev.c:469:32: sparse: sparse: incorrect type in assignment (different address spaces) @@     expected struct vnic_wq_ctrl *wq_ctrl @@     got struct vnic_wq_ctrl [noderef] __iomem *ctrl @@
   drivers/scsi/fnic/vnic_dev.c:469:32: sparse:     expected struct vnic_wq_ctrl *wq_ctrl
   drivers/scsi/fnic/vnic_dev.c:469:32: sparse:     got struct vnic_wq_ctrl [noderef] __iomem *ctrl
   drivers/scsi/fnic/vnic_dev.c:943:11: sparse: sparse: incorrect type in assignment (different address spaces) @@     expected void *p @@     got void [noderef] __iomem * @@
   drivers/scsi/fnic/vnic_dev.c:943:11: sparse:     expected void *p
   drivers/scsi/fnic/vnic_dev.c:943:11: sparse:     got void [noderef] __iomem *

vim +332 drivers/scsi/fnic/vnic_dev.c

5df6d737dd4b0fe Abhijeet Joglekar 2009-04-17  318  
363f4d937501ba4 Jason Yan         2020-04-15  319  static int vnic_dev_cmd2(struct vnic_dev *vdev, enum vnic_devcmd_cmd cmd,
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  320  		int wait)
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  321  {
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  322  	struct devcmd2_controller *dc2c = vdev->devcmd2;
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  323  	struct devcmd2_result *result;
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  324  	u8 color;
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  325  	unsigned int i;
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  326  	int delay;
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  327  	int err;
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  328  	u32 fetch_index;
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  329  	u32 posted;
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  330  	u32 new_posted;
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  331  
0a2fdd2215e1fa3 Satish Kharat     2019-01-18 @332  	posted = ioread32(&dc2c->wq_ctrl->posted_index);
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  333  	fetch_index = ioread32(&dc2c->wq_ctrl->fetch_index);
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  334  
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  335  	if (posted == 0xFFFFFFFF || fetch_index == 0xFFFFFFFF) {
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  336  		/* Hardware surprise removal: return error */
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  337  		pr_err("%s: devcmd2 invalid posted or fetch index on cmd %d\n",
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  338  				pci_name(vdev->pdev), _CMD_N(cmd));
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  339  		pr_err("%s: fetch index: %u, posted index: %u\n",
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  340  				pci_name(vdev->pdev), fetch_index, posted);
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  341  
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  342  		return -ENODEV;
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  343  
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  344  	}
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  345  
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  346  	new_posted = (posted + 1) % DEVCMD2_RING_SIZE;
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  347  
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  348  	if (new_posted == fetch_index) {
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  349  		pr_err("%s: devcmd2 wq full while issuing cmd %d\n",
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  350  				pci_name(vdev->pdev), _CMD_N(cmd));
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  351  		pr_err("%s: fetch index: %u, posted index: %u\n",
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  352  				pci_name(vdev->pdev), fetch_index, posted);
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  353  		return -EBUSY;
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  354  
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  355  	}
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  356  	dc2c->cmd_ring[posted].cmd = cmd;
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  357  	dc2c->cmd_ring[posted].flags = 0;
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  358  
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  359  	if ((_CMD_FLAGS(cmd) & _CMD_FLAGS_NOWAIT))
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  360  		dc2c->cmd_ring[posted].flags |= DEVCMD2_FNORESULT;
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  361  	if (_CMD_DIR(cmd) & _CMD_DIR_WRITE) {
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  362  		for (i = 0; i < VNIC_DEVCMD_NARGS; i++)
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  363  			dc2c->cmd_ring[posted].args[i] = vdev->args[i];
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  364  
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  365  	}
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  366  
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  367  	/* Adding write memory barrier prevents compiler and/or CPU
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  368  	 * reordering, thus avoiding descriptor posting before
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  369  	 * descriptor is initialized. Otherwise, hardware can read
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  370  	 * stale descriptor fields.
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  371  	 */
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  372  	wmb();
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  373  	iowrite32(new_posted, &dc2c->wq_ctrl->posted_index);
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  374  
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  375  	if (dc2c->cmd_ring[posted].flags & DEVCMD2_FNORESULT)
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  376  		return 0;
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  377  
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  378  	result = dc2c->result + dc2c->next_result;
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  379  	color = dc2c->color;
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  380  
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  381  	dc2c->next_result++;
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  382  	if (dc2c->next_result == dc2c->result_size) {
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  383  		dc2c->next_result = 0;
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  384  		dc2c->color = dc2c->color ? 0 : 1;
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  385  	}
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  386  
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  387  	for (delay = 0; delay < wait; delay++) {
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  388  		udelay(100);
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  389  		if (result->color == color) {
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  390  			if (result->error) {
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  391  				err = -(int) result->error;
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  392  				if (err != ERR_ECMDUNKNOWN ||
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  393  						cmd != CMD_CAPABILITY)
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  394  					pr_err("%s:Error %d devcmd %d\n",
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  395  						pci_name(vdev->pdev),
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  396  						err, _CMD_N(cmd));
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  397  				return err;
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  398  			}
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  399  			if (_CMD_DIR(cmd) & _CMD_DIR_READ) {
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  400  				rmb(); /*prevent reorder while reding result*/
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  401  				for (i = 0; i < VNIC_DEVCMD_NARGS; i++)
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  402  					vdev->args[i] = result->results[i];
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  403  			}
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  404  			return 0;
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  405  		}
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  406  	}
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  407  
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  408  	pr_err("%s:Timed out devcmd %d\n", pci_name(vdev->pdev), _CMD_N(cmd));
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  409  
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  410  	return -ETIMEDOUT;
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  411  }
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  412  

:::::: The code at line 332 was first introduced by commit
:::::: 0a2fdd2215e1fa3b417792bd6e9cb719822cbfb6 scsi: fnic: Adding devcmd2 init and posting interfaces

:::::: TO: Satish Kharat <satishkh@cisco.com>
:::::: CC: Martin K. Petersen <martin.petersen@oracle.com>

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

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 40594 bytes --]

^ permalink raw reply	[flat|nested] 17+ messages in thread

* drivers/scsi/fnic/vnic_dev.c:332:32: sparse: sparse: incorrect type in argument 1 (different address spaces)
@ 2020-12-26 12:00 kernel test robot
  0 siblings, 0 replies; 17+ messages in thread
From: kernel test robot @ 2020-12-26 12:00 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: kbuild-all, linux-kernel, Andrew Morton,
	Linux Memory Management List, Geert Uytterhoeven, Arnd Bergmann

[-- Attachment #1: Type: text/plain, Size: 10604 bytes --]

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   40f78232f97344afbbeb5b0008615f17c4b93466
commit: 8f28ca6bd8211214faf717677bbffe375c2a6072 iomap: constify ioreadX() iomem argument (as in generic implementation)
date:   4 months ago
config: i386-randconfig-s001-20201220 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0
reproduce:
        # apt-get install sparse
        # sparse version: v0.6.3-184-g1b896707-dirty
        # https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=8f28ca6bd8211214faf717677bbffe375c2a6072
        git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
        git fetch --no-tags linus master
        git checkout 8f28ca6bd8211214faf717677bbffe375c2a6072
        # save the attached .config to linux build tree
        make W=1 C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=i386 

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


"sparse warnings: (new ones prefixed by >>)"
>> drivers/scsi/fnic/vnic_dev.c:332:32: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void const [noderef] __iomem * @@     got unsigned int * @@
   drivers/scsi/fnic/vnic_dev.c:332:32: sparse:     expected void const [noderef] __iomem *
   drivers/scsi/fnic/vnic_dev.c:332:32: sparse:     got unsigned int *
   drivers/scsi/fnic/vnic_dev.c:333:37: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void const [noderef] __iomem * @@     got unsigned int * @@
   drivers/scsi/fnic/vnic_dev.c:333:37: sparse:     expected void const [noderef] __iomem *
   drivers/scsi/fnic/vnic_dev.c:333:37: sparse:     got unsigned int *
   drivers/scsi/fnic/vnic_dev.c:373:36: sparse: sparse: incorrect type in argument 2 (different address spaces) @@     expected void [noderef] __iomem * @@     got unsigned int * @@
   drivers/scsi/fnic/vnic_dev.c:373:36: sparse:     expected void [noderef] __iomem *
   drivers/scsi/fnic/vnic_dev.c:373:36: sparse:     got unsigned int *
   drivers/scsi/fnic/vnic_dev.c:469:32: sparse: sparse: incorrect type in assignment (different address spaces) @@     expected struct vnic_wq_ctrl *wq_ctrl @@     got struct vnic_wq_ctrl [noderef] __iomem *ctrl @@
   drivers/scsi/fnic/vnic_dev.c:469:32: sparse:     expected struct vnic_wq_ctrl *wq_ctrl
   drivers/scsi/fnic/vnic_dev.c:469:32: sparse:     got struct vnic_wq_ctrl [noderef] __iomem *ctrl
   drivers/scsi/fnic/vnic_dev.c:943:11: sparse: sparse: incorrect type in assignment (different address spaces) @@     expected void *p @@     got void [noderef] __iomem * @@
   drivers/scsi/fnic/vnic_dev.c:943:11: sparse:     expected void *p
   drivers/scsi/fnic/vnic_dev.c:943:11: sparse:     got void [noderef] __iomem *

vim +332 drivers/scsi/fnic/vnic_dev.c

5df6d737dd4b0fe Abhijeet Joglekar 2009-04-17  318  
363f4d937501ba4 Jason Yan         2020-04-15  319  static int vnic_dev_cmd2(struct vnic_dev *vdev, enum vnic_devcmd_cmd cmd,
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  320  		int wait)
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  321  {
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  322  	struct devcmd2_controller *dc2c = vdev->devcmd2;
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  323  	struct devcmd2_result *result;
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  324  	u8 color;
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  325  	unsigned int i;
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  326  	int delay;
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  327  	int err;
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  328  	u32 fetch_index;
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  329  	u32 posted;
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  330  	u32 new_posted;
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  331  
0a2fdd2215e1fa3 Satish Kharat     2019-01-18 @332  	posted = ioread32(&dc2c->wq_ctrl->posted_index);
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  333  	fetch_index = ioread32(&dc2c->wq_ctrl->fetch_index);
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  334  
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  335  	if (posted == 0xFFFFFFFF || fetch_index == 0xFFFFFFFF) {
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  336  		/* Hardware surprise removal: return error */
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  337  		pr_err("%s: devcmd2 invalid posted or fetch index on cmd %d\n",
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  338  				pci_name(vdev->pdev), _CMD_N(cmd));
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  339  		pr_err("%s: fetch index: %u, posted index: %u\n",
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  340  				pci_name(vdev->pdev), fetch_index, posted);
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  341  
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  342  		return -ENODEV;
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  343  
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  344  	}
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  345  
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  346  	new_posted = (posted + 1) % DEVCMD2_RING_SIZE;
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  347  
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  348  	if (new_posted == fetch_index) {
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  349  		pr_err("%s: devcmd2 wq full while issuing cmd %d\n",
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  350  				pci_name(vdev->pdev), _CMD_N(cmd));
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  351  		pr_err("%s: fetch index: %u, posted index: %u\n",
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  352  				pci_name(vdev->pdev), fetch_index, posted);
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  353  		return -EBUSY;
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  354  
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  355  	}
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  356  	dc2c->cmd_ring[posted].cmd = cmd;
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  357  	dc2c->cmd_ring[posted].flags = 0;
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  358  
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  359  	if ((_CMD_FLAGS(cmd) & _CMD_FLAGS_NOWAIT))
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  360  		dc2c->cmd_ring[posted].flags |= DEVCMD2_FNORESULT;
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  361  	if (_CMD_DIR(cmd) & _CMD_DIR_WRITE) {
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  362  		for (i = 0; i < VNIC_DEVCMD_NARGS; i++)
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  363  			dc2c->cmd_ring[posted].args[i] = vdev->args[i];
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  364  
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  365  	}
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  366  
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  367  	/* Adding write memory barrier prevents compiler and/or CPU
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  368  	 * reordering, thus avoiding descriptor posting before
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  369  	 * descriptor is initialized. Otherwise, hardware can read
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  370  	 * stale descriptor fields.
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  371  	 */
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  372  	wmb();
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  373  	iowrite32(new_posted, &dc2c->wq_ctrl->posted_index);
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  374  
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  375  	if (dc2c->cmd_ring[posted].flags & DEVCMD2_FNORESULT)
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  376  		return 0;
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  377  
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  378  	result = dc2c->result + dc2c->next_result;
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  379  	color = dc2c->color;
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  380  
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  381  	dc2c->next_result++;
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  382  	if (dc2c->next_result == dc2c->result_size) {
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  383  		dc2c->next_result = 0;
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  384  		dc2c->color = dc2c->color ? 0 : 1;
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  385  	}
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  386  
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  387  	for (delay = 0; delay < wait; delay++) {
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  388  		udelay(100);
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  389  		if (result->color == color) {
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  390  			if (result->error) {
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  391  				err = -(int) result->error;
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  392  				if (err != ERR_ECMDUNKNOWN ||
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  393  						cmd != CMD_CAPABILITY)
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  394  					pr_err("%s:Error %d devcmd %d\n",
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  395  						pci_name(vdev->pdev),
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  396  						err, _CMD_N(cmd));
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  397  				return err;
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  398  			}
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  399  			if (_CMD_DIR(cmd) & _CMD_DIR_READ) {
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  400  				rmb(); /*prevent reorder while reding result*/
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  401  				for (i = 0; i < VNIC_DEVCMD_NARGS; i++)
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  402  					vdev->args[i] = result->results[i];
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  403  			}
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  404  			return 0;
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  405  		}
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  406  	}
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  407  
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  408  	pr_err("%s:Timed out devcmd %d\n", pci_name(vdev->pdev), _CMD_N(cmd));
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  409  
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  410  	return -ETIMEDOUT;
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  411  }
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  412  

:::::: The code at line 332 was first introduced by commit
:::::: 0a2fdd2215e1fa3b417792bd6e9cb719822cbfb6 scsi: fnic: Adding devcmd2 init and posting interfaces

:::::: TO: Satish Kharat <satishkh@cisco.com>
:::::: CC: Martin K. Petersen <martin.petersen@oracle.com>

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

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 38067 bytes --]

^ permalink raw reply	[flat|nested] 17+ messages in thread

* drivers/scsi/fnic/vnic_dev.c:332:32: sparse: sparse: incorrect type in argument 1 (different address spaces)
@ 2020-12-25 12:37 kernel test robot
  0 siblings, 0 replies; 17+ messages in thread
From: kernel test robot @ 2020-12-25 12:37 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: kbuild-all, linux-kernel, Andrew Morton,
	Linux Memory Management List, Geert Uytterhoeven, Arnd Bergmann

[-- Attachment #1: Type: text/plain, Size: 10604 bytes --]

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   71c5f03154ac1cb27423b984743ccc2f5d11d14d
commit: 8f28ca6bd8211214faf717677bbffe375c2a6072 iomap: constify ioreadX() iomem argument (as in generic implementation)
date:   4 months ago
config: i386-randconfig-s001-20201220 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0
reproduce:
        # apt-get install sparse
        # sparse version: v0.6.3-184-g1b896707-dirty
        # https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=8f28ca6bd8211214faf717677bbffe375c2a6072
        git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
        git fetch --no-tags linus master
        git checkout 8f28ca6bd8211214faf717677bbffe375c2a6072
        # save the attached .config to linux build tree
        make W=1 C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=i386 

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


"sparse warnings: (new ones prefixed by >>)"
>> drivers/scsi/fnic/vnic_dev.c:332:32: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void const [noderef] __iomem * @@     got unsigned int * @@
   drivers/scsi/fnic/vnic_dev.c:332:32: sparse:     expected void const [noderef] __iomem *
   drivers/scsi/fnic/vnic_dev.c:332:32: sparse:     got unsigned int *
   drivers/scsi/fnic/vnic_dev.c:333:37: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void const [noderef] __iomem * @@     got unsigned int * @@
   drivers/scsi/fnic/vnic_dev.c:333:37: sparse:     expected void const [noderef] __iomem *
   drivers/scsi/fnic/vnic_dev.c:333:37: sparse:     got unsigned int *
   drivers/scsi/fnic/vnic_dev.c:373:36: sparse: sparse: incorrect type in argument 2 (different address spaces) @@     expected void [noderef] __iomem * @@     got unsigned int * @@
   drivers/scsi/fnic/vnic_dev.c:373:36: sparse:     expected void [noderef] __iomem *
   drivers/scsi/fnic/vnic_dev.c:373:36: sparse:     got unsigned int *
   drivers/scsi/fnic/vnic_dev.c:469:32: sparse: sparse: incorrect type in assignment (different address spaces) @@     expected struct vnic_wq_ctrl *wq_ctrl @@     got struct vnic_wq_ctrl [noderef] __iomem *ctrl @@
   drivers/scsi/fnic/vnic_dev.c:469:32: sparse:     expected struct vnic_wq_ctrl *wq_ctrl
   drivers/scsi/fnic/vnic_dev.c:469:32: sparse:     got struct vnic_wq_ctrl [noderef] __iomem *ctrl
   drivers/scsi/fnic/vnic_dev.c:943:11: sparse: sparse: incorrect type in assignment (different address spaces) @@     expected void *p @@     got void [noderef] __iomem * @@
   drivers/scsi/fnic/vnic_dev.c:943:11: sparse:     expected void *p
   drivers/scsi/fnic/vnic_dev.c:943:11: sparse:     got void [noderef] __iomem *

vim +332 drivers/scsi/fnic/vnic_dev.c

5df6d737dd4b0fe Abhijeet Joglekar 2009-04-17  318  
363f4d937501ba4 Jason Yan         2020-04-15  319  static int vnic_dev_cmd2(struct vnic_dev *vdev, enum vnic_devcmd_cmd cmd,
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  320  		int wait)
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  321  {
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  322  	struct devcmd2_controller *dc2c = vdev->devcmd2;
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  323  	struct devcmd2_result *result;
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  324  	u8 color;
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  325  	unsigned int i;
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  326  	int delay;
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  327  	int err;
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  328  	u32 fetch_index;
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  329  	u32 posted;
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  330  	u32 new_posted;
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  331  
0a2fdd2215e1fa3 Satish Kharat     2019-01-18 @332  	posted = ioread32(&dc2c->wq_ctrl->posted_index);
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  333  	fetch_index = ioread32(&dc2c->wq_ctrl->fetch_index);
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  334  
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  335  	if (posted == 0xFFFFFFFF || fetch_index == 0xFFFFFFFF) {
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  336  		/* Hardware surprise removal: return error */
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  337  		pr_err("%s: devcmd2 invalid posted or fetch index on cmd %d\n",
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  338  				pci_name(vdev->pdev), _CMD_N(cmd));
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  339  		pr_err("%s: fetch index: %u, posted index: %u\n",
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  340  				pci_name(vdev->pdev), fetch_index, posted);
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  341  
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  342  		return -ENODEV;
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  343  
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  344  	}
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  345  
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  346  	new_posted = (posted + 1) % DEVCMD2_RING_SIZE;
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  347  
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  348  	if (new_posted == fetch_index) {
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  349  		pr_err("%s: devcmd2 wq full while issuing cmd %d\n",
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  350  				pci_name(vdev->pdev), _CMD_N(cmd));
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  351  		pr_err("%s: fetch index: %u, posted index: %u\n",
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  352  				pci_name(vdev->pdev), fetch_index, posted);
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  353  		return -EBUSY;
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  354  
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  355  	}
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  356  	dc2c->cmd_ring[posted].cmd = cmd;
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  357  	dc2c->cmd_ring[posted].flags = 0;
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  358  
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  359  	if ((_CMD_FLAGS(cmd) & _CMD_FLAGS_NOWAIT))
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  360  		dc2c->cmd_ring[posted].flags |= DEVCMD2_FNORESULT;
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  361  	if (_CMD_DIR(cmd) & _CMD_DIR_WRITE) {
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  362  		for (i = 0; i < VNIC_DEVCMD_NARGS; i++)
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  363  			dc2c->cmd_ring[posted].args[i] = vdev->args[i];
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  364  
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  365  	}
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  366  
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  367  	/* Adding write memory barrier prevents compiler and/or CPU
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  368  	 * reordering, thus avoiding descriptor posting before
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  369  	 * descriptor is initialized. Otherwise, hardware can read
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  370  	 * stale descriptor fields.
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  371  	 */
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  372  	wmb();
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  373  	iowrite32(new_posted, &dc2c->wq_ctrl->posted_index);
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  374  
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  375  	if (dc2c->cmd_ring[posted].flags & DEVCMD2_FNORESULT)
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  376  		return 0;
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  377  
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  378  	result = dc2c->result + dc2c->next_result;
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  379  	color = dc2c->color;
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  380  
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  381  	dc2c->next_result++;
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  382  	if (dc2c->next_result == dc2c->result_size) {
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  383  		dc2c->next_result = 0;
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  384  		dc2c->color = dc2c->color ? 0 : 1;
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  385  	}
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  386  
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  387  	for (delay = 0; delay < wait; delay++) {
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  388  		udelay(100);
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  389  		if (result->color == color) {
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  390  			if (result->error) {
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  391  				err = -(int) result->error;
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  392  				if (err != ERR_ECMDUNKNOWN ||
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  393  						cmd != CMD_CAPABILITY)
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  394  					pr_err("%s:Error %d devcmd %d\n",
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  395  						pci_name(vdev->pdev),
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  396  						err, _CMD_N(cmd));
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  397  				return err;
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  398  			}
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  399  			if (_CMD_DIR(cmd) & _CMD_DIR_READ) {
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  400  				rmb(); /*prevent reorder while reding result*/
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  401  				for (i = 0; i < VNIC_DEVCMD_NARGS; i++)
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  402  					vdev->args[i] = result->results[i];
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  403  			}
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  404  			return 0;
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  405  		}
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  406  	}
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  407  
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  408  	pr_err("%s:Timed out devcmd %d\n", pci_name(vdev->pdev), _CMD_N(cmd));
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  409  
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  410  	return -ETIMEDOUT;
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  411  }
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  412  

:::::: The code at line 332 was first introduced by commit
:::::: 0a2fdd2215e1fa3b417792bd6e9cb719822cbfb6 scsi: fnic: Adding devcmd2 init and posting interfaces

:::::: TO: Satish Kharat <satishkh@cisco.com>
:::::: CC: Martin K. Petersen <martin.petersen@oracle.com>

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

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 38067 bytes --]

^ permalink raw reply	[flat|nested] 17+ messages in thread

* drivers/scsi/fnic/vnic_dev.c:332:32: sparse: sparse: incorrect type in argument 1 (different address spaces)
@ 2020-12-24 17:09 kernel test robot
  0 siblings, 0 replies; 17+ messages in thread
From: kernel test robot @ 2020-12-24 17:09 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: kbuild-all, linux-kernel, Andrew Morton,
	Linux Memory Management List, Geert Uytterhoeven, Arnd Bergmann

[-- Attachment #1: Type: text/plain, Size: 10604 bytes --]

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   58cf05f597b03a8212d9ecf2c79ee046d3ee8ad9
commit: 8f28ca6bd8211214faf717677bbffe375c2a6072 iomap: constify ioreadX() iomem argument (as in generic implementation)
date:   4 months ago
config: i386-randconfig-s001-20201220 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0
reproduce:
        # apt-get install sparse
        # sparse version: v0.6.3-184-g1b896707-dirty
        # https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=8f28ca6bd8211214faf717677bbffe375c2a6072
        git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
        git fetch --no-tags linus master
        git checkout 8f28ca6bd8211214faf717677bbffe375c2a6072
        # save the attached .config to linux build tree
        make W=1 C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=i386 

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


"sparse warnings: (new ones prefixed by >>)"
>> drivers/scsi/fnic/vnic_dev.c:332:32: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void const [noderef] __iomem * @@     got unsigned int * @@
   drivers/scsi/fnic/vnic_dev.c:332:32: sparse:     expected void const [noderef] __iomem *
   drivers/scsi/fnic/vnic_dev.c:332:32: sparse:     got unsigned int *
   drivers/scsi/fnic/vnic_dev.c:333:37: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void const [noderef] __iomem * @@     got unsigned int * @@
   drivers/scsi/fnic/vnic_dev.c:333:37: sparse:     expected void const [noderef] __iomem *
   drivers/scsi/fnic/vnic_dev.c:333:37: sparse:     got unsigned int *
   drivers/scsi/fnic/vnic_dev.c:373:36: sparse: sparse: incorrect type in argument 2 (different address spaces) @@     expected void [noderef] __iomem * @@     got unsigned int * @@
   drivers/scsi/fnic/vnic_dev.c:373:36: sparse:     expected void [noderef] __iomem *
   drivers/scsi/fnic/vnic_dev.c:373:36: sparse:     got unsigned int *
   drivers/scsi/fnic/vnic_dev.c:469:32: sparse: sparse: incorrect type in assignment (different address spaces) @@     expected struct vnic_wq_ctrl *wq_ctrl @@     got struct vnic_wq_ctrl [noderef] __iomem *ctrl @@
   drivers/scsi/fnic/vnic_dev.c:469:32: sparse:     expected struct vnic_wq_ctrl *wq_ctrl
   drivers/scsi/fnic/vnic_dev.c:469:32: sparse:     got struct vnic_wq_ctrl [noderef] __iomem *ctrl
   drivers/scsi/fnic/vnic_dev.c:943:11: sparse: sparse: incorrect type in assignment (different address spaces) @@     expected void *p @@     got void [noderef] __iomem * @@
   drivers/scsi/fnic/vnic_dev.c:943:11: sparse:     expected void *p
   drivers/scsi/fnic/vnic_dev.c:943:11: sparse:     got void [noderef] __iomem *

vim +332 drivers/scsi/fnic/vnic_dev.c

5df6d737dd4b0fe Abhijeet Joglekar 2009-04-17  318  
363f4d937501ba4 Jason Yan         2020-04-15  319  static int vnic_dev_cmd2(struct vnic_dev *vdev, enum vnic_devcmd_cmd cmd,
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  320  		int wait)
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  321  {
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  322  	struct devcmd2_controller *dc2c = vdev->devcmd2;
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  323  	struct devcmd2_result *result;
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  324  	u8 color;
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  325  	unsigned int i;
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  326  	int delay;
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  327  	int err;
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  328  	u32 fetch_index;
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  329  	u32 posted;
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  330  	u32 new_posted;
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  331  
0a2fdd2215e1fa3 Satish Kharat     2019-01-18 @332  	posted = ioread32(&dc2c->wq_ctrl->posted_index);
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  333  	fetch_index = ioread32(&dc2c->wq_ctrl->fetch_index);
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  334  
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  335  	if (posted == 0xFFFFFFFF || fetch_index == 0xFFFFFFFF) {
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  336  		/* Hardware surprise removal: return error */
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  337  		pr_err("%s: devcmd2 invalid posted or fetch index on cmd %d\n",
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  338  				pci_name(vdev->pdev), _CMD_N(cmd));
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  339  		pr_err("%s: fetch index: %u, posted index: %u\n",
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  340  				pci_name(vdev->pdev), fetch_index, posted);
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  341  
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  342  		return -ENODEV;
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  343  
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  344  	}
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  345  
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  346  	new_posted = (posted + 1) % DEVCMD2_RING_SIZE;
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  347  
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  348  	if (new_posted == fetch_index) {
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  349  		pr_err("%s: devcmd2 wq full while issuing cmd %d\n",
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  350  				pci_name(vdev->pdev), _CMD_N(cmd));
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  351  		pr_err("%s: fetch index: %u, posted index: %u\n",
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  352  				pci_name(vdev->pdev), fetch_index, posted);
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  353  		return -EBUSY;
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  354  
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  355  	}
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  356  	dc2c->cmd_ring[posted].cmd = cmd;
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  357  	dc2c->cmd_ring[posted].flags = 0;
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  358  
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  359  	if ((_CMD_FLAGS(cmd) & _CMD_FLAGS_NOWAIT))
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  360  		dc2c->cmd_ring[posted].flags |= DEVCMD2_FNORESULT;
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  361  	if (_CMD_DIR(cmd) & _CMD_DIR_WRITE) {
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  362  		for (i = 0; i < VNIC_DEVCMD_NARGS; i++)
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  363  			dc2c->cmd_ring[posted].args[i] = vdev->args[i];
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  364  
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  365  	}
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  366  
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  367  	/* Adding write memory barrier prevents compiler and/or CPU
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  368  	 * reordering, thus avoiding descriptor posting before
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  369  	 * descriptor is initialized. Otherwise, hardware can read
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  370  	 * stale descriptor fields.
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  371  	 */
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  372  	wmb();
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  373  	iowrite32(new_posted, &dc2c->wq_ctrl->posted_index);
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  374  
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  375  	if (dc2c->cmd_ring[posted].flags & DEVCMD2_FNORESULT)
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  376  		return 0;
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  377  
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  378  	result = dc2c->result + dc2c->next_result;
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  379  	color = dc2c->color;
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  380  
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  381  	dc2c->next_result++;
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  382  	if (dc2c->next_result == dc2c->result_size) {
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  383  		dc2c->next_result = 0;
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  384  		dc2c->color = dc2c->color ? 0 : 1;
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  385  	}
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  386  
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  387  	for (delay = 0; delay < wait; delay++) {
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  388  		udelay(100);
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  389  		if (result->color == color) {
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  390  			if (result->error) {
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  391  				err = -(int) result->error;
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  392  				if (err != ERR_ECMDUNKNOWN ||
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  393  						cmd != CMD_CAPABILITY)
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  394  					pr_err("%s:Error %d devcmd %d\n",
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  395  						pci_name(vdev->pdev),
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  396  						err, _CMD_N(cmd));
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  397  				return err;
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  398  			}
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  399  			if (_CMD_DIR(cmd) & _CMD_DIR_READ) {
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  400  				rmb(); /*prevent reorder while reding result*/
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  401  				for (i = 0; i < VNIC_DEVCMD_NARGS; i++)
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  402  					vdev->args[i] = result->results[i];
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  403  			}
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  404  			return 0;
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  405  		}
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  406  	}
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  407  
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  408  	pr_err("%s:Timed out devcmd %d\n", pci_name(vdev->pdev), _CMD_N(cmd));
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  409  
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  410  	return -ETIMEDOUT;
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  411  }
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  412  

:::::: The code at line 332 was first introduced by commit
:::::: 0a2fdd2215e1fa3b417792bd6e9cb719822cbfb6 scsi: fnic: Adding devcmd2 init and posting interfaces

:::::: TO: Satish Kharat <satishkh@cisco.com>
:::::: CC: Martin K. Petersen <martin.petersen@oracle.com>

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

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 38067 bytes --]

^ permalink raw reply	[flat|nested] 17+ messages in thread

* drivers/scsi/fnic/vnic_dev.c:332:32: sparse: sparse: incorrect type in argument 1 (different address spaces)
@ 2020-12-23 23:32 kernel test robot
  0 siblings, 0 replies; 17+ messages in thread
From: kernel test robot @ 2020-12-23 23:32 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: kbuild-all, linux-kernel, Andrew Morton,
	Linux Memory Management List, Geert Uytterhoeven, Arnd Bergmann

[-- Attachment #1: Type: text/plain, Size: 10604 bytes --]

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   614cb5894306cfa2c7d9b6168182876ff5948735
commit: 8f28ca6bd8211214faf717677bbffe375c2a6072 iomap: constify ioreadX() iomem argument (as in generic implementation)
date:   4 months ago
config: i386-randconfig-s001-20201220 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0
reproduce:
        # apt-get install sparse
        # sparse version: v0.6.3-184-g1b896707-dirty
        # https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=8f28ca6bd8211214faf717677bbffe375c2a6072
        git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
        git fetch --no-tags linus master
        git checkout 8f28ca6bd8211214faf717677bbffe375c2a6072
        # save the attached .config to linux build tree
        make W=1 C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=i386 

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


"sparse warnings: (new ones prefixed by >>)"
>> drivers/scsi/fnic/vnic_dev.c:332:32: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void const [noderef] __iomem * @@     got unsigned int * @@
   drivers/scsi/fnic/vnic_dev.c:332:32: sparse:     expected void const [noderef] __iomem *
   drivers/scsi/fnic/vnic_dev.c:332:32: sparse:     got unsigned int *
   drivers/scsi/fnic/vnic_dev.c:333:37: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void const [noderef] __iomem * @@     got unsigned int * @@
   drivers/scsi/fnic/vnic_dev.c:333:37: sparse:     expected void const [noderef] __iomem *
   drivers/scsi/fnic/vnic_dev.c:333:37: sparse:     got unsigned int *
   drivers/scsi/fnic/vnic_dev.c:373:36: sparse: sparse: incorrect type in argument 2 (different address spaces) @@     expected void [noderef] __iomem * @@     got unsigned int * @@
   drivers/scsi/fnic/vnic_dev.c:373:36: sparse:     expected void [noderef] __iomem *
   drivers/scsi/fnic/vnic_dev.c:373:36: sparse:     got unsigned int *
   drivers/scsi/fnic/vnic_dev.c:469:32: sparse: sparse: incorrect type in assignment (different address spaces) @@     expected struct vnic_wq_ctrl *wq_ctrl @@     got struct vnic_wq_ctrl [noderef] __iomem *ctrl @@
   drivers/scsi/fnic/vnic_dev.c:469:32: sparse:     expected struct vnic_wq_ctrl *wq_ctrl
   drivers/scsi/fnic/vnic_dev.c:469:32: sparse:     got struct vnic_wq_ctrl [noderef] __iomem *ctrl
   drivers/scsi/fnic/vnic_dev.c:943:11: sparse: sparse: incorrect type in assignment (different address spaces) @@     expected void *p @@     got void [noderef] __iomem * @@
   drivers/scsi/fnic/vnic_dev.c:943:11: sparse:     expected void *p
   drivers/scsi/fnic/vnic_dev.c:943:11: sparse:     got void [noderef] __iomem *

vim +332 drivers/scsi/fnic/vnic_dev.c

5df6d737dd4b0fe Abhijeet Joglekar 2009-04-17  318  
363f4d937501ba4 Jason Yan         2020-04-15  319  static int vnic_dev_cmd2(struct vnic_dev *vdev, enum vnic_devcmd_cmd cmd,
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  320  		int wait)
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  321  {
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  322  	struct devcmd2_controller *dc2c = vdev->devcmd2;
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  323  	struct devcmd2_result *result;
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  324  	u8 color;
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  325  	unsigned int i;
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  326  	int delay;
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  327  	int err;
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  328  	u32 fetch_index;
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  329  	u32 posted;
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  330  	u32 new_posted;
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  331  
0a2fdd2215e1fa3 Satish Kharat     2019-01-18 @332  	posted = ioread32(&dc2c->wq_ctrl->posted_index);
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  333  	fetch_index = ioread32(&dc2c->wq_ctrl->fetch_index);
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  334  
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  335  	if (posted == 0xFFFFFFFF || fetch_index == 0xFFFFFFFF) {
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  336  		/* Hardware surprise removal: return error */
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  337  		pr_err("%s: devcmd2 invalid posted or fetch index on cmd %d\n",
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  338  				pci_name(vdev->pdev), _CMD_N(cmd));
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  339  		pr_err("%s: fetch index: %u, posted index: %u\n",
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  340  				pci_name(vdev->pdev), fetch_index, posted);
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  341  
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  342  		return -ENODEV;
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  343  
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  344  	}
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  345  
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  346  	new_posted = (posted + 1) % DEVCMD2_RING_SIZE;
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  347  
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  348  	if (new_posted == fetch_index) {
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  349  		pr_err("%s: devcmd2 wq full while issuing cmd %d\n",
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  350  				pci_name(vdev->pdev), _CMD_N(cmd));
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  351  		pr_err("%s: fetch index: %u, posted index: %u\n",
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  352  				pci_name(vdev->pdev), fetch_index, posted);
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  353  		return -EBUSY;
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  354  
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  355  	}
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  356  	dc2c->cmd_ring[posted].cmd = cmd;
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  357  	dc2c->cmd_ring[posted].flags = 0;
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  358  
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  359  	if ((_CMD_FLAGS(cmd) & _CMD_FLAGS_NOWAIT))
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  360  		dc2c->cmd_ring[posted].flags |= DEVCMD2_FNORESULT;
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  361  	if (_CMD_DIR(cmd) & _CMD_DIR_WRITE) {
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  362  		for (i = 0; i < VNIC_DEVCMD_NARGS; i++)
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  363  			dc2c->cmd_ring[posted].args[i] = vdev->args[i];
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  364  
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  365  	}
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  366  
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  367  	/* Adding write memory barrier prevents compiler and/or CPU
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  368  	 * reordering, thus avoiding descriptor posting before
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  369  	 * descriptor is initialized. Otherwise, hardware can read
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  370  	 * stale descriptor fields.
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  371  	 */
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  372  	wmb();
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  373  	iowrite32(new_posted, &dc2c->wq_ctrl->posted_index);
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  374  
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  375  	if (dc2c->cmd_ring[posted].flags & DEVCMD2_FNORESULT)
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  376  		return 0;
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  377  
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  378  	result = dc2c->result + dc2c->next_result;
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  379  	color = dc2c->color;
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  380  
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  381  	dc2c->next_result++;
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  382  	if (dc2c->next_result == dc2c->result_size) {
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  383  		dc2c->next_result = 0;
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  384  		dc2c->color = dc2c->color ? 0 : 1;
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  385  	}
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  386  
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  387  	for (delay = 0; delay < wait; delay++) {
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  388  		udelay(100);
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  389  		if (result->color == color) {
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  390  			if (result->error) {
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  391  				err = -(int) result->error;
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  392  				if (err != ERR_ECMDUNKNOWN ||
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  393  						cmd != CMD_CAPABILITY)
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  394  					pr_err("%s:Error %d devcmd %d\n",
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  395  						pci_name(vdev->pdev),
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  396  						err, _CMD_N(cmd));
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  397  				return err;
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  398  			}
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  399  			if (_CMD_DIR(cmd) & _CMD_DIR_READ) {
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  400  				rmb(); /*prevent reorder while reding result*/
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  401  				for (i = 0; i < VNIC_DEVCMD_NARGS; i++)
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  402  					vdev->args[i] = result->results[i];
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  403  			}
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  404  			return 0;
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  405  		}
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  406  	}
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  407  
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  408  	pr_err("%s:Timed out devcmd %d\n", pci_name(vdev->pdev), _CMD_N(cmd));
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  409  
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  410  	return -ETIMEDOUT;
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  411  }
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  412  

:::::: The code at line 332 was first introduced by commit
:::::: 0a2fdd2215e1fa3b417792bd6e9cb719822cbfb6 scsi: fnic: Adding devcmd2 init and posting interfaces

:::::: TO: Satish Kharat <satishkh@cisco.com>
:::::: CC: Martin K. Petersen <martin.petersen@oracle.com>

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

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 38067 bytes --]

^ permalink raw reply	[flat|nested] 17+ messages in thread

* drivers/scsi/fnic/vnic_dev.c:332:32: sparse: sparse: incorrect type in argument 1 (different address spaces)
@ 2020-12-23 18:44 kernel test robot
  0 siblings, 0 replies; 17+ messages in thread
From: kernel test robot @ 2020-12-23 18:44 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: kbuild-all, linux-kernel, Andrew Morton,
	Linux Memory Management List, Geert Uytterhoeven, Arnd Bergmann

[-- Attachment #1: Type: text/plain, Size: 10604 bytes --]

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   614cb5894306cfa2c7d9b6168182876ff5948735
commit: 8f28ca6bd8211214faf717677bbffe375c2a6072 iomap: constify ioreadX() iomem argument (as in generic implementation)
date:   4 months ago
config: i386-randconfig-s001-20201220 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0
reproduce:
        # apt-get install sparse
        # sparse version: v0.6.3-184-g1b896707-dirty
        # https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=8f28ca6bd8211214faf717677bbffe375c2a6072
        git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
        git fetch --no-tags linus master
        git checkout 8f28ca6bd8211214faf717677bbffe375c2a6072
        # save the attached .config to linux build tree
        make W=1 C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=i386 

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


"sparse warnings: (new ones prefixed by >>)"
>> drivers/scsi/fnic/vnic_dev.c:332:32: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void const [noderef] __iomem * @@     got unsigned int * @@
   drivers/scsi/fnic/vnic_dev.c:332:32: sparse:     expected void const [noderef] __iomem *
   drivers/scsi/fnic/vnic_dev.c:332:32: sparse:     got unsigned int *
   drivers/scsi/fnic/vnic_dev.c:333:37: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void const [noderef] __iomem * @@     got unsigned int * @@
   drivers/scsi/fnic/vnic_dev.c:333:37: sparse:     expected void const [noderef] __iomem *
   drivers/scsi/fnic/vnic_dev.c:333:37: sparse:     got unsigned int *
   drivers/scsi/fnic/vnic_dev.c:373:36: sparse: sparse: incorrect type in argument 2 (different address spaces) @@     expected void [noderef] __iomem * @@     got unsigned int * @@
   drivers/scsi/fnic/vnic_dev.c:373:36: sparse:     expected void [noderef] __iomem *
   drivers/scsi/fnic/vnic_dev.c:373:36: sparse:     got unsigned int *
   drivers/scsi/fnic/vnic_dev.c:469:32: sparse: sparse: incorrect type in assignment (different address spaces) @@     expected struct vnic_wq_ctrl *wq_ctrl @@     got struct vnic_wq_ctrl [noderef] __iomem *ctrl @@
   drivers/scsi/fnic/vnic_dev.c:469:32: sparse:     expected struct vnic_wq_ctrl *wq_ctrl
   drivers/scsi/fnic/vnic_dev.c:469:32: sparse:     got struct vnic_wq_ctrl [noderef] __iomem *ctrl
   drivers/scsi/fnic/vnic_dev.c:943:11: sparse: sparse: incorrect type in assignment (different address spaces) @@     expected void *p @@     got void [noderef] __iomem * @@
   drivers/scsi/fnic/vnic_dev.c:943:11: sparse:     expected void *p
   drivers/scsi/fnic/vnic_dev.c:943:11: sparse:     got void [noderef] __iomem *

vim +332 drivers/scsi/fnic/vnic_dev.c

5df6d737dd4b0fe Abhijeet Joglekar 2009-04-17  318  
363f4d937501ba4 Jason Yan         2020-04-15  319  static int vnic_dev_cmd2(struct vnic_dev *vdev, enum vnic_devcmd_cmd cmd,
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  320  		int wait)
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  321  {
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  322  	struct devcmd2_controller *dc2c = vdev->devcmd2;
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  323  	struct devcmd2_result *result;
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  324  	u8 color;
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  325  	unsigned int i;
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  326  	int delay;
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  327  	int err;
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  328  	u32 fetch_index;
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  329  	u32 posted;
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  330  	u32 new_posted;
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  331  
0a2fdd2215e1fa3 Satish Kharat     2019-01-18 @332  	posted = ioread32(&dc2c->wq_ctrl->posted_index);
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  333  	fetch_index = ioread32(&dc2c->wq_ctrl->fetch_index);
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  334  
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  335  	if (posted == 0xFFFFFFFF || fetch_index == 0xFFFFFFFF) {
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  336  		/* Hardware surprise removal: return error */
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  337  		pr_err("%s: devcmd2 invalid posted or fetch index on cmd %d\n",
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  338  				pci_name(vdev->pdev), _CMD_N(cmd));
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  339  		pr_err("%s: fetch index: %u, posted index: %u\n",
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  340  				pci_name(vdev->pdev), fetch_index, posted);
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  341  
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  342  		return -ENODEV;
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  343  
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  344  	}
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  345  
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  346  	new_posted = (posted + 1) % DEVCMD2_RING_SIZE;
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  347  
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  348  	if (new_posted == fetch_index) {
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  349  		pr_err("%s: devcmd2 wq full while issuing cmd %d\n",
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  350  				pci_name(vdev->pdev), _CMD_N(cmd));
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  351  		pr_err("%s: fetch index: %u, posted index: %u\n",
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  352  				pci_name(vdev->pdev), fetch_index, posted);
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  353  		return -EBUSY;
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  354  
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  355  	}
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  356  	dc2c->cmd_ring[posted].cmd = cmd;
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  357  	dc2c->cmd_ring[posted].flags = 0;
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  358  
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  359  	if ((_CMD_FLAGS(cmd) & _CMD_FLAGS_NOWAIT))
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  360  		dc2c->cmd_ring[posted].flags |= DEVCMD2_FNORESULT;
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  361  	if (_CMD_DIR(cmd) & _CMD_DIR_WRITE) {
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  362  		for (i = 0; i < VNIC_DEVCMD_NARGS; i++)
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  363  			dc2c->cmd_ring[posted].args[i] = vdev->args[i];
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  364  
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  365  	}
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  366  
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  367  	/* Adding write memory barrier prevents compiler and/or CPU
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  368  	 * reordering, thus avoiding descriptor posting before
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  369  	 * descriptor is initialized. Otherwise, hardware can read
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  370  	 * stale descriptor fields.
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  371  	 */
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  372  	wmb();
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  373  	iowrite32(new_posted, &dc2c->wq_ctrl->posted_index);
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  374  
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  375  	if (dc2c->cmd_ring[posted].flags & DEVCMD2_FNORESULT)
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  376  		return 0;
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  377  
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  378  	result = dc2c->result + dc2c->next_result;
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  379  	color = dc2c->color;
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  380  
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  381  	dc2c->next_result++;
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  382  	if (dc2c->next_result == dc2c->result_size) {
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  383  		dc2c->next_result = 0;
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  384  		dc2c->color = dc2c->color ? 0 : 1;
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  385  	}
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  386  
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  387  	for (delay = 0; delay < wait; delay++) {
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  388  		udelay(100);
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  389  		if (result->color == color) {
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  390  			if (result->error) {
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  391  				err = -(int) result->error;
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  392  				if (err != ERR_ECMDUNKNOWN ||
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  393  						cmd != CMD_CAPABILITY)
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  394  					pr_err("%s:Error %d devcmd %d\n",
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  395  						pci_name(vdev->pdev),
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  396  						err, _CMD_N(cmd));
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  397  				return err;
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  398  			}
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  399  			if (_CMD_DIR(cmd) & _CMD_DIR_READ) {
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  400  				rmb(); /*prevent reorder while reding result*/
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  401  				for (i = 0; i < VNIC_DEVCMD_NARGS; i++)
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  402  					vdev->args[i] = result->results[i];
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  403  			}
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  404  			return 0;
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  405  		}
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  406  	}
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  407  
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  408  	pr_err("%s:Timed out devcmd %d\n", pci_name(vdev->pdev), _CMD_N(cmd));
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  409  
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  410  	return -ETIMEDOUT;
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  411  }
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  412  

:::::: The code at line 332 was first introduced by commit
:::::: 0a2fdd2215e1fa3b417792bd6e9cb719822cbfb6 scsi: fnic: Adding devcmd2 init and posting interfaces

:::::: TO: Satish Kharat <satishkh@cisco.com>
:::::: CC: Martin K. Petersen <martin.petersen@oracle.com>

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

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 38067 bytes --]

^ permalink raw reply	[flat|nested] 17+ messages in thread

* drivers/scsi/fnic/vnic_dev.c:332:32: sparse: sparse: incorrect type in argument 1 (different address spaces)
@ 2020-12-23 15:11 kernel test robot
  0 siblings, 0 replies; 17+ messages in thread
From: kernel test robot @ 2020-12-23 15:11 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: kbuild-all, linux-kernel, Andrew Morton,
	Linux Memory Management List, Geert Uytterhoeven, Arnd Bergmann

[-- Attachment #1: Type: text/plain, Size: 10604 bytes --]

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   614cb5894306cfa2c7d9b6168182876ff5948735
commit: 8f28ca6bd8211214faf717677bbffe375c2a6072 iomap: constify ioreadX() iomem argument (as in generic implementation)
date:   4 months ago
config: i386-randconfig-s001-20201220 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0
reproduce:
        # apt-get install sparse
        # sparse version: v0.6.3-184-g1b896707-dirty
        # https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=8f28ca6bd8211214faf717677bbffe375c2a6072
        git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
        git fetch --no-tags linus master
        git checkout 8f28ca6bd8211214faf717677bbffe375c2a6072
        # save the attached .config to linux build tree
        make W=1 C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=i386 

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


"sparse warnings: (new ones prefixed by >>)"
>> drivers/scsi/fnic/vnic_dev.c:332:32: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void const [noderef] __iomem * @@     got unsigned int * @@
   drivers/scsi/fnic/vnic_dev.c:332:32: sparse:     expected void const [noderef] __iomem *
   drivers/scsi/fnic/vnic_dev.c:332:32: sparse:     got unsigned int *
   drivers/scsi/fnic/vnic_dev.c:333:37: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void const [noderef] __iomem * @@     got unsigned int * @@
   drivers/scsi/fnic/vnic_dev.c:333:37: sparse:     expected void const [noderef] __iomem *
   drivers/scsi/fnic/vnic_dev.c:333:37: sparse:     got unsigned int *
   drivers/scsi/fnic/vnic_dev.c:373:36: sparse: sparse: incorrect type in argument 2 (different address spaces) @@     expected void [noderef] __iomem * @@     got unsigned int * @@
   drivers/scsi/fnic/vnic_dev.c:373:36: sparse:     expected void [noderef] __iomem *
   drivers/scsi/fnic/vnic_dev.c:373:36: sparse:     got unsigned int *
   drivers/scsi/fnic/vnic_dev.c:469:32: sparse: sparse: incorrect type in assignment (different address spaces) @@     expected struct vnic_wq_ctrl *wq_ctrl @@     got struct vnic_wq_ctrl [noderef] __iomem *ctrl @@
   drivers/scsi/fnic/vnic_dev.c:469:32: sparse:     expected struct vnic_wq_ctrl *wq_ctrl
   drivers/scsi/fnic/vnic_dev.c:469:32: sparse:     got struct vnic_wq_ctrl [noderef] __iomem *ctrl
   drivers/scsi/fnic/vnic_dev.c:943:11: sparse: sparse: incorrect type in assignment (different address spaces) @@     expected void *p @@     got void [noderef] __iomem * @@
   drivers/scsi/fnic/vnic_dev.c:943:11: sparse:     expected void *p
   drivers/scsi/fnic/vnic_dev.c:943:11: sparse:     got void [noderef] __iomem *

vim +332 drivers/scsi/fnic/vnic_dev.c

5df6d737dd4b0fe Abhijeet Joglekar 2009-04-17  318  
363f4d937501ba4 Jason Yan         2020-04-15  319  static int vnic_dev_cmd2(struct vnic_dev *vdev, enum vnic_devcmd_cmd cmd,
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  320  		int wait)
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  321  {
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  322  	struct devcmd2_controller *dc2c = vdev->devcmd2;
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  323  	struct devcmd2_result *result;
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  324  	u8 color;
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  325  	unsigned int i;
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  326  	int delay;
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  327  	int err;
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  328  	u32 fetch_index;
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  329  	u32 posted;
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  330  	u32 new_posted;
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  331  
0a2fdd2215e1fa3 Satish Kharat     2019-01-18 @332  	posted = ioread32(&dc2c->wq_ctrl->posted_index);
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  333  	fetch_index = ioread32(&dc2c->wq_ctrl->fetch_index);
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  334  
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  335  	if (posted == 0xFFFFFFFF || fetch_index == 0xFFFFFFFF) {
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  336  		/* Hardware surprise removal: return error */
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  337  		pr_err("%s: devcmd2 invalid posted or fetch index on cmd %d\n",
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  338  				pci_name(vdev->pdev), _CMD_N(cmd));
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  339  		pr_err("%s: fetch index: %u, posted index: %u\n",
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  340  				pci_name(vdev->pdev), fetch_index, posted);
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  341  
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  342  		return -ENODEV;
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  343  
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  344  	}
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  345  
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  346  	new_posted = (posted + 1) % DEVCMD2_RING_SIZE;
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  347  
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  348  	if (new_posted == fetch_index) {
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  349  		pr_err("%s: devcmd2 wq full while issuing cmd %d\n",
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  350  				pci_name(vdev->pdev), _CMD_N(cmd));
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  351  		pr_err("%s: fetch index: %u, posted index: %u\n",
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  352  				pci_name(vdev->pdev), fetch_index, posted);
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  353  		return -EBUSY;
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  354  
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  355  	}
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  356  	dc2c->cmd_ring[posted].cmd = cmd;
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  357  	dc2c->cmd_ring[posted].flags = 0;
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  358  
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  359  	if ((_CMD_FLAGS(cmd) & _CMD_FLAGS_NOWAIT))
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  360  		dc2c->cmd_ring[posted].flags |= DEVCMD2_FNORESULT;
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  361  	if (_CMD_DIR(cmd) & _CMD_DIR_WRITE) {
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  362  		for (i = 0; i < VNIC_DEVCMD_NARGS; i++)
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  363  			dc2c->cmd_ring[posted].args[i] = vdev->args[i];
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  364  
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  365  	}
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  366  
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  367  	/* Adding write memory barrier prevents compiler and/or CPU
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  368  	 * reordering, thus avoiding descriptor posting before
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  369  	 * descriptor is initialized. Otherwise, hardware can read
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  370  	 * stale descriptor fields.
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  371  	 */
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  372  	wmb();
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  373  	iowrite32(new_posted, &dc2c->wq_ctrl->posted_index);
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  374  
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  375  	if (dc2c->cmd_ring[posted].flags & DEVCMD2_FNORESULT)
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  376  		return 0;
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  377  
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  378  	result = dc2c->result + dc2c->next_result;
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  379  	color = dc2c->color;
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  380  
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  381  	dc2c->next_result++;
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  382  	if (dc2c->next_result == dc2c->result_size) {
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  383  		dc2c->next_result = 0;
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  384  		dc2c->color = dc2c->color ? 0 : 1;
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  385  	}
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  386  
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  387  	for (delay = 0; delay < wait; delay++) {
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  388  		udelay(100);
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  389  		if (result->color == color) {
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  390  			if (result->error) {
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  391  				err = -(int) result->error;
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  392  				if (err != ERR_ECMDUNKNOWN ||
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  393  						cmd != CMD_CAPABILITY)
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  394  					pr_err("%s:Error %d devcmd %d\n",
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  395  						pci_name(vdev->pdev),
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  396  						err, _CMD_N(cmd));
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  397  				return err;
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  398  			}
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  399  			if (_CMD_DIR(cmd) & _CMD_DIR_READ) {
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  400  				rmb(); /*prevent reorder while reding result*/
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  401  				for (i = 0; i < VNIC_DEVCMD_NARGS; i++)
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  402  					vdev->args[i] = result->results[i];
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  403  			}
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  404  			return 0;
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  405  		}
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  406  	}
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  407  
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  408  	pr_err("%s:Timed out devcmd %d\n", pci_name(vdev->pdev), _CMD_N(cmd));
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  409  
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  410  	return -ETIMEDOUT;
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  411  }
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  412  

:::::: The code at line 332 was first introduced by commit
:::::: 0a2fdd2215e1fa3b417792bd6e9cb719822cbfb6 scsi: fnic: Adding devcmd2 init and posting interfaces

:::::: TO: Satish Kharat <satishkh@cisco.com>
:::::: CC: Martin K. Petersen <martin.petersen@oracle.com>

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

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 38067 bytes --]

^ permalink raw reply	[flat|nested] 17+ messages in thread

* drivers/scsi/fnic/vnic_dev.c:332:32: sparse: sparse: incorrect type in argument 1 (different address spaces)
@ 2020-12-21 18:45 kernel test robot
  0 siblings, 0 replies; 17+ messages in thread
From: kernel test robot @ 2020-12-21 18:45 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: kbuild-all, linux-kernel, Andrew Morton,
	Linux Memory Management List, Geert Uytterhoeven, Arnd Bergmann

[-- Attachment #1: Type: text/plain, Size: 10604 bytes --]

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   e37b12e4bb21e7c81732370b0a2b34bd196f380b
commit: 8f28ca6bd8211214faf717677bbffe375c2a6072 iomap: constify ioreadX() iomem argument (as in generic implementation)
date:   4 months ago
config: i386-randconfig-s001-20201220 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0
reproduce:
        # apt-get install sparse
        # sparse version: v0.6.3-184-g1b896707-dirty
        # https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=8f28ca6bd8211214faf717677bbffe375c2a6072
        git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
        git fetch --no-tags linus master
        git checkout 8f28ca6bd8211214faf717677bbffe375c2a6072
        # save the attached .config to linux build tree
        make W=1 C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=i386 

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


"sparse warnings: (new ones prefixed by >>)"
>> drivers/scsi/fnic/vnic_dev.c:332:32: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void const [noderef] __iomem * @@     got unsigned int * @@
   drivers/scsi/fnic/vnic_dev.c:332:32: sparse:     expected void const [noderef] __iomem *
   drivers/scsi/fnic/vnic_dev.c:332:32: sparse:     got unsigned int *
   drivers/scsi/fnic/vnic_dev.c:333:37: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void const [noderef] __iomem * @@     got unsigned int * @@
   drivers/scsi/fnic/vnic_dev.c:333:37: sparse:     expected void const [noderef] __iomem *
   drivers/scsi/fnic/vnic_dev.c:333:37: sparse:     got unsigned int *
   drivers/scsi/fnic/vnic_dev.c:373:36: sparse: sparse: incorrect type in argument 2 (different address spaces) @@     expected void [noderef] __iomem * @@     got unsigned int * @@
   drivers/scsi/fnic/vnic_dev.c:373:36: sparse:     expected void [noderef] __iomem *
   drivers/scsi/fnic/vnic_dev.c:373:36: sparse:     got unsigned int *
   drivers/scsi/fnic/vnic_dev.c:469:32: sparse: sparse: incorrect type in assignment (different address spaces) @@     expected struct vnic_wq_ctrl *wq_ctrl @@     got struct vnic_wq_ctrl [noderef] __iomem *ctrl @@
   drivers/scsi/fnic/vnic_dev.c:469:32: sparse:     expected struct vnic_wq_ctrl *wq_ctrl
   drivers/scsi/fnic/vnic_dev.c:469:32: sparse:     got struct vnic_wq_ctrl [noderef] __iomem *ctrl
   drivers/scsi/fnic/vnic_dev.c:943:11: sparse: sparse: incorrect type in assignment (different address spaces) @@     expected void *p @@     got void [noderef] __iomem * @@
   drivers/scsi/fnic/vnic_dev.c:943:11: sparse:     expected void *p
   drivers/scsi/fnic/vnic_dev.c:943:11: sparse:     got void [noderef] __iomem *

vim +332 drivers/scsi/fnic/vnic_dev.c

5df6d737dd4b0fe Abhijeet Joglekar 2009-04-17  318  
363f4d937501ba4 Jason Yan         2020-04-15  319  static int vnic_dev_cmd2(struct vnic_dev *vdev, enum vnic_devcmd_cmd cmd,
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  320  		int wait)
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  321  {
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  322  	struct devcmd2_controller *dc2c = vdev->devcmd2;
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  323  	struct devcmd2_result *result;
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  324  	u8 color;
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  325  	unsigned int i;
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  326  	int delay;
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  327  	int err;
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  328  	u32 fetch_index;
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  329  	u32 posted;
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  330  	u32 new_posted;
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  331  
0a2fdd2215e1fa3 Satish Kharat     2019-01-18 @332  	posted = ioread32(&dc2c->wq_ctrl->posted_index);
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  333  	fetch_index = ioread32(&dc2c->wq_ctrl->fetch_index);
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  334  
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  335  	if (posted == 0xFFFFFFFF || fetch_index == 0xFFFFFFFF) {
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  336  		/* Hardware surprise removal: return error */
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  337  		pr_err("%s: devcmd2 invalid posted or fetch index on cmd %d\n",
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  338  				pci_name(vdev->pdev), _CMD_N(cmd));
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  339  		pr_err("%s: fetch index: %u, posted index: %u\n",
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  340  				pci_name(vdev->pdev), fetch_index, posted);
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  341  
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  342  		return -ENODEV;
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  343  
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  344  	}
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  345  
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  346  	new_posted = (posted + 1) % DEVCMD2_RING_SIZE;
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  347  
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  348  	if (new_posted == fetch_index) {
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  349  		pr_err("%s: devcmd2 wq full while issuing cmd %d\n",
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  350  				pci_name(vdev->pdev), _CMD_N(cmd));
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  351  		pr_err("%s: fetch index: %u, posted index: %u\n",
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  352  				pci_name(vdev->pdev), fetch_index, posted);
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  353  		return -EBUSY;
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  354  
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  355  	}
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  356  	dc2c->cmd_ring[posted].cmd = cmd;
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  357  	dc2c->cmd_ring[posted].flags = 0;
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  358  
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  359  	if ((_CMD_FLAGS(cmd) & _CMD_FLAGS_NOWAIT))
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  360  		dc2c->cmd_ring[posted].flags |= DEVCMD2_FNORESULT;
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  361  	if (_CMD_DIR(cmd) & _CMD_DIR_WRITE) {
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  362  		for (i = 0; i < VNIC_DEVCMD_NARGS; i++)
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  363  			dc2c->cmd_ring[posted].args[i] = vdev->args[i];
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  364  
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  365  	}
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  366  
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  367  	/* Adding write memory barrier prevents compiler and/or CPU
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  368  	 * reordering, thus avoiding descriptor posting before
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  369  	 * descriptor is initialized. Otherwise, hardware can read
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  370  	 * stale descriptor fields.
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  371  	 */
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  372  	wmb();
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  373  	iowrite32(new_posted, &dc2c->wq_ctrl->posted_index);
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  374  
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  375  	if (dc2c->cmd_ring[posted].flags & DEVCMD2_FNORESULT)
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  376  		return 0;
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  377  
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  378  	result = dc2c->result + dc2c->next_result;
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  379  	color = dc2c->color;
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  380  
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  381  	dc2c->next_result++;
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  382  	if (dc2c->next_result == dc2c->result_size) {
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  383  		dc2c->next_result = 0;
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  384  		dc2c->color = dc2c->color ? 0 : 1;
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  385  	}
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  386  
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  387  	for (delay = 0; delay < wait; delay++) {
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  388  		udelay(100);
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  389  		if (result->color == color) {
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  390  			if (result->error) {
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  391  				err = -(int) result->error;
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  392  				if (err != ERR_ECMDUNKNOWN ||
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  393  						cmd != CMD_CAPABILITY)
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  394  					pr_err("%s:Error %d devcmd %d\n",
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  395  						pci_name(vdev->pdev),
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  396  						err, _CMD_N(cmd));
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  397  				return err;
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  398  			}
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  399  			if (_CMD_DIR(cmd) & _CMD_DIR_READ) {
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  400  				rmb(); /*prevent reorder while reding result*/
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  401  				for (i = 0; i < VNIC_DEVCMD_NARGS; i++)
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  402  					vdev->args[i] = result->results[i];
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  403  			}
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  404  			return 0;
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  405  		}
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  406  	}
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  407  
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  408  	pr_err("%s:Timed out devcmd %d\n", pci_name(vdev->pdev), _CMD_N(cmd));
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  409  
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  410  	return -ETIMEDOUT;
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  411  }
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  412  

:::::: The code at line 332 was first introduced by commit
:::::: 0a2fdd2215e1fa3b417792bd6e9cb719822cbfb6 scsi: fnic: Adding devcmd2 init and posting interfaces

:::::: TO: Satish Kharat <satishkh@cisco.com>
:::::: CC: Martin K. Petersen <martin.petersen@oracle.com>

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

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 38067 bytes --]

^ permalink raw reply	[flat|nested] 17+ messages in thread

* drivers/scsi/fnic/vnic_dev.c:332:32: sparse: sparse: incorrect type in argument 1 (different address spaces)
@ 2020-10-22  8:14 kernel test robot
  0 siblings, 0 replies; 17+ messages in thread
From: kernel test robot @ 2020-10-22  8:14 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: kbuild-all, linux-kernel, Andrew Morton,
	Linux Memory Management List, Geert Uytterhoeven, Arnd Bergmann

[-- Attachment #1: Type: text/plain, Size: 10594 bytes --]

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   f804b3159482eedbb4250b1e9248c308fb63b805
commit: 8f28ca6bd8211214faf717677bbffe375c2a6072 iomap: constify ioreadX() iomem argument (as in generic implementation)
date:   10 weeks ago
config: x86_64-randconfig-s031-20201022 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0
reproduce:
        # apt-get install sparse
        # sparse version: v0.6.3-dirty
        # https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=8f28ca6bd8211214faf717677bbffe375c2a6072
        git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
        git fetch --no-tags linus master
        git checkout 8f28ca6bd8211214faf717677bbffe375c2a6072
        # 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@intel.com>


"sparse warnings: (new ones prefixed by >>)"
>> drivers/scsi/fnic/vnic_dev.c:332:32: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void const [noderef] __iomem * @@     got unsigned int * @@
>> drivers/scsi/fnic/vnic_dev.c:332:32: sparse:     expected void const [noderef] __iomem *
   drivers/scsi/fnic/vnic_dev.c:332:32: sparse:     got unsigned int *
   drivers/scsi/fnic/vnic_dev.c:333:37: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void const [noderef] __iomem * @@     got unsigned int * @@
   drivers/scsi/fnic/vnic_dev.c:333:37: sparse:     expected void const [noderef] __iomem *
   drivers/scsi/fnic/vnic_dev.c:333:37: sparse:     got unsigned int *
   drivers/scsi/fnic/vnic_dev.c:373:36: sparse: sparse: incorrect type in argument 2 (different address spaces) @@     expected void [noderef] __iomem * @@     got unsigned int * @@
   drivers/scsi/fnic/vnic_dev.c:373:36: sparse:     expected void [noderef] __iomem *
   drivers/scsi/fnic/vnic_dev.c:373:36: sparse:     got unsigned int *
   drivers/scsi/fnic/vnic_dev.c:469:32: sparse: sparse: incorrect type in assignment (different address spaces) @@     expected struct vnic_wq_ctrl *wq_ctrl @@     got struct vnic_wq_ctrl [noderef] __iomem *ctrl @@
   drivers/scsi/fnic/vnic_dev.c:469:32: sparse:     expected struct vnic_wq_ctrl *wq_ctrl
   drivers/scsi/fnic/vnic_dev.c:469:32: sparse:     got struct vnic_wq_ctrl [noderef] __iomem *ctrl
   drivers/scsi/fnic/vnic_dev.c:943:11: sparse: sparse: incorrect type in assignment (different address spaces) @@     expected void *p @@     got void [noderef] __iomem * @@
   drivers/scsi/fnic/vnic_dev.c:943:11: sparse:     expected void *p
   drivers/scsi/fnic/vnic_dev.c:943:11: sparse:     got void [noderef] __iomem *

vim +332 drivers/scsi/fnic/vnic_dev.c

5df6d737dd4b0fe Abhijeet Joglekar 2009-04-17  318  
363f4d937501ba4 Jason Yan         2020-04-15  319  static int vnic_dev_cmd2(struct vnic_dev *vdev, enum vnic_devcmd_cmd cmd,
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  320  		int wait)
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  321  {
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  322  	struct devcmd2_controller *dc2c = vdev->devcmd2;
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  323  	struct devcmd2_result *result;
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  324  	u8 color;
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  325  	unsigned int i;
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  326  	int delay;
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  327  	int err;
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  328  	u32 fetch_index;
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  329  	u32 posted;
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  330  	u32 new_posted;
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  331  
0a2fdd2215e1fa3 Satish Kharat     2019-01-18 @332  	posted = ioread32(&dc2c->wq_ctrl->posted_index);
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  333  	fetch_index = ioread32(&dc2c->wq_ctrl->fetch_index);
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  334  
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  335  	if (posted == 0xFFFFFFFF || fetch_index == 0xFFFFFFFF) {
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  336  		/* Hardware surprise removal: return error */
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  337  		pr_err("%s: devcmd2 invalid posted or fetch index on cmd %d\n",
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  338  				pci_name(vdev->pdev), _CMD_N(cmd));
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  339  		pr_err("%s: fetch index: %u, posted index: %u\n",
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  340  				pci_name(vdev->pdev), fetch_index, posted);
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  341  
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  342  		return -ENODEV;
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  343  
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  344  	}
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  345  
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  346  	new_posted = (posted + 1) % DEVCMD2_RING_SIZE;
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  347  
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  348  	if (new_posted == fetch_index) {
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  349  		pr_err("%s: devcmd2 wq full while issuing cmd %d\n",
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  350  				pci_name(vdev->pdev), _CMD_N(cmd));
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  351  		pr_err("%s: fetch index: %u, posted index: %u\n",
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  352  				pci_name(vdev->pdev), fetch_index, posted);
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  353  		return -EBUSY;
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  354  
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  355  	}
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  356  	dc2c->cmd_ring[posted].cmd = cmd;
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  357  	dc2c->cmd_ring[posted].flags = 0;
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  358  
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  359  	if ((_CMD_FLAGS(cmd) & _CMD_FLAGS_NOWAIT))
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  360  		dc2c->cmd_ring[posted].flags |= DEVCMD2_FNORESULT;
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  361  	if (_CMD_DIR(cmd) & _CMD_DIR_WRITE) {
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  362  		for (i = 0; i < VNIC_DEVCMD_NARGS; i++)
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  363  			dc2c->cmd_ring[posted].args[i] = vdev->args[i];
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  364  
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  365  	}
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  366  
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  367  	/* Adding write memory barrier prevents compiler and/or CPU
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  368  	 * reordering, thus avoiding descriptor posting before
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  369  	 * descriptor is initialized. Otherwise, hardware can read
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  370  	 * stale descriptor fields.
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  371  	 */
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  372  	wmb();
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  373  	iowrite32(new_posted, &dc2c->wq_ctrl->posted_index);
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  374  
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  375  	if (dc2c->cmd_ring[posted].flags & DEVCMD2_FNORESULT)
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  376  		return 0;
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  377  
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  378  	result = dc2c->result + dc2c->next_result;
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  379  	color = dc2c->color;
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  380  
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  381  	dc2c->next_result++;
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  382  	if (dc2c->next_result == dc2c->result_size) {
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  383  		dc2c->next_result = 0;
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  384  		dc2c->color = dc2c->color ? 0 : 1;
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  385  	}
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  386  
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  387  	for (delay = 0; delay < wait; delay++) {
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  388  		udelay(100);
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  389  		if (result->color == color) {
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  390  			if (result->error) {
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  391  				err = -(int) result->error;
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  392  				if (err != ERR_ECMDUNKNOWN ||
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  393  						cmd != CMD_CAPABILITY)
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  394  					pr_err("%s:Error %d devcmd %d\n",
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  395  						pci_name(vdev->pdev),
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  396  						err, _CMD_N(cmd));
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  397  				return err;
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  398  			}
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  399  			if (_CMD_DIR(cmd) & _CMD_DIR_READ) {
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  400  				rmb(); /*prevent reorder while reding result*/
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  401  				for (i = 0; i < VNIC_DEVCMD_NARGS; i++)
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  402  					vdev->args[i] = result->results[i];
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  403  			}
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  404  			return 0;
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  405  		}
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  406  	}
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  407  
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  408  	pr_err("%s:Timed out devcmd %d\n", pci_name(vdev->pdev), _CMD_N(cmd));
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  409  
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  410  	return -ETIMEDOUT;
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  411  }
0a2fdd2215e1fa3 Satish Kharat     2019-01-18  412  

:::::: The code at line 332 was first introduced by commit
:::::: 0a2fdd2215e1fa3b417792bd6e9cb719822cbfb6 scsi: fnic: Adding devcmd2 init and posting interfaces

:::::: TO: Satish Kharat <satishkh@cisco.com>
:::::: CC: Martin K. Petersen <martin.petersen@oracle.com>

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

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 41069 bytes --]

^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2023-12-09 12:07 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-24 12:23 drivers/scsi/fnic/vnic_dev.c:332:32: sparse: sparse: incorrect type in argument 1 (different address spaces) kernel test robot
  -- strict thread matches above, loose matches on Subject: below --
2023-12-09 12:06 kernel test robot
2023-12-04 23:49 kernel test robot
2023-11-16  1:29 kernel test robot
2023-11-15 19:01 kernel test robot
2021-04-12 22:02 kernel test robot
2021-03-07  6:14 kernel test robot
2021-02-12 23:27 kernel test robot
2021-01-06 10:13 kernel test robot
2020-12-26 12:00 kernel test robot
2020-12-25 12:37 kernel test robot
2020-12-24 17:09 kernel test robot
2020-12-23 23:32 kernel test robot
2020-12-23 18:44 kernel test robot
2020-12-23 15:11 kernel test robot
2020-12-21 18:45 kernel test robot
2020-10-22  8:14 kernel test robot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).