drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c:391:41: sparse: sparse: incorrect type in argument 1 (different address spaces)
From: kernel test robot
Date: Fri Sep 04 2026 - 20:53:04 EST
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 654ae5d73c05bd2943d65636ce6cd0aa46e62f18
commit: 1d8cfeb69daa863a70134b8ed6df8055c418a5b0 drm/amdgpu: Pack nested ucode_info struct
date: 5 weeks ago
config: i386-randconfig-063-20260904 (https://download.01.org/0day-ci/archive/20260905/202609050833.rJ9c0SND-lkp@xxxxxxxxx/config)
compiler: gcc-13 (Debian 13.3.0-16) 13.3.0
sparse: v0.6.5-rc1
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260905/202609050833.rJ9c0SND-lkp@xxxxxxxxx/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Fixes: 1d8cfeb69daa ("drm/amdgpu: Pack nested ucode_info struct")
| Reported-by: kernel test robot <lkp@xxxxxxxxx>
| Closes: https://lore.kernel.org/oe-kbuild-all/202609050833.rJ9c0SND-lkp@xxxxxxxxx/
sparse warnings: (new ones prefixed by >>)
>> drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c:391:41: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void volatile [noderef] __iomem * @@ got void *mqd_ptr @@
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c:391:41: sparse: expected void volatile [noderef] __iomem *
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c:391:41: sparse: got void *mqd_ptr
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c:397:41: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void volatile [noderef] __iomem * @@ got void *mqd_ptr @@
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c:397:41: sparse: expected void volatile [noderef] __iomem *
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c:397:41: sparse: got void *mqd_ptr
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c:1425:25: sparse: sparse: cast to restricted __le32
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c:1427:25: sparse: sparse: cast to restricted __le32
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c:1429:27: sparse: sparse: cast to restricted __le32
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c:1435:25: sparse: sparse: cast to restricted __le32
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c:1437:25: sparse: sparse: cast to restricted __le32
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c:1439:27: sparse: sparse: cast to restricted __le32
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c:1446:27: sparse: sparse: cast to restricted __le32
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c:1452:25: sparse: sparse: cast to restricted __le32
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c:1454:25: sparse: sparse: cast to restricted __le32
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c:1456:27: sparse: sparse: cast to restricted __le32
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c:1462:25: sparse: sparse: cast to restricted __le32
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c:1464:25: sparse: sparse: cast to restricted __le32
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c:1466:27: sparse: sparse: cast to restricted __le32
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c:1473:27: sparse: sparse: cast to restricted __le32
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c:1479:25: sparse: sparse: cast to restricted __le32
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c:1481:25: sparse: sparse: cast to restricted __le32
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c:1483:27: sparse: sparse: cast to restricted __le32
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c:1489:25: sparse: sparse: cast to restricted __le32
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c:1491:25: sparse: sparse: cast to restricted __le32
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c:1493:27: sparse: sparse: cast to restricted __le32
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c:1494:27: sparse: sparse: cast to restricted __le32
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c:1500:27: sparse: sparse: cast to restricted __le32
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c:1506:25: sparse: sparse: cast to restricted __le32
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c:1508:25: sparse: sparse: cast to restricted __le32
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c:1510:27: sparse: sparse: cast to restricted __le32
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c:1511:27: sparse: sparse: cast to restricted __le32
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c:1517:27: sparse: sparse: cast to restricted __le32
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c:1523:25: sparse: sparse: cast to restricted __le32
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c:1525:25: sparse: sparse: cast to restricted __le32
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c:1527:27: sparse: sparse: cast to restricted __le32
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c:1536:27: sparse: sparse: cast to restricted __le32
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c:2430:38: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void volatile [noderef] __iomem * @@ got void *cleaner_shader_cpu_ptr @@
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c:2430:38: sparse: expected void volatile [noderef] __iomem *
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c:2430:38: sparse: got void *cleaner_shader_cpu_ptr
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c:2783:25: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned int [usertype] @@ got restricted __le32 [usertype] @@
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c:2783:25: sparse: expected unsigned int [usertype]
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c:2783:25: sparse: got restricted __le32 [usertype]
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c:2784:25: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned int [usertype] @@ got restricted __le32 [usertype] @@
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c:2784:25: sparse: expected unsigned int [usertype]
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c:2784:25: sparse: got restricted __le32 [usertype]
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c:2786:25: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned int [usertype] @@ got restricted __le32 [usertype] @@
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c:2786:25: sparse: expected unsigned int [usertype]
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c:2786:25: sparse: got restricted __le32 [usertype]
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c:2787:25: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned int [usertype] @@ got restricted __le32 [usertype] @@
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c:2787:25: sparse: expected unsigned int [usertype]
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c:2787:25: sparse: got restricted __le32 [usertype]
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c:2788:25: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned int [usertype] @@ got restricted __le32 [usertype] @@
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c:2788:25: sparse: expected unsigned int [usertype]
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c:2788:25: sparse: got restricted __le32 [usertype]
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c:2812:49: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned int [usertype] @@ got restricted __le32 [usertype] @@
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c:2812:49: sparse: expected unsigned int [usertype]
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c:2812:49: sparse: got restricted __le32 [usertype]
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c:2813:49: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned int [usertype] @@ got restricted __le32 [usertype] @@
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c:2813:49: sparse: expected unsigned int [usertype]
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c:2813:49: sparse: got restricted __le32 [usertype]
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c:2816:57: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned int [usertype] @@ got restricted __le32 [usertype] @@
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c:2816:57: sparse: expected unsigned int [usertype]
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c:2816:57: sparse: got restricted __le32 [usertype]
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c:2832:25: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned int [usertype] @@ got restricted __le32 [usertype] @@
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c:2832:25: sparse: expected unsigned int [usertype]
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c:2832:25: sparse: got restricted __le32 [usertype]
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c:2833:25: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned int [usertype] @@ got restricted __le32 [usertype] @@
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c:2833:25: sparse: expected unsigned int [usertype]
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c:2833:25: sparse: got restricted __le32 [usertype]
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c:2835:25: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned int [usertype] @@ got restricted __le32 [usertype] @@
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c:2835:25: sparse: expected unsigned int [usertype]
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c:2835:25: sparse: got restricted __le32 [usertype]
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c:2836:25: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned int [usertype] @@ got restricted __le32 [usertype] @@
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c:2836:25: sparse: expected unsigned int [usertype]
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c:2836:25: sparse: got restricted __le32 [usertype]
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c:3015:25: sparse: sparse: cast to restricted __le32
vim +391 drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c
b9683c21f69b3d8 Alex Deucher 2017-06-07 380
b5ded0313519e7f Alex Deucher 2026-05-19 381 static void amdgpu_gfx_mqd_reset_restore(struct amdgpu_ring *ring)
a3cc79650141670 Alex Deucher 2026-05-19 382 {
a3cc79650141670 Alex Deucher 2026-05-19 383 struct amdgpu_device *adev = ring->adev;
a3cc79650141670 Alex Deucher 2026-05-19 384 int mqd_idx, mqd_size;
a3cc79650141670 Alex Deucher 2026-05-19 385
a3cc79650141670 Alex Deucher 2026-05-19 386 /* restore mqd with the backup copy */
a3cc79650141670 Alex Deucher 2026-05-19 387 if (ring->funcs->type == AMDGPU_RING_TYPE_COMPUTE) {
a3cc79650141670 Alex Deucher 2026-05-19 388 mqd_idx = ring - &adev->gfx.compute_ring[0];
a3cc79650141670 Alex Deucher 2026-05-19 389 mqd_size = adev->mqds[AMDGPU_HW_IP_COMPUTE].mqd_size;
a3cc79650141670 Alex Deucher 2026-05-19 390 if (adev->gfx.mec.mqd_backup[mqd_idx])
a3cc79650141670 Alex Deucher 2026-05-19 @391 memcpy_toio(ring->mqd_ptr, adev->gfx.mec.mqd_backup[mqd_idx], mqd_size);
a3cc79650141670 Alex Deucher 2026-05-19 392 } else if (ring->funcs->type == AMDGPU_RING_TYPE_GFX) {
a3cc79650141670 Alex Deucher 2026-05-19 393 mqd_size = adev->mqds[AMDGPU_HW_IP_GFX].mqd_size;
a3cc79650141670 Alex Deucher 2026-05-19 394 mqd_idx = ring - &adev->gfx.gfx_ring[0];
a3cc79650141670 Alex Deucher 2026-05-19 395
a3cc79650141670 Alex Deucher 2026-05-19 396 if (adev->gfx.me.mqd_backup[mqd_idx])
a3cc79650141670 Alex Deucher 2026-05-19 397 memcpy_toio(ring->mqd_ptr, adev->gfx.me.mqd_backup[mqd_idx], mqd_size);
a3cc79650141670 Alex Deucher 2026-05-19 398 }
a3cc79650141670 Alex Deucher 2026-05-19 399 /* reset the ring */
a3cc79650141670 Alex Deucher 2026-05-19 400 ring->wptr = 0;
a3cc79650141670 Alex Deucher 2026-05-19 401 atomic64_set((atomic64_t *)ring->wptr_cpu_addr, 0);
a3cc79650141670 Alex Deucher 2026-05-19 402 amdgpu_ring_clear_ring(ring);
a3cc79650141670 Alex Deucher 2026-05-19 403 }
a3cc79650141670 Alex Deucher 2026-05-19 404
:::::: The code at line 391 was first introduced by commit
:::::: a3cc79650141670f6db74f90e2d6c173144ace0a drm/amdgpu/gfx: add a helper for MQD restore
:::::: TO: Alex Deucher <alexander.deucher@xxxxxxx>
:::::: CC: Alex Deucher <alexander.deucher@xxxxxxx>
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki