From: Yu-hsin Wang Date: Mon, 17 Aug 2020 02:54:17 +0000 (+0800) Subject: systemc: Send response to TLM side if a packet does not need response X-Git-Tag: v20.1.0.0~219 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=a7530f798be0eb4a16a1768cb13efbd83e50781f;p=gem5.git systemc: Send response to TLM side if a packet does not need response A completed TLM transaction includes request and response parts. Currently, if a gem5 packet does not need a reponse, the bridge would not send BEGIN_RESP to its upstream. It causes stuck on TLM side. To fix this problem, the bridge should send BEGIN_RESP by itself in this case. Change-Id: I318dec21bc3f291693715c0d70bc624addf05076 Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/32735 Reviewed-by: Gabe Black Tested-by: kokoro Maintainer: Gabe Black --- diff --git a/src/systemc/tlm_bridge/tlm_to_gem5.cc b/src/systemc/tlm_bridge/tlm_to_gem5.cc index e6cb48332..2bfbcc495 100644 --- a/src/systemc/tlm_bridge/tlm_to_gem5.cc +++ b/src/systemc/tlm_bridge/tlm_to_gem5.cc @@ -162,8 +162,15 @@ TlmToGem5Bridge::handleBeginReq(tlm::tlm_generic_payload &trans) auto tlmSenderState = new TlmSenderState(trans); pkt->pushSenderState(tlmSenderState); + // If the packet doesn't need a response, we should send BEGIN_RESP by + // ourselves. + bool needsResponse = pkt->needsResponse(); if (bmp.sendTimingReq(pkt)) { // port is free -> send END_REQ immediately sendEndReq(trans); + if (!needsResponse) { + auto delay = sc_core::SC_ZERO_TIME; + sendBeginResp(trans, delay); + } trans.release(); } else { // port is blocked -> wait for retry before sending END_REQ waitForRetry = true; @@ -429,12 +436,19 @@ TlmToGem5Bridge::recvReqRetry() sc_assert(pendingRequest != nullptr); sc_assert(pendingPacket != nullptr); + // If the packet doesn't need a response, we should send BEGIN_RESP by + // ourselves. + bool needsResponse = pendingPacket->needsResponse(); if (bmp.sendTimingReq(pendingPacket)) { waitForRetry = false; pendingPacket = nullptr; auto &trans = *pendingRequest; sendEndReq(trans); + if (!needsResponse) { + auto delay = sc_core::SC_ZERO_TIME; + sendBeginResp(trans, delay); + } trans.release(); pendingRequest = nullptr;