32#ifndef __DEV_AMDGPU_MMIO_READER_HH__
33#define __DEV_AMDGPU_MMIO_READER_HH__
39#include <unordered_map>
70 const uint64_t
BAR0 = 0x2400000000;
71 const uint64_t
BAR2 = 0x2200000000;
72 const uint32_t
BAR5 = 0xecf00000;
73 const uint32_t
ROM = 0xc0000;
94 typedef std::unordered_map<uint32_t, std::list<trace_entry_t>>
trace_BAR_t;
119 return tokens[0] ==
"R";
125 return tokens[0] ==
"W";
131 return tokens[0] ==
"UNKNOWN";
136 isIO(std::vector <std::string> tokens)
const
138 return tokens[0] ==
"R" || tokens[0] ==
"W" || tokens[0] ==
"UNKNOWN";
145 uint64_t
addr = strtoull(tokens[4].c_str(),
nullptr, 16);
147 return (bar == 0 || bar == 2 || bar == 5);
178 panic(
"Can't find offset for the address in MMIO trace!");
187 mtrace.
size = strtoul(tokens[1].c_str(),
nullptr, 10);
188 mtrace.
addr = strtoull(tokens[4].c_str(),
nullptr, 16);
189 mtrace.
data = strtoull(tokens[5].c_str(),
nullptr, 16);
194 mtrace.
addr = strtoull(tokens[3].c_str(),
nullptr, 16);
Helper class to read Linux kernel MMIO trace from amdgpu modprobes.
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...
void writeFromTrace(PacketPtr pkt, int barnum, Addr offset)
Get the next MMIO write from the trace file to an offset in a BAR and compare the value with the data...
std::tuple< uint64_t, std::tuple< char, uint64_t > > trace_entry_t
The information we want from each relevant line of trace are: (1) The BAR number where the accessed a...
const uint64_t BAR0
These are the BAR values from the system where the trace is collected.
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...
bool isIO(std::vector< std::string > tokens) const
trace_BAR_t trace_BARs[6]
bool traceIsUnknown(std::vector< std::string > tokens) const
bool traceIsWrite(std::vector< std::string > tokens) const
bool isRelevant(std::vector< std::string > tokens)
uint8_t traceGetBAR(uint64_t addr)
bool traceIsRead(std::vector< std::string > tokens) const
void traceParseTokens(std::vector< std::string > tokens)
uint64_t trace_final_index
struct gem5::AMDMMIOReader::MmioTrace mtrace
std::unordered_map< uint32_t, std::list< trace_entry_t > > trace_BAR_t
uint64_t traceGetOffset(uint64_t addr)
A Packet is used to encapsulate a transfer between two objects in the memory system (e....
#define panic(...)
This implements a cprintf based panic() function.
Copyright (c) 2024 - Pranith Kumar Copyright (c) 2020 Inria All rights reserved.
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
Declaration of the Packet class.