mem-ruby: Add TLBI callbacks to the RubyPort

JIRA: https://gem5.atlassian.net/browse/GEM5-1097

Change-Id: I984fd497b7209772106150abb853c91c3d818dfd
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/57295
Reviewed-by: Jason Lowe-Power <power.jg@gmail.com>
Maintainer: Jason Lowe-Power <power.jg@gmail.com>
Tested-by: kokoro <noreply+kokoro@google.com>
This commit is contained in:
Samuel Stark
2021-11-02 08:50:39 +00:00
committed by Giacomo Travaglini
parent 6dac25a7f4
commit 32ed7794d8
2 changed files with 52 additions and 2 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2012-2013,2020 ARM Limited
* Copyright (c) 2012-2013,2020-2021 ARM Limited
* All rights reserved.
*
* The license below extends only to copyright in the software and shall
@@ -473,6 +473,54 @@ RubyPort::ruby_hit_callback(PacketPtr pkt)
trySendRetries();
}
void
RubyPort::ruby_unaddressed_callback(PacketPtr pkt)
{
DPRINTF(RubyPort, "Unaddressed callback for %s\n", pkt->cmdString());
assert(pkt->isRequest());
// First we must retrieve the request port from the sender State
RubyPort::SenderState *senderState =
safe_cast<RubyPort::SenderState *>(pkt->popSenderState());
MemResponsePort *port = senderState->port;
assert(port != NULL);
delete senderState;
port->hitCallback(pkt);
trySendRetries();
}
void
RubyPort::ruby_stale_translation_callback(Addr txnId)
{
DPRINTF(RubyPort, "Stale Translation Callback\n");
// Allocate the invalidate request and packet on the stack, as it is
// assumed they will not be modified or deleted by receivers.
// TODO: should this really be using funcRequestorId?
auto request = std::make_shared<Request>(
0, RubySystem::getBlockSizeBytes(), Request::TLBI_EXT_SYNC,
Request::funcRequestorId);
// Store the txnId in extraData instead of the address
request->setExtraData(txnId);
// Use a single packet to signal all snooping ports of the external sync.
// This assumes that snooping ports do NOT modify the packet/request
// TODO rename TlbiExtSync to StaleTranslation
Packet pkt(request, MemCmd::TlbiExtSync);
// TODO - see where response_ports is filled, might be we only want to send
// to specific places
for (auto &port : response_ports) {
// check if the connected request port is snooping
if (port->isSnooping()) {
// send as a snoop request
port->sendTimingSnoopReq(&pkt);
}
}
}
void
RubyPort::trySendRetries()
{

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2012-2013,2019 ARM Limited
* Copyright (c) 2012-2013,2019,2021 ARM Limited
* All rights reserved.
*
* The license below extends only to copyright in the software and shall
@@ -179,6 +179,8 @@ class RubyPort : public ClockedObject
protected:
void trySendRetries();
void ruby_hit_callback(PacketPtr pkt);
void ruby_unaddressed_callback(PacketPtr pkt);
void ruby_stale_translation_callback(Addr txnId);
void testDrainComplete();
void ruby_eviction_callback(Addr address);