This is another fix for the AArch32-AArch64 interprocessing issue
introduced in
3d15150d cpu, arch, arch-arm: Wire unused VecElem code in the O3 model.
Register mapping between AArch32 and AArch64 is explicitly defined in
ARMv8 manual. This allows software to read registers right after a state
switch without writing them first, and it is indeed common for software
to save registers to memory first before using them.
In gem5's implementation of vector mode switching, however, vectors may
not be marked as ready right after a state switch. Software reads toward
vectors at this time will stall O3CPU forever. This patch fixes this by
marking all mapped vectors (or vector elements, depending on AArch32 or
AArch64) as ready right after switching vector mode.
Change-Id: I609552c543dad8da66939c0a3079d73d48e92163
Signed-off-by: Hsuan Hsu <hsuan.hsu@mediatek.com>
Signed-off-by: Howard Wang <Howard.Wang@mediatek.com>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/26203
Reviewed-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
Maintainer: Giacomo Travaglini <giacomo.travaglini@arm.com>
Tested-by: kokoro <noreply+kokoro@google.com>
*/
}
+template <class Impl>
+void
+FullO3CPU<Impl>::setVectorsAsReady(ThreadID tid)
+{
+ if (vecMode == Enums::Elem) {
+ for (auto v = 0; v < TheISA::NumVecRegs; v++)
+ for (auto e = 0; e < TheISA::NumVecElemPerVecReg; e++)
+ scoreboard.setReg(
+ commitRenameMap[tid].lookup(
+ RegId(VecElemClass, v, e)
+ )
+ );
+ } else if (vecMode == Enums::Full) {
+ for (auto v = 0; v < TheISA::NumVecRegs; v++)
+ scoreboard.setReg(
+ commitRenameMap[tid].lookup(
+ RegId(VecRegClass, v)
+ )
+ );
+ }
+}
+
template <class Impl>
void
FullO3CPU<Impl>::switchRenameMode(ThreadID tid, UnifiedFreeList* freelist)
renameMap[tid].switchMode(vecMode);
commitRenameMap[tid].switchMode(vecMode);
renameMap[tid].switchFreeList(freelist);
+ setVectorsAsReady(tid);
}
}
/** Traps to handle given fault. */
void trap(const Fault &fault, ThreadID tid, const StaticInstPtr &inst);
+ /**
+ * Mark vector fields in scoreboard as ready right after switching
+ * vector mode, since software may read vectors at this time.
+ */
+ void setVectorsAsReady(ThreadID tid);
+
/** Check if a change in renaming is needed for vector registers.
* The vecMode variable is updated and propagated to rename maps.
*