arm: Change TLB Software Caching

In ARM, certain variables are only updated when a necessary change is
detected.  Having 2 SMT threads share a TLB resulted in these not being
updated as required.  This patch adds a thread context identifer to
assist in the invalidation of these variables.
This commit is contained in:
Mitch Hayenga 2015-09-30 11:14:19 -05:00
parent 9e07a7504c
commit ccf4f6c3d7
2 changed files with 5 additions and 2 deletions

View file

@ -78,7 +78,7 @@ TLB::TLB(const ArmTLBParams *p)
stage2Mmu(NULL), rangeMRU(1),
aarch64(false), aarch64EL(EL0), isPriv(false), isSecure(false),
isHyp(false), asid(0), vmid(0), dacr(0),
miscRegValid(false), curTranType(NormalTran)
miscRegValid(false), miscRegContext(0), curTranType(NormalTran)
{
tableWalker->setTlb(this);
@ -1204,7 +1204,8 @@ TLB::updateMiscReg(ThreadContext *tc, ArmTranslationType tranType)
// check if the regs have changed, or the translation mode is different.
// NOTE: the tran type doesn't affect stage 2 TLB's as they only handle
// one type of translation anyway
if (miscRegValid && ((tranType == curTranType) || isStage2)) {
if (miscRegValid && miscRegContext == tc->contextId() &&
((tranType == curTranType) || isStage2)) {
return;
}
@ -1300,6 +1301,7 @@ TLB::updateMiscReg(ThreadContext *tc, ArmTranslationType tranType)
}
}
miscRegValid = true;
miscRegContext = tc->contextId();
curTranType = tranType;
}

View file

@ -327,6 +327,7 @@ protected:
HCR hcr;
uint32_t dacr;
bool miscRegValid;
ContextID miscRegContext;
ArmTranslationType curTranType;
// Cached copies of system-level properties