From 40715206f4a67509ede17eb3db2343c28a0a24fc Mon Sep 17 00:00:00 2001 From: Gabriel Busnot Date: Mon, 7 Jun 2021 14:47:21 +0200 Subject: [PATCH] mem-ruby: Fix RubySystem::functionalRead with partial data Some protocol other than CHI require the read-write and/or read-only and/or backing-store controller's buffers to be checked if the system is busy. More details in issue GEM5-1000 Change-Id: I0ad6385ad5a88fc158e68e4c63c540504b817ccb Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/46561 Reviewed-by: Jason Lowe-Power Maintainer: Jason Lowe-Power Tested-by: kokoro --- src/mem/ruby/system/RubySystem.cc | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/mem/ruby/system/RubySystem.cc b/src/mem/ruby/system/RubySystem.cc index 239b652eec..caee770961 100644 --- a/src/mem/ruby/system/RubySystem.cc +++ b/src/mem/ruby/system/RubySystem.cc @@ -651,13 +651,21 @@ RubySystem::functionalRead(PacketPtr pkt) for (auto ctrl : ctrl_ro) ctrl->functionalRead(line_address, pkt, bytes); - ctrl_bs->functionalRead(line_address, pkt, bytes); + if (ctrl_bs) + ctrl_bs->functionalRead(line_address, pkt, bytes); // if there is any busy controller or bytes still not set, then a partial // and/or dirty copy of the line might be in a message buffer or the // network if (!ctrl_busy.empty() || !bytes.isFull()) { - DPRINTF(RubySystem, "Reading from busy controllers and network\n"); + DPRINTF(RubySystem, "Reading from remaining controllers, " + "buffers and networks\n"); + if (ctrl_rw != nullptr) + ctrl_rw->functionalReadBuffers(pkt, bytes); + for (auto ctrl : ctrl_ro) + ctrl->functionalReadBuffers(pkt, bytes); + if (ctrl_bs != nullptr) + ctrl_bs->functionalReadBuffers(pkt, bytes); for (auto ctrl : ctrl_busy) { ctrl->functionalRead(line_address, pkt, bytes); ctrl->functionalReadBuffers(pkt, bytes);