[PATCH 2/5] drm/amdgpu/rlc: gfx_v6 change the method to call rlc function
Christian König
ckoenig.leichtzumerken at gmail.com
Wed Oct 10 12:05:46 UTC 2018
Am 10.10.2018 um 13:42 schrieb likun Gao:
> From: Likun Gao <Likun.Gao at amd.com>
>
> Use struct pointer to call rlc function.
When you do this please do the next step as well and separate our the
RLC functions into another file.
Otherwise I don't see the point in actually doing the change.
Christian.
>
> Signed-off-by: Likun Gao <Likun.Gao at 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;
More information about the amd-gfx
mailing list