38#include "debug/AMDGPUDevice.hh"
101 uint32_t value = pkt->
getLE<uint32_t>();
107 pkt->
setLE<uint32_t>(1);
113 pkt->
setLE<uint32_t>(1);
126 pkt->
setLE<uint32_t>(1);
160 uint32_t
val = pkt->
getLE<uint32_t>();
164 uint32_t
val = pkt->
getLE<uint32_t>();
168 uint32_t
val = pkt->
getLE<uint32_t>();
172 uint32_t
val = pkt->
getLE<uint32_t>();
176 uint32_t
val = pkt->
getLE<uint32_t>();
180 uint32_t
val = pkt->
getLE<uint32_t>();
184 uint32_t
val = pkt->
getLE<uint32_t>();
188 uint32_t
val = pkt->
getLE<uint32_t>();
208 tlb->invalidateAll();
219 uint64_t gartTableSize;
249 uint64_t* gartTableKey =
new uint64_t[gartTableSize];
250 uint64_t* gartTableValue =
new uint64_t[gartTableSize];
254 gartTableKey[
i] = it->first;
255 gartTableValue[
i] = it->second;
260 delete[] gartTableKey;
261 delete[] gartTableValue;
271 uint64_t gartTableSize, *gartTableKey, *gartTableValue;
303 gartTableKey =
new uint64_t[gartTableSize];
304 gartTableValue =
new uint64_t[gartTableSize];
307 for (uint64_t
i = 0;
i < gartTableSize;
i++) {
310 delete[] gartTableKey;
311 delete[] gartTableValue;
320 if (next == range.
vaddr)
334 if (next == range.
vaddr)
343 gart_addr += lsb * 7;
347 auto result =
vm->gartTable.find(gart_addr);
348 if (result ==
vm->gartTable.end()) {
351 warn(
"GART translation for %p not found", range.
vaddr);
357 Addr pte = result->second;
359 range.
paddr = (
bits(pte, 47, 12) << 12) | lower_bits;
369 assert(
vm->inMMHUB(range.
vaddr));
372 if (next == range.
vaddr)
387 Addr start =
vm->getPageTableStart(vmid);
389 base, start, walker);
394 Fault fault = walker->startFunctional(
base, paddr, logBytes,
397 fatal(
"User translation fault");
401 const Addr page_size = 1 << logBytes;
403 if (next == range.
vaddr) {
411 paddr +=
vm->getMMHUBBase();
412 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.
void setMMIOAperture(mmio_range_t mmio_aperture, AddrRange range)
std::vector< AMDGPUVMContext > vmContexts
std::array< AddrRange, NUM_MMIO_RANGES > mmioRanges
AddrRange getMMIORange(mmio_range_t mmio_aperture)
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)
const AddrRange & getMMIOAperture(Addr addr)
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.
The AddrRange class encapsulates an address range, and supports a number of tests to check if two ran...
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)
Copyright (c) 2024 - Pranith Kumar Copyright (c) 2020 Inria All rights reserved.
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...