sim: Use memPools in SE mode only

memPools have been added by:

https://gem5-review.googlesource.com/c/public/gem5/+/42215

and are supposed to be used in SE mode only.
Current code is assuming there is at least one memory which is visible
to the OS/bootloader (conf_table_reported = True). This makes sense
in SE mode as it emulates the OS, but it shouldn't be enforced
in FS baremetal simulations

With this patch we are making sure memPools are used in SE mode
only.

Change-Id: Icebb7dafc18a6fdad0f9b16e5a988270bbebb9eb
Signed-off-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/44845
Reviewed-by: Matthew Poremba <matthew.poremba@amd.com>
Maintainer: Jason Lowe-Power <power.jg@gmail.com>
Tested-by: kokoro <noreply+kokoro@google.com>
This commit is contained in:
Giacomo Travaglini
2021-04-26 10:56:28 +01:00
parent 60f7618a0f
commit 70abb2dcfd

View File

@@ -233,18 +233,20 @@ System::System(const Params &p)
}
#endif
AddrRangeList memories = physmem.getConfAddrRanges();
assert(!memories.empty());
for (const auto &memory : memories) {
assert(!memory.interleaved());
memPools.emplace_back(this, memory.start(), memory.end());
}
if (!FullSystem) {
AddrRangeList memories = physmem.getConfAddrRanges();
assert(!memories.empty());
for (const auto &memory : memories) {
assert(!memory.interleaved());
memPools.emplace_back(this, memory.start(), memory.end());
}
/*
* Set freePage to what it was before Gabe Black's page table changes
* so allocations don't trample the page table entries.
*/
memPools[0].setFreePage(memPools[0].freePage() + 70);
/*
* Set freePage to what it was before Gabe Black's page table changes
* so allocations don't trample the page table entries.
*/
memPools[0].setFreePage(memPools[0].freePage() + 70);
}
// check if the cache line size is a value known to work
if (_cacheLineSize != 16 && _cacheLineSize != 32 &&
@@ -377,18 +379,21 @@ System::validKvmEnvironment() const
Addr
System::allocPhysPages(int npages, int poolID)
{
assert(!FullSystem);
return memPools[poolID].allocate(npages);
}
Addr
System::memSize(int poolID) const
{
assert(!FullSystem);
return memPools[poolID].totalBytes();
}
Addr
System::freeMemSize(int poolID) const
{
assert(!FullSystem);
return memPools[poolID].freeBytes();
}