gem5  v22.1.0.0
pm4_defines.hh
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2021 Advanced Micro Devices, Inc.
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions are met:
7  *
8  * 1. Redistributions of source code must retain the above copyright notice,
9  * this list of conditions and the following disclaimer.
10  *
11  * 2. Redistributions in binary form must reproduce the above copyright notice,
12  * this list of conditions and the following disclaimer in the documentation
13  * and/or other materials provided with the distribution.
14  *
15  * 3. Neither the name of the copyright holder nor the names of its
16  * contributors may be used to endorse or promote products derived from this
17  * software without specific prior written permission.
18  *
19  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
23  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29  * POSSIBILITY OF SUCH DAMAGE.
30  *
31  */
32 
33 #ifndef __DEV_AMDGPU_PM4_DEFINES_H__
34 #define __DEV_AMDGPU_PM4_DEFINES_H__
35 
36 #include <cstdlib>
37 #include <iostream>
38 #include <vector>
39 
40 #include "base/types.hh"
41 
42 namespace gem5
43 {
44 
53 {
54  IT_NOP = 0x10,
55  IT_WRITE_DATA = 0x37,
63  IT_MAP_QUEUES = 0xA2,
66  IT_RUN_LIST = 0xA5,
67 };
68 
72 #define PACKET3_SET_UCONFIG_REG_START 0x0000c000
73 
77 typedef struct GEM5_PACKED
78 {
79  union
80  {
81  struct
82  {
83  uint16_t predicated : 1;
84  uint16_t shader : 1;
85  uint16_t reserved : 6;
86  uint16_t opcode : 8;
87  uint16_t count : 14;
88  uint16_t type : 2;
89  };
90  uint32_t ordinal;
91  };
93 static_assert(sizeof(PM4Header) == 4);
94 
95 typedef struct GEM5_PACKED
96 {
97  uint32_t reserved1 : 8;
98  uint32_t destSel : 4;
99  uint32_t reserved2 : 4;
100  uint32_t addrIncr : 1;
101  uint32_t reserved3 : 2;
102  uint32_t resume : 1;
103  uint32_t writeConfirm : 1;
104  uint32_t reserved4 : 4;
105  uint32_t cachePolicy : 2;
106  uint32_t reserved5 : 5;
107  union
108  {
109  struct
110  {
111  uint32_t destAddrLo;
112  uint32_t destAddrHi;
113  };
114  uint64_t destAddr;
115  };
116  uint32_t data;
118 static_assert(sizeof(PM4WriteData) == 16);
119 
120 typedef struct GEM5_PACKED
121 {
122  uint32_t reserved1 : 4;
123  uint32_t queueSel : 2;
124  uint32_t reserved2 : 2;
125  uint32_t vmid : 4;
126  uint32_t reserved3 : 1;
127  uint32_t queueSlot : 3;
128  uint32_t pipe : 2;
129  uint32_t me : 1;
130  uint32_t reserved6 : 2;
131  uint32_t queueType : 3;
132  uint32_t allocFormat : 2;
133  uint32_t engineSel : 3;
134  uint32_t numQueues : 3;
135  uint32_t reserved4 : 1;
136  uint32_t checkDisable : 1;
137  uint32_t doorbellOffset : 26;
138  uint32_t reserved5 : 4;
139  union
140  {
141  struct
142  {
143  uint32_t mqdAddrLo : 32;
144  uint32_t mqdAddrHi : 32;
145  };
146  uint64_t mqdAddr;
147  };
148  union
149  {
150  struct
151  {
152  uint32_t wptrAddrLo : 32;
153  uint32_t wptrAddrHi : 32;
154  };
155  uint64_t wptrAddr;
156  };
158 static_assert(sizeof(PM4MapQueues) == 24);
159 
160 typedef struct GEM5_PACKED
161 {
162  uint32_t action : 2;
163  uint32_t reserved : 2;
164  uint32_t queueSel : 2;
165  uint32_t reserved1 : 20;
166  uint32_t engineSel : 3;
167  uint32_t numQueues : 3;
168  union
169  {
170  struct
171  {
172  uint32_t pasid : 16;
173  uint32_t reserved2 : 16;
174  };
175  struct
176  {
177  uint32_t reserved3 : 2;
178  uint32_t doorbellOffset0 : 26;
179  uint32_t reserved4 : 4;
180  };
181  };
182  uint32_t reserved5 : 2;
183  uint32_t doorbellOffset1 : 26;
184  uint32_t reserved6 : 4;
185  uint32_t reserved7 : 2;
186  uint32_t doorbellOffset2 : 26;
187  uint32_t reserved8 : 4;
188  uint32_t reserved9 : 2;
189  uint32_t doorbellOffset3 : 26;
190  uint32_t reserved10 : 4;
192 static_assert(sizeof(PM4UnmapQueues) == 20);
193 
194 typedef struct GEM5_PACKED
195 {
196  uint32_t vmidMask : 16;
197  uint32_t unmapLatency : 8;
198  uint32_t reserved : 5;
199  uint32_t queueType : 3;
200  union
201  {
202  struct
203  {
204  uint32_t queueMaskLo;
205  uint32_t queueMaskHi;
206  };
207  uint64_t queueMask;
208  };
209  union
210  {
211  struct
212  {
213  uint32_t gwsMaskLo;
214  uint32_t gwsMaskHi;
215  };
216  uint64_t gwsMask;
217  };
218  uint16_t oacMask;
219  uint16_t reserved1;
220  uint32_t gdsHeapBase : 6;
221  uint32_t reserved2 : 5;
222  uint32_t gdsHeapSize : 6;
223  uint32_t reserved3 : 15;
225 static_assert(sizeof(PM4SetResources) == 28);
226 
227 typedef struct GEM5_PACKED
228 {
229  uint32_t pasid : 16;
230  uint32_t reserved0 : 8;
231  uint32_t diq : 1;
232  uint32_t processQuantum : 7;
233  union
234  {
235  struct
236  {
237  uint32_t ptBaseLo;
238  uint32_t ptBaseHi;
239  };
240  uint64_t ptBase;
241  };
242  uint32_t shMemBases;
243  uint32_t shMemConfig;
244  uint32_t reserved1;
245  uint32_t reserved2;
246  uint32_t reserved3;
247  uint32_t reserved4;
248  uint32_t reserved5;
249  union
250  {
251  struct
252  {
253  uint32_t gdsAddrLo;
254  uint32_t gdsAddrHi;
255  };
256  uint64_t gdsAddr;
257  };
258  uint32_t numGws : 6;
259  uint32_t reserved7 : 2;
260  uint32_t numOac : 4;
261  uint32_t reserved8 : 4;
262  uint32_t gdsSize : 6;
263  uint32_t numQueues : 10;
264  union
265  {
266  struct
267  {
270  };
272  };
274 static_assert(sizeof(PM4MapProcess) == 60);
275 
276 typedef struct GEM5_PACKED
277 {
278  uint32_t function : 4;
279  uint32_t memSpace : 2;
280  uint32_t operation : 2;
281  uint32_t reserved1 : 24;
282  union
283  {
284  struct
285  {
286  uint32_t regAddr1 : 18;
287  uint32_t reserved2 : 14;
288  };
289  uint32_t memAddrLo;
290  };
291  union
292  {
293  struct
294  {
295  uint32_t regAddr2 : 18;
296  uint32_t reserved3 : 14;
297  };
298  uint32_t memAddrHi;
299  };
300  uint32_t reference;
301  uint32_t mask;
302  uint32_t pollInterval;
304 static_assert(sizeof(PM4WaitRegMem) == 24);
305 
306 typedef struct GEM5_PACKED
307 {
308  uint32_t regOffset : 16;
309  uint32_t reserved : 16;
310  uint32_t regData;
312 static_assert(sizeof(PM4SetUConfig) == 8);
313 
314 typedef struct GEM5_PACKED
315 {
316  union
317  {
318  struct
319  {
320  uint32_t ibBaseLo;
321  uint32_t ibBaseHi;
322  };
323  uint64_t ibBase;
324  };
325  uint32_t ibSize : 20;
326  uint32_t chain : 1;
327  uint32_t poll : 1;
328  uint32_t reserved0 : 1;
329  uint32_t valid: 1;
330  uint32_t vmid : 4;
331  uint32_t cachePolicy : 2;
332  uint32_t reserved1 : 1;
333  uint32_t priv : 1;
335 static_assert(sizeof(PM4IndirectBuf) == 12);
336 
337 typedef struct GEM5_PACKED
338 {
339  union
340  {
341  struct
342  {
343  uint32_t tmz : 1;
344  uint32_t reserved : 31;
345  };
346  uint32_t dummy;
347  };
349 static_assert(sizeof(PM4SwitchBuf) == 4);
350 
351 typedef struct GEM5_PACKED
352 {
353  union
354  {
355  struct
356  {
357  uint32_t ibBaseLo;
358  uint32_t ibBaseHi;
359  };
360  uint64_t ibBase;
361  };
362  uint32_t ibSize : 20;
363  uint32_t chain : 1;
364  uint32_t ena : 1;
365  uint32_t reserved1 : 2;
366  uint32_t vmid : 4;
367  uint32_t cachePolicy : 2;
368  uint32_t preResume : 1;
369  uint32_t priv : 1;
371 static_assert(sizeof(PM4IndirectBufConst) == 12);
372 
373 typedef struct GEM5_PACKED
374 {
375  uint32_t tmz : 1;
376  uint32_t reserved : 27;
377  uint32_t command : 4;
379 static_assert(sizeof(PM4FrameCtrl) == 4);
380 
381 typedef struct GEM5_PACKED
382 {
383  uint32_t event : 6;
384  uint32_t reserved0 : 2;
385  uint32_t eventIdx : 4;
386  uint32_t l1Volatile : 1;
387  uint32_t l2Volatile : 1;
388  uint32_t reserved1 : 1;
389  uint32_t l2WB : 1;
390  uint32_t l1Inv : 1;
391  uint32_t l2Inv : 1;
392  uint32_t reserved2 : 1;
393  uint32_t l2NC : 1;
394  uint32_t l2WC : 1;
395  uint32_t l2Meta : 1;
396  uint32_t reserved3 : 3;
397  uint32_t cachePolicy : 2;
398  uint32_t reserved4 : 1;
399  uint32_t execute : 1;
400  uint32_t reserved5 : 3;
401  uint32_t reserved6 : 16;
402  uint32_t destSelect : 2;
403  uint32_t reserved7 : 6;
404  uint32_t intSelect : 3;
405  uint32_t reserved8 : 2;
406  uint32_t dataSelect : 3;
407  union
408  {
409  struct
410  {
411  uint32_t addrLo;
412  uint32_t addrHi;
413  };
414  uint64_t addr;
415  };
416  union
417  {
418  struct
419  {
420  union
421  {
422  struct
423  {
424  uint32_t dwOffset : 16;
425  uint32_t numDws : 16;
426  };
427  uint32_t dataLo : 32;
428  };
429  uint32_t dataHi;
430  };
431  uint64_t data;
432  };
433  uint32_t intCtxId;
435 static_assert(sizeof(PM4ReleaseMem) == 28);
436 
437 typedef struct GEM5_PACKED
438 {
439  uint32_t offset : 16;
440  uint32_t reserved : 16;
441  uint32_t data;
443 static_assert(sizeof(PM4SetUconfigReg) == 8);
444 
445 typedef struct GEM5_PACKED
446 {
447  union
448  {
449  struct
450  {
451  uint32_t ibBaseLo;
452  uint32_t ibBaseHi;
453  };
454  uint64_t ibBase;
455  };
456  uint32_t ibSize : 20;
457  uint32_t chain : 1;
458  uint32_t offleadPolling : 1;
459  uint32_t reserved1 : 1;
460  uint32_t valid : 1;
461  uint32_t processCnt : 4;
462  uint32_t reserved2 : 4;
464 static_assert(sizeof(PM4RunList) == 12);
465 
466 typedef struct GEM5_PACKED
467 {
468  uint32_t contextId : 28;
469  uint32_t interruptSel : 2;
470  uint32_t command : 2;
471  union
472  {
473  struct
474  {
475  uint32_t pasid : 16;
476  uint32_t reserved0 : 16;
477  };
478  struct
479  {
480  uint32_t reserved1 : 2;
481  uint32_t doorbellOffset : 26;
482  uint32_t engineSel : 3;
483  uint32_t reserved2 : 1;
484  };
485  };
486  union
487  {
488  struct
489  {
490  uint32_t addrLo;
491  uint32_t addrHi;
492  };
493  uint64_t addr;
494  };
495  union
496  {
497  struct
498  {
499  uint32_t dataLo;
500  uint32_t dataHi;
501  };
502  uint64_t data;
503  };
505 static_assert(sizeof(PM4QueryStatus) == 24);
506 
507 } // namespace gem5
508 
509 #endif // __DEV_AMDGPU_PM4_DEFINES_HH__
Defines global host-dependent types: Counter, Tick, and (indirectly) {int,uint}{8,...
Reference material can be found at the JEDEC website: UFS standard http://www.jedec....
struct gem5::GEM5_PACKED PM4IndirectBufConst
struct gem5::GEM5_PACKED PM4WriteData
struct gem5::GEM5_PACKED PM4WaitRegMem
struct gem5::GEM5_PACKED PM4RunList
struct gem5::GEM5_PACKED PM4ReleaseMem
struct gem5::GEM5_PACKED PM4SwitchBuf
struct gem5::GEM5_PACKED PM4Header
PM4 packets.
struct gem5::GEM5_PACKED PM4MapQueues
struct gem5::GEM5_PACKED PM4MapProcess
struct gem5::GEM5_PACKED PM4UnmapQueues
struct gem5::GEM5_PACKED PM4SetUconfigReg
struct gem5::GEM5_PACKED PM4SetResources
it_opcode_type
PM4 opcodes.
Definition: pm4_defines.hh:53
@ IT_RELEASE_MEM
Definition: pm4_defines.hh:58
@ IT_WRITE_DATA
Definition: pm4_defines.hh:55
@ IT_RUN_LIST
Definition: pm4_defines.hh:66
@ IT_MAP_QUEUES
Definition: pm4_defines.hh:63
@ IT_NOP
Definition: pm4_defines.hh:54
@ IT_SET_UCONFIG_REG
Definition: pm4_defines.hh:59
@ IT_MAP_PROCESS
Definition: pm4_defines.hh:62
@ IT_INVALIDATE_TLBS
Definition: pm4_defines.hh:61
@ IT_QUERY_STATUS
Definition: pm4_defines.hh:65
@ IT_WAIT_REG_MEM
Definition: pm4_defines.hh:56
@ IT_UNMAP_QUEUES
Definition: pm4_defines.hh:64
@ IT_INDIRECT_BUFFER
Definition: pm4_defines.hh:57
@ IT_SWITCH_BUFFER
Definition: pm4_defines.hh:60
struct gem5::GEM5_PACKED PM4QueryStatus
struct gem5::GEM5_PACKED PM4FrameCtrl
struct gem5::GEM5_PACKED PM4SetUConfig
struct gem5::GEM5_PACKED PM4IndirectBuf
PM4 packets.
Definition: pm4_defines.hh:78
uint32_t queueMaskLo
Definition: pm4_defines.hh:204
uint32_t completionSignalLo
Definition: pm4_defines.hh:268
uint32_t shMemConfig
Definition: pm4_defines.hh:243
uint32_t doorbellOffset0
Definition: pm4_defines.hh:178
uint32_t unmapLatency
Definition: pm4_defines.hh:197
uint32_t cachePolicy
Definition: pm4_defines.hh:105
uint32_t doorbellOffset3
Definition: pm4_defines.hh:189
uint32_t doorbellOffset2
Definition: pm4_defines.hh:186
uint32_t allocFormat
Definition: pm4_defines.hh:132
uint32_t pollInterval
Definition: pm4_defines.hh:302
uint32_t doorbellOffset
Definition: pm4_defines.hh:137
uint32_t completionSignalHi
Definition: pm4_defines.hh:269
uint32_t reserved1
Definition: pm4_defines.hh:97
uint16_t predicated
Definition: pm4_defines.hh:83
uint32_t writeConfirm
Definition: pm4_defines.hh:103
uint32_t processQuantum
Definition: pm4_defines.hh:232
uint32_t queueMaskHi
Definition: pm4_defines.hh:205
uint32_t reserved2
Definition: pm4_defines.hh:99
uint32_t checkDisable
Definition: pm4_defines.hh:136
uint32_t offleadPolling
Definition: pm4_defines.hh:458
uint32_t gdsHeapSize
Definition: pm4_defines.hh:222
uint32_t doorbellOffset1
Definition: pm4_defines.hh:183
uint64_t completionSignal
Definition: pm4_defines.hh:271
uint32_t interruptSel
Definition: pm4_defines.hh:469
uint32_t gdsHeapBase
Definition: pm4_defines.hh:220

Generated on Wed Dec 21 2022 10:22:32 for gem5 by doxygen 1.9.1