xref: /aosp_15_r20/external/gmmlib/Source/inc/common/gtsysinfo.h (revision 35ffd701415c9e32e53136d61a677a8d0a8fc4a5)
1 /*==============================================================================
2 Copyright(c) 2017 Intel Corporation
3 
4 Permission is hereby granted, free of charge, to any person obtaining a
5 copy of this software and associated documentation files(the "Software"),
6 to deal in the Software without restriction, including without limitation
7 the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 and / or sell copies of the Software, and to permit persons to whom the
9 Software is furnished to do so, subject to the following conditions:
10 
11 The above copyright notice and this permission notice shall be included
12 in all copies or substantial portions of the Software.
13 
14 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
15 OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17 THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
18 OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19 ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20 OTHER DEALINGS IN THE SOFTWARE.
21 ============================================================================*/
22 
23 // This header file describes the GT system info data structure and associated
24 // types and constants. It is for use by both producers and consumers of GT
25 // system info on all OS.
26 
27 #ifndef __GT_SYS_INFO_H__
28 #define __GT_SYS_INFO_H__
29 
30 #include <stdbool.h>
31 #include <stdint.h>
32 
33 #pragma pack(push,1)
34 
35 // Maximums which bound all supported GT
36 #define GT_MAX_SLICE                   (8)
37 #define GT_MAX_SUBSLICE_PER_SLICE      (8)
38 #define GT_MAX_SUBSLICE_PER_DSS        (2) // Currently max value based on Gen12
39 #define GT_MAX_DUALSUBSLICE_PER_SLICE  (6) // Currently max value based on Gen12LP
40 
41 typedef struct GT_SUBSLICE_INFO
42 {
43     bool                Enabled;            // determine if this SS is enabled.
44     uint32_t            EuEnabledCount;     // Total Count of EU enabled on this SubSlice
45     uint32_t            EuEnabledMask;      // Mask of EUs enabled on this SubSlice
46 } GT_SUBSLICE_INFO;
47 
48 typedef struct GT_DUALSUBSLICE_INFO
49 {
50     bool Enabled;                                       // Bool to determine if this SS is enabled.
51     GT_SUBSLICE_INFO SubSlice[GT_MAX_SUBSLICE_PER_DSS]; // SS details that belong to this DualSubSlice.
52 } GT_DUALSUBSLICE_INFO;
53 
54 typedef struct GT_SLICE_INFO
55 {
56     bool                 Enabled;                                    // determine if this slice is enabled.
57     GT_SUBSLICE_INFO     SubSliceInfo[GT_MAX_SUBSLICE_PER_SLICE];    // SS details that belong to this slice.
58     GT_DUALSUBSLICE_INFO DSSInfo[GT_MAX_DUALSUBSLICE_PER_SLICE];     // DSS details that belong to this slice.
59     uint32_t             SubSliceEnabledCount;                       // No. of SS enabled in this slice
60     uint32_t             DualSubSliceEnabledCount;                   // No. of DSS enabled in this slice
61 } GT_SLICE_INFO;
62 
63 typedef struct GT_VEBOX_INFO
64 {
65     union VEBoxInstances
66     {
67         struct VEBitStruct
68         {
69             uint32_t    VEBox0Enabled : 1;      // To determine if VEBox0 is enabled
70             uint32_t    VEBox1Enabled : 1;      // To determine if VEBox1 is enabled
71             uint32_t    VEBox2Enabled : 1;      // To determine if VEBox2 is enabled
72             uint32_t    VEBox3Enabled : 1;      // To determine if VEBox3 is enabled
73             uint32_t    Reserved      : 28;     // Reserved bits
74         } Bits;
75 
76         uint32_t VEBoxEnableMask;               // Union for all VEBox instances. It can be used to know if any of the VEBOX is enabled.
77 
78     } Instances;
79 
80     union
81     {
82         struct
83         {
84             uint32_t    VEBox0   : 1;      // Set if VEBox0 supports SFC
85             uint32_t    VEBox1   : 1;      // Set if VEBox1 supports SFC
86             uint32_t    VEBox2   : 1;      // Set if VEBox2 supports SFC
87             uint32_t    VEBox3   : 1;      // Set if VEBox3 supports SFC
88             uint32_t    Reserved : 28;     // Reserved bits
89         }SfcSupportedBits;
90 
91         uint32_t Value;
92 
93     } SFCSupport;                               // VEBOX support of Scalar & Format Converter;
94 
95     uint32_t NumberOfVEBoxEnabled;              // Number of bits set among bit 0-3 of VEBoxEnableMask; used on CNL
96 
97     bool     IsValid;                           // flag to check if VEBoxInfo is valid.
98 
99 } GT_VEBOX_INFO;
100 
101 typedef struct GT_VDBOX_INFO
102 {
103     union VDBoxInstances
104     {
105         struct VDBitStruct
106         {
107             uint32_t    VDBox0Enabled : 1;      // To determine if VDBox0 is enabled
108             uint32_t    VDBox1Enabled : 1;      // To determine if VDBox1 is enabled
109             uint32_t    VDBox2Enabled : 1;      // To determine if VDBox2 is enabled
110             uint32_t    VDBox3Enabled : 1;      // To determine if VDBox3 is enabled
111             uint32_t    VDBox4Enabled : 1;      // To determine if VDBox4 is enabled
112             uint32_t    VDBox5Enabled : 1;      // To determine if VDBox5 is enabled
113             uint32_t    VDBox6Enabled : 1;      // To determine if VDBox6 is enabled
114             uint32_t    VDBox7Enabled : 1;      // To determine if VDBox7 is enabled
115             uint32_t    Reserved      : 24;     // Reserved bits
116         } Bits;
117 
118         uint32_t VDBoxEnableMask;               // Union for all VDBox instances. It can be used to know if any of the VDBOX is enabled.
119 
120     } Instances;
121 
122     union
123     {
124         struct
125         {
126             uint32_t    VDBox0   : 1;      // Set if VDBox0 supports SFC
127             uint32_t    VDBox1   : 1;      // Set if VDBox1 supports SFC
128             uint32_t    VDBox2   : 1;      // Set if VDBox2 supports SFC
129             uint32_t    VDBox3   : 1;      // Set if VDBox3 supports SFC
130             uint32_t    VDBox4   : 1;      // Set if VDBox4 supports SFC
131             uint32_t    VDBox5   : 1;      // Set if VDBox5 supports SFC
132             uint32_t    VDBox6   : 1;      // Set if VDBox6 supports SFC
133             uint32_t    VDBox7   : 1;      // Set if VDBox7 supports SFC
134             uint32_t    Reserved : 24;     // Reserved bits
135         }SfcSupportedBits;
136 
137         uint32_t Value;
138 
139     } SFCSupport;                               // VDBOX support of Scalar & Format Converter;
140 
141     uint32_t NumberOfVDBoxEnabled;              // Number of bits set among bit 0-7 of VDBoxEnableMask;
142 
143     bool     IsValid;                            // flag to check if VDBoxInfo is valid.
144 
145 } GT_VDBOX_INFO;
146 typedef struct GT_CCS_INFO
147 {
148     union CCSInstances
149     {
150         struct CCSBitStruct
151         {
152             uint32_t    CCS0Enabled : 1;      // To determine if CCS0 is enabled
153             uint32_t    CCS1Enabled : 1;
154             uint32_t    CCS2Enabled : 1;
155             uint32_t    CCS3Enabled : 1;
156             uint32_t    Reserved    : 28;     // Reserved bits
157         } Bits;
158 
159         uint32_t CCSEnableMask;               // Union for all CCS instances. It can be used to know which CCS is enabled.
160 
161     } Instances;
162 
163     uint32_t NumberOfCCSEnabled;              // Number of bits set among bit 0-3 of CCSEnableMask;
164 
165     bool     IsValid;                         // flag to check if CCSInfo is valid.
166 
167 } GT_CCS_INFO;
168 
169 typedef struct GT_MULTI_TILE_ARCH_INFO
170 {
171     // Total Count of Tiles enabled
172     uint8_t     TileCount;
173 
174     // Mask of all enabled Tiles
175     union
176     {
177         struct
178         {
179             uint8_t     Tile0       : 1;
180             uint8_t     Tile1       : 1;
181             uint8_t     Tile2       : 1;
182             uint8_t     Tile3       : 1;
183             uint8_t     Reserved    : 4;
184         };
185 
186         uint8_t TileMask;
187     };
188 
189     // flag to check if MultiTileArchInfo has valid data or not
190     bool        IsValid;
191 
192 } GT_MULTI_TILE_ARCH_INFO;
193 
194 typedef struct GT_SQIDI_INFO
195 {
196         uint32_t        NumberofSQIDI;                        // Total no. of enabled SQIDIs.
197         uint32_t        NumberofDoorbellPerSQIDI;             // Total no. of doorbells available per SQIDI unit
198 }GT_SQIDI_INFO;
199 
200 typedef union _GT_CACHE_TYPES
201 {
202     struct
203     {
204         uint32_t  L3        : 1;
205         uint32_t  LLC       : 1;
206         uint32_t  eDRAM     : 1;
207         uint32_t  Reserved : 29;
208     };
209 
210     uint32_t CacheTypeMask;
211 
212 } GT_CACHE_TYPES;
213 
214 typedef struct GT_SYSTEM_INFO
215 {
216     // These fields should always hold valid values
217     uint32_t        EUCount;                        // Total no. of enabled EUs
218     uint32_t        ThreadCount;                    // total no of system threads available
219     uint32_t        SliceCount;                     // Total no. of enabled slices
220     uint32_t        SubSliceCount;                  // Total no. of enabled subslices
221     uint32_t        DualSubSliceCount;              // Total no. of enabled dualsubslices
222     uint64_t        L3CacheSizeInKb;                // Total L3 cache size in kilo bytes
223     uint64_t        LLCCacheSizeInKb;               // Total LLC cache size in kilo bytes
224     uint64_t        EdramSizeInKb;                  // Total EDRAM size in kilo bytes
225     uint32_t        L3BankCount;                    // Total L3 banks across all slices. This is not bank count per slice.
226     uint32_t        MaxFillRate;                    // Fillrate with Alphablend (in Pix/Clk)
227     uint32_t        EuCountPerPoolMax;              // Max EU count per pool
228     uint32_t        EuCountPerPoolMin;              // Min EU count per pool
229 
230     uint32_t        TotalVsThreads;                 // Total threads in VS
231     uint32_t        TotalHsThreads;                 // Total threads in HS
232     uint32_t        TotalDsThreads;                 // Total threads in DS
233     uint32_t        TotalGsThreads;                 // Total threads in GS
234     uint32_t        TotalPsThreadsWindowerRange;    // Total threads in PS Windower Range
235 
236     uint32_t        TotalVsThreads_Pocs;            // Total threads in VS for POCS
237 
238     // Note: The CSR size requirement is not clear at this moment. Till then the driver will set
239     // the maximum size that should be sufficient for all platform SKUs.
240     uint32_t        CsrSizeInMb;                    // Total size that driver needs to allocate for CSR.
241 
242     /*------------------------------------*/
243     // Below fields are required for proper allocation of scratch/private space for threads execution.
244     // Threads scratch space has to be allocated based on native die config. So allocation has to be
245     // done even for unfused or non-enabled slices/subslices/EUs. Since H/W doesn't provide us a way to know
246     // about the native die config S/W will allocate based on max EU/S/SS.
247     uint32_t        MaxEuPerSubSlice;               // Max available EUs per sub-slice.
248     uint32_t        MaxSlicesSupported;             // Max slices this platfrom can have.
249     uint32_t        MaxSubSlicesSupported;          // Max total sub-slices this platform can have (not per slice)
250     uint32_t        MaxDualSubSlicesSupported;      // Max total dual sub-slices this platform can have (not per slice)
251     /*------------------------------------*/
252 
253     // Flag to determine if hashing is enabled. If enabled then one of the L3 banks will be disabled.
254     // As a result 'L3BankCount' will be reduced by 1 bank during system info derivation routine.
255     // Note: Only expected only in CNL (limited SKUs).
256     bool           IsL3HashModeEnabled;
257 
258     // VEBox/VDBox info
259     GT_VDBOX_INFO   VDBoxInfo;                      // VDBoxInfo provides details(enabled/disabled) of all VDBox instances.
260     GT_VEBOX_INFO   VEBoxInfo;                      // VEBoxInfo provides details(enabled/disabled) of all VEBox instances.
261 
262     // SliceInfo provides the detailed breakdown of the Slice/Subslice/EU configuration. It is useful
263     // for various WA that depend on the specific SSEU components enabled or disabled, but it is not
264     // considered critically important to driver function at this time and may not be validly populated
265     // on all platforms. IsDynamicallyPopulated indicates if SliceInfo has been validly populated.
266     // IsDynamicallyPopulated only applies to SliceInfo.
267     // TODO: Rename IsDynamicallyPopulated to something like SliceInfoIsValid to help clarify its
268     // purpose. At the moment we are constrained by USC not to make any changes to the GT System
269     // Info interface which require USC changes. USC currently references IsDynamicallyPopulated.
270     GT_SLICE_INFO   SliceInfo[GT_MAX_SLICE];
271     bool            IsDynamicallyPopulated;
272 
273         //SqidiInfo provides the detailed information for number of SQIDIs supported in GT.
274         //It also provides total no. of doorbells available per SQIDI unit.
275     GT_SQIDI_INFO   SqidiInfo;
276 
277     uint32_t        ReservedCCSWays;                // Reserved CCS ways provides value of reserved L3 ways for CCS when CCS is enabled.
278                                                     // This is a hardcoded value as suggested by HW. No MMIO read is needed for same.
279     GT_CCS_INFO     CCSInfo;                        // CCSInfo provides details(enabled/disabled) of all CCS instances.
280     GT_MULTI_TILE_ARCH_INFO MultiTileArchInfo;      // MultiTileArchInfo provides details(enabled/disabled) of GT Tiles in case of Multi Tile Architecture SKUs
281 
282     uint32_t        NumThreadsPerEu;                // Number of threads per EU.
283     GT_CACHE_TYPES  CacheTypes;                     // Types of caches available on system (L3/LLC/eDRAM).
284     uint32_t        MaxVECS;                        // Max VECS instances.
285     uint32_t        MemoryType;                     // GT_MEMORY_TYPES - type of memory supported in current platform
286     uint32_t        SLMSizeInKb;                    // SLM Size
287 } GT_SYSTEM_INFO, *PGT_SYSTEM_INFO;
288 
289 #pragma pack(pop)
290 
291 #endif //__GT_SYS_INFO_H__
292