diff options
author | Radhika Jagtap <radhika.jagtap@ARM.com> | 2015-12-07 16:42:16 -0600 |
---|---|---|
committer | Radhika Jagtap <radhika.jagtap@ARM.com> | 2015-12-07 16:42:16 -0600 |
commit | 54519fd51f739c3a37c4ad712b86a353eabbbfec (patch) | |
tree | 21002ebffe820d302b839ac625636830b141964b /src/cpu/o3 | |
parent | 3080bbcc365e6ed663787a4c06cd2b7c4a118d47 (diff) | |
download | gem5-54519fd51f739c3a37c4ad712b86a353eabbbfec.tar.xz |
cpu: Support virtual addr in elastic traces
This patch adds support to optionally capture the virtual address and asid
for load/store instructions in the elastic traces. If they are present in
the traces, Trace CPU will set those fields of the request during replay.
Diffstat (limited to 'src/cpu/o3')
-rw-r--r-- | src/cpu/o3/probe/ElasticTrace.py | 4 | ||||
-rw-r--r-- | src/cpu/o3/probe/elastic_trace.cc | 21 | ||||
-rw-r--r-- | src/cpu/o3/probe/elastic_trace.hh | 11 |
3 files changed, 27 insertions, 9 deletions
diff --git a/src/cpu/o3/probe/ElasticTrace.py b/src/cpu/o3/probe/ElasticTrace.py index fb3093a2c..20057ab97 100644 --- a/src/cpu/o3/probe/ElasticTrace.py +++ b/src/cpu/o3/probe/ElasticTrace.py @@ -59,4 +59,6 @@ class ElasticTrace(ProbeListenerObject): "after which to start tracing. Default " \ "zero means start tracing from first " \ "committed instruction.") - + # Whether to trace virtual addresses for memory accesses + traceVirtAddr = Param.Bool(False, "Set to true if virtual addresses are " \ + "to be traced.") diff --git a/src/cpu/o3/probe/elastic_trace.cc b/src/cpu/o3/probe/elastic_trace.cc index e1a41b696..3332816ca 100644 --- a/src/cpu/o3/probe/elastic_trace.cc +++ b/src/cpu/o3/probe/elastic_trace.cc @@ -57,7 +57,8 @@ ElasticTrace::ElasticTrace(const ElasticTraceParams* params) dataTraceStream(nullptr), instTraceStream(nullptr), startTraceInst(params->startTraceInst), - allProbesReg(false) + allProbesReg(false), + traceVirtAddr(params->traceVirtAddr) { cpu = dynamic_cast<FullO3CPU<O3CPUImpl>*>(params->manager); fatal_if(!cpu, "Manager of %s is not of type O3CPU and thus does not "\ @@ -391,7 +392,9 @@ ElasticTrace::addDepTraceRecord(const DynInstPtr &head_inst, // Assign fields for creating a request in case of a load/store new_record->reqFlags = head_inst->memReqFlags; - new_record->addr = head_inst->physEffAddrLow; + new_record->virtAddr = head_inst->effAddr; + new_record->asid = head_inst->asid; + new_record->physAddr = head_inst->physEffAddrLow; // Currently the tracing does not support split requests. new_record->size = head_inst->effSize; new_record->pc = head_inst->instAddr(); @@ -787,9 +790,9 @@ ElasticTrace::writeDepTrace(uint32_t num_to_write) "is as follows:\n", temp_ptr->instNum); if (temp_ptr->isLoad() || temp_ptr->isStore()) { DPRINTFR(ElasticTrace, "\tis a %s\n", temp_ptr->typeToStr()); - DPRINTFR(ElasticTrace, "\thas a request with addr %i, size %i," - " flags %i\n", temp_ptr->addr, temp_ptr->size, - temp_ptr->reqFlags); + DPRINTFR(ElasticTrace, "\thas a request with phys addr %i, " + "size %i, flags %i\n", temp_ptr->physAddr, + temp_ptr->size, temp_ptr->reqFlags); } else { DPRINTFR(ElasticTrace, "\tis a %s\n", temp_ptr->typeToStr()); } @@ -813,7 +816,13 @@ ElasticTrace::writeDepTrace(uint32_t num_to_write) dep_pkt.set_pc(temp_ptr->pc); if (temp_ptr->isLoad() || temp_ptr->isStore()) { dep_pkt.set_flags(temp_ptr->reqFlags); - dep_pkt.set_addr(temp_ptr->addr); + dep_pkt.set_p_addr(temp_ptr->physAddr); + // If tracing of virtual addresses is enabled, set the optional + // field for it + if (traceVirtAddr) { + dep_pkt.set_v_addr(temp_ptr->virtAddr); + dep_pkt.set_asid(temp_ptr->asid); + } dep_pkt.set_size(temp_ptr->size); } dep_pkt.set_comp_delay(temp_ptr->compDelay); diff --git a/src/cpu/o3/probe/elastic_trace.hh b/src/cpu/o3/probe/elastic_trace.hh index 001dc0e13..584cdf182 100644 --- a/src/cpu/o3/probe/elastic_trace.hh +++ b/src/cpu/o3/probe/elastic_trace.hh @@ -289,8 +289,12 @@ class ElasticTrace : public ProbeListenerObject Addr pc; /* Request flags in case of a load/store instruction */ Request::FlagsType reqFlags; - /* Request address in case of a load/store instruction */ - Addr addr; + /* Request physical address in case of a load/store instruction */ + Addr physAddr; + /* Request virtual address in case of a load/store instruction */ + Addr virtAddr; + /* Address space id in case of a load/store instruction */ + uint32_t asid; /* Request size in case of a load/store instruction */ unsigned size; /** Default Constructor */ @@ -366,6 +370,9 @@ class ElasticTrace : public ProbeListenerObject */ bool allProbesReg; + /** Whether to trace virtual addresses for memory requests. */ + const bool traceVirtAddr; + /** Pointer to the O3CPU that is this listener's parent a.k.a. manager */ FullO3CPU<O3CPUImpl>* cpu; |