CC: [email protected] CC: [email protected] TO: Christophe JAILLET <[email protected]> CC: Will Deacon <[email protected]>
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master head: 581cb3a26baf846ee9636214afaa5333919875b1 commit: 9062c1d0bedacf68d9c92cbd62c62a6fe6f6cebc iommu/io-pgtable: Move some initialization data to .init.rodata date: 12 months ago :::::: branch date: 8 hours ago :::::: commit date: 12 months ago compiler: arm-linux-gnueabi-gcc (GCC) 9.3.0 If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot <[email protected]> cppcheck warnings: (new ones prefixed by >>) drivers/iommu/io-pgtable-arm.c:914:8: warning: Shifting signed 32-bit value by 31 bits is undefined behaviour [shiftTooManyBitsSigned] reg = ARM_64_LPAE_S2_TCR_RES1 | ^ drivers/iommu/io-pgtable-arm.c:992:31: warning: Shifting signed 32-bit value by 31 bits is undefined behaviour [shiftTooManyBitsSigned] cfg->arm_lpae_s1_cfg.tcr |= ARM_32_LPAE_TCR_EAE; ^ >> drivers/iommu/io-pgtable-arm.c:1186:8: warning: Variable 'iova' is >> reassigned a value before the old one has been used. [redundantAssignment] iova = 0; ^ drivers/iommu/io-pgtable-arm.c:1170:9: note: Variable 'iova' is reassigned a value before the old one has been used. iova += SZ_1G; ^ drivers/iommu/io-pgtable-arm.c:1186:8: note: Variable 'iova' is reassigned a value before the old one has been used. iova = 0; ^ >> drivers/iommu/io-pgtable-arm.c:1221:46: warning: Variable '__initconst' is >> reassigned a value before the old one has been used. [redundantAssignment] static const unsigned int ias[] __initconst = { ^ drivers/iommu/io-pgtable-arm.c:1215:50: note: Variable '__initconst' is reassigned a value before the old one has been used. static const unsigned long pgsize[] __initconst = { ^ drivers/iommu/io-pgtable-arm.c:1221:46: note: Variable '__initconst' is reassigned a value before the old one has been used. static const unsigned int ias[] __initconst = { ^ # https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=9062c1d0bedacf68d9c92cbd62c62a6fe6f6cebc git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git git fetch --no-tags linus master git checkout 9062c1d0bedacf68d9c92cbd62c62a6fe6f6cebc vim +/iova +1186 drivers/iommu/io-pgtable-arm.c fe4b991dcd84e0 Will Deacon 2014-11-17 1113 fe4b991dcd84e0 Will Deacon 2014-11-17 1114 static int __init arm_lpae_run_tests(struct io_pgtable_cfg *cfg) fe4b991dcd84e0 Will Deacon 2014-11-17 1115 { 9062c1d0bedacf Christophe JAILLET 2019-09-09 1116 static const enum io_pgtable_fmt fmts[] __initconst = { fe4b991dcd84e0 Will Deacon 2014-11-17 1117 ARM_64_LPAE_S1, fe4b991dcd84e0 Will Deacon 2014-11-17 1118 ARM_64_LPAE_S2, fe4b991dcd84e0 Will Deacon 2014-11-17 1119 }; fe4b991dcd84e0 Will Deacon 2014-11-17 1120 fe4b991dcd84e0 Will Deacon 2014-11-17 1121 int i, j; fe4b991dcd84e0 Will Deacon 2014-11-17 1122 unsigned long iova; fe4b991dcd84e0 Will Deacon 2014-11-17 1123 size_t size; fe4b991dcd84e0 Will Deacon 2014-11-17 1124 struct io_pgtable_ops *ops; fe4b991dcd84e0 Will Deacon 2014-11-17 1125 fe4b991dcd84e0 Will Deacon 2014-11-17 1126 selftest_running = true; fe4b991dcd84e0 Will Deacon 2014-11-17 1127 fe4b991dcd84e0 Will Deacon 2014-11-17 1128 for (i = 0; i < ARRAY_SIZE(fmts); ++i) { fe4b991dcd84e0 Will Deacon 2014-11-17 1129 cfg_cookie = cfg; fe4b991dcd84e0 Will Deacon 2014-11-17 1130 ops = alloc_io_pgtable_ops(fmts[i], cfg, cfg); fe4b991dcd84e0 Will Deacon 2014-11-17 1131 if (!ops) { fe4b991dcd84e0 Will Deacon 2014-11-17 1132 pr_err("selftest: failed to allocate io pgtable ops\n"); fe4b991dcd84e0 Will Deacon 2014-11-17 1133 return -ENOMEM; fe4b991dcd84e0 Will Deacon 2014-11-17 1134 } fe4b991dcd84e0 Will Deacon 2014-11-17 1135 fe4b991dcd84e0 Will Deacon 2014-11-17 1136 /* fe4b991dcd84e0 Will Deacon 2014-11-17 1137 * Initial sanity checks. fe4b991dcd84e0 Will Deacon 2014-11-17 1138 * Empty page tables shouldn't provide any translations. fe4b991dcd84e0 Will Deacon 2014-11-17 1139 */ fe4b991dcd84e0 Will Deacon 2014-11-17 1140 if (ops->iova_to_phys(ops, 42)) fe4b991dcd84e0 Will Deacon 2014-11-17 1141 return __FAIL(ops, i); fe4b991dcd84e0 Will Deacon 2014-11-17 1142 fe4b991dcd84e0 Will Deacon 2014-11-17 1143 if (ops->iova_to_phys(ops, SZ_1G + 42)) fe4b991dcd84e0 Will Deacon 2014-11-17 1144 return __FAIL(ops, i); fe4b991dcd84e0 Will Deacon 2014-11-17 1145 fe4b991dcd84e0 Will Deacon 2014-11-17 1146 if (ops->iova_to_phys(ops, SZ_2G + 42)) fe4b991dcd84e0 Will Deacon 2014-11-17 1147 return __FAIL(ops, i); fe4b991dcd84e0 Will Deacon 2014-11-17 1148 fe4b991dcd84e0 Will Deacon 2014-11-17 1149 /* fe4b991dcd84e0 Will Deacon 2014-11-17 1150 * Distinct mappings of different granule sizes. fe4b991dcd84e0 Will Deacon 2014-11-17 1151 */ fe4b991dcd84e0 Will Deacon 2014-11-17 1152 iova = 0; 4ae8a5c528c0b1 Kefeng Wang 2016-09-21 1153 for_each_set_bit(j, &cfg->pgsize_bitmap, BITS_PER_LONG) { fe4b991dcd84e0 Will Deacon 2014-11-17 1154 size = 1UL << j; fe4b991dcd84e0 Will Deacon 2014-11-17 1155 fe4b991dcd84e0 Will Deacon 2014-11-17 1156 if (ops->map(ops, iova, iova, size, IOMMU_READ | fe4b991dcd84e0 Will Deacon 2014-11-17 1157 IOMMU_WRITE | fe4b991dcd84e0 Will Deacon 2014-11-17 1158 IOMMU_NOEXEC | fe4b991dcd84e0 Will Deacon 2014-11-17 1159 IOMMU_CACHE)) fe4b991dcd84e0 Will Deacon 2014-11-17 1160 return __FAIL(ops, i); fe4b991dcd84e0 Will Deacon 2014-11-17 1161 fe4b991dcd84e0 Will Deacon 2014-11-17 1162 /* Overlapping mappings */ fe4b991dcd84e0 Will Deacon 2014-11-17 1163 if (!ops->map(ops, iova, iova + size, size, fe4b991dcd84e0 Will Deacon 2014-11-17 1164 IOMMU_READ | IOMMU_NOEXEC)) fe4b991dcd84e0 Will Deacon 2014-11-17 1165 return __FAIL(ops, i); fe4b991dcd84e0 Will Deacon 2014-11-17 1166 fe4b991dcd84e0 Will Deacon 2014-11-17 1167 if (ops->iova_to_phys(ops, iova + 42) != (iova + 42)) fe4b991dcd84e0 Will Deacon 2014-11-17 1168 return __FAIL(ops, i); fe4b991dcd84e0 Will Deacon 2014-11-17 1169 fe4b991dcd84e0 Will Deacon 2014-11-17 1170 iova += SZ_1G; fe4b991dcd84e0 Will Deacon 2014-11-17 1171 } fe4b991dcd84e0 Will Deacon 2014-11-17 1172 fe4b991dcd84e0 Will Deacon 2014-11-17 1173 /* Partial unmap */ fe4b991dcd84e0 Will Deacon 2014-11-17 1174 size = 1UL << __ffs(cfg->pgsize_bitmap); a2d3a382d6c682 Will Deacon 2019-07-02 1175 if (ops->unmap(ops, SZ_1G + size, size, NULL) != size) fe4b991dcd84e0 Will Deacon 2014-11-17 1176 return __FAIL(ops, i); fe4b991dcd84e0 Will Deacon 2014-11-17 1177 fe4b991dcd84e0 Will Deacon 2014-11-17 1178 /* Remap of partial unmap */ fe4b991dcd84e0 Will Deacon 2014-11-17 1179 if (ops->map(ops, SZ_1G + size, size, size, IOMMU_READ)) fe4b991dcd84e0 Will Deacon 2014-11-17 1180 return __FAIL(ops, i); fe4b991dcd84e0 Will Deacon 2014-11-17 1181 fe4b991dcd84e0 Will Deacon 2014-11-17 1182 if (ops->iova_to_phys(ops, SZ_1G + size + 42) != (size + 42)) fe4b991dcd84e0 Will Deacon 2014-11-17 1183 return __FAIL(ops, i); fe4b991dcd84e0 Will Deacon 2014-11-17 1184 fe4b991dcd84e0 Will Deacon 2014-11-17 1185 /* Full unmap */ fe4b991dcd84e0 Will Deacon 2014-11-17 @1186 iova = 0; f793b13ef0c9c1 YueHaibing 2018-04-26 1187 for_each_set_bit(j, &cfg->pgsize_bitmap, BITS_PER_LONG) { fe4b991dcd84e0 Will Deacon 2014-11-17 1188 size = 1UL << j; fe4b991dcd84e0 Will Deacon 2014-11-17 1189 a2d3a382d6c682 Will Deacon 2019-07-02 1190 if (ops->unmap(ops, iova, size, NULL) != size) fe4b991dcd84e0 Will Deacon 2014-11-17 1191 return __FAIL(ops, i); fe4b991dcd84e0 Will Deacon 2014-11-17 1192 fe4b991dcd84e0 Will Deacon 2014-11-17 1193 if (ops->iova_to_phys(ops, iova + 42)) fe4b991dcd84e0 Will Deacon 2014-11-17 1194 return __FAIL(ops, i); fe4b991dcd84e0 Will Deacon 2014-11-17 1195 fe4b991dcd84e0 Will Deacon 2014-11-17 1196 /* Remap full block */ fe4b991dcd84e0 Will Deacon 2014-11-17 1197 if (ops->map(ops, iova, iova, size, IOMMU_WRITE)) fe4b991dcd84e0 Will Deacon 2014-11-17 1198 return __FAIL(ops, i); fe4b991dcd84e0 Will Deacon 2014-11-17 1199 fe4b991dcd84e0 Will Deacon 2014-11-17 1200 if (ops->iova_to_phys(ops, iova + 42) != (iova + 42)) fe4b991dcd84e0 Will Deacon 2014-11-17 1201 return __FAIL(ops, i); fe4b991dcd84e0 Will Deacon 2014-11-17 1202 fe4b991dcd84e0 Will Deacon 2014-11-17 1203 iova += SZ_1G; fe4b991dcd84e0 Will Deacon 2014-11-17 1204 } fe4b991dcd84e0 Will Deacon 2014-11-17 1205 fe4b991dcd84e0 Will Deacon 2014-11-17 1206 free_io_pgtable_ops(ops); fe4b991dcd84e0 Will Deacon 2014-11-17 1207 } fe4b991dcd84e0 Will Deacon 2014-11-17 1208 fe4b991dcd84e0 Will Deacon 2014-11-17 1209 selftest_running = false; fe4b991dcd84e0 Will Deacon 2014-11-17 1210 return 0; fe4b991dcd84e0 Will Deacon 2014-11-17 1211 } fe4b991dcd84e0 Will Deacon 2014-11-17 1212 fe4b991dcd84e0 Will Deacon 2014-11-17 1213 static int __init arm_lpae_do_selftests(void) fe4b991dcd84e0 Will Deacon 2014-11-17 1214 { 9062c1d0bedacf Christophe JAILLET 2019-09-09 1215 static const unsigned long pgsize[] __initconst = { fe4b991dcd84e0 Will Deacon 2014-11-17 1216 SZ_4K | SZ_2M | SZ_1G, fe4b991dcd84e0 Will Deacon 2014-11-17 1217 SZ_16K | SZ_32M, fe4b991dcd84e0 Will Deacon 2014-11-17 1218 SZ_64K | SZ_512M, fe4b991dcd84e0 Will Deacon 2014-11-17 1219 }; fe4b991dcd84e0 Will Deacon 2014-11-17 1220 9062c1d0bedacf Christophe JAILLET 2019-09-09 @1221 static const unsigned int ias[] __initconst = { :::::: The code at line 1186 was first introduced by commit :::::: fe4b991dcd84e0104cf2e29223a819335ed048a7 iommu: add self-consistency tests to ARM LPAE IO page table allocator :::::: TO: Will Deacon <[email protected]> :::::: CC: Will Deacon <[email protected]> --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/[email protected] _______________________________________________ kbuild mailing list -- [email protected] To unsubscribe send an email to [email protected]
