amd-gfx.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: Alex Deucher <alexdeucher@gmail.com>
To: "Marek Olšák" <maraeo@gmail.com>
Cc: Alex Deucher <alexander.deucher@amd.com>, amd-gfx@lists.freedesktop.org
Subject: Re: [PATCH 07/11] drm/amdgpu: add UAPI to query GFX shadow sizes
Date: Wed, 22 Mar 2023 10:34:28 -0400	[thread overview]
Message-ID: <CADnq5_MEWgn20_ywHR6N2XgqkZXdqDj5BAwdYBTDBew_uHr4Hw@mail.gmail.com> (raw)
In-Reply-To: <CAAxE2A5m+xACjfbBA+GZF7wWss38B5=Dy_jW9sLzBf8XV_8wbA@mail.gmail.com>

On Wed, Mar 22, 2023 at 10:12 AM Marek Olšák <maraeo@gmail.com> wrote:
>
> On Tue, Mar 21, 2023 at 3:51 PM Alex Deucher <alexdeucher@gmail.com> wrote:
>>
>> On Mon, Mar 20, 2023 at 8:30 PM Marek Olšák <maraeo@gmail.com> wrote:
>> >
>> >
>> > On Mon, Mar 20, 2023 at 1:38 PM Alex Deucher <alexander.deucher@amd.com> wrote:
>> >>
>> >> Add UAPI to query the GFX shadow buffer requirements
>> >> for preemption on GFX11.  UMDs need to specify the shadow
>> >> areas for preemption.
>> >>
>> >> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
>> >> ---
>> >>  include/uapi/drm/amdgpu_drm.h | 10 ++++++++++
>> >>  1 file changed, 10 insertions(+)
>> >>
>> >> diff --git a/include/uapi/drm/amdgpu_drm.h b/include/uapi/drm/amdgpu_drm.h
>> >> index 3d9474af6566..19a806145371 100644
>> >> --- a/include/uapi/drm/amdgpu_drm.h
>> >> +++ b/include/uapi/drm/amdgpu_drm.h
>> >> @@ -886,6 +886,7 @@ struct drm_amdgpu_cs_chunk_cp_gfx_shadow {
>> >>         #define AMDGPU_INFO_VIDEO_CAPS_DECODE           0
>> >>         /* Subquery id: Encode */
>> >>         #define AMDGPU_INFO_VIDEO_CAPS_ENCODE           1
>> >> +#define AMDGPU_INFO_CP_GFX_SHADOW_SIZE         0x22
>> >>
>> >>  #define AMDGPU_INFO_MMR_SE_INDEX_SHIFT 0
>> >>  #define AMDGPU_INFO_MMR_SE_INDEX_MASK  0xff
>> >> @@ -1203,6 +1204,15 @@ struct drm_amdgpu_info_video_caps {
>> >>         struct drm_amdgpu_info_video_codec_info codec_info[AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_COUNT];
>> >>  };
>> >>
>> >> +struct drm_amdgpu_info_cp_gfx_shadow_size {
>> >> +       __u32 shadow_size;
>> >> +       __u32 shadow_alignment;
>> >> +       __u32 csa_size;
>> >> +       __u32 csa_alignment;
>> >> +       __u32 gds_size;
>> >> +       __u32 gds_alignment;
>> >
>> >
>> > Can you document the fields? What is CSA? Also, why is GDS there when the hw deprecated it and replaced it with GDS registers?
>>
>> Will add documentation.  For reference:
>> CSA (Context Save Area) - used as a scratch area for FW for saving
>> various things
>> Shadow - stores the pipeline state
>> GDS backup - stores the GDS state used by the pipeline.  I'm not sure
>> if this is registers or the old GDS memory.  Presumably the former.
>
>
> 1. The POR for gfx11 was not to use GDS memory. I don't know why it's there, but it would be unused uapi.

It still needs to be allocated because the FW requires it.

>
> 2. Is it secure to give userspace write access to the CSA and shadow buffers? In the case of CSA, it looks like userspace could break the firmware.

Yes, it should be fine. It's the same way it has always been, it's
just that on older chips the kernel mapped them into all of the GPUVMs
because it was global. If the userspace screws it up, they are only
hurting themselves because the FW uses it to save the UMD's hardware
state.

Alex

>
> Marek

  reply	other threads:[~2023-03-22 14:34 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-20 17:37 [PATCH V2 00/11] Enable FW assisted shadowing for GFX11 Alex Deucher
2023-03-20 17:38 ` [PATCH 01/11] drm/amdgpu/gfx11: add FW version check for new CP GFX shadow feature Alex Deucher
2023-03-20 17:38 ` [PATCH 02/11] drm/amdgpu/gfx11: check the CP FW version CP GFX shadow support Alex Deucher
2023-03-21 15:36   ` Christian König
2023-03-20 17:38 ` [PATCH 03/11] drm/amdgpu/UAPI: add new CS chunk for GFX shadow buffers Alex Deucher
2023-03-20 17:38 ` [PATCH 04/11] drm/amdgpu: add gfx shadow CS IOCTL support Alex Deucher
2023-03-20 17:38 ` [PATCH 05/11] drm/amdgpu: add gfx11 emit shadow callback Alex Deucher
2023-03-20 17:38 ` [PATCH 06/11] drm/amdgpu: don't require a job for cond_exec and shadow Alex Deucher
2023-03-20 17:38 ` [PATCH 07/11] drm/amdgpu: add UAPI to query GFX shadow sizes Alex Deucher
2023-03-21  0:29   ` Marek Olšák
2023-03-21 19:51     ` Alex Deucher
2023-03-22 14:11       ` Marek Olšák
2023-03-22 14:34         ` Alex Deucher [this message]
2023-03-21  0:31   ` Marek Olšák
2023-03-21 19:53     ` Alex Deucher
2023-03-22  8:50       ` Christian König
2023-03-22 14:07       ` Marek Olšák
2023-03-20 17:38 ` [PATCH 08/11] drm/amdgpu: add gfx shadow callback Alex Deucher
2023-03-20 17:38 ` [PATCH 09/11] drm/amdgpu: add get_gfx_shadow_info callback for gfx11 Alex Deucher
2023-03-20 17:38 ` [PATCH 10/11] drm/amdgpu: add support for new GFX shadow size query Alex Deucher
2023-03-20 17:38 ` [PATCH 11/11] drm/amdgpu: bump driver version number for CP GFX shadow Alex Deucher

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=CADnq5_MEWgn20_ywHR6N2XgqkZXdqDj5BAwdYBTDBew_uHr4Hw@mail.gmail.com \
    --to=alexdeucher@gmail.com \
    --cc=alexander.deucher@amd.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=maraeo@gmail.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).