[tegra-drm:drm/tegra/for-next 5/12] drivers/gpu/host1x/job.c:141:30: warning: variable 'domain' set but not used
kernel test robot
lkp at intel.com
Thu Oct 7 04:43:08 UTC 2021
tree: git://anongit.freedesktop.org/tegra/linux.git drm/tegra/for-next
head: 29e08b1e60b429c2bb30a1578db4a2db354d8a36
commit: df77f99c7c11f1cfc37ba071e7efa3ad0d46d986 [5/12] drm/tegra: Implement correct DMA-BUF semantics
config: arm-randconfig-c002-20211004 (attached as .config)
compiler: arm-linux-gnueabi-gcc (GCC) 11.2.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
git remote add tegra-drm git://anongit.freedesktop.org/tegra/linux.git
git fetch --no-tags tegra-drm drm/tegra/for-next
git checkout df77f99c7c11f1cfc37ba071e7efa3ad0d46d986
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross ARCH=arm
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp at intel.com>
All warnings (new ones prefixed by >>):
drivers/gpu/host1x/job.c: In function 'pin_job':
>> drivers/gpu/host1x/job.c:141:30: warning: variable 'domain' set but not used [-Wunused-but-set-variable]
141 | struct iommu_domain *domain;
| ^~~~~~
vim +/domain +141 drivers/gpu/host1x/job.c
e902585fc8b639f1 Mikko Perttunen 2021-06-10 134
404bfb78daf3beda Mikko Perttunen 2016-12-14 135 static unsigned int pin_job(struct host1x *host, struct host1x_job *job)
6579324a41cc4140 Terje Bergstrom 2013-03-22 136 {
df77f99c7c11f1cf Thierry Reding 2021-09-09 137 unsigned long mask = HOST1X_RELOC_READ | HOST1X_RELOC_WRITE;
af1cbfb9bf0fe079 Thierry Reding 2019-10-28 138 struct host1x_client *client = job->client;
af1cbfb9bf0fe079 Thierry Reding 2019-10-28 139 struct device *dev = client->dev;
fd323e9ef0a19112 Dmitry Osipenko 2020-06-29 140 struct host1x_job_gather *g;
273da5a046965ccf Thierry Reding 2020-02-04 @141 struct iommu_domain *domain;
6579324a41cc4140 Terje Bergstrom 2013-03-22 142 unsigned int i;
404bfb78daf3beda Mikko Perttunen 2016-12-14 143 int err;
6579324a41cc4140 Terje Bergstrom 2013-03-22 144
273da5a046965ccf Thierry Reding 2020-02-04 145 domain = iommu_get_domain_for_dev(dev);
6579324a41cc4140 Terje Bergstrom 2013-03-22 146 job->num_unpins = 0;
6579324a41cc4140 Terje Bergstrom 2013-03-22 147
6579324a41cc4140 Terje Bergstrom 2013-03-22 148 for (i = 0; i < job->num_relocs; i++) {
06490bb99e1840ab Thierry Reding 2018-05-16 149 struct host1x_reloc *reloc = &job->relocs[i];
df77f99c7c11f1cf Thierry Reding 2021-09-09 150 enum dma_data_direction direction;
df77f99c7c11f1cf Thierry Reding 2021-09-09 151 struct host1x_bo_mapping *map;
df77f99c7c11f1cf Thierry Reding 2021-09-09 152 struct host1x_bo *bo;
6579324a41cc4140 Terje Bergstrom 2013-03-22 153
961e3beae3b29ae9 Thierry Reding 2014-06-10 154 reloc->target.bo = host1x_bo_get(reloc->target.bo);
404bfb78daf3beda Mikko Perttunen 2016-12-14 155 if (!reloc->target.bo) {
404bfb78daf3beda Mikko Perttunen 2016-12-14 156 err = -EINVAL;
6579324a41cc4140 Terje Bergstrom 2013-03-22 157 goto unpin;
404bfb78daf3beda Mikko Perttunen 2016-12-14 158 }
6579324a41cc4140 Terje Bergstrom 2013-03-22 159
df77f99c7c11f1cf Thierry Reding 2021-09-09 160 bo = reloc->target.bo;
af1cbfb9bf0fe079 Thierry Reding 2019-10-28 161
af1cbfb9bf0fe079 Thierry Reding 2019-10-28 162 switch (reloc->flags & mask) {
af1cbfb9bf0fe079 Thierry Reding 2019-10-28 163 case HOST1X_RELOC_READ:
df77f99c7c11f1cf Thierry Reding 2021-09-09 164 direction = DMA_TO_DEVICE;
af1cbfb9bf0fe079 Thierry Reding 2019-10-28 165 break;
af1cbfb9bf0fe079 Thierry Reding 2019-10-28 166
af1cbfb9bf0fe079 Thierry Reding 2019-10-28 167 case HOST1X_RELOC_WRITE:
df77f99c7c11f1cf Thierry Reding 2021-09-09 168 direction = DMA_FROM_DEVICE;
af1cbfb9bf0fe079 Thierry Reding 2019-10-28 169 break;
af1cbfb9bf0fe079 Thierry Reding 2019-10-28 170
af1cbfb9bf0fe079 Thierry Reding 2019-10-28 171 case HOST1X_RELOC_READ | HOST1X_RELOC_WRITE:
df77f99c7c11f1cf Thierry Reding 2021-09-09 172 direction = DMA_BIDIRECTIONAL;
af1cbfb9bf0fe079 Thierry Reding 2019-10-28 173 break;
af1cbfb9bf0fe079 Thierry Reding 2019-10-28 174
af1cbfb9bf0fe079 Thierry Reding 2019-10-28 175 default:
af1cbfb9bf0fe079 Thierry Reding 2019-10-28 176 err = -EINVAL;
af1cbfb9bf0fe079 Thierry Reding 2019-10-28 177 goto unpin;
af1cbfb9bf0fe079 Thierry Reding 2019-10-28 178 }
af1cbfb9bf0fe079 Thierry Reding 2019-10-28 179
df77f99c7c11f1cf Thierry Reding 2021-09-09 180 map = host1x_bo_pin(dev, bo, direction);
df77f99c7c11f1cf Thierry Reding 2021-09-09 181 if (IS_ERR(map)) {
df77f99c7c11f1cf Thierry Reding 2021-09-09 182 err = PTR_ERR(map);
af1cbfb9bf0fe079 Thierry Reding 2019-10-28 183 goto unpin;
df77f99c7c11f1cf Thierry Reding 2021-09-09 184 }
af1cbfb9bf0fe079 Thierry Reding 2019-10-28 185
df77f99c7c11f1cf Thierry Reding 2021-09-09 186 /*
df77f99c7c11f1cf Thierry Reding 2021-09-09 187 * host1x clients are generally not able to do scatter-gather themselves, so fail
df77f99c7c11f1cf Thierry Reding 2021-09-09 188 * if the buffer is discontiguous and we fail to map its SG table to a single
df77f99c7c11f1cf Thierry Reding 2021-09-09 189 * contiguous chunk of I/O virtual memory.
df77f99c7c11f1cf Thierry Reding 2021-09-09 190 */
df77f99c7c11f1cf Thierry Reding 2021-09-09 191 if (map->chunks > 1) {
df77f99c7c11f1cf Thierry Reding 2021-09-09 192 err = -EINVAL;
df77f99c7c11f1cf Thierry Reding 2021-09-09 193 goto unpin;
af1cbfb9bf0fe079 Thierry Reding 2019-10-28 194 }
af1cbfb9bf0fe079 Thierry Reding 2019-10-28 195
df77f99c7c11f1cf Thierry Reding 2021-09-09 196 job->addr_phys[job->num_unpins] = map->phys;
df77f99c7c11f1cf Thierry Reding 2021-09-09 197 job->unpins[job->num_unpins].map = map;
6579324a41cc4140 Terje Bergstrom 2013-03-22 198 job->num_unpins++;
6579324a41cc4140 Terje Bergstrom 2013-03-22 199 }
6579324a41cc4140 Terje Bergstrom 2013-03-22 200
26c8de5e5dea6f42 Dmitry Osipenko 2020-06-29 201 /*
26c8de5e5dea6f42 Dmitry Osipenko 2020-06-29 202 * We will copy gathers BO content later, so there is no need to
26c8de5e5dea6f42 Dmitry Osipenko 2020-06-29 203 * hold and pin them.
26c8de5e5dea6f42 Dmitry Osipenko 2020-06-29 204 */
0fddaa85d6614046 Mikko Perttunen 2021-06-10 205 if (job->enable_firewall)
26c8de5e5dea6f42 Dmitry Osipenko 2020-06-29 206 return 0;
26c8de5e5dea6f42 Dmitry Osipenko 2020-06-29 207
e902585fc8b639f1 Mikko Perttunen 2021-06-10 208 for (i = 0; i < job->num_cmds; i++) {
df77f99c7c11f1cf Thierry Reding 2021-09-09 209 struct host1x_bo_mapping *map;
404bfb78daf3beda Mikko Perttunen 2016-12-14 210 size_t gather_size = 0;
404bfb78daf3beda Mikko Perttunen 2016-12-14 211 struct scatterlist *sg;
404bfb78daf3beda Mikko Perttunen 2016-12-14 212 unsigned long shift;
404bfb78daf3beda Mikko Perttunen 2016-12-14 213 struct iova *alloc;
404bfb78daf3beda Mikko Perttunen 2016-12-14 214 unsigned int j;
6579324a41cc4140 Terje Bergstrom 2013-03-22 215
e902585fc8b639f1 Mikko Perttunen 2021-06-10 216 if (job->cmds[i].is_wait)
e902585fc8b639f1 Mikko Perttunen 2021-06-10 217 continue;
e902585fc8b639f1 Mikko Perttunen 2021-06-10 218
e902585fc8b639f1 Mikko Perttunen 2021-06-10 219 g = &job->cmds[i].gather;
e902585fc8b639f1 Mikko Perttunen 2021-06-10 220
6579324a41cc4140 Terje Bergstrom 2013-03-22 221 g->bo = host1x_bo_get(g->bo);
404bfb78daf3beda Mikko Perttunen 2016-12-14 222 if (!g->bo) {
404bfb78daf3beda Mikko Perttunen 2016-12-14 223 err = -EINVAL;
6579324a41cc4140 Terje Bergstrom 2013-03-22 224 goto unpin;
404bfb78daf3beda Mikko Perttunen 2016-12-14 225 }
6579324a41cc4140 Terje Bergstrom 2013-03-22 226
df77f99c7c11f1cf Thierry Reding 2021-09-09 227 map = host1x_bo_pin(host->dev, g->bo, DMA_TO_DEVICE);
df77f99c7c11f1cf Thierry Reding 2021-09-09 228 if (IS_ERR(map)) {
df77f99c7c11f1cf Thierry Reding 2021-09-09 229 err = PTR_ERR(map);
df77f99c7c11f1cf Thierry Reding 2021-09-09 230 goto unpin;
80327ce3d4edaa9a Thierry Reding 2019-10-28 231 }
404bfb78daf3beda Mikko Perttunen 2016-12-14 232
26c8de5e5dea6f42 Dmitry Osipenko 2020-06-29 233 if (host->domain) {
df77f99c7c11f1cf Thierry Reding 2021-09-09 234 for_each_sgtable_sg(map->sgt, sg, j)
404bfb78daf3beda Mikko Perttunen 2016-12-14 235 gather_size += sg->length;
df77f99c7c11f1cf Thierry Reding 2021-09-09 236
404bfb78daf3beda Mikko Perttunen 2016-12-14 237 gather_size = iova_align(&host->iova, gather_size);
404bfb78daf3beda Mikko Perttunen 2016-12-14 238
404bfb78daf3beda Mikko Perttunen 2016-12-14 239 shift = iova_shift(&host->iova);
404bfb78daf3beda Mikko Perttunen 2016-12-14 240 alloc = alloc_iova(&host->iova, gather_size >> shift,
404bfb78daf3beda Mikko Perttunen 2016-12-14 241 host->iova_end >> shift, true);
404bfb78daf3beda Mikko Perttunen 2016-12-14 242 if (!alloc) {
404bfb78daf3beda Mikko Perttunen 2016-12-14 243 err = -ENOMEM;
fd323e9ef0a19112 Dmitry Osipenko 2020-06-29 244 goto put;
404bfb78daf3beda Mikko Perttunen 2016-12-14 245 }
404bfb78daf3beda Mikko Perttunen 2016-12-14 246
df77f99c7c11f1cf Thierry Reding 2021-09-09 247 err = iommu_map_sgtable(host->domain, iova_dma_addr(&host->iova, alloc),
df77f99c7c11f1cf Thierry Reding 2021-09-09 248 map->sgt, IOMMU_READ);
404bfb78daf3beda Mikko Perttunen 2016-12-14 249 if (err == 0) {
404bfb78daf3beda Mikko Perttunen 2016-12-14 250 __free_iova(&host->iova, alloc);
404bfb78daf3beda Mikko Perttunen 2016-12-14 251 err = -EINVAL;
fd323e9ef0a19112 Dmitry Osipenko 2020-06-29 252 goto put;
404bfb78daf3beda Mikko Perttunen 2016-12-14 253 }
6579324a41cc4140 Terje Bergstrom 2013-03-22 254
df77f99c7c11f1cf Thierry Reding 2021-09-09 255 map->phys = iova_dma_addr(&host->iova, alloc);
df77f99c7c11f1cf Thierry Reding 2021-09-09 256 map->size = gather_size;
404bfb78daf3beda Mikko Perttunen 2016-12-14 257 }
404bfb78daf3beda Mikko Perttunen 2016-12-14 258
df77f99c7c11f1cf Thierry Reding 2021-09-09 259 job->addr_phys[job->num_unpins] = map->phys;
df77f99c7c11f1cf Thierry Reding 2021-09-09 260 job->unpins[job->num_unpins].map = map;
6579324a41cc4140 Terje Bergstrom 2013-03-22 261 job->num_unpins++;
df77f99c7c11f1cf Thierry Reding 2021-09-09 262
df77f99c7c11f1cf Thierry Reding 2021-09-09 263 job->gather_addr_phys[i] = map->phys;
6579324a41cc4140 Terje Bergstrom 2013-03-22 264 }
6579324a41cc4140 Terje Bergstrom 2013-03-22 265
404bfb78daf3beda Mikko Perttunen 2016-12-14 266 return 0;
6579324a41cc4140 Terje Bergstrom 2013-03-22 267
fd323e9ef0a19112 Dmitry Osipenko 2020-06-29 268 put:
fd323e9ef0a19112 Dmitry Osipenko 2020-06-29 269 host1x_bo_put(g->bo);
6579324a41cc4140 Terje Bergstrom 2013-03-22 270 unpin:
6579324a41cc4140 Terje Bergstrom 2013-03-22 271 host1x_job_unpin(job);
404bfb78daf3beda Mikko Perttunen 2016-12-14 272 return err;
6579324a41cc4140 Terje Bergstrom 2013-03-22 273 }
6579324a41cc4140 Terje Bergstrom 2013-03-22 274
:::::: The code at line 141 was first introduced by commit
:::::: 273da5a046965ccf0ec79eb63f2d5173467e20fa drm/tegra: Reuse IOVA mapping where possible
:::::: TO: Thierry Reding <treding at nvidia.com>
:::::: CC: Thierry Reding <treding at nvidia.com>
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: .config.gz
Type: application/gzip
Size: 32700 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/dri-devel/attachments/20211007/937ae7dd/attachment-0001.gz>
More information about the dri-devel
mailing list