drivers/media/common/videobuf2/videobuf2-dma-contig.c:509:5: error: implicit declaration of function '__pfn_to_phys'

From: kernel test robot
Date: Thu Feb 11 2021 - 09:22:05 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 291009f656e8eaebbdfd3a8d99f6b190a9ce9deb
commit: 4bfc848e0981fcd35db00fe1c6581560689f6dc7 m68k/mm: enable use of generic memory_model.h for !DISCONTIGMEM
date: 8 weeks ago
config: m68k-randconfig-r021-20210211 (attached as .config)
compiler: m68k-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
# https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=4bfc848e0981fcd35db00fe1c6581560689f6dc7
git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git fetch --no-tags linus master
git checkout 4bfc848e0981fcd35db00fe1c6581560689f6dc7
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=m68k

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>

All errors (new ones prefixed by >>):

drivers/media/common/videobuf2/videobuf2-dma-contig.c: In function 'vb2_dc_get_userptr':
>> drivers/media/common/videobuf2/videobuf2-dma-contig.c:509:5: error: implicit declaration of function '__pfn_to_phys' [-Werror=implicit-function-declaration]
509 | __pfn_to_phys(nums[0]), size, buf->dma_dir, 0);
| ^~~~~~~~~~~~~
cc1: some warnings being treated as errors


vim +/__pfn_to_phys +509 drivers/media/common/videobuf2/videobuf2-dma-contig.c

e15dab752d4c58 drivers/media/v4l2-core/videobuf2-dma-contig.c Tomasz Stanislawski 2012-06-14 455
36c0f8b32c4bd4 drivers/media/v4l2-core/videobuf2-dma-contig.c Hans Verkuil 2016-04-15 456 static void *vb2_dc_get_userptr(struct device *dev, unsigned long vaddr,
cd474037c4a9a9 drivers/media/v4l2-core/videobuf2-dma-contig.c Hans Verkuil 2014-11-18 457 unsigned long size, enum dma_data_direction dma_dir)
1a758d4e847f77 drivers/media/video/videobuf2-dma-contig.c Pawel Osciak 2010-10-11 458 {
1a758d4e847f77 drivers/media/video/videobuf2-dma-contig.c Pawel Osciak 2010-10-11 459 struct vb2_dc_buf *buf;
fb639eb3915431 drivers/media/v4l2-core/videobuf2-dma-contig.c Jan Kara 2015-07-13 460 struct frame_vector *vec;
c4860ad6056483 drivers/media/v4l2-core/videobuf2-dma-contig.c Tvrtko Ursulin 2017-07-31 461 unsigned int offset;
fb639eb3915431 drivers/media/v4l2-core/videobuf2-dma-contig.c Jan Kara 2015-07-13 462 int n_pages, i;
e15dab752d4c58 drivers/media/v4l2-core/videobuf2-dma-contig.c Tomasz Stanislawski 2012-06-14 463 int ret = 0;
e15dab752d4c58 drivers/media/v4l2-core/videobuf2-dma-contig.c Tomasz Stanislawski 2012-06-14 464 struct sg_table *sgt;
e15dab752d4c58 drivers/media/v4l2-core/videobuf2-dma-contig.c Tomasz Stanislawski 2012-06-14 465 unsigned long contig_size;
d81e870d5afa1b drivers/media/v4l2-core/videobuf2-dma-contig.c Marek Szyprowski 2012-06-12 466 unsigned long dma_align = dma_get_cache_alignment();
d81e870d5afa1b drivers/media/v4l2-core/videobuf2-dma-contig.c Marek Szyprowski 2012-06-12 467
d81e870d5afa1b drivers/media/v4l2-core/videobuf2-dma-contig.c Marek Szyprowski 2012-06-12 468 /* Only cache aligned DMA transfers are reliable */
d81e870d5afa1b drivers/media/v4l2-core/videobuf2-dma-contig.c Marek Szyprowski 2012-06-12 469 if (!IS_ALIGNED(vaddr | size, dma_align)) {
d81e870d5afa1b drivers/media/v4l2-core/videobuf2-dma-contig.c Marek Szyprowski 2012-06-12 470 pr_debug("user data must be aligned to %lu bytes\n", dma_align);
d81e870d5afa1b drivers/media/v4l2-core/videobuf2-dma-contig.c Marek Szyprowski 2012-06-12 471 return ERR_PTR(-EINVAL);
d81e870d5afa1b drivers/media/v4l2-core/videobuf2-dma-contig.c Marek Szyprowski 2012-06-12 472 }
d81e870d5afa1b drivers/media/v4l2-core/videobuf2-dma-contig.c Marek Szyprowski 2012-06-12 473
d81e870d5afa1b drivers/media/v4l2-core/videobuf2-dma-contig.c Marek Szyprowski 2012-06-12 474 if (!size) {
d81e870d5afa1b drivers/media/v4l2-core/videobuf2-dma-contig.c Marek Szyprowski 2012-06-12 475 pr_debug("size is zero\n");
d81e870d5afa1b drivers/media/v4l2-core/videobuf2-dma-contig.c Marek Szyprowski 2012-06-12 476 return ERR_PTR(-EINVAL);
d81e870d5afa1b drivers/media/v4l2-core/videobuf2-dma-contig.c Marek Szyprowski 2012-06-12 477 }
1a758d4e847f77 drivers/media/video/videobuf2-dma-contig.c Pawel Osciak 2010-10-11 478
10791829eb52d5 drivers/media/v4l2-core/videobuf2-dma-contig.c Hans Verkuil 2016-07-21 479 if (WARN_ON(!dev))
10791829eb52d5 drivers/media/v4l2-core/videobuf2-dma-contig.c Hans Verkuil 2016-07-21 480 return ERR_PTR(-EINVAL);
10791829eb52d5 drivers/media/v4l2-core/videobuf2-dma-contig.c Hans Verkuil 2016-07-21 481
1a758d4e847f77 drivers/media/video/videobuf2-dma-contig.c Pawel Osciak 2010-10-11 482 buf = kzalloc(sizeof *buf, GFP_KERNEL);
1a758d4e847f77 drivers/media/video/videobuf2-dma-contig.c Pawel Osciak 2010-10-11 483 if (!buf)
1a758d4e847f77 drivers/media/video/videobuf2-dma-contig.c Pawel Osciak 2010-10-11 484 return ERR_PTR(-ENOMEM);
1a758d4e847f77 drivers/media/video/videobuf2-dma-contig.c Pawel Osciak 2010-10-11 485
36c0f8b32c4bd4 drivers/media/v4l2-core/videobuf2-dma-contig.c Hans Verkuil 2016-04-15 486 buf->dev = dev;
cd474037c4a9a9 drivers/media/v4l2-core/videobuf2-dma-contig.c Hans Verkuil 2014-11-18 487 buf->dma_dir = dma_dir;
e15dab752d4c58 drivers/media/v4l2-core/videobuf2-dma-contig.c Tomasz Stanislawski 2012-06-14 488
c4860ad6056483 drivers/media/v4l2-core/videobuf2-dma-contig.c Tvrtko Ursulin 2017-07-31 489 offset = lower_32_bits(offset_in_page(vaddr));
707947247e9517 drivers/media/common/videobuf2/videobuf2-dma-contig.c Hans Verkuil 2019-04-04 490 vec = vb2_create_framevec(vaddr, size);
fb639eb3915431 drivers/media/v4l2-core/videobuf2-dma-contig.c Jan Kara 2015-07-13 491 if (IS_ERR(vec)) {
fb639eb3915431 drivers/media/v4l2-core/videobuf2-dma-contig.c Jan Kara 2015-07-13 492 ret = PTR_ERR(vec);
e15dab752d4c58 drivers/media/v4l2-core/videobuf2-dma-contig.c Tomasz Stanislawski 2012-06-14 493 goto fail_buf;
e15dab752d4c58 drivers/media/v4l2-core/videobuf2-dma-contig.c Tomasz Stanislawski 2012-06-14 494 }
fb639eb3915431 drivers/media/v4l2-core/videobuf2-dma-contig.c Jan Kara 2015-07-13 495 buf->vec = vec;
fb639eb3915431 drivers/media/v4l2-core/videobuf2-dma-contig.c Jan Kara 2015-07-13 496 n_pages = frame_vector_count(vec);
fb639eb3915431 drivers/media/v4l2-core/videobuf2-dma-contig.c Jan Kara 2015-07-13 497 ret = frame_vector_to_pages(vec);
fb639eb3915431 drivers/media/v4l2-core/videobuf2-dma-contig.c Jan Kara 2015-07-13 498 if (ret < 0) {
fb639eb3915431 drivers/media/v4l2-core/videobuf2-dma-contig.c Jan Kara 2015-07-13 499 unsigned long *nums = frame_vector_pfns(vec);
e15dab752d4c58 drivers/media/v4l2-core/videobuf2-dma-contig.c Tomasz Stanislawski 2012-06-14 500
fb639eb3915431 drivers/media/v4l2-core/videobuf2-dma-contig.c Jan Kara 2015-07-13 501 /*
fb639eb3915431 drivers/media/v4l2-core/videobuf2-dma-contig.c Jan Kara 2015-07-13 502 * Failed to convert to pages... Check the memory is physically
fb639eb3915431 drivers/media/v4l2-core/videobuf2-dma-contig.c Jan Kara 2015-07-13 503 * contiguous and use direct mapping
fb639eb3915431 drivers/media/v4l2-core/videobuf2-dma-contig.c Jan Kara 2015-07-13 504 */
fb639eb3915431 drivers/media/v4l2-core/videobuf2-dma-contig.c Jan Kara 2015-07-13 505 for (i = 1; i < n_pages; i++)
fb639eb3915431 drivers/media/v4l2-core/videobuf2-dma-contig.c Jan Kara 2015-07-13 506 if (nums[i-1] + 1 != nums[i])
fb639eb3915431 drivers/media/v4l2-core/videobuf2-dma-contig.c Jan Kara 2015-07-13 507 goto fail_pfnvec;
55ea54441fb3b6 drivers/media/common/videobuf2/videobuf2-dma-contig.c Christoph Hellwig 2019-01-04 508 buf->dma_addr = dma_map_resource(buf->dev,
55ea54441fb3b6 drivers/media/common/videobuf2/videobuf2-dma-contig.c Christoph Hellwig 2019-01-04 @509 __pfn_to_phys(nums[0]), size, buf->dma_dir, 0);
55ea54441fb3b6 drivers/media/common/videobuf2/videobuf2-dma-contig.c Christoph Hellwig 2019-01-04 510 if (dma_mapping_error(buf->dev, buf->dma_addr)) {
55ea54441fb3b6 drivers/media/common/videobuf2/videobuf2-dma-contig.c Christoph Hellwig 2019-01-04 511 ret = -ENOMEM;
55ea54441fb3b6 drivers/media/common/videobuf2/videobuf2-dma-contig.c Christoph Hellwig 2019-01-04 512 goto fail_pfnvec;
55ea54441fb3b6 drivers/media/common/videobuf2/videobuf2-dma-contig.c Christoph Hellwig 2019-01-04 513 }
fb639eb3915431 drivers/media/v4l2-core/videobuf2-dma-contig.c Jan Kara 2015-07-13 514 goto out;
e15dab752d4c58 drivers/media/v4l2-core/videobuf2-dma-contig.c Tomasz Stanislawski 2012-06-14 515 }
e15dab752d4c58 drivers/media/v4l2-core/videobuf2-dma-contig.c Tomasz Stanislawski 2012-06-14 516
e15dab752d4c58 drivers/media/v4l2-core/videobuf2-dma-contig.c Tomasz Stanislawski 2012-06-14 517 sgt = kzalloc(sizeof(*sgt), GFP_KERNEL);
e15dab752d4c58 drivers/media/v4l2-core/videobuf2-dma-contig.c Tomasz Stanislawski 2012-06-14 518 if (!sgt) {
e15dab752d4c58 drivers/media/v4l2-core/videobuf2-dma-contig.c Tomasz Stanislawski 2012-06-14 519 pr_err("failed to allocate sg table\n");
e15dab752d4c58 drivers/media/v4l2-core/videobuf2-dma-contig.c Tomasz Stanislawski 2012-06-14 520 ret = -ENOMEM;
fb639eb3915431 drivers/media/v4l2-core/videobuf2-dma-contig.c Jan Kara 2015-07-13 521 goto fail_pfnvec;
1a758d4e847f77 drivers/media/video/videobuf2-dma-contig.c Pawel Osciak 2010-10-11 522 }
1a758d4e847f77 drivers/media/video/videobuf2-dma-contig.c Pawel Osciak 2010-10-11 523
fb639eb3915431 drivers/media/v4l2-core/videobuf2-dma-contig.c Jan Kara 2015-07-13 524 ret = sg_alloc_table_from_pages(sgt, frame_vector_pages(vec), n_pages,
e15dab752d4c58 drivers/media/v4l2-core/videobuf2-dma-contig.c Tomasz Stanislawski 2012-06-14 525 offset, size, GFP_KERNEL);
e15dab752d4c58 drivers/media/v4l2-core/videobuf2-dma-contig.c Tomasz Stanislawski 2012-06-14 526 if (ret) {
e15dab752d4c58 drivers/media/v4l2-core/videobuf2-dma-contig.c Tomasz Stanislawski 2012-06-14 527 pr_err("failed to initialize sg table\n");
e15dab752d4c58 drivers/media/v4l2-core/videobuf2-dma-contig.c Tomasz Stanislawski 2012-06-14 528 goto fail_sgt;
e15dab752d4c58 drivers/media/v4l2-core/videobuf2-dma-contig.c Tomasz Stanislawski 2012-06-14 529 }
e15dab752d4c58 drivers/media/v4l2-core/videobuf2-dma-contig.c Tomasz Stanislawski 2012-06-14 530
251a79f8f5adfd drivers/media/v4l2-core/videobuf2-dma-contig.c Hans Verkuil 2014-11-18 531 /*
251a79f8f5adfd drivers/media/v4l2-core/videobuf2-dma-contig.c Hans Verkuil 2014-11-18 532 * No need to sync to the device, this will happen later when the
251a79f8f5adfd drivers/media/v4l2-core/videobuf2-dma-contig.c Hans Verkuil 2014-11-18 533 * prepare() memop is called.
251a79f8f5adfd drivers/media/v4l2-core/videobuf2-dma-contig.c Hans Verkuil 2014-11-18 534 */
8b7c0280ab03dd drivers/media/common/videobuf2/videobuf2-dma-contig.c Marek Szyprowski 2020-09-04 535 if (dma_map_sgtable(buf->dev, sgt, buf->dma_dir,
8b7c0280ab03dd drivers/media/common/videobuf2/videobuf2-dma-contig.c Marek Szyprowski 2020-09-04 536 DMA_ATTR_SKIP_CPU_SYNC)) {
e15dab752d4c58 drivers/media/v4l2-core/videobuf2-dma-contig.c Tomasz Stanislawski 2012-06-14 537 pr_err("failed to map scatterlist\n");
e15dab752d4c58 drivers/media/v4l2-core/videobuf2-dma-contig.c Tomasz Stanislawski 2012-06-14 538 ret = -EIO;
e15dab752d4c58 drivers/media/v4l2-core/videobuf2-dma-contig.c Tomasz Stanislawski 2012-06-14 539 goto fail_sgt_init;
e15dab752d4c58 drivers/media/v4l2-core/videobuf2-dma-contig.c Tomasz Stanislawski 2012-06-14 540 }
e15dab752d4c58 drivers/media/v4l2-core/videobuf2-dma-contig.c Tomasz Stanislawski 2012-06-14 541
e15dab752d4c58 drivers/media/v4l2-core/videobuf2-dma-contig.c Tomasz Stanislawski 2012-06-14 542 contig_size = vb2_dc_get_contiguous_size(sgt);
e15dab752d4c58 drivers/media/v4l2-core/videobuf2-dma-contig.c Tomasz Stanislawski 2012-06-14 543 if (contig_size < size) {
e15dab752d4c58 drivers/media/v4l2-core/videobuf2-dma-contig.c Tomasz Stanislawski 2012-06-14 544 pr_err("contiguous mapping is too small %lu/%lu\n",
e15dab752d4c58 drivers/media/v4l2-core/videobuf2-dma-contig.c Tomasz Stanislawski 2012-06-14 545 contig_size, size);
e15dab752d4c58 drivers/media/v4l2-core/videobuf2-dma-contig.c Tomasz Stanislawski 2012-06-14 546 ret = -EFAULT;
e15dab752d4c58 drivers/media/v4l2-core/videobuf2-dma-contig.c Tomasz Stanislawski 2012-06-14 547 goto fail_map_sg;
e15dab752d4c58 drivers/media/v4l2-core/videobuf2-dma-contig.c Tomasz Stanislawski 2012-06-14 548 }
e15dab752d4c58 drivers/media/v4l2-core/videobuf2-dma-contig.c Tomasz Stanislawski 2012-06-14 549
e15dab752d4c58 drivers/media/v4l2-core/videobuf2-dma-contig.c Tomasz Stanislawski 2012-06-14 550 buf->dma_addr = sg_dma_address(sgt->sgl);
e15dab752d4c58 drivers/media/v4l2-core/videobuf2-dma-contig.c Tomasz Stanislawski 2012-06-14 551 buf->dma_sgt = sgt;
fb639eb3915431 drivers/media/v4l2-core/videobuf2-dma-contig.c Jan Kara 2015-07-13 552 out:
fb639eb3915431 drivers/media/v4l2-core/videobuf2-dma-contig.c Jan Kara 2015-07-13 553 buf->size = size;
1a758d4e847f77 drivers/media/video/videobuf2-dma-contig.c Pawel Osciak 2010-10-11 554
1a758d4e847f77 drivers/media/video/videobuf2-dma-contig.c Pawel Osciak 2010-10-11 555 return buf;
1a758d4e847f77 drivers/media/video/videobuf2-dma-contig.c Pawel Osciak 2010-10-11 556
e15dab752d4c58 drivers/media/v4l2-core/videobuf2-dma-contig.c Tomasz Stanislawski 2012-06-14 557 fail_map_sg:
8b7c0280ab03dd drivers/media/common/videobuf2/videobuf2-dma-contig.c Marek Szyprowski 2020-09-04 558 dma_unmap_sgtable(buf->dev, sgt, buf->dma_dir, DMA_ATTR_SKIP_CPU_SYNC);
1a758d4e847f77 drivers/media/video/videobuf2-dma-contig.c Pawel Osciak 2010-10-11 559
e15dab752d4c58 drivers/media/v4l2-core/videobuf2-dma-contig.c Tomasz Stanislawski 2012-06-14 560 fail_sgt_init:
e15dab752d4c58 drivers/media/v4l2-core/videobuf2-dma-contig.c Tomasz Stanislawski 2012-06-14 561 sg_free_table(sgt);
e15dab752d4c58 drivers/media/v4l2-core/videobuf2-dma-contig.c Tomasz Stanislawski 2012-06-14 562
e15dab752d4c58 drivers/media/v4l2-core/videobuf2-dma-contig.c Tomasz Stanislawski 2012-06-14 563 fail_sgt:
e15dab752d4c58 drivers/media/v4l2-core/videobuf2-dma-contig.c Tomasz Stanislawski 2012-06-14 564 kfree(sgt);
e15dab752d4c58 drivers/media/v4l2-core/videobuf2-dma-contig.c Tomasz Stanislawski 2012-06-14 565
fb639eb3915431 drivers/media/v4l2-core/videobuf2-dma-contig.c Jan Kara 2015-07-13 566 fail_pfnvec:
fb639eb3915431 drivers/media/v4l2-core/videobuf2-dma-contig.c Jan Kara 2015-07-13 567 vb2_destroy_framevec(vec);
e15dab752d4c58 drivers/media/v4l2-core/videobuf2-dma-contig.c Tomasz Stanislawski 2012-06-14 568
e15dab752d4c58 drivers/media/v4l2-core/videobuf2-dma-contig.c Tomasz Stanislawski 2012-06-14 569 fail_buf:
1a758d4e847f77 drivers/media/video/videobuf2-dma-contig.c Pawel Osciak 2010-10-11 570 kfree(buf);
e15dab752d4c58 drivers/media/v4l2-core/videobuf2-dma-contig.c Tomasz Stanislawski 2012-06-14 571
e15dab752d4c58 drivers/media/v4l2-core/videobuf2-dma-contig.c Tomasz Stanislawski 2012-06-14 572 return ERR_PTR(ret);
1a758d4e847f77 drivers/media/video/videobuf2-dma-contig.c Pawel Osciak 2010-10-11 573 }
1a758d4e847f77 drivers/media/video/videobuf2-dma-contig.c Pawel Osciak 2010-10-11 574

:::::: The code at line 509 was first introduced by commit
:::::: 55ea54441fb3b6532d5d32417911ff5a10750903 videobuf2: replace a layering violation with dma_map_resource

:::::: TO: Christoph Hellwig <hch@xxxxxx>
:::::: CC: Christoph Hellwig <hch@xxxxxx>

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx

Attachment: .config.gz
Description: application/gzip