gem5 v24.0.0.0
Loading...
Searching...
No Matches
pm4_queues.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_QUEUES_HH__
34#define __DEV_AMDGPU_PM4_QUEUES_HH__
35
37
38namespace gem5
39{
40
46typedef struct GEM5_PACKED
47{
48 union
49 {
50 struct
51 {
54 };
55 uint64_t mqdReadIndex;
56 };
65 uint32_t disable_queue;
66 uint32_t reserved_107;
71 uint32_t reserved_112;
72 uint32_t reserved_113;
87 union
88 {
89 struct
90 {
93 };
94 uint64_t mqdBase;
95 };
96 uint32_t hqd_active;
97 uint32_t hqd_vmid;
101 uint32_t hqd_quantum;
102 union
103 {
104 struct
105 {
108 };
109 uint64_t base;
110 };
111 union
112 {
113 uint32_t hqd_pq_rptr;
114 uint32_t rptr;
115 };
116 union
117 {
118 struct
119 {
122 };
123 uint64_t aqlRptr;
124 };
127 union
128 {
130 uint32_t doorbell;
131 };
132 uint32_t reserved_144;
134 union
135 {
136 struct
137 {
140 };
142 };
143 union
144 {
145 uint32_t hqd_ib_rptr;
146 uint32_t ibRptr;
147 };
149 uint32_t hqd_iq_timer;
150 uint32_t hqd_iq_rptr;
178 uint32_t cp_hqd_error;
180 union
181 {
183 uint32_t aql;
184 };
188
194typedef struct GEM5_PACKED
195{
197 union
198 {
199 struct
200 {
203 };
204 uint64_t rb_base;
205 };
206 union
207 {
208 struct
209 {
212 };
213 uint64_t rptr;
214 };
215 union
216 {
217 struct
218 {
221 };
222 uint64_t wptr;
223 };
259 uint32_t reserved_42;
260 uint32_t reserved_43;
261 uint32_t reserved_44;
262 uint32_t reserved_45;
263 uint32_t reserved_46;
264 uint32_t reserved_47;
265 uint32_t reserved_48;
266 uint32_t reserved_49;
267 uint32_t reserved_50;
268 uint32_t reserved_51;
269 uint32_t reserved_52;
270 uint32_t reserved_53;
271 uint32_t reserved_54;
272 uint32_t reserved_55;
273 uint32_t reserved_56;
274 uint32_t reserved_57;
275 uint32_t reserved_58;
276 uint32_t reserved_59;
277 uint32_t reserved_60;
278 uint32_t reserved_61;
279 uint32_t reserved_62;
280 uint32_t reserved_63;
281 uint32_t reserved_64;
282 uint32_t reserved_65;
283 uint32_t reserved_66;
284 uint32_t reserved_67;
285 uint32_t reserved_68;
286 uint32_t reserved_69;
287 uint32_t reserved_70;
288 uint32_t reserved_71;
289 uint32_t reserved_72;
290 uint32_t reserved_73;
291 uint32_t reserved_74;
292 uint32_t reserved_75;
293 uint32_t reserved_76;
294 uint32_t reserved_77;
295 uint32_t reserved_78;
296 uint32_t reserved_79;
297 uint32_t reserved_80;
298 uint32_t reserved_81;
299 uint32_t reserved_82;
300 uint32_t reserved_83;
301 uint32_t reserved_84;
302 uint32_t reserved_85;
303 uint32_t reserved_86;
304 uint32_t reserved_87;
305 uint32_t reserved_88;
306 uint32_t reserved_89;
307 uint32_t reserved_90;
308 uint32_t reserved_91;
309 uint32_t reserved_92;
310 uint32_t reserved_93;
311 uint32_t reserved_94;
312 uint32_t reserved_95;
313 uint32_t reserved_96;
314 uint32_t reserved_97;
315 uint32_t reserved_98;
316 uint32_t reserved_99;
317 uint32_t reserved_100;
318 uint32_t reserved_101;
319 uint32_t reserved_102;
320 uint32_t reserved_103;
321 uint32_t reserved_104;
322 uint32_t reserved_105;
323 uint32_t reserved_106;
324 uint32_t reserved_107;
325 uint32_t reserved_108;
326 uint32_t reserved_109;
327 uint32_t reserved_110;
328 uint32_t reserved_111;
329 uint32_t reserved_112;
330 uint32_t reserved_113;
331 uint32_t reserved_114;
332 uint32_t reserved_115;
333 uint32_t reserved_116;
334 uint32_t reserved_117;
335 uint32_t reserved_118;
336 uint32_t reserved_119;
337 uint32_t reserved_120;
338 uint32_t reserved_121;
339 uint32_t reserved_122;
340 uint32_t reserved_123;
341 uint32_t reserved_124;
342 uint32_t reserved_125;
343 /* reserved_126,127: repurposed for driver-internal use */
347
348/* The Primary Queue has extra attributes, which will be stored separately. */
349typedef struct PrimaryQueue : QueueDesc
350{
351 union
352 {
353 struct
354 {
357 };
359 };
360 union
361 {
362 struct
363 {
364 uint32_t queueWptrLo;
365 uint32_t queueWptrHi;
366 };
368 };
373
378{
379 int _id;
380
381 /* Queue descriptor read from the system memory of the simulated system. */
383
393 bool _ib;
395 public:
396 PM4Queue() : _id(0), q(nullptr), _wptr(0), _offset(0), _processing(false),
397 _ib(false), _pkt() {}
400 _processing(false), _ib(false), _pkt() {}
403 _processing(false), _ib(false), _pkt(*pkt) {}
404
405 QueueDesc *getMQD() { return q; }
406 int id() { return _id; }
407 Addr mqdBase() { return q->mqdBase; }
408 Addr base() { return q->base; }
409 Addr ibBase() { return q->ibBase; }
410
411 Addr
413 {
414 if (ib()) return q->ibBase + q->ibRptr;
415 else return q->base + (q->rptr % size());
416 }
417
418 Addr
420 {
421 if (ib()) return q->ibBase + _ibWptr;
422 else return q->base + (_wptr % size());
423 }
424
425 Addr
427 {
428 if (ib()) return q->ibRptr;
429 else return q->rptr;
430 }
431
432 Addr
434 {
435 if (ib()) return _ibWptr;
436 else return _wptr;
437 }
438
439 Addr offset() { return _offset; }
440 bool processing() { return _processing; }
441 bool ib() { return _ib; }
442
443 void id(int value) { _id = value; }
444 void base(Addr value) { q->base = value; }
445 void ibBase(Addr value) { q->ibBase = value; }
446
454 void
456 {
457 if (ib()) q->ibRptr = _ibWptr;
458 else q->rptr = _wptr;
459 }
460
461 void
463 {
464 if (ib()) q->ibRptr += value;
465 else q->rptr += value;
466 }
467
468 void
469 rptr(Addr value)
470 {
471 if (ib()) q->ibRptr = value;
472 else q->rptr = value;
473 }
474
475 void
476 wptr(Addr value)
477 {
478 if (ib()) _ibWptr = value;
479 else _wptr = value;
480 }
481
482 void offset(Addr value) { _offset = value; }
483 void processing(bool value) { _processing = value; }
484 void ib(bool value) { _ib = value; }
485 uint32_t me() { return _pkt.me + 1; }
486 uint32_t pipe() { return _pkt.pipe; }
487 uint32_t queue() { return _pkt.queueSlot; }
488 bool privileged() { return _pkt.queueSel == 0 ? 1 : 0; }
489 PM4MapQueues* getPkt() { return &_pkt; }
490 void setPkt(uint32_t me, uint32_t pipe, uint32_t queue, bool privileged) {
491 _pkt.me = me - 1;
492 _pkt.pipe = pipe;
494 _pkt.queueSel = (privileged == 0) ? 1 : 0;
495 }
496
497 // Same computation as processMQD. See comment there for details.
498 uint64_t size() { return 4UL << ((q->hqd_pq_control & 0x3f) + 1); }
499};
500
501} // namespace gem5
502
503#endif // __DEV_AMDGPU_PM4_QUEUES_HH__
Class defining a PM4 queue.
void incRptr(Addr value)
void id(int value)
PM4MapQueues * getPkt()
void wptr(Addr value)
uint32_t me()
void processing(bool value)
void offset(Addr value)
PM4Queue(int id, QueueDesc *queue, Addr offset)
uint64_t size()
void setPkt(uint32_t me, uint32_t pipe, uint32_t queue, bool privileged)
void ibBase(Addr value)
QueueDesc * getMQD()
void base(Addr value)
void fastforwardRptr()
It seems that PM4 nop packets with count 0x3fff, not only do not consider the count value,...
uint32_t pipe()
PM4MapQueues _pkt
PM4Queue(int id, QueueDesc *queue, Addr offset, PM4MapQueues *pkt)
void rptr(Addr value)
uint32_t queue()
void ib(bool value)
QueueDesc * q
Addr _wptr
Most important fields of a PM4 queue are stored in the queue descriptor (i.e., QueueDesc).
Copyright (c) 2024 - Pranith Kumar Copyright (c) 2020 Inria All rights reserved.
Definition binary32.hh:36
gem5::PrimaryQueue PrimaryQueue
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
Definition types.hh:147
struct gem5::GEM5_PACKED SDMAQueueDesc
Queue descriptor for SDMA-based user queues (RLC queues).
struct gem5::GEM5_PACKED QueueDesc
Queue descriptor with relevant MQD attributes.
PM4 packets.
uint32_t gds_save_mask_hi
Definition pm4_queues.hh:82
uint32_t reserved_100
uint32_t sdmax_rlcx_ib_base_lo
uint32_t sdmax_rlcx_rb_rptr
uint32_t mqd_base_addr_hi
Definition pm4_queues.hh:92
uint32_t hqd_pq_base_lo
uint32_t reserved_104
uint32_t sdmax_rlcx_rb_wptr_poll_cntl
uint32_t reserved_114
uint32_t sdmax_rlcx_ib_cntl
uint32_t cp_hqd_eop_done_events
uint32_t reserved_122
uint32_t gds_save_base_addr_hi
Definition pm4_queues.hh:80
uint32_t reserved_125
uint32_t reserved_110
uint32_t sdmax_rlcx_ib_sub_remain
uint32_t hqd_ib_base_addr_hi
uint32_t cp_mqd_save_end_time_hi
Definition pm4_queues.hh:60
uint32_t reserved_144
uint32_t cp_mqd_restore_start_time_hi
Definition pm4_queues.hh:62
uint32_t mqd_base_addr_lo
Definition pm4_queues.hh:91
uint32_t cp_hqd_aql_control
uint32_t cp_packet_id_lo
Definition pm4_queues.hh:75
uint32_t sdmax_rlcx_preempt
uint32_t cp_hqd_eop_control
uint32_t sdmax_rlcx_rb_rptr_addr_hi
uint32_t cp_hqd_cntl_stack_offset
uint32_t cp_hqd_ctx_save_base_addr_lo
uint32_t hqd_queue_priority
uint32_t cp_hqd_error
uint32_t sdmax_rlcx_rb_cntl
uint32_t cp_hqd_dma_offload
uint32_t cp_hqd_atomic0_preop_lo
uint32_t sdmax_rlcx_skip_cntl
uint32_t reserved_117
uint32_t hqd_pq_wptr_poll_addr_hi
uint32_t hqd_pq_base_hi
uint32_t sdmax_rlcx_rb_base_hi
uint32_t sdmax_rlcx_doorbell_log
uint32_t cp_pq_exe_status_hi
Definition pm4_queues.hh:74
uint32_t cp_hqd_atomic1_preop_hi
uint32_t cp_mqd_readindex_hi
Definition pm4_queues.hh:53
uint32_t cp_mqd_control
uint32_t cp_packet_exe_status_lo
Definition pm4_queues.hh:77
uint32_t sdmax_rlcx_rb_wptr_hi
uint32_t gds_cs_ctxsw_cnt2
Definition pm4_queues.hh:69
uint32_t reserved_113
Definition pm4_queues.hh:72
uint32_t cp_mqd_readindex_lo
Definition pm4_queues.hh:52
uint32_t sdmax_rlcx_ib_base_hi
uint32_t hqd_pq_wptr_poll_addr_lo
uint32_t cp_mqd_restore_end_time_hi
Definition pm4_queues.hh:64
uint32_t sdmax_rlcx_rb_base
uint32_t cp_hqd_eop_base_addr_hi
uint32_t dynamic_cu_mask_addr_hi
Definition pm4_queues.hh:86
uint32_t sdmax_rlcx_midcmd_data8
uint32_t sdma_queue_id
uint32_t sdmax_rlcx_midcmd_data0
uint32_t cp_hqd_atomic1_preop_lo
uint32_t hqd_persistent_state
Definition pm4_queues.hh:98
uint32_t cp_hqd_atomic0_preop_hi
uint32_t cp_hqd_pq_wptr_lo
uint32_t sdmax_rlcx_status
uint32_t sdmax_rlcx_midcmd_data6
uint32_t ctx_save_base_addr_lo
Definition pm4_queues.hh:83
uint32_t sdmax_rlcx_rb_aql_cntl
uint32_t sdmax_rlcx_watermark
uint32_t gds_cs_ctxsw_cnt1
Definition pm4_queues.hh:68
uint32_t sdmax_rlcx_ib_rptr
uint32_t reserved_101
uint32_t sdmax_rlcx_csa_addr_lo
uint32_t cp_mqd_restore_start_time_lo
Definition pm4_queues.hh:61
uint32_t hqd_pipe_priority
Definition pm4_queues.hh:99
uint32_t sdmax_rlcx_csa_addr_hi
uint32_t sdmax_rlcx_doorbell_offset
uint32_t cp_mqd_save_end_time_lo
Definition pm4_queues.hh:59
uint32_t gds_cs_ctxsw_cnt0
Definition pm4_queues.hh:67
uint32_t hqd_ib_base_addr_lo
uint32_t cp_hqd_gds_resource_state
uint32_t reserved_107
Definition pm4_queues.hh:66
uint32_t cp_hqd_eop_base_addr_lo
uint32_t cp_hqd_pq_wptr_hi
uint32_t cp_hqd_eop_rptr
uint32_t gds_save_mask_lo
Definition pm4_queues.hh:81
uint32_t hqd_pq_rptr_report_addr_hi
uint32_t sdmax_rlcx_midcmd_data3
uint32_t cp_packet_exe_status_hi
Definition pm4_queues.hh:78
uint32_t reserved_118
uint32_t sdmax_rlcx_rb_wptr_poll_addr_lo
uint32_t reserved_112
Definition pm4_queues.hh:71
uint32_t cp_hqd_wg_state_offset
uint32_t sdmax_rlcx_midcmd_data4
uint32_t reserved_102
uint32_t hqd_pq_control
uint32_t sdmax_rlcx_midcmd_cntl
uint32_t cp_mqd_save_start_time_lo
Definition pm4_queues.hh:57
uint32_t sdmax_rlcx_context_status
uint32_t cp_pq_exe_status_lo
Definition pm4_queues.hh:73
uint32_t sdma_engine_id
uint32_t hqd_pq_rptr_report_addr_lo
uint32_t hqd_active
Definition pm4_queues.hh:96
uint32_t cp_hqd_hq_control1
uint32_t hqd_pq_doorbell_control
uint32_t sdmax_rlcx_rb_rptr_addr_lo
uint32_t reserved_121
uint32_t reserved_115
uint32_t cp_hqd_ctx_save_control
uint32_t sdmax_rlcx_doorbell
uint32_t sdmax_rlcx_rb_wptr
uint32_t cp_hqd_hq_status1
uint32_t ctx_save_base_addr_hi
Definition pm4_queues.hh:84
uint32_t sdmax_rlcx_ib_size
uint32_t sdmax_rlcx_minor_ptr_update
uint32_t sdmax_rlcx_rb_rptr_hi
uint32_t reserved_106
uint32_t cp_hqd_dequeue_request
uint32_t cp_hqd_hq_control0
uint32_t sdmax_rlcx_midcmd_data5
uint32_t reserved_119
uint32_t reserved_116
uint64_t mqdReadIndex
Definition pm4_queues.hh:55
uint32_t reserved_105
uint32_t disable_queue
Definition pm4_queues.hh:65
uint32_t gds_save_base_addr_lo
Definition pm4_queues.hh:79
uint32_t sdmax_rlcx_dummy_reg
uint32_t reserved_103
uint32_t sdmax_rlcx_ib_offset
uint32_t sdmax_rlcx_midcmd_data7
uint32_t sdmax_rlcx_rb_wptr_poll_addr_hi
uint32_t hqd_ib_control
uint32_t reserved_124
uint32_t reserved_123
uint32_t cp_hqd_cntl_stack_size
uint32_t gds_cs_ctxsw_cnt3
Definition pm4_queues.hh:70
uint32_t cp_hqd_eop_wptr_mem
uint32_t cp_mqd_save_start_time_hi
Definition pm4_queues.hh:58
uint32_t sdmax_rlcx_midcmd_data1
uint32_t dynamic_cu_mask_addr_lo
Definition pm4_queues.hh:85
uint32_t cp_hqd_hq_status0
uint32_t cp_mqd_restore_end_time_lo
Definition pm4_queues.hh:63
uint32_t cp_packet_id_hi
Definition pm4_queues.hh:76
uint32_t hqd_iq_timer
uint32_t reserved_109
uint32_t sdmax_rlcx_midcmd_data2
uint32_t cp_hqd_msg_type
uint32_t reserved_108
uint32_t cp_hqd_sema_cmd
uint32_t cp_hqd_ctx_save_size
uint32_t reserved_111
uint32_t reserved_120
uint32_t cp_hqd_ctx_save_base_addr_hi
uint32_t cp_hqd_eop_wptr
uint32_t queueRptrAddrLo
uint32_t doorbellRangeHi
uint32_t queueRptrAddrHi
uint32_t doorbellRangeLo
uint32_t doorbellOffset

Generated on Tue Jun 18 2024 16:24:02 for gem5 by doxygen 1.11.0