[kraxel:drm-virtio-bootfb 161/188] drivers/gpu/drm/msm/msm_gem.c:624:20: error: implicit declaration of function 'vmap'

From: kernel test robot
Date: Thu Sep 30 2021 - 05:38:42 EST


tree: git://git.kraxel.org/linux drm-virtio-bootfb
head: aaae02441fcdecbfa14901efeefe935266536925
commit: b3ed524f84f573ece1aa2f26e9db3c34a593e0d1 [161/188] drm/msm: allow compile_test on !ARM
config: hexagon-randconfig-r026-20210930 (attached as .config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 28981015526f2192440c18f18e8a20cd11b0779c)
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 remote add kraxel git://git.kraxel.org/linux
git fetch --no-tags kraxel drm-virtio-bootfb
git checkout b3ed524f84f573ece1aa2f26e9db3c34a593e0d1
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 ARCH=hexagon

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/gpu/drm/msm/msm_gem.c:624:20: error: implicit declaration of function 'vmap' [-Werror,-Wimplicit-function-declaration]
msm_obj->vaddr = vmap(pages, obj->size >> PAGE_SHIFT,
^
>> drivers/gpu/drm/msm/msm_gem.c:625:5: error: use of undeclared identifier 'VM_MAP'
VM_MAP, msm_gem_pgprot(msm_obj, PAGE_KERNEL));
^
>> drivers/gpu/drm/msm/msm_gem.c:777:2: error: implicit declaration of function 'vunmap' [-Werror,-Wimplicit-function-declaration]
vunmap(msm_obj->vaddr);
^
drivers/gpu/drm/msm/msm_gem.c:777:2: note: did you mean 'kunmap'?
include/linux/highmem.h:46:20: note: 'kunmap' declared here
static inline void kunmap(struct page *page);
^
3 errors generated.
--
>> drivers/gpu/drm/msm/msm_gem_shrinker.c:224:10: error: implicit declaration of function 'register_vmap_purge_notifier' [-Werror,-Wimplicit-function-declaration]
WARN_ON(register_vmap_purge_notifier(&priv->vmap_notifier));
^
drivers/gpu/drm/msm/msm_gem_shrinker.c:224:10: note: did you mean 'register_module_notifier'?
include/linux/module.h:655:5: note: 'register_module_notifier' declared here
int register_module_notifier(struct notifier_block *nb);
^
>> drivers/gpu/drm/msm/msm_gem_shrinker.c:238:11: error: implicit declaration of function 'unregister_vmap_purge_notifier' [-Werror,-Wimplicit-function-declaration]
WARN_ON(unregister_vmap_purge_notifier(&priv->vmap_notifier));
^
drivers/gpu/drm/msm/msm_gem_shrinker.c:238:11: note: did you mean 'unregister_module_notifier'?
include/linux/module.h:656:5: note: 'unregister_module_notifier' declared here
int unregister_module_notifier(struct notifier_block *nb);
^
2 errors generated.


vim +/vmap +624 drivers/gpu/drm/msm/msm_gem.c

c8afe684c95cd1 Rob Clark 2013-06-26 593
fad33f4b1073a4 Rob Clark 2017-09-15 594 static void *get_vaddr(struct drm_gem_object *obj, unsigned madv)
c8afe684c95cd1 Rob Clark 2013-06-26 595 {
c8afe684c95cd1 Rob Clark 2013-06-26 596 struct msm_gem_object *msm_obj = to_msm_bo(obj);
0e08270a1f01bc Sushmita Susheelendra 2017-06-13 597 int ret = 0;
0e08270a1f01bc Sushmita Susheelendra 2017-06-13 598
90643a24a7bfbe Rob Clark 2021-04-05 599 GEM_WARN_ON(!msm_gem_is_locked(obj));
e4b87d227f9e82 Rob Clark 2020-10-23 600
8b6b7d84bfce9a Daniel Vetter 2020-05-14 601 if (obj->import_attach)
8b6b7d84bfce9a Daniel Vetter 2020-05-14 602 return ERR_PTR(-ENODEV);
8b6b7d84bfce9a Daniel Vetter 2020-05-14 603
90643a24a7bfbe Rob Clark 2021-04-05 604 if (GEM_WARN_ON(msm_obj->madv > madv)) {
6a41da17e87dee Mamta Shukla 2018-10-20 605 DRM_DEV_ERROR(obj->dev->dev, "Invalid madv state: %u vs %u\n",
fad33f4b1073a4 Rob Clark 2017-09-15 606 msm_obj->madv, madv);
0e08270a1f01bc Sushmita Susheelendra 2017-06-13 607 return ERR_PTR(-EBUSY);
0e08270a1f01bc Sushmita Susheelendra 2017-06-13 608 }
0e08270a1f01bc Sushmita Susheelendra 2017-06-13 609
0e08270a1f01bc Sushmita Susheelendra 2017-06-13 610 /* increment vmap_count *before* vmap() call, so shrinker can
a6ae74c956e72c Rob Clark 2020-10-23 611 * check vmap_count (is_vunmapable()) outside of msm_obj lock.
0e08270a1f01bc Sushmita Susheelendra 2017-06-13 612 * This guarantees that we won't try to msm_gem_vunmap() this
0e08270a1f01bc Sushmita Susheelendra 2017-06-13 613 * same object from within the vmap() call (while we already
a6ae74c956e72c Rob Clark 2020-10-23 614 * hold msm_obj lock)
0e08270a1f01bc Sushmita Susheelendra 2017-06-13 615 */
0e08270a1f01bc Sushmita Susheelendra 2017-06-13 616 msm_obj->vmap_count++;
0e08270a1f01bc Sushmita Susheelendra 2017-06-13 617
c8afe684c95cd1 Rob Clark 2013-06-26 618 if (!msm_obj->vaddr) {
c8afe684c95cd1 Rob Clark 2013-06-26 619 struct page **pages = get_pages(obj);
0e08270a1f01bc Sushmita Susheelendra 2017-06-13 620 if (IS_ERR(pages)) {
0e08270a1f01bc Sushmita Susheelendra 2017-06-13 621 ret = PTR_ERR(pages);
0e08270a1f01bc Sushmita Susheelendra 2017-06-13 622 goto fail;
0e08270a1f01bc Sushmita Susheelendra 2017-06-13 623 }
c8afe684c95cd1 Rob Clark 2013-06-26 @624 msm_obj->vaddr = vmap(pages, obj->size >> PAGE_SHIFT,
af9b3547079915 Jonathan Marek 2021-04-23 @625 VM_MAP, msm_gem_pgprot(msm_obj, PAGE_KERNEL));
0e08270a1f01bc Sushmita Susheelendra 2017-06-13 626 if (msm_obj->vaddr == NULL) {
0e08270a1f01bc Sushmita Susheelendra 2017-06-13 627 ret = -ENOMEM;
0e08270a1f01bc Sushmita Susheelendra 2017-06-13 628 goto fail;
c8afe684c95cd1 Rob Clark 2013-06-26 629 }
10f76165d30bf5 Rob Clark 2021-04-26 630
10f76165d30bf5 Rob Clark 2021-04-26 631 update_inactive(msm_obj);
c8afe684c95cd1 Rob Clark 2013-06-26 632 }
c8afe684c95cd1 Rob Clark 2013-06-26 633
0e08270a1f01bc Sushmita Susheelendra 2017-06-13 634 return msm_obj->vaddr;
c8afe684c95cd1 Rob Clark 2013-06-26 635
0e08270a1f01bc Sushmita Susheelendra 2017-06-13 636 fail:
e1e9db2ca79575 Rob Clark 2016-05-27 637 msm_obj->vmap_count--;
0e08270a1f01bc Sushmita Susheelendra 2017-06-13 638 return ERR_PTR(ret);
18f23049f640e2 Rob Clark 2016-05-26 639 }
18f23049f640e2 Rob Clark 2016-05-26 640
e4b87d227f9e82 Rob Clark 2020-10-23 641 void *msm_gem_get_vaddr_locked(struct drm_gem_object *obj)
fad33f4b1073a4 Rob Clark 2017-09-15 642 {
fad33f4b1073a4 Rob Clark 2017-09-15 643 return get_vaddr(obj, MSM_MADV_WILLNEED);
fad33f4b1073a4 Rob Clark 2017-09-15 644 }
fad33f4b1073a4 Rob Clark 2017-09-15 645
e4b87d227f9e82 Rob Clark 2020-10-23 646 void *msm_gem_get_vaddr(struct drm_gem_object *obj)
e4b87d227f9e82 Rob Clark 2020-10-23 647 {
e4b87d227f9e82 Rob Clark 2020-10-23 648 void *ret;
e4b87d227f9e82 Rob Clark 2020-10-23 649
e4b87d227f9e82 Rob Clark 2020-10-23 650 msm_gem_lock(obj);
e4b87d227f9e82 Rob Clark 2020-10-23 651 ret = msm_gem_get_vaddr_locked(obj);
e4b87d227f9e82 Rob Clark 2020-10-23 652 msm_gem_unlock(obj);
e4b87d227f9e82 Rob Clark 2020-10-23 653
e4b87d227f9e82 Rob Clark 2020-10-23 654 return ret;
e4b87d227f9e82 Rob Clark 2020-10-23 655 }
e4b87d227f9e82 Rob Clark 2020-10-23 656
fad33f4b1073a4 Rob Clark 2017-09-15 657 /*
fad33f4b1073a4 Rob Clark 2017-09-15 658 * Don't use this! It is for the very special case of dumping
fad33f4b1073a4 Rob Clark 2017-09-15 659 * submits from GPU hangs or faults, were the bo may already
fad33f4b1073a4 Rob Clark 2017-09-15 660 * be MSM_MADV_DONTNEED, but we know the buffer is still on the
fad33f4b1073a4 Rob Clark 2017-09-15 661 * active list.
fad33f4b1073a4 Rob Clark 2017-09-15 662 */
fad33f4b1073a4 Rob Clark 2017-09-15 663 void *msm_gem_get_vaddr_active(struct drm_gem_object *obj)
fad33f4b1073a4 Rob Clark 2017-09-15 664 {
fad33f4b1073a4 Rob Clark 2017-09-15 665 return get_vaddr(obj, __MSM_MADV_PURGED);
fad33f4b1073a4 Rob Clark 2017-09-15 666 }
fad33f4b1073a4 Rob Clark 2017-09-15 667
e4b87d227f9e82 Rob Clark 2020-10-23 668 void msm_gem_put_vaddr_locked(struct drm_gem_object *obj)
18f23049f640e2 Rob Clark 2016-05-26 669 {
0e08270a1f01bc Sushmita Susheelendra 2017-06-13 670 struct msm_gem_object *msm_obj = to_msm_bo(obj);
0e08270a1f01bc Sushmita Susheelendra 2017-06-13 671
90643a24a7bfbe Rob Clark 2021-04-05 672 GEM_WARN_ON(!msm_gem_is_locked(obj));
90643a24a7bfbe Rob Clark 2021-04-05 673 GEM_WARN_ON(msm_obj->vmap_count < 1);
e4b87d227f9e82 Rob Clark 2020-10-23 674
0e08270a1f01bc Sushmita Susheelendra 2017-06-13 675 msm_obj->vmap_count--;
e4b87d227f9e82 Rob Clark 2020-10-23 676 }
e4b87d227f9e82 Rob Clark 2020-10-23 677
e4b87d227f9e82 Rob Clark 2020-10-23 678 void msm_gem_put_vaddr(struct drm_gem_object *obj)
e4b87d227f9e82 Rob Clark 2020-10-23 679 {
e4b87d227f9e82 Rob Clark 2020-10-23 680 msm_gem_lock(obj);
e4b87d227f9e82 Rob Clark 2020-10-23 681 msm_gem_put_vaddr_locked(obj);
a6ae74c956e72c Rob Clark 2020-10-23 682 msm_gem_unlock(obj);
18f23049f640e2 Rob Clark 2016-05-26 683 }
18f23049f640e2 Rob Clark 2016-05-26 684
4cd33c48ea25ba Rob Clark 2016-05-17 685 /* Update madvise status, returns true if not purged, else
4cd33c48ea25ba Rob Clark 2016-05-17 686 * false or -errno.
4cd33c48ea25ba Rob Clark 2016-05-17 687 */
4cd33c48ea25ba Rob Clark 2016-05-17 688 int msm_gem_madvise(struct drm_gem_object *obj, unsigned madv)
4cd33c48ea25ba Rob Clark 2016-05-17 689 {
4cd33c48ea25ba Rob Clark 2016-05-17 690 struct msm_gem_object *msm_obj = to_msm_bo(obj);
4cd33c48ea25ba Rob Clark 2016-05-17 691
a6ae74c956e72c Rob Clark 2020-10-23 692 msm_gem_lock(obj);
4cd33c48ea25ba Rob Clark 2016-05-17 693
4cd33c48ea25ba Rob Clark 2016-05-17 694 if (msm_obj->madv != __MSM_MADV_PURGED)
4cd33c48ea25ba Rob Clark 2016-05-17 695 msm_obj->madv = madv;
4cd33c48ea25ba Rob Clark 2016-05-17 696
0e08270a1f01bc Sushmita Susheelendra 2017-06-13 697 madv = msm_obj->madv;
0e08270a1f01bc Sushmita Susheelendra 2017-06-13 698
3edfa30f2340e6 Rob Clark 2020-11-16 699 /* If the obj is inactive, we might need to move it
3edfa30f2340e6 Rob Clark 2020-11-16 700 * between inactive lists
3edfa30f2340e6 Rob Clark 2020-11-16 701 */
3edfa30f2340e6 Rob Clark 2020-11-16 702 if (msm_obj->active_count == 0)
3edfa30f2340e6 Rob Clark 2020-11-16 703 update_inactive(msm_obj);
3edfa30f2340e6 Rob Clark 2020-11-16 704
a6ae74c956e72c Rob Clark 2020-10-23 705 msm_gem_unlock(obj);
0e08270a1f01bc Sushmita Susheelendra 2017-06-13 706
0e08270a1f01bc Sushmita Susheelendra 2017-06-13 707 return (madv != __MSM_MADV_PURGED);
4cd33c48ea25ba Rob Clark 2016-05-17 708 }
4cd33c48ea25ba Rob Clark 2016-05-17 709
599089c6af6830 Rob Clark 2020-10-23 710 void msm_gem_purge(struct drm_gem_object *obj)
68209390f11603 Rob Clark 2016-05-17 711 {
68209390f11603 Rob Clark 2016-05-17 712 struct drm_device *dev = obj->dev;
68209390f11603 Rob Clark 2016-05-17 713 struct msm_gem_object *msm_obj = to_msm_bo(obj);
68209390f11603 Rob Clark 2016-05-17 714
81d4d597d4faad Rob Clark 2021-04-05 715 GEM_WARN_ON(!msm_gem_is_locked(obj));
90643a24a7bfbe Rob Clark 2021-04-05 716 GEM_WARN_ON(!is_purgeable(msm_obj));
68209390f11603 Rob Clark 2016-05-17 717
20d0ae2f8c72e3 Rob Clark 2021-04-05 718 /* Get rid of any iommu mapping(s): */
20d0ae2f8c72e3 Rob Clark 2021-04-05 719 put_iova_spaces(obj, true);
0e08270a1f01bc Sushmita Susheelendra 2017-06-13 720
599089c6af6830 Rob Clark 2020-10-23 721 msm_gem_vunmap(obj);
68209390f11603 Rob Clark 2016-05-17 722
81d4d597d4faad Rob Clark 2021-04-05 723 drm_vma_node_unmap(&obj->vma_node, dev->anon_inode->i_mapping);
81d4d597d4faad Rob Clark 2021-04-05 724
68209390f11603 Rob Clark 2016-05-17 725 put_pages(obj);
68209390f11603 Rob Clark 2016-05-17 726
9b73bde39cf24b Iskren Chernev 2020-11-26 727 put_iova_vmas(obj);
9b73bde39cf24b Iskren Chernev 2020-11-26 728
68209390f11603 Rob Clark 2016-05-17 729 msm_obj->madv = __MSM_MADV_PURGED;
25ed38b3ed2691 Rob Clark 2021-04-02 730 update_inactive(msm_obj);
68209390f11603 Rob Clark 2016-05-17 731
68209390f11603 Rob Clark 2016-05-17 732 drm_gem_free_mmap_offset(obj);
68209390f11603 Rob Clark 2016-05-17 733
68209390f11603 Rob Clark 2016-05-17 734 /* Our goal here is to return as much of the memory as
68209390f11603 Rob Clark 2016-05-17 735 * is possible back to the system as we are called from OOM.
68209390f11603 Rob Clark 2016-05-17 736 * To do this we must instruct the shmfs to drop all of its
68209390f11603 Rob Clark 2016-05-17 737 * backing pages, *now*.
68209390f11603 Rob Clark 2016-05-17 738 */
68209390f11603 Rob Clark 2016-05-17 739 shmem_truncate_range(file_inode(obj->filp), 0, (loff_t)-1);
68209390f11603 Rob Clark 2016-05-17 740
68209390f11603 Rob Clark 2016-05-17 741 invalidate_mapping_pages(file_inode(obj->filp)->i_mapping,
68209390f11603 Rob Clark 2016-05-17 742 0, (loff_t)-1);
68209390f11603 Rob Clark 2016-05-17 743 }
68209390f11603 Rob Clark 2016-05-17 744
37c68900a252ce Lee Jones 2021-06-02 745 /*
63f17ef834284d Rob Clark 2021-04-05 746 * Unpin the backing pages and make them available to be swapped out.
63f17ef834284d Rob Clark 2021-04-05 747 */
63f17ef834284d Rob Clark 2021-04-05 748 void msm_gem_evict(struct drm_gem_object *obj)
63f17ef834284d Rob Clark 2021-04-05 749 {
63f17ef834284d Rob Clark 2021-04-05 750 struct drm_device *dev = obj->dev;
63f17ef834284d Rob Clark 2021-04-05 751 struct msm_gem_object *msm_obj = to_msm_bo(obj);
63f17ef834284d Rob Clark 2021-04-05 752
63f17ef834284d Rob Clark 2021-04-05 753 GEM_WARN_ON(!msm_gem_is_locked(obj));
63f17ef834284d Rob Clark 2021-04-05 754 GEM_WARN_ON(is_unevictable(msm_obj));
63f17ef834284d Rob Clark 2021-04-05 755 GEM_WARN_ON(!msm_obj->evictable);
63f17ef834284d Rob Clark 2021-04-05 756 GEM_WARN_ON(msm_obj->active_count);
63f17ef834284d Rob Clark 2021-04-05 757
63f17ef834284d Rob Clark 2021-04-05 758 /* Get rid of any iommu mapping(s): */
63f17ef834284d Rob Clark 2021-04-05 759 put_iova_spaces(obj, false);
63f17ef834284d Rob Clark 2021-04-05 760
63f17ef834284d Rob Clark 2021-04-05 761 drm_vma_node_unmap(&obj->vma_node, dev->anon_inode->i_mapping);
63f17ef834284d Rob Clark 2021-04-05 762
63f17ef834284d Rob Clark 2021-04-05 763 put_pages(obj);
63f17ef834284d Rob Clark 2021-04-05 764
63f17ef834284d Rob Clark 2021-04-05 765 update_inactive(msm_obj);
63f17ef834284d Rob Clark 2021-04-05 766 }
63f17ef834284d Rob Clark 2021-04-05 767
599089c6af6830 Rob Clark 2020-10-23 768 void msm_gem_vunmap(struct drm_gem_object *obj)
e1e9db2ca79575 Rob Clark 2016-05-27 769 {
e1e9db2ca79575 Rob Clark 2016-05-27 770 struct msm_gem_object *msm_obj = to_msm_bo(obj);
e1e9db2ca79575 Rob Clark 2016-05-27 771
90643a24a7bfbe Rob Clark 2021-04-05 772 GEM_WARN_ON(!msm_gem_is_locked(obj));
0e08270a1f01bc Sushmita Susheelendra 2017-06-13 773
90643a24a7bfbe Rob Clark 2021-04-05 774 if (!msm_obj->vaddr || GEM_WARN_ON(!is_vunmapable(msm_obj)))
e1e9db2ca79575 Rob Clark 2016-05-27 775 return;
e1e9db2ca79575 Rob Clark 2016-05-27 776
e1e9db2ca79575 Rob Clark 2016-05-27 @777 vunmap(msm_obj->vaddr);
e1e9db2ca79575 Rob Clark 2016-05-27 778 msm_obj->vaddr = NULL;
e1e9db2ca79575 Rob Clark 2016-05-27 779 }
e1e9db2ca79575 Rob Clark 2016-05-27 780

:::::: The code at line 624 was first introduced by commit
:::::: c8afe684c95cd17cf4f273d81af369a0fdfa5a74 drm/msm: basic KMS driver for snapdragon

:::::: TO: Rob Clark <robdclark@xxxxxxxxx>
:::::: CC: Rob Clark <robdclark@xxxxxxxxx>

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

Attachment: .config.gz
Description: application/gzip