gem5.git
9 years agox86: Fixes to avoid LTO warnings
Andreas Hansson [Mon, 20 Oct 2014 22:03:56 +0000 (18:03 -0400)]
x86: Fixes to avoid LTO warnings

This patch fixes a few minor issues that caused link-time warnings
when using LTO, mainly for x86. The most important change is how the
syscall array is created. Previously gcc and clang would complain that
the declaration and definition types did not match. The organisation
is now changed to match how it is done for ARM, moving the code that
was previously in syscalls.cc into process.cc, and having a class
variable pointing to the static array.

With these changes, there are no longer any warnings using gcc 4.6.3
with LTO.

9 years agomisc: Use gmtime for conversion to UTC to avoid getenv/setenv
Andreas Hansson [Mon, 20 Oct 2014 22:03:55 +0000 (18:03 -0400)]
misc: Use gmtime for conversion to UTC to avoid getenv/setenv

This patch changes how we turn time into UTC. Previously we
manipulated the TZ environment variable, but this has issues as the
strings that are manipulated could be tainted (see e.g. CERT
ENV34-C). Now we simply rely on the built-in gmtime function and avoid
touching getenv/setenv all together.

9 years agomem: Fix DRAM activationlLimit bug
Omar Naji [Mon, 20 Oct 2014 22:03:55 +0000 (18:03 -0400)]
mem: Fix DRAM activationlLimit bug

Ensure that we do the proper event scheduling also when the activation
limit is disabled.

9 years agobase: Fix for stats node on gcc < 4.6.3
Andreas Hansson [Mon, 20 Oct 2014 22:03:54 +0000 (18:03 -0400)]
base: Fix for stats node on gcc < 4.6.3

This patch adds an explicit function to get the underlying node as gcc
4.6.1 and 4.6.2 have issues otherwise.

9 years agoext: Bump DRAMPower to avoid compilation issues
Andreas Hansson [Mon, 20 Oct 2014 22:03:53 +0000 (18:03 -0400)]
ext: Bump DRAMPower to avoid compilation issues

This patch bumps DRAMPower to commit
19433a6897ede4bbb19b06694faa8589b5a6569a which contains a small fix
for clang, and a work-around for LTO with gcc 4.6.

9 years agomem: Add DRAM device size and check against config
Omar Naji [Mon, 20 Oct 2014 22:03:52 +0000 (18:03 -0400)]
mem: Add DRAM device size and check against config

This patch adds the size of the DRAM device to the DRAM config. It
also compares the actual DRAM size (calculated using information from
the config) to the size defined in the system. If these two values do
not match gem5 will print a warning. In order to do correct DRAM
research the size of the memory defined in the system should match the
size of the DRAM in the config. The timing and current parameters
found in the DRAM configs are defined for a DRAM device with a
specific size and would differ for another device with a different
size.

9 years agostats: updates due to previous mmap and exit_group patches.
Nilay Vaish [Mon, 20 Oct 2014 21:48:19 +0000 (16:48 -0500)]
stats: updates due to previous mmap and exit_group patches.

9 years agocpu: o3: corrects base FP and CC register index in removeThread()
Nilay Vaish [Mon, 20 Oct 2014 21:47:55 +0000 (16:47 -0500)]
cpu: o3: corrects base FP and CC register index in removeThread()

9 years agosim: invalid alignment checks in mmap and mremap
Tom Jablin [Mon, 20 Oct 2014 21:45:25 +0000 (16:45 -0500)]
sim: invalid alignment checks in mmap and mremap
Presently, the alignment checks in the mmap and mremap implementations
in syscall_emul.hh are wrong. The checks are implemented as:

if ((start % TheISA::PageBytes) != 0 ||
        (length % TheISA::PageBytes) != 0) {
    warn("mmap failing: arguments not page-aligned: "
            "start 0x%x length 0x%x",
            start, length);
    return -EINVAL;
}

This checks that both the start and the length arguments of the mmap
syscall are checked for page-alignment. However, the POSIX specification says:

The off argument is constrained to be aligned and sized according to the value
returned by sysconf() when passed _SC_PAGESIZE or _SC_PAGE_SIZE. When MAP_FIXED
is specified, the application shall ensure that the argument addr also meets
these constraints. The implementation performs mapping operations over whole
pages. Thus, while the argument len need not meet a size or alignment
constraint, the implementation shall include, in any mapping operation, any
partial page specified by the range [pa,pa+len).

So the length parameter should not be checked for page-alignment. By contrast,
the current implementation fails to check the offset argument, which must be
page aligned.

Committed by: Nilay Vaish <nilay@cs.wisc.edu>

9 years agosim: mmap: correct behavior for fixed address
Michael Adler [Mon, 20 Oct 2014 21:45:08 +0000 (16:45 -0500)]
sim: mmap: correct behavior for fixed address
Change mmap fixed address request to return an error if the mapping is
impossible due to conflict instead of what I believe used to be silent
corruption.

Committed by: Nilay Vaish <nilay@cs.wisc.edu>

9 years agosim: implement getdents/getdents64 in user mode
Michael Adler [Mon, 20 Oct 2014 21:44:53 +0000 (16:44 -0500)]
sim: implement getdents/getdents64 in user mode

Has been tested only for alpha.
Committed by: Nilay Vaish <nilay@cs.wisc.edu>

9 years agox86: syscall: implementation of exit_group
Severin Wischmann ext:(%2C%20Ioannis%20Ilkos%20%3Cioannis.ilkos09%40imperial.ac.uk%3E) [Mon, 20 Oct 2014 21:43:48 +0000 (16:43 -0500)]
x86: syscall: implementation of exit_group
On exit_group syscall, we used to exit the simulator.  But now we will only
halt the execution of threads that belong to the group.

Committed by: Nilay Vaish <nilay@cs.wisc.edu>

9 years agomem: Modernise PhysicalMemory with C++11 features
Andreas Hansson [Thu, 16 Oct 2014 09:50:01 +0000 (05:50 -0400)]
mem: Modernise PhysicalMemory with C++11 features

Bring the PhysicalMemory up-to-date by making use of range-based for
loops and vector intialisation where possible.

9 years agomisc: Move AddrRangeList from port.hh to addr_range.hh
Andreas Hansson [Thu, 16 Oct 2014 09:49:59 +0000 (05:49 -0400)]
misc: Move AddrRangeList from port.hh to addr_range.hh

The new location seems like a better fit. The iterator typedefs are
removed in favour of using C++11 auto.

9 years agoext: Update fputils to rev 6a47fd8358
Andreas Sandberg [Thu, 16 Oct 2014 09:49:58 +0000 (05:49 -0400)]
ext: Update fputils to rev 6a47fd8358

This patch updates fputils to the latest revision (6a47fd8358) from
the upstream repository (github.com/andysan/fputils). Most notably,
this includes changes that export a limited set of 64-bit float
manipulation and avoids a warning about unused 64-bit floats in clang.

9 years agodev: refactor pci config space for sysfs scanning
Geoffrey Blake [Thu, 16 Oct 2014 09:49:57 +0000 (05:49 -0400)]
dev: refactor pci config space for sysfs scanning

Sysfs on ubuntu scrapes the entire PCI config space
when it discovers a device using 4 byte accesses.
This was not supported by our devices, in particular the NIC
that implemented the extended PCI config space.  This change
allows the extended PCI config space to be accessed by
sysfs properly.

9 years agomem: Add ExternalMaster and ExternalSlave ports
Andrew Bardsley [Thu, 16 Oct 2014 09:49:56 +0000 (05:49 -0400)]
mem: Add ExternalMaster and ExternalSlave ports

This patch adds two MemoryObject's: ExternalMaster and ExternalSlave.
Each object has a single port which can be bound to an externally-
provided bridge to a port of another simulation system at
initialisation.

9 years agosim: SystemC hosting
Andrew Bardsley [Thu, 16 Oct 2014 09:49:54 +0000 (05:49 -0400)]
sim: SystemC hosting

This patch hosts gem5 onto SystemC scheduler. There's already an upstream
review board patch that does something similar but this patch ...:

 1) is less obtrusive to the existing gem5 code organisation. It's divided
 into the 'generic' preparatory patches (already submitted) and this patch
 which affects no existing files

 2) does not try to exactly track the gem5 event queue with notifys into
 SystemC and so doesn't requive the event queue to be modified for
 anything other than 'out of event queue' scheduling events

 3) supports debug logging with SC_REPORT

The patch consists of the files:
    util/systemc/
        sc_gem5_control.{cc,hh} -- top level objects to use to
                                   instantiate gem5 Systems within
                                   larger SystemC test harnesses as
                                   sc_module objects
        sc_logger.{cc,hh}       -- logging support
        sc_module.{cc,hh}       -- a separated event loop specific to
                                   SystemC
        stats.{cc,hh}           -- example Stats handling for the sample
                                   top level
        main.{cc,hh}            -- a sample top level

On the downside this patch is only currently functional with C++
configuration at the top level.

The above sc_... files are indended to be compiled alongside gem5 (as a
library, see main.cc for a command line and util/systemc/README for
more details.)

The top-level system instantiation in sc_gem5_control.{cc,hh} provides
two classes: Gem5Control and Gem5System

Gem5Control is a simulation control class (from which a singleton
object should be created) derived from Gem5SystemC::Module which
carries the top level simulation control interface for gem5.  This
includes hosting a system-building configuration file and
instantiating the Root object from that file.

Gem5System is a base class for instantiating renamed gem5 Systems
from the config file hosted by the Gem5Control object.  In use, a
SystemC module class should be made which represents the desired,
instantiable gem5 System.  That class's instances should create
a Gem5System during their construction, set the parameters of that
system and then call instantiate to build that system.  If this
is all carried out in the sc_core::sc_module-derived classes
constructor, the System's external ports will become children of
that module and can then be recovered by name using sc_core::
sc_find_object.

It is intended that this interface is used with dlopen.  To that
end, the header file sc_gem5_control.hh includes no other header
files from gem5 (and so can be easily copied into another project).
The classes Gem5System and Gem5Control have all their member
functions declared `virtual' so that those functions can be called
through the vtable acquired by building the top level Gem5Control
using dlsym(..., "makeGem5Control") and `makeSystem' on the
Gem5Control.

9 years agosim: EventQueue wakeup on events scheduled outside the event loop
Andreas Hansson [Thu, 16 Oct 2014 09:49:53 +0000 (05:49 -0400)]
sim: EventQueue wakeup on events scheduled outside the event loop

This patch adds a 'wakeup' member function to EventQueue which should be
called on an event queue whenever an event is scheduled on the event queue
from outside code within the call tree of the gem5 event loop.

This clearly isn't necessary for normal gem5 EventQueue operation but
becomes the minimum necessary interface to allow hosting gem5's event loop
onto other schedulers where there may be calls into gem5 from external
code which schedules events onto an EventQueue between the current time and
the time of the next scheduled event.

The use case I have in mind is a SystemC hosting where the event loop is:

    while (more events) {
        wait(time_to_next_event or wakeup)
        setCurTick
        service events at this time
    }

where the 'wait' needs to be woken up if time_to_next_event becomes shorter
due to a scheduled event from SystemC arriving in a gem5 object.

Requiring 'wakeup' to be called is a more efficient interface than
requiring all gem5 event scheduling actions to affect the host scheduler.

This interface could be located elsewhere, say on another global object,
or by being passed by the host scheduler to objects which will schedule
such events, but it seems cleanest to put it on EventQueue as it is
actually a signal to the queue.

EventQueue::wakeup is called for async_event events on event queue 0 as
it's only important that *some* queue be triggered for such events.

9 years agobase: Reimplement the DPRINTF mechanism in a Logger class
Andrew Bardsley [Thu, 16 Oct 2014 09:49:53 +0000 (05:49 -0400)]
base: Reimplement the DPRINTF mechanism in a Logger class

This patch adds a Logger class encapsulating dprintf.  This allows
variants of DPRINTF logging to be constructed and substituted in
place of the default behaviour.

The Logger provides a logMessage(when, name, format, ...) member
function like Trace::dprintf and a getOstream member function to
use a raw ostream for logging.

A class OstreamLogger is provided which generates the customary
debugging output with Trace::OstreamLogger::logMessage being the
old Trace::dprintf.

9 years agoarch: Use shared_ptr for all Faults
Andreas Hansson [Thu, 16 Oct 2014 09:49:51 +0000 (05:49 -0400)]
arch: Use shared_ptr for all Faults

This patch takes quite a large step in transitioning from the ad-hoc
RefCountingPtr to the c++11 shared_ptr by adopting its use for all
Faults. There are no changes in behaviour, and the code modifications
are mostly just replacing "new" with "make_shared".

9 years agoo3: Use shared_ptr for MemDepEntry
Andreas Hansson [Thu, 16 Oct 2014 09:49:49 +0000 (05:49 -0400)]
o3: Use shared_ptr for MemDepEntry

This patch transitions the o3 MemDepEntry from the ad-hoc
RefCountingPtr to the c++11 shared_ptr. There are no changes in
behaviour, and the code modifications are mainly replacing "new" with
"make_shared".

9 years agomem: Use shared_ptr for Ruby Message classes
Andreas Hansson [Thu, 16 Oct 2014 09:49:49 +0000 (05:49 -0400)]
mem: Use shared_ptr for Ruby Message classes

This patch transitions the Ruby Message and its derived classes from
the ad-hoc RefCountingPtr to the c++11 shared_ptr. There are no
changes in behaviour, and the code modifications are mainly replacing
"new" with "make_shared".

The cloning of derived messages is slightly changed as they previously
relied on overriding the base-class through covariant return types.

9 years agobase: Use shared_ptr for stat Node
Andreas Hansson [Thu, 16 Oct 2014 09:49:48 +0000 (05:49 -0400)]
base: Use shared_ptr for stat Node

This patch transitions the stat Node and its derived classes from
the ad-hoc RefCountingPtr to the c++11 shared_ptr. There are no
changes in behaviour, and the code modifications are mainly replacing
"new" with "make_shared".

9 years agobase: Transition CP annotate to use shared_ptr
Andreas Hansson [Thu, 16 Oct 2014 09:49:47 +0000 (05:49 -0400)]
base: Transition CP annotate to use shared_ptr

9 years agodev: Use shared_ptr for EthPacketData
Andreas Hansson [Thu, 16 Oct 2014 09:49:46 +0000 (05:49 -0400)]
dev: Use shared_ptr for EthPacketData

This patch transitions the EthPacketData from the ad-hoc
RefCountingPtr to the c++11 shared_ptr. There are no changes in
behaviour, and the code modifications are mainly replacing "new" with
"make_shared".

The bool casting operator for the shared_ptr is explicit, and we must
therefore either cast it, compare it to NULL (p != nullptr), double
negate it (!!p) or do a (p ? true : false).

9 years agodev: Use shared_ptr for Arguments::Data
Andreas Hansson [Thu, 16 Oct 2014 09:49:45 +0000 (05:49 -0400)]
dev: Use shared_ptr for Arguments::Data

This patch takes a first few steps in transitioning from the ad-hoc
RefCountingPtr to the c++11 shared_ptr. There are no changes in
behaviour, and the code modifications are mainly introducing the
use of make_shared.

Note that the class could use unique_ptr rather than shared_ptr, was
it not for the postfix increment and decrement operators.

9 years agoarch,x86,mem: Dynamically determine the ISA for Ruby store check
Andreas Hansson [Thu, 16 Oct 2014 09:49:44 +0000 (05:49 -0400)]
arch,x86,mem: Dynamically determine the ISA for Ruby store check

This patch makes the memory system ISA-agnostic by enabling the Ruby
Sequencer to dynamically determine if it has to do a store check. To
enable this check, the ISA is encoded as an enum, and the system
is able to provide the ISA to the Sequencer at run time.

--HG--
rename : src/arch/x86/insts/microldstop.hh => src/arch/x86/ldstflags.hh

9 years agomem: Dynamically determine page bytes in memory components
Andreas Hansson [Thu, 16 Oct 2014 09:49:43 +0000 (05:49 -0400)]
mem: Dynamically determine page bytes in memory components

This patch takes a step towards an ISA-agnostic memory
system by enabling the components to establish the page size after
instantiation. The swap operation in the memory is now also allowing
any granularity to avoid depending on the IntReg of the ISA.

9 years agoarm: Add helper methods to setup architected PMU events
Andreas Sandberg [Thu, 16 Oct 2014 09:49:42 +0000 (05:49 -0400)]
arm: Add helper methods to setup architected PMU events

9 years agocpu: Probe points for basic PMU stats
Andreas Sandberg [Thu, 16 Oct 2014 09:49:41 +0000 (05:49 -0400)]
cpu: Probe points for basic PMU stats

This changeset adds probe points that can be used to implement PMU
counters for CPU stats. The following probes are supported:

  * BaseCPU::ppCycles / Cycles
  * BaseCPU::ppRetiredInsts / RetiredInsts
  * BaseCPU::ppRetiredLoads / RetiredLoads
  * BaseCPU::ppRetiredStores / RetiredStores
  * BaseCPU::ppRetiredBranches RetiredBranches

9 years agoarm: Add TLB PMU probes
Andreas Sandberg [Thu, 16 Oct 2014 09:49:41 +0000 (05:49 -0400)]
arm: Add TLB PMU probes

This changeset adds probe points that can be used to implement PMU
counters for TLB stats. The following probes are supported:

* ArmISA::TLB::ppRefills / TLB Refills (TLB insertions)

9 years agocpu: Add branch predictor PMU probe points
Andreas Sandberg [Thu, 16 Oct 2014 09:49:40 +0000 (05:49 -0400)]
cpu: Add branch predictor PMU probe points

This changeset adds probe points that can be used to implement PMU
counters for branch predictor stats. The following probes are
supported:

 * BPRedUnit::ppBranches / Branches
 * BPRedUnit::ppMisses / Misses

9 years agoarm: Add a model of an ARM PMUv3
Andreas Sandberg [Thu, 16 Oct 2014 09:49:39 +0000 (05:49 -0400)]
arm: Add a model of an ARM PMUv3

This class implements a subset of the ARM PMU v3 specification as
described in the ARMv8 reference manual. It supports most of the
features of the PMU, however the following features are known to be
missing:

 * Event filtering (e.g., from different privilege levels).
 * Access controls (the PMU currently ignores the execution level).
 * The chain counter (event no. 0x1E) is unimplemented.

The PMU itself does not implement any events, it merely provides an
interface for the configuration scripts to hook up probes that drive
events. Configuration scripts should call addEventProbe() to configure
custom events or high-level methods to configure architected
events. The Python implementation of addEventProbe() automatically
delays event type registration until after instantiation.

In order to support CPU switching and some combined counters (e.g.,
memory references synthesized from loads and stores), the PMU allows
multiple probes per event type. When creating a system that switches
between CPU models that share the same PMU, PMU events for all of the
CPU models can be registered with the PMU.

Kudos to Matt Horsnell for the initial gem5 implementation of the PMU.

9 years agosim: Add typedefs for PMU probe points
Andreas Sandberg [Thu, 16 Oct 2014 09:49:38 +0000 (05:49 -0400)]
sim: Add typedefs for PMU probe points

In order to show make PMU probe points usable across different PMU
implementations, we want a common probe interface. This patch the
namespace ProbePoins that contains typedefs for probe points that are
shared between multiple SimObjects. It also adds typedefs for the PMU
probe interface.

9 years agosim: Add support for serializing BitUnionXX
Andreas Sandberg [Thu, 16 Oct 2014 09:49:37 +0000 (05:49 -0400)]
sim: Add support for serializing BitUnionXX

BitUnion instances can normally not be used with the SERIALIZE_SCALAR
and UNSERIALIZE_SCALAR macros due to the way they are converted
between their storage type and their actual type. This changeset adds
a set of parm(In|Out) functions specifically for gem5 bit unions to
work around the issue.

9 years agoconfig: Add the ability to read a config file using C++ and Python
Andreas Hansson [Thu, 16 Oct 2014 09:49:37 +0000 (05:49 -0400)]
config: Add the ability to read a config file using C++ and Python

This patch adds the ability to load in config.ini files generated from
gem5 into another instance of gem5 built without Python configuration
support. The intended use case is for configuring gem5 when it is a
library embedded in another simulation system.

A parallel config file reader is also provided purely in Python to
demonstrate the approach taken and to provided similar functionality
for as-yet-unknown use models. The Python configuration file reader
can read both .ini and .json files.

C++ configuration file reading:

A command line option has been added for scons to enable C++ configuration
file reading: --with-cxx-config

There is an example in util/cxx_config that shows C++ configuration in action.
util/cxx_config/README explains how to build the example.

Configuration is achieved by the object CxxConfigManager. It handles
reading object descriptions from a CxxConfigFileBase object which
wraps a config file reader. The wrapper class CxxIniFile is provided
which wraps an IniFile for reading .ini files. Reading .json files
from C++ would be possible with a similar wrapper and a JSON parser.

After reading object descriptions, CxxConfigManager creates
SimObjectParam-derived objects from the classes in the (generated with this
patch) directory build/ARCH/cxx_config

CxxConfigManager can then build SimObjects from those SimObjectParams (in an
order dictated by the SimObject-value parameters on other objects) and bind
ports of the produced SimObjects.

A minimal set of instantiate-replacing member functions are provided by
CxxConfigManager and few of the member functions of SimObject (such as drain)
are extended onto CxxConfigManager.

Python configuration file reading (configs/example/read_config.py):

A Python version of the reader is also supplied with a similar interface to
CxxConfigFileBase (In Python: ConfigFile) to config file readers.

The Python config file reading will handle both .ini and .json files.

The object construction strategy is slightly different in Python from the C++
reader as you need to avoid objects prematurely becoming the children of other
objects when setting parameters.

Port binding also needs to be strictly in the same port-index order as the
original instantiation.

9 years agoscons: Add Undefined Behavior Sanitizer (UBSan) option
Andreas Hansson [Thu, 16 Oct 2014 09:49:36 +0000 (05:49 -0400)]
scons: Add Undefined Behavior Sanitizer (UBSan) option

This patch adds the Undefined Behavior Sanitizer (UBSan) for clang and
gcc >= 4.9. Due to the performance impact, the usage is guarded by a
command-line option.

9 years agoscons: Add --without-tcmalloc build option
Curtis Dunham [Mon, 22 Sep 2014 19:37:23 +0000 (14:37 -0500)]
scons: Add --without-tcmalloc build option

Disabling tcmalloc is required for valgrind's memcheck to work properly;
this option makes it easier to create such a build.

9 years agoscons: Generate a single debug flag C++ file
Curtis Dunham [Tue, 12 Aug 2014 22:35:28 +0000 (17:35 -0500)]
scons: Generate a single debug flag C++ file

Reduces target count/compiler invocations by ~180.

9 years agoscons: create dummy target to have SWIG generate C++ classes
Curtis Dunham [Thu, 16 Oct 2014 09:49:33 +0000 (05:49 -0400)]
scons: create dummy target to have SWIG generate C++ classes

scons build/<arch>/swig

9 years agoconfig: Add a --without-python option to build process
Andrew Bardsley [Thu, 16 Oct 2014 09:49:32 +0000 (05:49 -0400)]
config: Add a --without-python option to build process

Add the ability to build libgem5 without embedded Python or the
ability to configure with Python.

This is a prelude to a patch to allow config.ini files to be loaded
into libgem5 using only C++ which would make embedding gem5 within
other simulation systems easier.

This adds a few registration interfaces to things which cross
between Python and C++.  Namely: stats dumping and SimObject resolving

9 years agostats: Small bump of trailing stats
Andreas Hansson [Thu, 16 Oct 2014 09:49:31 +0000 (05:49 -0400)]
stats: Small bump of trailing stats

Somehow these seem to have been missed.

9 years agostats: updates due to changes to x86, stale configs.
Nilay Vaish [Sat, 11 Oct 2014 21:18:51 +0000 (16:18 -0500)]
stats: updates due to changes to x86, stale configs.

9 years agocpu: Fix o3 SMT IQCount bug
Andrew Lukefahr [Sat, 11 Oct 2014 21:16:02 +0000 (16:16 -0500)]
cpu: Fix o3 SMT IQCount bug

Commmitted by: Nilay Vaish <nilay@cs.wisc.edu>

9 years agoutil: adds a script for using DSENT
Nilay Vaish [Sat, 11 Oct 2014 21:16:00 +0000 (16:16 -0500)]
util: adds a script for using DSENT
This patch adds a python script that processes the configuration and the
statistics file from a simulation run.  Configuration and activity of network
routers and links obtained from this processing is fed to DSENT via its Python
interface.  DSENT then computes the area and the power consumption of these
network components.  The script outputs these quantities to the console.

9 years agoext: dsent: adds a Python interface, drops C++ one
Nilay Vaish [Sat, 11 Oct 2014 21:16:00 +0000 (16:16 -0500)]
ext: dsent: adds a Python interface, drops C++ one
This patch extensively modifies DSENT so that it can be accessed using Python.
To access the Python interface, DSENT needs to compiled as a shared library.
For this purpose a CMakeLists.txt file has been added.  Some of the code that
is not required is being removed.

9 years agoext: add the source code for DSENT
Nilay Vaish [Sat, 11 Oct 2014 20:02:23 +0000 (15:02 -0500)]
ext: add the source code for DSENT
This patch adds a tool called DSENT to the ext/ directory.  DSENT
is a tool that models power and area for on-chip networks.  The next
patch adds a script for using the tool.

9 years agoruby: network: garnet: add statistics for different activities
Nilay Vaish [Sat, 11 Oct 2014 20:02:23 +0000 (15:02 -0500)]
ruby: network: garnet: add statistics for different activities
This patch adds some statistics to garnet that record the activity
of certain structures in the on-chip network.  These statistics, in a later
patch, will be used for computing the energy consumed by the on-chip network.

9 years agoruby: network: garnet: remove functions for computing power
Nilay Vaish [Sat, 11 Oct 2014 20:02:23 +0000 (15:02 -0500)]
ruby: network: garnet: remove functions for computing power

9 years agoruby: drop Orion network power model
Nilay Vaish [Sat, 11 Oct 2014 20:02:23 +0000 (15:02 -0500)]
ruby: drop Orion network power model

Orion is being dropped from ruby.  It would be replaced with DSENT
which has better models.  Note that the power / energy numbers reported
after this patch has been applied are not for use.

9 years agoruby: mesi: slight renaming
Nilay Vaish [Sat, 11 Oct 2014 20:02:23 +0000 (15:02 -0500)]
ruby: mesi: slight renaming

9 years agoconfig: separate function for instantiating a memory controller
Nilay Vaish [Sat, 11 Oct 2014 20:02:23 +0000 (15:02 -0500)]
config: separate function for instantiating a memory controller
This patch moves code for instantiating a single memory controller from
the function config_mem() to a separate function.  This is being done
so that memory controllers can be instantiated without assuming that
they will be attached to the system in a particular fashion.

9 years agoruby: structures: coorect #ifndef macros in header files
Nilay Vaish [Sat, 11 Oct 2014 20:02:22 +0000 (15:02 -0500)]
ruby: structures: coorect #ifndef macros in header files

9 years agoruby: moesi hammer: correct typo in master-slave assignment
Nilay Vaish [Sat, 11 Oct 2014 20:02:22 +0000 (15:02 -0500)]
ruby: moesi hammer: correct typo in master-slave assignment

10 years agox86: add LongModeAddressSize function to cpuid
Jiuyue Ma [Fri, 13 Jun 2014 08:48:47 +0000 (16:48 +0800)]
x86: add LongModeAddressSize function to cpuid

LongModeAddressSize was used by kernel 2.6.28.4 for physical address
validation, if not properly implemented, PCI resource allocation may
failed because of ioremap failed:

- linux-2.6.28.4/arch/x86/mm/ioremap.c:27-30
  27 static inline int phys_addr_valid(unsigned long addr)
  28 {
  29     return addr < (1UL << boot_cpu_data.x86_phys_bits);
  30 }

- linux-2.6.28.4/arch/x86/kernel/cpu/common.c:475-482
 475 #ifdef CONFIG_X86_64
 476         if (c->extended_cpuid_level >= 0x80000008) {
 477                 u32 eax = cpuid_eax(0x80000008);
 478
 479                 c->x86_virt_bits = (eax >> 8) & 0xff;
 480                 c->x86_phys_bits = eax & 0xff;
 481         }
 482 #endif

- linux-2.6.28.4/arch/x86/mm/ioremap.c:209-214
 209 if (!phys_addr_valid(phys_addr)) {
 210     printk(KERN_WARNING "ioremap: invalid physical address %llx\n",
 211            (unsigned long long)phys_addr);
 212     WARN_ON_ONCE(1);
 213     return NULL;
 214 }

This patch return 0x0000ffff for LongModeAddressSize, which guarantee phys_addr_valid never failed.

Committed by: Nilay Vaish <nilay@cs.wisc.edu>

10 years agoconfig, x86: Ensure that PCI devs get bridged to the memory bus
Jiuyue Ma [Thu, 17 Jul 2014 04:05:41 +0000 (12:05 +0800)]
config, x86: Ensure that PCI devs get bridged to the memory bus

This patch force IO device to be mapped to 0xC0000000-0xFFFF0000 by
reserve anything between the end of memory and 3GB if memory is less
than 3GB. It also statically bridge these address range to the IO bus,
which guaranty access to pci address space will pass though bridge to
iobus.

Committed by: Nilay Vaish <nilay@cs.wisc.edu>

10 years agoconfig, x86: swap bus_id of ISA/PCI in X86 IntelMPTable
Jiuyue Ma [Thu, 17 Jul 2014 03:00:12 +0000 (11:00 +0800)]
config, x86: swap bus_id of ISA/PCI in X86 IntelMPTable

This patch assign bus_id=0 to PCI bus and bus_id=1 to ISA bus for
X86 platform. Because PCI device get config space address using
Pc::calcPciConfigAddr() which requires "assert(bus==0)".
This fixes PCI interrupt routing and discovery on Linux.

Committed by: Nilay Vaish <nilay@cs.wisc.edu>

9 years agosim: draining bug for fast-forwaring multiple cores stable_2014_12_14
Andrew Lukefahr [Sat, 11 Oct 2014 20:02:22 +0000 (15:02 -0500)]
sim: draining bug for fast-forwaring multiple cores
fix draining bug where multiple cores hit max_insts_any_thread simultaneously

Committed by: Nilay Vaish <nilay@cs.wisc.edu>

9 years agobase: addr range: slight change to validity check
Nilay Vaish [Sat, 11 Oct 2014 20:02:22 +0000 (15:02 -0500)]
base: addr range: slight change to validity check
The validity check is being changed from < to <= since the end of the range
is considered to be a part of it.

9 years agobase: misc: Add missing header file.
Nilay Vaish [Sat, 11 Oct 2014 20:02:22 +0000 (15:02 -0500)]
base: misc: Add missing header file.

9 years agostats: Add DRAM power statistics to reference output
Andreas Hansson [Thu, 9 Oct 2014 21:52:13 +0000 (17:52 -0400)]
stats: Add DRAM power statistics to reference output

9 years agomem: DRAMPower integration for on-line DRAM power stats
Omar Naji [Tue, 29 Jul 2014 16:22:44 +0000 (17:22 +0100)]
mem: DRAMPower integration for on-line DRAM power stats

This patch takes the final step in integrating DRAMPower and adds the
appropriate calls in the DRAM controller to provide the command trace
and extract the power and energy stats. The debug printouts are still
left in place, but will eventually be removed.

At the moment the DRAM power calculation is always on when using the
DRAM controller model. The run-time impact of this addition is around
1.5% when looking at the total host seconds of the regressions. We
deem this a sensible trade-off to avoid the complication of adding an
enable/disable mechanism.

9 years agomem: Add DRAMPower wrapping class
Omar Naji [Tue, 29 Jul 2014 16:29:36 +0000 (17:29 +0100)]
mem: Add DRAMPower wrapping class

This patch adds a class to wrap DRAMPower Library in gem5.
This class initiates an object of class MemorySpecification
of the DRAMPower Library, passes the parameters from DRAMCtrl.py
to this object and creates an object of drampower library using
the memory specification.

9 years agomem: Add missig timing and current parameters to DRAM configs
Omar Naji [Fri, 25 Jul 2014 09:05:59 +0000 (10:05 +0100)]
mem: Add missig timing and current parameters to DRAM configs

This patch adds missing timing and current parameters to the existing
DRAM configs. These missing timing and current parameters are required
by DRAMPower for the DRAM power calculations. The missing values are
datasheet values of the specified DRAMs, and the appropriate
references are added for the variuos configs.

9 years agomem: Remove DRAMSim2 DDR3 configuration
Omar Naji [Thu, 9 Oct 2014 21:52:04 +0000 (17:52 -0400)]
mem: Remove DRAMSim2 DDR3 configuration

This patch prunes the DDR3 config that was initially created to match
the default config of DRAMSim2. The config is not complete as it is,
and to avoid having to maintain it, the easiest way forward is to
simply prune it. Going forward we are adding power number etc to the
other configurations.

9 years agoext: Add DRAMPower to enable on-line DRAM power modelling
Andreas Hansson [Thu, 9 Oct 2014 21:52:03 +0000 (17:52 -0400)]
ext: Add DRAMPower to enable on-line DRAM power modelling

This patch adds the open-source (BSD 3-clause) tool DRAMPower, commit
8d3cf4bbb10aa202d850ef5e5e3e4f53aa668fa6, to be built as a part of the
simulator. We have chosen this specific version of DRAMPower as it
provides the necessary functionality, and future updates will be
coordinated with the DRAMPower development team. The files added only
include the bits needed to build the library, thus excluding all
memory specifications, traces, and the stand-alone DRAMPower
command-line tool.

A future patch includes the DRAMPower functionality in the DRAM
controller, to enable on-line DRAM power modelling, and avoid using
post-processing of traces.

9 years agoconfig: Add Current as a parameter type
Andreas Hansson [Thu, 9 Oct 2014 21:52:00 +0000 (17:52 -0400)]
config: Add Current as a parameter type

This patch adds the Python parameter type Current, which is used for
the DRAM power modelling (to start with). With this addition we avoid
implicit unit assumptions.

9 years agocpu: Remove Ozone CPU from the source tree
Mitch Hayenga [Thu, 9 Oct 2014 21:51:58 +0000 (17:51 -0400)]
cpu: Remove Ozone CPU from the source tree

The Ozone CPU is now very much out of date and completely
non-functional, with no one actively working on restoring it. It is a
source of confusion for new users who attempt to use it before
realizing its current state. RIP

9 years agoscons: Warn for known gcc and swig incompatibilities
Andreas Hansson [Thu, 9 Oct 2014 21:51:57 +0000 (17:51 -0400)]
scons: Warn for known gcc and swig incompatibilities

9 years agomem: Add packet sanity checks to cache and MSHRs
Andreas Hansson [Thu, 9 Oct 2014 21:51:56 +0000 (17:51 -0400)]
mem: Add packet sanity checks to cache and MSHRs

This patch adds a number of asserts to the cache, checking basic
assumptions about packets being requests or responses.

9 years agomem: Allow packet queue to move next send event forward
Andreas Hansson [Thu, 9 Oct 2014 21:51:52 +0000 (17:51 -0400)]
mem: Allow packet queue to move next send event forward

This patch changes the packet queue such that when scheduling a send,
the queue is allowed to move the event forward.

9 years agomisc: Fix issues identified by static analysis
Andreas Hansson [Wed, 1 Oct 2014 12:05:54 +0000 (08:05 -0400)]
misc: Fix issues identified by static analysis

Another bunch of issues addressed.

9 years agoarm: Use MiscRegIndex rather than int when flattening
Andreas Hansson [Wed, 1 Oct 2014 12:05:52 +0000 (08:05 -0400)]
arm: Use MiscRegIndex rather than int when flattening

Some additional type checking to avoid future issues.

9 years agoarm: More UBSan cleanups after additional full-system runs
Andreas Hansson [Wed, 1 Oct 2014 12:05:51 +0000 (08:05 -0400)]
arm: More UBSan cleanups after additional full-system runs

Some incorrect casting to IntRegIndex, and a few uninitialized members
in the i8254xGBe device.

9 years agostats: Update stats to reflect ARM fixes
Andreas Hansson [Sun, 28 Sep 2014 20:53:48 +0000 (16:53 -0400)]
stats: Update stats to reflect ARM fixes

As a result of the fixes, the full-system dual-core ARM regressions
are slightly changed. Hopefully this also means there will no longer
be any discrepancies between the results observed on different hosts.

9 years agoarm: Fixed undefined behaviours identified by gcc
Andreas Hansson [Sat, 27 Sep 2014 13:08:37 +0000 (09:08 -0400)]
arm: Fixed undefined behaviours identified by gcc

This patch fixes the runtime errors highlighted by the undefined
behaviour sanitizer. In the end there were two issues. First, when
rotating an immediate, we ended up shifting an uint32_t by 32 in some
cases. This case is fixed by checking for a rotation by 0
positions. Second, the Mrc15 and Mcr15 are operating on an IntReg and
a MiscReg, but we used the type RegRegImmOp and passed a MiscRegIndex
as an IntRegIndex. This issue is resolved by introducing a
MiscRegRegImmOp and RegMiscRegImmOp with the appropriate types.

With these fixes there are no runtime errors identified for the full
ARM regressions.

9 years agoarch: Use const StaticInstPtr references where possible
Andreas Hansson [Sat, 27 Sep 2014 13:08:36 +0000 (09:08 -0400)]
arch: Use const StaticInstPtr references where possible

This patch optimises the passing of StaticInstPtr by avoiding copying
the reference-counting pointer. This avoids first incrementing and
then decrementing the reference-counting pointer.

9 years agoscons: Address issues related to gcc 4.9.1
Andreas Hansson [Sat, 27 Sep 2014 13:08:34 +0000 (09:08 -0400)]
scons: Address issues related to gcc 4.9.1

Fix a number few minor issues to please gcc 4.9.1. Removing the
'-fuse-linker-plugin' flag means no libraries are part of the LTO
process, but hopefully this is an acceptable loss, as the flag causes
issues on a lot of systems (only certain combinations of gcc, ld and
ar work).

9 years agodev: Output invalid access size in IsaFake panic
Curtis Dunham [Sat, 27 Sep 2014 13:08:33 +0000 (09:08 -0400)]
dev: Output invalid access size in IsaFake panic

9 years agomem: Output precise range when XBar has conflicts
Curtis Dunham [Sat, 27 Sep 2014 13:08:32 +0000 (09:08 -0400)]
mem: Output precise range when XBar has conflicts

9 years agomem: Provide better diagnostic for unconnected port
Curtis Dunham [Sat, 27 Sep 2014 13:08:30 +0000 (09:08 -0400)]
mem: Provide better diagnostic for unconnected port

When _masterPort is null, a message to that effect is
more helpful than a segfault.

9 years agomisc: Fix a bunch of minor issues identified by static analysis
Andreas Hansson [Sat, 27 Sep 2014 13:08:29 +0000 (09:08 -0400)]
misc: Fix a bunch of minor issues identified by static analysis

Add some missing initialisation, and fix a handful benign resource
leaks (including some false positives).

9 years agostats: update t1000 stats for recent changes
Steve Reinhardt [Mon, 22 Sep 2014 03:04:39 +0000 (23:04 -0400)]
stats: update t1000 stats for recent changes

9 years agostats: update eio stats for recent changes
Steve Reinhardt [Sun, 21 Sep 2014 20:15:14 +0000 (16:15 -0400)]
stats: update eio stats for recent changes

9 years agostats: Bump stats for filter, crossbar and config changes
Andreas Hansson [Sat, 20 Sep 2014 21:18:53 +0000 (17:18 -0400)]
stats: Bump stats for filter, crossbar and config changes

This patch bumps the stats to reflect the addition of the snoop filter
and snoop stats, the change from bus to crossbar, and the updates to
the ARM regressions that are now using a different CPU and cache
configuration. Lastly, some minor changes are expected due to the
activation cleanup of the CPUs.

9 years agocpu: Remove unused deallocateContext calls
Mitch Hayenga [Sat, 20 Sep 2014 21:18:36 +0000 (17:18 -0400)]
cpu: Remove unused deallocateContext calls

The call paths for de-scheduling a thread are halt() and suspend(), from
the thread context. There is no call to deallocateContext() in general,
though some CPUs chose to define it. This patch removes the function
from BaseCPU and the cores which do not require it.

9 years agoalpha,arm,mips,power,x86,cpu,sim: Cleanup activate/deactivate
Mitch Hayenga [Sat, 20 Sep 2014 21:18:35 +0000 (17:18 -0400)]
alpha,arm,mips,power,x86,cpu,sim: Cleanup activate/deactivate

activate(), suspend(), and halt() used on thread contexts had an optional
delay parameter. However this parameter was often ignored. Also, when used,
the delay was seemily arbitrarily set to 0 or 1 cycle (no other delays were
ever specified). This patch removes the delay parameter and 'Events'
associated with them across all ISAs and cores. Unused activate logic
is also removed.

9 years agotests: Use more representative configs for ARM tests
Andreas Hansson [Sat, 20 Sep 2014 21:18:33 +0000 (17:18 -0400)]
tests: Use more representative configs for ARM tests

This patch changes the CPU and cache configurations used in the ARM SE and FS
regressions to make them more representative, and also get better code
coverage by exercising different replacement policies and use an L2
prefetcher.

9 years agomem: Rename Bus to XBar to better reflect its behaviour
Andreas Hansson [Sat, 20 Sep 2014 21:18:32 +0000 (17:18 -0400)]
mem: Rename Bus to XBar to better reflect its behaviour

This patch changes the name of the Bus classes to XBar to better
reflect the actual timing behaviour. The actual instances in the
config scripts are not renamed, and remain as e.g. iobus or membus.

As part of this renaming, the code has also been clean up slightly,
making use of range-based for loops and tidying up some comments. The
only changes outside the bus/crossbar code is due to the delay
variables in the packet.

--HG--
rename : src/mem/Bus.py => src/mem/XBar.py
rename : src/mem/coherent_bus.cc => src/mem/coherent_xbar.cc
rename : src/mem/coherent_bus.hh => src/mem/coherent_xbar.hh
rename : src/mem/noncoherent_bus.cc => src/mem/noncoherent_xbar.cc
rename : src/mem/noncoherent_bus.hh => src/mem/noncoherent_xbar.hh
rename : src/mem/bus.cc => src/mem/xbar.cc
rename : src/mem/bus.hh => src/mem/xbar.hh

9 years agotests: Add a memtest version using the ideal SnoopFilter
Andreas Hansson [Sat, 20 Sep 2014 21:18:30 +0000 (17:18 -0400)]
tests: Add a memtest version using the ideal SnoopFilter

This patch adds a basic regression test for the snoop filter.

--HG--
rename : tests/configs/memtest.py => tests/configs/memtest-filter.py

10 years agomem: Add access statistics for the snoop filter
Stephan Diestelhorst [Fri, 25 Apr 2014 11:36:16 +0000 (12:36 +0100)]
mem: Add access statistics for the snoop filter

Adds a simple access counter for requests and snoops for the snoop filter and
also classifies hits based on whether a single other holder existed or whether
multiple shares held the line.

9 years agomem: Tie in the snoop filter in the coherent bus
Stephan Diestelhorst [Sat, 20 Sep 2014 21:18:29 +0000 (17:18 -0400)]
mem: Tie in the snoop filter in the coherent bus

10 years agomem: Add a simple snoop counter per bus
Stephan Diestelhorst [Thu, 24 Apr 2014 12:28:47 +0000 (13:28 +0100)]
mem: Add a simple snoop counter per bus

This patch adds a simple counter for both total messages and a histogram for
the fan-out of snoop messages.  The fan-out describes to how many ports snoops
had to be sent per incoming request / snoop-from-below.  Without any
cleverness, this usually means to either all, or all but the requesting port.

10 years agomisc: Add functions for doing popcount and power-of-two checking
Stephan Diestelhorst [Thu, 24 Apr 2014 16:41:26 +0000 (17:41 +0100)]
misc: Add functions for doing popcount and power-of-two checking

Adds two public domain algorithms for determining number of set bits and also
whether a value is a power of two, uses the builtin that is available in GCC
and clang for popcount.

9 years agomem: Simple Snoop Filter
Stephan Diestelhorst [Sat, 20 Sep 2014 21:18:26 +0000 (17:18 -0400)]
mem: Simple Snoop Filter

This is a first cut at a simple snoop filter that tracks presence of lines in
the caches "above" it. The snoop filter can be applied at any given cache
hierarchy and will then handle the caches above it appropriately; there is no
need to use this only in the last-level bus.

This design currently has some limitations: missing stats, no notion of clean
evictions (these will not update the underlying snoop filter, because they are
not sent from the evicting cache down), no notion of capacity for the snoop
filter and thus no need for invalidations caused by capacity pressure in the
snoop filter. These are planned to be added on top with future change sets.

9 years agoenergy: Tighter checking of levels for DFS systems
Stephan Diestelhorst [Tue, 12 Aug 2014 18:00:44 +0000 (19:00 +0100)]
energy: Tighter checking of levels for DFS systems

There are cases where users might by accident / intention specify less voltage
operating points thatn frequency points.  We consider one of these cases
special: giving only a single voltage to a voltage domain effectively renders
it as a static domain.  This patch adds additional logic in the auxiliary parts
of the functionality to handle these cases properly (simple driver asking for
N>1 operating levels, we should return the same voltage for all of them) and
adds error checking code in the voltage domain.

9 years agoenergy: Add the Energy Controller in the right configs
Stephan Diestelhorst [Fri, 25 Jul 2014 12:36:23 +0000 (13:36 +0100)]
energy: Add the Energy Controller in the right configs

Tie in the newly created energy controller components in the default
configurations.

9 years agoenergy: Memory-mapped Energy Controller component
Akash Bagdia [Sat, 20 Sep 2014 21:18:23 +0000 (17:18 -0400)]
energy: Memory-mapped Energy Controller component

This patch provides an Energy Controller device that provides software
(driver) access to a DVFS handler. The device is currently residing in
the dev/arm tree, but there is nothing inherently ARM specific in the
behaviour. It is currently only tested and supported for ARM Linux,
hence the location.

10 years agoenergy: Small extentions and fixes for DVFS handler
Stephan Diestelhorst [Mon, 16 Jun 2014 13:59:44 +0000 (14:59 +0100)]
energy: Small extentions and fixes for DVFS handler

These additions allow easier interoperability with and querying from an
additional controller which will be in a separate patch.  Also adding warnings
for changing the enabled state of the handler across checkpoint / resume and
deviating from the state in the configuration.

Contributed-by: Akash Bagdia <akash.bagdia@arm.com>