summaryrefslogtreecommitdiff
path: root/src/dev/arm
diff options
context:
space:
mode:
authorAndreas Hansson <andreas.hansson@arm.com>2014-12-02 06:07:41 -0500
committerAndreas Hansson <andreas.hansson@arm.com>2014-12-02 06:07:41 -0500
commit5df96cb690168d750ab0fafffd11fb51624374d2 (patch)
treeb8345b3c1b9f5a998a6eca8d68aa0022086b604d /src/dev/arm
parent0706a252031b3f160bac65fac00b22f8a5ebf4f9 (diff)
downloadgem5-5df96cb690168d750ab0fafffd11fb51624374d2.tar.xz
mem: Remove redundant Packet::allocate calls
This patch cleans up the packet memory allocation confusion. The data is always allocated at the requesting side, when a packet is created (or copied), and there is never a need for any device to allocate any space if it is merely responding to a paket. This behaviour is in line with how SystemC and TLM works as well, thus increasing interoperability, and matching established conventions. The redundant calls to Packet::allocate are removed, and the checks in the function are tightened up to make sure data is only ever allocated once. There are still some oddities in the packet copy constructor where we copy the data pointer if it is static (without ownership), and allocate new space if the data is dynamic (with ownership). The latter is being worked on further in a follow-on patch.
Diffstat (limited to 'src/dev/arm')
-rw-r--r--src/dev/arm/a9scu.cc1
-rw-r--r--src/dev/arm/amba_device.cc2
-rw-r--r--src/dev/arm/amba_fake.cc2
-rw-r--r--src/dev/arm/energy_ctrl.cc1
-rw-r--r--src/dev/arm/gic_pl390.cc6
-rw-r--r--src/dev/arm/hdlcd.cc2
-rw-r--r--src/dev/arm/kmi.cc2
-rw-r--r--src/dev/arm/pl011.cc1
-rw-r--r--src/dev/arm/pl111.cc1
-rw-r--r--src/dev/arm/rtc_pl031.cc2
-rw-r--r--src/dev/arm/rv_ctrl.cc1
-rw-r--r--src/dev/arm/timer_cpulocal.cc2
-rw-r--r--src/dev/arm/timer_sp804.cc2
-rw-r--r--src/dev/arm/vgic.cc4
14 files changed, 0 insertions, 29 deletions
diff --git a/src/dev/arm/a9scu.cc b/src/dev/arm/a9scu.cc
index dc012a036..26b2a4522 100644
--- a/src/dev/arm/a9scu.cc
+++ b/src/dev/arm/a9scu.cc
@@ -55,7 +55,6 @@ A9SCU::read(PacketPtr pkt)
assert(pkt->getAddr() >= pioAddr && pkt->getAddr() < pioAddr + pioSize);
assert(pkt->getSize() == 4);
Addr daddr = pkt->getAddr() - pioAddr;
- pkt->allocate();
switch(daddr) {
case Control:
diff --git a/src/dev/arm/amba_device.cc b/src/dev/arm/amba_device.cc
index d2333417f..0ba20d087 100644
--- a/src/dev/arm/amba_device.cc
+++ b/src/dev/arm/amba_device.cc
@@ -76,8 +76,6 @@ AmbaDevice::readId(PacketPtr pkt, uint64_t amba_id, Addr pio_addr)
if (daddr < AMBA_PER_ID0 || daddr > AMBA_CEL_ID3)
return false;
- pkt->allocate();
-
int byte = (daddr - AMBA_PER_ID0) << 1;
// Too noisy right now
DPRINTF(AMBA, "Returning %#x for offset %#x(%d)\n",
diff --git a/src/dev/arm/amba_fake.cc b/src/dev/arm/amba_fake.cc
index 3ca705c6c..d415ab2fa 100644
--- a/src/dev/arm/amba_fake.cc
+++ b/src/dev/arm/amba_fake.cc
@@ -57,7 +57,6 @@ AmbaFake::read(PacketPtr pkt)
assert(pkt->getAddr() >= pioAddr && pkt->getAddr() < pioAddr + pioSize);
Addr daddr = pkt->getAddr() - pioAddr;
- pkt->allocate();
DPRINTF(AMBA, " read register %#x\n", daddr);
@@ -74,7 +73,6 @@ AmbaFake::write(PacketPtr pkt)
{
Addr daddr = pkt->getAddr() - pioAddr;
- pkt->allocate();
if (!params()->ignore_access)
panic("Tried to write AmbaFake at offset %#x that doesn't exist\n", daddr);
diff --git a/src/dev/arm/energy_ctrl.cc b/src/dev/arm/energy_ctrl.cc
index cbfa5aa79..b77eaba3b 100644
--- a/src/dev/arm/energy_ctrl.cc
+++ b/src/dev/arm/energy_ctrl.cc
@@ -64,7 +64,6 @@ EnergyCtrl::read(PacketPtr pkt)
{
assert(pkt->getAddr() >= pioAddr && pkt->getAddr() < pioAddr + pioSize);
assert(pkt->getSize() == 4);
- pkt->allocate();
Addr daddr = pkt->getAddr() - pioAddr;
assert((daddr & 3) == 0);
diff --git a/src/dev/arm/gic_pl390.cc b/src/dev/arm/gic_pl390.cc
index b93cdd028..019b3ee8b 100644
--- a/src/dev/arm/gic_pl390.cc
+++ b/src/dev/arm/gic_pl390.cc
@@ -150,7 +150,6 @@ Tick
Pl390::readDistributor(PacketPtr pkt)
{
Addr daddr = pkt->getAddr() - distAddr;
- pkt->allocate();
int ctx_id = pkt->req->contextId();
@@ -284,7 +283,6 @@ Tick
Pl390::readCpu(PacketPtr pkt)
{
Addr daddr = pkt->getAddr() - cpuAddr;
- pkt->allocate();
assert(pkt->req->hasContextId());
int ctx_id = pkt->req->contextId();
@@ -369,7 +367,6 @@ Tick
Pl390::readMsix(PacketPtr pkt)
{
Addr daddr = pkt->getAddr() - msixRegAddr;
- pkt->allocate();
DPRINTF(GIC, "Gic MSIX read register %#x\n", daddr);
@@ -390,7 +387,6 @@ Tick
Pl390::writeDistributor(PacketPtr pkt)
{
Addr daddr = pkt->getAddr() - distAddr;
- pkt->allocate();
assert(pkt->req->hasContextId());
int ctx_id = pkt->req->contextId();
@@ -531,7 +527,6 @@ Tick
Pl390::writeCpu(PacketPtr pkt)
{
Addr daddr = pkt->getAddr() - cpuAddr;
- pkt->allocate();
assert(pkt->req->hasContextId());
int ctx_id = pkt->req->contextId();
@@ -586,7 +581,6 @@ Tick
Pl390::writeMsix(PacketPtr pkt)
{
Addr daddr = pkt->getAddr() - msixRegAddr;
- pkt->allocate();
DPRINTF(GIC, "Gic MSI-X write register %#x data %d\n",
daddr, pkt->get<uint32_t>());
diff --git a/src/dev/arm/hdlcd.cc b/src/dev/arm/hdlcd.cc
index 349b246c2..37569b22b 100644
--- a/src/dev/arm/hdlcd.cc
+++ b/src/dev/arm/hdlcd.cc
@@ -104,8 +104,6 @@ HDLcd::read(PacketPtr pkt)
pkt->getAddr() < pioAddr + pioSize &&
pkt->getSize() == 4);
- pkt->allocate();
-
switch (daddr) {
case Version:
data = version;
diff --git a/src/dev/arm/kmi.cc b/src/dev/arm/kmi.cc
index 99d61c610..2344b4cb5 100644
--- a/src/dev/arm/kmi.cc
+++ b/src/dev/arm/kmi.cc
@@ -69,8 +69,6 @@ Pl050::read(PacketPtr pkt)
assert(pkt->getAddr() >= pioAddr && pkt->getAddr() < pioAddr + pioSize);
Addr daddr = pkt->getAddr() - pioAddr;
- pkt->allocate();
-
uint32_t data = 0;
diff --git a/src/dev/arm/pl011.cc b/src/dev/arm/pl011.cc
index b47d0e9fb..d690ee9cb 100644
--- a/src/dev/arm/pl011.cc
+++ b/src/dev/arm/pl011.cc
@@ -64,7 +64,6 @@ Pl011::read(PacketPtr pkt)
assert(pkt->getAddr() >= pioAddr && pkt->getAddr() < pioAddr + pioSize);
Addr daddr = pkt->getAddr() - pioAddr;
- pkt->allocate();
DPRINTF(Uart, " read register %#x size=%d\n", daddr, pkt->getSize());
diff --git a/src/dev/arm/pl111.cc b/src/dev/arm/pl111.cc
index 4d1bcba1e..a5b9b412c 100644
--- a/src/dev/arm/pl111.cc
+++ b/src/dev/arm/pl111.cc
@@ -104,7 +104,6 @@ Pl111::read(PacketPtr pkt)
pkt->getAddr() < pioAddr + pioSize);
Addr daddr = pkt->getAddr() - pioAddr;
- pkt->allocate();
DPRINTF(PL111, " read register %#x size=%d\n", daddr, pkt->getSize());
diff --git a/src/dev/arm/rtc_pl031.cc b/src/dev/arm/rtc_pl031.cc
index 8f421a1da..a43ac6271 100644
--- a/src/dev/arm/rtc_pl031.cc
+++ b/src/dev/arm/rtc_pl031.cc
@@ -62,7 +62,6 @@ PL031::read(PacketPtr pkt)
assert(pkt->getAddr() >= pioAddr && pkt->getAddr() < pioAddr + pioSize);
assert(pkt->getSize() == 4);
Addr daddr = pkt->getAddr() - pioAddr;
- pkt->allocate();
uint32_t data;
DPRINTF(Timer, "Reading from RTC at offset: %#x\n", daddr);
@@ -125,7 +124,6 @@ PL031::write(PacketPtr pkt)
assert(pkt->getAddr() >= pioAddr && pkt->getAddr() < pioAddr + pioSize);
assert(pkt->getSize() == 4);
Addr daddr = pkt->getAddr() - pioAddr;
- pkt->allocate();
DPRINTF(Timer, "Writing to RTC at offset: %#x\n", daddr);
switch (daddr) {
diff --git a/src/dev/arm/rv_ctrl.cc b/src/dev/arm/rv_ctrl.cc
index af121861c..f2b85d513 100644
--- a/src/dev/arm/rv_ctrl.cc
+++ b/src/dev/arm/rv_ctrl.cc
@@ -54,7 +54,6 @@ RealViewCtrl::read(PacketPtr pkt)
assert(pkt->getAddr() >= pioAddr && pkt->getAddr() < pioAddr + pioSize);
assert(pkt->getSize() == 4);
Addr daddr = pkt->getAddr() - pioAddr;
- pkt->allocate();
switch(daddr) {
case ProcId0:
diff --git a/src/dev/arm/timer_cpulocal.cc b/src/dev/arm/timer_cpulocal.cc
index ae341e2be..de2f99f0a 100644
--- a/src/dev/arm/timer_cpulocal.cc
+++ b/src/dev/arm/timer_cpulocal.cc
@@ -75,7 +75,6 @@ CpuLocalTimer::read(PacketPtr pkt)
assert(pkt->getAddr() >= pioAddr && pkt->getAddr() < pioAddr + pioSize);
assert(pkt->getSize() == 4);
Addr daddr = pkt->getAddr() - pioAddr;
- pkt->allocate();
int cpu_id = pkt->req->contextId();
DPRINTF(Timer, "Reading from CpuLocalTimer at offset: %#x\n", daddr);
assert(cpu_id >= 0);
@@ -154,7 +153,6 @@ CpuLocalTimer::write(PacketPtr pkt)
assert(pkt->getAddr() >= pioAddr && pkt->getAddr() < pioAddr + pioSize);
assert(pkt->getSize() == 4);
Addr daddr = pkt->getAddr() - pioAddr;
- pkt->allocate();
int cpu_id = pkt->req->contextId();
DPRINTF(Timer, "Writing to CpuLocalTimer at offset: %#x\n", daddr);
assert(cpu_id >= 0);
diff --git a/src/dev/arm/timer_sp804.cc b/src/dev/arm/timer_sp804.cc
index 25bc08003..9f7867107 100644
--- a/src/dev/arm/timer_sp804.cc
+++ b/src/dev/arm/timer_sp804.cc
@@ -66,7 +66,6 @@ Sp804::read(PacketPtr pkt)
assert(pkt->getAddr() >= pioAddr && pkt->getAddr() < pioAddr + pioSize);
assert(pkt->getSize() == 4);
Addr daddr = pkt->getAddr() - pioAddr;
- pkt->allocate();
DPRINTF(Timer, "Reading from DualTimer at offset: %#x\n", daddr);
if (daddr < Timer::Size)
@@ -121,7 +120,6 @@ Sp804::write(PacketPtr pkt)
assert(pkt->getAddr() >= pioAddr && pkt->getAddr() < pioAddr + pioSize);
assert(pkt->getSize() == 4);
Addr daddr = pkt->getAddr() - pioAddr;
- pkt->allocate();
DPRINTF(Timer, "Writing to DualTimer at offset: %#x\n", daddr);
if (daddr < Timer::Size)
diff --git a/src/dev/arm/vgic.cc b/src/dev/arm/vgic.cc
index 2faf2030e..4a63c796a 100644
--- a/src/dev/arm/vgic.cc
+++ b/src/dev/arm/vgic.cc
@@ -92,7 +92,6 @@ Tick
VGic::readVCpu(PacketPtr pkt)
{
Addr daddr = pkt->getAddr() - vcpuAddr;
- pkt->allocate();
int ctx_id = pkt->req->contextId();
assert(ctx_id < VGIC_CPU_MAX);
@@ -137,7 +136,6 @@ Tick
VGic::readCtrl(PacketPtr pkt)
{
Addr daddr = pkt->getAddr() - hvAddr;
- pkt->allocate();
int ctx_id = pkt->req->contextId();
@@ -232,7 +230,6 @@ Tick
VGic::writeVCpu(PacketPtr pkt)
{
Addr daddr = pkt->getAddr() - vcpuAddr;
- pkt->allocate();
int ctx_id = pkt->req->contextId();
assert(ctx_id < VGIC_CPU_MAX);
@@ -280,7 +277,6 @@ Tick
VGic::writeCtrl(PacketPtr pkt)
{
Addr daddr = pkt->getAddr() - hvAddr;
- pkt->allocate();
int ctx_id = pkt->req->contextId();