changeset bbd8448f104e in /z/repo/gem5
details: http://repo.gem5.org/gem5?cmd=changeset;node=bbd8448f104e
description:
        arm: Add TLBI instruction for stage 2 IPA's

        This patch adds support for stage 2 TLBI instructions
        such as TLBI IPAS2E1_Xt.

        Change-Id: I0cd5e8055b0c1003e03439aa5183252f50ea0a88

diffstat:

 src/arch/arm/isa.cc |  23 +++++++++++++++++++++--
 src/arch/arm/tlb.cc |   7 +++++++
 src/arch/arm/tlb.hh |  13 +++++++++++++
 3 files changed, 41 insertions(+), 2 deletions(-)

diffs (73 lines):

diff -r 13c5ba4250b3 -r bbd8448f104e src/arch/arm/isa.cc
--- a/src/arch/arm/isa.cc       Tue Aug 02 10:38:03 2016 +0100
+++ b/src/arch/arm/isa.cc       Tue Aug 02 10:38:03 2016 +0100
@@ -1393,8 +1393,27 @@
           case MISCREG_TLBI_IPAS2E1IS_Xt:
           case MISCREG_TLBI_IPAS2E1_Xt:
             assert64(tc);
-            // @todo: implement these as part of Virtualization
-            warn("Not doing anything for write of miscreg ITLB_IPAS2\n");
+            target_el = 1; // EL 0 and 1 are handled together
+            scr = readMiscReg(MISCREG_SCR, tc);
+            secure_lookup = haveSecurity && !scr.ns;
+            sys = tc->getSystemPtr();
+            for (x = 0; x < sys->numContexts(); x++) {
+                oc = sys->getThreadContext(x);
+                assert(oc->getITBPtr() && oc->getDTBPtr());
+                Addr ipa = ((Addr) bits(newVal, 35, 0)) << 12;
+                oc->getITBPtr()->flushIpaVmid(ipa,
+                    secure_lookup, false, target_el);
+                oc->getDTBPtr()->flushIpaVmid(ipa,
+                    secure_lookup, false, target_el);
+
+                CheckerCPU *checker = oc->getCheckerCpuPtr();
+                if (checker) {
+                    checker->getITBPtr()->flushIpaVmid(ipa,
+                        secure_lookup, false, target_el);
+                    checker->getDTBPtr()->flushIpaVmid(ipa,
+                        secure_lookup, false, target_el);
+                }
+            }
             return;
           case MISCREG_ACTLR:
             warn("Not doing anything for write of miscreg ACTLR\n");
diff -r 13c5ba4250b3 -r bbd8448f104e src/arch/arm/tlb.cc
--- a/src/arch/arm/tlb.cc       Tue Aug 02 10:38:03 2016 +0100
+++ b/src/arch/arm/tlb.cc       Tue Aug 02 10:38:03 2016 +0100
@@ -337,6 +337,13 @@
     }
 }
 
+void
+TLB::flushIpaVmid(Addr ipa, bool secure_lookup, bool hyp, uint8_t target_el)
+{
+    assert(!isStage2);
+    stage2Tlb->_flushMva(ipa, 0xbeef, secure_lookup, hyp, true, target_el);
+}
+
 bool
 TLB::checkELMatch(uint8_t target_el, uint8_t tentry_el, bool ignore_el)
 {
diff -r 13c5ba4250b3 -r bbd8448f104e src/arch/arm/tlb.hh
--- a/src/arch/arm/tlb.hh       Tue Aug 02 10:38:03 2016 +0100
+++ b/src/arch/arm/tlb.hh       Tue Aug 02 10:38:03 2016 +0100
@@ -275,6 +275,19 @@
      */
     void flushMva(Addr mva, bool secure_lookup, bool hyp, uint8_t target_el);
 
+    /**
+     * Invalidate all entries in the stage 2 TLB that match the given ipa
+     * and the current VMID
+     * @param ipa the address to invalidate
+     * @param secure_lookup if the operation affects the secure world
+     * @param hyp if the operation affects hyp mode
+     */
+    void flushIpaVmid(Addr ipa, bool secure_lookup, bool hyp, uint8_t 
target_el);
+
+    Fault trickBoxCheck(RequestPtr req, Mode mode, TlbEntry::DomainType 
domain);
+    Fault walkTrickBoxCheck(Addr pa, bool is_secure, Addr va, Addr sz, bool 
is_exec,
+            bool is_write, TlbEntry::DomainType domain, LookupLevel 
lookup_level);
+
     void printTlb() const;
 
     void demapPage(Addr vaddr, uint64_t asn) override
_______________________________________________
gem5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/gem5-dev

Reply via email to