Skip to content

Commit 117faf6

Browse files
committed
[gem5] Add waiting state to SimpleMemory. Expose access deny due to THNVM schemes.
1 parent 23bc1e7 commit 117faf6

5 files changed

Lines changed: 22 additions & 16 deletions

File tree

addr_trans_controller.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ Addr AddrTransController::NVMStore(Addr phy_addr, int size) {
6060
mach_addr = att_.Translate(phy_addr, mach_base);
6161
}
6262
mem_store_->OnNVMWrite(mach_addr, size);
63+
return mach_addr;
6364
} else { // in checkpointing
6465
if (index != -EINVAL) { // found
6566
const ATTEntry& entry = att_.At(index);
@@ -84,8 +85,8 @@ Addr AddrTransController::NVMStore(Addr phy_addr, int size) {
8485
mach_addr = att_.Translate(phy_addr, mach_base);
8586
}
8687
mem_store_->OnDRAMWrite(mach_addr, size);
88+
return mach_addr;
8789
}
88-
return mach_addr;
8990
}
9091

9192
Addr AddrTransController::DRAMStore(Addr phy_addr, int size) {

gem5-stable/src/mem/abstract_mem.cc

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,7 @@ AbstractMemory::checkLockedAddrList(PacketPtr pkt)
328328

329329
#endif
330330

331-
void
331+
bool
332332
AbstractMemory::access(PacketPtr pkt)
333333
{
334334
assert(AddrRange(pkt->getAddr(),
@@ -337,7 +337,7 @@ AbstractMemory::access(PacketPtr pkt)
337337
if (pkt->memInhibitAsserted()) {
338338
DPRINTF(MemoryAccess, "mem inhibited on 0x%x: not responding\n",
339339
pkt->getAddr());
340-
return;
340+
return true;
341341
}
342342

343343
if (pkt->cmd == MemCmd::SwapReq) {
@@ -373,7 +373,7 @@ AbstractMemory::access(PacketPtr pkt)
373373
if (overwrite_mem) {
374374
Addr local_addr = addrController.StoreAddr(
375375
localAddr(pkt), pkt->getSize());
376-
if (local_addr == INVAL_ADDR) return;
376+
if (local_addr == INVAL_ADDR) return false;
377377
host_addr = hostAddr(local_addr);
378378
std::memcpy(host_addr, &overwrite_val, pkt->getSize());
379379
}
@@ -403,7 +403,7 @@ AbstractMemory::access(PacketPtr pkt)
403403
assert(pkt->getSize() == addrController.cache_block_size());
404404
Addr local_addr = addrController.StoreAddr(
405405
localAddr(pkt), pkt->getSize());
406-
if (local_addr == INVAL_ADDR) return;
406+
if (local_addr == INVAL_ADDR) return false;
407407
memcpy(hostAddr(local_addr), pkt->getPtr<uint8_t>(),
408408
pkt->getSize());
409409
DPRINTF(MemoryAccess, "%s wrote %x bytes to address %x\n",
@@ -423,6 +423,8 @@ AbstractMemory::access(PacketPtr pkt)
423423
if (pkt->needsResponse()) {
424424
pkt->makeResponse();
425425
}
426+
427+
return true;
426428
}
427429

428430
void

gem5-stable/src/mem/abstract_mem.hh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -315,8 +315,9 @@ class AbstractMemory : public MemObject, public MemStore
315315
* is turned into a response if required.
316316
*
317317
* @param pkt Packet performing the access
318+
* @return if this packet is serviced in THNVM schemes
318319
*/
319-
void access(PacketPtr pkt);
320+
bool access(PacketPtr pkt);
320321

321322
/**
322323
* Perform an untimed memory read or write without changing

gem5-stable/src/mem/simple_mem.cc

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ SimpleMemory::SimpleMemory(const SimpleMemoryParams* p) :
5353
tATTOp(p->lat_att_operate), tBufferOp(p->lat_buffer_operate),
5454
tNVMRead(p->lat_nvm_read), tNVMWrite(p->lat_nvm_write),
5555
isTimingATT(p->is_timing_att), latency_var(p->latency_var),
56-
bandwidth(p->bandwidth), isBusy(false),
56+
bandwidth(p->bandwidth), isBusy(false), isWaiting(false),
5757
retryReq(false), retryResp(false),
5858
releaseEvent(this), unfreezeEvent(this),
5959
dequeueEvent(this), drainManager(NULL)
@@ -95,7 +95,7 @@ SimpleMemory::regStats()
9595
Tick
9696
SimpleMemory::recvAtomic(PacketPtr pkt)
9797
{
98-
access(pkt);
98+
assert(access(pkt)); //TODO
9999
return pkt->memInhibitAsserted() ? 0 : getLatency();
100100
}
101101

@@ -168,13 +168,12 @@ SimpleMemory::recvTimingReq(PacketPtr pkt)
168168
// queue if there is one
169169
bool needsResponse = pkt->needsResponse();
170170
assert(sumLatency == 0 && sumSize == 0);
171-
recvAtomic(pkt);
172-
// turn packet around to go back to requester if response expected
173-
Tick lat = isTimingATT ? sumLatency : getLatency();
174-
if (retryReq) {
171+
if (!access(pkt)) {
175172
sumLatency = sumSize = 0;
176173
return false;
177174
}
175+
// turn packet around to go back to requester if response expected
176+
Tick lat = isTimingATT ? sumLatency : getLatency();
178177
if (needsResponse) {
179178
// recvAtomic() should already have turned packet into
180179
// atomic response
@@ -220,14 +219,14 @@ SimpleMemory::OnCheckpointing(int num_new_at, int num_new_pt)
220219
totalChkptTime += chkpt_duration;
221220
}
222221
} else {
223-
unfreeze();
222+
addrController.FinishCheckpointing();
224223
}
225224
}
226225

227226
void
228227
SimpleMemory::OnWaiting()
229228
{
230-
retryReq = true;
229+
isWaiting = true;
231230
}
232231

233232
void
@@ -245,8 +244,8 @@ void
245244
SimpleMemory::unfreeze()
246245
{
247246
addrController.FinishCheckpointing();
248-
if (retryReq) {
249-
retryReq = false;
247+
if (isWaiting) {
248+
isWaiting = false;
250249
port.sendRetry();
251250
}
252251
}

gem5-stable/src/mem/simple_mem.hh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,9 @@ class SimpleMemory : public AbstractMemory
149149
*/
150150
bool isBusy;
151151

152+
/** Track THNVM waiting state */
153+
bool isWaiting;
154+
152155
/**
153156
* Remember if we have to retry an outstanding request that
154157
* arrived while we were busy.

0 commit comments

Comments
 (0)