[PATCH 09/13] drm/amdgpu: add get_gfx_shadow_info callback for gfx11

Alex Deucher alexdeucher at gmail.com
Wed Apr 19 22:11:29 UTC 2023


Ping?

On Thu, Mar 30, 2023 at 3:18 PM Alex Deucher <alexander.deucher at amd.com> wrote:
>
> Used to get the size and alignment requirements for
> the gfx shadow buffer for preemption.
>
> v2: use FW version check to determine whether to
>     return a valid size here
>     return an error if not supported (Alex)
> v3: drop GDS (Alex)
> v4: make amdgpu_gfx_shadow_info mandatory (Alex)
>
> Signed-off-by: Alex Deucher <alexander.deucher at amd.com>
> ---
>  drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c | 22 ++++++++++++++++++++++
>  1 file changed, 22 insertions(+)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c
> index 1fc1e941f7df..7a5da13cffa0 100644
> --- a/drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c
> @@ -822,6 +822,27 @@ static void gfx_v11_0_select_me_pipe_q(struct amdgpu_device *adev,
>         soc21_grbm_select(adev, me, pipe, q, vm);
>  }
>
> +/* all sizes are in bytes */
> +#define MQD_SHADOW_BASE_SIZE      73728
> +#define MQD_SHADOW_BASE_ALIGNMENT 256
> +#define MQD_FWWORKAREA_SIZE       484
> +#define MQD_FWWORKAREA_ALIGNMENT  256
> +
> +static int gfx_v11_0_get_gfx_shadow_info(struct amdgpu_device *adev,
> +                                        struct amdgpu_gfx_shadow_info *shadow_info)
> +{
> +       if (adev->gfx.cp_gfx_shadow) {
> +               shadow_info->shadow_size = MQD_SHADOW_BASE_SIZE;
> +               shadow_info->shadow_alignment = MQD_SHADOW_BASE_ALIGNMENT;
> +               shadow_info->csa_size = MQD_FWWORKAREA_SIZE;
> +               shadow_info->csa_alignment = MQD_FWWORKAREA_ALIGNMENT;
> +               return 0;
> +       } else {
> +               memset(shadow_info, 0, sizeof(struct amdgpu_gfx_shadow_info));
> +               return -ENOTSUPP;
> +       }
> +}
> +
>  static const struct amdgpu_gfx_funcs gfx_v11_0_gfx_funcs = {
>         .get_gpu_clock_counter = &gfx_v11_0_get_gpu_clock_counter,
>         .select_se_sh = &gfx_v11_0_select_se_sh,
> @@ -830,6 +851,7 @@ static const struct amdgpu_gfx_funcs gfx_v11_0_gfx_funcs = {
>         .read_wave_vgprs = &gfx_v11_0_read_wave_vgprs,
>         .select_me_pipe_q = &gfx_v11_0_select_me_pipe_q,
>         .update_perfmon_mgcg = &gfx_v11_0_update_perf_clk,
> +       .get_gfx_shadow_info = &gfx_v11_0_get_gfx_shadow_info,
>  };
>
>  static int gfx_v11_0_gpu_early_init(struct amdgpu_device *adev)
> --
> 2.39.2
>


More information about the amd-gfx mailing list