[tobetter:odroid-5.15.y 7/75] drivers/media/platform/s5p-mfc/s5p_mfc.c:861:54: error: 'DMA_ATTR_NON_CONSISTENT' undeclared

From: kernel test robot
Date: Wed Nov 03 2021 - 09:03:49 EST


tree: https://github.com/tobetter/linux odroid-5.15.y
head: 49f1393b8740941fa5176620b302f25ab5f786dc
commit: 414eddd4e355e7e5d34260d085ed126e23088ed9 [7/75] ODROID-XU4: media: s5p-mfc: use cacheable DMA buffers to improve performance
config: sh-allmodconfig (attached as .config)
compiler: sh4-linux-gcc (GCC) 11.2.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://github.com/tobetter/linux/commit/414eddd4e355e7e5d34260d085ed126e23088ed9
git remote add tobetter https://github.com/tobetter/linux
git fetch --no-tags tobetter odroid-5.15.y
git checkout 414eddd4e355e7e5d34260d085ed126e23088ed9
# save the attached .config to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross O=build_dir ARCH=sh SHELL=/bin/bash drivers/media/platform/s5p-mfc/

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

Note: the tobetter/odroid-5.15.y HEAD 49f1393b8740941fa5176620b302f25ab5f786dc builds fine.
It only hurts bisectability.

All errors (new ones prefixed by >>):

drivers/media/platform/s5p-mfc/s5p_mfc.c: In function 's5p_mfc_open':
>> drivers/media/platform/s5p-mfc/s5p_mfc.c:861:54: error: 'DMA_ATTR_NON_CONSISTENT' undeclared (first use in this function)
861 | q->dma_attrs = DMA_ATTR_ALLOC_SINGLE_PAGES | DMA_ATTR_NON_CONSISTENT | DMA_ATTR_NO_KERNEL_MAPPING;
| ^~~~~~~~~~~~~~~~~~~~~~~
drivers/media/platform/s5p-mfc/s5p_mfc.c:861:54: note: each undeclared identifier is reported only once for each function it appears in


vim +/DMA_ATTR_NON_CONSISTENT +861 drivers/media/platform/s5p-mfc/s5p_mfc.c

749
750 /* Open an MFC node */
751 static int s5p_mfc_open(struct file *file)
752 {
753 struct video_device *vdev = video_devdata(file);
754 struct s5p_mfc_dev *dev = video_drvdata(file);
755 struct s5p_mfc_ctx *ctx = NULL;
756 struct vb2_queue *q;
757 int ret = 0;
758
759 mfc_debug_enter();
760 if (mutex_lock_interruptible(&dev->mfc_mutex))
761 return -ERESTARTSYS;
762 dev->num_inst++; /* It is guarded by mfc_mutex in vfd */
763 /* Allocate memory for context */
764 ctx = kzalloc(sizeof(*ctx), GFP_KERNEL);
765 if (!ctx) {
766 ret = -ENOMEM;
767 goto err_alloc;
768 }
769 init_waitqueue_head(&ctx->queue);
770 v4l2_fh_init(&ctx->fh, vdev);
771 file->private_data = &ctx->fh;
772 v4l2_fh_add(&ctx->fh);
773 ctx->dev = dev;
774 INIT_LIST_HEAD(&ctx->src_queue);
775 INIT_LIST_HEAD(&ctx->dst_queue);
776 ctx->src_queue_cnt = 0;
777 ctx->dst_queue_cnt = 0;
778 /* Get context number */
779 ctx->num = 0;
780 while (dev->ctx[ctx->num]) {
781 ctx->num++;
782 if (ctx->num >= MFC_NUM_CONTEXTS) {
783 mfc_debug(2, "Too many open contexts\n");
784 ret = -EBUSY;
785 goto err_no_ctx;
786 }
787 }
788 /* Mark context as idle */
789 clear_work_bit_irqsave(ctx);
790 dev->ctx[ctx->num] = ctx;
791 if (vdev == dev->vfd_dec) {
792 ctx->type = MFCINST_DECODER;
793 ctx->c_ops = get_dec_codec_ops();
794 s5p_mfc_dec_init(ctx);
795 /* Setup ctrl handler */
796 ret = s5p_mfc_dec_ctrls_setup(ctx);
797 if (ret) {
798 mfc_err("Failed to setup mfc controls\n");
799 goto err_ctrls_setup;
800 }
801 } else if (vdev == dev->vfd_enc) {
802 ctx->type = MFCINST_ENCODER;
803 ctx->c_ops = get_enc_codec_ops();
804 /* only for encoder */
805 INIT_LIST_HEAD(&ctx->ref_queue);
806 ctx->ref_queue_cnt = 0;
807 s5p_mfc_enc_init(ctx);
808 /* Setup ctrl handler */
809 ret = s5p_mfc_enc_ctrls_setup(ctx);
810 if (ret) {
811 mfc_err("Failed to setup mfc controls\n");
812 goto err_ctrls_setup;
813 }
814 } else {
815 ret = -ENOENT;
816 goto err_bad_node;
817 }
818 ctx->fh.ctrl_handler = &ctx->ctrl_handler;
819 ctx->inst_no = MFC_NO_INSTANCE_SET;
820 /* Load firmware if this is the first instance */
821 if (dev->num_inst == 1) {
822 dev->watchdog_timer.expires = jiffies +
823 msecs_to_jiffies(MFC_WATCHDOG_INTERVAL);
824 add_timer(&dev->watchdog_timer);
825 ret = s5p_mfc_power_on();
826 if (ret < 0) {
827 mfc_err("power on failed\n");
828 goto err_pwr_enable;
829 }
830 s5p_mfc_clock_on();
831 ret = s5p_mfc_load_firmware(dev);
832 if (ret) {
833 s5p_mfc_clock_off();
834 goto err_load_fw;
835 }
836 /* Init the FW */
837 ret = s5p_mfc_init_hw(dev);
838 s5p_mfc_clock_off();
839 if (ret)
840 goto err_init_hw;
841 }
842 /* Init videobuf2 queue for CAPTURE */
843 q = &ctx->vq_dst;
844 q->type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE;
845 q->drv_priv = &ctx->fh;
846 q->lock = &dev->mfc_mutex;
847 if (vdev == dev->vfd_dec) {
848 q->io_modes = VB2_MMAP;
849 q->ops = get_dec_queue_ops();
850 } else if (vdev == dev->vfd_enc) {
851 q->io_modes = VB2_MMAP | VB2_USERPTR;
852 q->ops = get_enc_queue_ops();
853 } else {
854 ret = -ENOENT;
855 goto err_queue_init;
856 }
857 /*
858 * We'll do mostly sequential access, so sacrifice TLB efficiency for
859 * faster allocation.
860 */
> 861 q->dma_attrs = DMA_ATTR_ALLOC_SINGLE_PAGES | DMA_ATTR_NON_CONSISTENT | DMA_ATTR_NO_KERNEL_MAPPING;
862 q->mem_ops = &vb2_dma_contig_memops;
863 q->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_COPY;
864 ret = vb2_queue_init(q);
865 if (ret) {
866 mfc_err("Failed to initialize videobuf2 queue(capture)\n");
867 goto err_queue_init;
868 }
869 /* Init videobuf2 queue for OUTPUT */
870 q = &ctx->vq_src;
871 q->type = V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE;
872 q->drv_priv = &ctx->fh;
873 q->lock = &dev->mfc_mutex;
874 if (vdev == dev->vfd_dec) {
875 q->io_modes = VB2_MMAP;
876 q->ops = get_dec_queue_ops();
877 } else if (vdev == dev->vfd_enc) {
878 q->io_modes = VB2_MMAP | VB2_USERPTR;
879 q->ops = get_enc_queue_ops();
880 } else {
881 ret = -ENOENT;
882 goto err_queue_init;
883 }
884 /* One way to indicate end-of-stream for MFC is to set the
885 * bytesused == 0. However by default videobuf2 handles bytesused
886 * equal to 0 as a special case and changes its value to the size
887 * of the buffer. Set the allow_zero_bytesused flag so that videobuf2
888 * will keep the value of bytesused intact.
889 */
890 q->allow_zero_bytesused = 1;
891
892 /*
893 * We'll do mostly sequential access, so sacrifice TLB efficiency for
894 * faster allocation.
895 */
896 q->dma_attrs = DMA_ATTR_ALLOC_SINGLE_PAGES | DMA_ATTR_NON_CONSISTENT | DMA_ATTR_NO_KERNEL_MAPPING;
897 q->mem_ops = &vb2_dma_contig_memops;
898 q->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_COPY;
899 ret = vb2_queue_init(q);
900 if (ret) {
901 mfc_err("Failed to initialize videobuf2 queue(output)\n");
902 goto err_queue_init;
903 }
904 mutex_unlock(&dev->mfc_mutex);
905 mfc_debug_leave();
906 return ret;
907 /* Deinit when failure occurred */
908 err_queue_init:
909 if (dev->num_inst == 1)
910 s5p_mfc_deinit_hw(dev);
911 err_init_hw:
912 err_load_fw:
913 err_pwr_enable:
914 if (dev->num_inst == 1) {
915 if (s5p_mfc_power_off() < 0)
916 mfc_err("power off failed\n");
917 del_timer_sync(&dev->watchdog_timer);
918 }
919 err_ctrls_setup:
920 s5p_mfc_dec_ctrls_delete(ctx);
921 err_bad_node:
922 dev->ctx[ctx->num] = NULL;
923 err_no_ctx:
924 v4l2_fh_del(&ctx->fh);
925 v4l2_fh_exit(&ctx->fh);
926 kfree(ctx);
927 err_alloc:
928 dev->num_inst--;
929 mutex_unlock(&dev->mfc_mutex);
930 mfc_debug_leave();
931 return ret;
932 }
933

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

Attachment: .config.gz
Description: application/gzip