Re: [PATCH 02/24] mpi3mr: base driver code

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

 



Hi Kashyap,

I love your patch! Yet something to improve:

[auto build test ERROR on mkp-scsi/for-next]
[also build test ERROR on scsi/for-next v5.10 next-20201223]
[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/Kashyap-Desai/Introducing-mpi3mr-driver/20201222-181732
base:   https://git.kernel.org/pub/scm/linux/kernel/git/mkp/scsi.git for-next
config: arc-allyesconfig (attached as .config)
compiler: arceb-elf-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://github.com/0day-ci/linux/commit/f1507bd10ed4f38cbe02ec83c46bcac080b681cb
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Kashyap-Desai/Introducing-mpi3mr-driver/20201222-181732
        git checkout f1507bd10ed4f38cbe02ec83c46bcac080b681cb
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=arc 

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

All error/warnings (new ones prefixed by >>):

   drivers/scsi/mpi3mr/mpi3mr_fw.c: In function 'mpi3mr_isr':
   drivers/scsi/mpi3mr/mpi3mr_fw.c:315:6: warning: variable 'midx' set but not used [-Wunused-but-set-variable]
     315 |  u16 midx;
         |      ^~~~
   drivers/scsi/mpi3mr/mpi3mr_fw.c:314:21: warning: variable 'mrioc' set but not used [-Wunused-but-set-variable]
     314 |  struct mpi3mr_ioc *mrioc;
         |                     ^~~~~
   In file included from include/linux/printk.h:7,
                    from include/linux/kernel.h:16,
                    from include/linux/list.h:9,
                    from include/linux/rculist.h:10,
                    from include/linux/pid.h:5,
                    from include/linux/sched.h:14,
                    from include/linux/blkdev.h:5,
                    from drivers/scsi/mpi3mr/mpi3mr.h:13,
                    from drivers/scsi/mpi3mr/mpi3mr_fw.c:10:
   drivers/scsi/mpi3mr/mpi3mr_fw.c: In function 'mpi3mr_process_factsdata':
   include/linux/kern_levels.h:5:18: warning: format '%ld' expects argument of type 'long int', but argument 3 has type 'unsigned int' [-Wformat=]
       5 | #define KERN_SOH "\001"  /* ASCII Start Of Header */
         |                  ^~~~~~
   include/linux/kern_levels.h:12:22: note: in expansion of macro 'KERN_SOH'
      12 | #define KERN_WARNING KERN_SOH "4" /* warning conditions */
         |                      ^~~~~~~~
   include/linux/printk.h:353:9: note: in expansion of macro 'KERN_WARNING'
     353 |  printk(KERN_WARNING pr_fmt(fmt), ##__VA_ARGS__)
         |         ^~~~~~~~~~~~
   drivers/scsi/mpi3mr/mpi3mr_debug.h:49:2: note: in expansion of macro 'pr_warn'
      49 |  pr_warn("%s: " fmt, (ioc)->name, ##__VA_ARGS__)
         |  ^~~~~~~
   drivers/scsi/mpi3mr/mpi3mr_fw.c:933:3: note: in expansion of macro 'ioc_warn'
     933 |   ioc_warn(mrioc,
         |   ^~~~~~~~
   drivers/scsi/mpi3mr/mpi3mr_fw.c:934:49: note: format string is defined here
     934 |       "IOCFactsdata length mismatch driver_sz(%ld) firmware_sz(%d)\n",
         |                                               ~~^
         |                                                 |
         |                                                 long int
         |                                               %d
   drivers/scsi/mpi3mr/mpi3mr_fw.c: In function 'mpi3mr_cleanup_resources':
>> drivers/scsi/mpi3mr/mpi3mr_fw.c:1332:16: warning: passing argument 1 of 'iounmap' discards 'volatile' qualifier from pointer target type [-Wdiscarded-qualifiers]
    1332 |   iounmap(mrioc->sysif_regs);
         |           ~~~~~^~~~~~~~~~~~
   In file included from include/linux/io.h:13,
                    from include/linux/irq.h:20,
                    from include/asm-generic/hardirq.h:13,
                    from ./arch/arc/include/generated/asm/hardirq.h:1,
                    from include/linux/hardirq.h:10,
                    from include/linux/highmem.h:10,
                    from include/linux/pagemap.h:11,
                    from include/linux/blkdev.h:14,
                    from drivers/scsi/mpi3mr/mpi3mr.h:13,
                    from drivers/scsi/mpi3mr/mpi3mr_fw.c:10:
   arch/arc/include/asm/io.h:35:41: note: expected 'const void *' but argument is of type 'volatile Mpi3SysIfRegs_t *' {aka 'volatile struct _MPI3_SYSIF_REGISTERS *'}
      35 | extern void iounmap(const void __iomem *addr);
         |                     ~~~~~~~~~~~~~~~~~~~~^~~~
   drivers/scsi/mpi3mr/mpi3mr_fw.c: In function 'mpi3mr_init_ioc':
>> drivers/scsi/mpi3mr/mpi3mr_fw.c:1476:14: error: implicit declaration of function 'readq'; did you mean 'readl'? [-Werror=implicit-function-declaration]
    1476 |  base_info = readq(&mrioc->sysif_regs->IOCInformation);
         |              ^~~~~
         |              readl
   cc1: some warnings being treated as errors


vim +1476 drivers/scsi/mpi3mr/mpi3mr_fw.c

  1315	
  1316	
  1317	/**
  1318	 * mpi3mr_cleanup_resources - Free PCI resources
  1319	 * @mrioc: Adapter instance reference
  1320	 *
  1321	 * Unmap PCI device memory and disable PCI device.
  1322	 *
  1323	 * Return: 0 on success and non-zero on failure.
  1324	 */
  1325	void mpi3mr_cleanup_resources(struct mpi3mr_ioc *mrioc)
  1326	{
  1327		struct pci_dev *pdev = mrioc->pdev;
  1328	
  1329		mpi3mr_cleanup_isr(mrioc);
  1330	
  1331		if (mrioc->sysif_regs) {
> 1332			iounmap(mrioc->sysif_regs);
  1333			mrioc->sysif_regs = NULL;
  1334		}
  1335	
  1336		if (pci_is_enabled(pdev)) {
  1337			if (mrioc->bars)
  1338				pci_release_selected_regions(pdev, mrioc->bars);
  1339			pci_disable_device(pdev);
  1340		}
  1341	}
  1342	
  1343	/**
  1344	 * mpi3mr_setup_resources - Enable PCI resources
  1345	 * @mrioc: Adapter instance reference
  1346	 *
  1347	 * Enable PCI device memory, MSI-x registers and set DMA mask.
  1348	 *
  1349	 * Return: 0 on success and non-zero on failure.
  1350	 */
  1351	int mpi3mr_setup_resources(struct mpi3mr_ioc *mrioc)
  1352	{
  1353		struct pci_dev *pdev = mrioc->pdev;
  1354		u32 memap_sz = 0;
  1355		int i, retval = 0, capb = 0;
  1356		u16 message_control;
  1357		u64 dma_mask = mrioc->dma_mask ? mrioc->dma_mask :
  1358		    (((dma_get_required_mask(&pdev->dev) > DMA_BIT_MASK(32)) &&
  1359		    (sizeof(dma_addr_t) > 4)) ? DMA_BIT_MASK(64):DMA_BIT_MASK(32));
  1360	
  1361		if (pci_enable_device_mem(pdev)) {
  1362			ioc_err(mrioc, "pci_enable_device_mem: failed\n");
  1363			retval = -ENODEV;
  1364			goto out_failed;
  1365		}
  1366	
  1367		capb = pci_find_capability(pdev, PCI_CAP_ID_MSIX);
  1368		if (!capb) {
  1369			ioc_err(mrioc, "Unable to find MSI-X Capabilities\n");
  1370			retval = -ENODEV;
  1371			goto out_failed;
  1372		}
  1373		mrioc->bars = pci_select_bars(pdev, IORESOURCE_MEM);
  1374	
  1375		if (pci_request_selected_regions(pdev, mrioc->bars,
  1376		    mrioc->driver_name)) {
  1377			ioc_err(mrioc, "pci_request_selected_regions: failed\n");
  1378			retval = -ENODEV;
  1379			goto out_failed;
  1380		}
  1381	
  1382		for (i = 0; (i < DEVICE_COUNT_RESOURCE); i++) {
  1383			if (pci_resource_flags(pdev, i) & IORESOURCE_MEM) {
  1384				mrioc->sysif_regs_phys = pci_resource_start(pdev, i);
  1385				memap_sz = pci_resource_len(pdev, i);
  1386				mrioc->sysif_regs =
  1387				    ioremap(mrioc->sysif_regs_phys, memap_sz);
  1388				break;
  1389			}
  1390		}
  1391	
  1392		pci_set_master(pdev);
  1393	
  1394		retval = dma_set_mask_and_coherent(&pdev->dev, dma_mask);
  1395		if (retval) {
  1396			if (dma_mask != DMA_BIT_MASK(32)) {
  1397				ioc_warn(mrioc, "Setting 64 bit DMA mask failed\n");
  1398				dma_mask = DMA_BIT_MASK(32);
  1399				retval = dma_set_mask_and_coherent(&pdev->dev,
  1400				    dma_mask);
  1401			}
  1402			if (retval) {
  1403				mrioc->dma_mask = 0;
  1404				ioc_err(mrioc, "Setting 32 bit DMA mask also failed\n");
  1405				goto out_failed;
  1406			}
  1407		}
  1408		mrioc->dma_mask = dma_mask;
  1409	
  1410		if (mrioc->sysif_regs == NULL) {
  1411			ioc_err(mrioc,
  1412			    "Unable to map adapter memory or resource not found\n");
  1413			retval = -EINVAL;
  1414			goto out_failed;
  1415		}
  1416	
  1417		pci_read_config_word(pdev, capb + 2, &message_control);
  1418		mrioc->msix_count = (message_control & 0x3FF) + 1;
  1419	
  1420		pci_save_state(pdev);
  1421	
  1422		pci_set_drvdata(pdev, mrioc->shost);
  1423	
  1424		mpi3mr_ioc_disable_intr(mrioc);
  1425	
  1426		ioc_info(mrioc, "iomem(0x%016llx), mapped(0x%p), size(%d)\n",
  1427		    (unsigned long long)mrioc->sysif_regs_phys,
  1428		    mrioc->sysif_regs, memap_sz);
  1429		ioc_info(mrioc, "Number of MSI-X vectors found in capabilities: (%d)\n",
  1430		    mrioc->msix_count);
  1431		return retval;
  1432	
  1433	out_failed:
  1434		mpi3mr_cleanup_resources(mrioc);
  1435		return retval;
  1436	}
  1437	
  1438	/**
  1439	 * mpi3mr_init_ioc - Initialize the controller
  1440	 * @mrioc: Adapter instance reference
  1441	 *
  1442	 * This the controller initialization routine, executed either
  1443	 * after soft reset or from pci probe callback.
  1444	 * Setup the required resources, memory map the controller
  1445	 * registers, create admin and operational reply queue pairs,
  1446	 * allocate required memory for reply pool, sense buffer pool,
  1447	 * issue IOC init request to the firmware, unmask the events and
  1448	 * issue port enable to discover SAS/SATA/NVMe devies and RAID
  1449	 * volumes.
  1450	 *
  1451	 * Return: 0 on success and non-zero on failure.
  1452	 */
  1453	int mpi3mr_init_ioc(struct mpi3mr_ioc *mrioc)
  1454	{
  1455		int retval = 0;
  1456		enum mpi3mr_iocstate ioc_state;
  1457		u64 base_info;
  1458		u32 timeout;
  1459		u32 ioc_status, ioc_config;
  1460		Mpi3IOCFactsData_t facts_data;
  1461	
  1462		mrioc->change_count = 0;
  1463		mrioc->cpu_count = num_online_cpus();
  1464		retval = mpi3mr_setup_resources(mrioc);
  1465		if (retval) {
  1466			ioc_err(mrioc, "Failed to setup resources:error %d\n",
  1467			    retval);
  1468			goto out_nocleanup;
  1469		}
  1470		ioc_status = readl(&mrioc->sysif_regs->IOCStatus);
  1471		ioc_config = readl(&mrioc->sysif_regs->IOCConfiguration);
  1472	
  1473		ioc_info(mrioc, "SOD status %x configuration %x\n",
  1474		    ioc_status, ioc_config);
  1475	
> 1476		base_info = readq(&mrioc->sysif_regs->IOCInformation);
  1477		ioc_info(mrioc, "SOD base_info %llx\n",	base_info);
  1478	
  1479		/*The timeout value is in 2sec unit, changing it to seconds*/
  1480		mrioc->ready_timeout =
  1481		    ((base_info & MPI3_SYSIF_IOC_INFO_LOW_TIMEOUT_MASK) >>
  1482		    MPI3_SYSIF_IOC_INFO_LOW_TIMEOUT_SHIFT) * 2;
  1483	
  1484		ioc_info(mrioc, "IOC ready timeout %d\n", mrioc->ready_timeout);
  1485	
  1486		ioc_state = mpi3mr_get_iocstate(mrioc);
  1487		ioc_info(mrioc, "IOC in %s state during detection\n",
  1488		    mpi3mr_iocstate_name(ioc_state));
  1489	
  1490		if (ioc_state == MRIOC_STATE_BECOMING_READY ||
  1491				ioc_state == MRIOC_STATE_RESET_REQUESTED) {
  1492			timeout = mrioc->ready_timeout * 10;
  1493			do {
  1494				msleep(100);
  1495			} while (--timeout);
  1496	
  1497			ioc_state = mpi3mr_get_iocstate(mrioc);
  1498			ioc_info(mrioc,
  1499				"IOC in %s state after waiting for reset time\n",
  1500				mpi3mr_iocstate_name(ioc_state));
  1501		}
  1502	
  1503		if (ioc_state == MRIOC_STATE_READY) {
  1504			retval = mpi3mr_issue_and_process_mur(mrioc,
  1505			    MPI3MR_RESET_FROM_BRINGUP);
  1506			if (retval) {
  1507				ioc_err(mrioc, "Failed to MU reset IOC error %d\n",
  1508				    retval);
  1509			}
  1510			ioc_state = mpi3mr_get_iocstate(mrioc);
  1511		}
  1512		if (ioc_state != MRIOC_STATE_RESET) {
  1513			mpi3mr_print_fault_info(mrioc);
  1514			retval = mpi3mr_issue_reset(mrioc,
  1515			    MPI3_SYSIF_HOST_DIAG_RESET_ACTION_SOFT_RESET,
  1516			    MPI3MR_RESET_FROM_BRINGUP);
  1517			if (retval) {
  1518				ioc_err(mrioc,
  1519				    "%s :Failed to soft reset IOC error %d\n",
  1520				    __func__, retval);
  1521				goto out_failed;
  1522			}
  1523		}
  1524		ioc_state = mpi3mr_get_iocstate(mrioc);
  1525		if (ioc_state != MRIOC_STATE_RESET) {
  1526			ioc_err(mrioc, "Cannot bring IOC to reset state\n");
  1527			goto out_failed;
  1528		}
  1529	
  1530		retval = mpi3mr_setup_admin_qpair(mrioc);
  1531		if (retval) {
  1532			ioc_err(mrioc, "Failed to setup admin Qs: error %d\n",
  1533			    retval);
  1534			goto out_failed;
  1535		}
  1536	
  1537		retval = mpi3mr_bring_ioc_ready(mrioc);
  1538		if (retval) {
  1539			ioc_err(mrioc, "Failed to bring ioc ready: error %d\n",
  1540			    retval);
  1541			goto out_failed;
  1542		}
  1543	
  1544		retval = mpi3mr_setup_isr(mrioc, 1);
  1545		if (retval) {
  1546			ioc_err(mrioc, "Failed to setup ISR error %d\n",
  1547			    retval);
  1548			goto out_failed;
  1549		}
  1550	
  1551		retval = mpi3mr_issue_iocfacts(mrioc, &facts_data);
  1552		if (retval) {
  1553			ioc_err(mrioc, "Failed to Issue IOC Facts %d\n",
  1554			    retval);
  1555			goto out_failed;
  1556		}
  1557	
  1558		mpi3mr_process_factsdata(mrioc, &facts_data);
  1559		retval = mpi3mr_check_reset_dma_mask(mrioc);
  1560		if (retval) {
  1561			ioc_err(mrioc, "Resetting dma mask failed %d\n",
  1562			    retval);
  1563			goto out_failed;
  1564		}
  1565	
  1566		retval = mpi3mr_alloc_reply_sense_bufs(mrioc);
  1567		if (retval) {
  1568			ioc_err(mrioc,
  1569			    "%s :Failed to allocated reply sense buffers %d\n",
  1570			    __func__, retval);
  1571			goto out_failed;
  1572		}
  1573	
  1574		retval = mpi3mr_alloc_chain_bufs(mrioc);
  1575		if (retval) {
  1576			ioc_err(mrioc, "Failed to allocated chain buffers %d\n",
  1577			    retval);
  1578			goto out_failed;
  1579		}
  1580	
  1581		retval = mpi3mr_issue_iocinit(mrioc);
  1582		if (retval) {
  1583			ioc_err(mrioc, "Failed to Issue IOC Init %d\n",
  1584			    retval);
  1585			goto out_failed;
  1586		}
  1587		mrioc->reply_free_queue_host_index = mrioc->num_reply_bufs;
  1588		writel(mrioc->reply_free_queue_host_index,
  1589		    &mrioc->sysif_regs->ReplyFreeHostIndex);
  1590	
  1591		mrioc->sbq_host_index = mrioc->num_sense_bufs;
  1592		writel(mrioc->sbq_host_index,
  1593		    &mrioc->sysif_regs->SenseBufferFreeHostIndex);
  1594	
  1595		retval = mpi3mr_setup_isr(mrioc, 0);
  1596		if (retval) {
  1597			ioc_err(mrioc, "Failed to re-setup ISR, error %d\n",
  1598			    retval);
  1599			goto out_failed;
  1600		}
  1601	
  1602		return retval;
  1603	
  1604	out_failed:
  1605		mpi3mr_cleanup_ioc(mrioc);
  1606	out_nocleanup:
  1607		return retval;
  1608	}
  1609	

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

Attachment: .config.gz
Description: application/gzip


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]

  Powered by Linux