All of lore.kernel.org
 help / color / mirror / Atom feed
From: likun Gao <likun.gao-5C7GfCeVMHo@public.gmane.org>
To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org
Cc: Likun Gao <Likun.Gao-5C7GfCeVMHo@public.gmane.org>
Subject: [PATCH 2/5] drm/amdgpu/rlc: gfx_v6 change the method to call rlc function
Date: Wed, 10 Oct 2018 19:42:53 +0800	[thread overview]
Message-ID: <1539171776-8157-3-git-send-email-likun.gao@amd.com> (raw)
In-Reply-To: <1539171776-8157-1-git-send-email-likun.gao-5C7GfCeVMHo@public.gmane.org>

From: Likun Gao <Likun.Gao@amd.com>

Use struct pointer to call rlc function.

Signed-off-by: Likun Gao <Likun.Gao@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c | 28 +++++++++++++++++++---------
 1 file changed, 19 insertions(+), 9 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c
index d76eb27..9b5523d 100644
--- a/drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c
@@ -2403,7 +2403,7 @@ static int gfx_v6_0_rlc_init(struct amdgpu_device *adev)
 		if (r) {
 			dev_warn(adev->dev, "(%d) create RLC sr bo failed\n",
 				 r);
-			gfx_v6_0_rlc_fini(adev);
+			adev->gfx.rlc.funcs->rlc_fini(adev);
 			return r;
 		}
 
@@ -2428,7 +2428,7 @@ static int gfx_v6_0_rlc_init(struct amdgpu_device *adev)
 					      (void **)&adev->gfx.rlc.cs_ptr);
 		if (r) {
 			dev_warn(adev->dev, "(%d) create RLC c bo failed\n", r);
-			gfx_v6_0_rlc_fini(adev);
+			adev->gfx.rlc.funcs->rlc_fini(adev);
 			return r;
 		}
 
@@ -2549,8 +2549,8 @@ static int gfx_v6_0_rlc_resume(struct amdgpu_device *adev)
 	if (!adev->gfx.rlc_fw)
 		return -EINVAL;
 
-	gfx_v6_0_rlc_stop(adev);
-	gfx_v6_0_rlc_reset(adev);
+	adev->gfx.rlc.funcs->rlc_stop(adev);
+	adev->gfx.rlc.funcs->rlc_reset(adev);
 	gfx_v6_0_init_pg(adev);
 	gfx_v6_0_init_cg(adev);
 
@@ -2578,7 +2578,7 @@ static int gfx_v6_0_rlc_resume(struct amdgpu_device *adev)
 	WREG32(mmRLC_UCODE_ADDR, 0);
 
 	gfx_v6_0_enable_lbpw(adev, gfx_v6_0_lbpw_supported(adev));
-	gfx_v6_0_rlc_start(adev);
+	adev->gfx.rlc.funcs->rlc_start(adev);
 
 	return 0;
 }
@@ -3075,6 +3075,15 @@ static const struct amdgpu_gfx_funcs gfx_v6_0_gfx_funcs = {
 	.select_me_pipe_q = &gfx_v6_0_select_me_pipe_q
 };
 
+static const struct amdgpu_rlc_funcs gfx_v6_0_rlc_funcs = {
+	.rlc_init = gfx_v6_0_rlc_init,
+	.rlc_fini = gfx_v6_0_rlc_fini,
+	.rlc_resume = gfx_v6_0_rlc_resume,
+	.rlc_stop = gfx_v6_0_rlc_stop,
+	.rlc_reset = gfx_v6_0_rlc_reset,
+	.rlc_start = gfx_v6_0_rlc_start
+};
+
 static int gfx_v6_0_early_init(void *handle)
 {
 	struct amdgpu_device *adev = (struct amdgpu_device *)handle;
@@ -3082,6 +3091,7 @@ static int gfx_v6_0_early_init(void *handle)
 	adev->gfx.num_gfx_rings = GFX6_NUM_GFX_RINGS;
 	adev->gfx.num_compute_rings = GFX6_NUM_COMPUTE_RINGS;
 	adev->gfx.funcs = &gfx_v6_0_gfx_funcs;
+	adev->gfx.rlc.funcs = &gfx_v6_0_rlc_funcs;
 	gfx_v6_0_set_ring_funcs(adev);
 	gfx_v6_0_set_irq_funcs(adev);
 
@@ -3114,7 +3124,7 @@ static int gfx_v6_0_sw_init(void *handle)
 		return r;
 	}
 
-	r = gfx_v6_0_rlc_init(adev);
+	r = adev->gfx.rlc.funcs->rlc_init(adev);
 	if (r) {
 		DRM_ERROR("Failed to init rlc BOs!\n");
 		return r;
@@ -3165,7 +3175,7 @@ static int gfx_v6_0_sw_fini(void *handle)
 	for (i = 0; i < adev->gfx.num_compute_rings; i++)
 		amdgpu_ring_fini(&adev->gfx.compute_ring[i]);
 
-	gfx_v6_0_rlc_fini(adev);
+	adev->gfx.rlc.funcs->rlc_fini(adev);
 
 	return 0;
 }
@@ -3177,7 +3187,7 @@ static int gfx_v6_0_hw_init(void *handle)
 
 	gfx_v6_0_constants_init(adev);
 
-	r = gfx_v6_0_rlc_resume(adev);
+	r = adev->gfx.rlc.funcs->rlc_resume(adev);
 	if (r)
 		return r;
 
@@ -3195,7 +3205,7 @@ static int gfx_v6_0_hw_fini(void *handle)
 	struct amdgpu_device *adev = (struct amdgpu_device *)handle;
 
 	gfx_v6_0_cp_enable(adev, false);
-	gfx_v6_0_rlc_stop(adev);
+	adev->gfx.rlc.funcs->rlc_stop(adev);
 	gfx_v6_0_fini_pg(adev);
 
 	return 0;
-- 
2.7.4

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

  parent reply	other threads:[~2018-10-10 11:42 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-10 11:42 [PATCH 0/5] RLC kernel code update for unified RLC function likun Gao
     [not found] ` <1539171776-8157-1-git-send-email-likun.gao-5C7GfCeVMHo@public.gmane.org>
2018-10-10 11:42   ` [PATCH 1/5] drm/amdgpu/rlc: unify rlc function into structure likun Gao
     [not found]     ` <1539171776-8157-2-git-send-email-likun.gao-5C7GfCeVMHo@public.gmane.org>
2018-10-10 12:04       ` Christian König
2018-10-10 11:42   ` likun Gao [this message]
     [not found]     ` <1539171776-8157-3-git-send-email-likun.gao-5C7GfCeVMHo@public.gmane.org>
2018-10-10 12:05       ` [PATCH 2/5] drm/amdgpu/rlc: gfx_v6 change the method to call rlc function Christian König
2018-10-10 11:42   ` [PATCH 3/5] drm/amdgpu/rlc: gfx_v7 " likun Gao
2018-10-10 11:42   ` [PATCH 4/5] drm/amdgpu/rlc: gfx_v8 " likun Gao
2018-10-10 11:42   ` [PATCH 5/5] drm/amdgpu/rlc: gfx_v9 " likun Gao

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1539171776-8157-3-git-send-email-likun.gao@amd.com \
    --to=likun.gao-5c7gfcevmho@public.gmane.org \
    --cc=amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.