All of lore.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: Akash Kumar <quic_akakum@quicinc.com>,
	Thinh Nguyen <Thinh.Nguyen@synopsys.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Jing Leng <jleng@ambarella.com>, Felipe Balbi <balbi@kernel.org>,
	Jack Pham <quic_jackp@quicinc.com>,
	kernel@quicinc.com, Wesley Cheng <quic_wcheng@quicinc.com>,
	Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
	Daniel Scally <dan.scally@ideasonboard.com>
Cc: oe-kbuild-all@lists.linux.dev,
	Vijayavardhan Vennapusa <quic_vvreddy@quicinc.com>,
	Krishna Kurapati <quic_kriskura@quicinc.com>,
	linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org,
	Akash Kumar <quic_akakum@quicinc.com>
Subject: Re: [PATCH v6] usb: dwc3: gadget: Refine the logic for resizing Tx FIFOs
Date: Thu, 17 Oct 2024 11:39:57 +0800	[thread overview]
Message-ID: <202410171133.eGVTBDtP-lkp@intel.com> (raw)
In-Reply-To: <20241016111904.11375-1-quic_akakum@quicinc.com>

Hi Akash,

kernel test robot noticed the following build warnings:

[auto build test WARNING on usb/usb-testing]
[also build test WARNING on usb/usb-next usb/usb-linus linus/master v6.12-rc3 next-20241016]
[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/Akash-Kumar/usb-dwc3-gadget-Refine-the-logic-for-resizing-Tx-FIFOs/20241016-192104
base:   https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-testing
patch link:    https://lore.kernel.org/r/20241016111904.11375-1-quic_akakum%40quicinc.com
patch subject: [PATCH v6] usb: dwc3: gadget: Refine the logic for resizing Tx FIFOs
config: i386-buildonly-randconfig-001-20241017 (https://download.01.org/0day-ci/archive/20241017/202410171133.eGVTBDtP-lkp@intel.com/config)
compiler: gcc-12 (Debian 12.2.0-14) 12.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20241017/202410171133.eGVTBDtP-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/202410171133.eGVTBDtP-lkp@intel.com/

All warnings (new ones prefixed by >>):

   drivers/usb/dwc3/gadget.c: In function 'dwc3_gadget_resize_tx_fifos':
>> drivers/usb/dwc3/gadget.c:777:9: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
     777 |         if (usb_endpoint_xfer_bulk(dep->endpoint.desc) ||
         |         ^~
   drivers/usb/dwc3/gadget.c:782:17: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
     782 |                 break;
         |                 ^~~~~
   drivers/usb/dwc3/gadget.c:792:9: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
     792 |         if (usb_endpoint_xfer_bulk(dep->endpoint.desc))
         |         ^~
   drivers/usb/dwc3/gadget.c:794:17: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
     794 |                 break;
         |                 ^~~~~


vim +/if +777 drivers/usb/dwc3/gadget.c

   726	
   727	/*
   728	 * dwc3_gadget_resize_tx_fifos - reallocate fifo spaces for current use-case
   729	 * @dwc: pointer to our context structure
   730	 *
   731	 * This function will a best effort FIFO allocation in order
   732	 * to improve FIFO usage and throughput, while still allowing
   733	 * us to enable as many endpoints as possible.
   734	 *
   735	 * Keep in mind that this operation will be highly dependent
   736	 * on the configured size for RAM1 - which contains TxFifo -,
   737	 * the amount of endpoints enabled on coreConsultant tool, and
   738	 * the width of the Master Bus.
   739	 *
   740	 * In general, FIFO depths are represented with the following equation:
   741	 *
   742	 * fifo_size = mult * ((max_packet + mdwidth)/mdwidth + 1) + 1
   743	 *
   744	 * In conjunction with dwc3_gadget_check_config(), this resizing logic will
   745	 * ensure that all endpoints will have enough internal memory for one max
   746	 * packet per endpoint.
   747	 */
   748	static int dwc3_gadget_resize_tx_fifos(struct dwc3_ep *dep)
   749	{
   750		struct dwc3 *dwc = dep->dwc;
   751		int fifo_0_start;
   752		int ram1_depth;
   753		int fifo_size;
   754		int min_depth;
   755		int num_in_ep;
   756		int remaining;
   757		int num_fifos = 1;
   758		int fifo;
   759		int tmp;
   760	
   761		if (!dwc->do_fifo_resize)
   762			return 0;
   763	
   764		/* resize IN endpoints except ep0 */
   765		if (!usb_endpoint_dir_in(dep->endpoint.desc) || dep->number <= 1)
   766			return 0;
   767	
   768		/* bail if already resized */
   769		if (dep->flags & DWC3_EP_TXFIFO_RESIZED)
   770			return 0;
   771	
   772		ram1_depth = DWC3_RAM1_DEPTH(dwc->hwparams.hwparams7);
   773	
   774		switch (dwc->gadget->speed) {
   775		case USB_SPEED_SUPER_PLUS:
   776		case USB_SPEED_SUPER:
 > 777		if (usb_endpoint_xfer_bulk(dep->endpoint.desc) ||
   778		    usb_endpoint_xfer_isoc(dep->endpoint.desc))
   779			num_fifos = min_t(unsigned int,
   780					  dep->endpoint.maxburst,
   781					  dwc->tx_fifo_resize_max_num);
   782			break;
   783		case USB_SPEED_HIGH:
   784		if (usb_endpoint_xfer_isoc(dep->endpoint.desc)) {
   785			num_fifos = min_t(unsigned int,
   786					  usb_endpoint_maxp_mult(dep->endpoint.desc) + 1,
   787					  dwc->tx_fifo_resize_max_num);
   788			break;
   789		}
   790			fallthrough;
   791		case USB_SPEED_FULL:
   792		if (usb_endpoint_xfer_bulk(dep->endpoint.desc))
   793			num_fifos = 2;
   794			break;
   795		default:
   796			break;
   797		}
   798	
   799		/* FIFO size for a single buffer */
   800		fifo = dwc3_gadget_calc_tx_fifo_size(dwc, 1);
   801	
   802		/* Calculate the number of remaining EPs w/o any FIFO */
   803		num_in_ep = dwc->max_cfg_eps;
   804		num_in_ep -= dwc->num_ep_resized;
   805	
   806		/* Reserve at least one FIFO for the number of IN EPs */
   807		min_depth = num_in_ep * (fifo + 1);
   808		remaining = ram1_depth - min_depth - dwc->last_fifo_depth;
   809		remaining = max_t(int, 0, remaining);
   810		/*
   811		 * We've already reserved 1 FIFO per EP, so check what we can fit in
   812		 * addition to it.  If there is not enough remaining space, allocate
   813		 * all the remaining space to the EP.
   814		 */
   815		fifo_size = (num_fifos - 1) * fifo;
   816		if (remaining < fifo_size)
   817			fifo_size = remaining;
   818	
   819		fifo_size += fifo;
   820		/* Last increment according to the TX FIFO size equation */
   821		fifo_size++;
   822	
   823		/* Check if TXFIFOs start at non-zero addr */
   824		tmp = dwc3_readl(dwc->regs, DWC3_GTXFIFOSIZ(0));
   825		fifo_0_start = DWC3_GTXFIFOSIZ_TXFSTADDR(tmp);
   826	
   827		fifo_size |= (fifo_0_start + (dwc->last_fifo_depth << 16));
   828		if (DWC3_IP_IS(DWC3))
   829			dwc->last_fifo_depth += DWC3_GTXFIFOSIZ_TXFDEP(fifo_size);
   830		else
   831			dwc->last_fifo_depth += DWC31_GTXFIFOSIZ_TXFDEP(fifo_size);
   832	
   833		/* Check fifo size allocation doesn't exceed available RAM size. */
   834		if (dwc->last_fifo_depth >= ram1_depth) {
   835			dev_err(dwc->dev, "Fifosize(%d) > RAM size(%d) %s depth:%d\n",
   836				dwc->last_fifo_depth, ram1_depth,
   837				dep->endpoint.name, fifo_size);
   838			if (DWC3_IP_IS(DWC3))
   839				fifo_size = DWC3_GTXFIFOSIZ_TXFDEP(fifo_size);
   840			else
   841				fifo_size = DWC31_GTXFIFOSIZ_TXFDEP(fifo_size);
   842	
   843			dwc->last_fifo_depth -= fifo_size;
   844			return -ENOMEM;
   845		}
   846	
   847		dwc3_writel(dwc->regs, DWC3_GTXFIFOSIZ(dep->number >> 1), fifo_size);
   848		dep->flags |= DWC3_EP_TXFIFO_RESIZED;
   849		dwc->num_ep_resized++;
   850	
   851		return 0;
   852	}
   853	

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

  parent reply	other threads:[~2024-10-17  3:40 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-16 11:19 [PATCH v6] usb: dwc3: gadget: Refine the logic for resizing Tx FIFOs Akash Kumar
2024-10-17  1:21 ` Thinh Nguyen
2024-10-17  3:39 ` kernel test robot [this message]
2024-10-17  3:50 ` kernel test robot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=202410171133.eGVTBDtP-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=Thinh.Nguyen@synopsys.com \
    --cc=balbi@kernel.org \
    --cc=dan.scally@ideasonboard.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=jleng@ambarella.com \
    --cc=kernel@quicinc.com \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=oe-kbuild-all@lists.linux.dev \
    --cc=quic_akakum@quicinc.com \
    --cc=quic_jackp@quicinc.com \
    --cc=quic_kriskura@quicinc.com \
    --cc=quic_vvreddy@quicinc.com \
    --cc=quic_wcheng@quicinc.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.