Skip to content

Commit b3c942b

Browse files
committed
drm/amdgpu/gfx10,11: use memcpy_to/fromio for MQDs
Since they were moved to VRAM, we need to use the IO variants of memcpy. Fixes: 1cfb4d6 ("drm/amdgpu: put MQDs in VRAM") Reviewed-by: Christian König <christian.koenig@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
1 parent f7aeee7 commit b3c942b

2 files changed

Lines changed: 12 additions & 12 deletions

File tree

drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6465,7 +6465,7 @@ static int gfx_v10_0_gfx_init_queue(struct amdgpu_ring *ring)
64656465
nv_grbm_select(adev, 0, 0, 0, 0);
64666466
mutex_unlock(&adev->srbm_mutex);
64676467
if (adev->gfx.me.mqd_backup[mqd_idx])
6468-
memcpy(adev->gfx.me.mqd_backup[mqd_idx], mqd, sizeof(*mqd));
6468+
memcpy_fromio(adev->gfx.me.mqd_backup[mqd_idx], mqd, sizeof(*mqd));
64696469
} else {
64706470
mutex_lock(&adev->srbm_mutex);
64716471
nv_grbm_select(adev, ring->me, ring->pipe, ring->queue, 0);
@@ -6476,7 +6476,7 @@ static int gfx_v10_0_gfx_init_queue(struct amdgpu_ring *ring)
64766476
mutex_unlock(&adev->srbm_mutex);
64776477
/* restore mqd with the backup copy */
64786478
if (adev->gfx.me.mqd_backup[mqd_idx])
6479-
memcpy(mqd, adev->gfx.me.mqd_backup[mqd_idx], sizeof(*mqd));
6479+
memcpy_toio(mqd, adev->gfx.me.mqd_backup[mqd_idx], sizeof(*mqd));
64806480
/* reset the ring */
64816481
ring->wptr = 0;
64826482
*ring->wptr_cpu_addr = 0;
@@ -6750,7 +6750,7 @@ static int gfx_v10_0_kiq_init_queue(struct amdgpu_ring *ring)
67506750
if (amdgpu_in_reset(adev)) { /* for GPU_RESET case */
67516751
/* reset MQD to a clean status */
67526752
if (adev->gfx.kiq[0].mqd_backup)
6753-
memcpy(mqd, adev->gfx.kiq[0].mqd_backup, sizeof(*mqd));
6753+
memcpy_toio(mqd, adev->gfx.kiq[0].mqd_backup, sizeof(*mqd));
67546754

67556755
/* reset ring buffer */
67566756
ring->wptr = 0;
@@ -6773,7 +6773,7 @@ static int gfx_v10_0_kiq_init_queue(struct amdgpu_ring *ring)
67736773
mutex_unlock(&adev->srbm_mutex);
67746774

67756775
if (adev->gfx.kiq[0].mqd_backup)
6776-
memcpy(adev->gfx.kiq[0].mqd_backup, mqd, sizeof(*mqd));
6776+
memcpy_fromio(adev->gfx.kiq[0].mqd_backup, mqd, sizeof(*mqd));
67776777
}
67786778

67796779
return 0;
@@ -6794,11 +6794,11 @@ static int gfx_v10_0_kcq_init_queue(struct amdgpu_ring *ring)
67946794
mutex_unlock(&adev->srbm_mutex);
67956795

67966796
if (adev->gfx.mec.mqd_backup[mqd_idx])
6797-
memcpy(adev->gfx.mec.mqd_backup[mqd_idx], mqd, sizeof(*mqd));
6797+
memcpy_fromio(adev->gfx.mec.mqd_backup[mqd_idx], mqd, sizeof(*mqd));
67986798
} else {
67996799
/* restore MQD to a clean status */
68006800
if (adev->gfx.mec.mqd_backup[mqd_idx])
6801-
memcpy(mqd, adev->gfx.mec.mqd_backup[mqd_idx], sizeof(*mqd));
6801+
memcpy_toio(mqd, adev->gfx.mec.mqd_backup[mqd_idx], sizeof(*mqd));
68026802
/* reset ring buffer */
68036803
ring->wptr = 0;
68046804
atomic64_set((atomic64_t *)ring->wptr_cpu_addr, 0);

drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3715,11 +3715,11 @@ static int gfx_v11_0_gfx_init_queue(struct amdgpu_ring *ring)
37153715
soc21_grbm_select(adev, 0, 0, 0, 0);
37163716
mutex_unlock(&adev->srbm_mutex);
37173717
if (adev->gfx.me.mqd_backup[mqd_idx])
3718-
memcpy(adev->gfx.me.mqd_backup[mqd_idx], mqd, sizeof(*mqd));
3718+
memcpy_fromio(adev->gfx.me.mqd_backup[mqd_idx], mqd, sizeof(*mqd));
37193719
} else {
37203720
/* restore mqd with the backup copy */
37213721
if (adev->gfx.me.mqd_backup[mqd_idx])
3722-
memcpy(mqd, adev->gfx.me.mqd_backup[mqd_idx], sizeof(*mqd));
3722+
memcpy_toio(mqd, adev->gfx.me.mqd_backup[mqd_idx], sizeof(*mqd));
37233723
/* reset the ring */
37243724
ring->wptr = 0;
37253725
*ring->wptr_cpu_addr = 0;
@@ -4008,7 +4008,7 @@ static int gfx_v11_0_kiq_init_queue(struct amdgpu_ring *ring)
40084008
if (amdgpu_in_reset(adev)) { /* for GPU_RESET case */
40094009
/* reset MQD to a clean status */
40104010
if (adev->gfx.kiq[0].mqd_backup)
4011-
memcpy(mqd, adev->gfx.kiq[0].mqd_backup, sizeof(*mqd));
4011+
memcpy_toio(mqd, adev->gfx.kiq[0].mqd_backup, sizeof(*mqd));
40124012

40134013
/* reset ring buffer */
40144014
ring->wptr = 0;
@@ -4031,7 +4031,7 @@ static int gfx_v11_0_kiq_init_queue(struct amdgpu_ring *ring)
40314031
mutex_unlock(&adev->srbm_mutex);
40324032

40334033
if (adev->gfx.kiq[0].mqd_backup)
4034-
memcpy(adev->gfx.kiq[0].mqd_backup, mqd, sizeof(*mqd));
4034+
memcpy_fromio(adev->gfx.kiq[0].mqd_backup, mqd, sizeof(*mqd));
40354035
}
40364036

40374037
return 0;
@@ -4052,11 +4052,11 @@ static int gfx_v11_0_kcq_init_queue(struct amdgpu_ring *ring)
40524052
mutex_unlock(&adev->srbm_mutex);
40534053

40544054
if (adev->gfx.mec.mqd_backup[mqd_idx])
4055-
memcpy(adev->gfx.mec.mqd_backup[mqd_idx], mqd, sizeof(*mqd));
4055+
memcpy_fromio(adev->gfx.mec.mqd_backup[mqd_idx], mqd, sizeof(*mqd));
40564056
} else {
40574057
/* restore MQD to a clean status */
40584058
if (adev->gfx.mec.mqd_backup[mqd_idx])
4059-
memcpy(mqd, adev->gfx.mec.mqd_backup[mqd_idx], sizeof(*mqd));
4059+
memcpy_toio(mqd, adev->gfx.mec.mqd_backup[mqd_idx], sizeof(*mqd));
40604060
/* reset ring buffer */
40614061
ring->wptr = 0;
40624062
atomic64_set((atomic64_t *)ring->wptr_cpu_addr, 0);

0 commit comments

Comments
 (0)