tree:
https://github.com/intel/linux-intel-lts.git 5.4/yocto
head: 87241c08286384feb3ddc57d4cb0daca4be1e384
commit: 25008f6f07f24ad55251a3f30505723f1c985338 [8458/9195] misc: vpusmm: add
alloc/import DMABuf for VPU
config: nios2-randconfig-r026-20200811 (attached as .config)
compiler: nios2-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 25008f6f07f24ad55251a3f30505723f1c985338
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=nios2
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp(a)intel.com>
All warnings (new ones prefixed by >>):
drivers/misc/vpusmm/vpusmm_driver.c:406:6: warning: no previous prototype for
'vpusmm_dmabuf_release' [-Wmissing-prototypes]
406 | void vpusmm_dmabuf_release(struct dma_buf *dmabuf)
| ^~~~~~~~~~~~~~~~~~~~~
In file included from include/linux/kernel.h:15,
from include/asm-generic/bug.h:19,
from ./arch/nios2/include/generated/asm/bug.h:1,
from include/linux/bug.h:5,
from include/linux/thread_info.h:12,
from include/asm-generic/current.h:5,
from ./arch/nios2/include/generated/asm/current.h:1,
from include/linux/sched.h:12,
from include/linux/uaccess.h:5,
from drivers/misc/vpusmm/vpusmm_driver.c:7:
drivers/misc/vpusmm/vpusmm_driver.c: In function 'vpusmm_session_alloc':
> drivers/misc/vpusmm/vpusmm_driver.c:616:11: warning: format
'%llx' expects argument of type 'long long unsigned int', but argument 4
has type 'dma_addr_t' {aka 'unsigned int'} [-Wformat=]
616 |
pr_debug("%s: dma_addr=%llx, phys_addr=%llx allocated from %s\n",
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/printk.h:283:21: note: in definition of macro 'pr_fmt'
283 | #define pr_fmt(fmt) fmt
| ^~~
include/linux/dynamic_debug.h:143:2: note: in expansion of macro
'__dynamic_func_call'
143 | __dynamic_func_call(__UNIQUE_ID(ddebug), fmt, func, ##__VA_ARGS__)
| ^~~~~~~~~~~~~~~~~~~
include/linux/dynamic_debug.h:153:2: note: in expansion of macro
'_dynamic_func_call'
153 | _dynamic_func_call(fmt, __dynamic_pr_debug, \
| ^~~~~~~~~~~~~~~~~~
include/linux/printk.h:331:2: note: in expansion of macro 'dynamic_pr_debug'
331 | dynamic_pr_debug(fmt, ##__VA_ARGS__)
| ^~~~~~~~~~~~~~~~
drivers/misc/vpusmm/vpusmm_driver.c:616:2: note: in expansion of macro
'pr_debug'
616 | pr_debug("%s: dma_addr=%llx, phys_addr=%llx allocated from %s\n",
| ^~~~~~~~
drivers/misc/vpusmm/vpusmm_driver.c:616:28: note: format string is defined here
616 | pr_debug("%s: dma_addr=%llx, phys_addr=%llx allocated from %s\n",
| ~~~^
| |
| long long unsigned int
| %x
In file included from include/linux/kernel.h:15,
from include/asm-generic/bug.h:19,
from ./arch/nios2/include/generated/asm/bug.h:1,
from include/linux/bug.h:5,
from include/linux/thread_info.h:12,
from include/asm-generic/current.h:5,
from ./arch/nios2/include/generated/asm/current.h:1,
from include/linux/sched.h:12,
from include/linux/uaccess.h:5,
from drivers/misc/vpusmm/vpusmm_driver.c:7:
> drivers/misc/vpusmm/vpusmm_driver.c:616:11: warning: format
'%llx' expects argument of type 'long long unsigned int', but argument 5
has type 'phys_addr_t' {aka 'unsigned int'} [-Wformat=]
616 |
pr_debug("%s: dma_addr=%llx, phys_addr=%llx allocated from %s\n",
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/printk.h:283:21: note: in definition of macro 'pr_fmt'
283 | #define pr_fmt(fmt) fmt
| ^~~
include/linux/dynamic_debug.h:143:2: note: in expansion of macro
'__dynamic_func_call'
143 | __dynamic_func_call(__UNIQUE_ID(ddebug), fmt, func, ##__VA_ARGS__)
| ^~~~~~~~~~~~~~~~~~~
include/linux/dynamic_debug.h:153:2: note: in expansion of macro
'_dynamic_func_call'
153 | _dynamic_func_call(fmt, __dynamic_pr_debug, \
| ^~~~~~~~~~~~~~~~~~
include/linux/printk.h:331:2: note: in expansion of macro 'dynamic_pr_debug'
331 | dynamic_pr_debug(fmt, ##__VA_ARGS__)
| ^~~~~~~~~~~~~~~~
drivers/misc/vpusmm/vpusmm_driver.c:616:2: note: in expansion of macro
'pr_debug'
616 | pr_debug("%s: dma_addr=%llx, phys_addr=%llx allocated from %s\n",
| ^~~~~~~~
drivers/misc/vpusmm/vpusmm_driver.c:616:44: note: format string is defined here
616 | pr_debug("%s: dma_addr=%llx, phys_addr=%llx allocated from %s\n",
| ~~~^
| |
| long long unsigned int
| %x
In file included from include/linux/cdev.h:8,
from drivers/misc/vpusmm/vpusmm_driver.c:12:
drivers/misc/vpusmm/vpusmm_driver.c: In function 'vpusmm_probe':
drivers/misc/vpusmm/vpusmm_driver.c:935:18: warning: format '%llx' expects
argument of type 'long long unsigned int', but argument 5 has type
'resource_size_t' {aka 'unsigned int'} [-Wformat=]
935 | dev_info(dev, " %s %zuMB %llx~%llx\n", dev_name(mem_dev),
mem_size/(1024*1024),
| ^~~~~~~~~~~~~~~~~~~~~~~
include/linux/device.h:1658:22: note: in definition of macro 'dev_fmt'
1658 | #define dev_fmt(fmt) fmt
| ^~~
drivers/misc/vpusmm/vpusmm_driver.c:935:4: note: in expansion of macro
'dev_info'
935 | dev_info(dev, " %s %zuMB %llx~%llx\n", dev_name(mem_dev),
mem_size/(1024*1024),
| ^~~~~~~~
drivers/misc/vpusmm/vpusmm_driver.c:935:32: note: format string is defined here
935 | dev_info(dev, " %s %zuMB %llx~%llx\n", dev_name(mem_dev),
mem_size/(1024*1024),
| ~~~^
| |
| long long unsigned int
| %x
In file included from include/linux/cdev.h:8,
from drivers/misc/vpusmm/vpusmm_driver.c:12:
drivers/misc/vpusmm/vpusmm_driver.c:935:18: warning: format '%llx' expects
argument of type 'long long unsigned int', but argument 6 has type
'resource_size_t' {aka 'unsigned int'} [-Wformat=]
935 | dev_info(dev, " %s %zuMB %llx~%llx\n", dev_name(mem_dev),
mem_size/(1024*1024),
| ^~~~~~~~~~~~~~~~~~~~~~~
include/linux/device.h:1658:22: note: in definition of macro 'dev_fmt'
1658 | #define dev_fmt(fmt) fmt
| ^~~
drivers/misc/vpusmm/vpusmm_driver.c:935:4: note: in expansion of macro
'dev_info'
935 | dev_info(dev, " %s %zuMB %llx~%llx\n", dev_name(mem_dev),
mem_size/(1024*1024),
| ^~~~~~~~
drivers/misc/vpusmm/vpusmm_driver.c:935:37: note: format string is defined here
935 | dev_info(dev, " %s %zuMB %llx~%llx\n", dev_name(mem_dev),
mem_size/(1024*1024),
| ~~~^
| |
| long long unsigned int
| %x
vim +616 drivers/misc/vpusmm/vpusmm_driver.c
534
535 /* allocate dma buffer suitable for VPU access.
536 * export as DMABuf fd
537 * sess will hold additional refcount to the dmabuf
538 * on request of passing it to VPU side for processing
539 */
540 static long vpusmm_session_alloc(struct vpusmm_session *sess, struct
vpusmm_args_alloc *arg)
541 {
542 int retval = 0;
543 size_t buffer_size = arg->size;
544 struct vpusmm_device *dev = sess->dev;
545 struct dma_buf *dmabuf = NULL;
546 const int flags = O_RDWR | O_CLOEXEC;
547 phys_addr_t phys_addr;
548 struct dma_buf_export_info exp_info = {
549 .exp_name = KBUILD_MODNAME, /*white lie for debug */
550 .owner = THIS_MODULE,
551 .ops = &vpusmm_dmabuf_ops,
552 .size = buffer_size,
553 .flags = flags
554 };
555 struct vpusmm_buffer *buff = NULL;
556
557 // only allocate from the first rmem, user-space API unchanged
558 if (dev->rmem_cnt <= 0) {
559 retval = -ENODEV;
560 goto failed;
561 }
562
563 buff = kzalloc(sizeof(*buff), GFP_KERNEL);
564 if (buff == NULL) {
565 retval = -ENOMEM;
566 goto failed;
567 }
568
569 buff->dev = dev->mem_dev[0];
570 buff->size = buffer_size;
571
572 buff->dma_attrs = 0;
573
574 if (arg->force_physical_contiguous)
575 buff->dma_attrs |= DMA_ATTR_FORCE_CONTIGUOUS;
576
577 if (arg->cachable)
578 buff->dma_attrs |= DMA_ATTR_NON_CONSISTENT;
579 else
580 buff->dma_attrs |= DMA_ATTR_WRITE_COMBINE;
581
582 // we need Kernel mapping to support dmabuf op vmap
583 buff->dma_attrs &= ~DMA_ATTR_NO_KERNEL_MAPPING;
584
585 buff->cookie = dma_alloc_attrs(
586 dev->mem_dev[0],
587 buff->size,
588 &buff->dma_addr,
589 GFP_KERNEL | GFP_DMA,
590 buff->dma_attrs);
591 if (buff->cookie == NULL) {
592 pr_info("[VPUSMM]:dma_alloc_attrs failed: size=%zu\n", buff->size);
593 retval = -ENOMEM;
594 goto failed;
595 }
596
597 phys_addr = dma_to_phys(dev->mem_dev[0], buff->dma_addr);
598
599 //export the buffer as DMABuf
600 exp_info.priv = buff;
601 dmabuf = dma_buf_export(&exp_info);
602 if (IS_ERR(dmabuf)) {
603 retval = PTR_ERR(dmabuf);
604 dmabuf = NULL;
605 goto failed;
606 }
607
608 retval = dma_buf_fd(dmabuf, flags);
609 if (retval < 0) {
610 goto failed;
611 } else {
612 arg->fd = retval;
613 retval = 0;
614 }
615
616 pr_debug("%s: dma_addr=%llx, phys_addr=%llx allocated from
%s\n",
617 __func__, buff->dma_addr, phys_addr,
dev_name(dev->dev));
618
619 return 0;
620 failed:
621 pr_err("%s failed with %d\n", __func__, retval);
622
623 if (dmabuf) {
624 // this will finally release underlying buff
625 dma_buf_put(dmabuf);
626 } else if (buff) {
627 if (buff->cookie)
628 dma_free_attrs(dev->mem_dev[0], buff->size, buff->cookie,
buff->dma_addr, buff->dma_attrs);
629 kfree(buff);
630 }
631 return retval;
632 }
633
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org