gem5  [DEVELOP-FOR-23.0]
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
amdgpu_device.cc
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 
33 
34 #include <fstream>
35 
36 #include "debug/AMDGPUDevice.hh"
38 #include "dev/amdgpu/amdgpu_vm.hh"
42 #include "dev/hsa/hw_scheduler.hh"
44 #include "gpu-compute/shader.hh"
45 #include "mem/abstract_mem.hh"
46 #include "mem/packet.hh"
47 #include "mem/packet_access.hh"
48 #include "params/AMDGPUDevice.hh"
49 #include "sim/byteswap.hh"
50 #include "sim/sim_exit.hh"
51 
52 namespace gem5
53 {
54 
55 AMDGPUDevice::AMDGPUDevice(const AMDGPUDeviceParams &p)
56  : PciDevice(p), gpuMemMgr(p.memory_manager), deviceIH(p.device_ih),
57  pm4PktProc(p.pm4_pkt_proc), cp(p.cp),
58  checkpoint_before_mmios(p.checkpoint_before_mmios),
59  init_interrupt_count(0), _lastVMID(0),
60  deviceMem(name() + ".deviceMem", p.memories, false, "", false)
61 {
62  // Loading the rom binary dumped from hardware.
63  std::ifstream romBin;
64  romBin.open(p.rom_binary, std::ios::binary);
65  romBin.read((char *)rom.data(), ROM_SIZE);
66  romBin.close();
67 
68  // System pointer needs to be explicitly set for device memory since
69  // DRAMCtrl uses it to get (1) cache line size and (2) the mem mode.
70  // Note this means the cache line size is system wide.
71  for (auto& m : p.memories) {
72  m->system(p.system);
73 
74  // Add to system's device memory map.
75  p.system->addDeviceMemory(gpuMemMgr->getRequestorID(), m);
76  }
77 
78  if (config.expansionROM) {
79  romRange = RangeSize(config.expansionROM, ROM_SIZE);
80  } else {
82  }
83 
84  if (p.trace_file != "") {
85  mmioReader.readMMIOTrace(p.trace_file);
86  }
87 
88  int sdma_id = 0;
89  for (auto& s : p.sdmas) {
90  s->setGPUDevice(this);
91  s->setId(sdma_id);
92  sdmaIds.insert({sdma_id, s});
93  sdmaMmios.insert({sdma_id,
94  RangeSize(s->getMmioBase(), s->getMmioSize())});
95  DPRINTF(AMDGPUDevice, "SDMA%d has MMIO range %s\n", sdma_id,
96  sdmaMmios[sdma_id].to_string().c_str());
97  sdma_id++;
98  }
99 
100  // Map SDMA MMIO addresses to functions
101  sdmaFunc.insert({0x81, &SDMAEngine::setGfxBaseLo});
102  sdmaFunc.insert({0x82, &SDMAEngine::setGfxBaseHi});
103  sdmaFunc.insert({0x88, &SDMAEngine::setGfxRptrHi});
104  sdmaFunc.insert({0x89, &SDMAEngine::setGfxRptrLo});
105  sdmaFunc.insert({0x92, &SDMAEngine::setGfxDoorbellLo});
107  sdmaFunc.insert({0x80, &SDMAEngine::setGfxSize});
108  sdmaFunc.insert({0xb2, &SDMAEngine::setGfxWptrLo});
109  sdmaFunc.insert({0xb3, &SDMAEngine::setGfxWptrHi});
110  if (p.device_name == "Vega10") {
111  sdmaFunc.insert({0xe1, &SDMAEngine::setPageBaseLo});
112  sdmaFunc.insert({0xe9, &SDMAEngine::setPageRptrLo});
113  sdmaFunc.insert({0xe8, &SDMAEngine::setPageRptrHi});
114  sdmaFunc.insert({0xf2, &SDMAEngine::setPageDoorbellLo});
116  sdmaFunc.insert({0xe0, &SDMAEngine::setPageSize});
117  sdmaFunc.insert({0x113, &SDMAEngine::setPageWptrLo});
118  } else if (p.device_name == "MI100" || p.device_name == "MI200") {
119  sdmaFunc.insert({0xd9, &SDMAEngine::setPageBaseLo});
120  sdmaFunc.insert({0xe1, &SDMAEngine::setPageRptrLo});
121  sdmaFunc.insert({0xe0, &SDMAEngine::setPageRptrHi});
122  sdmaFunc.insert({0xea, &SDMAEngine::setPageDoorbellLo});
124  sdmaFunc.insert({0x10b, &SDMAEngine::setPageWptrLo});
125  } else {
126  panic("Unknown GPU device %s\n", p.device_name);
127  }
128 
129  deviceIH->setGPUDevice(this);
130  pm4PktProc->setGPUDevice(this);
131  cp->hsaPacketProc().setGPUDevice(this);
132  cp->setGPUDevice(this);
133 
134  // Address aperture for device memory. We tell this to the driver and
135  // could possibly be anything, but these are the values used by hardware.
136  uint64_t mmhubBase = 0x8000ULL << 24;
137  uint64_t mmhubTop = 0x83ffULL << 24;
138 
139  // These are hardcoded register values to return what the driver expects
140  setRegVal(AMDGPU_MP0_SMN_C2PMSG_33, 0x80000000);
141 
142  // There are different registers for different GPUs, so we set the value
143  // based on the GPU type specified by the user.
144  if (p.device_name == "Vega10") {
145  setRegVal(VEGA10_FB_LOCATION_BASE, mmhubBase >> 24);
146  setRegVal(VEGA10_FB_LOCATION_TOP, mmhubTop >> 24);
147  gfx_version = GfxVersion::gfx900;
148  } else if (p.device_name == "MI100") {
149  setRegVal(MI100_FB_LOCATION_BASE, mmhubBase >> 24);
150  setRegVal(MI100_FB_LOCATION_TOP, mmhubTop >> 24);
151  setRegVal(MI100_MEM_SIZE_REG, 0x3ff0); // 16GB of memory
152  gfx_version = GfxVersion::gfx908;
153  } else if (p.device_name == "MI200") {
154  // This device can have either 64GB or 128GB of device memory.
155  // This limits to 16GB for simulation.
156  setRegVal(MI200_FB_LOCATION_BASE, mmhubBase >> 24);
157  setRegVal(MI200_FB_LOCATION_TOP, mmhubTop >> 24);
158  setRegVal(MI200_MEM_SIZE_REG, 0x3ff0);
159  gfx_version = GfxVersion::gfx90a;
160  } else {
161  panic("Unknown GPU device %s\n", p.device_name);
162  }
163 
164  gpuvm.setMMHUBBase(mmhubBase);
165  gpuvm.setMMHUBTop(mmhubTop);
166 
167  nbio.setGPUDevice(this);
168 }
169 
170 void
172 {
173  Addr rom_offset = pkt->getAddr() & (ROM_SIZE - 1);
174  uint64_t rom_data = 0;
175 
176  memcpy(&rom_data, rom.data() + rom_offset, pkt->getSize());
177  pkt->setUintX(rom_data, ByteOrder::little);
178 
179  DPRINTF(AMDGPUDevice, "Read from addr %#x on ROM offset %#x data: %#x\n",
180  pkt->getAddr(), rom_offset, rom_data);
181 }
182 
183 void
185 {
186  assert(isROM(pkt->getAddr()));
187 
188  Addr rom_offset = pkt->getAddr() - romRange.start();
189  uint64_t rom_data = pkt->getUintX(ByteOrder::little);
190 
191  memcpy(rom.data() + rom_offset, &rom_data, pkt->getSize());
192 
193  DPRINTF(AMDGPUDevice, "Write to addr %#x on ROM offset %#x data: %#x\n",
194  pkt->getAddr(), rom_offset, rom_data);
195 }
196 
199 {
201  AddrRangeList ret_ranges;
202  ret_ranges.push_back(romRange);
203 
204  // If the range starts at zero assume OS hasn't assigned it yet. Do not
205  // return ranges starting with zero as they will surely overlap with
206  // another range causing the I/O crossbar to fatal.
207  for (auto & r : ranges) {
208  if (r.start() != 0) {
209  ret_ranges.push_back(r);
210  }
211  }
212 
213  return ret_ranges;
214 }
215 
216 Tick
218 {
219  [[maybe_unused]] int offset = pkt->getAddr() & PCI_CONFIG_SIZE;
220  DPRINTF(AMDGPUDevice, "Read Config: from offset: %#x size: %#x "
221  "data: %#x\n", offset, pkt->getSize(), config.data[offset]);
222 
223  Tick delay = PciDevice::readConfig(pkt);
224 
225  // Before sending MMIOs the driver sends three interrupts in a row.
226  // Use this to trigger creating a checkpoint to restore in timing mode.
227  // This is only necessary until we can create a "hole" in the KVM VM
228  // around the VGA ROM region such that KVM exits and sends requests to
229  // this device rather than the KVM VM.
231  if (offset == PCI0_INTERRUPT_PIN) {
232  if (++init_interrupt_count == 3) {
233  DPRINTF(AMDGPUDevice, "Checkpointing before first MMIO\n");
234  exitSimLoop("checkpoint", 0, curTick() + delay + 1);
235  }
236  } else {
238  }
239  }
240 
241  return delay;
242 }
243 
244 Tick
246 {
247  [[maybe_unused]] int offset = pkt->getAddr() & PCI_CONFIG_SIZE;
248  DPRINTF(AMDGPUDevice, "Write Config: from offset: %#x size: %#x "
249  "data: %#x\n", offset, pkt->getSize(),
250  pkt->getUintX(ByteOrder::little));
251 
252  return PciDevice::writeConfig(pkt);
253 }
254 
255 void
257 {
258  DPRINTF(AMDGPUDevice, "%s from addr %#x size: %#x data: %#x\n",
259  read ? "Read" : "Write", pkt->getAddr(), pkt->getSize(),
260  pkt->getUintX(ByteOrder::little));
261 
262  pkt->makeAtomicResponse();
263 }
264 
265 void
267 {
268  DPRINTF(AMDGPUDevice, "Read framebuffer address %#lx\n", offset);
269 
270  /*
271  * Return data for frame reads in priority order: (1) Special addresses
272  * first, ignoring any writes from driver. (2) Any other address from
273  * device backing store / abstract memory class functionally.
274  */
275  if (nbio.readFrame(pkt, offset)) {
276  return;
277  }
278 
279  /*
280  * Read the value from device memory. This must be done functionally
281  * because this method is called by the PCIDevice::read method which
282  * is a non-timing read.
283  */
284  RequestPtr req = std::make_shared<Request>(offset, pkt->getSize(), 0,
285  vramRequestorId());
286  PacketPtr readPkt = Packet::createRead(req);
287  uint8_t *dataPtr = new uint8_t[pkt->getSize()];
288  readPkt->dataDynamic(dataPtr);
289 
290  auto system = cp->shader()->gpuCmdProc.system();
291  system->getDeviceMemory(readPkt)->access(readPkt);
292 
293  pkt->setUintX(readPkt->getUintX(ByteOrder::little), ByteOrder::little);
294 }
295 
296 void
298 {
299  DPRINTF(AMDGPUDevice, "Read doorbell %#lx\n", offset);
301 }
302 
303 void
305 {
306  Addr aperture = gpuvm.getMmioAperture(offset);
307  Addr aperture_offset = offset - aperture;
308 
309  // By default read from MMIO trace. Overwrite the packet for a select
310  // few more dynamic MMIOs.
311  DPRINTF(AMDGPUDevice, "Read MMIO %#lx\n", offset);
313 
314  if (regs.find(offset) != regs.end()) {
315  uint64_t value = regs[offset];
316  DPRINTF(AMDGPUDevice, "Reading what kernel wrote before: %#x\n",
317  value);
318  pkt->setUintX(value, ByteOrder::little);
319  }
320 
321  switch (aperture) {
322  case NBIO_BASE:
323  nbio.readMMIO(pkt, aperture_offset);
324  break;
325  case GRBM_BASE:
326  gpuvm.readMMIO(pkt, aperture_offset >> GRBM_OFFSET_SHIFT);
327  break;
328  case MMHUB_BASE:
329  gpuvm.readMMIO(pkt, aperture_offset >> MMHUB_OFFSET_SHIFT);
330  break;
331  default:
332  break;
333  }
334 }
335 
336 void
338 {
339  DPRINTF(AMDGPUDevice, "Wrote framebuffer address %#lx\n", offset);
340 
341  Addr aperture = gpuvm.getFrameAperture(offset);
342  Addr aperture_offset = offset - aperture;
343 
344  // Record the value
345  if (aperture == gpuvm.gartBase()) {
346  gpuvm.gartTable[aperture_offset] = pkt->getUintX(ByteOrder::little);
347  DPRINTF(AMDGPUDevice, "GART translation %p -> %p\n", aperture_offset,
348  gpuvm.gartTable[aperture_offset]);
349  }
350 
351  nbio.writeFrame(pkt, offset);
352 
353  /*
354  * Write the value to device memory. This must be done functionally
355  * because this method is called by the PCIDevice::write method which
356  * is a non-timing write.
357  */
358  RequestPtr req = std::make_shared<Request>(offset, pkt->getSize(), 0,
359  vramRequestorId());
360  PacketPtr writePkt = Packet::createWrite(req);
361  uint8_t *dataPtr = new uint8_t[pkt->getSize()];
362  std::memcpy(dataPtr, pkt->getPtr<uint8_t>(),
363  pkt->getSize() * sizeof(uint8_t));
364  writePkt->dataDynamic(dataPtr);
365 
366  auto system = cp->shader()->gpuCmdProc.system();
367  system->getDeviceMemory(writePkt)->access(writePkt);
368 }
369 
370 void
372 {
373  DPRINTF(AMDGPUDevice, "Wrote doorbell %#lx\n", offset);
374 
375  if (doorbells.find(offset) != doorbells.end()) {
376  QueueType q_type = doorbells[offset];
377  DPRINTF(AMDGPUDevice, "Doorbell offset %p queue: %d\n",
378  offset, q_type);
379  switch (q_type) {
380  case Compute:
382  pkt->getLE<uint64_t>());
383  break;
384  case Gfx:
386  pkt->getLE<uint64_t>());
387  break;
388  case SDMAGfx: {
389  SDMAEngine *sdmaEng = getSDMAEngine(offset);
390  sdmaEng->processGfx(pkt->getLE<uint64_t>());
391  } break;
392  case SDMAPage: {
393  SDMAEngine *sdmaEng = getSDMAEngine(offset);
394  sdmaEng->processPage(pkt->getLE<uint64_t>());
395  } break;
396  case ComputeAQL: {
398  pkt->getLE<uint64_t>() + 1);
399  pm4PktProc->updateReadIndex(offset, pkt->getLE<uint64_t>() + 1);
400  } break;
401  case InterruptHandler:
402  deviceIH->updateRptr(pkt->getLE<uint32_t>());
403  break;
404  case RLC: {
405  SDMAEngine *sdmaEng = getSDMAEngine(offset);
406  sdmaEng->processRLC(offset, pkt->getLE<uint64_t>());
407  } break;
408  default:
409  panic("Write to unkown queue type!");
410  }
411  } else {
412  warn("Unknown doorbell offset: %lx\n", offset);
413  }
414 }
415 
416 void
418 {
419  Addr aperture = gpuvm.getMmioAperture(offset);
420  Addr aperture_offset = offset - aperture;
421 
422  DPRINTF(AMDGPUDevice, "Wrote MMIO %#lx\n", offset);
423 
424  // Check SDMA functions first, then fallback to switch statement
425  for (int idx = 0; idx < sdmaIds.size(); ++idx) {
426  if (sdmaMmios[idx].contains(offset)) {
427  Addr sdma_offset = (offset - sdmaMmios[idx].start()) >> 2;
428  if (sdmaFunc.count(sdma_offset)) {
429  DPRINTF(AMDGPUDevice, "Calling SDMA%d MMIO function %lx\n",
430  idx, sdma_offset);
431  sdmaFuncPtr mptr = sdmaFunc[sdma_offset];
432  (getSDMAById(idx)->*mptr)(pkt->getLE<uint32_t>());
433  } else {
434  DPRINTF(AMDGPUDevice, "Unknown SDMA%d MMIO: %#lx\n", idx,
435  sdma_offset);
436  }
437 
438  return;
439  }
440  }
441 
442  switch (aperture) {
443  /* Write a general register to the graphics register bus manager. */
444  case GRBM_BASE:
445  gpuvm.writeMMIO(pkt, aperture_offset >> GRBM_OFFSET_SHIFT);
446  pm4PktProc->writeMMIO(pkt, aperture_offset >> GRBM_OFFSET_SHIFT);
447  break;
448  /* Write a register to the interrupt handler. */
449  case IH_BASE:
450  deviceIH->writeMMIO(pkt, aperture_offset >> IH_OFFSET_SHIFT);
451  break;
452  /* Write an IO space register */
453  case NBIO_BASE:
454  nbio.writeMMIO(pkt, aperture_offset);
455  break;
456  default:
457  DPRINTF(AMDGPUDevice, "Unknown MMIO aperture for %#x\n", offset);
458  break;
459  }
460 }
461 
462 Tick
464 {
465  if (isROM(pkt->getAddr())) {
466  readROM(pkt);
467  } else {
468  int barnum = -1;
469  Addr offset = 0;
470  getBAR(pkt->getAddr(), barnum, offset);
471 
472  switch (barnum) {
473  case FRAMEBUFFER_BAR:
474  readFrame(pkt, offset);
475  break;
476  case DOORBELL_BAR:
477  readDoorbell(pkt, offset);
478  break;
479  case MMIO_BAR:
480  readMMIO(pkt, offset);
481  break;
482  default:
483  panic("Request with address out of mapped range!");
484  }
485  }
486 
487  dispatchAccess(pkt, true);
488  return pioDelay;
489 }
490 
491 Tick
493 {
494  if (isROM(pkt->getAddr())) {
495  writeROM(pkt);
496 
497  dispatchAccess(pkt, false);
498 
499  return pioDelay;
500  }
501 
502  int barnum = -1;
503  Addr offset = 0;
504  getBAR(pkt->getAddr(), barnum, offset);
505 
506  switch (barnum) {
507  case FRAMEBUFFER_BAR:
508  writeFrame(pkt, offset);
509  break;
510  case DOORBELL_BAR:
511  writeDoorbell(pkt, offset);
512  break;
513  case MMIO_BAR:
514  writeMMIO(pkt, offset);
515  break;
516  default:
517  panic("Request with address out of mapped range!");
518  }
519 
520  // Record only if there is non-zero value, or a value to be overwritten.
521  // Reads return 0 by default.
522  uint64_t data = pkt->getUintX(ByteOrder::little);
523 
524  DPRINTF(AMDGPUDevice, "PCI Write to %#lx data %#lx\n",
525  pkt->getAddr(), data);
526 
527  dispatchAccess(pkt, false);
528 
529  return pioDelay;
530 }
531 
532 bool
534 {
535  return regs.count(addr);
536 }
537 
538 uint32_t
540 {
541  DPRINTF(AMDGPUDevice, "Getting register 0x%lx = %x\n",
542  addr, regs[addr]);
543  return regs[addr];
544 }
545 
546 void
547 AMDGPUDevice::setRegVal(uint32_t addr, uint32_t value)
548 {
549  DPRINTF(AMDGPUDevice, "Setting register 0x%lx to %x\n",
550  addr, value);
551  regs[addr] = value;
552 }
553 
554 void
556 {
557  DPRINTF(AMDGPUDevice, "Setting doorbell type for %x\n", offset);
558  doorbells[offset] = qt;
559 }
560 
561 void
563 {
564  sdmaEngs[offset] = eng;
565 }
566 
567 SDMAEngine*
569 {
574  assert(sdmaIds.count(id));
575 
576  return sdmaIds[id];
577 }
578 
579 SDMAEngine*
581 {
582  return sdmaEngs[offset];
583 }
584 
585 void
587 {
589 }
590 
591 void
593 {
594  // Serialize the PciDevice base class
596 
597  uint64_t regs_size = regs.size();
598  uint64_t doorbells_size = doorbells.size();
599  uint64_t sdma_engs_size = sdmaEngs.size();
600 
601  SERIALIZE_SCALAR(regs_size);
602  SERIALIZE_SCALAR(doorbells_size);
603  SERIALIZE_SCALAR(sdma_engs_size);
604 
605  // Make a c-style array of the regs to serialize
606  uint32_t reg_addrs[regs_size];
607  uint64_t reg_values[regs_size];
608  uint32_t doorbells_offset[doorbells_size];
609  QueueType doorbells_queues[doorbells_size];
610  uint32_t sdma_engs_offset[sdma_engs_size];
611  int sdma_engs[sdma_engs_size];
612 
613  int idx = 0;
614  for (auto & it : regs) {
615  reg_addrs[idx] = it.first;
616  reg_values[idx] = it.second;
617  ++idx;
618  }
619 
620  idx = 0;
621  for (auto & it : doorbells) {
622  doorbells_offset[idx] = it.first;
623  doorbells_queues[idx] = it.second;
624  ++idx;
625  }
626 
627  idx = 0;
628  for (auto & it : sdmaEngs) {
629  sdma_engs_offset[idx] = it.first;
630  sdma_engs[idx] = it.second->getId();
631  ++idx;
632  }
633 
634  SERIALIZE_ARRAY(reg_addrs, sizeof(reg_addrs)/sizeof(reg_addrs[0]));
635  SERIALIZE_ARRAY(reg_values, sizeof(reg_values)/sizeof(reg_values[0]));
636  SERIALIZE_ARRAY(doorbells_offset, sizeof(doorbells_offset)/
637  sizeof(doorbells_offset[0]));
638  SERIALIZE_ARRAY(doorbells_queues, sizeof(doorbells_queues)/
639  sizeof(doorbells_queues[0]));
640  SERIALIZE_ARRAY(sdma_engs_offset, sizeof(sdma_engs_offset)/
641  sizeof(sdma_engs_offset[0]));
642  SERIALIZE_ARRAY(sdma_engs, sizeof(sdma_engs)/sizeof(sdma_engs[0]));
643 
644  // Serialize the device memory
645  deviceMem.serializeSection(cp, "deviceMem");
646  gpuvm.serializeSection(cp, "GPUVM");
647 }
648 
649 void
651 {
652  // Unserialize the PciDevice base class
654 
655  uint64_t regs_size = 0;
656  uint64_t doorbells_size = 0;
657  uint64_t sdma_engs_size = 0;
658 
659  UNSERIALIZE_SCALAR(regs_size);
660  UNSERIALIZE_SCALAR(doorbells_size);
661  UNSERIALIZE_SCALAR(sdma_engs_size);
662 
663  if (regs_size > 0) {
664  uint32_t reg_addrs[regs_size];
665  uint64_t reg_values[regs_size];
666 
667  UNSERIALIZE_ARRAY(reg_addrs, sizeof(reg_addrs)/sizeof(reg_addrs[0]));
668  UNSERIALIZE_ARRAY(reg_values,
669  sizeof(reg_values)/sizeof(reg_values[0]));
670 
671  for (int idx = 0; idx < regs_size; ++idx) {
672  regs.insert(std::make_pair(reg_addrs[idx], reg_values[idx]));
673  }
674  }
675 
676  if (doorbells_size > 0) {
677  uint32_t doorbells_offset[doorbells_size];
678  QueueType doorbells_queues[doorbells_size];
679 
680  UNSERIALIZE_ARRAY(doorbells_offset, sizeof(doorbells_offset)/
681  sizeof(doorbells_offset[0]));
682  UNSERIALIZE_ARRAY(doorbells_queues, sizeof(doorbells_queues)/
683  sizeof(doorbells_queues[0]));
684 
685  for (int idx = 0; idx < doorbells_size; ++idx) {
686  regs.insert(std::make_pair(doorbells_offset[idx],
687  doorbells_queues[idx]));
688  doorbells[doorbells_offset[idx]] = doorbells_queues[idx];
689  }
690  }
691 
692  if (sdma_engs_size > 0) {
693  uint32_t sdma_engs_offset[sdma_engs_size];
694  int sdma_engs[sdma_engs_size];
695 
696  UNSERIALIZE_ARRAY(sdma_engs_offset, sizeof(sdma_engs_offset)/
697  sizeof(sdma_engs_offset[0]));
698  UNSERIALIZE_ARRAY(sdma_engs, sizeof(sdma_engs)/sizeof(sdma_engs[0]));
699 
700  for (int idx = 0; idx < sdma_engs_size; ++idx) {
701  int sdma_id = sdma_engs[idx];
702  assert(sdmaIds.count(sdma_id));
703  SDMAEngine *sdma = sdmaIds[sdma_id];
704  sdmaEngs.insert(std::make_pair(sdma_engs_offset[idx], sdma));
705  }
706  }
707 
708  // Unserialize the device memory
709  deviceMem.unserializeSection(cp, "deviceMem");
710  gpuvm.unserializeSection(cp, "GPUVM");
711 }
712 
713 uint16_t
715 {
716  for (uint16_t vmid = 1; vmid < AMDGPU_VM_COUNT; vmid++) {
717  auto result = usedVMIDs.find(vmid);
718  if (result == usedVMIDs.end()) {
719  idMap.insert(std::make_pair(pasid, vmid));
720  usedVMIDs[vmid] = {};
721  _lastVMID = vmid;
722  return vmid;
723  }
724  }
725  panic("All VMIDs have been assigned");
726 }
727 
728 void
730 {
731  usedVMIDs.erase(vmid);
732 }
733 
734 void
736 {
737  auto result = idMap.find(pasid);
738  assert(result != idMap.end());
739  if (result == idMap.end()) return;
740  uint16_t vmid = result->second;
741 
742  idMap.erase(result);
743  usedVMIDs.erase(vmid);
744 }
745 
746 void
748 {
749  idMap.erase(idMap.begin(), idMap.end());
750  usedVMIDs.erase(usedVMIDs.begin(), usedVMIDs.end());
751 
752  for (auto& it : sdmaEngs) {
753  it.second->deallocateRLCQueues();
754  }
755 }
756 
757 void
758 AMDGPUDevice::mapDoorbellToVMID(Addr doorbell, uint16_t vmid)
759 {
760  doorbellVMIDMap[doorbell] = vmid;
761 }
762 
763 std::unordered_map<uint16_t, std::set<int>>&
765 {
766  return usedVMIDs;
767 }
768 
769 void
770 AMDGPUDevice::insertQId(uint16_t vmid, int id)
771 {
772  usedVMIDs[vmid].insert(id);
773 }
774 
775 } // namespace gem5
gem5::AMDGPUVM::readMMIO
void readMMIO(PacketPtr pkt, Addr offset)
Definition: amdgpu_vm.cc:69
gem5::curTick
Tick curTick()
The universal simulation clock.
Definition: cur_tick.hh:46
gem5::AMDGPUDevice::read
Tick read(PacketPtr pkt) override
Pure virtual function that the device must implement.
Definition: amdgpu_device.cc:463
gem5::VegaISA::s
Bitfield< 1 > s
Definition: pagetable.hh:64
gem5::AMDGPUDevice::isROM
bool isROM(Addr addr) const
Definition: amdgpu_device.hh:97
MI200_MEM_SIZE_REG
#define MI200_MEM_SIZE_REG
Definition: amdgpu_vm.hh:84
gem5::GPUCommandProcessor::shader
Shader * shader()
Definition: gpu_command_processor.cc:460
MI200_FB_LOCATION_TOP
#define MI200_FB_LOCATION_TOP
Definition: amdgpu_vm.hh:86
gem5::AddrRange::start
Addr start() const
Get the start address of the range.
Definition: addr_range.hh:343
gem5::HSAPacketProcessor::setGPUDevice
void setGPUDevice(AMDGPUDevice *gpu_device)
Definition: hsa_packet_processor.cc:97
warn
#define warn(...)
Definition: logging.hh:256
gem5::AMDGPUDevice::_lastVMID
uint16_t _lastVMID
Definition: amdgpu_device.hh:142
gem5::AMDGPUDevice::getAddrRanges
AddrRangeList getAddrRanges() const override
Every PIO device is obliged to provide an implementation that returns the address ranges the device r...
Definition: amdgpu_device.cc:198
gem5::PciDevice::config
PCIConfig config
The current config space.
Definition: device.hh:275
gem5::Packet::getUintX
uint64_t getUintX(ByteOrder endian) const
Get the data in the packet byte swapped from the specified endianness and zero-extended to 64 bits.
Definition: packet.cc:352
gem5::VegaISA::m
m
Definition: pagetable.hh:52
gem5::AMDGPUDevice::gpuMemMgr
AMDGPUMemoryManager * gpuMemMgr
Definition: amdgpu_device.hh:112
data
const char data[]
Definition: circlebuf.test.cc:48
shader.hh
UNSERIALIZE_SCALAR
#define UNSERIALIZE_SCALAR(scalar)
Definition: serialize.hh:575
gem5::PciDevice::serialize
void serialize(CheckpointOut &cp) const override
Serialize this object to the given output stream.
Definition: device.cc:401
gem5::AMDGPUDevice::writeROM
void writeROM(PacketPtr pkt)
Definition: amdgpu_device.cc:184
gem5::AMDGPUDevice::setDoorbellType
void setDoorbellType(uint32_t offset, QueueType qt)
Set handles to GPU blocks.
Definition: amdgpu_device.cc:555
gem5::NBIO_BASE
static constexpr uint32_t NBIO_BASE
Definition: amdgpu_defines.hh:91
gem5::RangeSize
AddrRange RangeSize(Addr start, Addr size)
Definition: addr_range.hh:831
abstract_mem.hh
gem5::AMDGPUDevice::getSDMAEngine
SDMAEngine * getSDMAEngine(Addr offset)
Definition: amdgpu_device.cc:580
gem5::PciDevice::unserialize
void unserialize(CheckpointIn &cp) override
Reconstruct the state of this object from a checkpoint.
Definition: device.cc:464
gem5::IH_OFFSET_SHIFT
static constexpr uint32_t IH_OFFSET_SHIFT
Definition: amdgpu_defines.hh:73
gem5::AMDGPUVM::getMmioAperture
Addr getMmioAperture(Addr addr)
Definition: amdgpu_vm.hh:230
gem5::AMDGPUDevice::getSDMAById
SDMAEngine * getSDMAById(int id)
Definition: amdgpu_device.cc:568
gem5::MMHUB_OFFSET_SHIFT
static constexpr uint32_t MMHUB_OFFSET_SHIFT
Definition: amdgpu_defines.hh:88
gem5::Gfx
@ Gfx
Definition: amdgpu_defines.hh:44
gem5::AMDGPUInterruptHandler::writeMMIO
void writeMMIO(PacketPtr pkt, Addr mmio_offset)
Methods for setting the values of interrupt handler MMIO registers.
Definition: interrupt_handler.cc:165
gem5::PM4PacketProcessor::writeMMIO
void writeMMIO(PacketPtr pkt, Addr mmio_offset)
Definition: pm4_packet_processor.cc:782
gem5::AMDGPUDevice::deallocateAllQueues
void deallocateAllQueues()
Definition: amdgpu_device.cc:747
gem5::AMDGPUDevice::intrPost
void intrPost()
Methods inherited from PciDevice.
Definition: amdgpu_device.cc:586
gem5::CheckpointIn
Definition: serialize.hh:68
gem5::PciDevice::pioDelay
Tick pioDelay
Definition: device.hh:354
gem5::Serializable::serializeSection
void serializeSection(CheckpointOut &cp, const char *name) const
Serialize an object into a new section.
Definition: serialize.cc:74
sc_dt::to_string
const std::string to_string(sc_enc enc)
Definition: sc_fxdefs.cc:91
gem5::SDMAEngine::setPageWptrLo
void setPageWptrLo(uint32_t data)
Definition: sdma_engine.cc:1364
sdma_engine.hh
gem5::DOORBELL_BAR
constexpr int DOORBELL_BAR
Definition: amdgpu_defines.hh:57
gem5::RLC
@ RLC
Definition: amdgpu_defines.hh:49
gem5::AMDGPUDevice::nbio
AMDGPUNbio nbio
Blocks of the GPU.
Definition: amdgpu_device.hh:111
gem5::AMDGPUDevice::idMap
std::unordered_map< uint16_t, uint16_t > idMap
Definition: amdgpu_device.hh:136
gem5::AMDGPUDevice::sdmaMmios
std::unordered_map< uint32_t, AddrRange > sdmaMmios
Definition: amdgpu_device.hh:123
gem5::AMDGPUDevice::doorbellVMIDMap
std::unordered_map< Addr, uint16_t > doorbellVMIDMap
Definition: amdgpu_device.hh:138
gem5::Packet::createWrite
static PacketPtr createWrite(const RequestPtr &req)
Definition: packet.hh:1044
gem5::X86ISA::system
Bitfield< 15 > system
Definition: misc.hh:1004
gem5::AMDGPUVM::gartBase
Addr gartBase()
Return base address of GART table in framebuffer.
Definition: amdgpu_vm.cc:57
gem5::SDMAEngine::setGfxRptrHi
void setGfxRptrHi(uint32_t data)
Definition: sdma_engine.cc:1230
gem5::AMDGPUNbio::readMMIO
void readMMIO(PacketPtr pkt, Addr offset)
Definition: amdgpu_nbio.cc:54
gem5::FRAMEBUFFER_BAR
constexpr int FRAMEBUFFER_BAR
Definition: amdgpu_defines.hh:56
MI100_FB_LOCATION_BASE
#define MI100_FB_LOCATION_BASE
Definition: amdgpu_vm.hh:81
gem5::AMDGPUDevice::unserialize
void unserialize(CheckpointIn &cp) override
Unserialize an object.
Definition: amdgpu_device.cc:650
gem5::AMDGPUInterruptHandler::setGPUDevice
void setGPUDevice(AMDGPUDevice *gpu_device)
Definition: interrupt_handler.hh:172
gem5::GPUCommandProcessor::hsaPacketProc
HSAPacketProcessor & hsaPacketProc()
Definition: gpu_command_processor.cc:65
gem5::AMDMMIOReader::readMMIOTrace
void readMMIOTrace(std::string trace_file)
Read an MMIO trace gathered from a real system and place the MMIO values read and written into the MM...
Definition: mmio_reader.cc:44
gem5::Packet::makeAtomicResponse
void makeAtomicResponse()
Definition: packet.hh:1074
gem5::SDMAEngine::setGfxDoorbellLo
void setGfxDoorbellLo(uint32_t data)
Definition: sdma_engine.cc:1238
gem5::VegaISA::r
Bitfield< 5 > r
Definition: pagetable.hh:60
gem5::AMDGPUVM::getFrameAperture
Addr getFrameAperture(Addr addr)
Definition: amdgpu_vm.hh:262
gem5::SDMAEngine::setPageSize
void setPageSize(uint32_t data)
Definition: sdma_engine.cc:1356
gem5::PM4PacketProcessor::process
void process(PM4Queue *q, Addr wptrOffset)
This method start processing a PM4Queue from the current read pointer to the newly communicated write...
Definition: pm4_packet_processor.cc:155
gem5::AMDGPUDevice::gfx_version
GfxVersion gfx_version
Definition: amdgpu_device.hh:150
gem5::AMDGPUDevice::readConfig
Tick readConfig(PacketPtr pkt) override
Read from the PCI config space data that is stored locally.
Definition: amdgpu_device.cc:217
interrupt_handler.hh
hw_scheduler.hh
sim_exit.hh
gem5::SDMAPage
@ SDMAPage
Definition: amdgpu_defines.hh:46
gem5::AMDGPUDevice::mapDoorbellToVMID
void mapDoorbellToVMID(Addr doorbell, uint16_t vmid)
Definition: amdgpu_device.cc:758
gem5::AMDGPUDevice::writeMMIO
void writeMMIO(PacketPtr pkt, Addr offset)
Definition: amdgpu_device.cc:417
gem5::exitSimLoop
void exitSimLoop(const std::string &message, int exit_code, Tick when, Tick repeat, bool serialize)
Schedule an event to exit the simulation loop (returning to Python) at the end of the current cycle (...
Definition: sim_events.cc:88
gem5::AMDGPUDevice::gpuvm
AMDGPUVM gpuvm
Definition: amdgpu_device.hh:114
packet.hh
gem5::AMDGPUDevice::cp
GPUCommandProcessor * cp
Definition: amdgpu_device.hh:116
gem5::AMDGPUDevice::sdmaEngs
std::unordered_map< uint32_t, SDMAEngine * > sdmaEngs
Definition: amdgpu_device.hh:119
gem5::PciDevice::writeConfig
virtual Tick writeConfig(PacketPtr pkt)
Write to the PCI config space data that is stored locally.
Definition: device.cc:283
gem5::SDMAEngine::setGfxBaseLo
void setGfxBaseLo(uint32_t data)
Definition: sdma_engine.cc:1206
gem5::AMDGPUDevice::AMDGPUDevice
AMDGPUDevice(const AMDGPUDeviceParams &p)
Definition: amdgpu_device.cc:55
VEGA10_FB_LOCATION_TOP
#define VEGA10_FB_LOCATION_TOP
Definition: amdgpu_vm.hh:78
gem5::GRBM_OFFSET_SHIFT
static constexpr uint32_t GRBM_OFFSET_SHIFT
Definition: amdgpu_defines.hh:78
gem5::SDMAEngine::setGfxRptrLo
void setGfxRptrLo(uint32_t data)
Definition: sdma_engine.cc:1222
gem5::AMDGPUInterruptHandler::updateRptr
void updateRptr(const uint32_t &data)
Definition: interrupt_handler.cc:254
MI100_FB_LOCATION_TOP
#define MI100_FB_LOCATION_TOP
Definition: amdgpu_vm.hh:82
gem5::SDMAEngine::processPage
void processPage(Addr wptrOffset)
Definition: sdma_engine.cc:286
gem5::AMDGPUDevice::writeConfig
Tick writeConfig(PacketPtr pkt) override
Write to the PCI config space data that is stored locally.
Definition: amdgpu_device.cc:245
gem5::Serializable::unserializeSection
void unserializeSection(CheckpointIn &cp, const char *name)
Unserialize an a child object.
Definition: serialize.cc:81
gem5::VegaISA::p
Bitfield< 54 > p
Definition: pagetable.hh:70
gem5::PM4PacketProcessor::setGPUDevice
void setGPUDevice(AMDGPUDevice *gpu_device)
Definition: pm4_packet_processor.cc:86
gem5::AMDGPUVM::setMMHUBTop
void setMMHUBTop(Addr top)
Definition: amdgpu_vm.hh:207
DPRINTF
#define DPRINTF(x,...)
Definition: trace.hh:210
gem5::SDMAEngine::processRLC
void processRLC(Addr doorbellOffset, Addr wptrOffset)
Definition: sdma_engine.cc:297
amdgpu_device.hh
gem5::Packet
A Packet is used to encapsulate a transfer between two objects in the memory system (e....
Definition: packet.hh:294
gem5::Tick
uint64_t Tick
Tick count type.
Definition: types.hh:58
gem5::AMDGPUDevice::setRegVal
void setRegVal(uint32_t addr, uint32_t value)
Definition: amdgpu_device.cc:547
gem5::RequestPtr
std::shared_ptr< Request > RequestPtr
Definition: request.hh:92
gem5::AMDGPUDevice::allocateVMID
uint16_t allocateVMID(uint16_t pasid)
Definition: amdgpu_device.cc:714
gem5::AMDGPUDevice::regs
GPURegMap regs
Definition: amdgpu_device.hh:90
gem5::AMDGPUDevice::mmioReader
AMDMMIOReader mmioReader
MMIO reader to populate device registers map.
Definition: amdgpu_device.hh:106
gem5::AMDGPUNbio::setGPUDevice
void setGPUDevice(AMDGPUDevice *gpu_device)
Definition: amdgpu_nbio.cc:48
gem5::PciDevice
PCI device, base implementation is only config space.
Definition: device.hh:269
gem5::AMDGPUDevice::checkpoint_before_mmios
bool checkpoint_before_mmios
Initial checkpoint support variables.
Definition: amdgpu_device.hh:131
gem5::AMDGPUDevice::sdmaFunc
std::unordered_map< uint32_t, sdmaFuncPtr > sdmaFunc
Definition: amdgpu_device.hh:126
gem5::MMIO_BAR
constexpr int MMIO_BAR
Definition: amdgpu_defines.hh:58
gem5::AMDGPUDevice::readROM
void readROM(PacketPtr pkt)
Definition: amdgpu_device.cc:171
gem5::PciDevice::getBAR
bool getBAR(Addr addr, int &num, Addr &offs)
Which base address register (if any) maps the given address?
Definition: device.hh:320
pm4_packet_processor.hh
gem5::ArmISA::offset
Bitfield< 23, 0 > offset
Definition: types.hh:144
gem5::SDMAEngine::setPageRptrHi
void setPageRptrHi(uint32_t data)
Definition: sdma_engine.cc:1316
gem5::AMDGPUDevice
Device model for an AMD GPU.
Definition: amdgpu_device.hh:62
gem5::AMDGPUDevice::serialize
void serialize(CheckpointOut &cp) const override
Checkpoint support.
Definition: amdgpu_device.cc:592
gem5::AMDGPUDevice::dispatchAccess
void dispatchAccess(PacketPtr pkt, bool read)
Convert a PCI packet into a response.
Definition: amdgpu_device.cc:256
gem5::SDMAEngine::setPageDoorbellLo
void setPageDoorbellLo(uint32_t data)
Definition: sdma_engine.cc:1324
gpu_command_processor.hh
gem5::SDMAEngine::setGfxDoorbellOffsetLo
void setGfxDoorbellOffsetLo(uint32_t data)
Definition: sdma_engine.cc:1252
SERIALIZE_ARRAY
#define SERIALIZE_ARRAY(member, size)
Definition: serialize.hh:610
gem5::AMDGPUDevice::readFrame
void readFrame(PacketPtr pkt, Addr offset)
Helper methods to handle specific BAR read/writes.
Definition: amdgpu_device.cc:266
gem5::AMDGPUDevice::readDoorbell
void readDoorbell(PacketPtr pkt, Addr offset)
Definition: amdgpu_device.cc:297
gem5::SDMAEngine
System DMA Engine class for AMD dGPU.
Definition: sdma_engine.hh:48
gem5::AMDGPUVM::setMMHUBBase
void setMMHUBBase(Addr base)
Definition: amdgpu_vm.hh:206
gem5::GPUCommandProcessor::setGPUDevice
void setGPUDevice(AMDGPUDevice *gpu_device)
Definition: gpu_command_processor.cc:447
gem5::Addr
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
Definition: types.hh:147
gem5::AMDGPUVM::gartTable
std::unordered_map< uint64_t, uint64_t > gartTable
Copy of GART table.
Definition: amdgpu_vm.hh:179
gem5::GPUCommandProcessor::system
System * system()
Definition: gpu_command_processor.cc:434
gem5::AMDGPUNbio::readFrame
bool readFrame(PacketPtr pkt, Addr offset)
Definition: amdgpu_nbio.cc:151
gem5::ROM_SIZE
constexpr uint32_t ROM_SIZE
Definition: amdgpu_defines.hh:62
gem5::SDMAGfx
@ SDMAGfx
Definition: amdgpu_defines.hh:45
name
const std::string & name()
Definition: trace.cc:48
SERIALIZE_SCALAR
#define SERIALIZE_SCALAR(scalar)
Definition: serialize.hh:568
gem5::AMDGPUDevice::write
Tick write(PacketPtr pkt) override
Pure virtual function that the device must implement.
Definition: amdgpu_device.cc:492
gem5::VGA_ROM_DEFAULT
constexpr uint32_t VGA_ROM_DEFAULT
Definition: amdgpu_defines.hh:61
gem5::Compute
@ Compute
Definition: amdgpu_defines.hh:43
packet_access.hh
gem5::AMDGPUDevice::getUsedVMIDs
std::unordered_map< uint16_t, std::set< int > > & getUsedVMIDs()
Definition: amdgpu_device.cc:764
gem5::AMDGPUDevice::haveRegVal
bool haveRegVal(uint32_t addr)
Register value getter/setter.
Definition: amdgpu_device.cc:533
VEGA10_FB_LOCATION_BASE
#define VEGA10_FB_LOCATION_BASE
Definition: amdgpu_vm.hh:77
gem5::AMDMMIOReader::readFromTrace
void readFromTrace(PacketPtr pkt, int barnum, Addr offset)
Get the next MMIO read from the trace file to an offset in a BAR and write the value to the packet pr...
Definition: mmio_reader.cc:76
gem5::IH_BASE
static constexpr uint32_t IH_BASE
Definition: amdgpu_defines.hh:71
gem5::AMDGPUMemoryManager::getRequestorID
RequestorID getRequestorID() const
Get the requestorID for the memory manager.
Definition: memory_manager.hh:126
gem5::AMDGPUVM::writeMMIO
void writeMMIO(PacketPtr pkt, Addr offset)
Definition: amdgpu_vm.cc:105
amdgpu_nbio.hh
gem5::PciDevice::readConfig
virtual Tick readConfig(PacketPtr pkt)
Read from the PCI config space data that is stored locally.
Definition: device.cc:212
gem5::AMDGPUDevice::readMMIO
void readMMIO(PacketPtr pkt, Addr offset)
Definition: amdgpu_device.cc:304
gem5::AMDGPUDevice::sdmaIds
std::unordered_map< uint32_t, SDMAEngine * > sdmaIds
Definition: amdgpu_device.hh:121
UNSERIALIZE_ARRAY
#define UNSERIALIZE_ARRAY(member, size)
Definition: serialize.hh:618
gem5::PM4PacketProcessor::getQueue
PM4Queue * getQueue(Addr offset, bool gfx=false)
Based on an offset communicated through doorbell write, the PM4PacketProcessor identifies which queue...
Definition: pm4_packet_processor.cc:102
gem5::AMDGPUDevice::init_interrupt_count
int init_interrupt_count
Definition: amdgpu_device.hh:132
gem5::HSAPacketProcessor::hwScheduler
HWScheduler * hwScheduler()
Definition: hsa_packet_processor.hh:368
gem5::SDMAEngine::setPageRptrLo
void setPageRptrLo(uint32_t data)
Definition: sdma_engine.cc:1308
gem5::AMDGPUDevice::romRange
AddrRange romRange
VGA ROM methods.
Definition: amdgpu_device.hh:96
gem5::MMHUB_BASE
static constexpr uint32_t MMHUB_BASE
Definition: amdgpu_defines.hh:86
gem5::Packet::dataDynamic
void dataDynamic(T *p)
Set the data pointer to a value that should have delete [] called on it.
Definition: packet.hh:1213
gem5::SDMAEngine::setGfxWptrLo
void setGfxWptrLo(uint32_t data)
Definition: sdma_engine.cc:1278
gem5::Shader::gpuCmdProc
GPUCommandProcessor & gpuCmdProc
Definition: shader.hh:256
MI100_MEM_SIZE_REG
#define MI100_MEM_SIZE_REG
Definition: amdgpu_vm.hh:80
gem5::AMDGPUDevice::usedVMIDs
std::unordered_map< uint16_t, std::set< int > > usedVMIDs
Definition: amdgpu_device.hh:140
gem5::PM4PacketProcessor::updateReadIndex
void updateReadIndex(Addr offset, uint64_t rd_idx)
Update read index on doorbell rings.
Definition: pm4_packet_processor.cc:525
gem5::AMDGPUDevice::insertQId
void insertQId(uint16_t vmid, int id)
Definition: amdgpu_device.cc:770
gem5::Packet::getLE
T getLE() const
Get the data in the packet byte swapped from little endian to host endian.
Definition: packet_access.hh:78
gem5::ArmISA::id
Bitfield< 33 > id
Definition: misc_types.hh:305
gem5::AMDGPUDevice::deallocateVmid
void deallocateVmid(uint16_t vmid)
Definition: amdgpu_device.cc:729
gem5::PioDevice::read
virtual Tick read(PacketPtr pkt)=0
Pure virtual function that the device must implement.
gem5::AMDGPUDevice::deallocatePasid
void deallocatePasid(uint16_t pasid)
Definition: amdgpu_device.cc:735
gem5::AMDGPUDevice::rom
std::array< uint8_t, ROM_SIZE > rom
Definition: amdgpu_device.hh:101
gem5::CheckpointOut
std::ostream CheckpointOut
Definition: serialize.hh:66
gem5::AMDGPU_VM_COUNT
static constexpr int AMDGPU_VM_COUNT
Definition: amdgpu_defines.hh:53
gem5::AMDGPUDevice::deviceMem
memory::PhysicalMemory deviceMem
Definition: amdgpu_device.hh:147
gem5::AMDGPUDevice::getRegVal
uint32_t getRegVal(uint32_t addr)
Definition: amdgpu_device.cc:539
gem5::HWScheduler::write
void write(Addr db_addr, uint64_t doorbell_reg)
Definition: hw_scheduler.cc:331
gem5::InterruptHandler
@ InterruptHandler
Definition: amdgpu_defines.hh:48
gem5::AMDGPUNbio::writeFrame
void writeFrame(PacketPtr pkt, Addr offset)
Definition: amdgpu_nbio.cc:164
gem5::AMDGPUDevice::writeFrame
void writeFrame(PacketPtr pkt, Addr offset)
Definition: amdgpu_device.cc:337
std::list< AddrRange >
amdgpu_vm.hh
gem5::Packet::getAddr
Addr getAddr() const
Definition: packet.hh:807
gem5::SDMAEngine::processGfx
void processGfx(Addr wptrOffset)
Given a new write ptr offset, communicated to the GPU through a doorbell write, the SDMA engine proce...
Definition: sdma_engine.cc:275
PCI_CONFIG_SIZE
#define PCI_CONFIG_SIZE
Definition: pcireg.h:165
gem5::SDMAEngine::setPageDoorbellOffsetLo
void setPageDoorbellOffsetLo(uint32_t data)
Definition: sdma_engine.cc:1338
AMDGPU_MP0_SMN_C2PMSG_33
#define AMDGPU_MP0_SMN_C2PMSG_33
Definition: amdgpu_nbio.hh:62
gem5
Reference material can be found at the JEDEC website: UFS standard http://www.jedec....
Definition: gpu_translation_state.hh:37
gem5::AMDGPUDevice::sdmaFuncPtr
void(SDMAEngine::* sdmaFuncPtr)(uint32_t)
Definition: amdgpu_device.hh:125
gem5::PciDevice::intrPost
void intrPost()
Definition: device.hh:364
gem5::SDMAEngine::setGfxWptrHi
void setGfxWptrHi(uint32_t data)
Definition: sdma_engine.cc:1285
gem5::QueueType
QueueType
Definition: amdgpu_defines.hh:41
gem5::AMDGPUNbio::writeMMIO
void writeMMIO(PacketPtr pkt, Addr offset)
Definition: amdgpu_nbio.cc:112
gem5::Packet::createRead
static PacketPtr createRead(const RequestPtr &req)
Constructor-like methods that return Packets based on Request objects.
Definition: packet.hh:1038
gem5::AMDGPUDevice::pm4PktProc
PM4PacketProcessor * pm4PktProc
Definition: amdgpu_device.hh:115
gem5::AMDGPUDevice::setSDMAEngine
void setSDMAEngine(Addr offset, SDMAEngine *eng)
Definition: amdgpu_device.cc:562
gem5::SDMAEngine::setGfxSize
void setGfxSize(uint32_t data)
Definition: sdma_engine.cc:1270
gem5::Packet::setUintX
void setUintX(uint64_t w, ByteOrder endian)
Set the value in the word w after truncating it to the length of the packet and then byteswapping it ...
Definition: packet.cc:361
gem5::PciDevice::getAddrRanges
AddrRangeList getAddrRanges() const override
Determine the address ranges that this device responds to.
Definition: device.cc:269
gem5::SDMAEngine::setPageBaseLo
void setPageBaseLo(uint32_t data)
Definition: sdma_engine.cc:1292
gem5::AMDGPUDevice::doorbells
std::unordered_map< uint32_t, QueueType > doorbells
Definition: amdgpu_device.hh:91
gem5::GRBM_BASE
static constexpr uint32_t GRBM_BASE
Definition: amdgpu_defines.hh:76
MI200_FB_LOCATION_BASE
#define MI200_FB_LOCATION_BASE
Definition: amdgpu_vm.hh:85
gem5::SDMAEngine::setGfxBaseHi
void setGfxBaseHi(uint32_t data)
Definition: sdma_engine.cc:1214
gem5::AMDGPUDevice::vramRequestorId
RequestorID vramRequestorId()
Methods related to translations and system/device memory.
Definition: amdgpu_device.hh:201
gem5::AMDGPUDevice::deviceIH
AMDGPUInterruptHandler * deviceIH
Definition: amdgpu_device.hh:113
gem5::Packet::getSize
unsigned getSize() const
Definition: packet.hh:817
byteswap.hh
panic
#define panic(...)
This implements a cprintf based panic() function.
Definition: logging.hh:188
gem5::X86ISA::addr
Bitfield< 3 > addr
Definition: types.hh:84
gem5::Packet::getPtr
T * getPtr()
get a pointer to the data ptr.
Definition: packet.hh:1225
PCI0_INTERRUPT_PIN
#define PCI0_INTERRUPT_PIN
Definition: pcireg.h:135
gem5::AMDGPUDevice::writeDoorbell
void writeDoorbell(PacketPtr pkt, Addr offset)
Definition: amdgpu_device.cc:371
gem5::ComputeAQL
@ ComputeAQL
Definition: amdgpu_defines.hh:47

Generated on Sun Jul 30 2023 01:56:54 for gem5 by doxygen 1.8.17