]> git.baikalelectronics.ru Git - kernel.git/commitdiff
drm/amdgpu: added api for stopping psp ring (v2)
authorEvan Quan <evan.quan@amd.com>
Fri, 8 Sep 2017 05:04:52 +0000 (13:04 +0800)
committerAlex Deucher <alexander.deucher@amd.com>
Tue, 12 Sep 2017 18:30:11 +0000 (14:30 -0400)
- v2: reuse the ring stop api in ring destory

Signed-off-by: Evan Quan <evan.quan@amd.com>
Reviewed-by: Junwei Zhang <Jerry.Zhang@amd.com>
Acked-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Huang Rui <ray.huang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c
drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h
drivers/gpu/drm/amd/amdgpu/psp_v10_0.c
drivers/gpu/drm/amd/amdgpu/psp_v10_0.h
drivers/gpu/drm/amd/amdgpu/psp_v3_1.c
drivers/gpu/drm/amd/amdgpu/psp_v3_1.h

index 8c2204c7b3847c3ce18042b48d70516155b843e5..abd20819ba6bdf7001f5d7fbd6373a2659b5f58c 100644 (file)
@@ -57,6 +57,7 @@ static int psp_sw_init(void *handle)
                psp->prep_cmd_buf = psp_v3_1_prep_cmd_buf;
                psp->ring_init = psp_v3_1_ring_init;
                psp->ring_create = psp_v3_1_ring_create;
+               psp->ring_stop = psp_v3_1_ring_stop;
                psp->ring_destroy = psp_v3_1_ring_destroy;
                psp->cmd_submit = psp_v3_1_cmd_submit;
                psp->compare_sram_data = psp_v3_1_compare_sram_data;
@@ -69,6 +70,7 @@ static int psp_sw_init(void *handle)
                psp->prep_cmd_buf = psp_v10_0_prep_cmd_buf;
                psp->ring_init = psp_v10_0_ring_init;
                psp->ring_create = psp_v10_0_ring_create;
+               psp->ring_stop = psp_v10_0_ring_stop;
                psp->ring_destroy = psp_v10_0_ring_destroy;
                psp->cmd_submit = psp_v10_0_cmd_submit;
                psp->compare_sram_data = psp_v10_0_compare_sram_data;
index 538fa9dbfb21200094df54f07ad598f77f323fc6..e79795b59797d4f5e86156a9eeb0b6ee38664627 100644 (file)
@@ -66,6 +66,8 @@ struct psp_context
                            struct psp_gfx_cmd_resp *cmd);
        int (*ring_init)(struct psp_context *psp, enum psp_ring_type ring_type);
        int (*ring_create)(struct psp_context *psp, enum psp_ring_type ring_type);
+       int (*ring_stop)(struct psp_context *psp,
+                           enum psp_ring_type ring_type);
        int (*ring_destroy)(struct psp_context *psp,
                            enum psp_ring_type ring_type);
        int (*cmd_submit)(struct psp_context *psp, struct amdgpu_firmware_info *ucode,
index b77feef829e7b29c5d852901de0482c4ac542563..6ec5c9f8074d7f85acdb9bd8bb3ac31e322d354a 100644 (file)
@@ -207,7 +207,7 @@ int psp_v10_0_ring_create(struct psp_context *psp, enum psp_ring_type ring_type)
        return ret;
 }
 
-int psp_v10_0_ring_destroy(struct psp_context *psp, enum psp_ring_type ring_type)
+int psp_v10_0_ring_stop(struct psp_context *psp, enum psp_ring_type ring_type)
 {
        int ret = 0;
        struct psp_ring *ring;
@@ -227,6 +227,19 @@ int psp_v10_0_ring_destroy(struct psp_context *psp, enum psp_ring_type ring_type
        ret = psp_wait_for(psp, SOC15_REG_OFFSET(MP0, 0, mmMP0_SMN_C2PMSG_64),
                           0x80000000, 0x80000000, false);
 
+       return ret;
+}
+
+int psp_v10_0_ring_destroy(struct psp_context *psp, enum psp_ring_type ring_type)
+{
+       int ret = 0;
+       struct psp_ring *ring = &psp->km_ring;
+       struct amdgpu_device *adev = psp->adev;
+
+       ret = psp_v10_0_ring_stop(psp, ring_type);
+       if (ret)
+               DRM_ERROR("Fail to stop psp ring\n");
+
        amdgpu_bo_free_kernel(&adev->firmware.rbuf,
                              &ring->ring_mem_mc_addr,
                              (void **)&ring->ring_mem);
index e76cde2f01f9521f5a13509c17687cb532c08b9f..3af3ad1320ff858d0637a4225dcda3de1ee50fcb 100644 (file)
@@ -34,6 +34,8 @@ extern int psp_v10_0_ring_init(struct psp_context *psp,
                              enum psp_ring_type ring_type);
 extern int psp_v10_0_ring_create(struct psp_context *psp,
                                 enum psp_ring_type ring_type);
+extern int psp_v10_0_ring_stop(struct psp_context *psp,
+                                 enum psp_ring_type ring_type);
 extern int psp_v10_0_ring_destroy(struct psp_context *psp,
                                  enum psp_ring_type ring_type);
 extern int psp_v10_0_cmd_submit(struct psp_context *psp,
index 2a535a4b8d5b3263dde9158f09be3c8d5547ce12..bcbe30dfff39f22f7a1eb35aa26da2dfb5a688b1 100644 (file)
@@ -319,7 +319,7 @@ int psp_v3_1_ring_create(struct psp_context *psp, enum psp_ring_type ring_type)
        return ret;
 }
 
-int psp_v3_1_ring_destroy(struct psp_context *psp, enum psp_ring_type ring_type)
+int psp_v3_1_ring_stop(struct psp_context *psp, enum psp_ring_type ring_type)
 {
        int ret = 0;
        struct psp_ring *ring;
@@ -339,6 +339,19 @@ int psp_v3_1_ring_destroy(struct psp_context *psp, enum psp_ring_type ring_type)
        ret = psp_wait_for(psp, SOC15_REG_OFFSET(MP0, 0, mmMP0_SMN_C2PMSG_64),
                           0x80000000, 0x80000000, false);
 
+       return ret;
+}
+
+int psp_v3_1_ring_destroy(struct psp_context *psp, enum psp_ring_type ring_type)
+{
+       int ret = 0;
+       struct psp_ring *ring = &psp->km_ring;
+       struct amdgpu_device *adev = psp->adev;
+
+       ret = psp_v3_1_ring_stop(psp, ring_type);
+       if (ret)
+               DRM_ERROR("Fail to stop psp ring\n");
+
        amdgpu_bo_free_kernel(&adev->firmware.rbuf,
                              &ring->ring_mem_mc_addr,
                              (void **)&ring->ring_mem);
index 9dcd0b25c4c60c635c508e609ca588c748bbba65..5af2231b7099d5adfc863f21cdccf8346d0b8bed 100644 (file)
@@ -41,6 +41,8 @@ extern int psp_v3_1_ring_init(struct psp_context *psp,
                              enum psp_ring_type ring_type);
 extern int psp_v3_1_ring_create(struct psp_context *psp,
                                enum psp_ring_type ring_type);
+extern int psp_v3_1_ring_stop(struct psp_context *psp,
+                               enum psp_ring_type ring_type);
 extern int psp_v3_1_ring_destroy(struct psp_context *psp,
                                enum psp_ring_type ring_type);
 extern int psp_v3_1_cmd_submit(struct psp_context *psp,