gem5 v24.0.0.0
|
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. | |
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. | |
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. | |
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. | |
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. | |
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 = 0 |
uint64_t | trace_final_index = 0 |
uint64_t | trace_cur_index = 0 |
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 62 of file mmio_reader.hh.
|
private |
Definition at line 94 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 91 of file mmio_reader.hh.
|
inline |
Definition at line 217 of file mmio_reader.hh.
|
inline |
Definition at line 218 of file mmio_reader.hh.
|
inlineprivate |
Definition at line 136 of file mmio_reader.hh.
|
inlineprivate |
Definition at line 143 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 76 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(), 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 44 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 204 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 151 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 167 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 117 of file mmio_reader.hh.
Referenced by readMMIOTrace(), and traceParseTokens().
|
inlineprivate |
Definition at line 129 of file mmio_reader.hh.
Referenced by traceParseTokens().
|
inlineprivate |
Definition at line 123 of file mmio_reader.hh.
Referenced by traceParseTokens().
|
inlineprivate |
Definition at line 183 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 102 of file mmio_reader.cc.
References gem5::X86ISA::count, DPRINTF, gem5::ArmISA::offset, trace_BARs, trace_cur_index, and trace_final_index.
|
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 70 of file mmio_reader.hh.
Referenced by traceGetBAR(), and traceGetOffset().
|
private |
Definition at line 76 of file mmio_reader.hh.
Referenced by traceGetBAR(), and traceGetOffset().
|
private |
Definition at line 71 of file mmio_reader.hh.
Referenced by traceGetBAR(), and traceGetOffset().
|
private |
Definition at line 77 of file mmio_reader.hh.
Referenced by traceGetBAR(), and traceGetOffset().
|
private |
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 |
Referenced by readMMIOTrace(), recordMtrace(), and traceParseTokens().
|
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 97 of file mmio_reader.hh.
Referenced by readFromTrace(), recordMtrace(), and writeFromTrace().
|
private |
Definition at line 102 of file mmio_reader.hh.
Referenced by readFromTrace(), readMMIOTrace(), and writeFromTrace().
|
private |
Definition at line 101 of file mmio_reader.hh.
Referenced by readFromTrace(), readMMIOTrace(), and writeFromTrace().
|
private |
Definition at line 100 of file mmio_reader.hh.
Referenced by readMMIOTrace(), and traceParseTokens().