Gabe Black has uploaded this change for review. ( https://gem5-review.googlesource.com/c/public/gem5/+/39875 )

Change subject: RFC: mem: Add a mechanism to push physical addresses in memory requests.
......................................................................

RFC: mem: Add a mechanism to push physical addresses in memory requests.

When a request needs to be translated after its enter the physical
memory domain, the only way to do that currently is to create a whole
new request with the new physical address and to send that onwards.

This change makes it possible to push new physical addresses which will
replace the existing one, with the old addresses accumulating in a stack
so they can be restored as the request returns towards the sender.

This mechanism could hypothetically be extended in the future to cover
even normal translation at the ISA level MMU, and make it easier to add
additional levels of translation for, for instance, virtualization.

It might even make sense to break the MMU out of the CPU itself and
simply put it in line on the way to memory, although that may not be
practical given the high level of bidirectional interaction between the
MMU and the CPU.

Change-Id: I839f6ecd2332432dad7c0e1537c03d0787dba61b
---
M src/mem/request.hh
1 file changed, 19 insertions(+), 0 deletions(-)



diff --git a/src/mem/request.hh b/src/mem/request.hh
index 38b64fd..305606e 100644
--- a/src/mem/request.hh
+++ b/src/mem/request.hh
@@ -54,6 +54,7 @@
 #include <functional>
 #include <limits>
 #include <memory>
+#include <stack>
 #include <vector>

 #include "base/amo.hh"
@@ -344,6 +345,8 @@
      */
     Addr _paddr = 0;

+    std::stack<Addr> _paddrs;
+
     /**
      * The size of the request. This field must be set when vaddr or
      * paddr is written via setVirt() or a phys basec constructor, so it is
@@ -536,6 +539,22 @@
         privateFlags.set(VALID_PADDR);
     }

+    void
+    pushPaddr(Addr paddr)
+    {
+        assert(hasPaddr());
+        _paddrs.emplace(_paddr);
+        _paddr = paddr;
+    }
+
+    void
+    popPaddr()
+    {
+        assert(!_paddrs.empty());
+        _paddr = _paddrs.top();
+        _paddrs.pop();
+    }
+
     /**
      * Generate two requests as if this request had been split into two
      * pieces. The original request can't have been translated already.

--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/39875
To unsubscribe, or for help writing mail filters, visit https://gem5-review.googlesource.com/settings

Gerrit-Project: public/gem5
Gerrit-Branch: develop
Gerrit-Change-Id: I839f6ecd2332432dad7c0e1537c03d0787dba61b
Gerrit-Change-Number: 39875
Gerrit-PatchSet: 1
Gerrit-Owner: Gabe Black <gabe.bl...@gmail.com>
Gerrit-MessageType: newchange
_______________________________________________
gem5-dev mailing list -- gem5-dev@gem5.org
To unsubscribe send an email to gem5-dev-le...@gem5.org
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s

Reply via email to