@@ -1322,7 +1322,7 @@ static int gfx_v8_0_mec_init(struct amdgpu_device *adev)
13221322 return r ;
13231323 }
13241324
1325- memset (hpd , 0 , mec_hpd_size );
1325+ memset_io (hpd , 0 , mec_hpd_size );
13261326
13271327 amdgpu_bo_kunmap (adev -> gfx .mec .hpd_eop_obj );
13281328 amdgpu_bo_unreserve (adev -> gfx .mec .hpd_eop_obj );
@@ -4395,7 +4395,7 @@ static int gfx_v8_0_deactivate_hqd(struct amdgpu_device *adev, u32 req)
43954395 return r ;
43964396}
43974397
4398- static void gfx_v8_0_mqd_set_priority (struct amdgpu_ring * ring , struct vi_mqd * mqd )
4398+ static void gfx_v8_0_mqd_set_priority (struct amdgpu_ring * ring , volatile struct vi_mqd * mqd )
43994399{
44004400 struct amdgpu_device * adev = ring -> adev ;
44014401
@@ -4411,7 +4411,7 @@ static void gfx_v8_0_mqd_set_priority(struct amdgpu_ring *ring, struct vi_mqd *m
44114411static int gfx_v8_0_mqd_init (struct amdgpu_ring * ring )
44124412{
44134413 struct amdgpu_device * adev = ring -> adev ;
4414- struct vi_mqd * mqd = ring -> mqd_ptr ;
4414+ volatile struct vi_mqd * mqd = ring -> mqd_ptr ;
44154415 uint64_t hqd_gpu_addr , wb_gpu_addr , eop_base_addr ;
44164416 uint32_t tmp ;
44174417
@@ -4422,11 +4422,13 @@ static int gfx_v8_0_mqd_init(struct amdgpu_ring *ring)
44224422 mqd -> compute_static_thread_mgmt_se2 = 0xffffffff ;
44234423 mqd -> compute_static_thread_mgmt_se3 = 0xffffffff ;
44244424 mqd -> compute_misc_reserved = 0x00000003 ;
4425+
44254426 mqd -> dynamic_cu_mask_addr_lo = lower_32_bits (ring -> mqd_gpu_addr
44264427 + offsetof(struct vi_mqd_allocation , dynamic_cu_mask ));
44274428 mqd -> dynamic_cu_mask_addr_hi = upper_32_bits (ring -> mqd_gpu_addr
44284429 + offsetof(struct vi_mqd_allocation , dynamic_cu_mask ));
44294430 eop_base_addr = ring -> eop_gpu_addr >> 8 ;
4431+
44304432 mqd -> cp_hqd_eop_base_addr_lo = eop_base_addr ;
44314433 mqd -> cp_hqd_eop_base_addr_hi = upper_32_bits (eop_base_addr );
44324434
@@ -4602,7 +4604,7 @@ static int gfx_v8_0_kiq_init_queue(struct amdgpu_ring *ring)
46024604 if (amdgpu_in_reset (adev )) { /* for GPU_RESET case */
46034605 /* reset MQD to a clean status */
46044606 if (adev -> gfx .kiq [0 ].mqd_backup )
4605- memcpy (mqd , adev -> gfx .kiq [0 ].mqd_backup , sizeof (struct vi_mqd_allocation ));
4607+ memcpy_toio (mqd , adev -> gfx .kiq [0 ].mqd_backup , sizeof (struct vi_mqd_allocation ));
46064608
46074609 /* reset ring buffer */
46084610 ring -> wptr = 0 ;
@@ -4613,7 +4615,7 @@ static int gfx_v8_0_kiq_init_queue(struct amdgpu_ring *ring)
46134615 vi_srbm_select (adev , 0 , 0 , 0 , 0 );
46144616 mutex_unlock (& adev -> srbm_mutex );
46154617 } else {
4616- memset ((void * )mqd , 0 , sizeof (struct vi_mqd_allocation ));
4618+ memset_io ((void * )mqd , 0 , sizeof (struct vi_mqd_allocation ));
46174619 ((struct vi_mqd_allocation * )mqd )-> dynamic_cu_mask = 0xFFFFFFFF ;
46184620 ((struct vi_mqd_allocation * )mqd )-> dynamic_rb_mask = 0xFFFFFFFF ;
46194621 if (amdgpu_sriov_vf (adev ) && adev -> in_suspend )
@@ -4626,7 +4628,7 @@ static int gfx_v8_0_kiq_init_queue(struct amdgpu_ring *ring)
46264628 mutex_unlock (& adev -> srbm_mutex );
46274629
46284630 if (adev -> gfx .kiq [0 ].mqd_backup )
4629- memcpy (adev -> gfx .kiq [0 ].mqd_backup , mqd , sizeof (struct vi_mqd_allocation ));
4631+ memcpy_fromio (adev -> gfx .kiq [0 ].mqd_backup , mqd , sizeof (struct vi_mqd_allocation ));
46304632 }
46314633
46324634 return 0 ;
@@ -4639,7 +4641,7 @@ static int gfx_v8_0_kcq_init_queue(struct amdgpu_ring *ring)
46394641 int mqd_idx = ring - & adev -> gfx .compute_ring [0 ];
46404642
46414643 if (!amdgpu_in_reset (adev ) && !adev -> in_suspend ) {
4642- memset ((void * )mqd , 0 , sizeof (struct vi_mqd_allocation ));
4644+ memset_io ((void * )mqd , 0 , sizeof (struct vi_mqd_allocation ));
46434645 ((struct vi_mqd_allocation * )mqd )-> dynamic_cu_mask = 0xFFFFFFFF ;
46444646 ((struct vi_mqd_allocation * )mqd )-> dynamic_rb_mask = 0xFFFFFFFF ;
46454647 mutex_lock (& adev -> srbm_mutex );
@@ -4649,11 +4651,11 @@ static int gfx_v8_0_kcq_init_queue(struct amdgpu_ring *ring)
46494651 mutex_unlock (& adev -> srbm_mutex );
46504652
46514653 if (adev -> gfx .mec .mqd_backup [mqd_idx ])
4652- memcpy (adev -> gfx .mec .mqd_backup [mqd_idx ], mqd , sizeof (struct vi_mqd_allocation ));
4654+ memcpy_fromio (adev -> gfx .mec .mqd_backup [mqd_idx ], mqd , sizeof (struct vi_mqd_allocation ));
46534655 } else {
46544656 /* restore MQD to a clean status */
46554657 if (adev -> gfx .mec .mqd_backup [mqd_idx ])
4656- memcpy (mqd , adev -> gfx .mec .mqd_backup [mqd_idx ], sizeof (struct vi_mqd_allocation ));
4658+ memcpy_toio (mqd , adev -> gfx .mec .mqd_backup [mqd_idx ], sizeof (struct vi_mqd_allocation ));
46574659 /* reset ring buffer */
46584660 ring -> wptr = 0 ;
46594661 amdgpu_ring_clear_ring (ring );
0 commit comments