@@ -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 )
@@ -1884,7 +1884,7 @@ static int gfx_v9_0_mec_init(struct amdgpu_device *adev)
18841884 return r ;
18851885 }
18861886
1887- memset (hpd , 0 , mec_hpd_size );
1887+ memset_io (hpd , 0 , mec_hpd_size );
18881888
18891889 amdgpu_bo_kunmap (adev -> gfx .mec .hpd_eop_obj );
18901890 amdgpu_bo_unreserve (adev -> gfx .mec .hpd_eop_obj );
@@ -1908,7 +1908,7 @@ static int gfx_v9_0_mec_init(struct amdgpu_device *adev)
19081908 return r ;
19091909 }
19101910
1911- memcpy (fw , fw_data , fw_size );
1911+ memcpy_toio (fw , fw_data , fw_size );
19121912
19131913 amdgpu_bo_kunmap (adev -> gfx .mec .mec_fw_obj );
19141914 amdgpu_bo_unreserve (adev -> gfx .mec .mec_fw_obj );
@@ -3471,7 +3471,7 @@ static void gfx_v9_0_kiq_setting(struct amdgpu_ring *ring)
34713471 WREG32_SOC15_RLC (GC , 0 , mmRLC_CP_SCHEDULERS , tmp );
34723472}
34733473
3474- static void gfx_v9_0_mqd_set_priority (struct amdgpu_ring * ring , struct v9_mqd * mqd )
3474+ static void gfx_v9_0_mqd_set_priority (struct amdgpu_ring * ring , volatile struct v9_mqd * mqd )
34753475{
34763476 struct amdgpu_device * adev = ring -> adev ;
34773477
@@ -3487,7 +3487,7 @@ static void gfx_v9_0_mqd_set_priority(struct amdgpu_ring *ring, struct v9_mqd *m
34873487static int gfx_v9_0_mqd_init (struct amdgpu_ring * ring )
34883488{
34893489 struct amdgpu_device * adev = ring -> adev ;
3490- struct v9_mqd * mqd = ring -> mqd_ptr ;
3490+ volatile struct v9_mqd * mqd = ring -> mqd_ptr ;
34913491 uint64_t hqd_gpu_addr , wb_gpu_addr , eop_base_addr ;
34923492 uint32_t tmp ;
34933493
@@ -3786,7 +3786,7 @@ static int gfx_v9_0_kiq_init_queue(struct amdgpu_ring *ring)
37863786 if (amdgpu_in_reset (adev ) && tmp_mqd -> cp_hqd_pq_control ){
37873787 /* for GPU_RESET case , reset MQD to a clean status */
37883788 if (adev -> gfx .kiq [0 ].mqd_backup )
3789- memcpy (mqd , adev -> gfx .kiq [0 ].mqd_backup , sizeof (struct v9_mqd_allocation ));
3789+ memcpy_toio (mqd , adev -> gfx .kiq [0 ].mqd_backup , sizeof (struct v9_mqd_allocation ));
37903790
37913791 /* reset ring buffer */
37923792 ring -> wptr = 0 ;
@@ -3798,7 +3798,7 @@ static int gfx_v9_0_kiq_init_queue(struct amdgpu_ring *ring)
37983798 soc15_grbm_select (adev , 0 , 0 , 0 , 0 , 0 );
37993799 mutex_unlock (& adev -> srbm_mutex );
38003800 } else {
3801- memset ((void * )mqd , 0 , sizeof (struct v9_mqd_allocation ));
3801+ memset_io ((void * )mqd , 0 , sizeof (struct v9_mqd_allocation ));
38023802 ((struct v9_mqd_allocation * )mqd )-> dynamic_cu_mask = 0xFFFFFFFF ;
38033803 ((struct v9_mqd_allocation * )mqd )-> dynamic_rb_mask = 0xFFFFFFFF ;
38043804 if (amdgpu_sriov_vf (adev ) && adev -> in_suspend )
@@ -3811,7 +3811,7 @@ static int gfx_v9_0_kiq_init_queue(struct amdgpu_ring *ring)
38113811 mutex_unlock (& adev -> srbm_mutex );
38123812
38133813 if (adev -> gfx .kiq [0 ].mqd_backup )
3814- memcpy (adev -> gfx .kiq [0 ].mqd_backup , mqd , sizeof (struct v9_mqd_allocation ));
3814+ memcpy_fromio (adev -> gfx .kiq [0 ].mqd_backup , mqd , sizeof (struct v9_mqd_allocation ));
38153815 }
38163816
38173817 return 0 ;
@@ -3831,7 +3831,7 @@ static int gfx_v9_0_kcq_init_queue(struct amdgpu_ring *ring, bool restore)
38313831
38323832 if (!restore && (!tmp_mqd -> cp_hqd_pq_control ||
38333833 (!amdgpu_in_reset (adev ) && !adev -> in_suspend ))) {
3834- memset ((void * )mqd , 0 , sizeof (struct v9_mqd_allocation ));
3834+ memset_io ((void * )mqd , 0 , sizeof (struct v9_mqd_allocation ));
38353835 ((struct v9_mqd_allocation * )mqd )-> dynamic_cu_mask = 0xFFFFFFFF ;
38363836 ((struct v9_mqd_allocation * )mqd )-> dynamic_rb_mask = 0xFFFFFFFF ;
38373837 mutex_lock (& adev -> srbm_mutex );
@@ -3841,11 +3841,11 @@ static int gfx_v9_0_kcq_init_queue(struct amdgpu_ring *ring, bool restore)
38413841 mutex_unlock (& adev -> srbm_mutex );
38423842
38433843 if (adev -> gfx .mec .mqd_backup [mqd_idx ])
3844- memcpy (adev -> gfx .mec .mqd_backup [mqd_idx ], mqd , sizeof (struct v9_mqd_allocation ));
3844+ memcpy_fromio (adev -> gfx .mec .mqd_backup [mqd_idx ], mqd , sizeof (struct v9_mqd_allocation ));
38453845 } else {
38463846 /* restore MQD to a clean status */
38473847 if (adev -> gfx .mec .mqd_backup [mqd_idx ])
3848- memcpy (mqd , adev -> gfx .mec .mqd_backup [mqd_idx ], sizeof (struct v9_mqd_allocation ));
3848+ memcpy_toio (mqd , adev -> gfx .mec .mqd_backup [mqd_idx ], sizeof (struct v9_mqd_allocation ));
38493849 /* reset ring buffer */
38503850 ring -> wptr = 0 ;
38513851 atomic64_set ((atomic64_t * )ring -> wptr_cpu_addr , 0 );
@@ -4637,7 +4637,7 @@ static int gfx_v9_0_do_edc_gpr_workarounds(struct amdgpu_device *adev)
46374637 total_size += sizeof (sgpr_init_compute_shader );
46384638
46394639 /* allocate an indirect buffer to put the commands in */
4640- memset (& ib , 0 , sizeof (ib ));
4640+ memset_io (& ib , 0 , sizeof (ib ));
46414641 r = amdgpu_ib_get (adev , NULL , total_size ,
46424642 AMDGPU_IB_POOL_DIRECT , & ib );
46434643 if (r ) {
@@ -5456,12 +5456,12 @@ static void gfx_v9_0_ring_patch_ce_meta(struct amdgpu_ring *ring,
54565456 }
54575457
54585458 if (offset + (payload_size >> 2 ) <= ring -> buf_mask + 1 ) {
5459- memcpy ((void * )& ring -> ring [offset ], ce_payload_cpu_addr , payload_size );
5459+ memcpy_toio ((void * )& ring -> ring [offset ], ce_payload_cpu_addr , payload_size );
54605460 } else {
5461- memcpy ((void * )& ring -> ring [offset ], ce_payload_cpu_addr ,
5461+ memcpy_toio ((void * )& ring -> ring [offset ], ce_payload_cpu_addr ,
54625462 (ring -> buf_mask + 1 - offset ) << 2 );
54635463 payload_size -= (ring -> buf_mask + 1 - offset ) << 2 ;
5464- memcpy ((void * )& ring -> ring [0 ],
5464+ memcpy_toio ((void * )& ring -> ring [0 ],
54655465 ce_payload_cpu_addr + ((ring -> buf_mask + 1 - offset ) << 2 ),
54665466 payload_size );
54675467 }
@@ -5491,12 +5491,12 @@ static void gfx_v9_0_ring_patch_de_meta(struct amdgpu_ring *ring,
54915491 IB_COMPLETION_STATUS_PREEMPTED ;
54925492
54935493 if (offset + (payload_size >> 2 ) <= ring -> buf_mask + 1 ) {
5494- memcpy ((void * )& ring -> ring [offset ], de_payload_cpu_addr , payload_size );
5494+ memcpy_toio ((void * )& ring -> ring [offset ], de_payload_cpu_addr , payload_size );
54955495 } else {
5496- memcpy ((void * )& ring -> ring [offset ], de_payload_cpu_addr ,
5496+ memcpy_toio ((void * )& ring -> ring [offset ], de_payload_cpu_addr ,
54975497 (ring -> buf_mask + 1 - offset ) << 2 );
54985498 payload_size -= (ring -> buf_mask + 1 - offset ) << 2 ;
5499- memcpy ((void * )& ring -> ring [0 ],
5499+ memcpy_toio ((void * )& ring -> ring [0 ],
55005500 de_payload_cpu_addr + ((ring -> buf_mask + 1 - offset ) << 2 ),
55015501 payload_size );
55025502 }
0 commit comments