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]
Date:   Tue, 8 Nov 2022 04:42:41 +0800
From:   kernel test robot <lkp@...el.com>
To:     Herve Codina <herve.codina@...tlin.com>,
        Geert Uytterhoeven <geert+renesas@...der.be>,
        Michael Turquette <mturquette@...libre.com>,
        Stephen Boyd <sboyd@...nel.org>,
        Rob Herring <robh+dt@...nel.org>,
        Krzysztof Kozlowski <krzk@...nel.org>,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        Magnus Damm <magnus.damm@...il.com>,
        Gareth Williams <gareth.williams.jx@...esas.com>
Cc:     oe-kbuild-all@...ts.linux.dev, linux-renesas-soc@...r.kernel.org,
        linux-clk@...r.kernel.org, devicetree@...r.kernel.org,
        linux-kernel@...r.kernel.org, linux-usb@...r.kernel.org,
        Thomas Petazzoni <thomas.petazzoni@...tlin.com>,
        Miquel Raynal <miquel.raynal@...tlin.com>
Subject: Re: [PATCH 5/7] usb: gadget: udc: add Renesas RZ/N1 USBF controller
 support

Hi Herve,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on geert-renesas-drivers/renesas-clk]
[also build test WARNING on usb/usb-testing geert-renesas-devel/next linus/master v6.1-rc4 next-20221107]
[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#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Herve-Codina/Add-the-Renesas-USBF-controller-support/20221107-220159
base:   https://git.kernel.org/pub/scm/linux/kernel/git/geert/renesas-drivers.git renesas-clk
patch link:    https://lore.kernel.org/r/20221107135825.583877-6-herve.codina%40bootlin.com
patch subject: [PATCH 5/7] usb: gadget: udc: add Renesas RZ/N1 USBF controller support
config: ia64-allmodconfig
compiler: ia64-linux-gcc (GCC) 12.1.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/intel-lab-lkp/linux/commit/3f9bd513c21f6d289ffad6868aa19732b0ee63c0
        git remote add linux-review https://github.com/intel-lab-lkp/linux
        git fetch --no-tags linux-review Herve-Codina/Add-the-Renesas-USBF-controller-support/20221107-220159
        git checkout 3f9bd513c21f6d289ffad6868aa19732b0ee63c0
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=ia64 SHELL=/bin/bash drivers/usb/gadget/udc/

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

All warnings (new ones prefixed by >>):

   drivers/usb/gadget/udc/renesas_usbf.c: In function 'usbf_epn_dma_in':
>> drivers/usb/gadget/udc/renesas_usbf.c:897:62: warning: conversion from 'long unsigned int' to 'u32' {aka 'unsigned int'} changes value from '18446744073709551487' to '4294967167' [-Woverflow]
     897 |                 usbf_ep_reg_writel(epn, USBF_REG_EPN_STATUS, ~USBF_EPN_IN_END_INT);
>> drivers/usb/gadget/udc/renesas_usbf.c:32:38: warning: format '%u' expects argument of type 'unsigned int', but argument 4 has type 'size_t' {aka 'long unsigned int'} [-Wformat=]
      32 |                         trace_printk("%s: " _fmt, __func__, ##__VA_ARGS__); \
         |                                      ^~~~~~
   drivers/usb/gadget/udc/renesas_usbf.c:906:17: note: in expansion of macro 'TRACEEP'
     906 |                 TRACEEP(epn, "ep%d dma xfer %u\n", epn->id, req->dma_size);
         |                 ^~~~~~~
   drivers/usb/gadget/udc/renesas_usbf.c:931:70: warning: conversion from 'long unsigned int' to 'u32' {aka 'unsigned int'} changes value from '18446744073709551607' to '4294967287' [-Woverflow]
     931 |                         usbf_ep_reg_writel(epn, USBF_REG_EPN_STATUS, ~USBF_EPN_IN_INT);
   drivers/usb/gadget/udc/renesas_usbf.c:948:33: warning: conversion from 'long unsigned int' to 'u32' {aka 'unsigned int'} changes value from '18446744073709551607' to '4294967287' [-Woverflow]
     948 |                                 ~USBF_EPN_IN_INT);
   drivers/usb/gadget/udc/renesas_usbf.c: In function 'usbf_epn_dma_out_send_dma':
   drivers/usb/gadget/udc/renesas_usbf.c:1114:25: warning: conversion from 'long unsigned int' to 'u32' {aka 'unsigned int'} changes value from '18446744073701163007' to '4286578687' [-Woverflow]
    1114 |                         ~USBF_EPN_OUT_END_INT);
   drivers/usb/gadget/udc/renesas_usbf.c:1150:17: warning: conversion from 'long unsigned int' to 'u32' {aka 'unsigned int'} changes value from '18446744073701163007' to '4286578687' [-Woverflow]
    1150 |                 ~USBF_EPN_OUT_END_INT);
   drivers/usb/gadget/udc/renesas_usbf.c: In function 'usbf_epn_dma_out':
>> drivers/usb/gadget/udc/renesas_usbf.c:32:38: warning: format '%u' expects argument of type 'unsigned int', but argument 4 has type 'size_t' {aka 'long unsigned int'} [-Wformat=]
      32 |                         trace_printk("%s: " _fmt, __func__, ##__VA_ARGS__); \
         |                                      ^~~~~~
   drivers/usb/gadget/udc/renesas_usbf.c:1291:25: note: in expansion of macro 'TRACEEP'
    1291 |                         TRACEEP(epn, "ep%d dma short xfer %u\n", epn->id,
         |                         ^~~~~~~
>> drivers/usb/gadget/udc/renesas_usbf.c:32:38: warning: format '%u' expects argument of type 'unsigned int', but argument 4 has type 'size_t' {aka 'long unsigned int'} [-Wformat=]
      32 |                         trace_printk("%s: " _fmt, __func__, ##__VA_ARGS__); \
         |                                      ^~~~~~
   drivers/usb/gadget/udc/renesas_usbf.c:1317:17: note: in expansion of macro 'TRACEEP'
    1317 |                 TRACEEP(epn, "ep%d dma xfer %u (%u)\n", epn->id,
         |                 ^~~~~~~
   drivers/usb/gadget/udc/renesas_usbf.c:1380:41: warning: conversion from 'long unsigned int' to 'u32' {aka 'unsigned int'} changes value from '18446744073709289471' to '4294705151' [-Woverflow]
    1380 |                                         ~USBF_EPN_OUT_NULL_INT);
>> drivers/usb/gadget/udc/renesas_usbf.c:32:38: warning: format '%u' expects argument of type 'unsigned int', but argument 4 has type 'size_t' {aka 'long unsigned int'} [-Wformat=]
      32 |                         trace_printk("%s: " _fmt, __func__, ##__VA_ARGS__); \
         |                                      ^~~~~~
   drivers/usb/gadget/udc/renesas_usbf.c:1416:33: note: in expansion of macro 'TRACEEP'
    1416 |                                 TRACEEP(epn, "ep%d dma short xfer %u\n", epn->id,
         |                                 ^~~~~~~
--
   drivers/usb/gadget/udc/renesas_usbf.c: In function 'usbf_epn_dma_in':
>> drivers/usb/gadget/udc/renesas_usbf.c:897:62: warning: conversion from 'long unsigned int' to 'u32' {aka 'unsigned int'} changes value from '18446744073709551487' to '4294967167' [-Woverflow]
     897 |                 usbf_ep_reg_writel(epn, USBF_REG_EPN_STATUS, ~USBF_EPN_IN_END_INT);
   drivers/usb/gadget/udc/renesas_usbf.c:931:70: warning: conversion from 'long unsigned int' to 'u32' {aka 'unsigned int'} changes value from '18446744073709551607' to '4294967287' [-Woverflow]
     931 |                         usbf_ep_reg_writel(epn, USBF_REG_EPN_STATUS, ~USBF_EPN_IN_INT);
   drivers/usb/gadget/udc/renesas_usbf.c:948:33: warning: conversion from 'long unsigned int' to 'u32' {aka 'unsigned int'} changes value from '18446744073709551607' to '4294967287' [-Woverflow]
     948 |                                 ~USBF_EPN_IN_INT);
   drivers/usb/gadget/udc/renesas_usbf.c: In function 'usbf_epn_dma_out_send_dma':
   drivers/usb/gadget/udc/renesas_usbf.c:1114:25: warning: conversion from 'long unsigned int' to 'u32' {aka 'unsigned int'} changes value from '18446744073701163007' to '4286578687' [-Woverflow]
    1114 |                         ~USBF_EPN_OUT_END_INT);
   drivers/usb/gadget/udc/renesas_usbf.c:1150:17: warning: conversion from 'long unsigned int' to 'u32' {aka 'unsigned int'} changes value from '18446744073701163007' to '4286578687' [-Woverflow]
    1150 |                 ~USBF_EPN_OUT_END_INT);
   drivers/usb/gadget/udc/renesas_usbf.c: In function 'usbf_epn_dma_out':
   drivers/usb/gadget/udc/renesas_usbf.c:1380:41: warning: conversion from 'long unsigned int' to 'u32' {aka 'unsigned int'} changes value from '18446744073709289471' to '4294705151' [-Woverflow]
    1380 |                                         ~USBF_EPN_OUT_NULL_INT);


vim +897 drivers/usb/gadget/udc/renesas_usbf.c

   825	
   826	static int usbf_epn_dma_in(struct usbf_ep *epn, struct usbf_req *req)
   827	{
   828		unsigned int left;
   829		u32 npkt;
   830		u32 lastpkt;
   831		int ret;
   832	
   833		if (!IS_ALIGNED((uintptr_t)req->req.buf, 4)) {
   834			TRACEEP(epn, "ep%d buf unaligned -> fallback pio\n", epn->id);
   835			return usbf_epn_pio_in(epn, req);
   836		}
   837	
   838		left = req->req.length - req->req.actual;
   839	
   840		switch (req->xfer_step) {
   841		default:
   842		case USBF_XFER_START:
   843			if (left == 0) {
   844				TRACEEP(epn, "ep%d send null\n", epn->id);
   845				usbf_epn_send_null(epn);
   846				req->xfer_step = USBF_XFER_WAIT_END;
   847				break;
   848			}
   849			if (left < 4) {
   850				TRACEEP(epn, "ep%d send residue %u\n", epn->id, left);
   851				usbf_epn_send_residue(epn,
   852					req->req.buf + req->req.actual, left);
   853				req->req.actual += left;
   854				req->xfer_step = USBF_XFER_WAIT_END;
   855				break;
   856			}
   857	
   858			ret = usb_gadget_map_request(&epn->udc->gadget, &req->req, 1);
   859			if (ret < 0) {
   860				dev_err(epn->udc->dev, "usb_gadget_map_request failed (%d)\n",
   861					ret);
   862				return ret;
   863			}
   864			req->is_mapped = 1;
   865	
   866			npkt = DIV_ROUND_UP(left, epn->ep.maxpacket);
   867			lastpkt = (left % epn->ep.maxpacket);
   868			if (lastpkt == 0)
   869				lastpkt = epn->ep.maxpacket;
   870			lastpkt &= ~0x3; /* DMA is done on 32bit units */
   871	
   872			usbf_ep_dma_reg_writel(epn, USBF_REG_DMA_EPN_DCR2,
   873				USBF_SYS_EPN_MPKT(epn->ep.maxpacket) | USBF_SYS_EPN_LMPKT(lastpkt));
   874			usbf_ep_dma_reg_writel(epn, USBF_REG_DMA_EPN_TADR,
   875				req->req.dma);
   876			usbf_ep_dma_reg_writel(epn, USBF_REG_DMA_EPN_DCR1,
   877				USBF_SYS_EPN_SET_DMACNT(npkt));
   878			usbf_ep_dma_reg_bitset(epn, USBF_REG_DMA_EPN_DCR1,
   879				USBF_SYS_EPN_REQEN);
   880	
   881			usbf_ep_reg_writel(epn, USBF_REG_EPN_LEN_DCNT, USBF_EPN_SET_DMACNT(npkt));
   882	
   883			usbf_ep_reg_bitset(epn, USBF_REG_EPN_CONTROL, USBF_EPN_AUTO);
   884	
   885			/* The end of DMA transfer at the USBF level needs to be handle
   886			 * after the detection of the end of DMA transfer at the brige
   887			 * level.
   888			 * To force this sequence, EPN_IN_END_EN will be set by the
   889			 * detection of the end of transfer at bridge level (ie. bridge
   890			 * interrupt).
   891			 */
   892			usbf_ep_reg_bitclr(epn, USBF_REG_EPN_INT_ENA,
   893				USBF_EPN_IN_EN | USBF_EPN_IN_END_EN);
   894			epn->bridge_on_dma_end = usbf_epn_enable_in_end_int;
   895	
   896			/* Clear any pending IN_END interrupt */
 > 897			usbf_ep_reg_writel(epn, USBF_REG_EPN_STATUS, ~USBF_EPN_IN_END_INT);
   898	
   899			usbf_ep_reg_writel(epn, USBF_REG_EPN_DMA_CTRL,
   900				USBF_EPN_BURST_SET | USBF_EPN_DMAMODE0);
   901			usbf_ep_reg_bitset(epn, USBF_REG_EPN_DMA_CTRL,
   902				USBF_EPN_DMA_EN);
   903	
   904			req->dma_size = (npkt - 1) * epn->ep.maxpacket + lastpkt;
   905	
   906			TRACEEP(epn, "ep%d dma xfer %u\n", epn->id, req->dma_size);
   907	
   908			req->xfer_step = USBF_XFER_WAIT_DMA;
   909			break;
   910	
   911		case USBF_XFER_WAIT_DMA:
   912			if (!(epn->status & USBF_EPN_IN_END_INT)) {
   913				TRACEEP(epn, "ep%d dma not done\n", epn->id);
   914				break;
   915			}
   916			TRACEEP(epn, "ep%d dma done\n", epn->id);
   917	
   918			usb_gadget_unmap_request(&epn->udc->gadget, &req->req, 1);
   919			req->is_mapped = 0;
   920	
   921			usbf_ep_reg_bitclr(epn, USBF_REG_EPN_CONTROL, USBF_EPN_AUTO);
   922	
   923			usbf_ep_reg_clrset(epn, USBF_REG_EPN_INT_ENA,
   924				USBF_EPN_IN_END_EN,
   925				USBF_EPN_IN_EN);
   926	
   927			req->req.actual += req->dma_size;
   928	
   929			left = req->req.length - req->req.actual;
   930			if (left) {
   931				usbf_ep_reg_writel(epn, USBF_REG_EPN_STATUS, ~USBF_EPN_IN_INT);
   932	
   933				TRACEEP(epn, "ep%d send residue %u\n", epn->id, left);
   934				usbf_epn_send_residue(epn,
   935					req->req.buf + req->req.actual, left);
   936				req->req.actual += left;
   937				req->xfer_step = USBF_XFER_WAIT_END;
   938				break;
   939			}
   940	
   941			if (req->req.actual % epn->ep.maxpacket) {
   942				/* last packet was a short packet. Tell the hardware to
   943				 * send it right now.
   944				 */
   945				TRACEEP(epn, "ep%d send short\n", epn->id);
   946	
   947				usbf_ep_reg_writel(epn, USBF_REG_EPN_STATUS,
   948					~USBF_EPN_IN_INT);
   949				usbf_ep_reg_bitset(epn, USBF_REG_EPN_CONTROL,
   950					USBF_EPN_DEND);
   951	
   952				req->xfer_step = USBF_XFER_WAIT_END;
   953				break;
   954			}
   955	
   956			/* Last packet size was a maxpacket size
   957			 * Send null packet if needed
   958			 */
   959			if (req->req.zero) {
   960				req->xfer_step = USBF_XFER_SEND_NULL;
   961				break;
   962			}
   963	
   964			/* No more action to do. Wait for the end of the USB transfer */
   965			req->xfer_step = USBF_XFER_WAIT_END;
   966			break;
   967	
   968		case USBF_XFER_SEND_NULL:
   969			TRACEEP(epn, "ep%d send null\n", epn->id);
   970			usbf_epn_send_null(epn);
   971			req->xfer_step = USBF_XFER_WAIT_END;
   972			break;
   973	
   974		case USBF_XFER_WAIT_END:
   975			if (!(epn->status & USBF_EPN_IN_INT)) {
   976				TRACEEP(epn, "ep%d end not done\n", epn->id);
   977				break;
   978			}
   979			TRACEEP(epn, "ep%d send done %u/%u\n", epn->id,
   980				req->req.actual, req->req.length);
   981			req->xfer_step = USBF_XFER_START;
   982			return 0;
   983		}
   984	
   985		return -EINPROGRESS;
   986	}
   987	

-- 
0-DAY CI Kernel Test Service
https://01.org/lkp

View attachment "config" of type "text/plain" (286804 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ