drivers/gpu/drm/amd/amdgpu/amdgpu_device.c:192:16: sparse: sparse: incompatible types in comparison expression (different type sizes):

From: kernel test robot
Date: Wed Jun 17 2020 - 05:05:00 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 69119673bd50b176ded34032fadd41530fb5af21
commit: c12b84d6e0d70f1185e6daddfd12afb671791b6e drm/amdgpu: use the BAR if possible in amdgpu_device_vram_access v2
date: 4 months ago
config: x86_64-randconfig-s022-20200617 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-13) 9.3.0
reproduce:
# apt-get install sparse
# sparse version: v0.6.2-rc1-6-g78f577f8-dirty
git checkout c12b84d6e0d70f1185e6daddfd12afb671791b6e
# 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@xxxxxxxxx>


sparse warnings: (new ones prefixed by >>)

>> drivers/gpu/drm/amd/amdgpu/amdgpu_device.c:192:16: sparse: sparse: incompatible types in comparison expression (different type sizes):
>> drivers/gpu/drm/amd/amdgpu/amdgpu_device.c:192:16: sparse: unsigned long *
>> drivers/gpu/drm/amd/amdgpu/amdgpu_device.c:192:16: sparse: unsigned long long *
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c:442:39: sparse: sparse: cast removes address space '<asn:2>' of expression
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c:462:31: sparse: sparse: cast removes address space '<asn:2>' of expression
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c:1551:65: sparse: sparse: cast to restricted __le32
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c:1556:55: sparse: sparse: cast to restricted __le32
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c:1557:50: sparse: sparse: cast to restricted __le32
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c:1558:50: sparse: sparse: cast to restricted __le32
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c:1559:56: sparse: sparse: cast to restricted __le32
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c:1561:25: sparse: sparse: cast to restricted __le32
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c:1562:45: sparse: sparse: cast to restricted __le32
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c:1563:51: sparse: sparse: cast to restricted __le32
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c:1564:55: sparse: sparse: cast to restricted __le32
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c:1565:57: sparse: sparse: cast to restricted __le32
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c:1567:25: sparse: sparse: cast to restricted __le32
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c:1568:53: sparse: sparse: cast to restricted __le32
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c:1570:25: sparse: sparse: cast to restricted __le32
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c:1572:25: sparse: sparse: cast to restricted __le32
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c:1573:46: sparse: sparse: cast to restricted __le32
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c:1577:73: sparse: sparse: cast to restricted __le32
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c:1579:33: sparse: sparse: cast to restricted __le32
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c:1581:33: sparse: sparse: cast to restricted __le32
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c:1592:73: sparse: sparse: cast to restricted __le32

vim +192 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c

171
172 /**
173 * VRAM access helper functions.
174 *
175 * amdgpu_device_vram_access - read/write a buffer in vram
176 *
177 * @adev: amdgpu_device pointer
178 * @pos: offset of the buffer in vram
179 * @buf: virtual address of the buffer in system memory
180 * @size: read/write size, sizeof(@buf) must > @size
181 * @write: true - write to vram, otherwise - read from vram
182 */
183 void amdgpu_device_vram_access(struct amdgpu_device *adev, loff_t pos,
184 uint32_t *buf, size_t size, bool write)
185 {
186 unsigned long flags;
187 uint32_t hi = ~0;
188 uint64_t last;
189
190
191 #ifdef CONFIG_64BIT
> 192 last = min(pos + size, adev->gmc.visible_vram_size);
193 if (last > pos) {
194 void __iomem *addr = adev->mman.aper_base_kaddr + pos;
195 size_t count = last - pos;
196
197 if (write) {
198 memcpy_toio(addr, buf, count);
199 mb();
200 amdgpu_asic_flush_hdp(adev, NULL);
201 } else {
202 amdgpu_asic_invalidate_hdp(adev, NULL);
203 mb();
204 memcpy_fromio(buf, addr, count);
205 }
206
207 if (count == size)
208 return;
209
210 pos += count;
211 buf += count / 4;
212 size -= count;
213 }
214 #endif
215
216 spin_lock_irqsave(&adev->mmio_idx_lock, flags);
217 for (last = pos + size; pos < last; pos += 4) {
218 uint32_t tmp = pos >> 31;
219
220 WREG32_NO_KIQ(mmMM_INDEX, ((uint32_t)pos) | 0x80000000);
221 if (tmp != hi) {
222 WREG32_NO_KIQ(mmMM_INDEX_HI, tmp);
223 hi = tmp;
224 }
225 if (write)
226 WREG32_NO_KIQ(mmMM_DATA, *buf++);
227 else
228 *buf++ = RREG32_NO_KIQ(mmMM_DATA);
229 }
230 spin_unlock_irqrestore(&adev->mmio_idx_lock, flags);
231 }
232

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx

Attachment: .config.gz
Description: application/gzip