aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c')
-rw-r--r--drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c77
1 files changed, 35 insertions, 42 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c
index 40abb6b81c09..96dd05dca694 100644
--- a/drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c
@@ -1940,7 +1940,7 @@ static int gfx_v6_0_cp_resume(struct amdgpu_device *adev)
1940 1940
1941static void gfx_v6_0_ring_emit_pipeline_sync(struct amdgpu_ring *ring) 1941static void gfx_v6_0_ring_emit_pipeline_sync(struct amdgpu_ring *ring)
1942{ 1942{
1943 int usepfp = (ring->type == AMDGPU_RING_TYPE_GFX); 1943 int usepfp = (ring->funcs->type == AMDGPU_RING_TYPE_GFX);
1944 uint32_t seq = ring->fence_drv.sync_seq; 1944 uint32_t seq = ring->fence_drv.sync_seq;
1945 uint64_t addr = ring->fence_drv.gpu_addr; 1945 uint64_t addr = ring->fence_drv.gpu_addr;
1946 1946
@@ -1966,7 +1966,7 @@ static void gfx_v6_0_ring_emit_pipeline_sync(struct amdgpu_ring *ring)
1966static void gfx_v6_0_ring_emit_vm_flush(struct amdgpu_ring *ring, 1966static void gfx_v6_0_ring_emit_vm_flush(struct amdgpu_ring *ring,
1967 unsigned vm_id, uint64_t pd_addr) 1967 unsigned vm_id, uint64_t pd_addr)
1968{ 1968{
1969 int usepfp = (ring->type == AMDGPU_RING_TYPE_GFX); 1969 int usepfp = (ring->funcs->type == AMDGPU_RING_TYPE_GFX);
1970 1970
1971 /* write new base address */ 1971 /* write new base address */
1972 amdgpu_ring_write(ring, PACKET3(PACKET3_WRITE_DATA, 3)); 1972 amdgpu_ring_write(ring, PACKET3(PACKET3_WRITE_DATA, 3));
@@ -2814,33 +2814,6 @@ static void gfx_v6_ring_emit_cntxcntl(struct amdgpu_ring *ring, uint32_t flags)
2814 amdgpu_ring_write(ring, 0); 2814 amdgpu_ring_write(ring, 0);
2815} 2815}
2816 2816
2817static unsigned gfx_v6_0_ring_get_emit_ib_size(struct amdgpu_ring *ring)
2818{
2819 return
2820 6; /* gfx_v6_0_ring_emit_ib */
2821}
2822
2823static unsigned gfx_v6_0_ring_get_dma_frame_size_gfx(struct amdgpu_ring *ring)
2824{
2825 return
2826 5 + /* gfx_v6_0_ring_emit_hdp_flush */
2827 5 + /* gfx_v6_0_ring_emit_hdp_invalidate */
2828 14 + 14 + 14 + /* gfx_v6_0_ring_emit_fence x3 for user fence, vm fence */
2829 7 + 4 + /* gfx_v6_0_ring_emit_pipeline_sync */
2830 17 + 6 + /* gfx_v6_0_ring_emit_vm_flush */
2831 3; /* gfx_v6_ring_emit_cntxcntl */
2832}
2833
2834static unsigned gfx_v6_0_ring_get_dma_frame_size_compute(struct amdgpu_ring *ring)
2835{
2836 return
2837 5 + /* gfx_v6_0_ring_emit_hdp_flush */
2838 5 + /* gfx_v6_0_ring_emit_hdp_invalidate */
2839 7 + /* gfx_v6_0_ring_emit_pipeline_sync */
2840 17 + /* gfx_v6_0_ring_emit_vm_flush */
2841 14 + 14 + 14; /* gfx_v6_0_ring_emit_fence x3 for user fence, vm fence */
2842}
2843
2844static const struct amdgpu_gfx_funcs gfx_v6_0_gfx_funcs = { 2817static const struct amdgpu_gfx_funcs gfx_v6_0_gfx_funcs = {
2845 .get_gpu_clock_counter = &gfx_v6_0_get_gpu_clock_counter, 2818 .get_gpu_clock_counter = &gfx_v6_0_get_gpu_clock_counter,
2846 .select_se_sh = &gfx_v6_0_select_se_sh, 2819 .select_se_sh = &gfx_v6_0_select_se_sh,
@@ -2896,9 +2869,7 @@ static int gfx_v6_0_sw_init(void *handle)
2896 ring->ring_obj = NULL; 2869 ring->ring_obj = NULL;
2897 sprintf(ring->name, "gfx"); 2870 sprintf(ring->name, "gfx");
2898 r = amdgpu_ring_init(adev, ring, 1024, 2871 r = amdgpu_ring_init(adev, ring, 1024,
2899 0x80000000, 0xf, 2872 &adev->gfx.eop_irq, AMDGPU_CP_IRQ_GFX_EOP);
2900 &adev->gfx.eop_irq, AMDGPU_CP_IRQ_GFX_EOP,
2901 AMDGPU_RING_TYPE_GFX);
2902 if (r) 2873 if (r)
2903 return r; 2874 return r;
2904 } 2875 }
@@ -2920,9 +2891,7 @@ static int gfx_v6_0_sw_init(void *handle)
2920 sprintf(ring->name, "comp %d.%d.%d", ring->me, ring->pipe, ring->queue); 2891 sprintf(ring->name, "comp %d.%d.%d", ring->me, ring->pipe, ring->queue);
2921 irq_type = AMDGPU_CP_IRQ_COMPUTE_MEC1_PIPE0_EOP + ring->pipe; 2892 irq_type = AMDGPU_CP_IRQ_COMPUTE_MEC1_PIPE0_EOP + ring->pipe;
2922 r = amdgpu_ring_init(adev, ring, 1024, 2893 r = amdgpu_ring_init(adev, ring, 1024,
2923 0x80000000, 0xf, 2894 &adev->gfx.eop_irq, irq_type);
2924 &adev->gfx.eop_irq, irq_type,
2925 AMDGPU_RING_TYPE_COMPUTE);
2926 if (r) 2895 if (r)
2927 return r; 2896 return r;
2928 } 2897 }
@@ -3237,7 +3206,7 @@ static int gfx_v6_0_set_powergating_state(void *handle,
3237 return 0; 3206 return 0;
3238} 3207}
3239 3208
3240const struct amd_ip_funcs gfx_v6_0_ip_funcs = { 3209static const struct amd_ip_funcs gfx_v6_0_ip_funcs = {
3241 .name = "gfx_v6_0", 3210 .name = "gfx_v6_0",
3242 .early_init = gfx_v6_0_early_init, 3211 .early_init = gfx_v6_0_early_init,
3243 .late_init = NULL, 3212 .late_init = NULL,
@@ -3255,10 +3224,20 @@ const struct amd_ip_funcs gfx_v6_0_ip_funcs = {
3255}; 3224};
3256 3225
3257static const struct amdgpu_ring_funcs gfx_v6_0_ring_funcs_gfx = { 3226static const struct amdgpu_ring_funcs gfx_v6_0_ring_funcs_gfx = {
3227 .type = AMDGPU_RING_TYPE_GFX,
3228 .align_mask = 0xff,
3229 .nop = 0x80000000,
3258 .get_rptr = gfx_v6_0_ring_get_rptr, 3230 .get_rptr = gfx_v6_0_ring_get_rptr,
3259 .get_wptr = gfx_v6_0_ring_get_wptr, 3231 .get_wptr = gfx_v6_0_ring_get_wptr,
3260 .set_wptr = gfx_v6_0_ring_set_wptr_gfx, 3232 .set_wptr = gfx_v6_0_ring_set_wptr_gfx,
3261 .parse_cs = NULL, 3233 .emit_frame_size =
3234 5 + /* gfx_v6_0_ring_emit_hdp_flush */
3235 5 + /* gfx_v6_0_ring_emit_hdp_invalidate */
3236 14 + 14 + 14 + /* gfx_v6_0_ring_emit_fence x3 for user fence, vm fence */
3237 7 + 4 + /* gfx_v6_0_ring_emit_pipeline_sync */
3238 17 + 6 + /* gfx_v6_0_ring_emit_vm_flush */
3239 3, /* gfx_v6_ring_emit_cntxcntl */
3240 .emit_ib_size = 6, /* gfx_v6_0_ring_emit_ib */
3262 .emit_ib = gfx_v6_0_ring_emit_ib, 3241 .emit_ib = gfx_v6_0_ring_emit_ib,
3263 .emit_fence = gfx_v6_0_ring_emit_fence, 3242 .emit_fence = gfx_v6_0_ring_emit_fence,
3264 .emit_pipeline_sync = gfx_v6_0_ring_emit_pipeline_sync, 3243 .emit_pipeline_sync = gfx_v6_0_ring_emit_pipeline_sync,
@@ -3269,15 +3248,22 @@ static const struct amdgpu_ring_funcs gfx_v6_0_ring_funcs_gfx = {
3269 .test_ib = gfx_v6_0_ring_test_ib, 3248 .test_ib = gfx_v6_0_ring_test_ib,
3270 .insert_nop = amdgpu_ring_insert_nop, 3249 .insert_nop = amdgpu_ring_insert_nop,
3271 .emit_cntxcntl = gfx_v6_ring_emit_cntxcntl, 3250 .emit_cntxcntl = gfx_v6_ring_emit_cntxcntl,
3272 .get_emit_ib_size = gfx_v6_0_ring_get_emit_ib_size,
3273 .get_dma_frame_size = gfx_v6_0_ring_get_dma_frame_size_gfx,
3274}; 3251};
3275 3252
3276static const struct amdgpu_ring_funcs gfx_v6_0_ring_funcs_compute = { 3253static const struct amdgpu_ring_funcs gfx_v6_0_ring_funcs_compute = {
3254 .type = AMDGPU_RING_TYPE_COMPUTE,
3255 .align_mask = 0xff,
3256 .nop = 0x80000000,
3277 .get_rptr = gfx_v6_0_ring_get_rptr, 3257 .get_rptr = gfx_v6_0_ring_get_rptr,
3278 .get_wptr = gfx_v6_0_ring_get_wptr, 3258 .get_wptr = gfx_v6_0_ring_get_wptr,
3279 .set_wptr = gfx_v6_0_ring_set_wptr_compute, 3259 .set_wptr = gfx_v6_0_ring_set_wptr_compute,
3280 .parse_cs = NULL, 3260 .emit_frame_size =
3261 5 + /* gfx_v6_0_ring_emit_hdp_flush */
3262 5 + /* gfx_v6_0_ring_emit_hdp_invalidate */
3263 7 + /* gfx_v6_0_ring_emit_pipeline_sync */
3264 17 + /* gfx_v6_0_ring_emit_vm_flush */
3265 14 + 14 + 14, /* gfx_v6_0_ring_emit_fence x3 for user fence, vm fence */
3266 .emit_ib_size = 6, /* gfx_v6_0_ring_emit_ib */
3281 .emit_ib = gfx_v6_0_ring_emit_ib, 3267 .emit_ib = gfx_v6_0_ring_emit_ib,
3282 .emit_fence = gfx_v6_0_ring_emit_fence, 3268 .emit_fence = gfx_v6_0_ring_emit_fence,
3283 .emit_pipeline_sync = gfx_v6_0_ring_emit_pipeline_sync, 3269 .emit_pipeline_sync = gfx_v6_0_ring_emit_pipeline_sync,
@@ -3287,8 +3273,6 @@ static const struct amdgpu_ring_funcs gfx_v6_0_ring_funcs_compute = {
3287 .test_ring = gfx_v6_0_ring_test_ring, 3273 .test_ring = gfx_v6_0_ring_test_ring,
3288 .test_ib = gfx_v6_0_ring_test_ib, 3274 .test_ib = gfx_v6_0_ring_test_ib,
3289 .insert_nop = amdgpu_ring_insert_nop, 3275 .insert_nop = amdgpu_ring_insert_nop,
3290 .get_emit_ib_size = gfx_v6_0_ring_get_emit_ib_size,
3291 .get_dma_frame_size = gfx_v6_0_ring_get_dma_frame_size_compute,
3292}; 3276};
3293 3277
3294static void gfx_v6_0_set_ring_funcs(struct amdgpu_device *adev) 3278static void gfx_v6_0_set_ring_funcs(struct amdgpu_device *adev)
@@ -3360,3 +3344,12 @@ static void gfx_v6_0_get_cu_info(struct amdgpu_device *adev)
3360 cu_info->number = active_cu_number; 3344 cu_info->number = active_cu_number;
3361 cu_info->ao_cu_mask = ao_cu_mask; 3345 cu_info->ao_cu_mask = ao_cu_mask;
3362} 3346}
3347
3348const struct amdgpu_ip_block_version gfx_v6_0_ip_block =
3349{
3350 .type = AMD_IP_BLOCK_TYPE_GFX,
3351 .major = 6,
3352 .minor = 0,
3353 .rev = 0,
3354 .funcs = &gfx_v6_0_ip_funcs,
3355};