mem-ruby: fixes for masked writes
This adds DataBlock::setData(PacketPtr) to update the block with packet data. The method uses the packet's writeData to copy the correct bytes if the request is a masked write. Change-Id: I9e5f70fed29edcf55fef94a4b145aa838dc60eac Signed-off-by: Tiago Mück <tiago.muck@arm.com> Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/41134 Reviewed-by: Jason Lowe-Power <power.jg@gmail.com> 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:
@@ -1,4 +1,16 @@
|
||||
/*
|
||||
* Copyright (c) 2021 ARM Limited
|
||||
* All rights reserved.
|
||||
*
|
||||
* The license below extends only to copyright in the software and shall
|
||||
* not be construed as granting a license to any other intellectual
|
||||
* property including but not limited to intellectual property relating
|
||||
* to a hardware implementation of the functionality of the software
|
||||
* licensed hereunder. You may use the software subject to the license
|
||||
* terms below provided that you ensure that this notice is replicated
|
||||
* unmodified and in its entirety in all distributions of the software,
|
||||
* modified or unmodified, in source code or in binary form.
|
||||
*
|
||||
* Copyright (c) 1999-2008 Mark D. Hill and David A. Wood
|
||||
* All rights reserved.
|
||||
*
|
||||
@@ -108,6 +120,14 @@ DataBlock::setData(const uint8_t *data, int offset, int len)
|
||||
memcpy(&m_data[offset], data, len);
|
||||
}
|
||||
|
||||
void
|
||||
DataBlock::setData(PacketPtr pkt)
|
||||
{
|
||||
int offset = getOffset(pkt->getAddr());
|
||||
assert(offset + pkt->getSize() <= RubySystem::getBlockSizeBytes());
|
||||
pkt->writeData(&m_data[offset]);
|
||||
}
|
||||
|
||||
DataBlock &
|
||||
DataBlock::operator=(const DataBlock & obj)
|
||||
{
|
||||
|
||||
@@ -1,4 +1,16 @@
|
||||
/*
|
||||
* Copyright (c) 2021 ARM Limited
|
||||
* All rights reserved.
|
||||
*
|
||||
* The license below extends only to copyright in the software and shall
|
||||
* not be construed as granting a license to any other intellectual
|
||||
* property including but not limited to intellectual property relating
|
||||
* to a hardware implementation of the functionality of the software
|
||||
* licensed hereunder. You may use the software subject to the license
|
||||
* terms below provided that you ensure that this notice is replicated
|
||||
* unmodified and in its entirety in all distributions of the software,
|
||||
* modified or unmodified, in source code or in binary form.
|
||||
*
|
||||
* Copyright (c) 1999-2008 Mark D. Hill and David A. Wood
|
||||
* All rights reserved.
|
||||
*
|
||||
@@ -35,6 +47,8 @@
|
||||
#include <iomanip>
|
||||
#include <iostream>
|
||||
|
||||
#include "mem/packet.hh"
|
||||
|
||||
class WriteMask;
|
||||
|
||||
class DataBlock
|
||||
@@ -63,6 +77,7 @@ class DataBlock
|
||||
uint8_t *getDataMod(int offset);
|
||||
void setByte(int whichByte, uint8_t data);
|
||||
void setData(const uint8_t *data, int offset, int len);
|
||||
void setData(PacketPtr pkt);
|
||||
void copyPartial(const DataBlock &dblk, int offset, int len);
|
||||
void copyPartial(const DataBlock &dblk, const WriteMask &mask);
|
||||
void atomicPartial(const DataBlock & dblk, const WriteMask & mask);
|
||||
|
||||
@@ -1,4 +1,16 @@
|
||||
/*
|
||||
* Copyright (c) 2021 ARM Limited
|
||||
* All rights reserved.
|
||||
*
|
||||
* The license below extends only to copyright in the software and shall
|
||||
* not be construed as granting a license to any other intellectual
|
||||
* property including but not limited to intellectual property relating
|
||||
* to a hardware implementation of the functionality of the software
|
||||
* licensed hereunder. You may use the software subject to the license
|
||||
* terms below provided that you ensure that this notice is replicated
|
||||
* unmodified and in its entirety in all distributions of the software,
|
||||
* modified or unmodified, in source code or in binary form.
|
||||
*
|
||||
* Copyright (c) 2008 Mark D. Hill and David A. Wood
|
||||
* All rights reserved.
|
||||
*
|
||||
@@ -70,6 +82,9 @@ DMASequencer::makeRequest(PacketPtr pkt)
|
||||
int len = pkt->getSize();
|
||||
bool write = pkt->isWrite();
|
||||
|
||||
// Should DMA be allowed to generate this ?
|
||||
assert(!pkt->isMaskedWrite());
|
||||
|
||||
assert(m_outstanding_count < m_max_outstanding_requests);
|
||||
Addr line_addr = makeLineAddress(paddr);
|
||||
auto emplace_pair =
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2019-2020 ARM Limited
|
||||
* Copyright (c) 2019-2021 ARM Limited
|
||||
* All rights reserved.
|
||||
*
|
||||
* The license below extends only to copyright in the software and shall
|
||||
@@ -575,8 +575,7 @@ Sequencer::hitCallback(SequencerRequest* srequest, DataBlock& data,
|
||||
|
||||
// update the data unless it is a non-data-carrying flush
|
||||
if (RubySystem::getWarmupEnabled()) {
|
||||
data.setData(pkt->getConstPtr<uint8_t>(),
|
||||
getOffset(request_address), pkt->getSize());
|
||||
data.setData(pkt);
|
||||
} else if (!pkt->isFlush()) {
|
||||
if ((type == RubyRequestType_LD) ||
|
||||
(type == RubyRequestType_IFETCH) ||
|
||||
@@ -587,6 +586,7 @@ Sequencer::hitCallback(SequencerRequest* srequest, DataBlock& data,
|
||||
data.getData(getOffset(request_address), pkt->getSize()));
|
||||
DPRINTF(RubySequencer, "read data %s\n", data);
|
||||
} else if (pkt->req->isSwap()) {
|
||||
assert(!pkt->isMaskedWrite());
|
||||
std::vector<uint8_t> overwrite_val(pkt->getSize());
|
||||
pkt->writeData(&overwrite_val[0]);
|
||||
pkt->setData(
|
||||
@@ -597,8 +597,7 @@ Sequencer::hitCallback(SequencerRequest* srequest, DataBlock& data,
|
||||
} else if (type != RubyRequestType_Store_Conditional || llscSuccess) {
|
||||
// Types of stores set the actual data here, apart from
|
||||
// failed Store Conditional requests
|
||||
data.setData(pkt->getConstPtr<uint8_t>(),
|
||||
getOffset(request_address), pkt->getSize());
|
||||
data.setData(pkt);
|
||||
DPRINTF(RubySequencer, "set data %s\n", data);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user