drm/amdgpu/gfx8: whitespace cleanup
Subsystems (2)
PATCH 1/8 drm/amdgpu/gfx8: whitespace cleanup
--- drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +5 -6
@@ -7085,8 +7085,8 @@ static int gfx_v8_0_compute_mqd_soft_init(struct amdgpu_device *adev) ring = &adev->gfx.kiq.ring;if (!ring->mqd_obj) { r =amdgpu_bo_create_kernel (adev,sizeof (struct vi_mqd ),PAGE_SIZE , -AMDGPU_GEM_DOMAIN_GTT , &ring->mqd_obj, - &ring->mqd_gpu_addr, &ring->mqd_ptr); +AMDGPU_GEM_DOMAIN_GTT , &ring->mqd_obj, + &ring->mqd_gpu_addr, &ring->mqd_ptr);if (r) {dev_warn (adev->dev,"failed to create ring mqd ob (%d)" , r);return r;
@@ -7099,13 +7099,12 @@ static int gfx_v8_0_compute_mqd_soft_init(struct amdgpu_device *adev) }/* create MQD for each KCQ */ -for (i =0 ; i < adev->gfx.num_compute_rings; i++) - { +for (i =0 ; i < adev->gfx.num_compute_rings; i++) { ring = &adev->gfx.compute_ring[i];if (!ring->mqd_obj) { r =amdgpu_bo_create_kernel (adev,sizeof (struct vi_mqd ),PAGE_SIZE , -AMDGPU_GEM_DOMAIN_GTT , &ring->mqd_obj, - &ring->mqd_gpu_addr, &ring->mqd_ptr); +AMDGPU_GEM_DOMAIN_GTT , &ring->mqd_obj, + &ring->mqd_gpu_addr, &ring->mqd_ptr);if (r) {dev_warn (adev->dev,"failed to create ring mqd ob (%d)" , r);return r;
Signature · 6 lines
2.5.5 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): 1490284508-2453-1-git-send-email-alexander.deucher-5C7GfCeVMHo@public.gmane.org
PATCH 2/8 drm/amdgpu/gfx8: rename some functions
To better match where they are used. Called from sw_init and sw_fini.
--- drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +6 -6
@@ -659,8 +659,8 @@ static u32 gfx_v8_0_get_csb_size(struct amdgpu_device *adev);static void gfx_v8_0_get_cu_info (struct amdgpu_device *adev);static void gfx_v8_0_ring_emit_ce_meta_init (struct amdgpu_ring *ring,uint64_t addr);static void gfx_v8_0_ring_emit_de_meta_init (struct amdgpu_ring *ring,uint64_t addr); -static int gfx_v8_0_compute_mqd_soft_init (struct amdgpu_device *adev); -static void gfx_v8_0_compute_mqd_soft_fini (struct amdgpu_device *adev); +static int gfx_v8_0_compute_mqd_sw_init (struct amdgpu_device *adev); +static void gfx_v8_0_compute_mqd_sw_fini (struct amdgpu_device *adev);static void gfx_v8_0_init_golden_registers (struct amdgpu_device *adev) {
@@ -2170,7 +2170,7 @@ static int gfx_v8_0_sw_init(void *handle)return r;/* create MQD for all compute queues as well as KIQ for SRIOV case */ - r =gfx_v8_0_compute_mqd_soft_init (adev); + r =gfx_v8_0_compute_mqd_sw_init (adev);if (r)return r;
@@ -2216,7 +2216,7 @@ static int gfx_v8_0_sw_fini(void *handle)for (i =0 ; i < adev->gfx.num_compute_rings; i++)amdgpu_ring_fini (&adev->gfx.compute_ring[i]); -gfx_v8_0_compute_mqd_soft_fini (adev); +gfx_v8_0_compute_mqd_sw_fini (adev);gfx_v8_0_kiq_free_ring (&adev->gfx.kiq.ring, &adev->gfx.kiq.irq);gfx_v8_0_kiq_fini (adev);
@@ -7076,7 +7076,7 @@ static void gfx_v8_0_ring_emit_de_meta_init(struct amdgpu_ring *ring, uint64_t c }/* create MQD for each compute queue */ -static int gfx_v8_0_compute_mqd_soft_init (struct amdgpu_device *adev) +static int gfx_v8_0_compute_mqd_sw_init (struct amdgpu_device *adev) {struct amdgpu_ring *ring =NULL ;int r, i;
@@ -7120,7 +7120,7 @@ static int gfx_v8_0_compute_mqd_soft_init(struct amdgpu_device *adev)return 0 ; } -static void gfx_v8_0_compute_mqd_soft_fini (struct amdgpu_device *adev) +static void gfx_v8_0_compute_mqd_sw_fini (struct amdgpu_device *adev) {struct amdgpu_ring *ring =NULL ;int i;
Signature · 6 lines
2.5.5 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 3/8 drm/amdgpu/gfx8: reserve mqd objects before mapping them
In reply to a message not in the archiveIt's required.
--- drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c | 32 +++++++++++++++++++++----------- 1 file changed, 21 insertions(+), 11 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +21 -11
@@ -4936,31 +4936,40 @@ static int gfx_v8_0_kiq_resume(struct amdgpu_device *adev)gfx_v8_0_cp_compute_enable (adev, true); ring = &adev->gfx.kiq.ring; -if (!amdgpu_bo_kmap (ring->mqd_obj, &ring->mqd_ptr)) { + + r =amdgpu_bo_reserve (ring->mqd_obj, false); +if (unlikely (r !=0 )) + goto done; + + r =amdgpu_bo_kmap (ring->mqd_obj, &ring->mqd_ptr); +if (!r) { r =gfx_v8_0_kiq_init_queue (ring, (struct vi_mqd *)ring->mqd_ptr, ring->mqd_gpu_addr);amdgpu_bo_kunmap (ring->mqd_obj); ring->mqd_ptr =NULL ; -if (r) -return r; - }else { -return r; } +amdgpu_bo_unreserve (ring->mqd_obj); +if (r) + goto done;for (i =0 ; i < adev->gfx.num_compute_rings; i++) { ring = &adev->gfx.compute_ring[i]; -if (!amdgpu_bo_kmap (ring->mqd_obj, &ring->mqd_ptr)) { + + r =amdgpu_bo_reserve (ring->mqd_obj, false); +if (unlikely (r !=0 )) + goto done; + r =amdgpu_bo_kmap (ring->mqd_obj, &ring->mqd_ptr); +if (!r) { r =gfx_v8_0_kiq_init_queue (ring, (struct vi_mqd *)ring->mqd_ptr, ring->mqd_gpu_addr);amdgpu_bo_kunmap (ring->mqd_obj); ring->mqd_ptr =NULL ; -if (r) -return r; - }else { -return r; } +amdgpu_bo_unreserve (ring->mqd_obj); +if (r) + goto done; }for (i =0 ; i < adev->gfx.num_compute_rings; i++) {
@@ -4978,7 +4987,8 @@ static int gfx_v8_0_kiq_resume(struct amdgpu_device *adev)if (r) ring->ready = false; -return 0 ; +done: +return r; }static int gfx_v8_0_cp_resume (struct amdgpu_device *adev)
Signature · 6 lines
2.5.5 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 4/8 drm/amdgpu/gfx8: test KIQ before compute rings
In reply to a message not in the archiveIf KIQ isn't working, the compute rings won't work either.
--- drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +7 -6
@@ -4953,6 +4953,13 @@ static int gfx_v8_0_kiq_resume(struct amdgpu_device *adev)if (r) goto done; + ring->ready = true; + r =amdgpu_ring_test_ring (ring); +if (r) { + ring->ready = false; + goto done; + } +for (i =0 ; i < adev->gfx.num_compute_rings; i++) { ring = &adev->gfx.compute_ring[i];
@@ -4981,12 +4988,6 @@ static int gfx_v8_0_kiq_resume(struct amdgpu_device *adev) ring->ready = false; } - ring = &adev->gfx.kiq.ring; - ring->ready = true; - r =amdgpu_ring_test_ring (ring); -if (r) - ring->ready = false; - done:return r; }
Signature · 6 lines
2.5.5 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 5/8 drm/amdgpu/gfx8: fold loops in kiq_resume()
In reply to a message not in the archiveNo need to loop through the compute queues twice.
--- drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c | 4 ---- 1 file changed, 4 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +0 -4
@@ -4977,10 +4977,6 @@ static int gfx_v8_0_kiq_resume(struct amdgpu_device *adev)amdgpu_bo_unreserve (ring->mqd_obj);if (r) goto done; - } - -for (i =0 ; i < adev->gfx.num_compute_rings; i++) { - ring = &adev->gfx.compute_ring[i]; ring->ready = true; r =amdgpu_ring_test_ring (ring);
Signature · 6 lines
2.5.5 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 6/8 drm/amdgpu: reserve kiq eop object before unmapping it
In reply to a message not in the archiveIt's required.
--- drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +4 -0
@@ -1488,7 +1488,11 @@ static int gfx_v8_0_kiq_init(struct amdgpu_device *adev)memset (hpd,0 ,MEC_HPD_SIZE ); + r =amdgpu_bo_reserve (kiq->eop_obj, false); +if (unlikely (r !=0 )) +dev_warn (adev->dev,"(%d) reserve kiq eop bo failed\n" , r);amdgpu_bo_kunmap (kiq->eop_obj); +amdgpu_bo_unreserve (kiq->eop_obj);return 0 ; }
Signature · 6 lines
2.5.5 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 7/8 drm/amdgpu/gfx8: reduce the functon params for mpq setup
In reply to a message not in the archiveEverything we need is in the ring structure. No need to pass all the bits explicitly.
--- drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c | 32 ++++++++++++++------------------ 1 file changed, 14 insertions(+), 18 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +14 -18
@@ -4664,12 +4664,11 @@ static void gfx_v8_0_map_queue_enable(struct amdgpu_ring *kiq_ring,udelay (50 ); } -static int gfx_v8_0_mqd_init (struct amdgpu_device *adev, +static int gfx_v8_0_mqd_init (struct amdgpu_ring *ring,struct vi_mqd *mqd, -uint64_t mqd_gpu_addr, -uint64_t eop_gpu_addr, -struct amdgpu_ring *ring) +uint64_t eop_gpu_addr) { +struct amdgpu_device *adev = ring->adev;uint64_t hqd_gpu_addr, wb_gpu_addr, eop_base_addr;uint32_t tmp;
@@ -4710,8 +4709,8 @@ static int gfx_v8_0_mqd_init(struct amdgpu_device *adev, mqd->cp_hqd_pq_wptr =0 ;/* set the pointer to the MQD */ - mqd->cp_mqd_base_addr_lo = mqd_gpu_addr &0xfffffffc ; - mqd->cp_mqd_base_addr_hi =upper_32_bits (mqd_gpu_addr); + mqd->cp_mqd_base_addr_lo = ring->mqd_gpu_addr &0xfffffffc ; + mqd->cp_mqd_base_addr_hi =upper_32_bits (ring->mqd_gpu_addr);/* set MQD vmid to 0 */ tmp =RREG32 (mmCP_MQD_CONTROL);
@@ -4784,10 +4783,10 @@ static int gfx_v8_0_mqd_init(struct amdgpu_device *adev,return 0 ; } -static int gfx_v8_0_kiq_init_register (struct amdgpu_device *adev, -struct vi_mqd *mqd, -struct amdgpu_ring *ring) +static int gfx_v8_0_kiq_init_register (struct amdgpu_ring *ring, +struct vi_mqd *mqd) { +struct amdgpu_device *adev = ring->adev;uint32_t tmp;int j;
@@ -4876,8 +4875,7 @@ static int gfx_v8_0_kiq_init_register(struct amdgpu_device *adev, }static int gfx_v8_0_kiq_init_queue (struct amdgpu_ring *ring, -struct vi_mqd *mqd, -u64 mqd_gpu_addr) +struct vi_mqd *mqd) {struct amdgpu_device *adev = ring->adev;struct amdgpu_kiq *kiq = &adev->gfx.kiq;
@@ -4898,9 +4896,9 @@ static int gfx_v8_0_kiq_init_queue(struct amdgpu_ring *ring,memset ((void *)mqd,0 ,sizeof (*mqd));mutex_lock (&adev->srbm_mutex);vi_srbm_select (adev, ring->me, ring->pipe, ring->queue,0 ); -gfx_v8_0_mqd_init (adev, mqd, mqd_gpu_addr, eop_gpu_addr, ring); +gfx_v8_0_mqd_init (ring, mqd, eop_gpu_addr);if (is_kiq) -gfx_v8_0_kiq_init_register (adev, mqd, ring); +gfx_v8_0_kiq_init_register (ring, mqd);vi_srbm_select (adev,0 ,0 ,0 ,0 );mutex_unlock (&adev->srbm_mutex);
@@ -4918,7 +4916,7 @@ static int gfx_v8_0_kiq_init_queue(struct amdgpu_ring *ring,if (is_kiq) {mutex_lock (&adev->srbm_mutex);vi_srbm_select (adev, ring->me, ring->pipe, ring->queue,0 ); -gfx_v8_0_kiq_init_register (adev, mqd, ring); +gfx_v8_0_kiq_init_register (ring, mqd);vi_srbm_select (adev,0 ,0 ,0 ,0 );mutex_unlock (&adev->srbm_mutex); }
@@ -4948,8 +4946,7 @@ static int gfx_v8_0_kiq_resume(struct amdgpu_device *adev) r =amdgpu_bo_kmap (ring->mqd_obj, &ring->mqd_ptr);if (!r) { r =gfx_v8_0_kiq_init_queue (ring, - (struct vi_mqd *)ring->mqd_ptr, - ring->mqd_gpu_addr); + (struct vi_mqd *)ring->mqd_ptr);amdgpu_bo_kunmap (ring->mqd_obj); ring->mqd_ptr =NULL ; }
@@ -4973,8 +4970,7 @@ static int gfx_v8_0_kiq_resume(struct amdgpu_device *adev) r =amdgpu_bo_kmap (ring->mqd_obj, &ring->mqd_ptr);if (!r) { r =gfx_v8_0_kiq_init_queue (ring, - (struct vi_mqd *)ring->mqd_ptr, - ring->mqd_gpu_addr); + (struct vi_mqd *)ring->mqd_ptr);amdgpu_bo_kunmap (ring->mqd_obj); ring->mqd_ptr =NULL ; }
Signature · 6 lines
2.5.5 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 8/8 drm/amdgpu/gfx8: store the eop gpu addr in the ring structure
In reply to a message not in the archiveAvoids passing around additional parameters during setup.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h | 1 + drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c | 14 ++++++-------- 2 files changed, 7 insertions(+), 8 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h +1 -0
@@ -168,6 +168,7 @@ struct amdgpu_ring {struct amdgpu_bo *mqd_obj;uint64_t mqd_gpu_addr;void *mqd_ptr; +uint64_t eop_gpu_addr;u32 doorbell_index;bool use_doorbell;unsigned wptr_offs;
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +6 -8
@@ -1377,6 +1377,7 @@ static int gfx_v8_0_kiq_init_ring(struct amdgpu_device *adev,struct amdgpu_ring *ring, struct amdgpu_irq_src *irq) { + struct amdgpu_kiq *kiq = &adev->gfx.kiq;int r =0 ; r =amdgpu_wb_get (adev, &adev->virt.reg_val_offs);
@@ -1396,6 +1397,7 @@ static int gfx_v8_0_kiq_init_ring(struct amdgpu_device *adev, } ring->queue =0 ; + ring->eop_gpu_addr = kiq->eop_gpu_addr;sprintf (ring->name,"kiq %d.%d.%d" , ring->me, ring->pipe, ring->queue); r =amdgpu_ring_init (adev, ring,1024 , irq,AMDGPU_CP_KIQ_IRQ_DRIVER0 );
@@ -2153,6 +2155,7 @@ static int gfx_v8_0_sw_init(void *handle) ring->me =1 ;/* first MEC */ ring->pipe = i /8 ; ring->queue = i %8 ; + ring->eop_gpu_addr = adev->gfx.mec.hpd_eop_gpu_addr + (i *MEC_HPD_SIZE );sprintf (ring->name,"comp_%d.%d.%d" , ring->me, ring->pipe, ring->queue); irq_type =AMDGPU_CP_IRQ_COMPUTE_MEC1_PIPE0_EOP + ring->pipe;/* type-2 packets are deprecated on MEC, use type-3 instead */
@@ -4665,8 +4668,7 @@ static void gfx_v8_0_map_queue_enable(struct amdgpu_ring *kiq_ring, }static int gfx_v8_0_mqd_init (struct amdgpu_ring *ring, -struct vi_mqd *mqd, -uint64_t eop_gpu_addr) +struct vi_mqd *mqd) {struct amdgpu_device *adev = ring->adev;uint64_t hqd_gpu_addr, wb_gpu_addr, eop_base_addr;
@@ -4680,7 +4682,7 @@ static int gfx_v8_0_mqd_init(struct amdgpu_ring *ring, mqd->compute_static_thread_mgmt_se3 =0xffffffff ; mqd->compute_misc_reserved =0x00000003 ; - eop_base_addr = eop_gpu_addr >>8 ; + eop_base_addr = ring->eop_gpu_addr >>8 ; mqd->cp_hqd_eop_base_addr_lo = eop_base_addr; mqd->cp_hqd_eop_base_addr_hi =upper_32_bits (eop_base_addr);
@@ -4879,16 +4881,12 @@ static int gfx_v8_0_kiq_init_queue(struct amdgpu_ring *ring, {struct amdgpu_device *adev = ring->adev;struct amdgpu_kiq *kiq = &adev->gfx.kiq; -uint64_t eop_gpu_addr;bool is_kiq = (ring->funcs->type ==AMDGPU_RING_TYPE_KIQ );int mqd_idx =AMDGPU_MAX_COMPUTE_RINGS ;if (is_kiq) { - eop_gpu_addr = kiq->eop_gpu_addr;gfx_v8_0_kiq_setting (&kiq->ring); }else { - eop_gpu_addr = adev->gfx.mec.hpd_eop_gpu_addr + - ring->queue *MEC_HPD_SIZE ; mqd_idx = ring - &adev->gfx.compute_ring[0 ]; }
@@ -4896,7 +4894,7 @@ static int gfx_v8_0_kiq_init_queue(struct amdgpu_ring *ring,memset ((void *)mqd,0 ,sizeof (*mqd));mutex_lock (&adev->srbm_mutex);vi_srbm_select (adev, ring->me, ring->pipe, ring->queue,0 ); -gfx_v8_0_mqd_init (ring, mqd, eop_gpu_addr); +gfx_v8_0_mqd_init (ring, mqd);if (is_kiq)gfx_v8_0_kiq_init_register (ring, mqd);vi_srbm_select (adev,0 ,0 ,0 ,0 );
Signature · 6 lines
2.5.5 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Christian König
Reviewed-byAm 23.03.2017 um 16:55 schrieb Alex Deucher:
Quoted 1 line
Signed-off-by Alex Deucher <[email protected]>
Quoted 26 lines
--- drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-)drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +3
-4@@ -7085,8 +7085,8 @@ static int gfx_v8_0_compute_mqd_soft_init(struct amdgpu_device *adev) ring = &adev->gfx.kiq.ring;if (!ring->mqd_obj) { r =amdgpu_bo_create_kernel (adev,sizeof (struct vi_mqd ),PAGE_SIZE , -AMDGPU_GEM_DOMAIN_GTT , &ring->mqd_obj, - &ring->mqd_gpu_addr, &ring->mqd_ptr); +AMDGPU_GEM_DOMAIN_GTT , &ring->mqd_obj, + &ring->mqd_gpu_addr, &ring->mqd_ptr);if (r) {dev_warn (adev->dev,"failed to create ring mqd ob (%d)" , r);return r;@@ -7099,13 +7099,12 @@ static int gfx_v8_0_compute_mqd_soft_init(struct amdgpu_device *adev) }/* create MQD for each KCQ */ -for (i =0 ; i < adev->gfx.num_compute_rings; i++) - { +for (i =0 ; i < adev->gfx.num_compute_rings; i++) {
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c static int gfx_v8_0_compute_mqd_soft_init(struct amdgpu_device *adev) · line 7110
Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +2
-2ring = &adev->gfx.compute_ring[i];if (!ring->mqd_obj) { r =amdgpu_bo_create_kernel (adev,sizeof (struct vi_mqd ),PAGE_SIZE , -AMDGPU_GEM_DOMAIN_GTT , &ring->mqd_obj, - &ring->mqd_gpu_addr, &ring->mqd_ptr); +AMDGPU_GEM_DOMAIN_GTT , &ring->mqd_obj, + &ring->mqd_gpu_addr, &ring->mqd_ptr);if (r) {dev_warn (adev->dev,"failed to create ring mqd ob (%d)" , r);return r;
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx