38#include "debug/AMDGPUDevice.hh"
71 uint32_t value = pkt->
getLE<uint32_t>();
77 pkt->
setLE<uint32_t>(1);
83 pkt->
setLE<uint32_t>(1);
96 pkt->
setLE<uint32_t>(1);
130 uint32_t
val = pkt->
getLE<uint32_t>();
134 uint32_t
val = pkt->
getLE<uint32_t>();
138 uint32_t
val = pkt->
getLE<uint32_t>();
142 uint32_t
val = pkt->
getLE<uint32_t>();
146 uint32_t
val = pkt->
getLE<uint32_t>();
150 uint32_t
val = pkt->
getLE<uint32_t>();
154 uint32_t
val = pkt->
getLE<uint32_t>();
158 uint32_t
val = pkt->
getLE<uint32_t>();
178 tlb->invalidateAll();
189 uint64_t gartTableSize;
219 uint64_t* gartTableKey =
new uint64_t[gartTableSize];
220 uint64_t* gartTableValue =
new uint64_t[gartTableSize];
224 gartTableKey[
i] = it->first;
225 gartTableValue[
i] = it->second;
230 delete[] gartTableKey;
231 delete[] gartTableValue;
241 uint64_t gartTableSize, *gartTableKey, *gartTableValue;
273 gartTableKey =
new uint64_t[gartTableSize];
274 gartTableValue =
new uint64_t[gartTableSize];
277 for (uint64_t
i = 0;
i < gartTableSize;
i++) {
280 delete[] gartTableKey;
281 delete[] gartTableValue;
290 if (next == range.
vaddr)
304 if (next == range.
vaddr)
313 gart_addr += lsb * 7;
317 auto result =
vm->gartTable.find(gart_addr);
318 if (result ==
vm->gartTable.end()) {
321 warn(
"GART translation for %p not found", range.
vaddr);
327 Addr pte = result->second;
329 range.
paddr = (
bits(pte, 47, 12) << 12) | lower_bits;
339 assert(
vm->inMMHUB(range.
vaddr));
342 if (next == range.
vaddr)
357 Addr start =
vm->getPageTableStart(vmid);
359 base, start, walker);
364 Fault fault = walker->startFunctional(
base, paddr, logBytes,
367 fatal(
"User translation fault");
371 const Addr page_size = 1 << logBytes;
373 if (next == range.
vaddr) {
381 paddr +=
vm->getMMHUBBase();
382 assert(
vm->inMMHUB(paddr));
#define mmVM_CONTEXT0_PAGE_TABLE_START_ADDR_HI32
#define mmMMHUB_VM_FB_LOCATION_BASE
#define mmMMHUB_VM_FB_LOCATION_TOP
#define mmVM_CONTEXT0_PAGE_TABLE_END_ADDR_LO32
#define mmMC_VM_SYSTEM_APERTURE_LOW_ADDR
#define mmMC_VM_FB_LOCATION_BASE
static constexpr int AMDGPU_MMHUB_PAGE_SIZE
#define mmMMHUB_VM_INVALIDATE_ENG17_SEM
#define mmMC_VM_SYSTEM_APERTURE_HIGH_ADDR
#define mmVM_CONTEXT0_PAGE_TABLE_BASE_ADDR_LO32
#define mmVM_CONTEXT0_PAGE_TABLE_END_ADDR_HI32
#define mmMC_VM_FB_OFFSET
#define mmMC_VM_FB_LOCATION_TOP
static constexpr int AMDGPU_GART_PAGE_SIZE
static constexpr int AMDGPU_USER_PAGE_SIZE
#define mmVM_CONTEXT0_PAGE_TABLE_START_ADDR_LO32
#define mmVM_INVALIDATE_ENG17_ACK
MMIO offsets for graphics register bus manager (GRBM).
#define mmVM_CONTEXT0_PAGE_TABLE_BASE_ADDR_HI32
static constexpr int AMDGPU_AGP_PAGE_SIZE
#define mmMMHUB_VM_INVALIDATE_ENG17_ACK
Device model for an AMD GPU.
void translate(Range &range) const override
Subclasses implement this function to complete TranslationGen.
void translate(Range &range) const override
Subclasses implement this function to complete TranslationGen.
void translate(Range &range) const override
Subclasses implement this function to complete TranslationGen.
void translate(Range &range) const override
Subclasses implement this function to complete TranslationGen.
std::vector< AMDGPUVMContext > vmContexts
std::unordered_map< uint64_t, uint64_t > gartTable
Copy of GART table.
bool inAGP(Addr vaddr)
Methods for resolving apertures.
std::vector< VegaISA::GpuTLB * > gpu_tlbs
List of TLBs associated with the GPU device.
void readMMIO(PacketPtr pkt, Addr offset)
void writeMMIO(PacketPtr pkt, Addr offset)
AMDGPUSysVMContext vmContext0
Addr gartBase()
Return base address of GART table in framebuffer.
void unserialize(CheckpointIn &cp) override
Unserialize an object.
Addr gartSize()
Return size of GART in number of PTEs.
void serialize(CheckpointOut &cp) const override
Serialize an object.
void registerTLB(VegaISA::GpuTLB *tlb)
Control methods for TLBs associated with the GPU device.
A Packet is used to encapsulate a transfer between two objects in the memory system (e....
void setLE(T v)
Set the value in the data pointer to v as little endian.
T getLE() const
Get the data in the packet byte swapped from little endian to host endian.
static constexpr T roundUp(const T &val, const U &align)
This function is used to align addresses in memory.
constexpr T bits(T val, unsigned first, unsigned last)
Extract the bitfield from position 'first' to 'last' (inclusive) from 'val' and right justify it.
constexpr T insertBits(T val, unsigned first, unsigned last, B bit_val)
Returns val with bits first to last set to the LSBs of bit_val.
#define fatal(...)
This implements a cprintf based fatal() function.
#define UNSERIALIZE_ARRAY(member, size)
#define SERIALIZE_ARRAY(member, size)
Reference material can be found at the JEDEC website: UFS standard http://www.jedec....
std::shared_ptr< FaultBase > Fault
std::ostream CheckpointOut
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
static constexpr int AMDGPU_VM_COUNT
constexpr decltype(nullptr) NoFault
#define UNSERIALIZE_SCALAR(scalar)
#define SERIALIZE_SCALAR(scalar)
This structure represents a single, contiguous translation, or carries information about whatever fau...