Re: [PATCH 1/2] vDPA/ifcvf: record virtio notify base

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Zhu,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on linus/master]
[also build test WARNING on v5.12 next-20210428]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Zhu-Lingshan/vDPA-ifcvf-implement-doorbell-mapping-feature/20210428-162843
base:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git acd3d28594536e9096c1ea76c5867d8a68babef6
config: x86_64-randconfig-s022-20210428 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
reproduce:
        # apt-get install sparse
        # sparse version: v0.6.3-341-g8af24329-dirty
        # https://github.com/0day-ci/linux/commit/79474dca6dd202684180ad6ea88b5f73fc4a87c2
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Zhu-Lingshan/vDPA-ifcvf-implement-doorbell-mapping-feature/20210428-162843
        git checkout 79474dca6dd202684180ad6ea88b5f73fc4a87c2
        # save the attached .config to linux build tree
        make W=1 C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' W=1 ARCH=x86_64 

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


sparse warnings: (new ones prefixed by >>)
>> drivers/vdpa/ifcvf/ifcvf_base.c:136:80: sparse: sparse: restricted __le32 degrades to integer

vim +136 drivers/vdpa/ifcvf/ifcvf_base.c

    98	
    99	int ifcvf_init_hw(struct ifcvf_hw *hw, struct pci_dev *pdev)
   100	{
   101		struct virtio_pci_cap cap;
   102		u16 notify_off;
   103		int ret;
   104		u8 pos;
   105		u32 i;
   106	
   107		ret = pci_read_config_byte(pdev, PCI_CAPABILITY_LIST, &pos);
   108		if (ret < 0) {
   109			IFCVF_ERR(pdev, "Failed to read PCI capability list\n");
   110			return -EIO;
   111		}
   112	
   113		while (pos) {
   114			ret = ifcvf_read_config_range(pdev, (u32 *)&cap,
   115						      sizeof(cap), pos);
   116			if (ret < 0) {
   117				IFCVF_ERR(pdev,
   118					  "Failed to get PCI capability at %x\n", pos);
   119				break;
   120			}
   121	
   122			if (cap.cap_vndr != PCI_CAP_ID_VNDR)
   123				goto next;
   124	
   125			switch (cap.cfg_type) {
   126			case VIRTIO_PCI_CAP_COMMON_CFG:
   127				hw->common_cfg = get_cap_addr(hw, &cap);
   128				IFCVF_DBG(pdev, "hw->common_cfg = %p\n",
   129					  hw->common_cfg);
   130				break;
   131			case VIRTIO_PCI_CAP_NOTIFY_CFG:
   132				pci_read_config_dword(pdev, pos + sizeof(cap),
   133						      &hw->notify_off_multiplier);
   134				hw->notify_bar = cap.bar;
   135				hw->notify_base = get_cap_addr(hw, &cap);
 > 136				hw->notify_pa = pci_resource_start(pdev, cap.bar) + cap.offset;
   137				IFCVF_DBG(pdev, "hw->notify_base = %p\n",
   138					  hw->notify_base);
   139				break;
   140			case VIRTIO_PCI_CAP_ISR_CFG:
   141				hw->isr = get_cap_addr(hw, &cap);
   142				IFCVF_DBG(pdev, "hw->isr = %p\n", hw->isr);
   143				break;
   144			case VIRTIO_PCI_CAP_DEVICE_CFG:
   145				hw->net_cfg = get_cap_addr(hw, &cap);
   146				IFCVF_DBG(pdev, "hw->net_cfg = %p\n", hw->net_cfg);
   147				break;
   148			}
   149	
   150	next:
   151			pos = cap.cap_next;
   152		}
   153	
   154		if (hw->common_cfg == NULL || hw->notify_base == NULL ||
   155		    hw->isr == NULL || hw->net_cfg == NULL) {
   156			IFCVF_ERR(pdev, "Incomplete PCI capabilities\n");
   157			return -EIO;
   158		}
   159	
   160		for (i = 0; i < IFCVF_MAX_QUEUE_PAIRS * 2; i++) {
   161			ifc_iowrite16(i, &hw->common_cfg->queue_select);
   162			notify_off = ifc_ioread16(&hw->common_cfg->queue_notify_off);
   163			hw->vring[i].notify_addr = hw->notify_base +
   164				notify_off * hw->notify_off_multiplier;
   165		}
   166	
   167		hw->lm_cfg = hw->base[IFCVF_LM_BAR];
   168	
   169		IFCVF_DBG(pdev,
   170			  "PCI capability mapping: common cfg: %p, notify base: %p\n, isr cfg: %p, device cfg: %p, multiplier: %u\n",
   171			  hw->common_cfg, hw->notify_base, hw->isr,
   172			  hw->net_cfg, hw->notify_off_multiplier);
   173	
   174		return 0;
   175	}
   176	

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

Attachment: .config.gz
Description: application/gzip


[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux