<div dir="ltr"><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Mar 21, 2023 at 3:51 PM Alex Deucher <<a href="mailto:alexdeucher@gmail.com">alexdeucher@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On Mon, Mar 20, 2023 at 8:30 PM Marek Olšák <<a href="mailto:maraeo@gmail.com" target="_blank">maraeo@gmail.com</a>> wrote:<br>
><br>
><br>
> On Mon, Mar 20, 2023 at 1:38 PM Alex Deucher <<a href="mailto:alexander.deucher@amd.com" target="_blank">alexander.deucher@amd.com</a>> wrote:<br>
>><br>
>> Add UAPI to query the GFX shadow buffer requirements<br>
>> for preemption on GFX11.  UMDs need to specify the shadow<br>
>> areas for preemption.<br>
>><br>
>> Signed-off-by: Alex Deucher <<a href="mailto:alexander.deucher@amd.com" target="_blank">alexander.deucher@amd.com</a>><br>
>> ---<br>
>>  include/uapi/drm/amdgpu_drm.h | 10 ++++++++++<br>
>>  1 file changed, 10 insertions(+)<br>
>><br>
>> diff --git a/include/uapi/drm/amdgpu_drm.h b/include/uapi/drm/amdgpu_drm.h<br>
>> index 3d9474af6566..19a806145371 100644<br>
>> --- a/include/uapi/drm/amdgpu_drm.h<br>
>> +++ b/include/uapi/drm/amdgpu_drm.h<br>
>> @@ -886,6 +886,7 @@ struct drm_amdgpu_cs_chunk_cp_gfx_shadow {<br>
>>         #define AMDGPU_INFO_VIDEO_CAPS_DECODE           0<br>
>>         /* Subquery id: Encode */<br>
>>         #define AMDGPU_INFO_VIDEO_CAPS_ENCODE           1<br>
>> +#define AMDGPU_INFO_CP_GFX_SHADOW_SIZE         0x22<br>
>><br>
>>  #define AMDGPU_INFO_MMR_SE_INDEX_SHIFT 0<br>
>>  #define AMDGPU_INFO_MMR_SE_INDEX_MASK  0xff<br>
>> @@ -1203,6 +1204,15 @@ struct drm_amdgpu_info_video_caps {<br>
>>         struct drm_amdgpu_info_video_codec_info codec_info[AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_COUNT];<br>
>>  };<br>
>><br>
>> +struct drm_amdgpu_info_cp_gfx_shadow_size {<br>
>> +       __u32 shadow_size;<br>
>> +       __u32 shadow_alignment;<br>
>> +       __u32 csa_size;<br>
>> +       __u32 csa_alignment;<br>
>> +       __u32 gds_size;<br>
>> +       __u32 gds_alignment;<br>
><br>
><br>
> Can you document the fields? What is CSA? Also, why is GDS there when the hw deprecated it and replaced it with GDS registers?<br>
<br>
Will add documentation.  For reference:<br>
CSA (Context Save Area) - used as a scratch area for FW for saving<br>
various things<br>
Shadow - stores the pipeline state<br>
GDS backup - stores the GDS state used by the pipeline.  I'm not sure<br>
if this is registers or the old GDS memory.  Presumably the former.<br></blockquote><div><br></div>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.</div><div class="gmail_quote"><br></div><div class="gmail_quote">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.<br></div><div class="gmail_quote"><br></div><div class="gmail_quote">Marek<br></div></div>