From: kernel test robot <lkp@intel.com>
To: Thierry Reding <treding@nvidia.com>
Cc: kbuild-all@lists.01.org,
Linux Memory Management List <linux-mm@kvack.org>
Subject: [linux-next:master 6351/6649] drivers/gpu/host1x/job.c:141:30: error: variable 'domain' set but not used
Date: Thu, 7 Oct 2021 23:35:23 +0800 [thread overview]
Message-ID: <202110072313.7rob1lC3-lkp@intel.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 11594 bytes --]
tree: https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head: f8dc23b3dc0cc5b32dfd0c446e59377736d073a7
commit: df77f99c7c11f1cfc37ba071e7efa3ad0d46d986 [6351/6649] drm/tegra: Implement correct DMA-BUF semantics
config: arm-allyesconfig (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
# https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/?id=df77f99c7c11f1cfc37ba071e7efa3ad0d46d986
git remote add linux-next https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
git fetch --no-tags linux-next master
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@intel.com>
All errors (new ones prefixed by >>):
drivers/gpu/host1x/job.c: In function 'pin_job':
>> drivers/gpu/host1x/job.c:141:30: error: variable 'domain' set but not used [-Werror=unused-but-set-variable]
141 | struct iommu_domain *domain;
| ^~~~~~
cc1: all warnings being treated as errors
vim +/domain +141 drivers/gpu/host1x/job.c
e902585fc8b639 Mikko Perttunen 2021-06-10 134
404bfb78daf3be Mikko Perttunen 2016-12-14 135 static unsigned int pin_job(struct host1x *host, struct host1x_job *job)
6579324a41cc41 Terje Bergstrom 2013-03-22 136 {
df77f99c7c11f1 Thierry Reding 2021-09-09 137 unsigned long mask = HOST1X_RELOC_READ | HOST1X_RELOC_WRITE;
af1cbfb9bf0fe0 Thierry Reding 2019-10-28 138 struct host1x_client *client = job->client;
af1cbfb9bf0fe0 Thierry Reding 2019-10-28 139 struct device *dev = client->dev;
fd323e9ef0a191 Dmitry Osipenko 2020-06-29 140 struct host1x_job_gather *g;
273da5a046965c Thierry Reding 2020-02-04 @141 struct iommu_domain *domain;
6579324a41cc41 Terje Bergstrom 2013-03-22 142 unsigned int i;
404bfb78daf3be Mikko Perttunen 2016-12-14 143 int err;
6579324a41cc41 Terje Bergstrom 2013-03-22 144
273da5a046965c Thierry Reding 2020-02-04 145 domain = iommu_get_domain_for_dev(dev);
6579324a41cc41 Terje Bergstrom 2013-03-22 146 job->num_unpins = 0;
6579324a41cc41 Terje Bergstrom 2013-03-22 147
6579324a41cc41 Terje Bergstrom 2013-03-22 148 for (i = 0; i < job->num_relocs; i++) {
06490bb99e1840 Thierry Reding 2018-05-16 149 struct host1x_reloc *reloc = &job->relocs[i];
df77f99c7c11f1 Thierry Reding 2021-09-09 150 enum dma_data_direction direction;
df77f99c7c11f1 Thierry Reding 2021-09-09 151 struct host1x_bo_mapping *map;
df77f99c7c11f1 Thierry Reding 2021-09-09 152 struct host1x_bo *bo;
6579324a41cc41 Terje Bergstrom 2013-03-22 153
961e3beae3b29a Thierry Reding 2014-06-10 154 reloc->target.bo = host1x_bo_get(reloc->target.bo);
404bfb78daf3be Mikko Perttunen 2016-12-14 155 if (!reloc->target.bo) {
404bfb78daf3be Mikko Perttunen 2016-12-14 156 err = -EINVAL;
6579324a41cc41 Terje Bergstrom 2013-03-22 157 goto unpin;
404bfb78daf3be Mikko Perttunen 2016-12-14 158 }
6579324a41cc41 Terje Bergstrom 2013-03-22 159
df77f99c7c11f1 Thierry Reding 2021-09-09 160 bo = reloc->target.bo;
af1cbfb9bf0fe0 Thierry Reding 2019-10-28 161
af1cbfb9bf0fe0 Thierry Reding 2019-10-28 162 switch (reloc->flags & mask) {
af1cbfb9bf0fe0 Thierry Reding 2019-10-28 163 case HOST1X_RELOC_READ:
df77f99c7c11f1 Thierry Reding 2021-09-09 164 direction = DMA_TO_DEVICE;
af1cbfb9bf0fe0 Thierry Reding 2019-10-28 165 break;
af1cbfb9bf0fe0 Thierry Reding 2019-10-28 166
af1cbfb9bf0fe0 Thierry Reding 2019-10-28 167 case HOST1X_RELOC_WRITE:
df77f99c7c11f1 Thierry Reding 2021-09-09 168 direction = DMA_FROM_DEVICE;
af1cbfb9bf0fe0 Thierry Reding 2019-10-28 169 break;
af1cbfb9bf0fe0 Thierry Reding 2019-10-28 170
af1cbfb9bf0fe0 Thierry Reding 2019-10-28 171 case HOST1X_RELOC_READ | HOST1X_RELOC_WRITE:
df77f99c7c11f1 Thierry Reding 2021-09-09 172 direction = DMA_BIDIRECTIONAL;
af1cbfb9bf0fe0 Thierry Reding 2019-10-28 173 break;
af1cbfb9bf0fe0 Thierry Reding 2019-10-28 174
af1cbfb9bf0fe0 Thierry Reding 2019-10-28 175 default:
af1cbfb9bf0fe0 Thierry Reding 2019-10-28 176 err = -EINVAL;
af1cbfb9bf0fe0 Thierry Reding 2019-10-28 177 goto unpin;
af1cbfb9bf0fe0 Thierry Reding 2019-10-28 178 }
af1cbfb9bf0fe0 Thierry Reding 2019-10-28 179
df77f99c7c11f1 Thierry Reding 2021-09-09 180 map = host1x_bo_pin(dev, bo, direction);
df77f99c7c11f1 Thierry Reding 2021-09-09 181 if (IS_ERR(map)) {
df77f99c7c11f1 Thierry Reding 2021-09-09 182 err = PTR_ERR(map);
af1cbfb9bf0fe0 Thierry Reding 2019-10-28 183 goto unpin;
df77f99c7c11f1 Thierry Reding 2021-09-09 184 }
af1cbfb9bf0fe0 Thierry Reding 2019-10-28 185
df77f99c7c11f1 Thierry Reding 2021-09-09 186 /*
df77f99c7c11f1 Thierry Reding 2021-09-09 187 * host1x clients are generally not able to do scatter-gather themselves, so fail
df77f99c7c11f1 Thierry Reding 2021-09-09 188 * if the buffer is discontiguous and we fail to map its SG table to a single
df77f99c7c11f1 Thierry Reding 2021-09-09 189 * contiguous chunk of I/O virtual memory.
df77f99c7c11f1 Thierry Reding 2021-09-09 190 */
df77f99c7c11f1 Thierry Reding 2021-09-09 191 if (map->chunks > 1) {
df77f99c7c11f1 Thierry Reding 2021-09-09 192 err = -EINVAL;
df77f99c7c11f1 Thierry Reding 2021-09-09 193 goto unpin;
af1cbfb9bf0fe0 Thierry Reding 2019-10-28 194 }
af1cbfb9bf0fe0 Thierry Reding 2019-10-28 195
df77f99c7c11f1 Thierry Reding 2021-09-09 196 job->addr_phys[job->num_unpins] = map->phys;
df77f99c7c11f1 Thierry Reding 2021-09-09 197 job->unpins[job->num_unpins].map = map;
6579324a41cc41 Terje Bergstrom 2013-03-22 198 job->num_unpins++;
6579324a41cc41 Terje Bergstrom 2013-03-22 199 }
6579324a41cc41 Terje Bergstrom 2013-03-22 200
26c8de5e5dea6f Dmitry Osipenko 2020-06-29 201 /*
26c8de5e5dea6f Dmitry Osipenko 2020-06-29 202 * We will copy gathers BO content later, so there is no need to
26c8de5e5dea6f Dmitry Osipenko 2020-06-29 203 * hold and pin them.
26c8de5e5dea6f Dmitry Osipenko 2020-06-29 204 */
0fddaa85d66140 Mikko Perttunen 2021-06-10 205 if (job->enable_firewall)
26c8de5e5dea6f Dmitry Osipenko 2020-06-29 206 return 0;
26c8de5e5dea6f Dmitry Osipenko 2020-06-29 207
e902585fc8b639 Mikko Perttunen 2021-06-10 208 for (i = 0; i < job->num_cmds; i++) {
df77f99c7c11f1 Thierry Reding 2021-09-09 209 struct host1x_bo_mapping *map;
404bfb78daf3be Mikko Perttunen 2016-12-14 210 size_t gather_size = 0;
404bfb78daf3be Mikko Perttunen 2016-12-14 211 struct scatterlist *sg;
404bfb78daf3be Mikko Perttunen 2016-12-14 212 unsigned long shift;
404bfb78daf3be Mikko Perttunen 2016-12-14 213 struct iova *alloc;
404bfb78daf3be Mikko Perttunen 2016-12-14 214 unsigned int j;
6579324a41cc41 Terje Bergstrom 2013-03-22 215
e902585fc8b639 Mikko Perttunen 2021-06-10 216 if (job->cmds[i].is_wait)
e902585fc8b639 Mikko Perttunen 2021-06-10 217 continue;
e902585fc8b639 Mikko Perttunen 2021-06-10 218
e902585fc8b639 Mikko Perttunen 2021-06-10 219 g = &job->cmds[i].gather;
e902585fc8b639 Mikko Perttunen 2021-06-10 220
6579324a41cc41 Terje Bergstrom 2013-03-22 221 g->bo = host1x_bo_get(g->bo);
404bfb78daf3be Mikko Perttunen 2016-12-14 222 if (!g->bo) {
404bfb78daf3be Mikko Perttunen 2016-12-14 223 err = -EINVAL;
6579324a41cc41 Terje Bergstrom 2013-03-22 224 goto unpin;
404bfb78daf3be Mikko Perttunen 2016-12-14 225 }
6579324a41cc41 Terje Bergstrom 2013-03-22 226
df77f99c7c11f1 Thierry Reding 2021-09-09 227 map = host1x_bo_pin(host->dev, g->bo, DMA_TO_DEVICE);
df77f99c7c11f1 Thierry Reding 2021-09-09 228 if (IS_ERR(map)) {
df77f99c7c11f1 Thierry Reding 2021-09-09 229 err = PTR_ERR(map);
df77f99c7c11f1 Thierry Reding 2021-09-09 230 goto unpin;
80327ce3d4edaa Thierry Reding 2019-10-28 231 }
404bfb78daf3be Mikko Perttunen 2016-12-14 232
26c8de5e5dea6f Dmitry Osipenko 2020-06-29 233 if (host->domain) {
df77f99c7c11f1 Thierry Reding 2021-09-09 234 for_each_sgtable_sg(map->sgt, sg, j)
404bfb78daf3be Mikko Perttunen 2016-12-14 235 gather_size += sg->length;
df77f99c7c11f1 Thierry Reding 2021-09-09 236
404bfb78daf3be Mikko Perttunen 2016-12-14 237 gather_size = iova_align(&host->iova, gather_size);
404bfb78daf3be Mikko Perttunen 2016-12-14 238
404bfb78daf3be Mikko Perttunen 2016-12-14 239 shift = iova_shift(&host->iova);
404bfb78daf3be Mikko Perttunen 2016-12-14 240 alloc = alloc_iova(&host->iova, gather_size >> shift,
404bfb78daf3be Mikko Perttunen 2016-12-14 241 host->iova_end >> shift, true);
404bfb78daf3be Mikko Perttunen 2016-12-14 242 if (!alloc) {
404bfb78daf3be Mikko Perttunen 2016-12-14 243 err = -ENOMEM;
fd323e9ef0a191 Dmitry Osipenko 2020-06-29 244 goto put;
404bfb78daf3be Mikko Perttunen 2016-12-14 245 }
404bfb78daf3be Mikko Perttunen 2016-12-14 246
df77f99c7c11f1 Thierry Reding 2021-09-09 247 err = iommu_map_sgtable(host->domain, iova_dma_addr(&host->iova, alloc),
df77f99c7c11f1 Thierry Reding 2021-09-09 248 map->sgt, IOMMU_READ);
404bfb78daf3be Mikko Perttunen 2016-12-14 249 if (err == 0) {
404bfb78daf3be Mikko Perttunen 2016-12-14 250 __free_iova(&host->iova, alloc);
404bfb78daf3be Mikko Perttunen 2016-12-14 251 err = -EINVAL;
fd323e9ef0a191 Dmitry Osipenko 2020-06-29 252 goto put;
404bfb78daf3be Mikko Perttunen 2016-12-14 253 }
6579324a41cc41 Terje Bergstrom 2013-03-22 254
df77f99c7c11f1 Thierry Reding 2021-09-09 255 map->phys = iova_dma_addr(&host->iova, alloc);
df77f99c7c11f1 Thierry Reding 2021-09-09 256 map->size = gather_size;
404bfb78daf3be Mikko Perttunen 2016-12-14 257 }
404bfb78daf3be Mikko Perttunen 2016-12-14 258
df77f99c7c11f1 Thierry Reding 2021-09-09 259 job->addr_phys[job->num_unpins] = map->phys;
df77f99c7c11f1 Thierry Reding 2021-09-09 260 job->unpins[job->num_unpins].map = map;
6579324a41cc41 Terje Bergstrom 2013-03-22 261 job->num_unpins++;
df77f99c7c11f1 Thierry Reding 2021-09-09 262
df77f99c7c11f1 Thierry Reding 2021-09-09 263 job->gather_addr_phys[i] = map->phys;
6579324a41cc41 Terje Bergstrom 2013-03-22 264 }
6579324a41cc41 Terje Bergstrom 2013-03-22 265
404bfb78daf3be Mikko Perttunen 2016-12-14 266 return 0;
6579324a41cc41 Terje Bergstrom 2013-03-22 267
fd323e9ef0a191 Dmitry Osipenko 2020-06-29 268 put:
fd323e9ef0a191 Dmitry Osipenko 2020-06-29 269 host1x_bo_put(g->bo);
6579324a41cc41 Terje Bergstrom 2013-03-22 270 unpin:
6579324a41cc41 Terje Bergstrom 2013-03-22 271 host1x_job_unpin(job);
404bfb78daf3be Mikko Perttunen 2016-12-14 272 return err;
6579324a41cc41 Terje Bergstrom 2013-03-22 273 }
6579324a41cc41 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@nvidia.com>
:::::: CC: Thierry Reding <treding@nvidia.com>
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 79219 bytes --]
reply other threads:[~2021-10-07 15:36 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=202110072313.7rob1lC3-lkp@intel.com \
--to=lkp@intel.com \
--cc=kbuild-all@lists.01.org \
--cc=linux-mm@kvack.org \
--cc=treding@nvidia.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox