* Re: [PATCH 2/2] iommu: Add gfp parameter to io_pgtable_ops->map()
@ 2020-06-08 7:16 kernel test robot
0 siblings, 0 replies; 12+ messages in thread
From: kernel test robot @ 2020-06-08 7:16 UTC (permalink / raw)
To: kbuild
[-- Attachment #1: Type: text/plain, Size: 10345 bytes --]
CC: kbuild-all(a)lists.01.org
In-Reply-To: <837d7131e83b06ce222bda678fe2e8ac7ba095f2.1591587029.git.baolin.wang@linux.alibaba.com>
References: <837d7131e83b06ce222bda678fe2e8ac7ba095f2.1591587029.git.baolin.wang@linux.alibaba.com>
TO: Baolin Wang <baolin.wang@linux.alibaba.com>
TO: joro(a)8bytes.org
TO: will(a)kernel.org
TO: robin.murphy(a)arm.com
TO: agross(a)kernel.org
TO: bjorn.andersson(a)linaro.org
TO: matthias.bgg(a)gmail.com
TO: robdclark(a)gmail.com
TO: robh(a)kernel.org
TO: tomeu.vizoso(a)collabora.com
TO: steven.price(a)arm.com
Hi Baolin,
I love your patch! Perhaps something to improve:
[auto build test WARNING on iommu/next]
[also build test WARNING on soc/for-next linus/master v5.7 next-20200605]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]
url: https://github.com/0day-ci/linux/commits/Baolin-Wang/Some-improvements-for-iommu/20200608-114141
base: https://git.kernel.org/pub/scm/linux/kernel/git/joro/iommu.git next
:::::: branch date: 4 hours ago
:::::: commit date: 4 hours ago
config: x86_64-randconfig-s021-20200607 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-13) 9.3.0
reproduce:
# apt-get install sparse
# sparse version: v0.6.1-247-gcadbd124-dirty
# save the attached .config to linux build tree
make W=1 C=1 ARCH=x86_64 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__'
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
sparse warnings: (new ones prefixed by >>)
>> drivers/iommu/io-pgtable-arm.c:1178:37: sparse: sparse: not enough arguments for function map
drivers/iommu/io-pgtable-arm.c:1185:38: sparse: sparse: not enough arguments for function map
drivers/iommu/io-pgtable-arm.c:1201:29: sparse: sparse: not enough arguments for function map
drivers/iommu/io-pgtable-arm.c:1219:37: sparse: sparse: not enough arguments for function map
# https://github.com/0day-ci/linux/commit/6047fa5558b1fdb8d2d52c9807fd960220478d3d
git remote add linux-review https://github.com/0day-ci/linux
git remote update linux-review
git checkout 6047fa5558b1fdb8d2d52c9807fd960220478d3d
vim +1178 drivers/iommu/io-pgtable-arm.c
fe4b991dcd84e0 Will Deacon 2014-11-17 1135
fe4b991dcd84e0 Will Deacon 2014-11-17 1136 static int __init arm_lpae_run_tests(struct io_pgtable_cfg *cfg)
fe4b991dcd84e0 Will Deacon 2014-11-17 1137 {
9062c1d0bedacf Christophe JAILLET 2019-09-09 1138 static const enum io_pgtable_fmt fmts[] __initconst = {
fe4b991dcd84e0 Will Deacon 2014-11-17 1139 ARM_64_LPAE_S1,
fe4b991dcd84e0 Will Deacon 2014-11-17 1140 ARM_64_LPAE_S2,
fe4b991dcd84e0 Will Deacon 2014-11-17 1141 };
fe4b991dcd84e0 Will Deacon 2014-11-17 1142
fe4b991dcd84e0 Will Deacon 2014-11-17 1143 int i, j;
fe4b991dcd84e0 Will Deacon 2014-11-17 1144 unsigned long iova;
fe4b991dcd84e0 Will Deacon 2014-11-17 1145 size_t size;
fe4b991dcd84e0 Will Deacon 2014-11-17 1146 struct io_pgtable_ops *ops;
fe4b991dcd84e0 Will Deacon 2014-11-17 1147
fe4b991dcd84e0 Will Deacon 2014-11-17 1148 selftest_running = true;
fe4b991dcd84e0 Will Deacon 2014-11-17 1149
fe4b991dcd84e0 Will Deacon 2014-11-17 1150 for (i = 0; i < ARRAY_SIZE(fmts); ++i) {
fe4b991dcd84e0 Will Deacon 2014-11-17 1151 cfg_cookie = cfg;
fe4b991dcd84e0 Will Deacon 2014-11-17 1152 ops = alloc_io_pgtable_ops(fmts[i], cfg, cfg);
fe4b991dcd84e0 Will Deacon 2014-11-17 1153 if (!ops) {
fe4b991dcd84e0 Will Deacon 2014-11-17 1154 pr_err("selftest: failed to allocate io pgtable ops\n");
fe4b991dcd84e0 Will Deacon 2014-11-17 1155 return -ENOMEM;
fe4b991dcd84e0 Will Deacon 2014-11-17 1156 }
fe4b991dcd84e0 Will Deacon 2014-11-17 1157
fe4b991dcd84e0 Will Deacon 2014-11-17 1158 /*
fe4b991dcd84e0 Will Deacon 2014-11-17 1159 * Initial sanity checks.
fe4b991dcd84e0 Will Deacon 2014-11-17 1160 * Empty page tables shouldn't provide any translations.
fe4b991dcd84e0 Will Deacon 2014-11-17 1161 */
fe4b991dcd84e0 Will Deacon 2014-11-17 1162 if (ops->iova_to_phys(ops, 42))
fe4b991dcd84e0 Will Deacon 2014-11-17 1163 return __FAIL(ops, i);
fe4b991dcd84e0 Will Deacon 2014-11-17 1164
fe4b991dcd84e0 Will Deacon 2014-11-17 1165 if (ops->iova_to_phys(ops, SZ_1G + 42))
fe4b991dcd84e0 Will Deacon 2014-11-17 1166 return __FAIL(ops, i);
fe4b991dcd84e0 Will Deacon 2014-11-17 1167
fe4b991dcd84e0 Will Deacon 2014-11-17 1168 if (ops->iova_to_phys(ops, SZ_2G + 42))
fe4b991dcd84e0 Will Deacon 2014-11-17 1169 return __FAIL(ops, i);
fe4b991dcd84e0 Will Deacon 2014-11-17 1170
fe4b991dcd84e0 Will Deacon 2014-11-17 1171 /*
fe4b991dcd84e0 Will Deacon 2014-11-17 1172 * Distinct mappings of different granule sizes.
fe4b991dcd84e0 Will Deacon 2014-11-17 1173 */
fe4b991dcd84e0 Will Deacon 2014-11-17 1174 iova = 0;
4ae8a5c528c0b1 Kefeng Wang 2016-09-21 1175 for_each_set_bit(j, &cfg->pgsize_bitmap, BITS_PER_LONG) {
fe4b991dcd84e0 Will Deacon 2014-11-17 1176 size = 1UL << j;
fe4b991dcd84e0 Will Deacon 2014-11-17 1177
fe4b991dcd84e0 Will Deacon 2014-11-17 @1178 if (ops->map(ops, iova, iova, size, IOMMU_READ |
fe4b991dcd84e0 Will Deacon 2014-11-17 1179 IOMMU_WRITE |
fe4b991dcd84e0 Will Deacon 2014-11-17 1180 IOMMU_NOEXEC |
fe4b991dcd84e0 Will Deacon 2014-11-17 1181 IOMMU_CACHE))
fe4b991dcd84e0 Will Deacon 2014-11-17 1182 return __FAIL(ops, i);
fe4b991dcd84e0 Will Deacon 2014-11-17 1183
fe4b991dcd84e0 Will Deacon 2014-11-17 1184 /* Overlapping mappings */
fe4b991dcd84e0 Will Deacon 2014-11-17 1185 if (!ops->map(ops, iova, iova + size, size,
fe4b991dcd84e0 Will Deacon 2014-11-17 1186 IOMMU_READ | IOMMU_NOEXEC))
fe4b991dcd84e0 Will Deacon 2014-11-17 1187 return __FAIL(ops, i);
fe4b991dcd84e0 Will Deacon 2014-11-17 1188
fe4b991dcd84e0 Will Deacon 2014-11-17 1189 if (ops->iova_to_phys(ops, iova + 42) != (iova + 42))
fe4b991dcd84e0 Will Deacon 2014-11-17 1190 return __FAIL(ops, i);
fe4b991dcd84e0 Will Deacon 2014-11-17 1191
fe4b991dcd84e0 Will Deacon 2014-11-17 1192 iova += SZ_1G;
fe4b991dcd84e0 Will Deacon 2014-11-17 1193 }
fe4b991dcd84e0 Will Deacon 2014-11-17 1194
fe4b991dcd84e0 Will Deacon 2014-11-17 1195 /* Partial unmap */
fe4b991dcd84e0 Will Deacon 2014-11-17 1196 size = 1UL << __ffs(cfg->pgsize_bitmap);
a2d3a382d6c682 Will Deacon 2019-07-02 1197 if (ops->unmap(ops, SZ_1G + size, size, NULL) != size)
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 /* Remap of partial unmap */
fe4b991dcd84e0 Will Deacon 2014-11-17 1201 if (ops->map(ops, SZ_1G + size, size, size, IOMMU_READ))
fe4b991dcd84e0 Will Deacon 2014-11-17 1202 return __FAIL(ops, i);
fe4b991dcd84e0 Will Deacon 2014-11-17 1203
fe4b991dcd84e0 Will Deacon 2014-11-17 1204 if (ops->iova_to_phys(ops, SZ_1G + size + 42) != (size + 42))
fe4b991dcd84e0 Will Deacon 2014-11-17 1205 return __FAIL(ops, i);
fe4b991dcd84e0 Will Deacon 2014-11-17 1206
fe4b991dcd84e0 Will Deacon 2014-11-17 1207 /* Full unmap */
fe4b991dcd84e0 Will Deacon 2014-11-17 1208 iova = 0;
f793b13ef0c9c1 YueHaibing 2018-04-26 1209 for_each_set_bit(j, &cfg->pgsize_bitmap, BITS_PER_LONG) {
fe4b991dcd84e0 Will Deacon 2014-11-17 1210 size = 1UL << j;
fe4b991dcd84e0 Will Deacon 2014-11-17 1211
a2d3a382d6c682 Will Deacon 2019-07-02 1212 if (ops->unmap(ops, iova, size, NULL) != size)
fe4b991dcd84e0 Will Deacon 2014-11-17 1213 return __FAIL(ops, i);
fe4b991dcd84e0 Will Deacon 2014-11-17 1214
fe4b991dcd84e0 Will Deacon 2014-11-17 1215 if (ops->iova_to_phys(ops, iova + 42))
fe4b991dcd84e0 Will Deacon 2014-11-17 1216 return __FAIL(ops, i);
fe4b991dcd84e0 Will Deacon 2014-11-17 1217
fe4b991dcd84e0 Will Deacon 2014-11-17 1218 /* Remap full block */
fe4b991dcd84e0 Will Deacon 2014-11-17 1219 if (ops->map(ops, iova, iova, size, IOMMU_WRITE))
fe4b991dcd84e0 Will Deacon 2014-11-17 1220 return __FAIL(ops, i);
fe4b991dcd84e0 Will Deacon 2014-11-17 1221
fe4b991dcd84e0 Will Deacon 2014-11-17 1222 if (ops->iova_to_phys(ops, iova + 42) != (iova + 42))
fe4b991dcd84e0 Will Deacon 2014-11-17 1223 return __FAIL(ops, i);
fe4b991dcd84e0 Will Deacon 2014-11-17 1224
fe4b991dcd84e0 Will Deacon 2014-11-17 1225 iova += SZ_1G;
fe4b991dcd84e0 Will Deacon 2014-11-17 1226 }
fe4b991dcd84e0 Will Deacon 2014-11-17 1227
fe4b991dcd84e0 Will Deacon 2014-11-17 1228 free_io_pgtable_ops(ops);
fe4b991dcd84e0 Will Deacon 2014-11-17 1229 }
fe4b991dcd84e0 Will Deacon 2014-11-17 1230
fe4b991dcd84e0 Will Deacon 2014-11-17 1231 selftest_running = false;
fe4b991dcd84e0 Will Deacon 2014-11-17 1232 return 0;
fe4b991dcd84e0 Will Deacon 2014-11-17 1233 }
fe4b991dcd84e0 Will Deacon 2014-11-17 1234
:::::: The code at line 1178 was first introduced by commit
:::::: fe4b991dcd84e0104cf2e29223a819335ed048a7 iommu: add self-consistency tests to ARM LPAE IO page table allocator
:::::: TO: Will Deacon <will.deacon@arm.com>
:::::: CC: Will Deacon <will.deacon@arm.com>
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 49045 bytes --]
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 2/2] iommu: Add gfp parameter to io_pgtable_ops->map()
2020-06-08 3:38 ` Baolin Wang
` (6 preceding siblings ...)
(?)
@ 2020-06-08 21:07 ` kernel test robot
-1 siblings, 0 replies; 12+ messages in thread
From: kernel test robot @ 2020-06-08 21:07 UTC (permalink / raw)
To: kbuild-all
[-- Attachment #1: Type: text/plain, Size: 9994 bytes --]
Hi Baolin,
I love your patch! Yet something to improve:
[auto build test ERROR on iommu/next]
[also build test ERROR on soc/for-next linus/master v5.7 next-20200605]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]
url: https://github.com/0day-ci/linux/commits/Baolin-Wang/Some-improvements-for-iommu/20200608-114141
base: https://git.kernel.org/pub/scm/linux/kernel/git/joro/iommu.git next
config: arm-allyesconfig (attached as .config)
compiler: arm-linux-gnueabi-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
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=arm
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
All errors (new ones prefixed by >>, old ones prefixed by <<):
drivers/iommu/io-pgtable-arm.c: In function 'arm_lpae_run_tests':
>> drivers/iommu/io-pgtable-arm.c:1178:8: error: too few arguments to function 'ops->map'
1178 | if (ops->map(ops, iova, iova, size, IOMMU_READ |
| ^~~
drivers/iommu/io-pgtable-arm.c:1185:9: error: too few arguments to function 'ops->map'
1185 | if (!ops->map(ops, iova, iova + size, size,
| ^~~
drivers/iommu/io-pgtable-arm.c:1201:7: error: too few arguments to function 'ops->map'
1201 | if (ops->map(ops, SZ_1G + size, size, size, IOMMU_READ))
| ^~~
drivers/iommu/io-pgtable-arm.c:1219:8: error: too few arguments to function 'ops->map'
1219 | if (ops->map(ops, iova, iova, size, IOMMU_WRITE))
| ^~~
vim +1178 drivers/iommu/io-pgtable-arm.c
fe4b991dcd84e01 Will Deacon 2014-11-17 1135
fe4b991dcd84e01 Will Deacon 2014-11-17 1136 static int __init arm_lpae_run_tests(struct io_pgtable_cfg *cfg)
fe4b991dcd84e01 Will Deacon 2014-11-17 1137 {
9062c1d0bedacf6 Christophe JAILLET 2019-09-09 1138 static const enum io_pgtable_fmt fmts[] __initconst = {
fe4b991dcd84e01 Will Deacon 2014-11-17 1139 ARM_64_LPAE_S1,
fe4b991dcd84e01 Will Deacon 2014-11-17 1140 ARM_64_LPAE_S2,
fe4b991dcd84e01 Will Deacon 2014-11-17 1141 };
fe4b991dcd84e01 Will Deacon 2014-11-17 1142
fe4b991dcd84e01 Will Deacon 2014-11-17 1143 int i, j;
fe4b991dcd84e01 Will Deacon 2014-11-17 1144 unsigned long iova;
fe4b991dcd84e01 Will Deacon 2014-11-17 1145 size_t size;
fe4b991dcd84e01 Will Deacon 2014-11-17 1146 struct io_pgtable_ops *ops;
fe4b991dcd84e01 Will Deacon 2014-11-17 1147
fe4b991dcd84e01 Will Deacon 2014-11-17 1148 selftest_running = true;
fe4b991dcd84e01 Will Deacon 2014-11-17 1149
fe4b991dcd84e01 Will Deacon 2014-11-17 1150 for (i = 0; i < ARRAY_SIZE(fmts); ++i) {
fe4b991dcd84e01 Will Deacon 2014-11-17 1151 cfg_cookie = cfg;
fe4b991dcd84e01 Will Deacon 2014-11-17 1152 ops = alloc_io_pgtable_ops(fmts[i], cfg, cfg);
fe4b991dcd84e01 Will Deacon 2014-11-17 1153 if (!ops) {
fe4b991dcd84e01 Will Deacon 2014-11-17 1154 pr_err("selftest: failed to allocate io pgtable ops\n");
fe4b991dcd84e01 Will Deacon 2014-11-17 1155 return -ENOMEM;
fe4b991dcd84e01 Will Deacon 2014-11-17 1156 }
fe4b991dcd84e01 Will Deacon 2014-11-17 1157
fe4b991dcd84e01 Will Deacon 2014-11-17 1158 /*
fe4b991dcd84e01 Will Deacon 2014-11-17 1159 * Initial sanity checks.
fe4b991dcd84e01 Will Deacon 2014-11-17 1160 * Empty page tables shouldn't provide any translations.
fe4b991dcd84e01 Will Deacon 2014-11-17 1161 */
fe4b991dcd84e01 Will Deacon 2014-11-17 1162 if (ops->iova_to_phys(ops, 42))
fe4b991dcd84e01 Will Deacon 2014-11-17 1163 return __FAIL(ops, i);
fe4b991dcd84e01 Will Deacon 2014-11-17 1164
fe4b991dcd84e01 Will Deacon 2014-11-17 1165 if (ops->iova_to_phys(ops, SZ_1G + 42))
fe4b991dcd84e01 Will Deacon 2014-11-17 1166 return __FAIL(ops, i);
fe4b991dcd84e01 Will Deacon 2014-11-17 1167
fe4b991dcd84e01 Will Deacon 2014-11-17 1168 if (ops->iova_to_phys(ops, SZ_2G + 42))
fe4b991dcd84e01 Will Deacon 2014-11-17 1169 return __FAIL(ops, i);
fe4b991dcd84e01 Will Deacon 2014-11-17 1170
fe4b991dcd84e01 Will Deacon 2014-11-17 1171 /*
fe4b991dcd84e01 Will Deacon 2014-11-17 1172 * Distinct mappings of different granule sizes.
fe4b991dcd84e01 Will Deacon 2014-11-17 1173 */
fe4b991dcd84e01 Will Deacon 2014-11-17 1174 iova = 0;
4ae8a5c528c0b1e Kefeng Wang 2016-09-21 1175 for_each_set_bit(j, &cfg->pgsize_bitmap, BITS_PER_LONG) {
fe4b991dcd84e01 Will Deacon 2014-11-17 1176 size = 1UL << j;
fe4b991dcd84e01 Will Deacon 2014-11-17 1177
fe4b991dcd84e01 Will Deacon 2014-11-17 @1178 if (ops->map(ops, iova, iova, size, IOMMU_READ |
fe4b991dcd84e01 Will Deacon 2014-11-17 1179 IOMMU_WRITE |
fe4b991dcd84e01 Will Deacon 2014-11-17 1180 IOMMU_NOEXEC |
fe4b991dcd84e01 Will Deacon 2014-11-17 1181 IOMMU_CACHE))
fe4b991dcd84e01 Will Deacon 2014-11-17 1182 return __FAIL(ops, i);
fe4b991dcd84e01 Will Deacon 2014-11-17 1183
fe4b991dcd84e01 Will Deacon 2014-11-17 1184 /* Overlapping mappings */
fe4b991dcd84e01 Will Deacon 2014-11-17 1185 if (!ops->map(ops, iova, iova + size, size,
fe4b991dcd84e01 Will Deacon 2014-11-17 1186 IOMMU_READ | IOMMU_NOEXEC))
fe4b991dcd84e01 Will Deacon 2014-11-17 1187 return __FAIL(ops, i);
fe4b991dcd84e01 Will Deacon 2014-11-17 1188
fe4b991dcd84e01 Will Deacon 2014-11-17 1189 if (ops->iova_to_phys(ops, iova + 42) != (iova + 42))
fe4b991dcd84e01 Will Deacon 2014-11-17 1190 return __FAIL(ops, i);
fe4b991dcd84e01 Will Deacon 2014-11-17 1191
fe4b991dcd84e01 Will Deacon 2014-11-17 1192 iova += SZ_1G;
fe4b991dcd84e01 Will Deacon 2014-11-17 1193 }
fe4b991dcd84e01 Will Deacon 2014-11-17 1194
fe4b991dcd84e01 Will Deacon 2014-11-17 1195 /* Partial unmap */
fe4b991dcd84e01 Will Deacon 2014-11-17 1196 size = 1UL << __ffs(cfg->pgsize_bitmap);
a2d3a382d6c682e Will Deacon 2019-07-02 1197 if (ops->unmap(ops, SZ_1G + size, size, NULL) != size)
fe4b991dcd84e01 Will Deacon 2014-11-17 1198 return __FAIL(ops, i);
fe4b991dcd84e01 Will Deacon 2014-11-17 1199
fe4b991dcd84e01 Will Deacon 2014-11-17 1200 /* Remap of partial unmap */
fe4b991dcd84e01 Will Deacon 2014-11-17 1201 if (ops->map(ops, SZ_1G + size, size, size, IOMMU_READ))
fe4b991dcd84e01 Will Deacon 2014-11-17 1202 return __FAIL(ops, i);
fe4b991dcd84e01 Will Deacon 2014-11-17 1203
fe4b991dcd84e01 Will Deacon 2014-11-17 1204 if (ops->iova_to_phys(ops, SZ_1G + size + 42) != (size + 42))
fe4b991dcd84e01 Will Deacon 2014-11-17 1205 return __FAIL(ops, i);
fe4b991dcd84e01 Will Deacon 2014-11-17 1206
fe4b991dcd84e01 Will Deacon 2014-11-17 1207 /* Full unmap */
fe4b991dcd84e01 Will Deacon 2014-11-17 1208 iova = 0;
f793b13ef0c9c11 YueHaibing 2018-04-26 1209 for_each_set_bit(j, &cfg->pgsize_bitmap, BITS_PER_LONG) {
fe4b991dcd84e01 Will Deacon 2014-11-17 1210 size = 1UL << j;
fe4b991dcd84e01 Will Deacon 2014-11-17 1211
a2d3a382d6c682e Will Deacon 2019-07-02 1212 if (ops->unmap(ops, iova, size, NULL) != size)
fe4b991dcd84e01 Will Deacon 2014-11-17 1213 return __FAIL(ops, i);
fe4b991dcd84e01 Will Deacon 2014-11-17 1214
fe4b991dcd84e01 Will Deacon 2014-11-17 1215 if (ops->iova_to_phys(ops, iova + 42))
fe4b991dcd84e01 Will Deacon 2014-11-17 1216 return __FAIL(ops, i);
fe4b991dcd84e01 Will Deacon 2014-11-17 1217
fe4b991dcd84e01 Will Deacon 2014-11-17 1218 /* Remap full block */
fe4b991dcd84e01 Will Deacon 2014-11-17 1219 if (ops->map(ops, iova, iova, size, IOMMU_WRITE))
fe4b991dcd84e01 Will Deacon 2014-11-17 1220 return __FAIL(ops, i);
fe4b991dcd84e01 Will Deacon 2014-11-17 1221
fe4b991dcd84e01 Will Deacon 2014-11-17 1222 if (ops->iova_to_phys(ops, iova + 42) != (iova + 42))
fe4b991dcd84e01 Will Deacon 2014-11-17 1223 return __FAIL(ops, i);
fe4b991dcd84e01 Will Deacon 2014-11-17 1224
fe4b991dcd84e01 Will Deacon 2014-11-17 1225 iova += SZ_1G;
fe4b991dcd84e01 Will Deacon 2014-11-17 1226 }
fe4b991dcd84e01 Will Deacon 2014-11-17 1227
fe4b991dcd84e01 Will Deacon 2014-11-17 1228 free_io_pgtable_ops(ops);
fe4b991dcd84e01 Will Deacon 2014-11-17 1229 }
fe4b991dcd84e01 Will Deacon 2014-11-17 1230
fe4b991dcd84e01 Will Deacon 2014-11-17 1231 selftest_running = false;
fe4b991dcd84e01 Will Deacon 2014-11-17 1232 return 0;
fe4b991dcd84e01 Will Deacon 2014-11-17 1233 }
fe4b991dcd84e01 Will Deacon 2014-11-17 1234
:::::: The code at line 1178 was first introduced by commit
:::::: fe4b991dcd84e0104cf2e29223a819335ed048a7 iommu: add self-consistency tests to ARM LPAE IO page table allocator
:::::: TO: Will Deacon <will.deacon@arm.com>
:::::: CC: Will Deacon <will.deacon@arm.com>
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 73993 bytes --]
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 2/2] iommu: Add gfp parameter to io_pgtable_ops->map()
2020-06-08 3:38 ` Baolin Wang
` (5 preceding siblings ...)
(?)
@ 2020-06-08 15:36 ` kernel test robot
-1 siblings, 0 replies; 12+ messages in thread
From: kernel test robot @ 2020-06-08 15:36 UTC (permalink / raw)
To: kbuild-all
[-- Attachment #1: Type: text/plain, Size: 6511 bytes --]
Hi Baolin,
I love your patch! Yet something to improve:
[auto build test ERROR on iommu/next]
[also build test ERROR on soc/for-next linus/master v5.7 next-20200605]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]
url: https://github.com/0day-ci/linux/commits/Baolin-Wang/Some-improvements-for-iommu/20200608-114141
base: https://git.kernel.org/pub/scm/linux/kernel/git/joro/iommu.git next
config: x86_64-allyesconfig (attached as .config)
compiler: clang version 11.0.0 (https://github.com/llvm/llvm-project e429cffd4f228f70c1d9df0e5d77c08590dd9766)
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
# install x86_64 cross compiling tool for clang build
# apt-get install binutils-x86-64-linux-gnu
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
All errors (new ones prefixed by >>, old ones prefixed by <<):
>> drivers/iommu/io-pgtable-arm-v7s.c:925:22: error: too few arguments to function call, expected 6, have 5
IOMMU_CACHE))
^
drivers/iommu/io-pgtable-arm-v7s.c:930:35: error: too few arguments to function call, expected 6, have 5
IOMMU_READ | IOMMU_NOEXEC))
^
drivers/iommu/io-pgtable-arm-v7s.c:949:62: error: too few arguments to function call, expected 6, have 5
if (ops->map(ops, iova_start + size, size, size, IOMMU_READ))
~~~~~~~~ ^
drivers/iommu/io-pgtable-arm-v7s.c:970:50: error: too few arguments to function call, expected 6, have 5
if (ops->map(ops, iova, iova, size, IOMMU_WRITE))
~~~~~~~~ ^
4 errors generated.
--
>> drivers/iommu/io-pgtable-arm.c:1181:23: error: too few arguments to function call, expected 6, have 5
IOMMU_CACHE))
^
drivers/iommu/io-pgtable-arm.c:1186:36: error: too few arguments to function call, expected 6, have 5
IOMMU_READ | IOMMU_NOEXEC))
^
drivers/iommu/io-pgtable-arm.c:1201:57: error: too few arguments to function call, expected 6, have 5
if (ops->map(ops, SZ_1G + size, size, size, IOMMU_READ))
~~~~~~~~ ^
drivers/iommu/io-pgtable-arm.c:1219:51: error: too few arguments to function call, expected 6, have 5
if (ops->map(ops, iova, iova, size, IOMMU_WRITE))
~~~~~~~~ ^
4 errors generated.
vim +925 drivers/iommu/io-pgtable-arm-v7s.c
e5fc9753b1a831 Robin Murphy 2016-01-26 878
e5fc9753b1a831 Robin Murphy 2016-01-26 879 static int __init arm_v7s_do_selftests(void)
e5fc9753b1a831 Robin Murphy 2016-01-26 880 {
e5fc9753b1a831 Robin Murphy 2016-01-26 881 struct io_pgtable_ops *ops;
e5fc9753b1a831 Robin Murphy 2016-01-26 882 struct io_pgtable_cfg cfg = {
e5fc9753b1a831 Robin Murphy 2016-01-26 883 .tlb = &dummy_tlb_ops,
e5fc9753b1a831 Robin Murphy 2016-01-26 884 .oas = 32,
e5fc9753b1a831 Robin Murphy 2016-01-26 885 .ias = 32,
4f41845b340783 Will Deacon 2019-06-25 886 .coherent_walk = true,
4f41845b340783 Will Deacon 2019-06-25 887 .quirks = IO_PGTABLE_QUIRK_ARM_NS,
e5fc9753b1a831 Robin Murphy 2016-01-26 888 .pgsize_bitmap = SZ_4K | SZ_64K | SZ_1M | SZ_16M,
e5fc9753b1a831 Robin Murphy 2016-01-26 889 };
e5fc9753b1a831 Robin Murphy 2016-01-26 890 unsigned int iova, size, iova_start;
e5fc9753b1a831 Robin Murphy 2016-01-26 891 unsigned int i, loopnr = 0;
e5fc9753b1a831 Robin Murphy 2016-01-26 892
e5fc9753b1a831 Robin Murphy 2016-01-26 893 selftest_running = true;
e5fc9753b1a831 Robin Murphy 2016-01-26 894
e5fc9753b1a831 Robin Murphy 2016-01-26 895 cfg_cookie = &cfg;
e5fc9753b1a831 Robin Murphy 2016-01-26 896
e5fc9753b1a831 Robin Murphy 2016-01-26 897 ops = alloc_io_pgtable_ops(ARM_V7S, &cfg, &cfg);
e5fc9753b1a831 Robin Murphy 2016-01-26 898 if (!ops) {
e5fc9753b1a831 Robin Murphy 2016-01-26 899 pr_err("selftest: failed to allocate io pgtable ops\n");
e5fc9753b1a831 Robin Murphy 2016-01-26 900 return -EINVAL;
e5fc9753b1a831 Robin Murphy 2016-01-26 901 }
e5fc9753b1a831 Robin Murphy 2016-01-26 902
e5fc9753b1a831 Robin Murphy 2016-01-26 903 /*
e5fc9753b1a831 Robin Murphy 2016-01-26 904 * Initial sanity checks.
e5fc9753b1a831 Robin Murphy 2016-01-26 905 * Empty page tables shouldn't provide any translations.
e5fc9753b1a831 Robin Murphy 2016-01-26 906 */
e5fc9753b1a831 Robin Murphy 2016-01-26 907 if (ops->iova_to_phys(ops, 42))
e5fc9753b1a831 Robin Murphy 2016-01-26 908 return __FAIL(ops);
e5fc9753b1a831 Robin Murphy 2016-01-26 909
e5fc9753b1a831 Robin Murphy 2016-01-26 910 if (ops->iova_to_phys(ops, SZ_1G + 42))
e5fc9753b1a831 Robin Murphy 2016-01-26 911 return __FAIL(ops);
e5fc9753b1a831 Robin Murphy 2016-01-26 912
e5fc9753b1a831 Robin Murphy 2016-01-26 913 if (ops->iova_to_phys(ops, SZ_2G + 42))
e5fc9753b1a831 Robin Murphy 2016-01-26 914 return __FAIL(ops);
e5fc9753b1a831 Robin Murphy 2016-01-26 915
e5fc9753b1a831 Robin Murphy 2016-01-26 916 /*
e5fc9753b1a831 Robin Murphy 2016-01-26 917 * Distinct mappings of different granule sizes.
e5fc9753b1a831 Robin Murphy 2016-01-26 918 */
e5fc9753b1a831 Robin Murphy 2016-01-26 919 iova = 0;
4ae8a5c528c0b1 Kefeng Wang 2016-09-21 920 for_each_set_bit(i, &cfg.pgsize_bitmap, BITS_PER_LONG) {
e5fc9753b1a831 Robin Murphy 2016-01-26 921 size = 1UL << i;
e5fc9753b1a831 Robin Murphy 2016-01-26 922 if (ops->map(ops, iova, iova, size, IOMMU_READ |
e5fc9753b1a831 Robin Murphy 2016-01-26 923 IOMMU_WRITE |
e5fc9753b1a831 Robin Murphy 2016-01-26 924 IOMMU_NOEXEC |
e5fc9753b1a831 Robin Murphy 2016-01-26 @925 IOMMU_CACHE))
:::::: The code at line 925 was first introduced by commit
:::::: e5fc9753b1a831466be9b45d0bf926eeaa8b84a0 iommu/io-pgtable: Add ARMv7 short descriptor support
:::::: TO: Robin Murphy <robin.murphy@arm.com>
:::::: CC: Will Deacon <will.deacon@arm.com>
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 73530 bytes --]
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 2/2] iommu: Add gfp parameter to io_pgtable_ops->map()
2020-06-08 3:38 ` Baolin Wang
` (4 preceding siblings ...)
(?)
@ 2020-06-08 15:17 ` kernel test robot
-1 siblings, 0 replies; 12+ messages in thread
From: kernel test robot @ 2020-06-08 15:17 UTC (permalink / raw)
To: kbuild-all
[-- Attachment #1: Type: text/plain, Size: 5321 bytes --]
Hi Baolin,
I love your patch! Perhaps something to improve:
[auto build test WARNING on iommu/next]
[also build test WARNING on soc/for-next linus/master v5.7 next-20200605]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]
url: https://github.com/0day-ci/linux/commits/Baolin-Wang/Some-improvements-for-iommu/20200608-114141
base: https://git.kernel.org/pub/scm/linux/kernel/git/joro/iommu.git next
:::::: branch date: 4 hours ago
:::::: commit date: 4 hours ago
config: i386-randconfig-s001-20200608 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-13) 9.3.0
reproduce:
# apt-get install sparse
# sparse version: v0.6.1-247-gcadbd124-dirty
# save the attached .config to linux build tree
make W=1 C=1 ARCH=i386 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__'
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
sparse warnings: (new ones prefixed by >>)
>> drivers/iommu/io-pgtable-arm-v7s.c:922:29: sparse: sparse: not enough arguments for function map
drivers/iommu/io-pgtable-arm-v7s.c:929:30: sparse: sparse: not enough arguments for function map
drivers/iommu/io-pgtable-arm-v7s.c:949:29: sparse: sparse: not enough arguments for function map
drivers/iommu/io-pgtable-arm-v7s.c:970:29: sparse: sparse: not enough arguments for function map
# https://github.com/0day-ci/linux/commit/6047fa5558b1fdb8d2d52c9807fd960220478d3d
git remote add linux-review https://github.com/0day-ci/linux
git remote update linux-review
git checkout 6047fa5558b1fdb8d2d52c9807fd960220478d3d
vim +922 drivers/iommu/io-pgtable-arm-v7s.c
e5fc9753b1a831 Robin Murphy 2016-01-26 878
e5fc9753b1a831 Robin Murphy 2016-01-26 879 static int __init arm_v7s_do_selftests(void)
e5fc9753b1a831 Robin Murphy 2016-01-26 880 {
e5fc9753b1a831 Robin Murphy 2016-01-26 881 struct io_pgtable_ops *ops;
e5fc9753b1a831 Robin Murphy 2016-01-26 882 struct io_pgtable_cfg cfg = {
e5fc9753b1a831 Robin Murphy 2016-01-26 883 .tlb = &dummy_tlb_ops,
e5fc9753b1a831 Robin Murphy 2016-01-26 884 .oas = 32,
e5fc9753b1a831 Robin Murphy 2016-01-26 885 .ias = 32,
4f41845b340783 Will Deacon 2019-06-25 886 .coherent_walk = true,
4f41845b340783 Will Deacon 2019-06-25 887 .quirks = IO_PGTABLE_QUIRK_ARM_NS,
e5fc9753b1a831 Robin Murphy 2016-01-26 888 .pgsize_bitmap = SZ_4K | SZ_64K | SZ_1M | SZ_16M,
e5fc9753b1a831 Robin Murphy 2016-01-26 889 };
e5fc9753b1a831 Robin Murphy 2016-01-26 890 unsigned int iova, size, iova_start;
e5fc9753b1a831 Robin Murphy 2016-01-26 891 unsigned int i, loopnr = 0;
e5fc9753b1a831 Robin Murphy 2016-01-26 892
e5fc9753b1a831 Robin Murphy 2016-01-26 893 selftest_running = true;
e5fc9753b1a831 Robin Murphy 2016-01-26 894
e5fc9753b1a831 Robin Murphy 2016-01-26 895 cfg_cookie = &cfg;
e5fc9753b1a831 Robin Murphy 2016-01-26 896
e5fc9753b1a831 Robin Murphy 2016-01-26 897 ops = alloc_io_pgtable_ops(ARM_V7S, &cfg, &cfg);
e5fc9753b1a831 Robin Murphy 2016-01-26 898 if (!ops) {
e5fc9753b1a831 Robin Murphy 2016-01-26 899 pr_err("selftest: failed to allocate io pgtable ops\n");
e5fc9753b1a831 Robin Murphy 2016-01-26 900 return -EINVAL;
e5fc9753b1a831 Robin Murphy 2016-01-26 901 }
e5fc9753b1a831 Robin Murphy 2016-01-26 902
e5fc9753b1a831 Robin Murphy 2016-01-26 903 /*
e5fc9753b1a831 Robin Murphy 2016-01-26 904 * Initial sanity checks.
e5fc9753b1a831 Robin Murphy 2016-01-26 905 * Empty page tables shouldn't provide any translations.
e5fc9753b1a831 Robin Murphy 2016-01-26 906 */
e5fc9753b1a831 Robin Murphy 2016-01-26 907 if (ops->iova_to_phys(ops, 42))
e5fc9753b1a831 Robin Murphy 2016-01-26 908 return __FAIL(ops);
e5fc9753b1a831 Robin Murphy 2016-01-26 909
e5fc9753b1a831 Robin Murphy 2016-01-26 910 if (ops->iova_to_phys(ops, SZ_1G + 42))
e5fc9753b1a831 Robin Murphy 2016-01-26 911 return __FAIL(ops);
e5fc9753b1a831 Robin Murphy 2016-01-26 912
e5fc9753b1a831 Robin Murphy 2016-01-26 913 if (ops->iova_to_phys(ops, SZ_2G + 42))
e5fc9753b1a831 Robin Murphy 2016-01-26 914 return __FAIL(ops);
e5fc9753b1a831 Robin Murphy 2016-01-26 915
e5fc9753b1a831 Robin Murphy 2016-01-26 916 /*
e5fc9753b1a831 Robin Murphy 2016-01-26 917 * Distinct mappings of different granule sizes.
e5fc9753b1a831 Robin Murphy 2016-01-26 918 */
e5fc9753b1a831 Robin Murphy 2016-01-26 919 iova = 0;
4ae8a5c528c0b1 Kefeng Wang 2016-09-21 920 for_each_set_bit(i, &cfg.pgsize_bitmap, BITS_PER_LONG) {
e5fc9753b1a831 Robin Murphy 2016-01-26 921 size = 1UL << i;
e5fc9753b1a831 Robin Murphy 2016-01-26 @922 if (ops->map(ops, iova, iova, size, IOMMU_READ |
:::::: The code at line 922 was first introduced by commit
:::::: e5fc9753b1a831466be9b45d0bf926eeaa8b84a0 iommu/io-pgtable: Add ARMv7 short descriptor support
:::::: TO: Robin Murphy <robin.murphy@arm.com>
:::::: CC: Will Deacon <will.deacon@arm.com>
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 31260 bytes --]
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 2/2] iommu: Add gfp parameter to io_pgtable_ops->map()
2020-06-08 3:38 ` Baolin Wang
` (3 preceding siblings ...)
(?)
@ 2020-06-08 15:16 ` kernel test robot
-1 siblings, 0 replies; 12+ messages in thread
From: kernel test robot @ 2020-06-08 15:16 UTC (permalink / raw)
To: kbuild-all
[-- Attachment #1: Type: text/plain, Size: 9785 bytes --]
Hi Baolin,
I love your patch! Perhaps something to improve:
[auto build test WARNING on iommu/next]
[also build test WARNING on soc/for-next linus/master v5.7 next-20200605]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]
url: https://github.com/0day-ci/linux/commits/Baolin-Wang/Some-improvements-for-iommu/20200608-114141
base: https://git.kernel.org/pub/scm/linux/kernel/git/joro/iommu.git next
:::::: branch date: 4 hours ago
:::::: commit date: 4 hours ago
config: x86_64-randconfig-s021-20200607 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-13) 9.3.0
reproduce:
# apt-get install sparse
# sparse version: v0.6.1-247-gcadbd124-dirty
# save the attached .config to linux build tree
make W=1 C=1 ARCH=x86_64 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__'
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
sparse warnings: (new ones prefixed by >>)
>> drivers/iommu/io-pgtable-arm.c:1178:37: sparse: sparse: not enough arguments for function map
drivers/iommu/io-pgtable-arm.c:1185:38: sparse: sparse: not enough arguments for function map
drivers/iommu/io-pgtable-arm.c:1201:29: sparse: sparse: not enough arguments for function map
drivers/iommu/io-pgtable-arm.c:1219:37: sparse: sparse: not enough arguments for function map
# https://github.com/0day-ci/linux/commit/6047fa5558b1fdb8d2d52c9807fd960220478d3d
git remote add linux-review https://github.com/0day-ci/linux
git remote update linux-review
git checkout 6047fa5558b1fdb8d2d52c9807fd960220478d3d
vim +1178 drivers/iommu/io-pgtable-arm.c
fe4b991dcd84e0 Will Deacon 2014-11-17 1135
fe4b991dcd84e0 Will Deacon 2014-11-17 1136 static int __init arm_lpae_run_tests(struct io_pgtable_cfg *cfg)
fe4b991dcd84e0 Will Deacon 2014-11-17 1137 {
9062c1d0bedacf Christophe JAILLET 2019-09-09 1138 static const enum io_pgtable_fmt fmts[] __initconst = {
fe4b991dcd84e0 Will Deacon 2014-11-17 1139 ARM_64_LPAE_S1,
fe4b991dcd84e0 Will Deacon 2014-11-17 1140 ARM_64_LPAE_S2,
fe4b991dcd84e0 Will Deacon 2014-11-17 1141 };
fe4b991dcd84e0 Will Deacon 2014-11-17 1142
fe4b991dcd84e0 Will Deacon 2014-11-17 1143 int i, j;
fe4b991dcd84e0 Will Deacon 2014-11-17 1144 unsigned long iova;
fe4b991dcd84e0 Will Deacon 2014-11-17 1145 size_t size;
fe4b991dcd84e0 Will Deacon 2014-11-17 1146 struct io_pgtable_ops *ops;
fe4b991dcd84e0 Will Deacon 2014-11-17 1147
fe4b991dcd84e0 Will Deacon 2014-11-17 1148 selftest_running = true;
fe4b991dcd84e0 Will Deacon 2014-11-17 1149
fe4b991dcd84e0 Will Deacon 2014-11-17 1150 for (i = 0; i < ARRAY_SIZE(fmts); ++i) {
fe4b991dcd84e0 Will Deacon 2014-11-17 1151 cfg_cookie = cfg;
fe4b991dcd84e0 Will Deacon 2014-11-17 1152 ops = alloc_io_pgtable_ops(fmts[i], cfg, cfg);
fe4b991dcd84e0 Will Deacon 2014-11-17 1153 if (!ops) {
fe4b991dcd84e0 Will Deacon 2014-11-17 1154 pr_err("selftest: failed to allocate io pgtable ops\n");
fe4b991dcd84e0 Will Deacon 2014-11-17 1155 return -ENOMEM;
fe4b991dcd84e0 Will Deacon 2014-11-17 1156 }
fe4b991dcd84e0 Will Deacon 2014-11-17 1157
fe4b991dcd84e0 Will Deacon 2014-11-17 1158 /*
fe4b991dcd84e0 Will Deacon 2014-11-17 1159 * Initial sanity checks.
fe4b991dcd84e0 Will Deacon 2014-11-17 1160 * Empty page tables shouldn't provide any translations.
fe4b991dcd84e0 Will Deacon 2014-11-17 1161 */
fe4b991dcd84e0 Will Deacon 2014-11-17 1162 if (ops->iova_to_phys(ops, 42))
fe4b991dcd84e0 Will Deacon 2014-11-17 1163 return __FAIL(ops, i);
fe4b991dcd84e0 Will Deacon 2014-11-17 1164
fe4b991dcd84e0 Will Deacon 2014-11-17 1165 if (ops->iova_to_phys(ops, SZ_1G + 42))
fe4b991dcd84e0 Will Deacon 2014-11-17 1166 return __FAIL(ops, i);
fe4b991dcd84e0 Will Deacon 2014-11-17 1167
fe4b991dcd84e0 Will Deacon 2014-11-17 1168 if (ops->iova_to_phys(ops, SZ_2G + 42))
fe4b991dcd84e0 Will Deacon 2014-11-17 1169 return __FAIL(ops, i);
fe4b991dcd84e0 Will Deacon 2014-11-17 1170
fe4b991dcd84e0 Will Deacon 2014-11-17 1171 /*
fe4b991dcd84e0 Will Deacon 2014-11-17 1172 * Distinct mappings of different granule sizes.
fe4b991dcd84e0 Will Deacon 2014-11-17 1173 */
fe4b991dcd84e0 Will Deacon 2014-11-17 1174 iova = 0;
4ae8a5c528c0b1 Kefeng Wang 2016-09-21 1175 for_each_set_bit(j, &cfg->pgsize_bitmap, BITS_PER_LONG) {
fe4b991dcd84e0 Will Deacon 2014-11-17 1176 size = 1UL << j;
fe4b991dcd84e0 Will Deacon 2014-11-17 1177
fe4b991dcd84e0 Will Deacon 2014-11-17 @1178 if (ops->map(ops, iova, iova, size, IOMMU_READ |
fe4b991dcd84e0 Will Deacon 2014-11-17 1179 IOMMU_WRITE |
fe4b991dcd84e0 Will Deacon 2014-11-17 1180 IOMMU_NOEXEC |
fe4b991dcd84e0 Will Deacon 2014-11-17 1181 IOMMU_CACHE))
fe4b991dcd84e0 Will Deacon 2014-11-17 1182 return __FAIL(ops, i);
fe4b991dcd84e0 Will Deacon 2014-11-17 1183
fe4b991dcd84e0 Will Deacon 2014-11-17 1184 /* Overlapping mappings */
fe4b991dcd84e0 Will Deacon 2014-11-17 1185 if (!ops->map(ops, iova, iova + size, size,
fe4b991dcd84e0 Will Deacon 2014-11-17 1186 IOMMU_READ | IOMMU_NOEXEC))
fe4b991dcd84e0 Will Deacon 2014-11-17 1187 return __FAIL(ops, i);
fe4b991dcd84e0 Will Deacon 2014-11-17 1188
fe4b991dcd84e0 Will Deacon 2014-11-17 1189 if (ops->iova_to_phys(ops, iova + 42) != (iova + 42))
fe4b991dcd84e0 Will Deacon 2014-11-17 1190 return __FAIL(ops, i);
fe4b991dcd84e0 Will Deacon 2014-11-17 1191
fe4b991dcd84e0 Will Deacon 2014-11-17 1192 iova += SZ_1G;
fe4b991dcd84e0 Will Deacon 2014-11-17 1193 }
fe4b991dcd84e0 Will Deacon 2014-11-17 1194
fe4b991dcd84e0 Will Deacon 2014-11-17 1195 /* Partial unmap */
fe4b991dcd84e0 Will Deacon 2014-11-17 1196 size = 1UL << __ffs(cfg->pgsize_bitmap);
a2d3a382d6c682 Will Deacon 2019-07-02 1197 if (ops->unmap(ops, SZ_1G + size, size, NULL) != size)
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 /* Remap of partial unmap */
fe4b991dcd84e0 Will Deacon 2014-11-17 1201 if (ops->map(ops, SZ_1G + size, size, size, IOMMU_READ))
fe4b991dcd84e0 Will Deacon 2014-11-17 1202 return __FAIL(ops, i);
fe4b991dcd84e0 Will Deacon 2014-11-17 1203
fe4b991dcd84e0 Will Deacon 2014-11-17 1204 if (ops->iova_to_phys(ops, SZ_1G + size + 42) != (size + 42))
fe4b991dcd84e0 Will Deacon 2014-11-17 1205 return __FAIL(ops, i);
fe4b991dcd84e0 Will Deacon 2014-11-17 1206
fe4b991dcd84e0 Will Deacon 2014-11-17 1207 /* Full unmap */
fe4b991dcd84e0 Will Deacon 2014-11-17 1208 iova = 0;
f793b13ef0c9c1 YueHaibing 2018-04-26 1209 for_each_set_bit(j, &cfg->pgsize_bitmap, BITS_PER_LONG) {
fe4b991dcd84e0 Will Deacon 2014-11-17 1210 size = 1UL << j;
fe4b991dcd84e0 Will Deacon 2014-11-17 1211
a2d3a382d6c682 Will Deacon 2019-07-02 1212 if (ops->unmap(ops, iova, size, NULL) != size)
fe4b991dcd84e0 Will Deacon 2014-11-17 1213 return __FAIL(ops, i);
fe4b991dcd84e0 Will Deacon 2014-11-17 1214
fe4b991dcd84e0 Will Deacon 2014-11-17 1215 if (ops->iova_to_phys(ops, iova + 42))
fe4b991dcd84e0 Will Deacon 2014-11-17 1216 return __FAIL(ops, i);
fe4b991dcd84e0 Will Deacon 2014-11-17 1217
fe4b991dcd84e0 Will Deacon 2014-11-17 1218 /* Remap full block */
fe4b991dcd84e0 Will Deacon 2014-11-17 1219 if (ops->map(ops, iova, iova, size, IOMMU_WRITE))
fe4b991dcd84e0 Will Deacon 2014-11-17 1220 return __FAIL(ops, i);
fe4b991dcd84e0 Will Deacon 2014-11-17 1221
fe4b991dcd84e0 Will Deacon 2014-11-17 1222 if (ops->iova_to_phys(ops, iova + 42) != (iova + 42))
fe4b991dcd84e0 Will Deacon 2014-11-17 1223 return __FAIL(ops, i);
fe4b991dcd84e0 Will Deacon 2014-11-17 1224
fe4b991dcd84e0 Will Deacon 2014-11-17 1225 iova += SZ_1G;
fe4b991dcd84e0 Will Deacon 2014-11-17 1226 }
fe4b991dcd84e0 Will Deacon 2014-11-17 1227
fe4b991dcd84e0 Will Deacon 2014-11-17 1228 free_io_pgtable_ops(ops);
fe4b991dcd84e0 Will Deacon 2014-11-17 1229 }
fe4b991dcd84e0 Will Deacon 2014-11-17 1230
fe4b991dcd84e0 Will Deacon 2014-11-17 1231 selftest_running = false;
fe4b991dcd84e0 Will Deacon 2014-11-17 1232 return 0;
fe4b991dcd84e0 Will Deacon 2014-11-17 1233 }
fe4b991dcd84e0 Will Deacon 2014-11-17 1234
:::::: The code at line 1178 was first introduced by commit
:::::: fe4b991dcd84e0104cf2e29223a819335ed048a7 iommu: add self-consistency tests to ARM LPAE IO page table allocator
:::::: TO: Will Deacon <will.deacon@arm.com>
:::::: CC: Will Deacon <will.deacon@arm.com>
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 49045 bytes --]
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 2/2] iommu: Add gfp parameter to io_pgtable_ops->map()
2020-06-08 7:34 kernel test robot
@ 2020-06-08 7:55 ` Xia, Hui
0 siblings, 0 replies; 12+ messages in thread
From: Xia, Hui @ 2020-06-08 7:55 UTC (permalink / raw)
To: kbuild
[-- Attachment #1: Type: text/plain, Size: 6309 bytes --]
Need to report.
>-----Original Message-----
>From: kernel test robot <lkp@intel.com>
>Sent: 2020年6月8日 15:34
>To: kbuild(a)lists.01.org
>Cc: lkp <lkp@intel.com>
>Subject: [kbuild] Re: [PATCH 2/2] iommu: Add gfp parameter to io_pgtable_ops-
>>map()
>
>CC: kbuild-all(a)lists.01.org
>In-Reply-To:
><837d7131e83b06ce222bda678fe2e8ac7ba095f2.1591587029.git.baolin.wang@l
>inux.alibaba.com>
>References:
><837d7131e83b06ce222bda678fe2e8ac7ba095f2.1591587029.git.baolin.wang@l
>inux.alibaba.com>
>TO: Baolin Wang <baolin.wang@linux.alibaba.com>
>TO: joro(a)8bytes.org
>TO: will(a)kernel.org
>TO: robin.murphy(a)arm.com
>TO: agross(a)kernel.org
>TO: bjorn.andersson(a)linaro.org
>TO: matthias.bgg(a)gmail.com
>TO: robdclark(a)gmail.com
>TO: robh(a)kernel.org
>TO: tomeu.vizoso(a)collabora.com
>TO: steven.price(a)arm.com
>
>Hi Baolin,
>
>I love your patch! Perhaps something to improve:
>
>[auto build test WARNING on iommu/next]
>[also build test WARNING on soc/for-next linus/master v5.7 next-20200605] [if
>your patch is applied to the wrong git tree, please drop us a note to help improve
>the system. BTW, we also suggest to use '--base' option to specify the base tree
>in git format-patch, please see https://stackoverflow.com/a/37406982]
>
>url: https://github.com/0day-ci/linux/commits/Baolin-Wang/Some-
>improvements-for-iommu/20200608-114141
>base: https://git.kernel.org/pub/scm/linux/kernel/git/joro/iommu.git next
>:::::: branch date: 4 hours ago
>:::::: commit date: 4 hours ago
>config: i386-randconfig-s001-20200608 (attached as .config)
>compiler: gcc-9 (Debian 9.3.0-13) 9.3.0
>reproduce:
> # apt-get install sparse
> # sparse version: v0.6.1-247-gcadbd124-dirty
> # save the attached .config to linux build tree
> make W=1 C=1 ARCH=i386 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__'
>
>If you fix the issue, kindly add following tag as appropriate
>Reported-by: kernel test robot <lkp@intel.com>
>
>
>sparse warnings: (new ones prefixed by >>)
>
>>> drivers/iommu/io-pgtable-arm-v7s.c:922:29: sparse: sparse: not enough
>>> arguments for function map
> drivers/iommu/io-pgtable-arm-v7s.c:929:30: sparse: sparse: not enough
>arguments for function map
> drivers/iommu/io-pgtable-arm-v7s.c:949:29: sparse: sparse: not enough
>arguments for function map
> drivers/iommu/io-pgtable-arm-v7s.c:970:29: sparse: sparse: not enough
>arguments for function map
>
># https://github.com/0day-
>ci/linux/commit/6047fa5558b1fdb8d2d52c9807fd960220478d3d
>git remote add linux-review https://github.com/0day-ci/linux git remote update
>linux-review git checkout 6047fa5558b1fdb8d2d52c9807fd960220478d3d
>vim +922 drivers/iommu/io-pgtable-arm-v7s.c
>
>e5fc9753b1a831 Robin Murphy 2016-01-26 878
>e5fc9753b1a831 Robin Murphy 2016-01-26 879 static int __init
>arm_v7s_do_selftests(void)
>e5fc9753b1a831 Robin Murphy 2016-01-26 880 {
>e5fc9753b1a831 Robin Murphy 2016-01-26 881 struct io_pgtable_ops
>*ops;
>e5fc9753b1a831 Robin Murphy 2016-01-26 882 struct io_pgtable_cfg
>cfg = {
>e5fc9753b1a831 Robin Murphy 2016-01-26 883 .tlb =
>&dummy_tlb_ops,
>e5fc9753b1a831 Robin Murphy 2016-01-26 884 .oas = 32,
>e5fc9753b1a831 Robin Murphy 2016-01-26 885 .ias = 32,
>4f41845b340783 Will Deacon 2019-06-25 886 .coherent_walk = true,
>4f41845b340783 Will Deacon 2019-06-25 887 .quirks =
>IO_PGTABLE_QUIRK_ARM_NS,
>e5fc9753b1a831 Robin Murphy 2016-01-26 888 .pgsize_bitmap
>= SZ_4K | SZ_64K | SZ_1M | SZ_16M,
>e5fc9753b1a831 Robin Murphy 2016-01-26 889 };
>e5fc9753b1a831 Robin Murphy 2016-01-26 890 unsigned int iova, size,
>iova_start;
>e5fc9753b1a831 Robin Murphy 2016-01-26 891 unsigned int i, loopnr =
>0;
>e5fc9753b1a831 Robin Murphy 2016-01-26 892
>e5fc9753b1a831 Robin Murphy 2016-01-26 893 selftest_running = true;
>e5fc9753b1a831 Robin Murphy 2016-01-26 894
>e5fc9753b1a831 Robin Murphy 2016-01-26 895 cfg_cookie = &cfg;
>e5fc9753b1a831 Robin Murphy 2016-01-26 896
>e5fc9753b1a831 Robin Murphy 2016-01-26 897 ops =
>alloc_io_pgtable_ops(ARM_V7S, &cfg, &cfg);
>e5fc9753b1a831 Robin Murphy 2016-01-26 898 if (!ops) {
>e5fc9753b1a831 Robin Murphy 2016-01-26 899 pr_err("selftest:
>failed to allocate io pgtable ops\n");
>e5fc9753b1a831 Robin Murphy 2016-01-26 900 return -EINVAL;
>e5fc9753b1a831 Robin Murphy 2016-01-26 901 }
>e5fc9753b1a831 Robin Murphy 2016-01-26 902
>e5fc9753b1a831 Robin Murphy 2016-01-26 903 /*
>e5fc9753b1a831 Robin Murphy 2016-01-26 904 * Initial sanity checks.
>e5fc9753b1a831 Robin Murphy 2016-01-26 905 * Empty page tables
>shouldn't provide any translations.
>e5fc9753b1a831 Robin Murphy 2016-01-26 906 */
>e5fc9753b1a831 Robin Murphy 2016-01-26 907 if (ops-
>>iova_to_phys(ops, 42))
>e5fc9753b1a831 Robin Murphy 2016-01-26 908 return
>__FAIL(ops);
>e5fc9753b1a831 Robin Murphy 2016-01-26 909
>e5fc9753b1a831 Robin Murphy 2016-01-26 910 if (ops-
>>iova_to_phys(ops, SZ_1G + 42))
>e5fc9753b1a831 Robin Murphy 2016-01-26 911 return
>__FAIL(ops);
>e5fc9753b1a831 Robin Murphy 2016-01-26 912
>e5fc9753b1a831 Robin Murphy 2016-01-26 913 if (ops-
>>iova_to_phys(ops, SZ_2G + 42))
>e5fc9753b1a831 Robin Murphy 2016-01-26 914 return
>__FAIL(ops);
>e5fc9753b1a831 Robin Murphy 2016-01-26 915
>e5fc9753b1a831 Robin Murphy 2016-01-26 916 /*
>e5fc9753b1a831 Robin Murphy 2016-01-26 917 * Distinct mappings of
>different granule sizes.
>e5fc9753b1a831 Robin Murphy 2016-01-26 918 */
>e5fc9753b1a831 Robin Murphy 2016-01-26 919 iova = 0;
>4ae8a5c528c0b1 Kefeng Wang 2016-09-21 920 for_each_set_bit(i,
>&cfg.pgsize_bitmap, BITS_PER_LONG) {
>e5fc9753b1a831 Robin Murphy 2016-01-26 921 size = 1UL << i;
>e5fc9753b1a831 Robin Murphy 2016-01-26 @922 if (ops-
>>map(ops, iova, iova, size, IOMMU_READ |
>
>:::::: The code at line 922 was first introduced by commit
>:::::: e5fc9753b1a831466be9b45d0bf926eeaa8b84a0 iommu/io-pgtable: Add
>ARMv7 short descriptor support
>
>:::::: TO: Robin Murphy <robin.murphy@arm.com>
>:::::: CC: Will Deacon <will.deacon@arm.com>
>
>---
>0-DAY CI Kernel Test Service, Intel Corporation
>https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 2/2] iommu: Add gfp parameter to io_pgtable_ops->map()
@ 2020-06-08 7:34 kernel test robot
2020-06-08 7:55 ` Xia, Hui
0 siblings, 1 reply; 12+ messages in thread
From: kernel test robot @ 2020-06-08 7:34 UTC (permalink / raw)
To: kbuild
[-- Attachment #1: Type: text/plain, Size: 5881 bytes --]
CC: kbuild-all(a)lists.01.org
In-Reply-To: <837d7131e83b06ce222bda678fe2e8ac7ba095f2.1591587029.git.baolin.wang@linux.alibaba.com>
References: <837d7131e83b06ce222bda678fe2e8ac7ba095f2.1591587029.git.baolin.wang@linux.alibaba.com>
TO: Baolin Wang <baolin.wang@linux.alibaba.com>
TO: joro(a)8bytes.org
TO: will(a)kernel.org
TO: robin.murphy(a)arm.com
TO: agross(a)kernel.org
TO: bjorn.andersson(a)linaro.org
TO: matthias.bgg(a)gmail.com
TO: robdclark(a)gmail.com
TO: robh(a)kernel.org
TO: tomeu.vizoso(a)collabora.com
TO: steven.price(a)arm.com
Hi Baolin,
I love your patch! Perhaps something to improve:
[auto build test WARNING on iommu/next]
[also build test WARNING on soc/for-next linus/master v5.7 next-20200605]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]
url: https://github.com/0day-ci/linux/commits/Baolin-Wang/Some-improvements-for-iommu/20200608-114141
base: https://git.kernel.org/pub/scm/linux/kernel/git/joro/iommu.git next
:::::: branch date: 4 hours ago
:::::: commit date: 4 hours ago
config: i386-randconfig-s001-20200608 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-13) 9.3.0
reproduce:
# apt-get install sparse
# sparse version: v0.6.1-247-gcadbd124-dirty
# save the attached .config to linux build tree
make W=1 C=1 ARCH=i386 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__'
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
sparse warnings: (new ones prefixed by >>)
>> drivers/iommu/io-pgtable-arm-v7s.c:922:29: sparse: sparse: not enough arguments for function map
drivers/iommu/io-pgtable-arm-v7s.c:929:30: sparse: sparse: not enough arguments for function map
drivers/iommu/io-pgtable-arm-v7s.c:949:29: sparse: sparse: not enough arguments for function map
drivers/iommu/io-pgtable-arm-v7s.c:970:29: sparse: sparse: not enough arguments for function map
# https://github.com/0day-ci/linux/commit/6047fa5558b1fdb8d2d52c9807fd960220478d3d
git remote add linux-review https://github.com/0day-ci/linux
git remote update linux-review
git checkout 6047fa5558b1fdb8d2d52c9807fd960220478d3d
vim +922 drivers/iommu/io-pgtable-arm-v7s.c
e5fc9753b1a831 Robin Murphy 2016-01-26 878
e5fc9753b1a831 Robin Murphy 2016-01-26 879 static int __init arm_v7s_do_selftests(void)
e5fc9753b1a831 Robin Murphy 2016-01-26 880 {
e5fc9753b1a831 Robin Murphy 2016-01-26 881 struct io_pgtable_ops *ops;
e5fc9753b1a831 Robin Murphy 2016-01-26 882 struct io_pgtable_cfg cfg = {
e5fc9753b1a831 Robin Murphy 2016-01-26 883 .tlb = &dummy_tlb_ops,
e5fc9753b1a831 Robin Murphy 2016-01-26 884 .oas = 32,
e5fc9753b1a831 Robin Murphy 2016-01-26 885 .ias = 32,
4f41845b340783 Will Deacon 2019-06-25 886 .coherent_walk = true,
4f41845b340783 Will Deacon 2019-06-25 887 .quirks = IO_PGTABLE_QUIRK_ARM_NS,
e5fc9753b1a831 Robin Murphy 2016-01-26 888 .pgsize_bitmap = SZ_4K | SZ_64K | SZ_1M | SZ_16M,
e5fc9753b1a831 Robin Murphy 2016-01-26 889 };
e5fc9753b1a831 Robin Murphy 2016-01-26 890 unsigned int iova, size, iova_start;
e5fc9753b1a831 Robin Murphy 2016-01-26 891 unsigned int i, loopnr = 0;
e5fc9753b1a831 Robin Murphy 2016-01-26 892
e5fc9753b1a831 Robin Murphy 2016-01-26 893 selftest_running = true;
e5fc9753b1a831 Robin Murphy 2016-01-26 894
e5fc9753b1a831 Robin Murphy 2016-01-26 895 cfg_cookie = &cfg;
e5fc9753b1a831 Robin Murphy 2016-01-26 896
e5fc9753b1a831 Robin Murphy 2016-01-26 897 ops = alloc_io_pgtable_ops(ARM_V7S, &cfg, &cfg);
e5fc9753b1a831 Robin Murphy 2016-01-26 898 if (!ops) {
e5fc9753b1a831 Robin Murphy 2016-01-26 899 pr_err("selftest: failed to allocate io pgtable ops\n");
e5fc9753b1a831 Robin Murphy 2016-01-26 900 return -EINVAL;
e5fc9753b1a831 Robin Murphy 2016-01-26 901 }
e5fc9753b1a831 Robin Murphy 2016-01-26 902
e5fc9753b1a831 Robin Murphy 2016-01-26 903 /*
e5fc9753b1a831 Robin Murphy 2016-01-26 904 * Initial sanity checks.
e5fc9753b1a831 Robin Murphy 2016-01-26 905 * Empty page tables shouldn't provide any translations.
e5fc9753b1a831 Robin Murphy 2016-01-26 906 */
e5fc9753b1a831 Robin Murphy 2016-01-26 907 if (ops->iova_to_phys(ops, 42))
e5fc9753b1a831 Robin Murphy 2016-01-26 908 return __FAIL(ops);
e5fc9753b1a831 Robin Murphy 2016-01-26 909
e5fc9753b1a831 Robin Murphy 2016-01-26 910 if (ops->iova_to_phys(ops, SZ_1G + 42))
e5fc9753b1a831 Robin Murphy 2016-01-26 911 return __FAIL(ops);
e5fc9753b1a831 Robin Murphy 2016-01-26 912
e5fc9753b1a831 Robin Murphy 2016-01-26 913 if (ops->iova_to_phys(ops, SZ_2G + 42))
e5fc9753b1a831 Robin Murphy 2016-01-26 914 return __FAIL(ops);
e5fc9753b1a831 Robin Murphy 2016-01-26 915
e5fc9753b1a831 Robin Murphy 2016-01-26 916 /*
e5fc9753b1a831 Robin Murphy 2016-01-26 917 * Distinct mappings of different granule sizes.
e5fc9753b1a831 Robin Murphy 2016-01-26 918 */
e5fc9753b1a831 Robin Murphy 2016-01-26 919 iova = 0;
4ae8a5c528c0b1 Kefeng Wang 2016-09-21 920 for_each_set_bit(i, &cfg.pgsize_bitmap, BITS_PER_LONG) {
e5fc9753b1a831 Robin Murphy 2016-01-26 921 size = 1UL << i;
e5fc9753b1a831 Robin Murphy 2016-01-26 @922 if (ops->map(ops, iova, iova, size, IOMMU_READ |
:::::: The code at line 922 was first introduced by commit
:::::: e5fc9753b1a831466be9b45d0bf926eeaa8b84a0 iommu/io-pgtable: Add ARMv7 short descriptor support
:::::: TO: Robin Murphy <robin.murphy@arm.com>
:::::: CC: Will Deacon <will.deacon@arm.com>
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 31260 bytes --]
^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH 2/2] iommu: Add gfp parameter to io_pgtable_ops->map()
2020-06-08 3:38 [PATCH 0/2] Some improvements for iommu Baolin Wang
` (2 preceding siblings ...)
(?)
@ 2020-06-08 3:38 ` Baolin Wang
0 siblings, 0 replies; 12+ messages in thread
From: Baolin Wang @ 2020-06-08 3:38 UTC (permalink / raw)
To: joro, will, robin.murphy, agross, bjorn.andersson, matthias.bgg,
robdclark, robh, tomeu.vizoso, steven.price, alyssa.rosenzweig,
airlied, daniel
Cc: baolin.wang, linux-arm-kernel, iommu, linux-arm-msm,
linux-mediatek, linux-kernel, dri-devel
Now the ARM page tables are always allocated by GFP_ATOMIC parameter,
but the iommu_ops->map() function has been added a gfp_t parameter by
commit 781ca2de89ba ("iommu: Add gfp parameter to iommu_ops::map"),
thus io_pgtable_ops->map() should use the gfp parameter passed from
iommu_ops->map() to allocate page pages, which can avoid wasting the
memory allocators atomic pools for some non-atomic contexts.
Signed-off-by: Baolin Wang <baolin.wang@linux.alibaba.com>
---
drivers/gpu/drm/panfrost/panfrost_mmu.c | 2 +-
drivers/iommu/arm-smmu-v3.c | 2 +-
drivers/iommu/arm-smmu.c | 2 +-
drivers/iommu/io-pgtable-arm-v7s.c | 10 +++++-----
drivers/iommu/io-pgtable-arm.c | 10 +++++-----
drivers/iommu/ipmmu-vmsa.c | 2 +-
drivers/iommu/msm_iommu.c | 2 +-
drivers/iommu/mtk_iommu.c | 2 +-
drivers/iommu/qcom_iommu.c | 2 +-
include/linux/io-pgtable.h | 2 +-
10 files changed, 18 insertions(+), 18 deletions(-)
diff --git a/drivers/gpu/drm/panfrost/panfrost_mmu.c b/drivers/gpu/drm/panfrost/panfrost_mmu.c
index ed28aeb..5a39eee 100644
--- a/drivers/gpu/drm/panfrost/panfrost_mmu.c
+++ b/drivers/gpu/drm/panfrost/panfrost_mmu.c
@@ -262,7 +262,7 @@ static int mmu_map_sg(struct panfrost_device *pfdev, struct panfrost_mmu *mmu,
while (len) {
size_t pgsize = get_pgsize(iova | paddr, len);
- ops->map(ops, iova, paddr, pgsize, prot);
+ ops->map(ops, iova, paddr, pgsize, prot, GFP_KERNEL);
iova += pgsize;
paddr += pgsize;
len -= pgsize;
diff --git a/drivers/iommu/arm-smmu-v3.c b/drivers/iommu/arm-smmu-v3.c
index 8250873..433b680 100644
--- a/drivers/iommu/arm-smmu-v3.c
+++ b/drivers/iommu/arm-smmu-v3.c
@@ -2845,7 +2845,7 @@ static int arm_smmu_map(struct iommu_domain *domain, unsigned long iova,
if (!ops)
return -ENODEV;
- return ops->map(ops, iova, paddr, size, prot);
+ return ops->map(ops, iova, paddr, size, prot, gfp);
}
static size_t arm_smmu_unmap(struct iommu_domain *domain, unsigned long iova,
diff --git a/drivers/iommu/arm-smmu.c b/drivers/iommu/arm-smmu.c
index a6a5796..bf640aa 100644
--- a/drivers/iommu/arm-smmu.c
+++ b/drivers/iommu/arm-smmu.c
@@ -1237,7 +1237,7 @@ static int arm_smmu_map(struct iommu_domain *domain, unsigned long iova,
return -ENODEV;
arm_smmu_rpm_get(smmu);
- ret = ops->map(ops, iova, paddr, size, prot);
+ ret = ops->map(ops, iova, paddr, size, prot, gfp);
arm_smmu_rpm_put(smmu);
return ret;
diff --git a/drivers/iommu/io-pgtable-arm-v7s.c b/drivers/iommu/io-pgtable-arm-v7s.c
index 4272fe4..ebbe2c5 100644
--- a/drivers/iommu/io-pgtable-arm-v7s.c
+++ b/drivers/iommu/io-pgtable-arm-v7s.c
@@ -470,7 +470,7 @@ static arm_v7s_iopte arm_v7s_install_table(arm_v7s_iopte *table,
static int __arm_v7s_map(struct arm_v7s_io_pgtable *data, unsigned long iova,
phys_addr_t paddr, size_t size, int prot,
- int lvl, arm_v7s_iopte *ptep)
+ int lvl, arm_v7s_iopte *ptep, gfp_t gfp)
{
struct io_pgtable_cfg *cfg = &data->iop.cfg;
arm_v7s_iopte pte, *cptep;
@@ -491,7 +491,7 @@ static int __arm_v7s_map(struct arm_v7s_io_pgtable *data, unsigned long iova,
/* Grab a pointer to the next level */
pte = READ_ONCE(*ptep);
if (!pte) {
- cptep = __arm_v7s_alloc_table(lvl + 1, GFP_ATOMIC, data);
+ cptep = __arm_v7s_alloc_table(lvl + 1, gfp, data);
if (!cptep)
return -ENOMEM;
@@ -512,11 +512,11 @@ static int __arm_v7s_map(struct arm_v7s_io_pgtable *data, unsigned long iova,
}
/* Rinse, repeat */
- return __arm_v7s_map(data, iova, paddr, size, prot, lvl + 1, cptep);
+ return __arm_v7s_map(data, iova, paddr, size, prot, lvl + 1, cptep, gfp);
}
static int arm_v7s_map(struct io_pgtable_ops *ops, unsigned long iova,
- phys_addr_t paddr, size_t size, int prot)
+ phys_addr_t paddr, size_t size, int prot, gfp_t gfp)
{
struct arm_v7s_io_pgtable *data = io_pgtable_ops_to_data(ops);
struct io_pgtable *iop = &data->iop;
@@ -530,7 +530,7 @@ static int arm_v7s_map(struct io_pgtable_ops *ops, unsigned long iova,
paddr >= (1ULL << data->iop.cfg.oas)))
return -ERANGE;
- ret = __arm_v7s_map(data, iova, paddr, size, prot, 1, data->pgd);
+ ret = __arm_v7s_map(data, iova, paddr, size, prot, 1, data->pgd, gfp);
/*
* Synchronise all PTE updates for the new mapping before there's
* a chance for anything to kick off a table walk for the new iova.
diff --git a/drivers/iommu/io-pgtable-arm.c b/drivers/iommu/io-pgtable-arm.c
index 04fbd4b..3ced132 100644
--- a/drivers/iommu/io-pgtable-arm.c
+++ b/drivers/iommu/io-pgtable-arm.c
@@ -355,7 +355,7 @@ static arm_lpae_iopte arm_lpae_install_table(arm_lpae_iopte *table,
static int __arm_lpae_map(struct arm_lpae_io_pgtable *data, unsigned long iova,
phys_addr_t paddr, size_t size, arm_lpae_iopte prot,
- int lvl, arm_lpae_iopte *ptep)
+ int lvl, arm_lpae_iopte *ptep, gfp_t gfp)
{
arm_lpae_iopte *cptep, pte;
size_t block_size = ARM_LPAE_BLOCK_SIZE(lvl, data);
@@ -376,7 +376,7 @@ static int __arm_lpae_map(struct arm_lpae_io_pgtable *data, unsigned long iova,
/* Grab a pointer to the next level */
pte = READ_ONCE(*ptep);
if (!pte) {
- cptep = __arm_lpae_alloc_pages(tblsz, GFP_ATOMIC, cfg);
+ cptep = __arm_lpae_alloc_pages(tblsz, gfp, cfg);
if (!cptep)
return -ENOMEM;
@@ -396,7 +396,7 @@ static int __arm_lpae_map(struct arm_lpae_io_pgtable *data, unsigned long iova,
}
/* Rinse, repeat */
- return __arm_lpae_map(data, iova, paddr, size, prot, lvl + 1, cptep);
+ return __arm_lpae_map(data, iova, paddr, size, prot, lvl + 1, cptep, gfp);
}
static arm_lpae_iopte arm_lpae_prot_to_pte(struct arm_lpae_io_pgtable *data,
@@ -461,7 +461,7 @@ static arm_lpae_iopte arm_lpae_prot_to_pte(struct arm_lpae_io_pgtable *data,
}
static int arm_lpae_map(struct io_pgtable_ops *ops, unsigned long iova,
- phys_addr_t paddr, size_t size, int iommu_prot)
+ phys_addr_t paddr, size_t size, int iommu_prot, gfp_t gfp)
{
struct arm_lpae_io_pgtable *data = io_pgtable_ops_to_data(ops);
struct io_pgtable_cfg *cfg = &data->iop.cfg;
@@ -483,7 +483,7 @@ static int arm_lpae_map(struct io_pgtable_ops *ops, unsigned long iova,
return -ERANGE;
prot = arm_lpae_prot_to_pte(data, iommu_prot);
- ret = __arm_lpae_map(data, iova, paddr, size, prot, lvl, ptep);
+ ret = __arm_lpae_map(data, iova, paddr, size, prot, lvl, ptep, gfp);
/*
* Synchronise all PTE updates for the new mapping before there's
* a chance for anything to kick off a table walk for the new iova.
diff --git a/drivers/iommu/ipmmu-vmsa.c b/drivers/iommu/ipmmu-vmsa.c
index 310cf09..391d7f1 100644
--- a/drivers/iommu/ipmmu-vmsa.c
+++ b/drivers/iommu/ipmmu-vmsa.c
@@ -687,7 +687,7 @@ static int ipmmu_map(struct iommu_domain *io_domain, unsigned long iova,
if (!domain)
return -ENODEV;
- return domain->iop->map(domain->iop, iova, paddr, size, prot);
+ return domain->iop->map(domain->iop, iova, paddr, size, prot, gfp);
}
static size_t ipmmu_unmap(struct iommu_domain *io_domain, unsigned long iova,
diff --git a/drivers/iommu/msm_iommu.c b/drivers/iommu/msm_iommu.c
index 94a6df1..f3057f9 100644
--- a/drivers/iommu/msm_iommu.c
+++ b/drivers/iommu/msm_iommu.c
@@ -511,7 +511,7 @@ static int msm_iommu_map(struct iommu_domain *domain, unsigned long iova,
int ret;
spin_lock_irqsave(&priv->pgtlock, flags);
- ret = priv->iop->map(priv->iop, iova, pa, len, prot);
+ ret = priv->iop->map(priv->iop, iova, pa, len, prot, GFP_ATOMIC);
spin_unlock_irqrestore(&priv->pgtlock, flags);
return ret;
diff --git a/drivers/iommu/mtk_iommu.c b/drivers/iommu/mtk_iommu.c
index 5f4d6df..1593801 100644
--- a/drivers/iommu/mtk_iommu.c
+++ b/drivers/iommu/mtk_iommu.c
@@ -397,7 +397,7 @@ static int mtk_iommu_map(struct iommu_domain *domain, unsigned long iova,
paddr |= BIT_ULL(32);
/* Synchronize with the tlb_lock */
- return dom->iop->map(dom->iop, iova, paddr, size, prot);
+ return dom->iop->map(dom->iop, iova, paddr, size, prot, gfp);
}
static size_t mtk_iommu_unmap(struct iommu_domain *domain,
diff --git a/drivers/iommu/qcom_iommu.c b/drivers/iommu/qcom_iommu.c
index 5b3b270..2c4c5d7 100644
--- a/drivers/iommu/qcom_iommu.c
+++ b/drivers/iommu/qcom_iommu.c
@@ -441,7 +441,7 @@ static int qcom_iommu_map(struct iommu_domain *domain, unsigned long iova,
return -ENODEV;
spin_lock_irqsave(&qcom_domain->pgtbl_lock, flags);
- ret = ops->map(ops, iova, paddr, size, prot);
+ ret = ops->map(ops, iova, paddr, size, prot, GFP_ATOMIC);
spin_unlock_irqrestore(&qcom_domain->pgtbl_lock, flags);
return ret;
}
diff --git a/include/linux/io-pgtable.h b/include/linux/io-pgtable.h
index 53d53c6..23285ba 100644
--- a/include/linux/io-pgtable.h
+++ b/include/linux/io-pgtable.h
@@ -155,7 +155,7 @@ struct io_pgtable_cfg {
*/
struct io_pgtable_ops {
int (*map)(struct io_pgtable_ops *ops, unsigned long iova,
- phys_addr_t paddr, size_t size, int prot);
+ phys_addr_t paddr, size_t size, int prot, gfp_t gfp);
size_t (*unmap)(struct io_pgtable_ops *ops, unsigned long iova,
size_t size, struct iommu_iotlb_gather *gather);
phys_addr_t (*iova_to_phys)(struct io_pgtable_ops *ops,
--
1.8.3.1
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH 2/2] iommu: Add gfp parameter to io_pgtable_ops->map()
@ 2020-06-08 3:38 ` Baolin Wang
0 siblings, 0 replies; 12+ messages in thread
From: Baolin Wang @ 2020-06-08 3:38 UTC (permalink / raw)
To: joro, will, robin.murphy, agross, bjorn.andersson, matthias.bgg,
robdclark, robh, tomeu.vizoso, steven.price, alyssa.rosenzweig,
airlied, daniel
Cc: linux-arm-msm, linux-kernel, dri-devel, iommu, linux-mediatek,
baolin.wang, linux-arm-kernel
Now the ARM page tables are always allocated by GFP_ATOMIC parameter,
but the iommu_ops->map() function has been added a gfp_t parameter by
commit 781ca2de89ba ("iommu: Add gfp parameter to iommu_ops::map"),
thus io_pgtable_ops->map() should use the gfp parameter passed from
iommu_ops->map() to allocate page pages, which can avoid wasting the
memory allocators atomic pools for some non-atomic contexts.
Signed-off-by: Baolin Wang <baolin.wang@linux.alibaba.com>
---
drivers/gpu/drm/panfrost/panfrost_mmu.c | 2 +-
drivers/iommu/arm-smmu-v3.c | 2 +-
drivers/iommu/arm-smmu.c | 2 +-
drivers/iommu/io-pgtable-arm-v7s.c | 10 +++++-----
drivers/iommu/io-pgtable-arm.c | 10 +++++-----
drivers/iommu/ipmmu-vmsa.c | 2 +-
drivers/iommu/msm_iommu.c | 2 +-
drivers/iommu/mtk_iommu.c | 2 +-
drivers/iommu/qcom_iommu.c | 2 +-
include/linux/io-pgtable.h | 2 +-
10 files changed, 18 insertions(+), 18 deletions(-)
diff --git a/drivers/gpu/drm/panfrost/panfrost_mmu.c b/drivers/gpu/drm/panfrost/panfrost_mmu.c
index ed28aeb..5a39eee 100644
--- a/drivers/gpu/drm/panfrost/panfrost_mmu.c
+++ b/drivers/gpu/drm/panfrost/panfrost_mmu.c
@@ -262,7 +262,7 @@ static int mmu_map_sg(struct panfrost_device *pfdev, struct panfrost_mmu *mmu,
while (len) {
size_t pgsize = get_pgsize(iova | paddr, len);
- ops->map(ops, iova, paddr, pgsize, prot);
+ ops->map(ops, iova, paddr, pgsize, prot, GFP_KERNEL);
iova += pgsize;
paddr += pgsize;
len -= pgsize;
diff --git a/drivers/iommu/arm-smmu-v3.c b/drivers/iommu/arm-smmu-v3.c
index 8250873..433b680 100644
--- a/drivers/iommu/arm-smmu-v3.c
+++ b/drivers/iommu/arm-smmu-v3.c
@@ -2845,7 +2845,7 @@ static int arm_smmu_map(struct iommu_domain *domain, unsigned long iova,
if (!ops)
return -ENODEV;
- return ops->map(ops, iova, paddr, size, prot);
+ return ops->map(ops, iova, paddr, size, prot, gfp);
}
static size_t arm_smmu_unmap(struct iommu_domain *domain, unsigned long iova,
diff --git a/drivers/iommu/arm-smmu.c b/drivers/iommu/arm-smmu.c
index a6a5796..bf640aa 100644
--- a/drivers/iommu/arm-smmu.c
+++ b/drivers/iommu/arm-smmu.c
@@ -1237,7 +1237,7 @@ static int arm_smmu_map(struct iommu_domain *domain, unsigned long iova,
return -ENODEV;
arm_smmu_rpm_get(smmu);
- ret = ops->map(ops, iova, paddr, size, prot);
+ ret = ops->map(ops, iova, paddr, size, prot, gfp);
arm_smmu_rpm_put(smmu);
return ret;
diff --git a/drivers/iommu/io-pgtable-arm-v7s.c b/drivers/iommu/io-pgtable-arm-v7s.c
index 4272fe4..ebbe2c5 100644
--- a/drivers/iommu/io-pgtable-arm-v7s.c
+++ b/drivers/iommu/io-pgtable-arm-v7s.c
@@ -470,7 +470,7 @@ static arm_v7s_iopte arm_v7s_install_table(arm_v7s_iopte *table,
static int __arm_v7s_map(struct arm_v7s_io_pgtable *data, unsigned long iova,
phys_addr_t paddr, size_t size, int prot,
- int lvl, arm_v7s_iopte *ptep)
+ int lvl, arm_v7s_iopte *ptep, gfp_t gfp)
{
struct io_pgtable_cfg *cfg = &data->iop.cfg;
arm_v7s_iopte pte, *cptep;
@@ -491,7 +491,7 @@ static int __arm_v7s_map(struct arm_v7s_io_pgtable *data, unsigned long iova,
/* Grab a pointer to the next level */
pte = READ_ONCE(*ptep);
if (!pte) {
- cptep = __arm_v7s_alloc_table(lvl + 1, GFP_ATOMIC, data);
+ cptep = __arm_v7s_alloc_table(lvl + 1, gfp, data);
if (!cptep)
return -ENOMEM;
@@ -512,11 +512,11 @@ static int __arm_v7s_map(struct arm_v7s_io_pgtable *data, unsigned long iova,
}
/* Rinse, repeat */
- return __arm_v7s_map(data, iova, paddr, size, prot, lvl + 1, cptep);
+ return __arm_v7s_map(data, iova, paddr, size, prot, lvl + 1, cptep, gfp);
}
static int arm_v7s_map(struct io_pgtable_ops *ops, unsigned long iova,
- phys_addr_t paddr, size_t size, int prot)
+ phys_addr_t paddr, size_t size, int prot, gfp_t gfp)
{
struct arm_v7s_io_pgtable *data = io_pgtable_ops_to_data(ops);
struct io_pgtable *iop = &data->iop;
@@ -530,7 +530,7 @@ static int arm_v7s_map(struct io_pgtable_ops *ops, unsigned long iova,
paddr >= (1ULL << data->iop.cfg.oas)))
return -ERANGE;
- ret = __arm_v7s_map(data, iova, paddr, size, prot, 1, data->pgd);
+ ret = __arm_v7s_map(data, iova, paddr, size, prot, 1, data->pgd, gfp);
/*
* Synchronise all PTE updates for the new mapping before there's
* a chance for anything to kick off a table walk for the new iova.
diff --git a/drivers/iommu/io-pgtable-arm.c b/drivers/iommu/io-pgtable-arm.c
index 04fbd4b..3ced132 100644
--- a/drivers/iommu/io-pgtable-arm.c
+++ b/drivers/iommu/io-pgtable-arm.c
@@ -355,7 +355,7 @@ static arm_lpae_iopte arm_lpae_install_table(arm_lpae_iopte *table,
static int __arm_lpae_map(struct arm_lpae_io_pgtable *data, unsigned long iova,
phys_addr_t paddr, size_t size, arm_lpae_iopte prot,
- int lvl, arm_lpae_iopte *ptep)
+ int lvl, arm_lpae_iopte *ptep, gfp_t gfp)
{
arm_lpae_iopte *cptep, pte;
size_t block_size = ARM_LPAE_BLOCK_SIZE(lvl, data);
@@ -376,7 +376,7 @@ static int __arm_lpae_map(struct arm_lpae_io_pgtable *data, unsigned long iova,
/* Grab a pointer to the next level */
pte = READ_ONCE(*ptep);
if (!pte) {
- cptep = __arm_lpae_alloc_pages(tblsz, GFP_ATOMIC, cfg);
+ cptep = __arm_lpae_alloc_pages(tblsz, gfp, cfg);
if (!cptep)
return -ENOMEM;
@@ -396,7 +396,7 @@ static int __arm_lpae_map(struct arm_lpae_io_pgtable *data, unsigned long iova,
}
/* Rinse, repeat */
- return __arm_lpae_map(data, iova, paddr, size, prot, lvl + 1, cptep);
+ return __arm_lpae_map(data, iova, paddr, size, prot, lvl + 1, cptep, gfp);
}
static arm_lpae_iopte arm_lpae_prot_to_pte(struct arm_lpae_io_pgtable *data,
@@ -461,7 +461,7 @@ static arm_lpae_iopte arm_lpae_prot_to_pte(struct arm_lpae_io_pgtable *data,
}
static int arm_lpae_map(struct io_pgtable_ops *ops, unsigned long iova,
- phys_addr_t paddr, size_t size, int iommu_prot)
+ phys_addr_t paddr, size_t size, int iommu_prot, gfp_t gfp)
{
struct arm_lpae_io_pgtable *data = io_pgtable_ops_to_data(ops);
struct io_pgtable_cfg *cfg = &data->iop.cfg;
@@ -483,7 +483,7 @@ static int arm_lpae_map(struct io_pgtable_ops *ops, unsigned long iova,
return -ERANGE;
prot = arm_lpae_prot_to_pte(data, iommu_prot);
- ret = __arm_lpae_map(data, iova, paddr, size, prot, lvl, ptep);
+ ret = __arm_lpae_map(data, iova, paddr, size, prot, lvl, ptep, gfp);
/*
* Synchronise all PTE updates for the new mapping before there's
* a chance for anything to kick off a table walk for the new iova.
diff --git a/drivers/iommu/ipmmu-vmsa.c b/drivers/iommu/ipmmu-vmsa.c
index 310cf09..391d7f1 100644
--- a/drivers/iommu/ipmmu-vmsa.c
+++ b/drivers/iommu/ipmmu-vmsa.c
@@ -687,7 +687,7 @@ static int ipmmu_map(struct iommu_domain *io_domain, unsigned long iova,
if (!domain)
return -ENODEV;
- return domain->iop->map(domain->iop, iova, paddr, size, prot);
+ return domain->iop->map(domain->iop, iova, paddr, size, prot, gfp);
}
static size_t ipmmu_unmap(struct iommu_domain *io_domain, unsigned long iova,
diff --git a/drivers/iommu/msm_iommu.c b/drivers/iommu/msm_iommu.c
index 94a6df1..f3057f9 100644
--- a/drivers/iommu/msm_iommu.c
+++ b/drivers/iommu/msm_iommu.c
@@ -511,7 +511,7 @@ static int msm_iommu_map(struct iommu_domain *domain, unsigned long iova,
int ret;
spin_lock_irqsave(&priv->pgtlock, flags);
- ret = priv->iop->map(priv->iop, iova, pa, len, prot);
+ ret = priv->iop->map(priv->iop, iova, pa, len, prot, GFP_ATOMIC);
spin_unlock_irqrestore(&priv->pgtlock, flags);
return ret;
diff --git a/drivers/iommu/mtk_iommu.c b/drivers/iommu/mtk_iommu.c
index 5f4d6df..1593801 100644
--- a/drivers/iommu/mtk_iommu.c
+++ b/drivers/iommu/mtk_iommu.c
@@ -397,7 +397,7 @@ static int mtk_iommu_map(struct iommu_domain *domain, unsigned long iova,
paddr |= BIT_ULL(32);
/* Synchronize with the tlb_lock */
- return dom->iop->map(dom->iop, iova, paddr, size, prot);
+ return dom->iop->map(dom->iop, iova, paddr, size, prot, gfp);
}
static size_t mtk_iommu_unmap(struct iommu_domain *domain,
diff --git a/drivers/iommu/qcom_iommu.c b/drivers/iommu/qcom_iommu.c
index 5b3b270..2c4c5d7 100644
--- a/drivers/iommu/qcom_iommu.c
+++ b/drivers/iommu/qcom_iommu.c
@@ -441,7 +441,7 @@ static int qcom_iommu_map(struct iommu_domain *domain, unsigned long iova,
return -ENODEV;
spin_lock_irqsave(&qcom_domain->pgtbl_lock, flags);
- ret = ops->map(ops, iova, paddr, size, prot);
+ ret = ops->map(ops, iova, paddr, size, prot, GFP_ATOMIC);
spin_unlock_irqrestore(&qcom_domain->pgtbl_lock, flags);
return ret;
}
diff --git a/include/linux/io-pgtable.h b/include/linux/io-pgtable.h
index 53d53c6..23285ba 100644
--- a/include/linux/io-pgtable.h
+++ b/include/linux/io-pgtable.h
@@ -155,7 +155,7 @@ struct io_pgtable_cfg {
*/
struct io_pgtable_ops {
int (*map)(struct io_pgtable_ops *ops, unsigned long iova,
- phys_addr_t paddr, size_t size, int prot);
+ phys_addr_t paddr, size_t size, int prot, gfp_t gfp);
size_t (*unmap)(struct io_pgtable_ops *ops, unsigned long iova,
size_t size, struct iommu_iotlb_gather *gather);
phys_addr_t (*iova_to_phys)(struct io_pgtable_ops *ops,
--
1.8.3.1
_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH 2/2] iommu: Add gfp parameter to io_pgtable_ops->map()
@ 2020-06-08 3:38 ` Baolin Wang
0 siblings, 0 replies; 12+ messages in thread
From: Baolin Wang @ 2020-06-08 3:38 UTC (permalink / raw)
To: joro, will, robin.murphy, agross, bjorn.andersson, matthias.bgg,
robdclark, robh, tomeu.vizoso, steven.price, alyssa.rosenzweig,
airlied, daniel
Cc: linux-arm-msm, linux-kernel, dri-devel, iommu, linux-mediatek,
baolin.wang, linux-arm-kernel
Now the ARM page tables are always allocated by GFP_ATOMIC parameter,
but the iommu_ops->map() function has been added a gfp_t parameter by
commit 781ca2de89ba ("iommu: Add gfp parameter to iommu_ops::map"),
thus io_pgtable_ops->map() should use the gfp parameter passed from
iommu_ops->map() to allocate page pages, which can avoid wasting the
memory allocators atomic pools for some non-atomic contexts.
Signed-off-by: Baolin Wang <baolin.wang@linux.alibaba.com>
---
drivers/gpu/drm/panfrost/panfrost_mmu.c | 2 +-
drivers/iommu/arm-smmu-v3.c | 2 +-
drivers/iommu/arm-smmu.c | 2 +-
drivers/iommu/io-pgtable-arm-v7s.c | 10 +++++-----
drivers/iommu/io-pgtable-arm.c | 10 +++++-----
drivers/iommu/ipmmu-vmsa.c | 2 +-
drivers/iommu/msm_iommu.c | 2 +-
drivers/iommu/mtk_iommu.c | 2 +-
drivers/iommu/qcom_iommu.c | 2 +-
include/linux/io-pgtable.h | 2 +-
10 files changed, 18 insertions(+), 18 deletions(-)
diff --git a/drivers/gpu/drm/panfrost/panfrost_mmu.c b/drivers/gpu/drm/panfrost/panfrost_mmu.c
index ed28aeb..5a39eee 100644
--- a/drivers/gpu/drm/panfrost/panfrost_mmu.c
+++ b/drivers/gpu/drm/panfrost/panfrost_mmu.c
@@ -262,7 +262,7 @@ static int mmu_map_sg(struct panfrost_device *pfdev, struct panfrost_mmu *mmu,
while (len) {
size_t pgsize = get_pgsize(iova | paddr, len);
- ops->map(ops, iova, paddr, pgsize, prot);
+ ops->map(ops, iova, paddr, pgsize, prot, GFP_KERNEL);
iova += pgsize;
paddr += pgsize;
len -= pgsize;
diff --git a/drivers/iommu/arm-smmu-v3.c b/drivers/iommu/arm-smmu-v3.c
index 8250873..433b680 100644
--- a/drivers/iommu/arm-smmu-v3.c
+++ b/drivers/iommu/arm-smmu-v3.c
@@ -2845,7 +2845,7 @@ static int arm_smmu_map(struct iommu_domain *domain, unsigned long iova,
if (!ops)
return -ENODEV;
- return ops->map(ops, iova, paddr, size, prot);
+ return ops->map(ops, iova, paddr, size, prot, gfp);
}
static size_t arm_smmu_unmap(struct iommu_domain *domain, unsigned long iova,
diff --git a/drivers/iommu/arm-smmu.c b/drivers/iommu/arm-smmu.c
index a6a5796..bf640aa 100644
--- a/drivers/iommu/arm-smmu.c
+++ b/drivers/iommu/arm-smmu.c
@@ -1237,7 +1237,7 @@ static int arm_smmu_map(struct iommu_domain *domain, unsigned long iova,
return -ENODEV;
arm_smmu_rpm_get(smmu);
- ret = ops->map(ops, iova, paddr, size, prot);
+ ret = ops->map(ops, iova, paddr, size, prot, gfp);
arm_smmu_rpm_put(smmu);
return ret;
diff --git a/drivers/iommu/io-pgtable-arm-v7s.c b/drivers/iommu/io-pgtable-arm-v7s.c
index 4272fe4..ebbe2c5 100644
--- a/drivers/iommu/io-pgtable-arm-v7s.c
+++ b/drivers/iommu/io-pgtable-arm-v7s.c
@@ -470,7 +470,7 @@ static arm_v7s_iopte arm_v7s_install_table(arm_v7s_iopte *table,
static int __arm_v7s_map(struct arm_v7s_io_pgtable *data, unsigned long iova,
phys_addr_t paddr, size_t size, int prot,
- int lvl, arm_v7s_iopte *ptep)
+ int lvl, arm_v7s_iopte *ptep, gfp_t gfp)
{
struct io_pgtable_cfg *cfg = &data->iop.cfg;
arm_v7s_iopte pte, *cptep;
@@ -491,7 +491,7 @@ static int __arm_v7s_map(struct arm_v7s_io_pgtable *data, unsigned long iova,
/* Grab a pointer to the next level */
pte = READ_ONCE(*ptep);
if (!pte) {
- cptep = __arm_v7s_alloc_table(lvl + 1, GFP_ATOMIC, data);
+ cptep = __arm_v7s_alloc_table(lvl + 1, gfp, data);
if (!cptep)
return -ENOMEM;
@@ -512,11 +512,11 @@ static int __arm_v7s_map(struct arm_v7s_io_pgtable *data, unsigned long iova,
}
/* Rinse, repeat */
- return __arm_v7s_map(data, iova, paddr, size, prot, lvl + 1, cptep);
+ return __arm_v7s_map(data, iova, paddr, size, prot, lvl + 1, cptep, gfp);
}
static int arm_v7s_map(struct io_pgtable_ops *ops, unsigned long iova,
- phys_addr_t paddr, size_t size, int prot)
+ phys_addr_t paddr, size_t size, int prot, gfp_t gfp)
{
struct arm_v7s_io_pgtable *data = io_pgtable_ops_to_data(ops);
struct io_pgtable *iop = &data->iop;
@@ -530,7 +530,7 @@ static int arm_v7s_map(struct io_pgtable_ops *ops, unsigned long iova,
paddr >= (1ULL << data->iop.cfg.oas)))
return -ERANGE;
- ret = __arm_v7s_map(data, iova, paddr, size, prot, 1, data->pgd);
+ ret = __arm_v7s_map(data, iova, paddr, size, prot, 1, data->pgd, gfp);
/*
* Synchronise all PTE updates for the new mapping before there's
* a chance for anything to kick off a table walk for the new iova.
diff --git a/drivers/iommu/io-pgtable-arm.c b/drivers/iommu/io-pgtable-arm.c
index 04fbd4b..3ced132 100644
--- a/drivers/iommu/io-pgtable-arm.c
+++ b/drivers/iommu/io-pgtable-arm.c
@@ -355,7 +355,7 @@ static arm_lpae_iopte arm_lpae_install_table(arm_lpae_iopte *table,
static int __arm_lpae_map(struct arm_lpae_io_pgtable *data, unsigned long iova,
phys_addr_t paddr, size_t size, arm_lpae_iopte prot,
- int lvl, arm_lpae_iopte *ptep)
+ int lvl, arm_lpae_iopte *ptep, gfp_t gfp)
{
arm_lpae_iopte *cptep, pte;
size_t block_size = ARM_LPAE_BLOCK_SIZE(lvl, data);
@@ -376,7 +376,7 @@ static int __arm_lpae_map(struct arm_lpae_io_pgtable *data, unsigned long iova,
/* Grab a pointer to the next level */
pte = READ_ONCE(*ptep);
if (!pte) {
- cptep = __arm_lpae_alloc_pages(tblsz, GFP_ATOMIC, cfg);
+ cptep = __arm_lpae_alloc_pages(tblsz, gfp, cfg);
if (!cptep)
return -ENOMEM;
@@ -396,7 +396,7 @@ static int __arm_lpae_map(struct arm_lpae_io_pgtable *data, unsigned long iova,
}
/* Rinse, repeat */
- return __arm_lpae_map(data, iova, paddr, size, prot, lvl + 1, cptep);
+ return __arm_lpae_map(data, iova, paddr, size, prot, lvl + 1, cptep, gfp);
}
static arm_lpae_iopte arm_lpae_prot_to_pte(struct arm_lpae_io_pgtable *data,
@@ -461,7 +461,7 @@ static arm_lpae_iopte arm_lpae_prot_to_pte(struct arm_lpae_io_pgtable *data,
}
static int arm_lpae_map(struct io_pgtable_ops *ops, unsigned long iova,
- phys_addr_t paddr, size_t size, int iommu_prot)
+ phys_addr_t paddr, size_t size, int iommu_prot, gfp_t gfp)
{
struct arm_lpae_io_pgtable *data = io_pgtable_ops_to_data(ops);
struct io_pgtable_cfg *cfg = &data->iop.cfg;
@@ -483,7 +483,7 @@ static int arm_lpae_map(struct io_pgtable_ops *ops, unsigned long iova,
return -ERANGE;
prot = arm_lpae_prot_to_pte(data, iommu_prot);
- ret = __arm_lpae_map(data, iova, paddr, size, prot, lvl, ptep);
+ ret = __arm_lpae_map(data, iova, paddr, size, prot, lvl, ptep, gfp);
/*
* Synchronise all PTE updates for the new mapping before there's
* a chance for anything to kick off a table walk for the new iova.
diff --git a/drivers/iommu/ipmmu-vmsa.c b/drivers/iommu/ipmmu-vmsa.c
index 310cf09..391d7f1 100644
--- a/drivers/iommu/ipmmu-vmsa.c
+++ b/drivers/iommu/ipmmu-vmsa.c
@@ -687,7 +687,7 @@ static int ipmmu_map(struct iommu_domain *io_domain, unsigned long iova,
if (!domain)
return -ENODEV;
- return domain->iop->map(domain->iop, iova, paddr, size, prot);
+ return domain->iop->map(domain->iop, iova, paddr, size, prot, gfp);
}
static size_t ipmmu_unmap(struct iommu_domain *io_domain, unsigned long iova,
diff --git a/drivers/iommu/msm_iommu.c b/drivers/iommu/msm_iommu.c
index 94a6df1..f3057f9 100644
--- a/drivers/iommu/msm_iommu.c
+++ b/drivers/iommu/msm_iommu.c
@@ -511,7 +511,7 @@ static int msm_iommu_map(struct iommu_domain *domain, unsigned long iova,
int ret;
spin_lock_irqsave(&priv->pgtlock, flags);
- ret = priv->iop->map(priv->iop, iova, pa, len, prot);
+ ret = priv->iop->map(priv->iop, iova, pa, len, prot, GFP_ATOMIC);
spin_unlock_irqrestore(&priv->pgtlock, flags);
return ret;
diff --git a/drivers/iommu/mtk_iommu.c b/drivers/iommu/mtk_iommu.c
index 5f4d6df..1593801 100644
--- a/drivers/iommu/mtk_iommu.c
+++ b/drivers/iommu/mtk_iommu.c
@@ -397,7 +397,7 @@ static int mtk_iommu_map(struct iommu_domain *domain, unsigned long iova,
paddr |= BIT_ULL(32);
/* Synchronize with the tlb_lock */
- return dom->iop->map(dom->iop, iova, paddr, size, prot);
+ return dom->iop->map(dom->iop, iova, paddr, size, prot, gfp);
}
static size_t mtk_iommu_unmap(struct iommu_domain *domain,
diff --git a/drivers/iommu/qcom_iommu.c b/drivers/iommu/qcom_iommu.c
index 5b3b270..2c4c5d7 100644
--- a/drivers/iommu/qcom_iommu.c
+++ b/drivers/iommu/qcom_iommu.c
@@ -441,7 +441,7 @@ static int qcom_iommu_map(struct iommu_domain *domain, unsigned long iova,
return -ENODEV;
spin_lock_irqsave(&qcom_domain->pgtbl_lock, flags);
- ret = ops->map(ops, iova, paddr, size, prot);
+ ret = ops->map(ops, iova, paddr, size, prot, GFP_ATOMIC);
spin_unlock_irqrestore(&qcom_domain->pgtbl_lock, flags);
return ret;
}
diff --git a/include/linux/io-pgtable.h b/include/linux/io-pgtable.h
index 53d53c6..23285ba 100644
--- a/include/linux/io-pgtable.h
+++ b/include/linux/io-pgtable.h
@@ -155,7 +155,7 @@ struct io_pgtable_cfg {
*/
struct io_pgtable_ops {
int (*map)(struct io_pgtable_ops *ops, unsigned long iova,
- phys_addr_t paddr, size_t size, int prot);
+ phys_addr_t paddr, size_t size, int prot, gfp_t gfp);
size_t (*unmap)(struct io_pgtable_ops *ops, unsigned long iova,
size_t size, struct iommu_iotlb_gather *gather);
phys_addr_t (*iova_to_phys)(struct io_pgtable_ops *ops,
--
1.8.3.1
_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH 2/2] iommu: Add gfp parameter to io_pgtable_ops->map()
@ 2020-06-08 3:38 ` Baolin Wang
0 siblings, 0 replies; 12+ messages in thread
From: Baolin Wang @ 2020-06-08 3:38 UTC (permalink / raw)
To: joro, will, robin.murphy, agross, bjorn.andersson, matthias.bgg,
robdclark, robh, tomeu.vizoso, steven.price, alyssa.rosenzweig,
airlied, daniel
Cc: linux-arm-msm, linux-kernel, dri-devel, iommu, linux-mediatek,
baolin.wang, linux-arm-kernel
Now the ARM page tables are always allocated by GFP_ATOMIC parameter,
but the iommu_ops->map() function has been added a gfp_t parameter by
commit 781ca2de89ba ("iommu: Add gfp parameter to iommu_ops::map"),
thus io_pgtable_ops->map() should use the gfp parameter passed from
iommu_ops->map() to allocate page pages, which can avoid wasting the
memory allocators atomic pools for some non-atomic contexts.
Signed-off-by: Baolin Wang <baolin.wang@linux.alibaba.com>
---
drivers/gpu/drm/panfrost/panfrost_mmu.c | 2 +-
drivers/iommu/arm-smmu-v3.c | 2 +-
drivers/iommu/arm-smmu.c | 2 +-
drivers/iommu/io-pgtable-arm-v7s.c | 10 +++++-----
drivers/iommu/io-pgtable-arm.c | 10 +++++-----
drivers/iommu/ipmmu-vmsa.c | 2 +-
drivers/iommu/msm_iommu.c | 2 +-
drivers/iommu/mtk_iommu.c | 2 +-
drivers/iommu/qcom_iommu.c | 2 +-
include/linux/io-pgtable.h | 2 +-
10 files changed, 18 insertions(+), 18 deletions(-)
diff --git a/drivers/gpu/drm/panfrost/panfrost_mmu.c b/drivers/gpu/drm/panfrost/panfrost_mmu.c
index ed28aeb..5a39eee 100644
--- a/drivers/gpu/drm/panfrost/panfrost_mmu.c
+++ b/drivers/gpu/drm/panfrost/panfrost_mmu.c
@@ -262,7 +262,7 @@ static int mmu_map_sg(struct panfrost_device *pfdev, struct panfrost_mmu *mmu,
while (len) {
size_t pgsize = get_pgsize(iova | paddr, len);
- ops->map(ops, iova, paddr, pgsize, prot);
+ ops->map(ops, iova, paddr, pgsize, prot, GFP_KERNEL);
iova += pgsize;
paddr += pgsize;
len -= pgsize;
diff --git a/drivers/iommu/arm-smmu-v3.c b/drivers/iommu/arm-smmu-v3.c
index 8250873..433b680 100644
--- a/drivers/iommu/arm-smmu-v3.c
+++ b/drivers/iommu/arm-smmu-v3.c
@@ -2845,7 +2845,7 @@ static int arm_smmu_map(struct iommu_domain *domain, unsigned long iova,
if (!ops)
return -ENODEV;
- return ops->map(ops, iova, paddr, size, prot);
+ return ops->map(ops, iova, paddr, size, prot, gfp);
}
static size_t arm_smmu_unmap(struct iommu_domain *domain, unsigned long iova,
diff --git a/drivers/iommu/arm-smmu.c b/drivers/iommu/arm-smmu.c
index a6a5796..bf640aa 100644
--- a/drivers/iommu/arm-smmu.c
+++ b/drivers/iommu/arm-smmu.c
@@ -1237,7 +1237,7 @@ static int arm_smmu_map(struct iommu_domain *domain, unsigned long iova,
return -ENODEV;
arm_smmu_rpm_get(smmu);
- ret = ops->map(ops, iova, paddr, size, prot);
+ ret = ops->map(ops, iova, paddr, size, prot, gfp);
arm_smmu_rpm_put(smmu);
return ret;
diff --git a/drivers/iommu/io-pgtable-arm-v7s.c b/drivers/iommu/io-pgtable-arm-v7s.c
index 4272fe4..ebbe2c5 100644
--- a/drivers/iommu/io-pgtable-arm-v7s.c
+++ b/drivers/iommu/io-pgtable-arm-v7s.c
@@ -470,7 +470,7 @@ static arm_v7s_iopte arm_v7s_install_table(arm_v7s_iopte *table,
static int __arm_v7s_map(struct arm_v7s_io_pgtable *data, unsigned long iova,
phys_addr_t paddr, size_t size, int prot,
- int lvl, arm_v7s_iopte *ptep)
+ int lvl, arm_v7s_iopte *ptep, gfp_t gfp)
{
struct io_pgtable_cfg *cfg = &data->iop.cfg;
arm_v7s_iopte pte, *cptep;
@@ -491,7 +491,7 @@ static int __arm_v7s_map(struct arm_v7s_io_pgtable *data, unsigned long iova,
/* Grab a pointer to the next level */
pte = READ_ONCE(*ptep);
if (!pte) {
- cptep = __arm_v7s_alloc_table(lvl + 1, GFP_ATOMIC, data);
+ cptep = __arm_v7s_alloc_table(lvl + 1, gfp, data);
if (!cptep)
return -ENOMEM;
@@ -512,11 +512,11 @@ static int __arm_v7s_map(struct arm_v7s_io_pgtable *data, unsigned long iova,
}
/* Rinse, repeat */
- return __arm_v7s_map(data, iova, paddr, size, prot, lvl + 1, cptep);
+ return __arm_v7s_map(data, iova, paddr, size, prot, lvl + 1, cptep, gfp);
}
static int arm_v7s_map(struct io_pgtable_ops *ops, unsigned long iova,
- phys_addr_t paddr, size_t size, int prot)
+ phys_addr_t paddr, size_t size, int prot, gfp_t gfp)
{
struct arm_v7s_io_pgtable *data = io_pgtable_ops_to_data(ops);
struct io_pgtable *iop = &data->iop;
@@ -530,7 +530,7 @@ static int arm_v7s_map(struct io_pgtable_ops *ops, unsigned long iova,
paddr >= (1ULL << data->iop.cfg.oas)))
return -ERANGE;
- ret = __arm_v7s_map(data, iova, paddr, size, prot, 1, data->pgd);
+ ret = __arm_v7s_map(data, iova, paddr, size, prot, 1, data->pgd, gfp);
/*
* Synchronise all PTE updates for the new mapping before there's
* a chance for anything to kick off a table walk for the new iova.
diff --git a/drivers/iommu/io-pgtable-arm.c b/drivers/iommu/io-pgtable-arm.c
index 04fbd4b..3ced132 100644
--- a/drivers/iommu/io-pgtable-arm.c
+++ b/drivers/iommu/io-pgtable-arm.c
@@ -355,7 +355,7 @@ static arm_lpae_iopte arm_lpae_install_table(arm_lpae_iopte *table,
static int __arm_lpae_map(struct arm_lpae_io_pgtable *data, unsigned long iova,
phys_addr_t paddr, size_t size, arm_lpae_iopte prot,
- int lvl, arm_lpae_iopte *ptep)
+ int lvl, arm_lpae_iopte *ptep, gfp_t gfp)
{
arm_lpae_iopte *cptep, pte;
size_t block_size = ARM_LPAE_BLOCK_SIZE(lvl, data);
@@ -376,7 +376,7 @@ static int __arm_lpae_map(struct arm_lpae_io_pgtable *data, unsigned long iova,
/* Grab a pointer to the next level */
pte = READ_ONCE(*ptep);
if (!pte) {
- cptep = __arm_lpae_alloc_pages(tblsz, GFP_ATOMIC, cfg);
+ cptep = __arm_lpae_alloc_pages(tblsz, gfp, cfg);
if (!cptep)
return -ENOMEM;
@@ -396,7 +396,7 @@ static int __arm_lpae_map(struct arm_lpae_io_pgtable *data, unsigned long iova,
}
/* Rinse, repeat */
- return __arm_lpae_map(data, iova, paddr, size, prot, lvl + 1, cptep);
+ return __arm_lpae_map(data, iova, paddr, size, prot, lvl + 1, cptep, gfp);
}
static arm_lpae_iopte arm_lpae_prot_to_pte(struct arm_lpae_io_pgtable *data,
@@ -461,7 +461,7 @@ static arm_lpae_iopte arm_lpae_prot_to_pte(struct arm_lpae_io_pgtable *data,
}
static int arm_lpae_map(struct io_pgtable_ops *ops, unsigned long iova,
- phys_addr_t paddr, size_t size, int iommu_prot)
+ phys_addr_t paddr, size_t size, int iommu_prot, gfp_t gfp)
{
struct arm_lpae_io_pgtable *data = io_pgtable_ops_to_data(ops);
struct io_pgtable_cfg *cfg = &data->iop.cfg;
@@ -483,7 +483,7 @@ static int arm_lpae_map(struct io_pgtable_ops *ops, unsigned long iova,
return -ERANGE;
prot = arm_lpae_prot_to_pte(data, iommu_prot);
- ret = __arm_lpae_map(data, iova, paddr, size, prot, lvl, ptep);
+ ret = __arm_lpae_map(data, iova, paddr, size, prot, lvl, ptep, gfp);
/*
* Synchronise all PTE updates for the new mapping before there's
* a chance for anything to kick off a table walk for the new iova.
diff --git a/drivers/iommu/ipmmu-vmsa.c b/drivers/iommu/ipmmu-vmsa.c
index 310cf09..391d7f1 100644
--- a/drivers/iommu/ipmmu-vmsa.c
+++ b/drivers/iommu/ipmmu-vmsa.c
@@ -687,7 +687,7 @@ static int ipmmu_map(struct iommu_domain *io_domain, unsigned long iova,
if (!domain)
return -ENODEV;
- return domain->iop->map(domain->iop, iova, paddr, size, prot);
+ return domain->iop->map(domain->iop, iova, paddr, size, prot, gfp);
}
static size_t ipmmu_unmap(struct iommu_domain *io_domain, unsigned long iova,
diff --git a/drivers/iommu/msm_iommu.c b/drivers/iommu/msm_iommu.c
index 94a6df1..f3057f9 100644
--- a/drivers/iommu/msm_iommu.c
+++ b/drivers/iommu/msm_iommu.c
@@ -511,7 +511,7 @@ static int msm_iommu_map(struct iommu_domain *domain, unsigned long iova,
int ret;
spin_lock_irqsave(&priv->pgtlock, flags);
- ret = priv->iop->map(priv->iop, iova, pa, len, prot);
+ ret = priv->iop->map(priv->iop, iova, pa, len, prot, GFP_ATOMIC);
spin_unlock_irqrestore(&priv->pgtlock, flags);
return ret;
diff --git a/drivers/iommu/mtk_iommu.c b/drivers/iommu/mtk_iommu.c
index 5f4d6df..1593801 100644
--- a/drivers/iommu/mtk_iommu.c
+++ b/drivers/iommu/mtk_iommu.c
@@ -397,7 +397,7 @@ static int mtk_iommu_map(struct iommu_domain *domain, unsigned long iova,
paddr |= BIT_ULL(32);
/* Synchronize with the tlb_lock */
- return dom->iop->map(dom->iop, iova, paddr, size, prot);
+ return dom->iop->map(dom->iop, iova, paddr, size, prot, gfp);
}
static size_t mtk_iommu_unmap(struct iommu_domain *domain,
diff --git a/drivers/iommu/qcom_iommu.c b/drivers/iommu/qcom_iommu.c
index 5b3b270..2c4c5d7 100644
--- a/drivers/iommu/qcom_iommu.c
+++ b/drivers/iommu/qcom_iommu.c
@@ -441,7 +441,7 @@ static int qcom_iommu_map(struct iommu_domain *domain, unsigned long iova,
return -ENODEV;
spin_lock_irqsave(&qcom_domain->pgtbl_lock, flags);
- ret = ops->map(ops, iova, paddr, size, prot);
+ ret = ops->map(ops, iova, paddr, size, prot, GFP_ATOMIC);
spin_unlock_irqrestore(&qcom_domain->pgtbl_lock, flags);
return ret;
}
diff --git a/include/linux/io-pgtable.h b/include/linux/io-pgtable.h
index 53d53c6..23285ba 100644
--- a/include/linux/io-pgtable.h
+++ b/include/linux/io-pgtable.h
@@ -155,7 +155,7 @@ struct io_pgtable_cfg {
*/
struct io_pgtable_ops {
int (*map)(struct io_pgtable_ops *ops, unsigned long iova,
- phys_addr_t paddr, size_t size, int prot);
+ phys_addr_t paddr, size_t size, int prot, gfp_t gfp);
size_t (*unmap)(struct io_pgtable_ops *ops, unsigned long iova,
size_t size, struct iommu_iotlb_gather *gather);
phys_addr_t (*iova_to_phys)(struct io_pgtable_ops *ops,
--
1.8.3.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH 2/2] iommu: Add gfp parameter to io_pgtable_ops->map()
@ 2020-06-08 3:38 ` Baolin Wang
0 siblings, 0 replies; 12+ messages in thread
From: Baolin Wang @ 2020-06-08 3:38 UTC (permalink / raw)
To: joro, will, robin.murphy, agross, bjorn.andersson, matthias.bgg,
robdclark, robh, tomeu.vizoso, steven.price, alyssa.rosenzweig,
airlied, daniel
Cc: linux-arm-msm, linux-kernel, dri-devel, iommu, linux-mediatek,
baolin.wang, linux-arm-kernel
Now the ARM page tables are always allocated by GFP_ATOMIC parameter,
but the iommu_ops->map() function has been added a gfp_t parameter by
commit 781ca2de89ba ("iommu: Add gfp parameter to iommu_ops::map"),
thus io_pgtable_ops->map() should use the gfp parameter passed from
iommu_ops->map() to allocate page pages, which can avoid wasting the
memory allocators atomic pools for some non-atomic contexts.
Signed-off-by: Baolin Wang <baolin.wang@linux.alibaba.com>
---
drivers/gpu/drm/panfrost/panfrost_mmu.c | 2 +-
drivers/iommu/arm-smmu-v3.c | 2 +-
drivers/iommu/arm-smmu.c | 2 +-
drivers/iommu/io-pgtable-arm-v7s.c | 10 +++++-----
drivers/iommu/io-pgtable-arm.c | 10 +++++-----
drivers/iommu/ipmmu-vmsa.c | 2 +-
drivers/iommu/msm_iommu.c | 2 +-
drivers/iommu/mtk_iommu.c | 2 +-
drivers/iommu/qcom_iommu.c | 2 +-
include/linux/io-pgtable.h | 2 +-
10 files changed, 18 insertions(+), 18 deletions(-)
diff --git a/drivers/gpu/drm/panfrost/panfrost_mmu.c b/drivers/gpu/drm/panfrost/panfrost_mmu.c
index ed28aeb..5a39eee 100644
--- a/drivers/gpu/drm/panfrost/panfrost_mmu.c
+++ b/drivers/gpu/drm/panfrost/panfrost_mmu.c
@@ -262,7 +262,7 @@ static int mmu_map_sg(struct panfrost_device *pfdev, struct panfrost_mmu *mmu,
while (len) {
size_t pgsize = get_pgsize(iova | paddr, len);
- ops->map(ops, iova, paddr, pgsize, prot);
+ ops->map(ops, iova, paddr, pgsize, prot, GFP_KERNEL);
iova += pgsize;
paddr += pgsize;
len -= pgsize;
diff --git a/drivers/iommu/arm-smmu-v3.c b/drivers/iommu/arm-smmu-v3.c
index 8250873..433b680 100644
--- a/drivers/iommu/arm-smmu-v3.c
+++ b/drivers/iommu/arm-smmu-v3.c
@@ -2845,7 +2845,7 @@ static int arm_smmu_map(struct iommu_domain *domain, unsigned long iova,
if (!ops)
return -ENODEV;
- return ops->map(ops, iova, paddr, size, prot);
+ return ops->map(ops, iova, paddr, size, prot, gfp);
}
static size_t arm_smmu_unmap(struct iommu_domain *domain, unsigned long iova,
diff --git a/drivers/iommu/arm-smmu.c b/drivers/iommu/arm-smmu.c
index a6a5796..bf640aa 100644
--- a/drivers/iommu/arm-smmu.c
+++ b/drivers/iommu/arm-smmu.c
@@ -1237,7 +1237,7 @@ static int arm_smmu_map(struct iommu_domain *domain, unsigned long iova,
return -ENODEV;
arm_smmu_rpm_get(smmu);
- ret = ops->map(ops, iova, paddr, size, prot);
+ ret = ops->map(ops, iova, paddr, size, prot, gfp);
arm_smmu_rpm_put(smmu);
return ret;
diff --git a/drivers/iommu/io-pgtable-arm-v7s.c b/drivers/iommu/io-pgtable-arm-v7s.c
index 4272fe4..ebbe2c5 100644
--- a/drivers/iommu/io-pgtable-arm-v7s.c
+++ b/drivers/iommu/io-pgtable-arm-v7s.c
@@ -470,7 +470,7 @@ static arm_v7s_iopte arm_v7s_install_table(arm_v7s_iopte *table,
static int __arm_v7s_map(struct arm_v7s_io_pgtable *data, unsigned long iova,
phys_addr_t paddr, size_t size, int prot,
- int lvl, arm_v7s_iopte *ptep)
+ int lvl, arm_v7s_iopte *ptep, gfp_t gfp)
{
struct io_pgtable_cfg *cfg = &data->iop.cfg;
arm_v7s_iopte pte, *cptep;
@@ -491,7 +491,7 @@ static int __arm_v7s_map(struct arm_v7s_io_pgtable *data, unsigned long iova,
/* Grab a pointer to the next level */
pte = READ_ONCE(*ptep);
if (!pte) {
- cptep = __arm_v7s_alloc_table(lvl + 1, GFP_ATOMIC, data);
+ cptep = __arm_v7s_alloc_table(lvl + 1, gfp, data);
if (!cptep)
return -ENOMEM;
@@ -512,11 +512,11 @@ static int __arm_v7s_map(struct arm_v7s_io_pgtable *data, unsigned long iova,
}
/* Rinse, repeat */
- return __arm_v7s_map(data, iova, paddr, size, prot, lvl + 1, cptep);
+ return __arm_v7s_map(data, iova, paddr, size, prot, lvl + 1, cptep, gfp);
}
static int arm_v7s_map(struct io_pgtable_ops *ops, unsigned long iova,
- phys_addr_t paddr, size_t size, int prot)
+ phys_addr_t paddr, size_t size, int prot, gfp_t gfp)
{
struct arm_v7s_io_pgtable *data = io_pgtable_ops_to_data(ops);
struct io_pgtable *iop = &data->iop;
@@ -530,7 +530,7 @@ static int arm_v7s_map(struct io_pgtable_ops *ops, unsigned long iova,
paddr >= (1ULL << data->iop.cfg.oas)))
return -ERANGE;
- ret = __arm_v7s_map(data, iova, paddr, size, prot, 1, data->pgd);
+ ret = __arm_v7s_map(data, iova, paddr, size, prot, 1, data->pgd, gfp);
/*
* Synchronise all PTE updates for the new mapping before there's
* a chance for anything to kick off a table walk for the new iova.
diff --git a/drivers/iommu/io-pgtable-arm.c b/drivers/iommu/io-pgtable-arm.c
index 04fbd4b..3ced132 100644
--- a/drivers/iommu/io-pgtable-arm.c
+++ b/drivers/iommu/io-pgtable-arm.c
@@ -355,7 +355,7 @@ static arm_lpae_iopte arm_lpae_install_table(arm_lpae_iopte *table,
static int __arm_lpae_map(struct arm_lpae_io_pgtable *data, unsigned long iova,
phys_addr_t paddr, size_t size, arm_lpae_iopte prot,
- int lvl, arm_lpae_iopte *ptep)
+ int lvl, arm_lpae_iopte *ptep, gfp_t gfp)
{
arm_lpae_iopte *cptep, pte;
size_t block_size = ARM_LPAE_BLOCK_SIZE(lvl, data);
@@ -376,7 +376,7 @@ static int __arm_lpae_map(struct arm_lpae_io_pgtable *data, unsigned long iova,
/* Grab a pointer to the next level */
pte = READ_ONCE(*ptep);
if (!pte) {
- cptep = __arm_lpae_alloc_pages(tblsz, GFP_ATOMIC, cfg);
+ cptep = __arm_lpae_alloc_pages(tblsz, gfp, cfg);
if (!cptep)
return -ENOMEM;
@@ -396,7 +396,7 @@ static int __arm_lpae_map(struct arm_lpae_io_pgtable *data, unsigned long iova,
}
/* Rinse, repeat */
- return __arm_lpae_map(data, iova, paddr, size, prot, lvl + 1, cptep);
+ return __arm_lpae_map(data, iova, paddr, size, prot, lvl + 1, cptep, gfp);
}
static arm_lpae_iopte arm_lpae_prot_to_pte(struct arm_lpae_io_pgtable *data,
@@ -461,7 +461,7 @@ static arm_lpae_iopte arm_lpae_prot_to_pte(struct arm_lpae_io_pgtable *data,
}
static int arm_lpae_map(struct io_pgtable_ops *ops, unsigned long iova,
- phys_addr_t paddr, size_t size, int iommu_prot)
+ phys_addr_t paddr, size_t size, int iommu_prot, gfp_t gfp)
{
struct arm_lpae_io_pgtable *data = io_pgtable_ops_to_data(ops);
struct io_pgtable_cfg *cfg = &data->iop.cfg;
@@ -483,7 +483,7 @@ static int arm_lpae_map(struct io_pgtable_ops *ops, unsigned long iova,
return -ERANGE;
prot = arm_lpae_prot_to_pte(data, iommu_prot);
- ret = __arm_lpae_map(data, iova, paddr, size, prot, lvl, ptep);
+ ret = __arm_lpae_map(data, iova, paddr, size, prot, lvl, ptep, gfp);
/*
* Synchronise all PTE updates for the new mapping before there's
* a chance for anything to kick off a table walk for the new iova.
diff --git a/drivers/iommu/ipmmu-vmsa.c b/drivers/iommu/ipmmu-vmsa.c
index 310cf09..391d7f1 100644
--- a/drivers/iommu/ipmmu-vmsa.c
+++ b/drivers/iommu/ipmmu-vmsa.c
@@ -687,7 +687,7 @@ static int ipmmu_map(struct iommu_domain *io_domain, unsigned long iova,
if (!domain)
return -ENODEV;
- return domain->iop->map(domain->iop, iova, paddr, size, prot);
+ return domain->iop->map(domain->iop, iova, paddr, size, prot, gfp);
}
static size_t ipmmu_unmap(struct iommu_domain *io_domain, unsigned long iova,
diff --git a/drivers/iommu/msm_iommu.c b/drivers/iommu/msm_iommu.c
index 94a6df1..f3057f9 100644
--- a/drivers/iommu/msm_iommu.c
+++ b/drivers/iommu/msm_iommu.c
@@ -511,7 +511,7 @@ static int msm_iommu_map(struct iommu_domain *domain, unsigned long iova,
int ret;
spin_lock_irqsave(&priv->pgtlock, flags);
- ret = priv->iop->map(priv->iop, iova, pa, len, prot);
+ ret = priv->iop->map(priv->iop, iova, pa, len, prot, GFP_ATOMIC);
spin_unlock_irqrestore(&priv->pgtlock, flags);
return ret;
diff --git a/drivers/iommu/mtk_iommu.c b/drivers/iommu/mtk_iommu.c
index 5f4d6df..1593801 100644
--- a/drivers/iommu/mtk_iommu.c
+++ b/drivers/iommu/mtk_iommu.c
@@ -397,7 +397,7 @@ static int mtk_iommu_map(struct iommu_domain *domain, unsigned long iova,
paddr |= BIT_ULL(32);
/* Synchronize with the tlb_lock */
- return dom->iop->map(dom->iop, iova, paddr, size, prot);
+ return dom->iop->map(dom->iop, iova, paddr, size, prot, gfp);
}
static size_t mtk_iommu_unmap(struct iommu_domain *domain,
diff --git a/drivers/iommu/qcom_iommu.c b/drivers/iommu/qcom_iommu.c
index 5b3b270..2c4c5d7 100644
--- a/drivers/iommu/qcom_iommu.c
+++ b/drivers/iommu/qcom_iommu.c
@@ -441,7 +441,7 @@ static int qcom_iommu_map(struct iommu_domain *domain, unsigned long iova,
return -ENODEV;
spin_lock_irqsave(&qcom_domain->pgtbl_lock, flags);
- ret = ops->map(ops, iova, paddr, size, prot);
+ ret = ops->map(ops, iova, paddr, size, prot, GFP_ATOMIC);
spin_unlock_irqrestore(&qcom_domain->pgtbl_lock, flags);
return ret;
}
diff --git a/include/linux/io-pgtable.h b/include/linux/io-pgtable.h
index 53d53c6..23285ba 100644
--- a/include/linux/io-pgtable.h
+++ b/include/linux/io-pgtable.h
@@ -155,7 +155,7 @@ struct io_pgtable_cfg {
*/
struct io_pgtable_ops {
int (*map)(struct io_pgtable_ops *ops, unsigned long iova,
- phys_addr_t paddr, size_t size, int prot);
+ phys_addr_t paddr, size_t size, int prot, gfp_t gfp);
size_t (*unmap)(struct io_pgtable_ops *ops, unsigned long iova,
size_t size, struct iommu_iotlb_gather *gather);
phys_addr_t (*iova_to_phys)(struct io_pgtable_ops *ops,
--
1.8.3.1
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply related [flat|nested] 12+ messages in thread
end of thread, other threads:[~2020-06-08 21:07 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-08 7:16 [PATCH 2/2] iommu: Add gfp parameter to io_pgtable_ops->map() kernel test robot
-- strict thread matches above, loose matches on Subject: below --
2020-06-08 7:34 kernel test robot
2020-06-08 7:55 ` Xia, Hui
2020-06-08 3:38 [PATCH 0/2] Some improvements for iommu Baolin Wang
2020-06-08 3:38 ` [PATCH 2/2] iommu: Add gfp parameter to io_pgtable_ops->map() Baolin Wang
2020-06-08 3:38 ` Baolin Wang
2020-06-08 3:38 ` Baolin Wang
2020-06-08 3:38 ` Baolin Wang
2020-06-08 3:38 ` Baolin Wang
2020-06-08 15:16 ` kernel test robot
2020-06-08 15:17 ` kernel test robot
2020-06-08 15:36 ` kernel test robot
2020-06-08 21:07 ` kernel test robot
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.