drm/amdgpu/gfx11: drop old bring up code
Subsystems (2)
Alex Deucher
maintainerPATCH 1/12 drm/amdgpu/gfx11: drop old bring up code
No longer used. Remove it.
--- drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c | 70 ++------------------------ 1 file changed, 3 insertions(+), 67 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c +3 -67
@@ -3680,55 +3680,6 @@ static int gfx_v11_0_gfx_mqd_init(struct amdgpu_device *adev, void *m,return 0 ; } -#ifdef BRING_UP_DEBUG -static int gfx_v11_0_gfx_queue_init_register (struct amdgpu_ring *ring) -{ -struct amdgpu_device *adev = ring->adev; -struct v11_gfx_mqd *mqd = ring->mqd_ptr; - -/* set mmCP_GFX_HQD_WPTR/_HI to 0 */ -WREG32_SOC15 (GC ,0 , regCP_GFX_HQD_WPTR, mqd->cp_gfx_hqd_wptr); -WREG32_SOC15 (GC ,0 , regCP_GFX_HQD_WPTR_HI, mqd->cp_gfx_hqd_wptr_hi); - -/* set GFX_MQD_BASE */ -WREG32_SOC15 (GC ,0 , regCP_MQD_BASE_ADDR, mqd->cp_mqd_base_addr); -WREG32_SOC15 (GC ,0 , regCP_MQD_BASE_ADDR_HI, mqd->cp_mqd_base_addr_hi); - -/* set GFX_MQD_CONTROL */ -WREG32_SOC15 (GC ,0 , regCP_GFX_MQD_CONTROL, mqd->cp_gfx_mqd_control); - -/* set GFX_HQD_VMID to 0 */ -WREG32_SOC15 (GC ,0 , regCP_GFX_HQD_VMID, mqd->cp_gfx_hqd_vmid); - -WREG32_SOC15 (GC ,0 , regCP_GFX_HQD_QUEUE_PRIORITY, - mqd->cp_gfx_hqd_queue_priority); -WREG32_SOC15 (GC ,0 , regCP_GFX_HQD_QUANTUM, mqd->cp_gfx_hqd_quantum); - -/* set GFX_HQD_BASE, similar as CP_RB_BASE */ -WREG32_SOC15 (GC ,0 , regCP_GFX_HQD_BASE, mqd->cp_gfx_hqd_base); -WREG32_SOC15 (GC ,0 , regCP_GFX_HQD_BASE_HI, mqd->cp_gfx_hqd_base_hi); - -/* set GFX_HQD_RPTR_ADDR, similar as CP_RB_RPTR */ -WREG32_SOC15 (GC ,0 , regCP_GFX_HQD_RPTR_ADDR, mqd->cp_gfx_hqd_rptr_addr); -WREG32_SOC15 (GC ,0 , regCP_GFX_HQD_RPTR_ADDR_HI, mqd->cp_gfx_hqd_rptr_addr_hi); - -/* set GFX_HQD_CNTL, similar as CP_RB_CNTL */ -WREG32_SOC15 (GC ,0 , regCP_GFX_HQD_CNTL, mqd->cp_gfx_hqd_cntl); - -/* set RB_WPTR_POLL_ADDR */ -WREG32_SOC15 (GC ,0 , regCP_RB_WPTR_POLL_ADDR_LO, mqd->cp_rb_wptr_poll_addr_lo); -WREG32_SOC15 (GC ,0 , regCP_RB_WPTR_POLL_ADDR_HI, mqd->cp_rb_wptr_poll_addr_hi); - -/* set RB_DOORBELL_CONTROL */ -WREG32_SOC15 (GC ,0 , regCP_RB_DOORBELL_CONTROL, mqd->cp_rb_doorbell_control); - -/* active the queue */ -WREG32_SOC15 (GC ,0 , regCP_GFX_HQD_ACTIVE, mqd->cp_gfx_hqd_active); - -return 0 ; -} -#endif -static int gfx_v11_0_gfx_init_queue (struct amdgpu_ring *ring) {struct amdgpu_device *adev = ring->adev;
@@ -3740,9 +3691,6 @@ static int gfx_v11_0_gfx_init_queue(struct amdgpu_ring *ring)mutex_lock (&adev->srbm_mutex);soc21_grbm_select (adev, ring->me, ring->pipe, ring->queue,0 );amdgpu_ring_init_mqd (ring); -#ifdef BRING_UP_DEBUG -gfx_v11_0_gfx_queue_init_register (ring); -#endif soc21_grbm_select (adev,0 ,0 ,0 ,0 );mutex_unlock (&adev->srbm_mutex);if (adev->gfx.me.mqd_backup[mqd_idx])
@@ -3755,13 +3703,6 @@ static int gfx_v11_0_gfx_init_queue(struct amdgpu_ring *ring) ring->wptr =0 ; *ring->wptr_cpu_addr =0 ;amdgpu_ring_clear_ring (ring); -#ifdef BRING_UP_DEBUG -mutex_lock (&adev->srbm_mutex); -soc21_grbm_select (adev, ring->me, ring->pipe, ring->queue,0 ); -gfx_v11_0_gfx_queue_init_register (ring); -soc21_grbm_select (adev,0 ,0 ,0 ,0 ); -mutex_unlock (&adev->srbm_mutex); -#endif }else {amdgpu_ring_clear_ring (ring); }
@@ -3769,7 +3710,6 @@ static int gfx_v11_0_gfx_init_queue(struct amdgpu_ring *ring)return 0 ; } -#ifndef BRING_UP_DEBUG static int gfx_v11_0_kiq_enable_kgq (struct amdgpu_device *adev) {struct amdgpu_kiq *kiq = &adev->gfx.kiq[0 ];
@@ -3791,7 +3731,6 @@ static int gfx_v11_0_kiq_enable_kgq(struct amdgpu_device *adev)return amdgpu_ring_test_helper (kiq_ring); } -#endif static int gfx_v11_0_cp_async_gfx_ring_resume (struct amdgpu_device *adev) {
@@ -3815,11 +3754,11 @@ static int gfx_v11_0_cp_async_gfx_ring_resume(struct amdgpu_device *adev)if (r) goto done; } -#ifndef BRING_UP_DEBUG + r =gfx_v11_0_kiq_enable_kgq (adev);if (r) goto done; -#endif + r =gfx_v11_0_cp_gfx_start (adev);if (r) goto done;
@@ -4453,7 +4392,6 @@ static int gfx_v11_0_hw_init(void *handle)return r; } -#ifndef BRING_UP_DEBUG static int gfx_v11_0_kiq_disable_kgq (struct amdgpu_device *adev) {struct amdgpu_kiq *kiq = &adev->gfx.kiq[0 ];
@@ -4476,7 +4414,6 @@ static int gfx_v11_0_kiq_disable_kgq(struct amdgpu_device *adev)return r; } -#endif static int gfx_v11_0_hw_fini (void *handle) {
@@ -4488,13 +4425,12 @@ static int gfx_v11_0_hw_fini(void *handle)amdgpu_irq_put (adev, &adev->gfx.priv_inst_irq,0 );if (!adev->no_hw_access) { -#ifndef BRING_UP_DEBUG if (amdgpu_async_gfx_ring) { r =gfx_v11_0_kiq_disable_kgq (adev);if (r)DRM_ERROR ("KGQ disable failed\n" ); } -#endif +if (amdgpu_gfx_disable_kcq (adev,0 ))DRM_ERROR ("KCQ disable failed\n" );
Signature · 1 line
2.40.0
Alex Deucher
maintainerPATCH 2/12 drm/amdgpu/gfx10: drop old bring up code
No longer used. Remove it.
--- drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c | 70 ++------------------------ 1 file changed, 3 insertions(+), 67 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +3 -67
@@ -6423,55 +6423,6 @@ static int gfx_v10_0_gfx_mqd_init(struct amdgpu_device *adev, void *m,return 0 ; } -#ifdef BRING_UP_DEBUG -static int gfx_v10_0_gfx_queue_init_register (struct amdgpu_ring *ring) -{ -struct amdgpu_device *adev = ring->adev; -struct v10_gfx_mqd *mqd = ring->mqd_ptr; - -/* set mmCP_GFX_HQD_WPTR/_HI to 0 */ -WREG32_SOC15 (GC ,0 , mmCP_GFX_HQD_WPTR, mqd->cp_gfx_hqd_wptr); -WREG32_SOC15 (GC ,0 , mmCP_GFX_HQD_WPTR_HI, mqd->cp_gfx_hqd_wptr_hi); - -/* set GFX_MQD_BASE */ -WREG32_SOC15 (GC ,0 , mmCP_MQD_BASE_ADDR, mqd->cp_mqd_base_addr); -WREG32_SOC15 (GC ,0 , mmCP_MQD_BASE_ADDR_HI, mqd->cp_mqd_base_addr_hi); - -/* set GFX_MQD_CONTROL */ -WREG32_SOC15 (GC ,0 , mmCP_GFX_MQD_CONTROL, mqd->cp_gfx_mqd_control); - -/* set GFX_HQD_VMID to 0 */ -WREG32_SOC15 (GC ,0 , mmCP_GFX_HQD_VMID, mqd->cp_gfx_hqd_vmid); - -WREG32_SOC15 (GC ,0 , mmCP_GFX_HQD_QUEUE_PRIORITY, - mqd->cp_gfx_hqd_queue_priority); -WREG32_SOC15 (GC ,0 , mmCP_GFX_HQD_QUANTUM, mqd->cp_gfx_hqd_quantum); - -/* set GFX_HQD_BASE, similar as CP_RB_BASE */ -WREG32_SOC15 (GC ,0 , mmCP_GFX_HQD_BASE, mqd->cp_gfx_hqd_base); -WREG32_SOC15 (GC ,0 , mmCP_GFX_HQD_BASE_HI, mqd->cp_gfx_hqd_base_hi); - -/* set GFX_HQD_RPTR_ADDR, similar as CP_RB_RPTR */ -WREG32_SOC15 (GC ,0 , mmCP_GFX_HQD_RPTR_ADDR, mqd->cp_gfx_hqd_rptr_addr); -WREG32_SOC15 (GC ,0 , mmCP_GFX_HQD_RPTR_ADDR_HI, mqd->cp_gfx_hqd_rptr_addr_hi); - -/* set GFX_HQD_CNTL, similar as CP_RB_CNTL */ -WREG32_SOC15 (GC ,0 , mmCP_GFX_HQD_CNTL, mqd->cp_gfx_hqd_cntl); - -/* set RB_WPTR_POLL_ADDR */ -WREG32_SOC15 (GC ,0 , mmCP_RB_WPTR_POLL_ADDR_LO, mqd->cp_rb_wptr_poll_addr_lo); -WREG32_SOC15 (GC ,0 , mmCP_RB_WPTR_POLL_ADDR_HI, mqd->cp_rb_wptr_poll_addr_hi); - -/* set RB_DOORBELL_CONTROL */ -WREG32_SOC15 (GC ,0 , mmCP_RB_DOORBELL_CONTROL, mqd->cp_rb_doorbell_control); - -/* active the queue */ -WREG32_SOC15 (GC ,0 , mmCP_GFX_HQD_ACTIVE, mqd->cp_gfx_hqd_active); - -return 0 ; -} -#endif -static int gfx_v10_0_gfx_init_queue (struct amdgpu_ring *ring) {struct amdgpu_device *adev = ring->adev;
@@ -6492,9 +6443,6 @@ static int gfx_v10_0_gfx_init_queue(struct amdgpu_ring *ring)if (ring->doorbell_index == adev->doorbell_index.gfx_ring0 <<1 )gfx_v10_0_cp_gfx_set_doorbell (adev, ring); -#ifdef BRING_UP_DEBUG -gfx_v10_0_gfx_queue_init_register (ring); -#endif nv_grbm_select (adev,0 ,0 ,0 ,0 );mutex_unlock (&adev->srbm_mutex);if (adev->gfx.me.mqd_backup[mqd_idx])
@@ -6507,13 +6455,6 @@ static int gfx_v10_0_gfx_init_queue(struct amdgpu_ring *ring) ring->wptr =0 ; *ring->wptr_cpu_addr =0 ;amdgpu_ring_clear_ring (ring); -#ifdef BRING_UP_DEBUG -mutex_lock (&adev->srbm_mutex); -nv_grbm_select (adev, ring->me, ring->pipe, ring->queue,0 ); -gfx_v10_0_gfx_queue_init_register (ring); -nv_grbm_select (adev,0 ,0 ,0 ,0 ); -mutex_unlock (&adev->srbm_mutex); -#endif }else {amdgpu_ring_clear_ring (ring); }
@@ -6521,7 +6462,6 @@ static int gfx_v10_0_gfx_init_queue(struct amdgpu_ring *ring)return 0 ; } -#ifndef BRING_UP_DEBUG static int gfx_v10_0_kiq_enable_kgq (struct amdgpu_device *adev) {struct amdgpu_kiq *kiq = &adev->gfx.kiq[0 ];
@@ -6543,7 +6483,6 @@ static int gfx_v10_0_kiq_enable_kgq(struct amdgpu_device *adev)return amdgpu_ring_test_helper (kiq_ring); } -#endif static int gfx_v10_0_cp_async_gfx_ring_resume (struct amdgpu_device *adev) {
@@ -6567,11 +6506,11 @@ static int gfx_v10_0_cp_async_gfx_ring_resume(struct amdgpu_device *adev)if (r) goto done; } -#ifndef BRING_UP_DEBUG + r =gfx_v10_0_kiq_enable_kgq (adev);if (r) goto done; -#endif + r =gfx_v10_0_cp_gfx_start (adev);if (r) goto done;
@@ -7239,7 +7178,6 @@ static int gfx_v10_0_hw_init(void *handle)return r; } -#ifndef BRING_UP_DEBUG static int gfx_v10_0_kiq_disable_kgq (struct amdgpu_device *adev) {struct amdgpu_kiq *kiq = &adev->gfx.kiq[0 ];
@@ -7261,7 +7199,6 @@ static int gfx_v10_0_kiq_disable_kgq(struct amdgpu_device *adev)else return 0 ; } -#endif static int gfx_v10_0_hw_fini (void *handle) {
@@ -7272,13 +7209,12 @@ static int gfx_v10_0_hw_fini(void *handle)amdgpu_irq_put (adev, &adev->gfx.priv_inst_irq,0 );if (!adev->no_hw_access) { -#ifndef BRING_UP_DEBUG if (amdgpu_async_gfx_ring) { r =gfx_v10_0_kiq_disable_kgq (adev);if (r)DRM_ERROR ("KGQ disable failed\n" ); } -#endif +if (amdgpu_gfx_disable_kcq (adev,0 ))DRM_ERROR ("KCQ disable failed\n" ); }
Signature · 1 line
2.40.0
Alex Deucher
maintainerPATCH 3/12 drm/amdgpu: add [en/dis]able_kgq() functions
In reply to Alex DeucherTo replace the IP specific variants which are largely duplicate.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c | 68 +++++++++++++++++++++++++ drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.h | 2 + 2 files changed, 70 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c +68 -0
@@ -518,6 +518,39 @@ int amdgpu_gfx_disable_kcq(struct amdgpu_device *adev, int xcc_id)return r; } +int amdgpu_gfx_disable_kgq (struct amdgpu_device *adev,int xcc_id) +{ +struct amdgpu_kiq *kiq = &adev->gfx.kiq[xcc_id]; +struct amdgpu_ring *kiq_ring = &kiq->ring; +int i, r =0 ; +int j; + +if (!kiq->pmf || !kiq->pmf->kiq_unmap_queues) +return -EINVAL ; + +spin_lock (&kiq->ring_lock); +if (amdgpu_gfx_is_master_xcc (adev, xcc_id)) { +if (amdgpu_ring_alloc (kiq_ring, kiq->pmf->unmap_queues_size * + adev->gfx.num_gfx_rings)) { +spin_unlock (&kiq->ring_lock); +return -ENOMEM ; + } + +for (i =0 ; i < adev->gfx.num_gfx_rings; i++) { + j = i + xcc_id * adev->gfx.num_gfx_rings; + kiq->pmf->kiq_unmap_queues (kiq_ring, + &adev->gfx.gfx_ring[i], +PREEMPT_QUEUES ,0 ,0 ); + } + } + +if (adev->gfx.kiq[0 ].ring.sched.ready && !adev->job_hang) + r =amdgpu_ring_test_helper (kiq_ring); +spin_unlock (&kiq->ring_lock); + +return r; +} +int amdgpu_queue_mask_bit_to_set_resource_bit (struct amdgpu_device *adev,int queue_bit) {
@@ -589,6 +622,41 @@ int amdgpu_gfx_enable_kcq(struct amdgpu_device *adev, int xcc_id)return r; } +int amdgpu_gfx_enable_kgq (struct amdgpu_device *adev,int xcc_id) +{ +struct amdgpu_kiq *kiq = &adev->gfx.kiq[xcc_id]; +struct amdgpu_ring *kiq_ring = &kiq->ring; +int r, i, j; + +if (!kiq->pmf || !kiq->pmf->kiq_map_queues) +return -EINVAL ; + +spin_lock (&kiq->ring_lock); +/* No need to map kcq on the slave */ +if (amdgpu_gfx_is_master_xcc (adev, xcc_id)) { + r =amdgpu_ring_alloc (kiq_ring, kiq->pmf->map_queues_size * + adev->gfx.num_gfx_rings); +if (r) { +DRM_ERROR ("Failed to lock KIQ (%d).\n" , r); +spin_unlock (&adev->gfx.kiq[0 ].ring_lock); +return r; + } + +for (i =0 ; i < adev->gfx.num_gfx_rings; i++) { + j = i + xcc_id * adev->gfx.num_gfx_rings; + kiq->pmf->kiq_map_queues (kiq_ring, + &adev->gfx.gfx_ring[i]); + } + } + + r =amdgpu_ring_test_helper (kiq_ring); +spin_unlock (&kiq->ring_lock); +if (r) +DRM_ERROR ("KCQ enable failed\n" ); + +return r; +} +/* amdgpu_gfx_off_ctrl - Handle gfx off feature enable/disable * * @adev: amdgpu_device pointer
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.h +2 -0
@@ -433,6 +433,8 @@ int amdgpu_gfx_mqd_sw_init(struct amdgpu_device *adev,void amdgpu_gfx_mqd_sw_fini (struct amdgpu_device *adev,int xcc_id);int amdgpu_gfx_disable_kcq (struct amdgpu_device *adev,int xcc_id);int amdgpu_gfx_enable_kcq (struct amdgpu_device *adev,int xcc_id); +int amdgpu_gfx_disable_kgq (struct amdgpu_device *adev,int xcc_id); +int amdgpu_gfx_enable_kgq (struct amdgpu_device *adev,int xcc_id);void amdgpu_gfx_compute_queue_acquire (struct amdgpu_device *adev);void amdgpu_gfx_graphics_queue_acquire (struct amdgpu_device *adev);
Signature · 1 line
2.40.0
Alex Deucher
maintainerPATCH 4/12 drm/amdgpu/gfx10: use generic [en/dis]able_kgq() helpers
In reply to Alex DeucherAnd remove the duplicate local variants.
--- drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c | 48 ++------------------------ 1 file changed, 2 insertions(+), 46 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +2 -46
@@ -6462,28 +6462,6 @@ static int gfx_v10_0_gfx_init_queue(struct amdgpu_ring *ring)return 0 ; } -static int gfx_v10_0_kiq_enable_kgq (struct amdgpu_device *adev) -{ -struct amdgpu_kiq *kiq = &adev->gfx.kiq[0 ]; -struct amdgpu_ring *kiq_ring = &adev->gfx.kiq[0 ].ring; -int r, i; - -if (!kiq->pmf || !kiq->pmf->kiq_map_queues) -return -EINVAL ; - - r =amdgpu_ring_alloc (kiq_ring, kiq->pmf->map_queues_size * - adev->gfx.num_gfx_rings); -if (r) { -DRM_ERROR ("Failed to lock KIQ (%d).\n" , r); -return r; - } - -for (i =0 ; i < adev->gfx.num_gfx_rings; i++) - kiq->pmf->kiq_map_queues (kiq_ring, &adev->gfx.gfx_ring[i]); - -return amdgpu_ring_test_helper (kiq_ring); -} -static int gfx_v10_0_cp_async_gfx_ring_resume (struct amdgpu_device *adev) {int r, i;
@@ -6507,7 +6485,7 @@ static int gfx_v10_0_cp_async_gfx_ring_resume(struct amdgpu_device *adev) goto done; } - r =gfx_v10_0_kiq_enable_kgq (adev); + r =amdgpu_gfx_enable_kgq (adev,0 );if (r) goto done;
@@ -7178,28 +7156,6 @@ static int gfx_v10_0_hw_init(void *handle)return r; } -static int gfx_v10_0_kiq_disable_kgq (struct amdgpu_device *adev) -{ -struct amdgpu_kiq *kiq = &adev->gfx.kiq[0 ]; -struct amdgpu_ring *kiq_ring = &kiq->ring; -int i; - -if (!kiq->pmf || !kiq->pmf->kiq_unmap_queues) -return -EINVAL ; - -if (amdgpu_ring_alloc (kiq_ring, kiq->pmf->unmap_queues_size * - adev->gfx.num_gfx_rings)) -return -ENOMEM ; - -for (i =0 ; i < adev->gfx.num_gfx_rings; i++) - kiq->pmf->kiq_unmap_queues (kiq_ring, &adev->gfx.gfx_ring[i], -PREEMPT_QUEUES ,0 ,0 ); -if (!adev->job_hang) -return amdgpu_ring_test_helper (kiq_ring); -else -return 0 ; -} -static int gfx_v10_0_hw_fini (void *handle) {struct amdgpu_device *adev = (struct amdgpu_device *)handle;
@@ -7210,7 +7166,7 @@ static int gfx_v10_0_hw_fini(void *handle)if (!adev->no_hw_access) {if (amdgpu_async_gfx_ring) { - r =gfx_v10_0_kiq_disable_kgq (adev); + r =amdgpu_gfx_disable_kgq (adev,0 );if (r)DRM_ERROR ("KGQ disable failed\n" ); }
Signature · 1 line
2.40.0
Alex Deucher
maintainerPATCH 5/12 drm/amdgpu/gfx11: use generic [en/dis]able_kgq() helpers
In reply to Alex DeucherAnd remove the duplicate local variants.
--- drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c | 49 ++------------------------ 1 file changed, 2 insertions(+), 47 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c +2 -47
@@ -3710,28 +3710,6 @@ static int gfx_v11_0_gfx_init_queue(struct amdgpu_ring *ring)return 0 ; } -static int gfx_v11_0_kiq_enable_kgq (struct amdgpu_device *adev) -{ -struct amdgpu_kiq *kiq = &adev->gfx.kiq[0 ]; -struct amdgpu_ring *kiq_ring = &adev->gfx.kiq[0 ].ring; -int r, i; - -if (!kiq->pmf || !kiq->pmf->kiq_map_queues) -return -EINVAL ; - - r =amdgpu_ring_alloc (kiq_ring, kiq->pmf->map_queues_size * - adev->gfx.num_gfx_rings); -if (r) { -DRM_ERROR ("Failed to lock KIQ (%d).\n" , r); -return r; - } - -for (i =0 ; i < adev->gfx.num_gfx_rings; i++) - kiq->pmf->kiq_map_queues (kiq_ring, &adev->gfx.gfx_ring[i]); - -return amdgpu_ring_test_helper (kiq_ring); -} -static int gfx_v11_0_cp_async_gfx_ring_resume (struct amdgpu_device *adev) {int r, i;
@@ -3755,7 +3733,7 @@ static int gfx_v11_0_cp_async_gfx_ring_resume(struct amdgpu_device *adev) goto done; } - r =gfx_v11_0_kiq_enable_kgq (adev); + r =amdgpu_gfx_enable_kgq (adev,0 );if (r) goto done;
@@ -4392,29 +4370,6 @@ static int gfx_v11_0_hw_init(void *handle)return r; } -static int gfx_v11_0_kiq_disable_kgq (struct amdgpu_device *adev) -{ -struct amdgpu_kiq *kiq = &adev->gfx.kiq[0 ]; -struct amdgpu_ring *kiq_ring = &kiq->ring; -int i, r =0 ; - -if (!kiq->pmf || !kiq->pmf->kiq_unmap_queues) -return -EINVAL ; - -if (amdgpu_ring_alloc (kiq_ring, kiq->pmf->unmap_queues_size * - adev->gfx.num_gfx_rings)) -return -ENOMEM ; - -for (i =0 ; i < adev->gfx.num_gfx_rings; i++) - kiq->pmf->kiq_unmap_queues (kiq_ring, &adev->gfx.gfx_ring[i], -PREEMPT_QUEUES ,0 ,0 ); - -if (adev->gfx.kiq[0 ].ring.sched.ready) - r =amdgpu_ring_test_helper (kiq_ring); - -return r; -} -static int gfx_v11_0_hw_fini (void *handle) {struct amdgpu_device *adev = (struct amdgpu_device *)handle;
@@ -4426,7 +4381,7 @@ static int gfx_v11_0_hw_fini(void *handle)if (!adev->no_hw_access) {if (amdgpu_async_gfx_ring) { - r =gfx_v11_0_kiq_disable_kgq (adev); + r =amdgpu_gfx_disable_kgq (adev,0 );if (r)DRM_ERROR ("KGQ disable failed\n" ); }
Signature · 1 line
2.40.0
Alex Deucher
maintainerPATCH 6/12 drm/amdgpu/gfx10: drop unused variable
In reply to Alex DeucherJust check the return value directly.
--- drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +1 -3
@@ -7159,15 +7159,13 @@ static int gfx_v10_0_hw_init(void *handle)static int gfx_v10_0_hw_fini (void *handle) {struct amdgpu_device *adev = (struct amdgpu_device *)handle; -int r;amdgpu_irq_put (adev, &adev->gfx.priv_reg_irq,0 );amdgpu_irq_put (adev, &adev->gfx.priv_inst_irq,0 );if (!adev->no_hw_access) {if (amdgpu_async_gfx_ring) { - r =amdgpu_gfx_disable_kgq (adev,0 ); -if (r) +if (amdgpu_gfx_disable_kgq (adev,0 ))DRM_ERROR ("KGQ disable failed\n" ); }
Signature · 1 line
2.40.0
Re: [PATCH 06/12] drm/amdgpu/gfx10: drop unused variable
Am 27.04.23 um 17:27 schrieb Alex Deucher:
Quoted 3 lines
Just check the return value directly.
Signed-off-by Alex Deucher <[email protected]>
Quoted 25 lines
--- drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +1
-3@@ -7159,15 +7159,13 @@ static int gfx_v10_0_hw_init(void *handle)static int gfx_v10_0_hw_fini (void *handle) {struct amdgpu_device *adev = (struct amdgpu_device *)handle; -int r;amdgpu_irq_put (adev, &adev->gfx.priv_reg_irq,0 );amdgpu_irq_put (adev, &adev->gfx.priv_inst_irq,0 );if (!adev->no_hw_access) {if (amdgpu_async_gfx_ring) { - r =amdgpu_gfx_disable_kgq (adev,0 ); -if (r) +if (amdgpu_gfx_disable_kgq (adev,0 ))DRM_ERROR ("KGQ disable failed\n" ); }
Alex Deucher
maintainerPATCH 7/12 drm/amdgpu/gfx11: drop unused variable
In reply to Alex DeucherJust check the return value directly.
--- drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c +1 -3
@@ -4373,7 +4373,6 @@ static int gfx_v11_0_hw_init(void *handle)static int gfx_v11_0_hw_fini (void *handle) {struct amdgpu_device *adev = (struct amdgpu_device *)handle; -int r;amdgpu_irq_put (adev, &adev->gfx.cp_ecc_error_irq,0 );amdgpu_irq_put (adev, &adev->gfx.priv_reg_irq,0 );
@@ -4381,8 +4380,7 @@ static int gfx_v11_0_hw_fini(void *handle)if (!adev->no_hw_access) {if (amdgpu_async_gfx_ring) { - r =amdgpu_gfx_disable_kgq (adev,0 ); -if (r) +if (amdgpu_gfx_disable_kgq (adev,0 ))DRM_ERROR ("KGQ disable failed\n" ); }
Signature · 1 line
2.40.0
Re: [PATCH 07/12] drm/amdgpu/gfx11: drop unused variable
Am 27.04.23 um 17:27 schrieb Alex Deucher:
Quoted 3 lines
Just check the return value directly.
Signed-off-by Alex Deucher <[email protected]>
Quoted 26 lines
--- drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c +1
-3@@ -4373,7 +4373,6 @@ static int gfx_v11_0_hw_init(void *handle)static int gfx_v11_0_hw_fini (void *handle) {struct amdgpu_device *adev = (struct amdgpu_device *)handle; -int r;amdgpu_irq_put (adev, &adev->gfx.cp_ecc_error_irq,0 );amdgpu_irq_put (adev, &adev->gfx.priv_reg_irq,0 );@@ -4381,8 +4380,7 @@ static int gfx_v11_0_hw_fini(void *handle)if (!adev->no_hw_access) {if (amdgpu_async_gfx_ring) { - r =amdgpu_gfx_disable_kgq (adev,0 ); -if (r) +if (amdgpu_gfx_disable_kgq (adev,0 ))DRM_ERROR ("KGQ disable failed\n" ); }
Alex Deucher
maintainerPATCH 8/12 drm/amdgpu/gfx8: always restore kcq MQDs
In reply to Alex DeucherAlways restore the MQD not just when we do a reset. This allows us to move the MQD to VRAM if we want.
v2: always reset ring pointer as well (Christian)
--- drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +2 -4
@@ -4651,15 +4651,13 @@ static int gfx_v8_0_kcq_init_queue(struct amdgpu_ring *ring)if (adev->gfx.mec.mqd_backup[mqd_idx])memcpy (adev->gfx.mec.mqd_backup[mqd_idx], mqd,sizeof (struct vi_mqd_allocation )); - }else if (amdgpu_in_reset (adev)) {/* for GPU_RESET case */ -/* reset MQD to a clean status */ + }else { +/* restore MQD to a clean status */ if (adev->gfx.mec.mqd_backup[mqd_idx])memcpy (mqd, adev->gfx.mec.mqd_backup[mqd_idx],sizeof (struct vi_mqd_allocation ));/* reset ring buffer */ ring->wptr =0 ;amdgpu_ring_clear_ring (ring); - }else { -amdgpu_ring_clear_ring (ring); }return 0 ; }
Signature · 1 line
2.40.0
Re: [PATCH 08/12] drm/amdgpu/gfx8: always restore kcq MQDs
Am 27.04.23 um 17:27 schrieb Alex Deucher:
Quoted 6 lines
Always restore the MQD not just when we do a reset. This allows us to move the MQD to VRAM if we want.
v2: always reset ring pointer as well (Christian)
Signed-off-by Alex Deucher <[email protected]>
Quoted 26 lines
--- drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +2
-4@@ -4651,15 +4651,13 @@ static int gfx_v8_0_kcq_init_queue(struct amdgpu_ring *ring)if (adev->gfx.mec.mqd_backup[mqd_idx])memcpy (adev->gfx.mec.mqd_backup[mqd_idx], mqd,sizeof (struct vi_mqd_allocation )); - }else if (amdgpu_in_reset (adev)) {/* for GPU_RESET case */ -/* reset MQD to a clean status */ + }else { +/* restore MQD to a clean status */ if (adev->gfx.mec.mqd_backup[mqd_idx])memcpy (mqd, adev->gfx.mec.mqd_backup[mqd_idx],sizeof (struct vi_mqd_allocation ));/* reset ring buffer */ ring->wptr =0 ;amdgpu_ring_clear_ring (ring); - }else { -amdgpu_ring_clear_ring (ring); }return 0 ; }
Alex Deucher
maintainerPATCH 9/12 drm/amdgpu/gfx9: always restore kcq MQDs
In reply to Alex DeucherAlways restore the MQD not just when we do a reset. This allows us to move the MQD to VRAM if we want.
v2: always reset ring pointer as well (Christian)
--- drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 7 ++----- drivers/gpu/drm/amd/amdgpu/gfx_v9_4_3.c | 7 ++----- 2 files changed, 4 insertions(+), 10 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +2 -5
@@ -3591,17 +3591,14 @@ static int gfx_v9_0_kcq_init_queue(struct amdgpu_ring *ring)if (adev->gfx.mec.mqd_backup[mqd_idx])memcpy (adev->gfx.mec.mqd_backup[mqd_idx], mqd,sizeof (struct v9_mqd_allocation )); - }else if (amdgpu_in_reset (adev)) {/* for GPU_RESET case */ -/* reset MQD to a clean status */ + }else { +/* restore MQD to a clean status */ if (adev->gfx.mec.mqd_backup[mqd_idx])memcpy (mqd, adev->gfx.mec.mqd_backup[mqd_idx],sizeof (struct v9_mqd_allocation )); -/* reset ring buffer */ ring->wptr =0 ;atomic64_set ((atomic64_t *)ring->wptr_cpu_addr,0 );amdgpu_ring_clear_ring (ring); - }else { -amdgpu_ring_clear_ring (ring); }return 0 ;
drivers/gpu/drm/amd/amdgpu/gfx_v9_4_3.c +2 -5
@@ -1799,17 +1799,14 @@ static int gfx_v9_4_3_kcq_init_queue(struct amdgpu_ring *ring, int xcc_id)if (adev->gfx.mec.mqd_backup[mqd_idx])memcpy (adev->gfx.mec.mqd_backup[mqd_idx], mqd,sizeof (struct v9_mqd_allocation )); - }else if (amdgpu_in_reset (adev)) {/* for GPU_RESET case */ -/* reset MQD to a clean status */ + }else { +/* restore MQD to a clean status */ if (adev->gfx.mec.mqd_backup[mqd_idx])memcpy (mqd, adev->gfx.mec.mqd_backup[mqd_idx],sizeof (struct v9_mqd_allocation )); -/* reset ring buffer */ ring->wptr =0 ;atomic64_set ((atomic64_t *)&adev->wb.wb[ring->wptr_offs],0 );amdgpu_ring_clear_ring (ring); - }else { -amdgpu_ring_clear_ring (ring); }return 0 ;
Signature · 1 line
2.40.0
Alex Deucher
maintainerPATCH 10/12 drm/amdgpu/gfx10: always restore kcq/kgq MQDs
In reply to Alex DeucherAlways restore the MQD not just when we do a reset. This allows us to move the MQD to VRAM if we want.
v2: always reset ring pointer as well (Christian)
--- drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +4 -9
@@ -6447,16 +6447,14 @@ static int gfx_v10_0_gfx_init_queue(struct amdgpu_ring *ring)mutex_unlock (&adev->srbm_mutex);if (adev->gfx.me.mqd_backup[mqd_idx])memcpy (adev->gfx.me.mqd_backup[mqd_idx], mqd,sizeof (*mqd)); - }else if (amdgpu_in_reset (adev)) { -/* reset mqd with the backup copy */ + }else { +/* restore mqd with the backup copy */ if (adev->gfx.me.mqd_backup[mqd_idx])memcpy (mqd, adev->gfx.me.mqd_backup[mqd_idx],sizeof (*mqd));/* reset the ring */ ring->wptr =0 ; *ring->wptr_cpu_addr =0 ;amdgpu_ring_clear_ring (ring); - }else { -amdgpu_ring_clear_ring (ring); }return 0 ;
@@ -6780,17 +6778,14 @@ static int gfx_v10_0_kcq_init_queue(struct amdgpu_ring *ring)if (adev->gfx.mec.mqd_backup[mqd_idx])memcpy (adev->gfx.mec.mqd_backup[mqd_idx], mqd,sizeof (*mqd)); - }else if (amdgpu_in_reset (adev)) {/* for GPU_RESET case */ -/* reset MQD to a clean status */ + }else { +/* restore MQD to a clean status */ if (adev->gfx.mec.mqd_backup[mqd_idx])memcpy (mqd, adev->gfx.mec.mqd_backup[mqd_idx],sizeof (*mqd)); -/* reset ring buffer */ ring->wptr =0 ;atomic64_set ((atomic64_t *)ring->wptr_cpu_addr,0 );amdgpu_ring_clear_ring (ring); - }else { -amdgpu_ring_clear_ring (ring); }return 0 ;
Signature · 1 line
2.40.0
Alex Deucher
maintainerPATCH 11/12 drm/amdgpu/gfx11: always restore kcq/kgq MQDs
In reply to Alex DeucherAlways restore the MQD not just when we do a reset. This allows us to move the MQD to VRAM if we want.
v2: always reset ring pointer as well (Christian)
--- drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c +4 -9
@@ -3695,16 +3695,14 @@ static int gfx_v11_0_gfx_init_queue(struct amdgpu_ring *ring)mutex_unlock (&adev->srbm_mutex);if (adev->gfx.me.mqd_backup[mqd_idx])memcpy (adev->gfx.me.mqd_backup[mqd_idx], mqd,sizeof (*mqd)); - }else if (amdgpu_in_reset (adev)) { -/* reset mqd with the backup copy */ + }else { +/* restore mqd with the backup copy */ if (adev->gfx.me.mqd_backup[mqd_idx])memcpy (mqd, adev->gfx.me.mqd_backup[mqd_idx],sizeof (*mqd));/* reset the ring */ ring->wptr =0 ; *ring->wptr_cpu_addr =0 ;amdgpu_ring_clear_ring (ring); - }else { -amdgpu_ring_clear_ring (ring); }return 0 ;
@@ -4043,17 +4041,14 @@ static int gfx_v11_0_kcq_init_queue(struct amdgpu_ring *ring)if (adev->gfx.mec.mqd_backup[mqd_idx])memcpy (adev->gfx.mec.mqd_backup[mqd_idx], mqd,sizeof (*mqd)); - }else if (amdgpu_in_reset (adev)) {/* for GPU_RESET case */ -/* reset MQD to a clean status */ + }else { +/* restore MQD to a clean status */ if (adev->gfx.mec.mqd_backup[mqd_idx])memcpy (mqd, adev->gfx.mec.mqd_backup[mqd_idx],sizeof (*mqd)); -/* reset ring buffer */ ring->wptr =0 ;atomic64_set ((atomic64_t *)ring->wptr_cpu_addr,0 );amdgpu_ring_clear_ring (ring); - }else { -amdgpu_ring_clear_ring (ring); }return 0 ;
Signature · 1 line
2.40.0
Alex Deucher
maintainerPATCH 12/12 drm/amdgpu: put MQDs in VRAM
In reply to Alex DeucherReduces preemption latency.
v2: move MES MQDs into VRAM as well (YuBiao)
v3: enable on gfx10, 11 only (Alex)
--- drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c | 4 ++++ drivers/gpu/drm/amd/amdgpu/mes_v10_1.c | 1 + drivers/gpu/drm/amd/amdgpu/mes_v11_0.c | 1 + 3 files changed, 6 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c +4 -0
@@ -382,6 +382,8 @@ int amdgpu_gfx_mqd_sw_init(struct amdgpu_device *adev,int r, i;struct amdgpu_kiq *kiq = &adev->gfx.kiq[xcc_id];struct amdgpu_ring *ring = &kiq->ring; +u32 domain_vram = adev->ip_versions[GC_HWIP ][0 ] >=IP_VERSION (10 ,0 ,0 ) ? +AMDGPU_GEM_DOMAIN_VRAM :0 ;/* create MQD for KIQ */ if (!adev->enable_mes_kiq && !ring->mqd_obj) {
@@ -413,6 +415,7 @@ int amdgpu_gfx_mqd_sw_init(struct amdgpu_device *adev, ring = &adev->gfx.gfx_ring[i];if (!ring->mqd_obj) { r =amdgpu_bo_create_kernel (adev, mqd_size,PAGE_SIZE , + domain_vram |AMDGPU_GEM_DOMAIN_GTT , &ring->mqd_obj, &ring->mqd_gpu_addr, &ring->mqd_ptr);if (r) {
@@ -434,6 +437,7 @@ int amdgpu_gfx_mqd_sw_init(struct amdgpu_device *adev, ring = &adev->gfx.compute_ring[i + xcc_id * adev->gfx.num_compute_rings];if (!ring->mqd_obj) { r =amdgpu_bo_create_kernel (adev, mqd_size,PAGE_SIZE , + domain_vram |AMDGPU_GEM_DOMAIN_GTT , &ring->mqd_obj, &ring->mqd_gpu_addr, &ring->mqd_ptr);if (r) {
drivers/gpu/drm/amd/amdgpu/mes_v10_1.c +1 -0
@@ -901,6 +901,7 @@ static int mes_v10_1_mqd_sw_init(struct amdgpu_device *adev,return 0 ; r =amdgpu_bo_create_kernel (adev, mqd_size,PAGE_SIZE , +AMDGPU_GEM_DOMAIN_VRAM |AMDGPU_GEM_DOMAIN_GTT , &ring->mqd_obj, &ring->mqd_gpu_addr, &ring->mqd_ptr);if (r) {
drivers/gpu/drm/amd/amdgpu/mes_v11_0.c +1 -0
@@ -999,6 +999,7 @@ static int mes_v11_0_mqd_sw_init(struct amdgpu_device *adev,return 0 ; r =amdgpu_bo_create_kernel (adev, mqd_size,PAGE_SIZE , +AMDGPU_GEM_DOMAIN_VRAM |AMDGPU_GEM_DOMAIN_GTT , &ring->mqd_obj, &ring->mqd_gpu_addr, &ring->mqd_ptr);if (r) {
Signature · 1 line
2.40.0
Re: [PATCH 12/12] drm/amdgpu: put MQDs in VRAM
Am 27.04.23 um 17:27 schrieb Alex Deucher:
Quoted 4 lines
Reduces preemption latency.
v2: move MES MQDs into VRAM as well (YuBiao)
v3: enable on gfx10, 11 only (Alex)
The why we do that not for gfx9 is missing.
Quoted 13 lines
Signed-off-by Alex Deucher <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c | 4 ++++ drivers/gpu/drm/amd/amdgpu/mes_v10_1.c | 1 + drivers/gpu/drm/amd/amdgpu/mes_v11_0.c | 1 + 3 files changed, 6 insertions(+)drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c +0
-0
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c int amdgpu_gfx_mqd_sw_init(struct amdgpu_device *adev, · line 386
Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c +2
-0@@ -382,6 +382,8 @@ int amdgpu_gfx_mqd_sw_init(struct amdgpu_device *adev,int r, i;struct amdgpu_kiq *kiq = &adev->gfx.kiq[xcc_id];struct amdgpu_ring *ring = &kiq->ring; +u32 domain_vram = adev->ip_versions[GC_HWIP ][0 ] >=IP_VERSION (10 ,0 ,0 ) ? +AMDGPU_GEM_DOMAIN_VRAM :0 ;
Maybe cleaner to do something like:
domain = AMDGPU_GEM_DOMAIN_GTT;
if (...)
domain |= AMDGPU_GEM_DOMAIN_VRAM;
Christian.
Quoted 43 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c +2
-0/* create MQD for KIQ */ if (!adev->enable_mes_kiq && !ring->mqd_obj) {@@ -413,6 +415,7 @@ int amdgpu_gfx_mqd_sw_init(struct amdgpu_device *adev, ring = &adev->gfx.gfx_ring[i];if (!ring->mqd_obj) { r =amdgpu_bo_create_kernel (adev, mqd_size,PAGE_SIZE , + domain_vram |AMDGPU_GEM_DOMAIN_GTT , &ring->mqd_obj, &ring->mqd_gpu_addr, &ring->mqd_ptr);if (r) {@@ -434,6 +437,7 @@ int amdgpu_gfx_mqd_sw_init(struct amdgpu_device *adev, ring = &adev->gfx.compute_ring[i + xcc_id * adev->gfx.num_compute_rings];if (!ring->mqd_obj) { r =amdgpu_bo_create_kernel (adev, mqd_size,PAGE_SIZE , + domain_vram |AMDGPU_GEM_DOMAIN_GTT , &ring->mqd_obj, &ring->mqd_gpu_addr, &ring->mqd_ptr);if (r) {drivers/gpu/drm/amd/amdgpu/mes_v10_1.c +1
-0@@ -901,6 +901,7 @@ static int mes_v10_1_mqd_sw_init(struct amdgpu_device *adev,return 0 ; r =amdgpu_bo_create_kernel (adev, mqd_size,PAGE_SIZE , +AMDGPU_GEM_DOMAIN_VRAM |AMDGPU_GEM_DOMAIN_GTT , &ring->mqd_obj, &ring->mqd_gpu_addr, &ring->mqd_ptr);if (r) {drivers/gpu/drm/amd/amdgpu/mes_v11_0.c +1
-0@@ -999,6 +999,7 @@ static int mes_v11_0_mqd_sw_init(struct amdgpu_device *adev,return 0 ; r =amdgpu_bo_create_kernel (adev, mqd_size,PAGE_SIZE , +AMDGPU_GEM_DOMAIN_VRAM |AMDGPU_GEM_DOMAIN_GTT , &ring->mqd_obj, &ring->mqd_gpu_addr, &ring->mqd_ptr);if (r) {
Re: [PATCH 12/12] drm/amdgpu: put MQDs in VRAM
Quoted 8 lines · Christian König
Am 27.04.23 um 17:27 schrieb Alex Deucher:
Quoted 4 lines
Reduces preemption latency.
v2: move MES MQDs into VRAM as well (YuBiao)
v3: enable on gfx10, 11 only (Alex)The why we do that not for gfx9 is missing.
We could do it for gfx8-11. That said, gfx8 and 9 are working fine and there's no reasons to change them at this point. Less chance for regressions. I'll update the commit message.
Quoted 22 lines
Quoted 14 lines
Signed-off-by Alex Deucher <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c | 4 ++++ drivers/gpu/drm/amd/amdgpu/mes_v10_1.c | 1 + drivers/gpu/drm/amd/amdgpu/mes_v11_0.c | 1 + 3 files changed, 6 insertions(+)drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c +0
-0drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c int amdgpu_gfx_mqd_sw_init(struct amdgpu_device *adev, · line 386
Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c +2
-0@@ -382,6 +382,8 @@ int amdgpu_gfx_mqd_sw_init(struct amdgpu_device *adev,int r, i;struct amdgpu_kiq *kiq = &adev->gfx.kiq[xcc_id];struct amdgpu_ring *ring = &kiq->ring; +u32 domain_vram = adev->ip_versions[GC_HWIP ][0 ] >=IP_VERSION (10 ,0 ,0 ) ? +AMDGPU_GEM_DOMAIN_VRAM :0 ;Maybe cleaner to do something like:
Quoted 4 lines
domain = AMDGPU_GEM_DOMAIN_GTT;
if (...)
domain |= AMDGPU_GEM_DOMAIN_VRAM;I can fix that up.
Thanks,
Alex
Quoted 46 lines
Christian.
Quoted 43 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c +2
-0/* create MQD for KIQ */ if (!adev->enable_mes_kiq && !ring->mqd_obj) {@@ -413,6 +415,7 @@ int amdgpu_gfx_mqd_sw_init(struct amdgpu_device *adev, ring = &adev->gfx.gfx_ring[i];if (!ring->mqd_obj) { r =amdgpu_bo_create_kernel (adev, mqd_size,PAGE_SIZE , + domain_vram |AMDGPU_GEM_DOMAIN_GTT , &ring->mqd_obj, &ring->mqd_gpu_addr, &ring->mqd_ptr);if (r) {@@ -434,6 +437,7 @@ int amdgpu_gfx_mqd_sw_init(struct amdgpu_device *adev, ring = &adev->gfx.compute_ring[i + xcc_id * adev->gfx.num_compute_rings];if (!ring->mqd_obj) { r =amdgpu_bo_create_kernel (adev, mqd_size,PAGE_SIZE , + domain_vram |AMDGPU_GEM_DOMAIN_GTT , &ring->mqd_obj, &ring->mqd_gpu_addr, &ring->mqd_ptr);if (r) {drivers/gpu/drm/amd/amdgpu/mes_v10_1.c +1
-0@@ -901,6 +901,7 @@ static int mes_v10_1_mqd_sw_init(struct amdgpu_device *adev,return 0 ; r =amdgpu_bo_create_kernel (adev, mqd_size,PAGE_SIZE , +AMDGPU_GEM_DOMAIN_VRAM |AMDGPU_GEM_DOMAIN_GTT , &ring->mqd_obj, &ring->mqd_gpu_addr, &ring->mqd_ptr);if (r) {drivers/gpu/drm/amd/amdgpu/mes_v11_0.c +1
-0@@ -999,6 +999,7 @@ static int mes_v11_0_mqd_sw_init(struct amdgpu_device *adev,return 0 ; r =amdgpu_bo_create_kernel (adev, mqd_size,PAGE_SIZE , +AMDGPU_GEM_DOMAIN_VRAM |AMDGPU_GEM_DOMAIN_GTT , &ring->mqd_obj, &ring->mqd_gpu_addr, &ring->mqd_ptr);if (r) {