@@ -1211,7 +1211,7 @@ static int gfx_v9_0_ring_test_ib(struct amdgpu_ring *ring, long timeout)
12111211
12121212 gpu_addr = adev -> wb .gpu_addr + (index * 4 );
12131213 adev -> wb .wb [index ] = cpu_to_le32 (0xCAFEDEAD );
1214- memset (& ib , 0 , sizeof (ib ));
1214+ memset_io (& ib , 0 , sizeof (ib ));
12151215
12161216 r = amdgpu_ib_get (adev , NULL , 20 , AMDGPU_IB_POOL_DIRECT , & ib );
12171217 if (r )
@@ -1883,7 +1883,7 @@ static int gfx_v9_0_mec_init(struct amdgpu_device *adev)
18831883 return r ;
18841884 }
18851885
1886- memset (hpd , 0 , mec_hpd_size );
1886+ memset_io (hpd , 0 , mec_hpd_size );
18871887
18881888 amdgpu_bo_kunmap (adev -> gfx .mec .hpd_eop_obj );
18891889 amdgpu_bo_unreserve (adev -> gfx .mec .hpd_eop_obj );
@@ -1907,7 +1907,7 @@ static int gfx_v9_0_mec_init(struct amdgpu_device *adev)
19071907 return r ;
19081908 }
19091909
1910- memcpy (fw , fw_data , fw_size );
1910+ memcpy_toio (fw , fw_data , fw_size );
19111911
19121912 amdgpu_bo_kunmap (adev -> gfx .mec .mec_fw_obj );
19131913 amdgpu_bo_unreserve (adev -> gfx .mec .mec_fw_obj );
@@ -3470,7 +3470,7 @@ static void gfx_v9_0_kiq_setting(struct amdgpu_ring *ring)
34703470 WREG32_SOC15_RLC (GC , 0 , mmRLC_CP_SCHEDULERS , tmp );
34713471}
34723472
3473- static void gfx_v9_0_mqd_set_priority (struct amdgpu_ring * ring , struct v9_mqd * mqd )
3473+ static void gfx_v9_0_mqd_set_priority (struct amdgpu_ring * ring , volatile struct v9_mqd * mqd )
34743474{
34753475 struct amdgpu_device * adev = ring -> adev ;
34763476
@@ -3486,7 +3486,7 @@ static void gfx_v9_0_mqd_set_priority(struct amdgpu_ring *ring, struct v9_mqd *m
34863486static int gfx_v9_0_mqd_init (struct amdgpu_ring * ring )
34873487{
34883488 struct amdgpu_device * adev = ring -> adev ;
3489- struct v9_mqd * mqd = ring -> mqd_ptr ;
3489+ volatile struct v9_mqd * mqd = ring -> mqd_ptr ;
34903490 uint64_t hqd_gpu_addr , wb_gpu_addr , eop_base_addr ;
34913491 uint32_t tmp ;
34923492
@@ -3785,7 +3785,7 @@ static int gfx_v9_0_kiq_init_queue(struct amdgpu_ring *ring)
37853785 if (amdgpu_in_reset (adev ) && tmp_mqd -> cp_hqd_pq_control ){
37863786 /* for GPU_RESET case , reset MQD to a clean status */
37873787 if (adev -> gfx .kiq [0 ].mqd_backup )
3788- memcpy (mqd , adev -> gfx .kiq [0 ].mqd_backup , sizeof (struct v9_mqd_allocation ));
3788+ memcpy_toio (mqd , adev -> gfx .kiq [0 ].mqd_backup , sizeof (struct v9_mqd_allocation ));
37893789
37903790 /* reset ring buffer */
37913791 ring -> wptr = 0 ;
@@ -3797,7 +3797,7 @@ static int gfx_v9_0_kiq_init_queue(struct amdgpu_ring *ring)
37973797 soc15_grbm_select (adev , 0 , 0 , 0 , 0 , 0 );
37983798 mutex_unlock (& adev -> srbm_mutex );
37993799 } else {
3800- memset ((void * )mqd , 0 , sizeof (struct v9_mqd_allocation ));
3800+ memset_io ((void * )mqd , 0 , sizeof (struct v9_mqd_allocation ));
38013801 ((struct v9_mqd_allocation * )mqd )-> dynamic_cu_mask = 0xFFFFFFFF ;
38023802 ((struct v9_mqd_allocation * )mqd )-> dynamic_rb_mask = 0xFFFFFFFF ;
38033803 if (amdgpu_sriov_vf (adev ) && adev -> in_suspend )
@@ -3810,7 +3810,7 @@ static int gfx_v9_0_kiq_init_queue(struct amdgpu_ring *ring)
38103810 mutex_unlock (& adev -> srbm_mutex );
38113811
38123812 if (adev -> gfx .kiq [0 ].mqd_backup )
3813- memcpy (adev -> gfx .kiq [0 ].mqd_backup , mqd , sizeof (struct v9_mqd_allocation ));
3813+ memcpy_fromio (adev -> gfx .kiq [0 ].mqd_backup , mqd , sizeof (struct v9_mqd_allocation ));
38143814 }
38153815
38163816 return 0 ;
@@ -3830,7 +3830,7 @@ static int gfx_v9_0_kcq_init_queue(struct amdgpu_ring *ring, bool restore)
38303830
38313831 if (!restore && (!tmp_mqd -> cp_hqd_pq_control ||
38323832 (!amdgpu_in_reset (adev ) && !adev -> in_suspend ))) {
3833- memset ((void * )mqd , 0 , sizeof (struct v9_mqd_allocation ));
3833+ memset_io ((void * )mqd , 0 , sizeof (struct v9_mqd_allocation ));
38343834 ((struct v9_mqd_allocation * )mqd )-> dynamic_cu_mask = 0xFFFFFFFF ;
38353835 ((struct v9_mqd_allocation * )mqd )-> dynamic_rb_mask = 0xFFFFFFFF ;
38363836 mutex_lock (& adev -> srbm_mutex );
@@ -3840,11 +3840,11 @@ static int gfx_v9_0_kcq_init_queue(struct amdgpu_ring *ring, bool restore)
38403840 mutex_unlock (& adev -> srbm_mutex );
38413841
38423842 if (adev -> gfx .mec .mqd_backup [mqd_idx ])
3843- memcpy (adev -> gfx .mec .mqd_backup [mqd_idx ], mqd , sizeof (struct v9_mqd_allocation ));
3843+ memcpy_fromio (adev -> gfx .mec .mqd_backup [mqd_idx ], mqd , sizeof (struct v9_mqd_allocation ));
38443844 } else {
38453845 /* restore MQD to a clean status */
38463846 if (adev -> gfx .mec .mqd_backup [mqd_idx ])
3847- memcpy (mqd , adev -> gfx .mec .mqd_backup [mqd_idx ], sizeof (struct v9_mqd_allocation ));
3847+ memcpy_toio (mqd , adev -> gfx .mec .mqd_backup [mqd_idx ], sizeof (struct v9_mqd_allocation ));
38483848 /* reset ring buffer */
38493849 ring -> wptr = 0 ;
38503850 atomic64_set ((atomic64_t * )ring -> wptr_cpu_addr , 0 );
@@ -4636,7 +4636,7 @@ static int gfx_v9_0_do_edc_gpr_workarounds(struct amdgpu_device *adev)
46364636 total_size += sizeof (sgpr_init_compute_shader );
46374637
46384638 /* allocate an indirect buffer to put the commands in */
4639- memset (& ib , 0 , sizeof (ib ));
4639+ memset_io (& ib , 0 , sizeof (ib ));
46404640 r = amdgpu_ib_get (adev , NULL , total_size ,
46414641 AMDGPU_IB_POOL_DIRECT , & ib );
46424642 if (r ) {
@@ -5455,12 +5455,12 @@ static void gfx_v9_0_ring_patch_ce_meta(struct amdgpu_ring *ring,
54555455 }
54565456
54575457 if (offset + (payload_size >> 2 ) <= ring -> buf_mask + 1 ) {
5458- memcpy ((void * )& ring -> ring [offset ], ce_payload_cpu_addr , payload_size );
5458+ memcpy_toio ((void * )& ring -> ring [offset ], ce_payload_cpu_addr , payload_size );
54595459 } else {
5460- memcpy ((void * )& ring -> ring [offset ], ce_payload_cpu_addr ,
5460+ memcpy_toio ((void * )& ring -> ring [offset ], ce_payload_cpu_addr ,
54615461 (ring -> buf_mask + 1 - offset ) << 2 );
54625462 payload_size -= (ring -> buf_mask + 1 - offset ) << 2 ;
5463- memcpy ((void * )& ring -> ring [0 ],
5463+ memcpy_toio ((void * )& ring -> ring [0 ],
54645464 ce_payload_cpu_addr + ((ring -> buf_mask + 1 - offset ) << 2 ),
54655465 payload_size );
54665466 }
@@ -5490,12 +5490,12 @@ static void gfx_v9_0_ring_patch_de_meta(struct amdgpu_ring *ring,
54905490 IB_COMPLETION_STATUS_PREEMPTED ;
54915491
54925492 if (offset + (payload_size >> 2 ) <= ring -> buf_mask + 1 ) {
5493- memcpy ((void * )& ring -> ring [offset ], de_payload_cpu_addr , payload_size );
5493+ memcpy_toio ((void * )& ring -> ring [offset ], de_payload_cpu_addr , payload_size );
54945494 } else {
5495- memcpy ((void * )& ring -> ring [offset ], de_payload_cpu_addr ,
5495+ memcpy_toio ((void * )& ring -> ring [offset ], de_payload_cpu_addr ,
54965496 (ring -> buf_mask + 1 - offset ) << 2 );
54975497 payload_size -= (ring -> buf_mask + 1 - offset ) << 2 ;
5498- memcpy ((void * )& ring -> ring [0 ],
5498+ memcpy_toio ((void * )& ring -> ring [0 ],
54995499 de_payload_cpu_addr + ((ring -> buf_mask + 1 - offset ) << 2 ),
55005500 payload_size );
55015501 }
0 commit comments