2c2
< * Copyright (c) 2012-2013, 2015 ARM Limited
---
> * Copyright (c) 2012-2013, 2015-2016 ARM Limited
64a65
> #include "mem/cache/write_queue.hh"
75d75
< class MSHR;
80a81
> protected:
193c194
< MSHRQueue writeBuffer;
---
> WriteQueue writeBuffer;
196,202c197,198
< * Allocate a buffer, passing the time indicating when schedule an
< * event to the queued port to go and ask the MSHR and write queue
< * if they have packets to send.
< *
< * allocateBufferInternal() function is called in:
< * - MSHR allocateWriteBuffer (unchached write forwarded to WriteBuffer);
< * - MSHR allocateMissBuffer (miss in MSHR queue);
---
> * Mark a request as in service (sent downstream in the memory
> * system), effectively making this MSHR the ordering point.
204,206c200
< MSHR *allocateBufferInternal(MSHRQueue *mq, Addr addr, int size,
< PacketPtr pkt, Tick time,
< bool sched_send)
---
> void markInService(MSHR *mshr, bool pending_modified_resp)
208,211c202,203
< // check that the address is block aligned since we rely on
< // this in a number of places when checking for matches and
< // overlap
< assert(addr == blockAlign(addr));
---
> bool wasFull = mshrQueue.isFull();
> mshrQueue.markInService(mshr, pending_modified_resp);
213,217c205,206
< MSHR *mshr = mq->allocate(addr, size, pkt, time, order++,
< allocOnFill(pkt->cmd));
<
< if (mq->isFull()) {
< setBlocked((BlockedCause)mq->index);
---
> if (wasFull && !mshrQueue.isFull()) {
> clearBlocked(Blocked_NoMSHRs);
219,224d207
<
< if (sched_send)
< // schedule the send
< schedMemSideSendEvent(time);
<
< return mshr;
227c210
< void markInServiceInternal(MSHR *mshr, bool pending_modified_resp)
---
> void markInService(WriteQueueEntry *entry)
229,233c212,216
< MSHRQueue *mq = mshr->queue;
< bool wasFull = mq->isFull();
< mq->markInService(mshr, pending_modified_resp);
< if (wasFull && !mq->isFull()) {
< clearBlocked((BlockedCause)mq->index);
---
> bool wasFull = writeBuffer.isFull();
> writeBuffer.markInService(entry);
>
> if (wasFull && !writeBuffer.isFull()) {
> clearBlocked(Blocked_NoWBBuffers);
514,516c497,510
< return allocateBufferInternal(&mshrQueue,
< blockAlign(pkt->getAddr()), blkSize,
< pkt, time, sched_send);
---
> MSHR *mshr = mshrQueue.allocate(blockAlign(pkt->getAddr()), blkSize,
> pkt, time, order++,
> allocOnFill(pkt->cmd));
>
> if (mshrQueue.isFull()) {
> setBlocked((BlockedCause)MSHRQueue_MSHRs);
> }
>
> if (sched_send) {
> // schedule the send
> schedMemSideSendEvent(time);
> }
>
> return mshr;
519c513
< MSHR *allocateWriteBuffer(PacketPtr pkt, Tick time)
---
> void allocateWriteBuffer(PacketPtr pkt, Tick time)
524,526c518,534
< return allocateBufferInternal(&writeBuffer,
< blockAlign(pkt->getAddr()), blkSize,
< pkt, time, true);
---
> Addr blk_addr = blockAlign(pkt->getAddr());
>
> WriteQueueEntry *wq_entry =
> writeBuffer.findMatch(blk_addr, pkt->isSecure());
> if (wq_entry && !wq_entry->inService) {
> DPRINTF(Cache, "Potential to merge writeback %s to %#llx",
> pkt->cmdString(), pkt->getAddr());
> }
>
> writeBuffer.allocate(blk_addr, blkSize, pkt, time, order++);
>
> if (writeBuffer.isFull()) {
> setBlocked((BlockedCause)MSHRQueue_WriteBuffer);
> }
>
> // schedule the send
> schedMemSideSendEvent(time);