Hi Claire, Thank you for the patch! Yet something to improve: [auto build test ERROR on next-20210421] [cannot apply to swiotlb/linux-next robh/for-next xen-tip/linux-next linus/master v5.12-rc8 v5.12-rc7 v5.12-rc6 v5.12-rc8] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch] url: https://github.com/0day-ci/linux/commits/Claire-Chang/Restricted-DMA/20210422-161942 base: b74523885a715463203d4ccc3cf8c85952d3701a config: s390-allmodconfig (attached as .config) compiler: s390-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://github.com/0day-ci/linux/commit/2c0a859fc4095e12d1119617c6fd60037cfde731 git remote add linux-review https://github.com/0day-ci/linux git fetch --no-tags linux-review Claire-Chang/Restricted-DMA/20210422-161942 git checkout 2c0a859fc4095e12d1119617c6fd60037cfde731 # save the attached .config to linux build tree COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross W=1 ARCH=s390 If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot All errors (new ones prefixed by >>): drivers/of/device.c: In function 'of_dma_configure_id': >> drivers/of/device.c:169:10: error: implicit declaration of function 'of_dma_set_restricted_buffer'; did you mean 'of_dma_get_restricted_buffer'? [-Werror=implicit-function-declaration] 169 | return of_dma_set_restricted_buffer(dev); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ | of_dma_get_restricted_buffer cc1: some warnings being treated as errors vim +169 drivers/of/device.c 54 55 /** 56 * of_dma_configure_id - Setup DMA configuration 57 * @dev: Device to apply DMA configuration 58 * @np: Pointer to OF node having DMA configuration 59 * @force_dma: Whether device is to be set up by of_dma_configure() even if 60 * DMA capability is not explicitly described by firmware. 61 * @id: Optional const pointer value input id 62 * 63 * Try to get devices's DMA configuration from DT and update it 64 * accordingly. 65 * 66 * If platform code needs to use its own special DMA configuration, it 67 * can use a platform bus notifier and handle BUS_NOTIFY_ADD_DEVICE events 68 * to fix up DMA configuration. 69 */ 70 int of_dma_configure_id(struct device *dev, struct device_node *np, 71 bool force_dma, const u32 *id) 72 { 73 const struct iommu_ops *iommu; 74 const struct bus_dma_region *map = NULL; 75 u64 dma_start = 0; 76 u64 mask, end, size = 0; 77 bool coherent; 78 int ret; 79 80 ret = of_dma_get_range(np, &map); 81 if (ret < 0) { 82 /* 83 * For legacy reasons, we have to assume some devices need 84 * DMA configuration regardless of whether "dma-ranges" is 85 * correctly specified or not. 86 */ 87 if (!force_dma) 88 return ret == -ENODEV ? 0 : ret; 89 } else { 90 const struct bus_dma_region *r = map; 91 u64 dma_end = 0; 92 93 /* Determine the overall bounds of all DMA regions */ 94 for (dma_start = ~0; r->size; r++) { 95 /* Take lower and upper limits */ 96 if (r->dma_start < dma_start) 97 dma_start = r->dma_start; 98 if (r->dma_start + r->size > dma_end) 99 dma_end = r->dma_start + r->size; 100 } 101 size = dma_end - dma_start; 102 103 /* 104 * Add a work around to treat the size as mask + 1 in case 105 * it is defined in DT as a mask. 106 */ 107 if (size & 1) { 108 dev_warn(dev, "Invalid size 0x%llx for dma-range(s)\n", 109 size); 110 size = size + 1; 111 } 112 113 if (!size) { 114 dev_err(dev, "Adjusted size 0x%llx invalid\n", size); 115 kfree(map); 116 return -EINVAL; 117 } 118 } 119 120 /* 121 * If @dev is expected to be DMA-capable then the bus code that created 122 * it should have initialised its dma_mask pointer by this point. For 123 * now, we'll continue the legacy behaviour of coercing it to the 124 * coherent mask if not, but we'll no longer do so quietly. 125 */ 126 if (!dev->dma_mask) { 127 dev_warn(dev, "DMA mask not set\n"); 128 dev->dma_mask = &dev->coherent_dma_mask; 129 } 130 131 if (!size && dev->coherent_dma_mask) 132 size = max(dev->coherent_dma_mask, dev->coherent_dma_mask + 1); 133 else if (!size) 134 size = 1ULL << 32; 135 136 /* 137 * Limit coherent and dma mask based on size and default mask 138 * set by the driver. 139 */ 140 end = dma_start + size - 1; 141 mask = DMA_BIT_MASK(ilog2(end) + 1); 142 dev->coherent_dma_mask &= mask; 143 *dev->dma_mask &= mask; 144 /* ...but only set bus limit and range map if we found valid dma-ranges earlier */ 145 if (!ret) { 146 dev->bus_dma_limit = end; 147 dev->dma_range_map = map; 148 } 149 150 coherent = of_dma_is_coherent(np); 151 dev_dbg(dev, "device is%sdma coherent\n", 152 coherent ? " " : " not "); 153 154 iommu = of_iommu_configure(dev, np, id); 155 if (PTR_ERR(iommu) == -EPROBE_DEFER) { 156 /* Don't touch range map if it wasn't set from a valid dma-ranges */ 157 if (!ret) 158 dev->dma_range_map = NULL; 159 kfree(map); 160 return -EPROBE_DEFER; 161 } 162 163 dev_dbg(dev, "device is%sbehind an iommu\n", 164 iommu ? " " : " not "); 165 166 arch_setup_dma_ops(dev, dma_start, size, iommu, coherent); 167 168 if (!iommu) > 169 return of_dma_set_restricted_buffer(dev); 170 171 return 0; 172 } 173 EXPORT_SYMBOL_GPL(of_dma_configure_id); 174 --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org