arch, arm: Preserve TLB bootUncacheability when switching CPUs
The ARM TLBs have a bootUncacheability flag used to make some loads and stores become uncacheable when booting in FS mode. Later the flag is cleared to let those loads and stores operate as normal. When doing a takeOverFrom(), this flag's state is not preserved and is momentarily reset until the CPSR is touched. On single core runs this is a non-issue. On multi-core runs this can lead to crashes on the O3 CPU model from the following series of events: 1) takeOverFrom executed to switch from Atomic -> O3 2) All bootUncacheability flags are reset to true 3) Core2 tries to execute a load covered by bootUncacheability, it is flagged as uncacheable 4) Core2's load needs to replay due to a pipeline flush 3) Core1 core does an action on CPSR 4) The handling code for CPSR then checks all other cores to determine if bootUncacheability can be set to false 5) Asynchronously set bootUncacheability on all cores to false 6) Core2 replays load previously set as uncacheable and notices it is now flagged as cacheable, leads to a panic. This patch implements takeOverFrom() functionality for the ARM TLBs to preserve flag values when switching from atomic -> detailed.
This commit is contained in:
parent
1028c03320
commit
85940fd537
9 changed files with 47 additions and 0 deletions
|
@ -87,6 +87,8 @@ class TLB : public BaseTLB
|
|||
TLB(const Params *p);
|
||||
virtual ~TLB();
|
||||
|
||||
void takeOverFrom(BaseTLB *otlb) {}
|
||||
|
||||
virtual void regStats();
|
||||
|
||||
int getsize() const { return size; }
|
||||
|
|
|
@ -353,6 +353,30 @@ TLB::drainResume()
|
|||
miscRegValid = false;
|
||||
}
|
||||
|
||||
void
|
||||
TLB::takeOverFrom(BaseTLB *_otlb)
|
||||
{
|
||||
TLB *otlb = dynamic_cast<TLB*>(_otlb);
|
||||
/* Make sure we actually have a valid type */
|
||||
if (otlb) {
|
||||
_attr = otlb->_attr;
|
||||
haveLPAE = otlb->haveLPAE;
|
||||
directToStage2 = otlb->directToStage2;
|
||||
stage2Req = otlb->stage2Req;
|
||||
bootUncacheability = otlb->bootUncacheability;
|
||||
|
||||
/* Sync the stage2 MMU if they exist in both
|
||||
* the old CPU and the new
|
||||
*/
|
||||
if (!isStage2 &&
|
||||
stage2Tlb && otlb->stage2Tlb) {
|
||||
stage2Tlb->takeOverFrom(otlb->stage2Tlb);
|
||||
}
|
||||
} else {
|
||||
panic("Incompatible TLB type!");
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
TLB::serialize(ostream &os)
|
||||
{
|
||||
|
|
|
@ -155,6 +155,8 @@ class TLB : public BaseTLB
|
|||
|
||||
virtual ~TLB();
|
||||
|
||||
void takeOverFrom(BaseTLB *otlb);
|
||||
|
||||
/// setup all the back pointers
|
||||
virtual void init();
|
||||
|
||||
|
|
|
@ -87,6 +87,9 @@ class TLB : public BaseTLB
|
|||
int probeEntry(Addr vpn,uint8_t) const;
|
||||
MipsISA::PTE *getEntry(unsigned) const;
|
||||
virtual ~TLB();
|
||||
|
||||
void takeOverFrom(BaseTLB *otlb) {}
|
||||
|
||||
int smallPages;
|
||||
int getsize() const { return size; }
|
||||
|
||||
|
|
|
@ -130,6 +130,8 @@ class TLB : public BaseTLB
|
|||
TLB(const Params *p);
|
||||
virtual ~TLB();
|
||||
|
||||
void takeOverFrom(BaseTLB *otlb) {}
|
||||
|
||||
int probeEntry(Addr vpn,uint8_t) const;
|
||||
PowerISA::PTE *getEntry(unsigned) const;
|
||||
|
||||
|
|
|
@ -154,6 +154,8 @@ class TLB : public BaseTLB
|
|||
typedef SparcTLBParams Params;
|
||||
TLB(const Params *p);
|
||||
|
||||
void takeOverFrom(BaseTLB *otlb) {}
|
||||
|
||||
void
|
||||
demapPage(Addr vaddr, uint64_t asn)
|
||||
{
|
||||
|
|
|
@ -75,6 +75,8 @@ namespace X86ISA
|
|||
typedef X86TLBParams Params;
|
||||
TLB(const Params *p);
|
||||
|
||||
void takeOverFrom(BaseTLB *otlb) {}
|
||||
|
||||
TlbEntry *lookup(Addr va, bool update_lru = true);
|
||||
|
||||
void setConfigAddress(uint32_t addr);
|
||||
|
|
|
@ -432,6 +432,8 @@ BaseCPU::takeOverFrom(BaseCPU *oldCPU)
|
|||
old_dtb_port->unbind();
|
||||
new_dtb_port->bind(slavePort);
|
||||
}
|
||||
newTC->getITBPtr()->takeOverFrom(oldTC->getITBPtr());
|
||||
newTC->getDTBPtr()->takeOverFrom(oldTC->getDTBPtr());
|
||||
|
||||
// Checker whether or not we have to transfer CheckerCPU
|
||||
// objects over in the switch
|
||||
|
@ -447,6 +449,9 @@ BaseCPU::takeOverFrom(BaseCPU *oldCPU)
|
|||
BaseMasterPort *new_checker_dtb_port =
|
||||
newChecker->getDTBPtr()->getMasterPort();
|
||||
|
||||
newChecker->getITBPtr()->takeOverFrom(oldChecker->getITBPtr());
|
||||
newChecker->getDTBPtr()->takeOverFrom(oldChecker->getDTBPtr());
|
||||
|
||||
// Move over any table walker ports if they exist for checker
|
||||
if (new_checker_itb_port) {
|
||||
assert(!new_checker_itb_port->isConnected());
|
||||
|
|
|
@ -69,6 +69,11 @@ class BaseTLB : public SimObject
|
|||
*/
|
||||
virtual void flushAll() = 0;
|
||||
|
||||
/**
|
||||
* Take over from an old tlb context
|
||||
*/
|
||||
virtual void takeOverFrom(BaseTLB *otlb) = 0;
|
||||
|
||||
/**
|
||||
* Get the table walker master port if present. This is used for
|
||||
* migrating port connections during a CPU takeOverFrom()
|
||||
|
|
Loading…
Reference in a new issue