gem5
v21.1.0.2
|
Helper class to read Linux kernel MMIO trace from amdgpu modprobes. More...
#include <mmio_reader.hh>
Classes | |
struct | MmioTrace |
Public Member Functions | |
AMDMMIOReader () | |
~AMDMMIOReader () | |
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 MMIO trace entry map. More... | |
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 provided. More... | |
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 in the packet provided. More... | |
Private Types | |
typedef 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 address is mapped to. More... | |
typedef std::unordered_map< uint32_t, std::list< trace_entry_t > > | trace_BAR_t |
Private Member Functions | |
bool | traceIsRead (std::vector< std::string > tokens) const |
bool | traceIsWrite (std::vector< std::string > tokens) const |
bool | traceIsUnknown (std::vector< std::string > tokens) const |
bool | isIO (std::vector< std::string > tokens) const |
bool | isRelevant (std::vector< std::string > tokens) |
uint8_t | traceGetBAR (uint64_t addr) |
uint64_t | traceGetOffset (uint64_t addr) |
void | traceParseTokens (std::vector< std::string > tokens) |
void | recordMtrace () |
Private Attributes | |
const uint64_t | BAR0 = 0x2400000000 |
These are the BAR values from the system where the trace is collected. More... | |
const uint64_t | BAR2 = 0x2200000000 |
const uint32_t | BAR5 = 0xecf00000 |
const uint32_t | ROM = 0xc0000 |
const uint64_t | BAR0_SIZE = 0x400000000 |
const uint64_t | BAR2_SIZE = 0x200000 |
const uint32_t | BAR5_SIZE = 0x80000 |
const uint32_t | ROM_SIZE = 0x20000 |
trace_BAR_t | trace_BARs [6] |
uint64_t | trace_index |
uint64_t | trace_final_index |
uint64_t | trace_cur_index |
struct gem5::AMDMMIOReader::MmioTrace | mtrace |
Helper class to read Linux kernel MMIO trace from amdgpu modprobes.
This class is used rather than implementing MMIOs in code as it is easier to update to never kernel versions this way. It also helps with setting values for registers which are not documented.
The class is designed to be able to read both raw MMIO input traces as well as traces that have been filtered by the util script to reduce the file size.
An MMIO trace is provided with the gem5 release. To see instructions on how to generate the file yourself, see the documentation on the MMIO trace generation script provided in util.
Definition at line 64 of file mmio_reader.hh.
|
private |
Definition at line 96 of file mmio_reader.hh.
|
private |
The information we want from each relevant line of trace are: (1) The BAR number where the accessed address is mapped to.
(2) The offset from the BAR. (3) Type of the access, if it's Read/Write/Unknown (4) Data from the access if available (not for Unknown). (5) An index representing the order of trace.
Definition at line 93 of file mmio_reader.hh.
|
inline |
Definition at line 219 of file mmio_reader.hh.
|
inline |
Definition at line 220 of file mmio_reader.hh.
|
inlineprivate |
Definition at line 138 of file mmio_reader.hh.
|
inlineprivate |
Definition at line 145 of file mmio_reader.hh.
References gem5::X86ISA::addr, and traceGetBAR().
Referenced by readMMIOTrace().
Get the next MMIO read from the trace file to an offset in a BAR and write the value to the packet provided.
pkt | Packet to write the MMIO trace value |
barnum | The BAR of the MMIO read |
offset | The offset in the BAR of the MMIO read. |
Definition at line 78 of file mmio_reader.cc.
References gem5::X86ISA::count, DPRINTF, gem5::ArmISA::offset, gem5::Packet::setUintX(), trace_BARs, trace_cur_index, and trace_final_index.
Referenced by gem5::AMDGPUDevice::readDoorbell(), gem5::AMDGPUDevice::readFrame(), and gem5::AMDGPUDevice::readMMIO().
void gem5::AMDMMIOReader::readMMIOTrace | ( | std::string | trace_file | ) |
Read an MMIO trace gathered from a real system and place the MMIO values read and written into the MMIO trace entry map.
trace_file | Absolute path of MMIO trace file to read. |
Definition at line 46 of file mmio_reader.cc.
References gem5::AMDMMIOReader::MmioTrace::addr, gem5::AMDMMIOReader::MmioTrace::bar, gem5::AMDMMIOReader::MmioTrace::data, gem5::AMDMMIOReader::MmioTrace::event, isRelevant(), gem5::MipsISA::l, mtrace, recordMtrace(), gem5::AMDMMIOReader::MmioTrace::size, gem5::scmi::token, trace_cur_index, trace_final_index, trace_index, traceIsRead(), and traceParseTokens().
Referenced by gem5::AMDGPUDevice::AMDGPUDevice().
|
inlineprivate |
Definition at line 206 of file mmio_reader.hh.
References gem5::AMDMMIOReader::MmioTrace::addr, gem5::AMDMMIOReader::MmioTrace::bar, gem5::AMDMMIOReader::MmioTrace::data, gem5::AMDMMIOReader::MmioTrace::event, gem5::AMDMMIOReader::MmioTrace::index, mtrace, gem5::ArmISA::offset, trace_BARs, and traceGetOffset().
Referenced by readMMIOTrace().
|
inlineprivate |
Definition at line 153 of file mmio_reader.hh.
References gem5::X86ISA::addr, BAR0, BAR0_SIZE, BAR2, BAR2_SIZE, BAR5, BAR5_SIZE, ROM, and ROM_SIZE.
Referenced by isRelevant(), and traceParseTokens().
|
inlineprivate |
Definition at line 169 of file mmio_reader.hh.
References gem5::X86ISA::addr, BAR0, BAR0_SIZE, BAR2, BAR2_SIZE, BAR5, BAR5_SIZE, panic, ROM, and ROM_SIZE.
Referenced by recordMtrace().
|
inlineprivate |
Definition at line 119 of file mmio_reader.hh.
Referenced by readMMIOTrace(), and traceParseTokens().
|
inlineprivate |
Definition at line 131 of file mmio_reader.hh.
Referenced by traceParseTokens().
|
inlineprivate |
Definition at line 125 of file mmio_reader.hh.
Referenced by traceParseTokens().
|
inlineprivate |
Definition at line 185 of file mmio_reader.hh.
References gem5::AMDMMIOReader::MmioTrace::addr, gem5::AMDMMIOReader::MmioTrace::bar, gem5::AMDMMIOReader::MmioTrace::data, gem5::AMDMMIOReader::MmioTrace::event, gem5::AMDMMIOReader::MmioTrace::index, mtrace, gem5::AMDMMIOReader::MmioTrace::size, trace_index, traceGetBAR(), traceIsRead(), traceIsUnknown(), and traceIsWrite().
Referenced by readMMIOTrace().
Get the next MMIO write from the trace file to an offset in a BAR and compare the value with the data in the packet provided.
This is only used for debugging and is otherwise intercepted by MMIO interface.
pkt | Packet to write the MMIO trace value |
barnum | The BAR of the MMIO read |
offset | The offset in the BAR of the MMIO read. |
Definition at line 104 of file mmio_reader.cc.
References gem5::X86ISA::count, DPRINTF, gem5::ArmISA::offset, trace_BARs, trace_cur_index, and trace_final_index.
Referenced by gem5::AMDGPUDevice::writeDoorbell(), gem5::AMDGPUDevice::writeFrame(), and gem5::AMDGPUDevice::writeMMIO().
|
private |
These are the BAR values from the system where the trace is collected.
If you have collected your own trace, you may need to change these BARs for the MMIO trace to be read correctly!
Definition at line 72 of file mmio_reader.hh.
Referenced by traceGetBAR(), and traceGetOffset().
|
private |
Definition at line 78 of file mmio_reader.hh.
Referenced by traceGetBAR(), and traceGetOffset().
|
private |
Definition at line 73 of file mmio_reader.hh.
Referenced by traceGetBAR(), and traceGetOffset().
|
private |
Definition at line 79 of file mmio_reader.hh.
Referenced by traceGetBAR(), and traceGetOffset().
|
private |
Definition at line 74 of file mmio_reader.hh.
Referenced by traceGetBAR(), and traceGetOffset().
|
private |
Definition at line 80 of file mmio_reader.hh.
Referenced by traceGetBAR(), and traceGetOffset().
|
private |
Referenced by readMMIOTrace(), recordMtrace(), and traceParseTokens().
|
private |
Definition at line 75 of file mmio_reader.hh.
Referenced by traceGetBAR(), and traceGetOffset().
|
private |
Definition at line 81 of file mmio_reader.hh.
Referenced by traceGetBAR(), and traceGetOffset().
|
private |
Definition at line 99 of file mmio_reader.hh.
Referenced by readFromTrace(), recordMtrace(), and writeFromTrace().
|
private |
Definition at line 104 of file mmio_reader.hh.
Referenced by readFromTrace(), readMMIOTrace(), and writeFromTrace().
|
private |
Definition at line 103 of file mmio_reader.hh.
Referenced by readFromTrace(), readMMIOTrace(), and writeFromTrace().
|
private |
Definition at line 102 of file mmio_reader.hh.
Referenced by readMMIOTrace(), and traceParseTokens().