[xlnx:master 137/137] drivers/misc/xilinx-ai-engine/ai-engine-dma.c:83:24: warning: format '%lx' expects argument of type 'long unsigned int', but argument 4 has type 'size_t' {aka 'unsigned int'}

kernel test robot lkp at intel.com
Tue Aug 11 15:09:30 EDT 2020


tree:   https://github.com/Xilinx/linux-xlnx master
head:   566441779cdc25e377c2baab9277342b09b4249b
commit: 566441779cdc25e377c2baab9277342b09b4249b [137/137] misc: xilinx-ai-engine: add setting shim dma bd operation
config: mips-allyesconfig (attached as .config)
compiler: mips-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
        git checkout 566441779cdc25e377c2baab9277342b09b4249b
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=mips 

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

All warnings (new ones prefixed by >>):

   In file included from include/linux/cdev.h:8,
                    from drivers/misc/xilinx-ai-engine/ai-engine-internal.h:13,
                    from drivers/misc/xilinx-ai-engine/ai-engine-dma.c:8:
   drivers/misc/xilinx-ai-engine/ai-engine-dma.c: In function 'aie_part_get_dmabuf_da':
>> drivers/misc/xilinx-ai-engine/ai-engine-dma.c:83:24: warning: format '%lx' expects argument of type 'long unsigned int', but argument 4 has type 'size_t' {aka 'unsigned int'} [-Wformat=]
      83 |   dev_err(&apart->dev, "failed to find vma for %p, 0x%lx.\n",
         |                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/device.h:1658:22: note: in definition of macro 'dev_fmt'
    1658 | #define dev_fmt(fmt) fmt
         |                      ^~~
   drivers/misc/xilinx-ai-engine/ai-engine-dma.c:83:3: note: in expansion of macro 'dev_err'
      83 |   dev_err(&apart->dev, "failed to find vma for %p, 0x%lx.\n",
         |   ^~~~~~~
   drivers/misc/xilinx-ai-engine/ai-engine-dma.c:83:56: note: format string is defined here
      83 |   dev_err(&apart->dev, "failed to find vma for %p, 0x%lx.\n",
         |                                                      ~~^
         |                                                        |
         |                                                        long unsigned int
         |                                                      %x
   In file included from include/linux/cdev.h:8,
                    from drivers/misc/xilinx-ai-engine/ai-engine-internal.h:13,
                    from drivers/misc/xilinx-ai-engine/ai-engine-dma.c:8:
   drivers/misc/xilinx-ai-engine/ai-engine-dma.c:103:4: warning: format '%lx' expects argument of type 'long unsigned int', but argument 4 has type 'size_t' {aka 'unsigned int'} [-Wformat=]
     103 |    "failed to get dma address for %p, 0x%lx.\n", va, len);
         |    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/device.h:1658:22: note: in definition of macro 'dev_fmt'
    1658 | #define dev_fmt(fmt) fmt
         |                      ^~~
   drivers/misc/xilinx-ai-engine/ai-engine-dma.c:102:3: note: in expansion of macro 'dev_err'
     102 |   dev_err(&apart->dev,
         |   ^~~~~~~
   drivers/misc/xilinx-ai-engine/ai-engine-dma.c:103:43: note: format string is defined here
     103 |    "failed to get dma address for %p, 0x%lx.\n", va, len);
         |                                         ~~^
         |                                           |
         |                                           long unsigned int
         |                                         %x

vim +83 drivers/misc/xilinx-ai-engine/ai-engine-dma.c

   > 8	#include "ai-engine-internal.h"
     9	#include <linux/dma-buf.h>
    10	#include <linux/kernel.h>
    11	#include <linux/mm.h>
    12	#include <linux/refcount.h>
    13	#include <linux/slab.h>
    14	#include <linux/types.h>
    15	#include <linux/uaccess.h>
    16	
    17	/**
    18	 * struct aie_dmabuf - AI engine dmabuf information
    19	 * @attach: dmabuf attachment pointer
    20	 * @sgt: scatter/gather table
    21	 * @refs: refcount of the attached aie_dmabuf
    22	 * @node: list node
    23	 */
    24	struct aie_dmabuf {
    25		struct dma_buf_attachment *attach;
    26		struct sg_table *sgt;
    27		refcount_t refs;
    28		struct list_head node;
    29	};
    30	
    31	/**
    32	 * aie_part_find_dmabuf_from_file() - find a attached dmabuf from file
    33	 * @apart: AI engine partition
    34	 * @file: file which belongs to a dmabuf
    35	 * @return: pointer to AI engine dmabuf struct of the found dmabuf, if dmabuf
    36	 *	    is not found, returns NULL.
    37	 *
    38	 * This function scans all the attached dmabufs of the AI engine partition,
    39	 * it checks the file with the attached dmabufs, if it founds a match, it
    40	 * returns the aie_dmabuf pointer.
    41	 */
    42	static struct aie_dmabuf *
    43	aie_part_find_dmabuf_from_file(struct aie_partition *apart,
    44				       const struct file *file)
    45	{
    46		struct aie_dmabuf *adbuf;
    47	
    48		list_for_each_entry(adbuf, &apart->dbufs, node) {
    49			if (file ==  adbuf->attach->dmabuf->file)
    50				return adbuf;
    51		}
    52	
    53		return NULL;
    54	}
    55	
    56	/**
    57	 * aie_part_get_dmabuf_da() -  get DMA address from the va
    58	 * @apart: AI engine partition
    59	 * @va: virtual address
    60	 * @len: memory length
    61	 * @return: dma address of of the specified va, or 0 if va is not valid
    62	 *
    63	 * This function returns DMA address if the has been mapped to a dmabuf which
    64	 * has been attached to the AI engine partition.
    65	 */
    66	static dma_addr_t aie_part_get_dmabuf_da(struct aie_partition *apart,
    67						 void *va, size_t len)
    68	{
    69		struct vm_area_struct *vma;
    70		struct aie_dmabuf *adbuf;
    71		unsigned long va_start, va_off;
    72		dma_addr_t da;
    73	
    74		va_start = (unsigned long)((uintptr_t)va);
    75		if (!current->mm) {
    76			dev_err(&apart->dev,
    77				"failed to get dma address from va, no process mm.\n");
    78			return 0;
    79		}
    80	
    81		vma = find_vma(current->mm, va_start);
    82		if (!vma) {
  > 83			dev_err(&apart->dev, "failed to find vma for %p, 0x%lx.\n",
    84				va, len);
    85			return 0;
    86		}
    87	
    88		adbuf = aie_part_find_dmabuf_from_file(apart, vma->vm_file);
    89		if (!adbuf) {
    90			dev_err(&apart->dev,
    91				"failed to get dma address for %p, no dma buf is found.\n",
    92				va);
    93			return 0;
    94		}
    95	
    96		va_off = va_start - vma->vm_start;
    97		/*
    98		 * As we only support continuous DMA memory which is guaranteed from
    99		 * dmabuf attachment, we will compared with the size of the dmabuf only
   100		 */
   101		if (va_off + len >= adbuf->attach->dmabuf->size) {
   102			dev_err(&apart->dev,
   103				"failed to get dma address for %p, 0x%lx.\n", va, len);
   104			return 0;
   105		}
   106	
   107		da = sg_dma_address(adbuf->sgt->sgl) + va_off;
   108		return da;
   109	}
   110	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: .config.gz
Type: application/gzip
Size: 63609 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20200812/165ac343/attachment-0001.gz>


More information about the linux-arm-kernel mailing list