drm/amdgpu: clarify MEC_HPD_SIZE is specific to a gfx generation
authorAndres Rodriguez <andresx7@gmail.com>
Wed, 12 Apr 2017 20:53:50 +0000 (16:53 -0400)
committerAlex Deucher <alexander.deucher@amd.com>
Wed, 31 May 2017 20:48:45 +0000 (16:48 -0400)
Rename MEC_HPD_SIZE to GFXN_MEC_HPD_SIZE to clarify it is specific to a
gfx generation.

Signed-off-by: Andres Rodriguez <andresx7@gmail.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c

index e27262bc0fd1eb7bff0e27ad9d437d0eb6b7de61..3372ad10eb5aebfdfbc0d174b65bb52b43051a93 100644 (file)
@@ -49,6 +49,7 @@
 
 #define GFX7_NUM_GFX_RINGS     1
 #define GFX7_NUM_COMPUTE_RINGS 8
+#define GFX7_MEC_HPD_SIZE      2048
 
 static void gfx_v7_0_set_ring_funcs(struct amdgpu_device *adev);
 static void gfx_v7_0_set_irq_funcs(struct amdgpu_device *adev);
@@ -2821,8 +2822,6 @@ static void gfx_v7_0_mec_fini(struct amdgpu_device *adev)
        }
 }
 
-#define MEC_HPD_SIZE 2048
-
 static int gfx_v7_0_mec_init(struct amdgpu_device *adev)
 {
        int r;
@@ -2840,7 +2839,7 @@ static int gfx_v7_0_mec_init(struct amdgpu_device *adev)
 
        if (adev->gfx.mec.hpd_eop_obj == NULL) {
                r = amdgpu_bo_create(adev,
-                                    adev->gfx.mec.num_mec *adev->gfx.mec.num_pipe * MEC_HPD_SIZE * 2,
+                                    adev->gfx.mec.num_mec * adev->gfx.mec.num_pipe * GFX7_MEC_HPD_SIZE * 2,
                                     PAGE_SIZE, true,
                                     AMDGPU_GEM_DOMAIN_GTT, 0, NULL, NULL,
                                     &adev->gfx.mec.hpd_eop_obj);
@@ -2870,7 +2869,7 @@ static int gfx_v7_0_mec_init(struct amdgpu_device *adev)
        }
 
        /* clear memory.  Not sure if this is required or not */
-       memset(hpd, 0, adev->gfx.mec.num_mec *adev->gfx.mec.num_pipe * MEC_HPD_SIZE * 2);
+       memset(hpd, 0, adev->gfx.mec.num_mec * adev->gfx.mec.num_pipe * GFX7_MEC_HPD_SIZE * 2);
 
        amdgpu_bo_kunmap(adev->gfx.mec.hpd_eop_obj);
        amdgpu_bo_unreserve(adev->gfx.mec.hpd_eop_obj);
@@ -2978,7 +2977,7 @@ static int gfx_v7_0_cp_compute_resume(struct amdgpu_device *adev)
                int me = (i < 4) ? 1 : 2;
                int pipe = (i < 4) ? i : (i - 4);
 
-               eop_gpu_addr = adev->gfx.mec.hpd_eop_gpu_addr + (i * MEC_HPD_SIZE * 2);
+               eop_gpu_addr = adev->gfx.mec.hpd_eop_gpu_addr + (i * GFX7_MEC_HPD_SIZE * 2);
 
                cik_srbm_select(adev, me, pipe, 0, 0);
 
@@ -2992,7 +2991,7 @@ static int gfx_v7_0_cp_compute_resume(struct amdgpu_device *adev)
                /* set the EOP size, register value is 2^(EOP_SIZE+1) dwords */
                tmp = RREG32(mmCP_HPD_EOP_CONTROL);
                tmp &= ~CP_HPD_EOP_CONTROL__EOP_SIZE_MASK;
-               tmp |= order_base_2(MEC_HPD_SIZE / 8);
+               tmp |= order_base_2(GFX7_MEC_HPD_SIZE / 8);
                WREG32(mmCP_HPD_EOP_CONTROL, tmp);
        }
        cik_srbm_select(adev, 0, 0, 0, 0);
index 58cc585f57968578d52a817f6f2bed7b5a7a79e1..1a15c5e16b2f59f0042ca8b5929a59f5704d7d3e 100644 (file)
@@ -53,6 +53,7 @@
 
 #define GFX8_NUM_GFX_RINGS     1
 #define GFX8_NUM_COMPUTE_RINGS 8
+#define GFX8_MEC_HPD_SIZE 2048
 
 #define TOPAZ_GB_ADDR_CONFIG_GOLDEN 0x22010001
 #define CARRIZO_GB_ADDR_CONFIG_GOLDEN 0x22010001
@@ -1421,8 +1422,6 @@ static void gfx_v8_0_kiq_free_ring(struct amdgpu_ring *ring,
        amdgpu_ring_fini(ring);
 }
 
-#define MEC_HPD_SIZE 2048
-
 static int gfx_v8_0_mec_init(struct amdgpu_device *adev)
 {
        int r;
@@ -1438,7 +1437,7 @@ static int gfx_v8_0_mec_init(struct amdgpu_device *adev)
 
        if (adev->gfx.mec.hpd_eop_obj == NULL) {
                r = amdgpu_bo_create(adev,
-                                    adev->gfx.mec.num_queue * MEC_HPD_SIZE,
+                                    adev->gfx.mec.num_queue * GFX8_MEC_HPD_SIZE,
                                     PAGE_SIZE, true,
                                     AMDGPU_GEM_DOMAIN_GTT, 0, NULL, NULL,
                                     &adev->gfx.mec.hpd_eop_obj);
@@ -1467,7 +1466,7 @@ static int gfx_v8_0_mec_init(struct amdgpu_device *adev)
                return r;
        }
 
-       memset(hpd, 0, adev->gfx.mec.num_queue * MEC_HPD_SIZE);
+       memset(hpd, 0, adev->gfx.mec.num_queue * GFX8_MEC_HPD_SIZE);
 
        amdgpu_bo_kunmap(adev->gfx.mec.hpd_eop_obj);
        amdgpu_bo_unreserve(adev->gfx.mec.hpd_eop_obj);
@@ -1488,7 +1487,7 @@ static int gfx_v8_0_kiq_init(struct amdgpu_device *adev)
        u32 *hpd;
        struct amdgpu_kiq *kiq = &adev->gfx.kiq;
 
-       r = amdgpu_bo_create_kernel(adev, MEC_HPD_SIZE, PAGE_SIZE,
+       r = amdgpu_bo_create_kernel(adev, GFX8_MEC_HPD_SIZE, PAGE_SIZE,
                                    AMDGPU_GEM_DOMAIN_GTT, &kiq->eop_obj,
                                    &kiq->eop_gpu_addr, (void **)&hpd);
        if (r) {
@@ -1496,7 +1495,7 @@ static int gfx_v8_0_kiq_init(struct amdgpu_device *adev)
                return r;
        }
 
-       memset(hpd, 0, MEC_HPD_SIZE);
+       memset(hpd, 0, GFX8_MEC_HPD_SIZE);
 
        r = amdgpu_bo_reserve(kiq->eop_obj, true);
        if (unlikely(r != 0))
@@ -2175,7 +2174,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);
+               ring->eop_gpu_addr = adev->gfx.mec.hpd_eop_gpu_addr + (i * GFX8_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 */
@@ -4795,7 +4794,7 @@ static int gfx_v8_0_mqd_init(struct amdgpu_ring *ring)
        /* set the EOP size, register value is 2^(EOP_SIZE+1) dwords */
        tmp = RREG32(mmCP_HQD_EOP_CONTROL);
        tmp = REG_SET_FIELD(tmp, CP_HQD_EOP_CONTROL, EOP_SIZE,
-                       (order_base_2(MEC_HPD_SIZE / 4) - 1));
+                       (order_base_2(GFX8_MEC_HPD_SIZE / 4) - 1));
 
        mqd->cp_hqd_eop_control = tmp;
 
index f97fc0dafc36c81bcace4d8fe64528d5e2828d1a..9a0029d80ff478f80da58411ad7e87c7636e39a8 100644 (file)
@@ -39,6 +39,7 @@
 
 #define GFX9_NUM_GFX_RINGS     1
 #define GFX9_NUM_COMPUTE_RINGS 8
+#define GFX9_MEC_HPD_SIZE 2048
 #define RLCG_UCODE_LOADING_START_ADDRESS 0x00002000L
 #define RLC_SAVE_RESTORE_ADDR_STARTING_OFFSET 0x00000000L
 #define GFX9_RLC_FORMAT_DIRECT_REG_LIST_LENGTH 34
@@ -857,8 +858,6 @@ static void gfx_v9_0_mec_fini(struct amdgpu_device *adev)
        }
 }
 
-#define MEC_HPD_SIZE 2048
-
 static int gfx_v9_0_mec_init(struct amdgpu_device *adev)
 {
        int r;
@@ -879,7 +878,7 @@ static int gfx_v9_0_mec_init(struct amdgpu_device *adev)
 
        if (adev->gfx.mec.hpd_eop_obj == NULL) {
                r = amdgpu_bo_create(adev,
-                                    adev->gfx.mec.num_queue * MEC_HPD_SIZE,
+                                    adev->gfx.mec.num_queue * GFX9_MEC_HPD_SIZE,
                                     PAGE_SIZE, true,
                                     AMDGPU_GEM_DOMAIN_GTT, 0, NULL, NULL,
                                     &adev->gfx.mec.hpd_eop_obj);
@@ -972,7 +971,7 @@ static int gfx_v9_0_kiq_init(struct amdgpu_device *adev)
        u32 *hpd;
        struct amdgpu_kiq *kiq = &adev->gfx.kiq;
 
-       r = amdgpu_bo_create_kernel(adev, MEC_HPD_SIZE, PAGE_SIZE,
+       r = amdgpu_bo_create_kernel(adev, GFX9_MEC_HPD_SIZE, PAGE_SIZE,
                                    AMDGPU_GEM_DOMAIN_GTT, &kiq->eop_obj,
                                    &kiq->eop_gpu_addr, (void **)&hpd);
        if (r) {
@@ -980,7 +979,7 @@ static int gfx_v9_0_kiq_init(struct amdgpu_device *adev)
                return r;
        }
 
-       memset(hpd, 0, MEC_HPD_SIZE);
+       memset(hpd, 0, GFX9_MEC_HPD_SIZE);
 
        r = amdgpu_bo_reserve(kiq->eop_obj, true);
        if (unlikely(r != 0))
@@ -1495,7 +1494,7 @@ static int gfx_v9_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);
+               ring->eop_gpu_addr = adev->gfx.mec.hpd_eop_gpu_addr + (i * GFX9_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 */
@@ -2672,7 +2671,7 @@ static int gfx_v9_0_mqd_init(struct amdgpu_ring *ring)
        /* set the EOP size, register value is 2^(EOP_SIZE+1) dwords */
        tmp = RREG32_SOC15(GC, 0, mmCP_HQD_EOP_CONTROL);
        tmp = REG_SET_FIELD(tmp, CP_HQD_EOP_CONTROL, EOP_SIZE,
-                       (order_base_2(MEC_HPD_SIZE / 4) - 1));
+                       (order_base_2(GFX9_MEC_HPD_SIZE / 4) - 1));
 
        mqd->cp_hqd_eop_control = tmp;