Re: [PATCH 3/6] PCI: dwc: endpoint: Add support for BAR type BAR_RESIZABLE

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

 



On Thu, Jan 09, 2025 at 10:22:07AM +0800, kernel test robot wrote:
> Hi Niklas,
> 
> kernel test robot noticed the following build warnings:
> 
> [auto build test WARNING on pci/next]
> [also build test WARNING on next-20250108]
> [cannot apply to pci/for-linus linus/master v6.13-rc6]
> [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/Niklas-Cassel/PCI-endpoint-Add-BAR-type-BAR_RESIZABLE/20250108-021844
> base:   https://git.kernel.org/pub/scm/linux/kernel/git/pci/pci.git next
> patch link:    https://lore.kernel.org/r/20250107181450.3182430-11-cassel%40kernel.org
> patch subject: [PATCH 3/6] PCI: dwc: endpoint: Add support for BAR type BAR_RESIZABLE
> config: arm-randconfig-003-20250109 (https://download.01.org/0day-ci/archive/20250109/202501090927.zMSzHORM-lkp@xxxxxxxxx/config)
> compiler: clang version 20.0.0git (https://github.com/llvm/llvm-project 096551537b2a747a3387726ca618ceeb3950e9bc)
> reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250109/202501090927.zMSzHORM-lkp@xxxxxxxxx/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@xxxxxxxxx>
> | Closes: https://lore.kernel.org/oe-kbuild-all/202501090927.zMSzHORM-lkp@xxxxxxxxx/
> 
> All warnings (new ones prefixed by >>):
> 
>    In file included from drivers/pci/controller/dwc/pcie-designware-ep.c:14:
>    In file included from drivers/pci/controller/dwc/pcie-designware.h:17:
>    In file included from include/linux/dma-mapping.h:8:
>    In file included from include/linux/scatterlist.h:8:
>    In file included from include/linux/mm.h:2223:
>    include/linux/vmstat.h:518:36: warning: arithmetic between different enumeration types ('enum node_stat_item' and 'enum lru_list') [-Wenum-enum-conversion]
>      518 |         return node_stat_name(NR_LRU_BASE + lru) + 3; // skip "nr_"
>          |                               ~~~~~~~~~~~ ^ ~~~
> >> drivers/pci/controller/dwc/pcie-designware-ep.c:259:27: warning: result of comparison of constant 140737488355328 with expression of type 'size_t' (aka 'unsigned int') is always false [-Wtautological-constant-out-of-range-compare]
>      259 |         if (size < SZ_1M || size > (SZ_128G * 1024))
>          |                             ~~~~ ^ ~~~~~~~~~~~~~~~~
>    2 warnings generated.
>

The compiler is correct that this condition can never happen on 32-bit,
but the code is correct, and the compiler will be able to optimize the
check away on 32-bit, so I will simply add a cast to shut up the warning.


Kind regards,
Niklas

> 
> vim +259 drivers/pci/controller/dwc/pcie-designware-ep.c
> 
>    249	
>    250	static u32 dw_pcie_ep_bar_size_to_rebar_cap(size_t size)
>    251	{
>    252		u32 val;
>    253	
>    254		/*
>    255		 * According to PCIe base spec, min size for a resizable BAR is 1 MB,
>    256		 * thus disallow a requested BAR size smaller than 1 MB.
>    257		 * Disallow a requested BAR size larger than 128 TB.
>    258		 */
>  > 259		if (size < SZ_1M || size > (SZ_128G * 1024))
>    260			return 0;
>    261	
>    262		val = ilog2(size);
>    263		val -= 20;
>    264	
>    265		/* Sizes in REBAR_CAP start at BIT(4). */
>    266		return BIT(val + 4);
>    267	}
>    268	
> 
> -- 
> 0-DAY CI Kernel Test Service
> https://github.com/intel/lkp-tests/wiki




[Index of Archives]     [DMA Engine]     [Linux Coverity]     [Linux USB]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Greybus]

  Powered by Linux