From mboxrd@z Thu Jan 1 00:00:00 1970 Content-Type: multipart/mixed; boundary="===============2604238448370443137==" MIME-Version: 1.0 From: kernel test robot To: kbuild-all@lists.01.org Subject: Re: [PATCH 2/4] dmaengine: Add Oxford Semiconductor OXNAS DMA Controller Date: Wed, 05 Jan 2022 01:27:07 +0800 Message-ID: <202201050144.3TpBzQkL-lkp@intel.com> In-Reply-To: <20220104145206.135524-3-narmstrong@baylibre.com> List-Id: --===============2604238448370443137== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Hi Neil, I love your patch! Perhaps something to improve: [auto build test WARNING on fa55b7dcdc43c1aa1ba12bca9d2dd4318c2a0dbf] url: https://github.com/0day-ci/linux/commits/Neil-Armstrong/dmaengine-A= dd-support-Oxford-Semiconductor-OXNAS-DMA-Engine/20220104-225322 base: fa55b7dcdc43c1aa1ba12bca9d2dd4318c2a0dbf config: arc-allyesconfig (https://download.01.org/0day-ci/archive/20220105/= 202201050144.3TpBzQkL-lkp(a)intel.com/config) compiler: arceb-elf-gcc (GCC) 11.2.0 reproduce (this is a W=3D1 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/0day-ci/linux/commit/55f80a9eaf56cb8c1b943a7ea= 35e3a97aecc628d git remote add linux-review https://github.com/0day-ci/linux git fetch --no-tags linux-review Neil-Armstrong/dmaengine-Add-suppo= rt-Oxford-Semiconductor-OXNAS-DMA-Engine/20220104-225322 git checkout 55f80a9eaf56cb8c1b943a7ea35e3a97aecc628d # save the config file to linux build tree mkdir build_dir COMPILER_INSTALL_PATH=3D$HOME/0day COMPILER=3Dgcc-11.2.0 make.cross= O=3Dbuild_dir ARCH=3Darc SHELL=3D/bin/bash drivers/dma/ If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot All warnings (new ones prefixed by >>): | | | un= signed int | %08llx In file included from include/linux/printk.h:555, from include/linux/kernel.h:20, from include/linux/cpumask.h:10, from include/linux/mm_types_task.h:14, from include/linux/mm_types.h:5, from include/linux/buildid.h:5, from include/linux/module.h:14, from drivers/dma/oxnas_adma.c:7: drivers/dma/oxnas_adma.c:655:37: warning: format '%x' expects argument o= f type 'unsigned int', but argument 5 has type 'dma_addr_t' {aka 'long long= unsigned int'} [-Wformat=3D] 655 | dev_dbg(&dmadev->pdev->dev, "preparing memcpy from %08x = to %08x, %lubytes (flags %x)\n", | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~= ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ include/linux/dynamic_debug.h:134:29: note: in definition of macro '__dy= namic_func_call' 134 | func(&id, ##__VA_ARGS__); \ | ^~~~~~~~~~~ include/linux/dynamic_debug.h:166:9: note: in expansion of macro '_dynam= ic_func_call' 166 | _dynamic_func_call(fmt,__dynamic_dev_dbg, \ | ^~~~~~~~~~~~~~~~~~ include/linux/dev_printk.h:155:9: note: in expansion of macro 'dynamic_d= ev_dbg' 155 | dynamic_dev_dbg(dev, dev_fmt(fmt), ##__VA_ARGS__) | ^~~~~~~~~~~~~~~ include/linux/dev_printk.h:155:30: note: in expansion of macro 'dev_fmt' 155 | dynamic_dev_dbg(dev, dev_fmt(fmt), ##__VA_ARGS__) | ^~~~~~~ drivers/dma/oxnas_adma.c:655:9: note: in expansion of macro 'dev_dbg' 655 | dev_dbg(&dmadev->pdev->dev, "preparing memcpy from %08x = to %08x, %lubytes (flags %x)\n", | ^~~~~~~ drivers/dma/oxnas_adma.c:655:71: note: format string is defined here 655 | dev_dbg(&dmadev->pdev->dev, "preparing memcpy from %08x = to %08x, %lubytes (flags %x)\n", | = ~~~^ | = | | = unsigned int | = %08llx In file included from include/linux/printk.h:555, from include/linux/kernel.h:20, from include/linux/cpumask.h:10, from include/linux/mm_types_task.h:14, from include/linux/mm_types.h:5, from include/linux/buildid.h:5, from include/linux/module.h:14, from drivers/dma/oxnas_adma.c:7: drivers/dma/oxnas_adma.c: In function 'oxnas_dma_probe': drivers/dma/oxnas_adma.c:869:37: warning: format '%x' expects argument o= f type 'unsigned int', but argument 4 has type 'dma_addr_t' {aka 'long long= unsigned int'} [-Wformat=3D] 869 | dev_dbg(&pdev->dev, "0x%08x-0x%08x =3D %d\n", | ^~~~~~~~~~~~~~~~~~~~~~ include/linux/dynamic_debug.h:134:29: note: in definition of macro '__dy= namic_func_call' 134 | func(&id, ##__VA_ARGS__); \ | ^~~~~~~~~~~ include/linux/dynamic_debug.h:166:9: note: in expansion of macro '_dynam= ic_func_call' 166 | _dynamic_func_call(fmt,__dynamic_dev_dbg, \ | ^~~~~~~~~~~~~~~~~~ include/linux/dev_printk.h:155:9: note: in expansion of macro 'dynamic_d= ev_dbg' 155 | dynamic_dev_dbg(dev, dev_fmt(fmt), ##__VA_ARGS__) | ^~~~~~~~~~~~~~~ include/linux/dev_printk.h:155:30: note: in expansion of macro 'dev_fmt' 155 | dynamic_dev_dbg(dev, dev_fmt(fmt), ##__VA_ARGS__) | ^~~~~~~ drivers/dma/oxnas_adma.c:869:17: note: in expansion of macro 'dev_dbg' 869 | dev_dbg(&pdev->dev, "0x%08x-0x%08x =3D %d\n", | ^~~~~~~ drivers/dma/oxnas_adma.c:869:43: note: format string is defined here 869 | dev_dbg(&pdev->dev, "0x%08x-0x%08x =3D %d\n", | ~~~^ | | | unsigned int | %08llx In file included from include/linux/printk.h:555, from include/linux/kernel.h:20, from include/linux/cpumask.h:10, from include/linux/mm_types_task.h:14, from include/linux/mm_types.h:5, from include/linux/buildid.h:5, from include/linux/module.h:14, from drivers/dma/oxnas_adma.c:7: drivers/dma/oxnas_adma.c:869:37: warning: format '%x' expects argument o= f type 'unsigned int', but argument 5 has type 'dma_addr_t' {aka 'long long= unsigned int'} [-Wformat=3D] 869 | dev_dbg(&pdev->dev, "0x%08x-0x%08x =3D %d\n", | ^~~~~~~~~~~~~~~~~~~~~~ include/linux/dynamic_debug.h:134:29: note: in definition of macro '__dy= namic_func_call' 134 | func(&id, ##__VA_ARGS__); \ | ^~~~~~~~~~~ include/linux/dynamic_debug.h:166:9: note: in expansion of macro '_dynam= ic_func_call' 166 | _dynamic_func_call(fmt,__dynamic_dev_dbg, \ | ^~~~~~~~~~~~~~~~~~ include/linux/dev_printk.h:155:9: note: in expansion of macro 'dynamic_d= ev_dbg' 155 | dynamic_dev_dbg(dev, dev_fmt(fmt), ##__VA_ARGS__) | ^~~~~~~~~~~~~~~ include/linux/dev_printk.h:155:30: note: in expansion of macro 'dev_fmt' 155 | dynamic_dev_dbg(dev, dev_fmt(fmt), ##__VA_ARGS__) | ^~~~~~~ drivers/dma/oxnas_adma.c:869:17: note: in expansion of macro 'dev_dbg' 869 | dev_dbg(&pdev->dev, "0x%08x-0x%08x =3D %d\n", | ^~~~~~~ drivers/dma/oxnas_adma.c:869:50: note: format string is defined here 869 | dev_dbg(&pdev->dev, "0x%08x-0x%08x =3D %d\n", | ~~~^ | | | unsigned int | %08llx >> drivers/dma/oxnas_adma.c:915:40: warning: cast to pointer from integer o= f different size [-Wint-to-pointer-cast] 915 | (dma_addr_t)&(((struct oxnas_dma_sg_data= *)dmadev->p_sg_data)->entries[i]); | ^ >> drivers/dma/oxnas_adma.c:915:25: warning: cast from pointer to integer o= f different size [-Wpointer-to-int-cast] 915 | (dma_addr_t)&(((struct oxnas_dma_sg_data= *)dmadev->p_sg_data)->entries[i]); | ^ drivers/dma/oxnas_adma.c:944:39: warning: cast to pointer from integer o= f different size [-Wint-to-pointer-cast] 944 | (dma_addr_t)&((struct oxnas_dma_sg_data = *)dmadev->p_sg_data)->infos[i]; | ^ drivers/dma/oxnas_adma.c:944:25: warning: cast from pointer to integer o= f different size [-Wpointer-to-int-cast] 944 | (dma_addr_t)&((struct oxnas_dma_sg_data = *)dmadev->p_sg_data)->infos[i]; | ^ vim +915 drivers/dma/oxnas_adma.c 794 = 795 static int oxnas_dma_probe(struct platform_device *pdev) 796 { 797 struct oxnas_dma_device *dmadev; 798 struct resource *res; 799 int hwid, i, ret; 800 = 801 dmadev =3D devm_kzalloc(&pdev->dev, sizeof(struct oxnas_dma_device)= , GFP_KERNEL); 802 if (!dmadev) 803 return -ENOMEM; 804 = 805 res =3D platform_get_resource(pdev, IORESOURCE_MEM, 0); 806 dmadev->dma_base =3D devm_ioremap_resource(&pdev->dev, res); 807 if (IS_ERR(dmadev->dma_base)) 808 return PTR_ERR(dmadev->dma_base); 809 = 810 res =3D platform_get_resource(pdev, IORESOURCE_MEM, 1); 811 dmadev->sgdma_base =3D devm_ioremap_resource(&pdev->dev, res); 812 if (IS_ERR(dmadev->sgdma_base)) 813 return PTR_ERR(dmadev->sgdma_base); 814 = 815 dmadev->dma_rst =3D devm_reset_control_get(&pdev->dev, "dma"); 816 if (IS_ERR(dmadev->dma_rst)) 817 return PTR_ERR(dmadev->dma_rst); 818 = 819 dmadev->sgdma_rst =3D devm_reset_control_get(&pdev->dev, "sgdma"); 820 if (IS_ERR(dmadev->sgdma_rst)) 821 return PTR_ERR(dmadev->sgdma_rst); 822 = 823 dmadev->dma_clk =3D devm_clk_get(&pdev->dev, 0); 824 if (IS_ERR(dmadev->dma_clk)) 825 return PTR_ERR(dmadev->dma_clk); 826 = 827 ret =3D of_property_count_elems_of_size(pdev->dev.of_node, "oxsemi,= targets-types", 4); 828 if (ret <=3D 0 || (ret % 3) !=3D 0) { 829 dev_err(&pdev->dev, "malformed or missing oxsemi,targets-types\n"); 830 return -EINVAL; 831 } 832 = 833 dmadev->authorized_types_count =3D ret / 3; 834 dmadev->authorized_types =3D devm_kzalloc(&pdev->dev, 835 sizeof(*dmadev->authorized_types) * dmadev->authorized_types_count= , GFP_KERNEL); 836 = 837 if (!dmadev->authorized_types) 838 return -ENOMEM; 839 = 840 for (i =3D 0 ; i < dmadev->authorized_types_count ; ++i) { 841 u32 value; 842 = 843 ret =3D of_property_read_u32_index(pdev->dev.of_node, 844 "oxsemi,targets-types", 845 (i * 3), &value); 846 if (ret < 0) 847 return ret; 848 = 849 dmadev->authorized_types[i].start =3D value; 850 ret =3D of_property_read_u32_index(pdev->dev.of_node, 851 "oxsemi,targets-types", 852 (i * 3) + 1, &value); 853 if (ret < 0) 854 return ret; 855 = 856 dmadev->authorized_types[i].end =3D value; 857 ret =3D of_property_read_u32_index(pdev->dev.of_node, 858 "oxsemi,targets-types", 859 (i * 3) + 2, &value); 860 if (ret < 0) 861 return ret; 862 = 863 dmadev->authorized_types[i].type =3D value; 864 } 865 = 866 dev_dbg(&pdev->dev, "Authorized memory ranges :\n"); 867 dev_dbg(&pdev->dev, " Start - End =3D Type\n"); 868 for (i =3D 0 ; i < dmadev->authorized_types_count ; ++i) 869 dev_dbg(&pdev->dev, "0x%08x-0x%08x =3D %d\n", 870 dmadev->authorized_types[i].start, 871 dmadev->authorized_types[i].end, 872 dmadev->authorized_types[i].type); 873 = 874 dmadev->pdev =3D pdev; 875 = 876 spin_lock_init(&dmadev->lock); 877 = 878 tasklet_init(&dmadev->tasklet, oxnas_dma_sched, (unsigned long)dmad= ev); 879 INIT_LIST_HEAD(&dmadev->common.channels); 880 INIT_LIST_HEAD(&dmadev->pending); 881 INIT_LIST_HEAD(&dmadev->free_entries); 882 = 883 /* Enable HW & Clocks */ 884 reset_control_reset(dmadev->dma_rst); 885 reset_control_reset(dmadev->sgdma_rst); 886 clk_prepare_enable(dmadev->dma_clk); 887 = 888 /* Discover the number of channels available */ 889 hwid =3D readl(dmadev->dma_base + DMA_CALC_REG_ADR(0, DMA_INTR_ID)); 890 dmadev->channels_count =3D DMA_INTR_ID_GET_NUM_CHANNELS(hwid); 891 dmadev->hwversion =3D DMA_INTR_ID_GET_VERSION(hwid); 892 = 893 dev_dbg(&pdev->dev, "OXNAS DMA v%x with %d channels\n", 894 dmadev->hwversion, dmadev->channels_count); 895 = 896 /* Limit channels count */ 897 if (dmadev->channels_count > MAX_OXNAS_DMA_CHANNELS) 898 dmadev->channels_count =3D MAX_OXNAS_DMA_CHANNELS; 899 = 900 /* Allocate coherent memory for sg descriptors */ 901 dmadev->sg_data =3D dma_alloc_coherent(&pdev->dev, sizeof(struct ox= nas_dma_sg_data), 902 &dmadev->p_sg_data, GFP_KERNEL); 903 if (!dmadev->sg_data) { 904 ret =3D -ENOMEM; 905 goto disable_clks; 906 } 907 = 908 /* Reset SG descritors */ 909 memset(dmadev->sg_data, 0, sizeof(struct oxnas_dma_sg_data)); 910 atomic_set(&dmadev->free_entries_count, 0); 911 = 912 /* Initialize and add all sg entries to the free list */ 913 for (i =3D 0 ; i < MAX_OXNAS_SG_ENTRIES ; ++i) { 914 dmadev->sg_data->entries[i].this_paddr =3D > 915 (dma_addr_t)&(((struct oxnas_dma_sg_data *)dmadev->p_sg_data)->en= tries[i]); 916 INIT_LIST_HEAD(&dmadev->sg_data->entries[i].entry); 917 list_add_tail(&dmadev->sg_data->entries[i].entry, 918 &dmadev->free_entries); 919 atomic_inc(&dmadev->free_entries_count); 920 } 921 = 922 /* Init all channels */ 923 for (i =3D 0 ; i < dmadev->channels_count ; ++i) { 924 struct oxnas_dma_channel *ch =3D &dmadev->channels[i]; 925 = 926 ch->dmadev =3D dmadev; 927 ch->id =3D i; 928 = 929 ch->irq =3D irq_of_parse_and_map(pdev->dev.of_node, i); 930 if (ch->irq <=3D 0) { 931 dev_err(&pdev->dev, "invalid irq%d from platform\n", i); 932 goto free_coherent; 933 } 934 = 935 ret =3D devm_request_irq(&pdev->dev, ch->irq, 936 oxnas_dma_interrupt, 0, 937 "DMA", ch); 938 if (ret < 0) { 939 dev_err(&pdev->dev, "failed to request irq%d\n", i); 940 goto free_coherent; 941 } 942 = 943 ch->p_sg_info =3D 944 (dma_addr_t)&((struct oxnas_dma_sg_data *)dmadev->p_sg_data)->inf= os[i]; 945 ch->sg_info =3D &dmadev->sg_data->infos[i]; 946 memset(ch->sg_info, 0, sizeof(struct oxnas_dma_sg_info)); 947 = 948 atomic_set(&ch->active, 0); 949 = 950 ch->vc.desc_free =3D oxnas_dma_desc_free; 951 vchan_init(&ch->vc, &dmadev->common); 952 INIT_LIST_HEAD(&ch->node); 953 } 954 = 955 platform_set_drvdata(pdev, dmadev); 956 = 957 dma_cap_set(DMA_MEMCPY, dmadev->common.cap_mask); 958 dmadev->common.chancnt =3D dmadev->channels_count; 959 dmadev->common.device_free_chan_resources =3D oxnas_dma_free_chan_r= esources; 960 dmadev->common.device_tx_status =3D oxnas_dma_tx_status; 961 dmadev->common.device_issue_pending =3D oxnas_dma_issue_pending; 962 dmadev->common.device_prep_dma_memcpy =3D oxnas_dma_prep_dma_memcpy; 963 dmadev->common.device_prep_slave_sg =3D oxnas_dma_prep_slave_sg; 964 dmadev->common.device_config =3D oxnas_dma_slave_config; 965 dmadev->common.copy_align =3D DMAENGINE_ALIGN_4_BYTES; 966 dmadev->common.src_addr_widths =3D DMA_SLAVE_BUSWIDTH_4_BYTES; 967 dmadev->common.dst_addr_widths =3D DMA_SLAVE_BUSWIDTH_4_BYTES; 968 dmadev->common.directions =3D BIT(DMA_MEM_TO_MEM); 969 dmadev->common.residue_granularity =3D DMA_RESIDUE_GRANULARITY_DESC= RIPTOR; 970 dmadev->common.dev =3D &pdev->dev; 971 = 972 ret =3D dma_async_device_register(&dmadev->common); 973 if (ret) 974 goto free_coherent; 975 = 976 ret =3D of_dma_controller_register(pdev->dev.of_node, 977 of_dma_xlate_by_chan_id, 978 &dmadev->common); 979 if (ret) { 980 dev_warn(&pdev->dev, "Failed to register DMA Controller\n"); 981 goto dma_unregister; 982 } 983 = 984 dev_info(&pdev->dev, "OXNAS DMA Registered\n"); 985 = 986 return 0; 987 = 988 dma_unregister: 989 dma_async_device_unregister(&dmadev->common); 990 = 991 free_coherent: 992 dma_free_coherent(&pdev->dev, sizeof(struct oxnas_dma_sg_data), 993 dmadev->sg_data, dmadev->p_sg_data); 994 = 995 disable_clks: 996 clk_disable_unprepare(dmadev->dma_clk); 997 = 998 return ret; 999 } 1000 = --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org --===============2604238448370443137==--