lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <202012142359.ZshcbBoP-lkp@intel.com>
Date:   Mon, 14 Dec 2020 23:35:56 +0800
From:   kernel test robot <lkp@...el.com>
To:     Pawel Laszczak <pawell@...ence.com>, peter.chen@....com
Cc:     kbuild-all@...ts.01.org, rogerq@...com, a-govindraju@...com,
        nsekhar@...com, gregkh@...uxfoundation.org,
        linux-usb@...r.kernel.org, linux-kernel@...r.kernel.org,
        kurahul@...ence.com, Pawel Laszczak <pawell@...ence.com>
Subject: Re: [PATCH] usb: cdns3: Adds missing __iomem markers

Hi Pawel,

I love your patch! Perhaps something to improve:

[auto build test WARNING on next-20201211]
[cannot apply to peter.chen-usb/ci-for-usb-next v5.10 v5.10-rc7 v5.10-rc6 v5.10]
[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/Pawel-Laszczak/usb-cdns3-Adds-missing-__iomem-markers/20201214-205353
base:    3cc2bd440f2171f093b3a8480a4b54d8c270ed38
config: riscv-allmodconfig (attached as .config)
compiler: riscv64-linux-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/315bfcf1e0604de6ecfc1856cf5820876390f16c
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Pawel-Laszczak/usb-cdns3-Adds-missing-__iomem-markers/20201214-205353
        git checkout 315bfcf1e0604de6ecfc1856cf5820876390f16c
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=riscv 

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

All warnings (new ones prefixed by >>):

   In file included from arch/riscv/include/asm/io.h:23,
                    from include/linux/io.h:13,
                    from include/linux/irq.h:20,
                    from include/asm-generic/hardirq.h:17,
                    from ./arch/riscv/include/generated/asm/hardirq.h:1,
                    from include/linux/hardirq.h:10,
                    from include/linux/interrupt.h:11,
                    from drivers/usb/cdns3/drd.c:13:
   drivers/usb/cdns3/drd.c: In function 'cdns_otg_disable_irq':
   drivers/usb/cdns3/drd.c:159:31: error: dereferencing pointer to incomplete type 'struct cdns_otg_irq_reg'
     159 |  writel(0, &cdns->otg_irq_regs->ien);
         |                               ^~
   arch/riscv/include/asm/mmio.h:93:76: note: in definition of macro 'writel_cpu'
      93 | #define writel_cpu(v, c) ((void)__raw_writel((__force u32)cpu_to_le32(v), (c)))
         |                                                                            ^
   drivers/usb/cdns3/drd.c:159:2: note: in expansion of macro 'writel'
     159 |  writel(0, &cdns->otg_irq_regs->ien);
         |  ^~~~~~
   drivers/usb/cdns3/drd.c: In function 'cdns_drd_init':
   drivers/usb/cdns3/drd.c:409:22: error: assignment to 'struct cdns_otg_irq_reg *' from incompatible pointer type 'struct cdns_otg_irq_regs *' [-Werror=incompatible-pointer-types]
     409 |   cdns->otg_irq_regs = (struct cdns_otg_irq_regs __iomem  *)
         |                      ^
   In file included from include/linux/byteorder/little_endian.h:5,
                    from arch/riscv/include/uapi/asm/byteorder.h:10,
                    from include/asm-generic/bitops/le.h:6,
                    from arch/riscv/include/asm/bitops.h:202,
                    from include/linux/bitops.h:32,
                    from include/linux/kernel.h:11,
                    from drivers/usb/cdns3/drd.c:12:
>> drivers/usb/cdns3/drd.c:421:33: warning: passing argument 1 of '__raw_readl' makes pointer from integer without a cast [-Wint-conversion]
     421 |   if (readl(cdns->otg_cdnsp_regs->did) == OTG_CDNSP_DID) {
         |             ~~~~~~~~~~~~~~~~~~~~^~~~~
         |                                 |
         |                                 __le32 {aka unsigned int}
   include/uapi/linux/byteorder/little_endian.h:34:51: note: in definition of macro '__le32_to_cpu'
      34 | #define __le32_to_cpu(x) ((__force __u32)(__le32)(x))
         |                                                   ^
   arch/riscv/include/asm/mmio.h:140:47: note: in expansion of macro 'readl_cpu'
     140 | #define readl(c) ({ u32 __v; __io_br(); __v = readl_cpu(c); __io_ar(__v); __v; })
         |                                               ^~~~~~~~~
   drivers/usb/cdns3/drd.c:421:7: note: in expansion of macro 'readl'
     421 |   if (readl(cdns->otg_cdnsp_regs->did) == OTG_CDNSP_DID) {
         |       ^~~~~
   In file included from arch/riscv/include/asm/io.h:23,
                    from include/linux/io.h:13,
                    from include/linux/irq.h:20,
                    from include/asm-generic/hardirq.h:17,
                    from ./arch/riscv/include/generated/asm/hardirq.h:1,
                    from include/linux/hardirq.h:10,
                    from include/linux/interrupt.h:11,
                    from drivers/usb/cdns3/drd.c:13:
   arch/riscv/include/asm/mmio.h:63:60: note: expected 'const volatile void *' but argument is of type '__le32' {aka 'unsigned int'}
      63 | static inline u32 __raw_readl(const volatile void __iomem *addr)
         |                               ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~
   drivers/usb/cdns3/drd.c:422:23: error: assignment to 'struct cdns_otg_irq_reg *' from incompatible pointer type 'struct cdns_otg_irq_regs *' [-Werror=incompatible-pointer-types]
     422 |    cdns->otg_irq_regs = (struct cdns_otg_irq_regs __iomem *)
         |                       ^
   drivers/usb/cdns3/drd.c:426:23: error: assignment to 'struct cdns_otg_irq_reg *' from incompatible pointer type 'struct cdns_otg_irq_regs *' [-Werror=incompatible-pointer-types]
     426 |    cdns->otg_irq_regs = (struct cdns_otg_irq_regs __iomem *)
         |                       ^
   cc1: some warnings being treated as errors

vim +/__raw_readl +421 drivers/usb/cdns3/drd.c

   383	
   384	int cdns_drd_init(struct cdns *cdns)
   385	{
   386		void __iomem *regs;
   387		u32 state;
   388		int ret;
   389	
   390		regs = devm_ioremap_resource(cdns->dev, &cdns->otg_res);
   391		if (IS_ERR(regs))
   392			return PTR_ERR(regs);
   393	
   394		/* Detection of DRD version. Controller has been released
   395		 * in three versions. All are very similar and are software compatible,
   396		 * but they have same changes in register maps.
   397		 * The first register in oldest version is command register and it's
   398		 * read only. Driver should read 0 from it. On the other hand, in v1
   399		 * and v2 the first register contains device ID number which is not
   400		 * set to 0. Driver uses this fact to detect the proper version of
   401		 * controller.
   402		 */
   403		cdns->otg_v0_regs = regs;
   404		if (!readl(&cdns->otg_v0_regs->cmd)) {
   405			cdns->version  = CDNS3_CONTROLLER_V0;
   406			cdns->otg_v1_regs = NULL;
   407			cdns->otg_cdnsp_regs = NULL;
   408			cdns->otg_regs = regs;
   409			cdns->otg_irq_regs = (struct cdns_otg_irq_regs __iomem  *)
   410					     &cdns->otg_v0_regs->ien;
   411			writel(1, &cdns->otg_v0_regs->simulate);
   412			dev_dbg(cdns->dev, "DRD version v0 (%08x)\n",
   413				 readl(&cdns->otg_v0_regs->version));
   414		} else {
   415			cdns->otg_v0_regs = NULL;
   416			cdns->otg_v1_regs = regs;
   417			cdns->otg_cdnsp_regs = regs;
   418	
   419			cdns->otg_regs = (void __iomem *)&cdns->otg_v1_regs->cmd;
   420	
 > 421			if (readl(cdns->otg_cdnsp_regs->did) == OTG_CDNSP_DID) {
   422				cdns->otg_irq_regs = (struct cdns_otg_irq_regs __iomem *)
   423						      &cdns->otg_cdnsp_regs->ien;
   424				cdns->version  = CDNSP_CONTROLLER_V2;
   425			} else {
   426				cdns->otg_irq_regs = (struct cdns_otg_irq_regs __iomem *)
   427						      &cdns->otg_v1_regs->ien;
   428				writel(1, &cdns->otg_v1_regs->simulate);
   429				cdns->version  = CDNS3_CONTROLLER_V1;
   430			}
   431	
   432			dev_dbg(cdns->dev, "DRD version v1 (ID: %08x, rev: %08x)\n",
   433				 readl(&cdns->otg_v1_regs->did),
   434				 readl(&cdns->otg_v1_regs->rid));
   435		}
   436	
   437		state = OTGSTS_STRAP(readl(&cdns->otg_regs->sts));
   438	
   439		/* Update dr_mode according to STRAP configuration. */
   440		cdns->dr_mode = USB_DR_MODE_OTG;
   441	
   442		if ((cdns->version == CDNSP_CONTROLLER_V2 &&
   443		     state == OTGSTS_CDNSP_STRAP_HOST) ||
   444		    (cdns->version != CDNSP_CONTROLLER_V2 &&
   445		     state == OTGSTS_STRAP_HOST)) {
   446			dev_dbg(cdns->dev, "Controller strapped to HOST\n");
   447			cdns->dr_mode = USB_DR_MODE_HOST;
   448		} else if ((cdns->version == CDNSP_CONTROLLER_V2 &&
   449			    state == OTGSTS_CDNSP_STRAP_GADGET) ||
   450			   (cdns->version != CDNSP_CONTROLLER_V2 &&
   451			    state == OTGSTS_STRAP_GADGET)) {
   452			dev_dbg(cdns->dev, "Controller strapped to PERIPHERAL\n");
   453			cdns->dr_mode = USB_DR_MODE_PERIPHERAL;
   454		}
   455	
   456		ret = devm_request_threaded_irq(cdns->dev, cdns->otg_irq,
   457						cdns_drd_irq,
   458						cdns_drd_thread_irq,
   459						IRQF_SHARED,
   460						dev_name(cdns->dev), cdns);
   461		if (ret) {
   462			dev_err(cdns->dev, "couldn't get otg_irq\n");
   463			return ret;
   464		}
   465	
   466		state = readl(&cdns->otg_regs->sts);
   467		if (OTGSTS_OTG_NRDY(state)) {
   468			dev_err(cdns->dev, "Cadence USB3 OTG device not ready\n");
   469			return -ENODEV;
   470		}
   471	
   472		return 0;
   473	}
   474	

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

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ