Hi, I love your patch! Perhaps something to improve: [auto build test WARNING on 3c1f24109dfc4fb1a3730ed237e50183c6bb26b3] url: https://github.com/intel-lab-lkp/linux/commits/daire-mcnamara-microchip-com/PCI-microchip-Partition-address-translations/20221116-220208 base: 3c1f24109dfc4fb1a3730ed237e50183c6bb26b3 patch link: https://lore.kernel.org/r/20221116135504.258687-9-daire.mcnamara%40microchip.com patch subject: [PATCH v1 8/9] PCI: microchip: Partition inbound address translation config: ia64-allyesconfig compiler: ia64-linux-gcc (GCC) 12.1.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/intel-lab-lkp/linux/commit/41006bdc423e557398463818442a7607a8111347 git remote add linux-review https://github.com/intel-lab-lkp/linux git fetch --no-tags linux-review daire-mcnamara-microchip-com/PCI-microchip-Partition-address-translations/20221116-220208 git checkout 41006bdc423e557398463818442a7607a8111347 # save the config file mkdir build_dir && cp config build_dir/.config COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=ia64 SHELL=/bin/bash drivers/pci/controller/ If you fix the issue, kindly add following tag where applicable | Reported-by: kernel test robot All warnings (new ones prefixed by >>): drivers/pci/controller/pcie-microchip-host.c: In function 'mc_check_for_parent_dma_range_handling': >> drivers/pci/controller/pcie-microchip-host.c:1212:13: warning: variable 'end_pci' set but not used [-Wunused-but-set-variable] 1212 | u64 end_pci = 0; | ^~~~~~~ drivers/pci/controller/pcie-microchip-host.c: In function 'mc_host_probe': drivers/pci/controller/pcie-microchip-host.c:1364:23: warning: variable 'ctrl_base_addr' set but not used [-Wunused-but-set-variable] 1364 | void __iomem *ctrl_base_addr; | ^~~~~~~~~~~~~~ vim +/end_pci +1212 drivers/pci/controller/pcie-microchip-host.c 1198 1199 static int mc_check_for_parent_dma_range_handling(struct platform_device *pdev, 1200 struct mc_pcie *port) 1201 { 1202 struct device *dev = &pdev->dev; 1203 struct device_node *dn = dev->of_node; 1204 struct of_range_parser parser; 1205 struct of_range range; 1206 int num_parent_ranges = 0; 1207 int num_ranges = 0; 1208 struct inbound_windows ranges[MC_MAX_NUM_INBOUND_WINDOWS] = { 0 }; 1209 u64 start_axi = GENMASK(63, 0); 1210 u64 end_axi = 0; 1211 u64 start_pci = GENMASK(63, 0); > 1212 u64 end_pci = 0; 1213 s64 size; 1214 u64 window_size; 1215 int i; 1216 1217 /* find all dma-ranges */ 1218 if (of_pci_dma_range_parser_init(&parser, dn)) { 1219 dev_err(dev, "missing dma-ranges property\n"); 1220 return -EINVAL; 1221 } 1222 1223 for_each_of_range(&parser, &range) { 1224 if (num_ranges > MC_MAX_NUM_INBOUND_WINDOWS) { 1225 dev_err(dev, "too many inbound ranges; %d available tables\n", 1226 MC_MAX_NUM_INBOUND_WINDOWS); 1227 return -EINVAL; 1228 } 1229 ranges[num_ranges].axi_addr = range.cpu_addr; 1230 ranges[num_ranges].pci_addr = range.pci_addr; 1231 ranges[num_ranges].size = range.size; 1232 1233 num_ranges++; 1234 } 1235 1236 /* 1237 * check for one level up; will need to adjust 1238 * address translation tables for these 1239 */ 1240 dn = of_get_parent(dn); 1241 if (dn) { 1242 of_pci_dma_range_parser_init(&parser, dn); 1243 1244 for_each_of_range(&parser, &range) { 1245 if (num_parent_ranges > MC_MAX_NUM_INBOUND_WINDOWS) { 1246 dev_err(dev, "too many parent inbound ranges; %d available tables\n", 1247 MC_MAX_NUM_INBOUND_WINDOWS); 1248 return -EINVAL; 1249 } 1250 ranges[num_parent_ranges].axi_addr = range.pci_addr; 1251 num_parent_ranges++; 1252 } 1253 } 1254 1255 if (num_parent_ranges) { 1256 if (num_ranges != num_parent_ranges) { 1257 dev_err(dev, "num parent inbound ranges must be 0 or match num inbound ranges\n"); 1258 return -EINVAL; 1259 } 1260 } 1261 1262 /* merge ranges */ 1263 for (i = 0; i < num_ranges; i++) { 1264 struct inbound_windows *range = &ranges[i]; 1265 1266 if (range->axi_addr < start_axi) { 1267 start_axi = range->axi_addr; 1268 start_pci = range->pci_addr; 1269 } 1270 1271 if (range->axi_addr + range->size > end_axi) { 1272 end_axi = range->axi_addr + range->size; 1273 end_pci = range->pci_addr + range->size; 1274 } 1275 } 1276 1277 /* move starts back as far as possible */ 1278 start_axi &= MC_ATT_MASK; 1279 start_pci &= MC_ATT_MASK; 1280 1281 /* adjust size to take account of that change */ 1282 size = end_axi - start_axi; 1283 1284 /* may need to adjust size up to the next largest power of 2 */ 1285 if (size < 1ull << ilog2(size)) 1286 size = 1ull << (ilog2(size) + 1); 1287 1288 window_size = 1ull << (ilog2(size) - 1); 1289 1290 /* divide merged range into windows */ 1291 i = 0; 1292 while (size > 0 && i < MC_MAX_NUM_INBOUND_WINDOWS) { 1293 port->inbound_windows[i].axi_addr = start_axi; 1294 port->inbound_windows[i].pci_addr = start_pci; 1295 port->inbound_windows[i].size = window_size; 1296 1297 size -= window_size; 1298 start_axi += window_size; 1299 start_pci += window_size; 1300 i++; 1301 port->num_inbound_windows = i; 1302 } 1303 1304 if (size < 0) { 1305 dev_err(dev, "insufficient windows to map inbound ranges\n"); 1306 return -EINVAL; 1307 } 1308 1309 return 0; 1310 } 1311 -- 0-DAY CI Kernel Test Service https://01.org/lkp