arch: Add support for invalidating TLBs when draining

This patch adds support for the memInvalidate() drain method.  TLB
flushing is requested by calling the virtual flushAll() method on the
TLB.

Note: This patch renames invalidateAll() to flushAll() on x86 and
SPARC to make the interface consistent across all supported
architectures.
This commit is contained in:
Andreas Sandberg 2013-01-07 13:05:40 -05:00
parent d44f2f611f
commit 94561dd526
7 changed files with 21 additions and 16 deletions

View file

@ -323,7 +323,7 @@ TLB::demapAll(int partition_id)
}
void
TLB::invalidateAll()
TLB::flushAll()
{
cacheValid = false;
lookupTable.clear();

View file

@ -123,7 +123,7 @@ class TLB : public BaseTLB
uint64_t TagRead(int entry);
/** Remove all entries from the TLB */
void invalidateAll();
void flushAll();
/** Remove all non-locked entries from the tlb that match partition id. */
void demapAll(int partition_id);

View file

@ -191,8 +191,8 @@ ISA::setMiscReg(int miscReg, MiscReg val, ThreadContext * tc)
}
}
if (toggled.pg) {
tc->getITBPtr()->invalidateAll();
tc->getDTBPtr()->invalidateAll();
tc->getITBPtr()->flushAll();
tc->getDTBPtr()->flushAll();
}
//This must always be 1.
newCR0.et = 1;
@ -208,15 +208,15 @@ ISA::setMiscReg(int miscReg, MiscReg val, ThreadContext * tc)
case MISCREG_CR2:
break;
case MISCREG_CR3:
tc->getITBPtr()->invalidateNonGlobal();
tc->getDTBPtr()->invalidateNonGlobal();
tc->getITBPtr()->flushNonGlobal();
tc->getDTBPtr()->flushNonGlobal();
break;
case MISCREG_CR4:
{
CR4 toggled = regVal[miscReg] ^ val;
if (toggled.pae || toggled.pse || toggled.pge) {
tc->getITBPtr()->invalidateAll();
tc->getDTBPtr()->invalidateAll();
tc->getITBPtr()->flushAll();
tc->getDTBPtr()->flushAll();
}
}
break;

View file

@ -129,7 +129,7 @@ TLB::lookup(Addr va, bool update_lru)
}
void
TLB::invalidateAll()
TLB::flushAll()
{
DPRINTF(TLB, "Invalidating all entries.\n");
for (unsigned i = 0; i < size; i++) {
@ -148,7 +148,7 @@ TLB::setConfigAddress(uint32_t addr)
}
void
TLB::invalidateNonGlobal()
TLB::flushNonGlobal()
{
DPRINTF(TLB, "Invalidating all non global entries.\n");
for (unsigned i = 0; i < size; i++) {

View file

@ -75,8 +75,6 @@ namespace X86ISA
typedef X86TLBParams Params;
TLB(const Params *p);
void dumpAll();
TlbEntry *lookup(Addr va, bool update_lru = true);
void setConfigAddress(uint32_t addr);
@ -90,9 +88,9 @@ namespace X86ISA
public:
Walker *getWalker();
void invalidateAll();
void flushAll();
void invalidateNonGlobal();
void flushNonGlobal();
void demapPage(Addr va, uint64_t asn);

View file

@ -213,8 +213,8 @@ copyMiscRegs(ThreadContext *src, ThreadContext *dest)
dest->setMiscRegNoEffect(i, src->readMiscRegNoEffect(i));
}
dest->getITBPtr()->invalidateAll();
dest->getDTBPtr()->invalidateAll();
dest->getITBPtr()->flushAll();
dest->getDTBPtr()->flushAll();
}
void

View file

@ -64,6 +64,11 @@ class BaseTLB : public SimObject
public:
virtual void demapPage(Addr vaddr, uint64_t asn) = 0;
/**
* Remove all entries from the TLB
*/
virtual void flushAll() = 0;
/**
* Get the table walker master port if present. This is used for
* migrating port connections during a CPU takeOverFrom()
@ -75,6 +80,8 @@ class BaseTLB : public SimObject
*/
virtual BaseMasterPort* getMasterPort() { return NULL; }
void memInvalidate() { flushAll(); }
class Translation
{
public: