mem: Remove redundant Packet::allocate calls
authorAndreas Hansson <andreas.hansson@arm.com>
Tue, 2 Dec 2014 11:07:41 +0000 (06:07 -0500)
committerAndreas Hansson <andreas.hansson@arm.com>
Tue, 2 Dec 2014 11:07:41 +0000 (06:07 -0500)
commit5df96cb690168d750ab0fafffd11fb51624374d2
treeb8345b3c1b9f5a998a6eca8d68aa0022086b604d
parent0706a252031b3f160bac65fac00b22f8a5ebf4f9
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.
35 files changed:
src/dev/alpha/backdoor.cc
src/dev/alpha/tsunami_cchip.cc
src/dev/alpha/tsunami_io.cc
src/dev/alpha/tsunami_pchip.cc
src/dev/arm/a9scu.cc
src/dev/arm/amba_device.cc
src/dev/arm/amba_fake.cc
src/dev/arm/energy_ctrl.cc
src/dev/arm/gic_pl390.cc
src/dev/arm/hdlcd.cc
src/dev/arm/kmi.cc
src/dev/arm/pl011.cc
src/dev/arm/pl111.cc
src/dev/arm/rtc_pl031.cc
src/dev/arm/rv_ctrl.cc
src/dev/arm/timer_cpulocal.cc
src/dev/arm/timer_sp804.cc
src/dev/arm/vgic.cc
src/dev/copy_engine.cc
src/dev/i8254xGBe.cc
src/dev/ide_ctrl.cc
src/dev/isa_fake.cc
src/dev/mips/malta_cchip.cc
src/dev/mips/malta_pchip.cc
src/dev/ns_gige.cc
src/dev/pciconfigall.cc
src/dev/pcidev.cc
src/dev/sinic.cc
src/dev/sparc/dtod.cc
src/dev/uart8250.cc
src/dev/virtio/base.cc
src/dev/virtio/pci.cc
src/mem/cache/cache_impl.hh
src/mem/packet.cc
src/mem/packet.hh