cpu-o3: Fix unset scoreboard in vector mode switching

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>
This commit is contained in:
Hsuan Hsu
2020-03-03 17:28:44 +08:00
committed by Hsuan Hsu
parent d36f2fda12
commit 32b0eb0771
2 changed files with 29 additions and 0 deletions

View File

@@ -844,6 +844,28 @@ FullO3CPU<Impl>::removeThread(ThreadID tid)
*/
}
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)
@@ -860,6 +882,7 @@ FullO3CPU<Impl>::switchRenameMode(ThreadID tid, UnifiedFreeList* freelist)
renameMap[tid].switchMode(vecMode);
commitRenameMap[tid].switchMode(vecMode);
renameMap[tid].switchFreeList(freelist);
setVectorsAsReady(tid);
}
}