gem5.git
10 years agocpu: Fix Checker register index use
Andreas Hansson [Fri, 15 Nov 2013 08:47:10 +0000 (03:47 -0500)]
cpu: Fix Checker register index use

This patch fixes an issue in the checker CPU register indexing. The
code will not even compile using LTO as deep inlining causes the used
index to be outside the array bounds.

10 years agotests: suppress output on switcheroo tests
Steve Reinhardt [Thu, 14 Nov 2013 23:03:42 +0000 (15:03 -0800)]
tests: suppress output on switcheroo tests

The output from the switcheroo tests is voluminous and
(because it includes timestamps) highly sensitive to
minor changes, leading to extremely large updates to the
reference outputs.  This patch addresses this problem
by suppressing output from the tests.  An internal
parameter can be set to enable the output.  Wiring that
up to a command-line flag (perhaps even the rudimantary
-v/-q options in m5/main.py) is left for future work.

10 years agosim: fix event priority name for debug-start option
Anthony Gutierrez [Tue, 12 Nov 2013 16:46:48 +0000 (11:46 -0500)]
sim: fix event priority name for debug-start option

10 years agostats: Bump stats to match DRAM controller changes
Andreas Hansson [Fri, 1 Nov 2013 15:56:34 +0000 (11:56 -0400)]
stats: Bump stats to match DRAM controller changes

This patch encompasses all the stats updates needed to reflect the
changes to the DRAM controller.

10 years agomem: Fixes for DRAM stats accounting
Andreas Hansson [Fri, 1 Nov 2013 15:56:31 +0000 (11:56 -0400)]
mem: Fixes for DRAM stats accounting

This patch fixes a number of stats accounting issues in the DRAM
controller. Most importantly, it separates the system interface and
DRAM interface so that it is clearer what the actual DRAM bandwidth
(and consequently utilisation) is.

10 years agomem: Fix the LPDDR3 page size
Andreas Hansson [Fri, 1 Nov 2013 15:56:30 +0000 (11:56 -0400)]
mem: Fix the LPDDR3 page size

This patch corrects the LPDDR3 page size, which was set too low.

10 years agomem: Adding stats for DRAM power calculation
Neha Agarwal [Fri, 1 Nov 2013 15:56:28 +0000 (11:56 -0400)]
mem: Adding stats for DRAM power calculation

This patch adds stats which are used for offline power calculation
from the 'Micron Power Calculator' spreadsheet.

10 years agomem: Unify request selection for read and write queues
Neha Agarwal [Fri, 1 Nov 2013 15:56:27 +0000 (11:56 -0400)]
mem: Unify request selection for read and write queues

This patch unifies the request selection across read and write queues
for FR-FCFS scheduling policy. It also fixes the request selection
code to prioritize the row hits present in the request queues over the
selection based on earliest bank availability.

10 years agomem: Add a simple adaptive version of the open-page policy
Andreas Hansson [Fri, 1 Nov 2013 15:56:26 +0000 (11:56 -0400)]
mem: Add a simple adaptive version of the open-page policy

This patch adds a basic adaptive version of the open-page policy that
guides the decision to keep open or close by looking at the contents
of the controller queues. If no row hits are found, and bank conflicts
are present, then the row is closed by means of an auto
precharge. This is a well-known technique that should improve
performance in most use-cases.

10 years agomem: Just-in-time write scheduling in DRAM controller
Neha Agarwal [Fri, 1 Nov 2013 15:56:25 +0000 (11:56 -0400)]
mem: Just-in-time write scheduling in DRAM controller

This patch removes the untimed while loop in the write scheduling
mechanism and now schedule commands taking into account the minimum
timing constraint. It also introduces an optimization to track write
queue size and switch from writes to reads if the number of write
requests fall below write low threshold.

10 years agomem: Add tRRD as a timing parameter for the DRAM controller
Andreas Hansson [Fri, 1 Nov 2013 15:56:24 +0000 (11:56 -0400)]
mem: Add tRRD as a timing parameter for the DRAM controller

This patch adds the tRRD parameter to the DRAM controller. With the
recent addition of the actAllowedAt member for each bank, this
addition is trivial.

10 years agomem: Less conservative tRAS in DRAM configurations
Andreas Hansson [Fri, 1 Nov 2013 15:56:23 +0000 (11:56 -0400)]
mem: Less conservative tRAS in DRAM configurations

This patch changes the default values of the tRAS timing parameter to
be less conservative, and closer in line with existing parts.

10 years agomem: Make tXAW enforcement less conservative and per rank
Ani Udipi [Fri, 1 Nov 2013 15:56:22 +0000 (11:56 -0400)]
mem: Make tXAW enforcement less conservative and per rank

This patch changes the tXAW constraint so that it is enforced per rank
rather than globally for all ranks in the channel. It also avoids
using the bank freeAt to enforce the activation limit, as doing so
also precludes performing any column or row command to the
DRAM. Instead the patch introduces a new variable actAllowedAt for the
banks and use this to track when a potential activation can occur.

10 years agomem: Fix for 100% write threshold in DRAM controller
Neha Agarwal [Fri, 1 Nov 2013 15:56:21 +0000 (11:56 -0400)]
mem: Fix for 100% write threshold in DRAM controller

This patch fixes the controller when a write threshold of 100% is
used.  Earlier for 100% write threshold no data is written to memory
as writes never get triggered since this corner case is not
considered.

10 years agomem: Pick the next DRAM request based on bank availability
Andreas Hansson [Fri, 1 Nov 2013 15:56:20 +0000 (11:56 -0400)]
mem: Pick the next DRAM request based on bank availability

This patch changes the FCFS bit of FR-FCFS such that requests that
target the earliest available bank are picked first (as suggested in
the original work on FR-FCFS by Rixner et al). To accommodate this we
add functionality to identify a bank through a one-dimensional
identifier (bank id). The member names of the DRAMPacket are also
update to match the style guide.

10 years agomem: Use the same timing calculation for DRAM read and write
Ani Udipi [Fri, 1 Nov 2013 15:56:19 +0000 (11:56 -0400)]
mem: Use the same timing calculation for DRAM read and write

This patch simplifies the DRAM model by re-using the function that
computes the busy and access time for both reads and writes.

10 years agomem: Fix DRAM bank occupancy for streaming access
Ani Udipi [Fri, 1 Nov 2013 15:56:18 +0000 (11:56 -0400)]
mem: Fix DRAM bank occupancy for streaming access

This patch fixes an issue that allowed more than 100% bus utilisation
in certain cases.

10 years agomem: Schedule time for DRAM event taking tRAS into account
Ani Udipi [Fri, 1 Nov 2013 15:56:17 +0000 (11:56 -0400)]
mem: Schedule time for DRAM event taking tRAS into account

This patch changes the time the controller is woken up to take the
next scheduling decisions. tRAS is now handled in estimateLatency and
doDRAMAccess and we do not need to worry about it at scheduling
time. The earliest we need to wake up is to do a pre-charge, row
access and column access before the bus becomes free for use.

10 years agomem: Add tRAS parameter to the DRAM controller model
Ani Udipi [Fri, 1 Nov 2013 15:56:16 +0000 (11:56 -0400)]
mem: Add tRAS parameter to the DRAM controller model

This patch adds an explicit tRAS parameter to the DRAM controller
model. Previously tRAS was, rather conservatively, assumed to be tRCD
+ tCL + tRP. The default values for tRAS are chosen to match the
previous behaviour and will be updated later.

10 years agostats: Bump stats after shifting to SimpleMemory
Andreas Hansson [Fri, 1 Nov 2013 15:56:15 +0000 (11:56 -0400)]
stats: Bump stats after shifting to SimpleMemory

Match stats with new regression configs.

10 years agotest: Use SimpleMemory for atomic full-system tests
Andreas Hansson [Fri, 1 Nov 2013 15:56:14 +0000 (11:56 -0400)]
test: Use SimpleMemory for atomic full-system tests

Keep it simple and use the SimpleMemory rather than the DRAM
controller model for atomic full-system tests.

10 years agosim: Clarify the difference between tracing and debugging
Andreas Hansson [Fri, 1 Nov 2013 15:56:13 +0000 (11:56 -0400)]
sim: Clarify the difference between tracing and debugging

This patch changes the name the command-line options related to debug
output to all start with "debug" rather than being a mix of that and
"trace". It also makes it clear that the breakpoint time is specified
in ticks and not in cycles.

10 years agoARM: add support for TEEHBR access
Chander Sudanthi [Thu, 31 Oct 2013 18:41:13 +0000 (13:41 -0500)]
ARM: add support for TEEHBR access

Thumb2 ARM kernels may access the TEEHBR via thumbee_notifier
in arch/arm/kernel/thumbee.c.  The Linux kernel code just seems
to be saving and restoring the register.  This patch adds support
for the TEEHBR cp14 register.  Note, this may be a special case
when restoring from an image that was run on a system that
supports ThumbEE.

10 years agodev: Add 'OSC' oscillator sys control reg support to VersatileExpress
Matt Evans [Thu, 31 Oct 2013 18:41:13 +0000 (13:41 -0500)]
dev: Add 'OSC' oscillator sys control reg support to VersatileExpress

The VE motherboard provides a set of system control registers through which
various motherboard and coretile registers are accessed.  Voltage regulators and
oscillator (DLL/PLL) config are examples. These registers must be impleted to
boot Linux 3.9+ kernels.

10 years agodev: Add support for MSI-X and Capability Lists for ARM and PCI devices
Geoffrey Blake [Thu, 31 Oct 2013 18:41:13 +0000 (13:41 -0500)]
dev: Add support for MSI-X and Capability Lists for ARM and PCI devices

This patch adds the registers and fields to the PCI device to support
Capability lists and to support MSI-X in the GIC.

10 years agodev: Fix race conditions in IDE device on newer kernels
Geoffrey Blake [Thu, 31 Oct 2013 18:41:13 +0000 (13:41 -0500)]
dev: Fix race conditions in IDE device on newer kernels

Newer linux kernels and distros exercise more functionality in the IDE device
than previously, exposing 2 races. The first race is the handling of aborted
DMA commands would immediately report the device is ready back to the kernel
and cause already in flight commands to assert the simulator when they returned
and discovered an inconsitent device state.  The second race was due to the
Status register not being handled correctly, the interrupt status bit would get
stuck at 1 and the driver eventually views this as a bad state and logs the
condition to the terminal.  This patch fixes these two conditions by making the
device handle aborted commands gracefully and properly handles clearing the
interrupt status bit in the Status register.

10 years agobase: Add support for ipv6 into inet.hh/inet.cc
Geoffrey Blake [Thu, 31 Oct 2013 18:41:13 +0000 (13:41 -0500)]
base: Add support for ipv6 into inet.hh/inet.cc

10 years agocpu: Construct ROB with cpu params struct instead of each variable
Faissal Sleiman [Thu, 31 Oct 2013 18:41:13 +0000 (13:41 -0500)]
cpu: Construct ROB with cpu params struct instead of each variable

Most other structures/stages get passed the cpu params struct.

10 years agoconfig: Fix handling of parents for simobject vectors
Geoffrey Blake [Thu, 31 Oct 2013 18:41:13 +0000 (13:41 -0500)]
config: Fix handling of parents for simobject vectors

SimObjectVector objects did not provide the same interface to
the _parent attribute through get_parent() like a normal
SimObject.  It also handled assigning a _parent incorrectly
if objects in a SimObjectVector were changed post-creation,
leading to errors later when the simulator tried to execute.
This patch fixes these two omissions.

10 years agosim: added option to serialize SimLoopExitEvent
Dam Sunwoo [Thu, 31 Oct 2013 18:41:13 +0000 (13:41 -0500)]
sim: added option to serialize SimLoopExitEvent

SimLoopExitEvents weren't serialized by default. Some benchmarks
utilize a delayed m5 exit pseudo op call to terminate the simulation
and this event was lost when resuming from a checkpoint generated
after the pseudo op call. This patch adds the capability to serialize
the SimLoopExitEvents and enable serialization for m5_exit and m5_fail
pseudo ops by default. Does not affect other generic
SimLoopExitEvents.

10 years agomem: Add "const" attribute to Packet getters
Stephan Diestelhorst [Thu, 31 Oct 2013 18:41:13 +0000 (13:41 -0500)]
mem: Add "const" attribute to Packet getters

Add a "const" keywords to the getters in the Packet class so these can be
invoked on const Packet objects.

10 years agomem: Add privilege info to request class
Prakash Ramrakhyani [Thu, 31 Oct 2013 18:41:13 +0000 (13:41 -0500)]
mem: Add privilege info to request class

This patch adds a flag in the request class that indicates if the request
was made in privileged mode.

10 years agoarm: fix m5ops binary for ARM and add m5fail.
Ali Saidi [Thu, 31 Oct 2013 18:41:13 +0000 (13:41 -0500)]
arm: fix m5ops binary for ARM and add m5fail.

Changes to make m5ops work under virtualization seemed to break them working
with non-virtualized systems and the recently added m5 fail command makes
the m5op binary not compile.  For now remove the code for virtualization.

10 years agocpu: Fix O3 issuse with load+barrier instructions.
Ali Saidi [Thu, 31 Oct 2013 18:41:13 +0000 (13:41 -0500)]
cpu: Fix O3 issuse with load+barrier instructions.

Fix a problem in the O3 CPU for instructions that are both
memory loads and memory barriers (e.g. load acquire) and
to uncacheable memory. This combination can confuse the
commit stage into commitng an instruction that hasn't
executed and got it's value yet. At the same time refactor
the code slightly to remove duplication between two of
the cases.

10 years agoruby: set SenderMachine in messages of MOESI_CMP_directory
Lluc Alvarez [Wed, 30 Oct 2013 15:35:06 +0000 (10:35 -0500)]
ruby: set SenderMachine in messages of MOESI_CMP_directory
This patch adds missing initializations of the SenderMachine field of
out_msg's when thery are created in the L2 cache controller of the
MOESI_CMP_directory coherence protocol. When an out_msg is created and this
field is left uninitialized, it is set to the default value MachineType_NUM.
This causes a panic in the MachineType_to_string function when gem5 is
executed with the Ruby debug flag on and it tries to print the message.

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

10 years agoruby: Fixed a deadlock when restoring a checkpoint with garnet
Emilio Castillo [Wed, 30 Oct 2013 15:35:05 +0000 (10:35 -0500)]
ruby: Fixed a deadlock when restoring a checkpoint with garnet
This patch fixes a problem where in Garnet, the enqueue time in the
VCallocator and the SWallocator which is of type Cycles was being stored
inside a variable with int type.

This lead to a known problem restoring checkpoints with garnet & the fixed
pipeline enabled. That value was really big and didn't fit in the variable
overflowing it, therefore some conditions on the VC allocation stage & the
SW allocation stage were not met and the packets didn't advance through the
network, leading to a deadlock panic right after the checkpoint was restored.

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

10 years agomem: De-virtualise interfaces in the CoherentBus
Stephan Diestelhorst [Thu, 17 Oct 2013 15:20:45 +0000 (10:20 -0500)]
mem: De-virtualise interfaces in the CoherentBus

The CoherentBus eventually got virtual methods for its interface. The
"virtuality" of the CoherentBus, however, comes already from the virtual
interface of the bus' ports. There is no need to add another layer of virtual
functions, here.

10 years agocpu: add consistent guarding to *_impl.hh files.
Matt Horsnell [Thu, 17 Oct 2013 15:20:45 +0000 (10:20 -0500)]
cpu: add consistent guarding to *_impl.hh files.

10 years agomem: Add PortID to QueuedMasterPort constructor
Sascha Bischoff [Thu, 17 Oct 2013 15:20:45 +0000 (10:20 -0500)]
mem: Add PortID to QueuedMasterPort constructor

This patch adds the PortID to the QueuedMasterPort. This allows a PortID to be
specified as it previously was set to the detault value of -1.

10 years agoarm: Add a 'clear PPI' method to gic_pl390
Matt Evans [Thu, 17 Oct 2013 15:20:45 +0000 (10:20 -0500)]
arm: Add a 'clear PPI' method to gic_pl390

The underlying assumption that all PPIs must be edge-triggered is
strained when the architected timers and VGIC interfaces make
level-behaviour observable. For example, a virtual timer interrupt
'goes away' when the hypervisor is entered and the vtimer is disabled;
this requires a PPI to be de-activated.

The new method simply clears the interrupt pending state.

10 years agoconfig: Fix ommission of number base in ethernet address param
Geoffrey Blake [Thu, 17 Oct 2013 15:20:45 +0000 (10:20 -0500)]
config: Fix ommission of number base in ethernet address param

The ethernet address param tries to convert a hexadecimal
string using int() in python, which defaults to base 10,
need to specify base 16 in this case.

10 years agoconfig: Fix for port references generated multiple times
Geoffrey Blake [Thu, 17 Oct 2013 15:20:45 +0000 (10:20 -0500)]
config: Fix for port references generated multiple times

SimObjects are expected to only generate one port reference per
port belonging to them.  There is a subtle bug with using "not"
here as a VectorPort is seen as not having a reference if it is
either None or empty as per Python docs sec 9.9 for Standard operators.
Intended behavior is to only check if we have not created the reference.

10 years agodev: Add option to disable framebuffer .bmp dump in run folder
Dam Sunwoo [Thu, 17 Oct 2013 15:20:45 +0000 (10:20 -0500)]
dev: Add option to disable framebuffer .bmp dump in run folder

There is an option to enable/disable all framebuffer dumps, but the
last frame always gets dumped in the run folder with no other way to
disable it. These files can add up very quickly running many experiments.

This patch adds an option to disable them. The default behavior
remains unchanged.

10 years agocpu: Removing an unused variable in rename
Faissal Sleiman [Thu, 17 Oct 2013 15:20:45 +0000 (10:20 -0500)]
cpu: Removing an unused variable in rename

10 years agocpu: Change IEW DPRINTF to use IEW debug flag
Faissal Sleiman [Thu, 17 Oct 2013 15:20:45 +0000 (10:20 -0500)]
cpu: Change IEW DPRINTF to use IEW debug flag

IEW DPRINTF uses Decode debug flag, which appears to be a copying error. This
patch changes this to the IEW Debug flag.

10 years agocpu: Put in assertions to check for maximum supported LQ/SQ size
Faissal Sleiman [Thu, 17 Oct 2013 15:20:45 +0000 (10:20 -0500)]
cpu: Put in assertions to check for maximum supported LQ/SQ size

LSQSenderState represents the LQ/SQ index using uint8_t, which supports up to
 256 entries (including the sentinel entry). Sending packets to memory with a
higher index than 255 truncates the index, such that the response matches the
wrong entry. For instance, this can result in a deadlock if a store completion
does not clear the head entry.

10 years agoutil: Streamline .apc project convertsion script
Dam Sunwoo [Thu, 17 Oct 2013 15:20:45 +0000 (10:20 -0500)]
util: Streamline .apc project convertsion script

This Python script generates an ARM DS-5 Streamline .apc project based
on gem5 run. To successfully convert, the gem5 runs needs to be run
with the context-switch-based stats dump option enabled (The guest
kernel also needs to be patched to allow gem5 interrogate its task
information.) See help for more information.

10 years agoarm: Accomodate function name changes in newer linux kernels
Eric Van Hensbergen [Thu, 17 Oct 2013 15:20:45 +0000 (10:20 -0500)]
arm: Accomodate function name changes in newer linux kernels

10 years agoarm: Fix a GIC mask register bug
Ali Saidi [Thu, 17 Oct 2013 15:20:45 +0000 (10:20 -0500)]
arm: Fix a GIC mask register bug

This resulted in a kernel printk that said,
"GIC CPU mask not found - kernel will fail to boot."

10 years agocpu: Fix O3 uncacheable load that is replayed but misses the TLB
Ali Saidi [Thu, 17 Oct 2013 15:20:45 +0000 (10:20 -0500)]
cpu: Fix O3 uncacheable load that is replayed but misses the TLB

This change fixes an issue in the O3 CPU where an uncachable instruction
is attempted to be executed before it reaches the head of the ROB. It is
determined to be uncacheable, and is replayed, but a PanicFault is attached
to the instruction to make sure that it is properly executed before
committing. If the TLB entry it was using is replaced in the interveaning
time, the TLB returns a delayed translation when the load is replayed at
the head of the ROB, however the LSQ code can't differntiate between the
old fault and the new one. If the translation isn't complete it can't
be faulting, so clear the fault.

10 years agomem: Make MemoryAccess flag more verbose
Ali Saidi [Thu, 17 Oct 2013 15:20:45 +0000 (10:20 -0500)]
mem: Make MemoryAccess flag more verbose

This patch extends the MemoryAccess debug flag to report who sent the
requests and the cacheability.

10 years agobuild: Place proto output in the same directory, also for EXTRAS
Andreas Hansson [Thu, 17 Oct 2013 15:20:45 +0000 (10:20 -0500)]
build: Place proto output in the same directory, also for EXTRAS

This patch changes the ProtoBuf builder such that the generated source
and header is placed in the build directory of the proto file. This
was previously not the case for the directories included as EXTRAS. To
make this work, we also ensure that the build directory for the EXTRAS
are added to the include path (which does not seem to automatically be
the case).

10 years agoarm, config: Fix a small issue with the dtb file being specified
Ali Saidi [Thu, 17 Oct 2013 15:20:45 +0000 (10:20 -0500)]
arm, config: Fix a small issue with the dtb file being specified

10 years agoconfig: Fix memtest example script
Ali Saidi [Thu, 17 Oct 2013 15:20:45 +0000 (10:20 -0500)]
config: Fix memtest example script

10 years agodev: Allow additional UART interrupts to be set
Ali Saidi [Thu, 17 Oct 2013 15:20:45 +0000 (10:20 -0500)]
dev: Allow additional UART interrupts to be set

This patch allows setting a few additional interrupts for status
changes that should never occur.

10 years agobuild: Enable color diagnostics in clang by preserving TERM.
Stan Czerniawski [Thu, 17 Oct 2013 15:20:45 +0000 (10:20 -0500)]
build: Enable color diagnostics in clang by preserving TERM.

10 years agokvm: Fix latency calculation of IPR accesses
Andreas Sandberg [Wed, 16 Oct 2013 16:12:15 +0000 (18:12 +0200)]
kvm: Fix latency calculation of IPR accesses

When handling IPR accesses in doMMIOAccess, the KVM CPU used
clockEdge() to convert between cycles and ticks. This is incorrect
since doMMIOAccess is supposed to return a latency in ticks rather
than when the access is done. This changeset fixes this issue by
returning clockPeriod() * ipr_delay instead.

10 years agotest: update stats
Steve Reinhardt [Wed, 16 Oct 2013 14:44:12 +0000 (10:44 -0400)]
test: update stats

Update stats for recent changes.  Mostly minor changes
in register access stats due to addition of new cc
register type and slightly different (and more accurate)
classification of int vs. fp register accesses.

10 years agoruby: eliminate non-determinism from ruby.stats output
Steve Reinhardt [Tue, 15 Oct 2013 22:22:49 +0000 (18:22 -0400)]
ruby: eliminate non-determinism from ruby.stats output

Get rid of non-deterministic "stats" in ruby.stats output
such as time & date of run, elapsed & CPU time used,
and memory usage.  These values cause spurious
miscomparisons when looking at output diffs (though
they don't affect regressions, since the regressions
pass/fail status currently ignores ruby.stats entirely).

Most of this information is already captured in other
places (time & date in stdout, elapsed time & mem usage
in stats.txt), where the regression script is smart
enough to filter it out.  It seems easier to get rid of
the redundant output rather than teaching the
regression tester to ignore the same information in
two different places.

10 years agoscons: fix minor update-ref bug in regressions
Steve Reinhardt [Tue, 15 Oct 2013 22:22:41 +0000 (18:22 -0400)]
scons: fix minor update-ref bug in regressions

In the unusual case that regressions are run with --update-ref
when there is no existing regression output, scons gets
confused because it depends on stats.txt to trigger the
update, but it has no indication that running the test will
generate the stats.txt file.  (In the typical case where
stats.txt already exists, scons doesn't care about where
it came from.)

It's easy to fix this just by adding the stats.txt file
to the target list for the test action.

10 years agoarch/x86: add support for explicit CC register file
Yasuko Eckert [Tue, 15 Oct 2013 18:22:44 +0000 (14:22 -0400)]
arch/x86: add support for explicit CC register file

Convert condition code registers from being specialized
("pseudo") integer registers to using the recently
added CC register class.

Nilay Vaish also contributed to this patch.

10 years agocpu: add a condition-code register class
Yasuko Eckert [Tue, 15 Oct 2013 18:22:44 +0000 (14:22 -0400)]
cpu: add a condition-code register class

Add a third register class for condition codes,
in parallel with the integer and FP classes.
No ISAs use the CC class at this point though.

10 years agocpu/o3: clean up rename map and free list
Steve Reinhardt [Tue, 15 Oct 2013 18:22:44 +0000 (14:22 -0400)]
cpu/o3: clean up rename map and free list

Restructured rename map and free list to clean up some
extraneous code and separate out common code that can
be reused across different register classes (int and fp
at this point).  Both components now consist of a set
of Simple* objects that are stand-alone rename map &
free list for each class, plus a Unified* object that
presents a unified interface across all register
classes and then redirects accesses to the appropriate
Simple* object as needed.

Moved free list initialization to PhysRegFile to better
isolate knowledge of physical register index mappings
to that class (and remove the need to pass a number
of parameters to the free list constructor).

Causes a small change to these stats:
  cpu.rename.int_rename_lookups
  cpu.rename.fp_rename_lookups
because they are now categorized on a per-operand basis
rather than a per-instruction basis.
That is, an instruction with mixed fp/int/misc operand
types will have each operand categorized independently,
where previously the lookup was categorized based on
the instruction type.

10 years agocpu: rename *_DepTag constants to *_Reg_Base
Steve Reinhardt [Tue, 15 Oct 2013 18:22:43 +0000 (14:22 -0400)]
cpu: rename *_DepTag constants to *_Reg_Base

Make these names more meaningful.

Specifically, made these substitutions:

s/FP_Base_DepTag/FP_Reg_Base/g;
s/Ctrl_Base_DepTag/Misc_Reg_Base/g;
s/Max_DepTag/Max_Reg_Index/g;

10 years agoisa: clean up register constants
Steve Reinhardt [Tue, 15 Oct 2013 18:22:43 +0000 (14:22 -0400)]
isa: clean up register constants

Clean up and add some consistency to the *_Base_DepTag
constants as well as some related register constants:
- Get rid of NumMiscArchRegs, TotalArchRegs, and TotalDataRegs
  since they're never used and not always defined
- Set FP_Base_DepTag = NumIntRegs when possible (i.e.,
  every case except x86)
- Set Ctrl_Base_DepTag = FP_Base_DepTag + NumFloatRegs
  (this was true before, but wasn't always expressed
  that way)
- Drastically reduce the number of arbitrary constants
  appearing in these calculations

10 years agocpu/o3: clean up scoreboard object
Steve Reinhardt [Tue, 15 Oct 2013 18:22:43 +0000 (14:22 -0400)]
cpu/o3: clean up scoreboard object

It had a bunch of fields (and associated constructor
parameters) thet it didn't really use, and the array
initialization was needlessly verbose.

Also just hardwired the getReg() method to aleays
return true for misc regs, rather than having an array
of bits that we always kept marked as ready.

10 years agocpu/o3: clean up physical register file
Steve Reinhardt [Tue, 15 Oct 2013 18:22:43 +0000 (14:22 -0400)]
cpu/o3: clean up physical register file

No need for PhysRegFile to be a template class, or
have a pointer back to the CPU.  Also made some methods
for checking the physical register type (int vs. float)
based on the phys reg index, which will come in handy later.

10 years agocpu/inorder: merge register class enums
Steve Reinhardt [Tue, 15 Oct 2013 18:22:43 +0000 (14:22 -0400)]
cpu/inorder: merge register class enums

The previous patch introduced a RegClass enum to clean
up register classification.  The inorder model already
had an equivalent enum (RegType) that was used internally.
This patch replaces RegType with RegClass to get rid
of the now-redundant code.

10 years agocpu: clean up architectural register classification
Steve Reinhardt [Tue, 15 Oct 2013 18:22:42 +0000 (14:22 -0400)]
cpu: clean up architectural register classification

Move from a poorly documented scheme where the mapping
of unified architectural register indices to register
classes is hardcoded all over to one where there's an
enum for the register classes and a function that
encapsulates the mapping.

10 years agomem: Rename the ASI_BITS flag field in Request
Andreas Sandberg [Tue, 15 Oct 2013 11:26:34 +0000 (13:26 +0200)]
mem: Rename the ASI_BITS flag field in Request

ASI_BITS in the Request object were originally used to store a memory
request's ASI on SPARC. This is not the case any more since other ISAs
use the ASI bits to store architecture-dependent information. This
changeset renames the ASI_BITS to ARCH_BITS which better describes
their use. Additionally, the getAsi() accessor is renamed to
getArchFlags().

10 years agomem: Use a flag instead of address bit 63 for generic IPRs
Andreas Sandberg [Tue, 15 Oct 2013 11:24:35 +0000 (13:24 +0200)]
mem: Use a flag instead of address bit 63 for generic IPRs

Using address bit 63 to identify generic IPRs caused problems on
SPARC, where IPRs are heavily used. This changeset redefines how
generic IPRs are identified. Instead of using bit 63, we now use a
separate flag (GENERIC_IPR) a memory request.

10 years agoAdded tag stable_2013_10_14 to the changeset 6a043adb1e8d
Nilay Vaish [Mon, 14 Oct 2013 18:58:02 +0000 (13:58 -0500)]
Added tag stable_2013_10_14 to the changeset 6a043adb1e8d

10 years agoconfig: correct example ruby scripts
Nilay Vaish [Wed, 9 Oct 2013 22:28:14 +0000 (17:28 -0500)]
config: correct example ruby scripts
A couple of recent changesets added/deleted/edited some variables
that are needed for running the example ruby scripts. This changeset
edits these scripts to bring them to a working state.

10 years agostats: Bump pc-simple-timing-ruby stats
Andreas Hansson [Wed, 9 Oct 2013 08:41:19 +0000 (04:41 -0400)]
stats: Bump pc-simple-timing-ruby stats

This patch simply brings the stats for the pc-simple-timing-ruby
regression up to date. The particular regression seems to give
different results on different systems unfortunately, and this update
reflects the current behaviour on zizzer.

10 years agoconfig: set cwd for processes in se.py
Nilay Vaish [Mon, 7 Oct 2013 23:05:50 +0000 (18:05 -0500)]
config: set cwd for processes in se.py

10 years agox86: enables lstat and readlink syscalls
Nilay Vaish [Mon, 7 Oct 2013 23:05:49 +0000 (18:05 -0500)]
x86: enables lstat and readlink syscalls

10 years agobase: Fix a potential race in PollQueue::setupAsyncIO
Andreas Sandberg [Mon, 7 Oct 2013 14:03:15 +0000 (16:03 +0200)]
base: Fix a potential race in PollQueue::setupAsyncIO

There is a potential race between enabling asynchronous IO and
selecting the target for the SIGIO signal. This changeset move the
F_SETOWN call to before the F_SETFL call that enables SIGIO
delivery. This ensures that signals are always sent to the correct
process.

10 years agokvm: Service events in the instruction event queues
Andreas Sandberg [Thu, 3 Oct 2013 09:00:18 +0000 (11:00 +0200)]
kvm: Service events in the instruction event queues

This changset adds calls to the service the instruction event queues
that accidentally went missing from commit [0063c7dd18ec]. The
original commit only included the code needed to schedule instruction
stops from KVM and missed the functionality to actually service the
events.

10 years agokvm: Only include KVM support for supported kernels
Andreas Hansson [Wed, 2 Oct 2013 10:08:45 +0000 (06:08 -0400)]
kvm: Only include KVM support for supported kernels

This patch adds a check to ensure that the KVM API provided by the
running kernel is what we are expecting.

10 years agoext: Fix fputils compiler flags to ensure ISO C99
Andreas Hansson [Wed, 2 Oct 2013 10:08:43 +0000 (06:08 -0400)]
ext: Fix fputils compiler flags to ensure ISO C99

The fp code relies on C99, and depending on gcc version, the default
is to use c89. This patch adds -std=c99 when using gcc to ensure the
code is compiled in ISO C99 mode.

10 years agostats: Update x86 stats after x87 fixes
Andreas Sandberg [Wed, 2 Oct 2013 09:03:38 +0000 (11:03 +0200)]
stats: Update x86 stats after x87 fixes

The updates to the x87 caused the stats for several regressions to
change. This was mainly caused by the addition of a working 32-bit and
80-bit FP load instruction and xsave support.

10 years agoscons, kvm: Check for the presence of POSIX timers
Andreas Sandberg [Tue, 1 Oct 2013 13:56:47 +0000 (15:56 +0200)]
scons, kvm: Check for the presence of POSIX timers

The kvm-based CPU module requires support for POSIX timers. This
changeset adds a check for POSIX timers and ensures that gem5 is
linked with librt if necessary. KVM support is disabled if POSIX
timers are not supported by the host. This fixes a compilation issue
for some glibc versions where clock_nanosleep and timer_create are in
different libraries.

10 years agoext: Update fputils to rev 52b6190b4e
Andreas Sandberg [Tue, 1 Oct 2013 13:19:56 +0000 (15:19 +0200)]
ext: Update fputils to rev 52b6190b4e

This changeset updates the external library to git revision
52b6190b4e. This update includes changes that fix compilation errors
on old gcc versions and fixes to test a case that affect ICC.

10 years agox86: Add support for m5ops through a memory mapped interface
Andreas Sandberg [Mon, 30 Sep 2013 10:20:53 +0000 (12:20 +0200)]
x86: Add support for m5ops through a memory mapped interface

In order to support m5ops in virtualized environments, we need to use
a memory mapped interface. This changeset adds support for that by
reserving 0xFFFF0000-0xFFFFFFFF and mapping those to the generic IPR
interface for m5ops. The mapping is done in the
X86ISA::TLB::finalizePhysical() which means that it just works for all
of the CPU models, including virtualized ones.

10 years agoarch: Add support for m5ops using mmapped IPRs
Andreas Sandberg [Mon, 30 Sep 2013 10:20:43 +0000 (12:20 +0200)]
arch: Add support for m5ops using mmapped IPRs

In order to support m5ops on virtualized CPUs, we need to either
intercept hypercall instructions or provide a memory mapped m5ops
interface. Since KVM does not normally pass the results of hypercalls
to userspace, which makes that method unfeasible. This changeset
introduces support for m5ops using memory mapped mmapped IPRs. This is
implemented by adding a class of "generic" IPRs which are handled by
architecture-independent code. Such IPRs always have bit 63 set and
are handled by handleGenericIprRead() and
handleGenericIprWrite(). Platform specific impementations of
handleIprRead and handleIprWrite should use
GenericISA::isGenericIprAccess to determine if an IPR address should
be handled by the generic code instead of the architecture-specific
code. Platforms that don't need their own IPR support can reuse
GenericISA::handleIprRead() and GenericISA::handleIprWrite().

10 years agox86: Add support for FXSAVE, FXSAVE64, FXRSTOR, and FXRSTOR64
Andreas Sandberg [Mon, 30 Sep 2013 10:06:36 +0000 (12:06 +0200)]
x86: Add support for FXSAVE, FXSAVE64, FXRSTOR, and FXRSTOR64

10 years agox86: Add support for FLDENV & FNSTENV
Andreas Sandberg [Mon, 30 Sep 2013 10:04:36 +0000 (12:04 +0200)]
x86: Add support for FLDENV & FNSTENV

10 years agox86: Add support for loading 32-bit and 80-bit floats in the x87
Andreas Sandberg [Mon, 30 Sep 2013 10:00:20 +0000 (12:00 +0200)]
x86: Add support for loading 32-bit and 80-bit floats in the x87

The x87 FPU supports three floating point formats: 32-bit, 64-bit, and
80-bit floats. The current gem5 implementation supports 32-bit and
64-bit floats, but only works correctly for 64-bit floats. This
changeset fixes the 32-bit float handling by correctly loading and
rounding (using truncation) 32-bit floats instead of simply truncating
the bit pattern.

80-bit floats are loaded by first loading the 80-bits of the float to
two temporary integer registers. A micro-op (cvtint_fp80) then
converts the contents of the two integer registers to the internal FP
representation (double). Similarly, when storing an 80-bit float,
there are two conversion routines (ctvfp80h_int and cvtfp80l_int) that
convert an internal FP register to 80-bit and stores the upper 64-bits
or lower 32-bits to an integer register, which is the written to
memory using normal integer stores.

10 years agox86: Fix re-entrancy problems in x87 store instructions
Andreas Sandberg [Mon, 30 Sep 2013 09:51:25 +0000 (11:51 +0200)]
x86: Fix re-entrancy problems in x87 store instructions

X87 store instructions typically loads and pops the top value of the
stack and stores it in memory. The current implementation pops the
stack at the same time as the floating point value is loaded to a
temporary register. This will corrupt the state of the x87 stack if
the store fails. This changeset introduces a pop87 micro-instruction
that pops the stack and uses this instruction in the affected
macro-instructions to pop the stack after storing the value to memory.

10 years agokvm: Add support for thread-specific instruction events
Andreas Sandberg [Mon, 30 Sep 2013 07:53:52 +0000 (09:53 +0200)]
kvm: Add support for thread-specific instruction events

Instruction events are currently ignored when executing in KVM. This
changeset adds support for triggering KVM exits based on instruction
counts using hardware performance counters. Depending on the
underlying performance counter implementation, there might be some
inaccuracies due to instructions being counted in the host kernel when
entering/exiting KVM.

Due to limitations/bugs in Linux's performance counter interface, we
can't reliably change the period of an overflow counter. We work
around this issue by detaching and reattaching the counter if we need
to reconfigure it.

10 years agoconfig: Add a 'kvm' CPU alias
Andreas Sandberg [Mon, 30 Sep 2013 07:45:43 +0000 (09:45 +0200)]
config: Add a 'kvm' CPU alias

Add a CPU alias, 'kvm', for the first available KVM-accelerated CPU
model.

10 years agokvm: FPU synchronization support on x86
Andreas Sandberg [Mon, 30 Sep 2013 07:43:43 +0000 (09:43 +0200)]
kvm: FPU synchronization support on x86

This changeset adds support for synchronizing the FPU and SIMD state
of a virtual x86 CPU with gem5. It supports both the XSave API and the
KVM_(GET|SET)_FPU kernel API. The XSave interface can be disabled
using the useXSave parameter (in case of kernel
issues). Unfortunately, KVM_(GET|SET)_FPU interface seems to be buggy
in some kernels (specifically, the MXCSR register isn't always
synchronized), which means that it might not be possible to
synchronize MXCSR on old kernels without the XSave interface.

This changeset depends on the __float80 type in gcc and might not
build using llvm.

10 years agox86: Add support routines to load and store 80-bit floats
Andreas Sandberg [Mon, 30 Sep 2013 07:42:30 +0000 (09:42 +0200)]
x86: Add support routines to load and store 80-bit floats

The x87 FPU on x86 supports extended floating point. We currently
handle all floating point on x86 as double and don't support 80-bit
loads/stores. This changeset add a utility function to load and
convert 80-bit floats to doubles (loadFloat80) and another function to
store doubles as 80-bit floats (storeFloat80). Both functions use
libfputils to do the conversion in software. The functions are
currently not used, but are required to handle floating point in KVM
and to properly support all x87 loads/stores.

10 years agoext: Include libfputils
Andreas Sandberg [Mon, 30 Sep 2013 07:40:26 +0000 (09:40 +0200)]
ext: Include libfputils

This changeset includes libfputils from revision bbf0d61d75. This
library can be used to convert to and from 80-bit floats and query the
type of an 80-bit float, which is needed to support the x87 FPU.

10 years agox86: Add limited support for extracting function call arguments
Andreas Sandberg [Mon, 30 Sep 2013 07:37:17 +0000 (09:37 +0200)]
x86: Add limited support for extracting function call arguments

Add support for extracting the first 6 64-bit integer argumements to a
function call in X86ISA::getArgument().

10 years agokvm: x86: Fix segment registers to make them VMX compatible
Andreas Sandberg [Mon, 30 Sep 2013 07:36:54 +0000 (09:36 +0200)]
kvm: x86: Fix segment registers to make them VMX compatible

There are cases when the segment registers in gem5 are not compatible
with VMX. This changeset works around all known such issues. Specifically:

* The accessed bits in CS, SS, DD, ES, FS, GS are forced to 1.
* The busy bit in TR is forced to 1.
* The protection level of SS is forced to the same protection level as
  CS. The difference /seems/ to be caused by a bug in gem5's x86
  implementation.

10 years agotests: update reference outputs
Steve Reinhardt [Sat, 28 Sep 2013 19:25:17 +0000 (15:25 -0400)]
tests: update reference outputs

Apparently only stats.txt was updated the last time, so
this changeset updates other reference output files
(config.ini, simout, simerr, ruby.stats) so that
test output diffs should not be cluttered with irrelevant
changes.  There are a few stats.txt updates too, but
they are in the minority.

10 years agokvm: Add x86 segment register verification to help debugging
Andreas Sandberg [Wed, 25 Sep 2013 10:35:21 +0000 (12:35 +0200)]
kvm: Add x86 segment register verification to help debugging

10 years agokvm: Initial x86 support
Andreas Sandberg [Wed, 25 Sep 2013 10:24:26 +0000 (12:24 +0200)]
kvm: Initial x86 support

This changeset adds support for KVM on x86. Full support is split
across a number of commits since some features are relatively
complex. This changeset includes support for:

 * Integer state synchronization (including segment regs)
 * CPUID (gem5's CPUID values are inserted into KVM)
 * x86 legacy IO (remapped and handled by gem5's memory system)
 * Memory mapped IO
 * PCI
 * MSRs
 * State dumping

Most of the functionality is fairly straight forward. There are some
quirks to support PCI enumerations since this is done in the TLB(!) in
the simulated CPUs. We currently replicate some of that code.

Unlike the ARM implementation, the x86 implementation of the virtual
CPU does not use the cycles hardware counter. KVM on x86 simulates the
time stamp counter (TSC) in the kernel. If we just measure host cycles
using perfevent, we might end up measuring a slightly different number
of cycles. If we don't get the cycle accounting right, we might end up
rewinding the TSC, with all kinds of chaos as a result.

An additional feature of the KVM CPU on x86 is extended state
dumping. This enables Python scripts controlling the simulator to
request dumping of a subset of the processor state. The following
methods are currenlty supported:

 * dumpFpuRegs
 * dumpIntRegs
 * dumpSpecRegs
 * dumpDebugRegs
 * dumpXCRs
 * dumpXSave
 * dumpVCpuEvents
 * dumpMSRs

Known limitations:
  * M5 ops are currently not supported.
  * FPU synchronization is not supported (only affects CPU switching).

Both of the limitations will be addressed in separate commits.

10 years agokvm: Correctly handle the return value from handleIpr(Read|Write)
Andreas Sandberg [Thu, 19 Sep 2013 15:55:04 +0000 (17:55 +0200)]
kvm: Correctly handle the return value from handleIpr(Read|Write)

The KVM base class incorrectly assumed that handleIprRead and
handleIprWrite both return ticks. This is not the case, instead they
return cycles. This changeset converts the returned cycles to ticks
when handling IPR accesses.