gem5.git
4 years agodev-arm: Fix VExpressFastmodel.py indentation
Giacomo Travaglini [Mon, 2 Mar 2020 18:10:36 +0000 (18:10 +0000)]
dev-arm: Fix VExpressFastmodel.py indentation

Convert TAB with four spaces

Change-Id: I7472a01423953c68aed60b37f56fe86eca249fac
Signed-off-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/26253
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Jason Lowe-Power <jason@lowepower.com>
Maintainer: Jason Lowe-Power <jason@lowepower.com>

4 years agoarch: Convert exec keyword to exec() function
Giacomo Travaglini [Mon, 2 Mar 2020 15:53:50 +0000 (15:53 +0000)]
arch: Convert exec keyword to exec() function

The function syntax was also accepted in 2.x

Change-Id: I3d9bef3ddcd5e98ff589796d21dbfeb9796bff1d
Signed-off-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/26252
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Jason Lowe-Power <jason@lowepower.com>
Maintainer: Jason Lowe-Power <jason@lowepower.com>

4 years agoarch: Bring closure out of p_global_let
Giacomo Travaglini [Thu, 5 Mar 2020 15:34:34 +0000 (15:34 +0000)]
arch: Bring closure out of p_global_let

The python interpreter might complain when exec() (the function, not the
python2 keyword) is used in a function and the function contains a nested
block.

See: https://www.python.org/dev/peps/pep-0227/

The patch is moving the nested function out of p_global_let.

Change-Id: Idb3a08a8cd42455af1e5ec2c3ec8f8a1438047d3
Signed-off-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/26303
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Jason Lowe-Power <jason@lowepower.com>
Maintainer: Jason Lowe-Power <jason@lowepower.com>

4 years agomisc: Make exception handling python3 compliant
Giacomo Travaglini [Mon, 2 Mar 2020 15:18:56 +0000 (15:18 +0000)]
misc: Make exception handling python3 compliant

Change-Id: I37d0e97e9762e21c7a0ad315cf7684a19119b5b4
Signed-off-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/26251
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Jason Lowe-Power <jason@lowepower.com>
Maintainer: Jason Lowe-Power <jason@lowepower.com>

4 years agomisc: Text vs Byte string in python3
Giacomo Travaglini [Mon, 2 Mar 2020 15:16:09 +0000 (15:16 +0000)]
misc: Text vs Byte string in python3

Python 3 uses the concepts of two different types:
text and binary strings.
Those cannot be implicilty combined (as it was happening in python2) and
in order to be used together one of them must be converted to the other
type:

* Text can be encoded into Bytes via the encode() method
* Bytes can be decoded to Text using the decode() method

By default encode/decode will assume UTF-8 format

JIRA: https://gem5.atlassian.net/browse/GEM5-345

Change-Id: I1bdf7db17b49cc109239fd5f44791769370853f8
Signed-off-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/26250
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Jason Lowe-Power <jason@lowepower.com>
4 years agoscons: file removed from python3
Giacomo Travaglini [Mon, 2 Mar 2020 15:08:41 +0000 (15:08 +0000)]
scons: file removed from python3

Change-Id: I95794fec5cc9c6e72c9ae53f586052be71436c87
Signed-off-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/26249
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Jason Lowe-Power <jason@lowepower.com>
Maintainer: Jason Lowe-Power <jason@lowepower.com>

4 years agomisc: Views and Iterators instead of Lists in python3
Giacomo Travaglini [Mon, 2 Mar 2020 14:30:25 +0000 (14:30 +0000)]
misc: Views and Iterators instead of Lists in python3

* dict methods dict.keys(), dict.items() and dict.values()
return "views" instead of lists

* The dict.iterkeys(), dict.iteritems() and dict.itervalues()
methods are no longer supported.

* map() and filter() return iterators.

* range() now behaves like xrange() used to behave, except it works with
values of arbitrary size. The latter no longer exists.

* zip() now returns an iterator.

Change-Id: Id480018239db88d7f5d60588c93719056de4a0c0
Signed-off-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/26248
Reviewed-by: Gabe Black <gabeblack@google.com>
Maintainer: Gabe Black <gabeblack@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
4 years agodev-arm: Fix setupBootloader for VExpressFastmodel
Yu-hsin Wang [Fri, 13 Mar 2020 04:40:43 +0000 (12:40 +0800)]
dev-arm: Fix setupBootloader for VExpressFastmodel

Previous fix setupBootloader for VExpress_GEM5_V2 didn't include
VExpressFastmodel. Fix it.

Change-Id: Ia720978848660be63bb788ffaf84b60a5b1b5db5
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/26684
Reviewed-by: Gabe Black <gabeblack@google.com>
Maintainer: Giacomo Travaglini <giacomo.travaglini@arm.com>
Tested-by: kokoro <noreply+kokoro@google.com>
4 years agoarch-arm: Fix Arch detection in FS if there is not bootloader
Giacomo Travaglini [Thu, 12 Mar 2020 15:45:33 +0000 (15:45 +0000)]
arch-arm: Fix Arch detection in FS if there is not bootloader

In case a workload is run with no bootloader we still want to be able
to provide the simulation with the correct arch version.
Without this patch every baremetal simulation will default to AArch64, which
is the default value of ArmFsWorkload.

Change-Id: I0f766167d8983cafc1fd30d054862339eb21f73f
Signed-off-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/26606
Reviewed-by: Gabe Black <gabeblack@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
4 years agomem-ruby: Fix fast-forward when using the backing store.
Yuan Yao [Sun, 23 Feb 2020 22:16:03 +0000 (17:16 -0500)]
mem-ruby: Fix fast-forward when using the backing store.

While the up-to-date data may reside in any agent of Ruby's memory
hierarchy, there's an optional backing store in Ruby that provides
a 'correct' view of the physical memory. When it is enabled by the
user, every Ruby memory access will update this global memory view
as well upon finishing.

The issue is that Ruby's atomic access, used in fast-forward, does
not currently access the backing store, leading to data
incorrectness. More specifically, at the very beginning stage of the
simulation, a loader loads the program into the backing store using
functional accesses. Then the program starts execution with
fast-forward enabled, using atomic accesses for faster simulation. But
because atomic access only accesses the real memory hierarchy, the CPU
fetches incorrect instructions.

The fix is simple. Just make Ruby's atomic access update the backing
store as well as the real physical memory.

Change-Id: I2541d923e18ea488d383097ca7abd4124e47e59b
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/26343
Reviewed-by: Jason Lowe-Power <jason@lowepower.com>
Reviewed-by: Onur Kayıran <onur.kayiran@amd.com>
Maintainer: Jason Lowe-Power <jason@lowepower.com>
Tested-by: kokoro <noreply+kokoro@google.com>
4 years agoarm: Eliminate the MustBeOne ARM specific request flag.
Gabe Black [Wed, 11 Mar 2020 01:33:20 +0000 (18:33 -0700)]
arm: Eliminate the MustBeOne ARM specific request flag.

This flag makes constructing a generic Request object for ARM
impossible, since generic consumers won't know to set that flag to one.

As a principle, Request flags should change the behavior of a request
away from whatever the default/typical behavior is in the current
context, so flags set to zero means no special behavior.

Change-Id: Id606dc0bf42210218e1745585327671a98a8dba4
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/26546
Reviewed-by: Nikos Nikoleris <nikos.nikoleris@arm.com>
Maintainer: Gabe Black <gabeblack@google.com>
Maintainer: Giacomo Travaglini <giacomo.travaglini@arm.com>
Tested-by: kokoro <noreply+kokoro@google.com>
4 years agodev-arm: add FVP Base Power Controller model
Adrian Herrera [Fri, 25 Oct 2019 09:49:23 +0000 (10:49 +0100)]
dev-arm: add FVP Base Power Controller model

This is a reduced model of the FVP Base platforms Power Controller.
As of now it allows the following functions from software:
- Checking for core presence
- Reporting the power state of a core / cluster
- Explicitly powering off a core on WFI
- Explicitly powering off cores in a CPU cluster on WFI
- Explicitly powering on a core through writes to PPONR register

Change-Id: Ia1d4d3ae8e4bfb2d23b2c6077396a4d8500e2e30
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/26463
Maintainer: Giacomo Travaglini <giacomo.travaglini@arm.com>
Reviewed-by: Nikos Nikoleris <nikos.nikoleris@arm.com>
Tested-by: kokoro <noreply+kokoro@google.com>
4 years agoarch-arm: Rewrite getMPIDR
Adrian Herrera [Tue, 10 Dec 2019 17:21:18 +0000 (17:21 +0000)]
arch-arm: Rewrite getMPIDR

This patch is rewriting getMPIDR to have a more canonical form:

* Using threadId() instead of contextId()

It is also splitting the helper so that a client can get an affinity
number given a specific thread context.

Change-Id: I727e4b96ada345fd548cd3ff9423bf27347812c4
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/26304
Reviewed-by: Nikos Nikoleris <nikos.nikoleris@arm.com>
Reviewed-by: Ciro Santilli <ciro.santilli@arm.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Maintainer: Giacomo Travaglini <giacomo.travaglini@arm.com>

4 years agokern: Minor style cleanup in the base SkipFuncEvent class.
Gabe Black [Wed, 25 Dec 2019 20:43:28 +0000 (12:43 -0800)]
kern: Minor style cleanup in the base SkipFuncEvent class.

Change-Id: I0f4efb825b0611d3bab5a429fd36d28a178f86b9
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/24110
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Bobby R. Bruce <bbruce@ucdavis.edu>
Maintainer: Gabe Black <gabeblack@google.com>

4 years agoarm: Implement the AAPCS32 ABI.
Gabe Black [Mon, 23 Dec 2019 04:06:51 +0000 (23:06 -0500)]
arm: Implement the AAPCS32 ABI.

Change-Id: I63b2ec586146163642392f5164fb01335d811471
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/24108
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Bobby R. Bruce <bbruce@ucdavis.edu>
Maintainer: Gabe Black <gabeblack@google.com>

4 years agosim: Rename GuestABI's Position to State.
Gabe Black [Mon, 23 Dec 2019 06:54:14 +0000 (22:54 -0800)]
sim: Rename GuestABI's Position to State.

This type can hold any generic state related to locating return types
and arguments in addition to simple position information. To make that
clearer, this change renames the Position type to State.

Change-Id: I50ff2ec61c3eba0e9505c66ce32e27b515bd4b27
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/24107
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Bobby R. Bruce <bbruce@ucdavis.edu>
Maintainer: Gabe Black <gabeblack@google.com>

4 years agosim: Rename allocate in GuestABI to prepare.
Gabe Black [Mon, 23 Dec 2019 06:00:46 +0000 (22:00 -0800)]
sim: Rename allocate in GuestABI to prepare.

This method can be used for allocating resources for registers and/or
arguments, but it can also be used for generic preparation for them
as well. For instance, it can be used to detect some sort of property
of the function signature as a whole (if it's variadic for instance)
which can be stored in position and used to change ABI behavior.

Change-Id: I8a090be65dc4987e35cd115562114cd1b748155f
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/24106
Reviewed-by: Gabe Black <gabeblack@google.com>
Maintainer: Gabe Black <gabeblack@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
4 years agosim: Optionally pass "position" to GuestABI::Result::store.
Gabe Black [Sun, 22 Dec 2019 08:59:46 +0000 (03:59 -0500)]
sim: Optionally pass "position" to GuestABI::Result::store.

This will let it get at information about the signature as a whole.

Also, put result storing and argument getting behind functions to hide
some of the templating involved in those mechanisms.

Change-Id: Ib9f26ff69495f8891435f68d3d2f9dfa761a0274
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/24105
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Bobby R. Bruce <bbruce@ucdavis.edu>
Maintainer: Gabe Black <gabeblack@google.com>

4 years agosim: Split up the guest_abi.hh header.
Gabe Black [Sat, 21 Dec 2019 05:42:43 +0000 (21:42 -0800)]
sim: Split up the guest_abi.hh header.

This header was getting pretty long, and could be broken up into a few
headers which logically grouped related definitions and concepts.

To maintain compatibility and keep things simple for users of the
mechanism, there is still a top level header with the original name
which defines the interface for using ABIs. It includes all the other
new headers, and so can also be used when defining ABIs.

Change-Id: I62a051b9bd982e0fcecfceeb3d658d1ff4d30c5e
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/24104
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Bobby R. Bruce <bbruce@ucdavis.edu>
Maintainer: Gabe Black <gabeblack@google.com>

4 years agosim: Generalize the GuestABI Result::allocate() mechanism.
Gabe Black [Sat, 21 Dec 2019 05:04:19 +0000 (21:04 -0800)]
sim: Generalize the GuestABI Result::allocate() mechanism.

This change generalizes the GuestABI Result template family's
allocate() mechanism so that it can also be used with arguments. This
is useful in cases like the 32 bit ARM ISA which says that variadic
functions treat their floating point arguments differently than
non-variadic functions do. This mechanism will give the ABI a chance
to detect that the function is variadic (by checking for VarArgs) and
then to behave differently in that case.

This also makes the GuestABI mechanism a little more regular by
supporting allocate() on both arguments and return values instead of
just return values.

Change-Id: I67050a0ad7ccf15ee75b800dca4eae4fdc0e564e
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/24103
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Bobby R. Bruce <bbruce@ucdavis.edu>
Maintainer: Gabe Black <gabeblack@google.com>

4 years agoarm: Implement the AAPCS64 ABI.
Gabe Black [Tue, 17 Dec 2019 06:27:12 +0000 (22:27 -0800)]
arm: Implement the AAPCS64 ABI.

This implementation has been tested a tiny bit by intercepting a call
which passed an argument of this type to a function.

struct Test
{
    int32_t a;
    float *b;
};

The gem5 intercept printed out the value of a, the value of b, and the
value of the float it pointed to.

I was able to get things to work by commenting out the panic in
fixFuncEventAddr and making it return its argument unmodified, and by
calling addFuncEvent instead of addKernelFuncEvent which injects the
kernel symbol table. I substitured the Process's debugSymbolTable which
had the right symbols.

Note that this implementation is not completely correct. First of all,
I used a dummy type in place of the Short Vector type which is just
a byte array with the appropriate alignment forced on it. It sounds
like this type would be something the compiler would need an intrinsic
and architecture specific type for to behave correctly, and so in
gem5 we'd have to define our own type for ARM which could feed in here.

Also, strictly speaking, it sounds like HVA and HFA category of types,
the Homogeneous Short-Vector Aggregates and Homogeneous Floating-point
Aggregates, are supposed to apply to any type which is an aggregate of
all the same type (short vector for one, floating point for the other)
with 4 or fewer members.

In this implementation, I capture any *array* of 4 or fewer elements of
the appropriate type as an HVA or HFA, but I believe these structures
would also count and are not included in my implementation.

struct {
    float a;
    float b;
    float c;
};

struct {
    ShortVector a;
    ShortVector b;
};

This only matters if those sorts of structures are passed by value as
top level arguments to a function, ie they are not included in some
larger structure.

Also, rule B.6 talks about what to do with an "aignment adjusted type",
and I have no idea what that's supposed to be. Those may not be handled
correctly either.

Change-Id: I5a599a03d38075d7c0a06988c05e7fb5423c68c0
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/23751
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Bobby R. Bruce <bbruce@ucdavis.edu>
Maintainer: Gabe Black <gabeblack@google.com>

4 years agokern: Stop using a pseudo instruction to quiesce the ThreadContext.
Gabe Black [Thu, 12 Dec 2019 04:17:39 +0000 (20:17 -0800)]
kern: Stop using a pseudo instruction to quiesce the ThreadContext.

The pseudo instruction implementation is very short, and so doing the
work it was doing directly doesn't really add much to the
implementation of the udelay events. By not calling the pseudo
instruction we also uncouple these unrelated mechanisms and don't,
for instance, cause pseudo instruction debug output every time udelay
executes.

Change-Id: I5c9b32509562487e53b2acfa1a3f6226d33d1cfd
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/23748
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Bobby R. Bruce <bbruce@ucdavis.edu>
Maintainer: Gabe Black <gabeblack@google.com>

4 years agoarm: Delete the unused onKvmExitHypercall method.
Gabe Black [Wed, 11 Dec 2019 02:56:46 +0000 (18:56 -0800)]
arm: Delete the unused onKvmExitHypercall method.

The KVM_EXIT_HYPERCALL KVM exit is now unused, and so even if this
exit handler was plumbed to receive these exits, they would probably
never come.

Change-Id: Ic3ecc789102e761a6dbe80caaf57d61dd95f70a6
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/23746
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Bobby R. Bruce <bbruce@ucdavis.edu>
Maintainer: Gabe Black <gabeblack@google.com>

4 years agoarch,sim: Get rid of the now unused setSyscallReturn method.
Gabe Black [Tue, 10 Dec 2019 00:59:01 +0000 (16:59 -0800)]
arch,sim: Get rid of the now unused setSyscallReturn method.

Change-Id: I61741ab2eca4c77a2c8884e2b5c328479e2b3c90
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/23505
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Bobby R. Bruce <bbruce@ucdavis.edu>
Maintainer: Gabe Black <gabeblack@google.com>

4 years agosim: Use the new returnInto method in cloneFunc.
Gabe Black [Tue, 10 Dec 2019 00:58:25 +0000 (16:58 -0800)]
sim: Use the new returnInto method in cloneFunc.

This gets rid of the final use of setSyscallReturn.

Change-Id: I1108df0c5c72b5dec60128dced48ac0fd0356d24
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/23504
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Bobby R. Bruce <bbruce@ucdavis.edu>
Maintainer: Gabe Black <gabeblack@google.com>

4 years agosim: Add a returnInto function to the SyscallDesc class.
Gabe Black [Tue, 10 Dec 2019 00:55:36 +0000 (16:55 -0800)]
sim: Add a returnInto function to the SyscallDesc class.

This method lets system call implementations return values into
ThreadContexts other than the one they were called from. That's useful
for, for instance, clone() which creates new ThreadContexts.

By making it a virtual function in the SyscallDesc, we can delegate the
actual implementation to the SyscallDescABI subclass which knows the
ABI and how to use it to set the return value.

Change-Id: I61c6e60e4c2a8863c885cd818e4ff053fc3312ee
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/23503
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Bobby R. Bruce <bbruce@ucdavis.edu>
Maintainer: Gabe Black <gabeblack@google.com>

4 years agosim: Get rid of the now unused getSyscallArg method.
Gabe Black [Sun, 8 Dec 2019 09:52:06 +0000 (01:52 -0800)]
sim: Get rid of the now unused getSyscallArg method.

Change-Id: I2f78420d8687da7530feb66784fe3e6d2357baf8
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/23462
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Bobby R. Bruce <bbruce@ucdavis.edu>
Maintainer: Gabe Black <gabeblack@google.com>

4 years agosim: Rework the SyscallDesc to use the dumpSimcall mechanism.
Gabe Black [Sun, 8 Dec 2019 09:36:05 +0000 (01:36 -0800)]
sim: Rework the SyscallDesc to use the dumpSimcall mechanism.

This greatly simplifies the doSyscall method, removes a use of
getSyscallArg, and will only print arguments the target syscall is
going to use.

Change-Id: Id8c9c995a2506468fd99fd865f2eb31c40db8b55
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/23461
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Bobby R. Bruce <bbruce@ucdavis.edu>
Maintainer: Gabe Black <gabeblack@google.com>

4 years agosim: Get rid of the no longer needed DefaultSyscallABI.
Gabe Black [Sun, 8 Dec 2019 04:54:07 +0000 (20:54 -0800)]
sim: Get rid of the no longer needed DefaultSyscallABI.

All ISAs now have their own ABI definitions.

Change-Id: I20484b024227658bed7093c232ebf7d64f29bdb6
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/23458
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Bobby R. Bruce <bbruce@ucdavis.edu>
Maintainer: Gabe Black <gabeblack@google.com>

4 years agosim: Convert the various flavors of pipe to GuestABI.
Gabe Black [Sat, 7 Dec 2019 11:31:58 +0000 (03:31 -0800)]
sim: Convert the various flavors of pipe to GuestABI.

Change-Id: I44aaff417ea6a3ce311208b084fe4013bb93a48e
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/23457
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Bobby R. Bruce <bbruce@ucdavis.edu>
Maintainer: Gabe Black <gabeblack@google.com>

4 years agosim,gpu: Make ioctl unconditionally take an address parameter.
Gabe Black [Sat, 7 Dec 2019 11:43:46 +0000 (03:43 -0800)]
sim,gpu: Make ioctl unconditionally take an address parameter.

The definition of ioctl is not actually variadic, it just doesn't
specify what the type of the pointer is that it takes as its third
argument. The man page says that that's because it predates void *
being valid C.

By passing this address around (even if it's unused), we avoid having
to extract system call arguments further down the call stack.

Change-Id: I62541237baafaec30bbe3df06b3284dd286a4051
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/23456
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Bobby R. Bruce <bbruce@ucdavis.edu>
Maintainer: Gabe Black <gabeblack@google.com>

4 years agosim: Clean up some constants used in some syscalls.
Gabe Black [Sat, 7 Dec 2019 11:35:39 +0000 (03:35 -0800)]
sim: Clean up some constants used in some syscalls.

Having readable constants for these large numbers is good, but they
used incorrect style, were at global scope, and were only used in one
place.

This change centralizes them where they're used, fixes their style, and
rewrites the actual constants in a way that makes it clear what they're
values are.

Change-Id: Ib89c46fce133d4180296d384a61d51d1fe1f8d20
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/23455
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Bobby R. Bruce <bbruce@ucdavis.edu>
Maintainer: Gabe Black <gabeblack@google.com>

4 years agosim: Convert ftruncate64 to GuestABI.
Gabe Black [Sat, 7 Dec 2019 11:23:18 +0000 (03:23 -0800)]
sim: Convert ftruncate64 to GuestABI.

This function was specifying a particular width to getSyscallArg. The
new ISA specific ABIs now handle that automatically.

Change-Id: I141655d3bcb78f56c2a9278d140dfbc0d69e1ff4
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/23454
Reviewed-by: Bobby R. Bruce <bbruce@ucdavis.edu>
Maintainer: Gabe Black <gabeblack@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
4 years agoriscv: Use a riscv specific GuestABI for riscv system calls.
Gabe Black [Sun, 8 Dec 2019 04:52:09 +0000 (20:52 -0800)]
riscv: Use a riscv specific GuestABI for riscv system calls.

Change-Id: Ia6ac34dfb38b71eff7b573b3c9ce477fef0ef5f7
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/23453
Reviewed-by: Bobby R. Bruce <bbruce@ucdavis.edu>
Maintainer: Gabe Black <gabeblack@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
4 years agopower: Use a power specific GuestABI for power system calls.
Gabe Black [Sun, 8 Dec 2019 04:13:50 +0000 (20:13 -0800)]
power: Use a power specific GuestABI for power system calls.

Change-Id: I39cf64c025c284b63980f3c2e48fbd8b6c355d2b
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/23452
Reviewed-by: Bobby R. Bruce <bbruce@ucdavis.edu>
Maintainer: Gabe Black <gabeblack@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
4 years agomips: Use a mips specific GuestABI for mips system calls.
Gabe Black [Sun, 8 Dec 2019 04:03:28 +0000 (20:03 -0800)]
mips: Use a mips specific GuestABI for mips system calls.

Change-Id: Ice9fb867b47e56bc00b171399a82b2892b16c9e4
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/23451
Reviewed-by: Bobby R. Bruce <bbruce@ucdavis.edu>
Maintainer: Gabe Black <gabeblack@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
4 years agosim: Remove the get*PseudoFunc handlers.
Gabe Black [Sun, 8 Dec 2019 02:14:11 +0000 (18:14 -0800)]
sim: Remove the get*PseudoFunc handlers.

These were used in Alpha which has been removed.

Change-Id: I801ef71972b0c3d2aa04d682a3a94acfb27ac7ed
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/23449
Reviewed-by: Bobby R. Bruce <bbruce@ucdavis.edu>
Maintainer: Gabe Black <gabeblack@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
4 years agoarm: Use an ARM specific GuestABI for ARM system calls.
Gabe Black [Sat, 7 Dec 2019 15:28:14 +0000 (07:28 -0800)]
arm: Use an ARM specific GuestABI for ARM system calls.

Change-Id: I2d0d0a563355f43ed791ba2f2a1894e303cca994
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/23448
Reviewed-by: Bobby R. Bruce <bbruce@ucdavis.edu>
Maintainer: Gabe Black <gabeblack@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
4 years agosparc: Use a SPARC specific GuestABI for system calls.
Gabe Black [Sat, 7 Dec 2019 11:07:43 +0000 (03:07 -0800)]
sparc: Use a SPARC specific GuestABI for system calls.

Change-Id: I41996cada5ccde7b265e5315829ac6690da8902f
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/23447
Reviewed-by: Bobby R. Bruce <bbruce@ucdavis.edu>
Maintainer: Gabe Black <gabeblack@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
4 years agosparc: Introduce a BitUnion for the CCR register.
Gabe Black [Sat, 7 Dec 2019 10:37:50 +0000 (02:37 -0800)]
sparc: Introduce a BitUnion for the CCR register.

This avoids opaque masks when accessing fields of this register.

Change-Id: If20d82c7c6401e6b1b35bb6d2c69542a56e2fb45
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/23446
Reviewed-by: Bobby R. Bruce <bbruce@ucdavis.edu>
Maintainer: Gabe Black <gabeblack@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
4 years agosparc: Introduce constants for pseudo integer registers.
Gabe Black [Sat, 7 Dec 2019 10:12:53 +0000 (02:12 -0800)]
sparc: Introduce constants for pseudo integer registers.

These are "integer" registers which are renamed, but which aren't
normally considered integer registers by the ISA. They had been indexed
by adding an opaque constant to the number of official integer
registers which obscured what they were, and was also fragile and
invited mistakes.

Change-Id: Idab8cf4d889682b98c7c81a00d9a92d8e3bb3a05
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/23445
Reviewed-by: Bobby R. Bruce <bbruce@ucdavis.edu>
Maintainer: Gabe Black <gabeblack@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
4 years agosparc: Get rid of some commented out constants.
Gabe Black [Sat, 7 Dec 2019 09:30:23 +0000 (01:30 -0800)]
sparc: Get rid of some commented out constants.

Change-Id: Ie2a223f5f969402a03b924ef767eddbcc14bf312
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/23444
Reviewed-by: Bobby R. Bruce <bbruce@ucdavis.edu>
Maintainer: Bobby R. Bruce <bbruce@ucdavis.edu>
Tested-by: kokoro <noreply+kokoro@google.com>
4 years agox86: Define a local ABI for system calls.
Gabe Black [Sat, 7 Dec 2019 01:46:38 +0000 (17:46 -0800)]
x86: Define a local ABI for system calls.

These ABIs (one 32 bit and one 64 bit) take advantage of the
GenericSyscallABI and X86Linux::SyscallABI partial ABIs set up earlier.

This removes x86's dependence on the getSyscallArg and setSyscallReturn
Process methods.

Change-Id: Ia07834cea1afa827d77e590af5397e2a1e0e2099
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/23443
Reviewed-by: Bobby R. Bruce <bbruce@ucdavis.edu>
Maintainer: Gabe Black <gabeblack@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
4 years agox86: In X86 linux, system calls simply return their result in a register.
Gabe Black [Sat, 7 Dec 2019 01:41:13 +0000 (17:41 -0800)]
x86: In X86 linux, system calls simply return their result in a register.

We can partially define an x86 linux system call ABI which handles the
return value. Argument gathering would be handled elsewhere.

Change-Id: Id2841dea39aa2ea3fc42e1a0fb70ff4e477b3671
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/23442
Reviewed-by: Bobby R. Bruce <bbruce@ucdavis.edu>
Maintainer: Gabe Black <gabeblack@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
4 years agosim: Add GenericSyscallABI structs which can be used by the ISAs.
Gabe Black [Sat, 7 Dec 2019 01:42:58 +0000 (17:42 -0800)]
sim: Add GenericSyscallABI structs which can be used by the ISAs.

It's very common for system call arguments to be passed in a sequence
of registers, one argument per register. To avoid having that
implementation repeated over and over across the various ISAs and OSes,
these partial ABI implementations provide that mechanism they can just
pull in. They would need to define the sequence of registers to use,
and these would take care of the rest.

Unlike the temporary DefaultSyscallABI which defers to the Process
classes, these read registers from the ThreadContext directly.

Change-Id: Ic72eb8d784ecf4711b5eec76d958a87c70850fce
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/23441
Reviewed-by: Bobby R. Bruce <bbruce@ucdavis.edu>
Maintainer: Gabe Black <gabeblack@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
4 years agosim: Make SyscallReturn handle extra/"pseudo" return registers.
Gabe Black [Sun, 8 Dec 2019 01:45:44 +0000 (17:45 -0800)]
sim: Make SyscallReturn handle extra/"pseudo" return registers.

Avoid special casing them in the system calls themselves.

Change-Id: I735f8e6fdff164c66e3f1386aed3fc9b107ea45f
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/23440
Reviewed-by: Bobby R. Bruce <bbruce@ucdavis.edu>
Maintainer: Gabe Black <gabeblack@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
4 years agomips: Convert MIPS specific syscalls to Guest ABI.
Gabe Black [Thu, 28 Nov 2019 08:05:34 +0000 (00:05 -0800)]
mips: Convert MIPS specific syscalls to Guest ABI.

Jira Issue: https://gem5.atlassian.net/browse/GEM5-187

Change-Id: I7e7c49e885a8c3395f2e6ca361c228bce3691dbe
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/23205
Reviewed-by: Bobby R. Bruce <bbruce@ucdavis.edu>
Maintainer: Gabe Black <gabeblack@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
4 years agopower: Convert POWER specific syscalls to Guest ABI.
Gabe Black [Thu, 28 Nov 2019 08:05:09 +0000 (00:05 -0800)]
power: Convert POWER specific syscalls to Guest ABI.

Jira Issue: https://gem5.atlassian.net/browse/GEM5-187

Change-Id: Icdf41a0e2bf910813250249eff7a9f1b54c60b22
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/23204
Reviewed-by: Bobby R. Bruce <bbruce@ucdavis.edu>
Maintainer: Gabe Black <gabeblack@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
4 years agosparc: Convert SPARC specific syscalls to Guest ABI.
Gabe Black [Thu, 28 Nov 2019 08:04:36 +0000 (00:04 -0800)]
sparc: Convert SPARC specific syscalls to Guest ABI.

Jira Issue: https://gem5.atlassian.net/browse/GEM5-187

Change-Id: I144fc3fb0e408380294ea91fefa881494f44098b
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/23203
Reviewed-by: Bobby R. Bruce <bbruce@ucdavis.edu>
Maintainer: Gabe Black <gabeblack@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
4 years agoriscv: Convert RISCV specific syscalls to Guest ABI.
Gabe Black [Thu, 28 Nov 2019 08:04:54 +0000 (00:04 -0800)]
riscv: Convert RISCV specific syscalls to Guest ABI.

Jira Issue: https://gem5.atlassian.net/browse/GEM5-187

Change-Id: I1a7041ba890f5f69d5506583c658ae6a777b5daf
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/23202
Reviewed-by: Bobby R. Bruce <bbruce@ucdavis.edu>
Maintainer: Gabe Black <gabeblack@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
4 years agox86: Convert x86 specific syscalls to GuestABI.
Gabe Black [Thu, 28 Nov 2019 08:04:16 +0000 (00:04 -0800)]
x86: Convert x86 specific syscalls to GuestABI.

Jira Issue: https://gem5.atlassian.net/browse/GEM5-187

Change-Id: I2ad9c0ac72eb875f30ece27d58549244de84e191
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/23201
Reviewed-by: Bobby R. Bruce <bbruce@ucdavis.edu>
Maintainer: Gabe Black <gabeblack@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
4 years agoarm: Convert ARM specific syscalls to GuestABI.
Gabe Black [Thu, 28 Nov 2019 07:53:28 +0000 (23:53 -0800)]
arm: Convert ARM specific syscalls to GuestABI.

Jira Issue: https://gem5.atlassian.net/browse/GEM5-187

Change-Id: I1055b72f34ea9e0bcce465492bd45b6fb0c36eef
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/23200
Reviewed-by: Bobby R. Bruce <bbruce@ucdavis.edu>
Maintainer: Gabe Black <gabeblack@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
4 years agosim: Remove ISA specific KVM handling of the return from clone.
Gabe Black [Thu, 28 Nov 2019 07:07:34 +0000 (23:07 -0800)]
sim: Remove ISA specific KVM handling of the return from clone.

When the new thread context ctc is created, it should have a copy of
all the state in the original tc, including the original PC. This code
used to specially handle the KVM case by explicitly making this new
context return from the system call immediately by jumping right to
RCX which (assuming a particular instruction was used) is where user
mode should resume.

The first problem with this approach as far as I can tell is that the
CPU will still be in CPL0, ie supervisor mode, and will not have been
forced back into CPL3, ie user mode. This may not have any immediately
visible effect, but may down the line.

Second, this seems unnecessary. The non-special case code will advance
the PC beyond the instruction which triggered the system call. Then
once the new thread starts executing again, it will execute sysret and
return to rcx naturally, just like the original thread will.

The only observed difference is that when executing a gem5 instruction,
the IP is set to the currently executing instruction, and so to avoid
the new context from re-executing the system call, the PC needs to be
advanced. When calling in from KVM, the instruction has already been
"completed", and so the IP should *not* be advanced.

Also note that when reading the PCState object in KVM, it doesn't
figure out where the next instruction is and so NPC is just one
ExtMachInst sized blob later on. Advancing the PC will just move to
an address 8 bytes later, which is very unlikely to be what you want.

Jira Issue: https://gem5.atlassian.net/browse/GEM5-187

Change-Id: I0d97f66e64ce39b13d6700dcf3d7da88d6fe0048
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/23199
Reviewed-by: Bobby R. Bruce <bbruce@ucdavis.edu>
Maintainer: Gabe Black <gabeblack@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
4 years agoarch,sim: Convert clone to GuestABI and define a cloneBackwardsFunc.
Gabe Black [Thu, 28 Nov 2019 07:03:14 +0000 (23:03 -0800)]
arch,sim: Convert clone to GuestABI and define a cloneBackwardsFunc.

cloneBackwardsFunc takes its arguments in the order specified for
ARM and RISCV. Because of the new GuestABI mechanism, it can be a
simple wrapper around the normal clone implementation without the need
for #ifdefs.

Jira Issue: https://gem5.atlassian.net/browse/GEM5-187

Change-Id: Iff1ffd6774b9162185a124585e9507a5bdbc46f4
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/23198
Reviewed-by: Bobby R. Bruce <bbruce@ucdavis.edu>
Maintainer: Gabe Black <gabeblack@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
4 years agosim: Use variadic GuestABI arguments in a few additional syscalls.
Gabe Black [Thu, 28 Nov 2019 06:53:47 +0000 (22:53 -0800)]
sim: Use variadic GuestABI arguments in a few additional syscalls.

Jira Issue: https://gem5.atlassian.net/browse/GEM5-187

Change-Id: Ib2f193e7409859469c853e11f121eba82b3c0ddc
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/23196
Reviewed-by: Bobby R. Bruce <bbruce@ucdavis.edu>
Maintainer: Bobby R. Bruce <bbruce@ucdavis.edu>
Tested-by: kokoro <noreply+kokoro@google.com>
4 years agopower: Implement translateFunctional.
Gabe Black [Wed, 11 Mar 2020 01:16:05 +0000 (18:16 -0700)]
power: Implement translateFunctional.

Change-Id: I039a09879a50a7d50329c01c337cfa5674c34fae
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/26549
Maintainer: Gabe Black <gabeblack@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Nikos Nikoleris <nikos.nikoleris@arm.com>
4 years agomips: Implement translateFunctional.
Gabe Black [Wed, 11 Mar 2020 01:15:44 +0000 (18:15 -0700)]
mips: Implement translateFunctional.

Change-Id: I32df1b3b12a0adee4457b78c735936c4c73da048
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/26548
Maintainer: Gabe Black <gabeblack@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Nikos Nikoleris <nikos.nikoleris@arm.com>
4 years agoconfig,arch,cpu,kern,sim: Extract kernel information from System.
Gabe Black [Tue, 29 Oct 2019 01:55:02 +0000 (18:55 -0700)]
config,arch,cpu,kern,sim: Extract kernel information from System.

Information about what kernel to load and how to load it was built
into the System object and its subclasses. That overloaded the System
object and made it responsible for too many things, and also was
somewhat awkward when working with SE mode which doesn't have a kernel.

This change extracts the kernel and information related to it from the
System object and puts into into a OsKernel or Workload object.
Currently the idea of a "Workload" to run and a kernel are a bit
muddled, an unfortunate carry-over from the original code. It's also an
implication of trying not to make too sweeping of a change, and to
minimize the number of times configs need to change, ie avoiding
creating a "kernel" parameter which would shortly thereafter be
renamed to "workload".

In future changes, the ideas of a kernel and a workload will be
disentangled, and workloads will be expanded to include emulated
operating systems which shephard and contain Process-es for syscall
emulation.

This change was originally split into pieces to make reviewing it
easier. Those reviews are here:

https: //gem5-review.googlesource.com/c/public/gem5/+/22243
https: //gem5-review.googlesource.com/c/public/gem5/+/24144
https: //gem5-review.googlesource.com/c/public/gem5/+/24145
https: //gem5-review.googlesource.com/c/public/gem5/+/24146
https: //gem5-review.googlesource.com/c/public/gem5/+/24147
https: //gem5-review.googlesource.com/c/public/gem5/+/24286

Change-Id: Ia3d863db276a023b6a2c7ee7a656d8142ff75589
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/26466
Reviewed-by: Gabe Black <gabeblack@google.com>
Maintainer: Gabe Black <gabeblack@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
4 years agoarch-arm: Correct the Ids and names of the PMU events
Andriani Mappoura [Mon, 9 Mar 2020 17:17:22 +0000 (17:17 +0000)]
arch-arm: Correct the Ids and names of the PMU events

0x0C is the PC_WRITE_RETIRED event and 0x21 is the RetiredBranches.

Change-Id: I5f1173ff06f67b6a46e8a914c8acb9639edf67ec
Signed-off-by: Andriani Mappoura <andriani.mappoura@arm.com>
Reviewed-by: Nikos Nikoleris <nikos.nikoleris@arm.com>
Reviewed-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/26485
Maintainer: Giacomo Travaglini <giacomo.travaglini@arm.com>
Tested-by: kokoro <noreply+kokoro@google.com>
4 years agoarch-arm: Remove unnecessary RegIndex set for VSTR VFP inst
Giacomo Travaglini [Tue, 19 Nov 2019 10:20:07 +0000 (10:20 +0000)]
arch-arm: Remove unnecessary RegIndex set for VSTR VFP inst

vd index is already set at the beginning of the
decodeExtensionRegLoadStore function.

Change-Id: Ic8cea43cf3a60881823195ef6da0bbda6940f1cf
Signed-off-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
Reviewed-by: Ciro Santilli <ciro.santilli@arm.com>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/23950
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Nikos Nikoleris <nikos.nikoleris@arm.com>
4 years agoarch-arm: GenericTimer arch regs, perms/trapping
Adrian Herrera [Thu, 7 Nov 2019 12:59:27 +0000 (12:59 +0000)]
arch-arm: GenericTimer arch regs, perms/trapping

This patch enhances the Generic Timer architected registers handling:

- Reordering of miscregs for easier switch/case ranges
- Implement _EL12 reg versions for E2H environments
- AArch32/64 EL0/EL1/EL2 arch compliant trapping for all registers
    + Rely on CNTKCTL and CNTHCTL access controls
- UNDEFINED behaviour from EL0(NS)
- EL1(S) timer traps to EL3 when SCR.ST == 0

Change-Id: I4f018e103cf8f7323060516121838f90278b1c3e
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/25307
Reviewed-by: Nikos Nikoleris <nikos.nikoleris@arm.com>
Maintainer: Giacomo Travaglini <giacomo.travaglini@arm.com>
Tested-by: kokoro <noreply+kokoro@google.com>
4 years agodev-arm: Refactor GenericTimer
Adrian Herrera [Wed, 30 Oct 2019 10:03:52 +0000 (10:03 +0000)]
dev-arm: Refactor GenericTimer

The GenericTimer specification includes a global component for
a universal view of time: the System Counter.

If both per-PE architected and memory-mapped timers are instantiated
in a system, they must both share the same counter. SystemCounter is
promoted to be an independent SimObject, which is now shared by
implementations.

The SystemCounter may be controlled/accessed through the memory-mapped
counter module in the system level implementation. This provides
control (CNTControlBase) and status (CNTReadBase) register frames. The
counter module is now implemented as part of GenericTimerMem.

Frequency changes occur through writes to an active CNTFID or to
CNTCR.EN as per the architecture. Low-high and high-low transitions are
delayed until suitable thresholds, where the counter value is a divisor
of the increment given the new frequency.
Due to changes in frequency, timers need to be notifies to be
rescheduled their counter limit events based on CompareValue/TimerValue.
A new SystemCounterListener interface is provided to achieve
correctness.

CNTFRQ is no longer able to modify the global frequency. PEs may
use this to modify their register view of the former, but they should
not affect the global value. These two should be consistent.

With frequency changes, counter value needs to be stored to track
contributions from different frequency epochs. This is now handled
on epoch change, counter disable and register access.

References to all GenericTimer model components are now provided as
part of the documentation.

VExpress_GEM5_Base is updated with the new model configuration.

Change-Id: I9a991836cacd84a5bc09e5d5275191fcae9ed84b
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/25306
Reviewed-by: Nikos Nikoleris <nikos.nikoleris@arm.com>
Maintainer: Giacomo Travaglini <giacomo.travaglini@arm.com>
Tested-by: kokoro <noreply+kokoro@google.com>
4 years agoarch-arm: Hint the compiler to inline getArmSystem
Giacomo Travaglini [Thu, 5 Mar 2020 13:29:49 +0000 (13:29 +0000)]
arch-arm: Hint the compiler to inline getArmSystem

By defining it in the header we are hinting the compiler to inline
the method

Change-Id: I132964bf8b8c0b5d5eb28868f15723177d049d38
Signed-off-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/26323
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Ciro Santilli <ciro.santilli@arm.com>
4 years agoarch-arm: Speedup ARM execution by avoiding expensive RTTI check
Giacomo Travaglini [Wed, 26 Feb 2020 13:46:24 +0000 (13:46 +0000)]
arch-arm: Speedup ARM execution by avoiding expensive RTTI check

getArmSystem is the building block for a lot of ArmSystem getters
a client can use to check for a specific feature.
This method is called very often during simulation and it is basically
casting a System pointer into an ArmSystem pointer.
To do so, it is using dynamic casting to check if the system is really
an ArmSystem. This is very expensive and usually not needed.

The only chance arm code would use a non ArmSystem is when in SE mode.
But if that's the case, we can just replace the assertion with a

assert(FullSystem).

Testing Linux boot with this patch provides a speedup of nearly 2x!
(atomic mode).

This is partially related to:

JIRA: https://gem5.atlassian.net/browse/GEM5-337

Since the PAuth patch changed the purifyTagged helper (on the critical
path of simulation) to rely more heavilly on getArmSystem (via
ArmSystem:: static methods)

Change-Id: Idbf079548ffe03513b4fc58c76f0d69613952a50
Signed-off-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
Reviewed-by: Ciro Santilli <ciro.santilli@arm.com>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/25964
Tested-by: kokoro <noreply+kokoro@google.com>
4 years agoarch-arm: python3 "/" will always produce a float
Giacomo Travaglini [Mon, 2 Mar 2020 11:56:45 +0000 (11:56 +0000)]
arch-arm: python3 "/" will always produce a float

"/" was ambiguous in python2 and was producing a floor (integer)
division if the operands were int or long.
In python3 "/" will always produce a float which makes it unsuitable
in cases where an integer is expected

PEP238: https://www.python.org/dev/peps/pep-0238/

Change-Id: I481cf1e9c0f95a6f47ecf6539eee0c9bcaf31e17
Signed-off-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/26247
Reviewed-by: Jason Lowe-Power <jason@lowepower.com>
Maintainer: Jason Lowe-Power <jason@lowepower.com>
Tested-by: kokoro <noreply+kokoro@google.com>
4 years agomisc: Replace basestring with six.string_types
Giacomo Travaglini [Fri, 28 Feb 2020 14:58:17 +0000 (14:58 +0000)]
misc: Replace basestring with six.string_types

Change-Id: I914adb545fe82efed386085d2f191ec54efccbf3
Signed-off-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/26246
Reviewed-by: Jason Lowe-Power <jason@lowepower.com>
Maintainer: Jason Lowe-Power <jason@lowepower.com>
Tested-by: kokoro <noreply+kokoro@google.com>
4 years agomisc: Replace __metaclass__ with six.add_metaclass
Giacomo Travaglini [Fri, 28 Feb 2020 14:56:16 +0000 (14:56 +0000)]
misc: Replace __metaclass__ with six.add_metaclass

Change-Id: I45f73b71266c1edf9c4ec521d58db779b16bd591
Signed-off-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/26245
Reviewed-by: Jason Lowe-Power <jason@lowepower.com>
Maintainer: Jason Lowe-Power <jason@lowepower.com>
Tested-by: kokoro <noreply+kokoro@google.com>
4 years agomisc: string.join has been removed in python3
Giacomo Travaglini [Fri, 28 Feb 2020 13:48:12 +0000 (13:48 +0000)]
misc: string.join has been removed in python3

In general string methods are deprecated in favour of str ones

Change-Id: Ifba04e0b70be29e5a82a67cf11837f740de57e32
Signed-off-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/26244
Reviewed-by: Jason Lowe-Power <jason@lowepower.com>
Maintainer: Jason Lowe-Power <jason@lowepower.com>
Tested-by: kokoro <noreply+kokoro@google.com>
4 years agopython: The new module has been removed in python3
Giacomo Travaglini [Fri, 28 Feb 2020 13:42:03 +0000 (13:42 +0000)]
python: The new module has been removed in python3

new.instance was used to instantiate a method bypassing the __init__
interface This patch is doing things properly by importing the LRTable
so that the LRParser interface is respected

Change-Id: I0b0ce184ef5ac297af40289a2896962c9a967a71
Signed-off-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/26243
Reviewed-by: Jason Lowe-Power <jason@lowepower.com>
Maintainer: Jason Lowe-Power <jason@lowepower.com>
Tested-by: kokoro <noreply+kokoro@google.com>
4 years agopython: Make meta class declarations Python 3 safe
Andreas Sandberg [Fri, 25 Jan 2019 11:40:53 +0000 (11:40 +0000)]
python: Make meta class declarations Python 3 safe

Python 2.x and Python 3 use different meta class syntax. Fix this by
implementing meta classes using the add_metaclass decorator in the six
Python library.

Due to the way meta classes are implemented in six,
MetaParamValue.__new__ seems to be called twice for some classes. This
triggers an assertion which when param that checks that Param types
have only been registered once. I have turned this assertion into a
warning.

The assertion was triggered in params.CheckedInt and params.Enum. It
seems like the cause of the issue is that these classes have their own
meta classes (CheckedIntType and MetaEnum) that inherit from
MetaParamValue and a base class (ParamValue) that also inherits from
MetaParamValue.

Change-Id: I5dea08bf0558cfca57897a124cb131c78114e59e
Signed-off-by: Andreas Sandberg <andreas.sandberg@arm.com>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/26083
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Jason Lowe-Power <jason@lowepower.com>
Maintainer: Jason Lowe-Power <jason@lowepower.com>

4 years agomem: Change some default values in the Request class.
Gabe Black [Thu, 5 Mar 2020 00:00:02 +0000 (16:00 -0800)]
mem: Change some default values in the Request class.

These values are more abnormal than the 0s they replace, and so it
would be more obvious when something is accidentally left
uninitialized.

Change-Id: Ie7f14abe9e22f9df1ff238f29d4a783c890f4a20
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/26237
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Nikos Nikoleris <nikos.nikoleris@arm.com>
Maintainer: Nikos Nikoleris <nikos.nikoleris@arm.com>

4 years agoarch: Remove the "process.hh" switching header file.
Gabe Black [Wed, 4 Mar 2020 11:10:06 +0000 (03:10 -0800)]
arch: Remove the "process.hh" switching header file.

This file is not included anywhere in gem5.

Change-Id: I936ac482b9b1d527f141267d0dfb86dda3de34df
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/26235
Maintainer: Gabe Black <gabeblack@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Nikos Nikoleris <nikos.nikoleris@arm.com>
4 years agoconfigs: Fix relative import in non-package in configs
Daniel R. Carvalho [Wed, 8 Jan 2020 08:19:42 +0000 (09:19 +0100)]
configs: Fix relative import in non-package in configs

Fix "ValueError: Attempted relative import in non-package"

Python "compilation" fails when running, among other configs:
    ./build/X86/gem5.fast ./configs/example/ruby_random_test.py

The files in the configs/folder_name folder that are not named
"folder_name.py" are not packages, and thus Python does not allow
relative imports in them.

This fixes the bug reported in
    https://gem5.atlassian.net/projects/GEM5/issues/GEM5-188

Change-Id: Ic8befc30e4cff1d6e8d2f5db1b7f9b89b0fc1395
Signed-off-by: Daniel R. Carvalho <odanrc@yahoo.com.br>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/24163
Reviewed-by: Bobby R. Bruce <bbruce@ucdavis.edu>
Maintainer: Bobby R. Bruce <bbruce@ucdavis.edu>
Tested-by: kokoro <noreply+kokoro@google.com>
4 years agobase,cpu,sim: Stop including arch/vtophys.hh when not using vtophys.
Gabe Black [Wed, 4 Mar 2020 05:46:40 +0000 (21:46 -0800)]
base,cpu,sim: Stop including arch/vtophys.hh when not using vtophys.

These #includes are leftovers from when vtophys was used much more
prevalently in the simulator.

Change-Id: Ib2e947bc95f1e21acc9eff8e856f38b31d3fd933
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/26225
Reviewed-by: Nikos Nikoleris <nikos.nikoleris@arm.com>
Maintainer: Gabe Black <gabeblack@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
4 years agoarch,cpu: Get rid of unused/unimplemented vtophys variants.
Gabe Black [Tue, 3 Mar 2020 00:12:23 +0000 (16:12 -0800)]
arch,cpu: Get rid of unused/unimplemented vtophys variants.

The version of vtophys which didn't take a ThreadContext had only been
implemented on Alpha which has since been removed, so this version of
the function was completely unimplemented and never used.

This change also gets rid of the dbg_vtophys which was sometimes
implemented but also never used, and takes the opportunity to fix up
some style problems in some of the vtophys arch files.

Change-Id: Ie10f881f8ce08c7188e71805357cf3264be4c81a
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/26224
Reviewed-by: Nikos Nikoleris <nikos.nikoleris@arm.com>
Maintainer: Gabe Black <gabeblack@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
4 years agosparc: Implement translateFunctional in the TLB class.
Gabe Black [Sat, 7 Mar 2020 00:09:15 +0000 (16:09 -0800)]
sparc: Implement translateFunctional in the TLB class.

This is a slightly munged version of vtophys, but which returns faults
like the normal translate functions if the address is malformed. It
attempts to return an approximately correct fault if the translation
isn't found, but since SPARC doesn't have hardware managed TLBs that
has to be an approximation.

translateFunctional also ignores permissions type checks (unless
they're built into the "lookup" method?) in line with vtophys type
semantics. The idea is that translateFunctional is used in conjunction
with functional accesses, and those are intended to reach beyond
normal barriers/boundaries to give unfettered access to the system for
debugging or setup purposes.

Change-Id: I000d9c31877b82043489792de037e7d664914fa9
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/26404
Reviewed-by: Nikos Nikoleris <nikos.nikoleris@arm.com>
Maintainer: Gabe Black <gabeblack@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
4 years agobase: Clean up condcodes.hh slightly.
Gabe Black [Sun, 8 Mar 2020 04:10:46 +0000 (20:10 -0800)]
base: Clean up condcodes.hh slightly.

Correct some minor style issues, make the functions static, and use the
single bit version of bits.

Change-Id: I4708961745a33caabecfbb06f8113ce8980e399e
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/26424
Reviewed-by: Gabe Black <gabeblack@google.com>
Reviewed-by: Daniel Carvalho <odanrc@yahoo.com.br>
Maintainer: Gabe Black <gabeblack@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
4 years agosparc: Delete some commented out code in the TLB.
Gabe Black [Fri, 6 Mar 2020 23:37:34 +0000 (15:37 -0800)]
sparc: Delete some commented out code in the TLB.

Change-Id: I80c455403422ec35bafa1f3ed86628f8327d1da0
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/26403
Maintainer: Gabe Black <gabeblack@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Nikos Nikoleris <nikos.nikoleris@arm.com>
4 years agoarch,cpu,gpu-compute,mem: Remove asid from Request objects.
Gabe Black [Wed, 4 Mar 2020 10:22:44 +0000 (02:22 -0800)]
arch,cpu,gpu-compute,mem: Remove asid from Request objects.

This is passed around a lot and set all over the place (usually to 0),
but it's never actually used for anything.

Change-Id: I38ca08387beabeaf9e339b4915ec7eba9e19eecb
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/26232
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Nikos Nikoleris <nikos.nikoleris@arm.com>
Maintainer: Gabe Black <gabeblack@google.com>

4 years agomem: Merge the virtual Request constructors.
Gabe Black [Wed, 4 Mar 2020 09:50:53 +0000 (01:50 -0800)]
mem: Merge the virtual Request constructors.

The only difference was whether the the atomic op functor was accepted
as an argument. If it wasn't, setVirt would be called without an op
functor argument where it will default to nullptr.

This change deletes the constructor which doesn't take an atomic op
functor and in the other defaults the functor to nullptr. Functionally
nothing changes, but the code is now simpler.

Change-Id: Iff06543b1046594df297344e16961ee9d0f0a373
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/26231
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Nikos Nikoleris <nikos.nikoleris@arm.com>
Maintainer: Gabe Black <gabeblack@google.com>

4 years agomem: Get rid of one more unused Request constructor.
Gabe Black [Wed, 4 Mar 2020 09:46:47 +0000 (01:46 -0800)]
mem: Get rid of one more unused Request constructor.

Also collapse setPhys, which is private, into the only caller which is
the Request constructor which takes a physical address.

Change-Id: I872c489cd168d7c364a57e26efce2350a3632c82
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/26230
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Nikos Nikoleris <nikos.nikoleris@arm.com>
Maintainer: Gabe Black <gabeblack@google.com>

4 years agomem: Get rid of another unused Request constructor.
Gabe Black [Wed, 4 Mar 2020 09:17:06 +0000 (01:17 -0800)]
mem: Get rid of another unused Request constructor.

This one took an explicit "time" value instead of using curTick().

Change-Id: I935ba1dfc194dcf156d7defedb6ce540db461ce4
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/26228
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Nikos Nikoleris <nikos.nikoleris@arm.com>
Maintainer: Gabe Black <gabeblack@google.com>

4 years agomem: Add default initializers to the fields in Request.
Gabe Black [Wed, 4 Mar 2020 08:48:15 +0000 (00:48 -0800)]
mem: Add default initializers to the fields in Request.

This avoids having to have bunches of uninteresting initializers in the
Request constructors, and accidentally forgetting to initialize any of
them.

Change-Id: If7a91fdf4aa6cd774f6f53474f55034ed6eda5f0
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/26227
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Nikos Nikoleris <nikos.nikoleris@arm.com>
Maintainer: Nikos Nikoleris <nikos.nikoleris@arm.com>

4 years agobase: Disable a warning in hdf5.cc which comes from an external header.
Gabe Black [Fri, 6 Mar 2020 01:43:28 +0000 (17:43 -0800)]
base: Disable a warning in hdf5.cc which comes from an external header.

This warning comes from an external header which we don't have the
ability to fix directly. We can disable it in hdf5.cc specifically
which should keep things building without defeating the warning in
cases where we could fix it.

Jira Issue: https://gem5.atlassian.net/browse/GEM5-365

Change-Id: Ie1f4d91340e68cee7514beab9d03bba1d1c9bb38
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/26325
Reviewed-by: Ciro Santilli <ciro.santilli@arm.com>
Reviewed-by: Jason Lowe-Power <jason@lowepower.com>
Maintainer: Gabe Black <gabeblack@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
4 years agobase: Optimize and otherwise fix a couple of functions in intmath.hh.
Gabe Black [Wed, 4 Mar 2020 01:41:44 +0000 (17:41 -0800)]
base: Optimize and otherwise fix a couple of functions in intmath.hh.

As described in the Jira issue, this replaces the implementation of
isPowerOf2() and power(). It also revamps floorLog2 so that there only
needs to be one implementation and no assumptions about how big certain
types are.

The way power() used to work was to raise a number n to an exponent e
by multiplying n times itself e times. As a warning in this function
explains, this can be quite slow for large e. A much more efficient
way to raise a number to an exponent is to square n over and over, and
to multiply in the current square if that bit of e is set.

n ^ 15 = (n^1) * (n^2) * (n^4) * (n^8)
n^8 = (n^4)^2
n^4 = (n^2)^2
n^2 = n^2
n^1 = n

So that takes 6 multiplications, n^2, (n^2)^2, (n^4)^2, and then each
multipy to compute the final result, instead of 14.

The difference is more pronounced for larger exponents, although you'd
quickly start to overflow a uint64_t.

Jira Issue: https://gem5.atlassian.net/browse/GEM5-140

Change-Id: I0ae05aeba1b5882d2a616613b1679e6206b4cbfe
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/26164
Reviewed-by: Daniel Carvalho <odanrc@yahoo.com.br>
Maintainer: Gabe Black <gabeblack@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
4 years agomem: Get rid of an unused Request constructor.
Gabe Black [Wed, 4 Mar 2020 08:22:48 +0000 (00:22 -0800)]
mem: Get rid of an unused Request constructor.

This constructor took a physical address and a PC. After deleting it
all ISAs still compile.

Change-Id: I25f404f80ce7e995688165dc86ac8899da7aa919
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/26226
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Nikos Nikoleris <nikos.nikoleris@arm.com>
Maintainer: Gabe Black <gabeblack@google.com>

4 years agocpu: Switch away from some fringe Request constructors.
Gabe Black [Wed, 4 Mar 2020 09:42:23 +0000 (01:42 -0800)]
cpu: Switch away from some fringe Request constructors.

These are only used in these two files, one each, and pass one dummy
argument with a default value and one extra argument with an actual
value compared to the more common constructors.

Instead, switch to constructors without those two arguments and set the
one extra value explicitly after construction.

The constructor will likely be inlined, and merged with this additional
assignment.

Change-Id: I75ca539d5ca95b57b4f4322ffa050af2031544dd
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/26229
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Nikos Nikoleris <nikos.nikoleris@arm.com>
Maintainer: Gabe Black <gabeblack@google.com>

4 years agomem: Remove the version of the FS translating port proxy with no tc.
Gabe Black [Tue, 3 Mar 2020 00:46:12 +0000 (16:46 -0800)]
mem: Remove the version of the FS translating port proxy with no tc.

This version is not used and is the only remaining consumer of the
vtophys variant with no ThreadContext.

Change-Id: I8cb870b841fe064cee121e4930cb163d2ec7628f
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/26223
Reviewed-by: Nikos Nikoleris <nikos.nikoleris@arm.com>
Maintainer: Gabe Black <gabeblack@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
4 years agoarch-arm: Remove unused getArmSystem helper
Giacomo Travaglini [Wed, 26 Feb 2020 13:34:51 +0000 (13:34 +0000)]
arch-arm: Remove unused getArmSystem helper

Change-Id: Ifbb1619fa1cfd6c6cda5c390889c423dbe62dc7e
Signed-off-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
Reviewed-by: Ciro Santilli <ciro.santilli@arm.com>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/25963
Reviewed-by: Gabe Black <gabeblack@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
4 years agomem-ruby: Minor Ruby Prefetcher fixes
Timothy Hayes [Mon, 21 Oct 2019 14:17:13 +0000 (15:17 +0100)]
mem-ruby: Minor Ruby Prefetcher fixes

Minor fixes to the Ruby stride prefetcher. This includes removing unused
statistics and changing where/when some statistics are updated.

Change-Id: If758bf009f53fad277cb3cd754d57a0b10737599
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/24363
Reviewed-by: Daniel Carvalho <odanrc@yahoo.com.br>
Maintainer: Bobby R. Bruce <bbruce@ucdavis.edu>
Tested-by: kokoro <noreply+kokoro@google.com>
4 years agox86: Track message based interrupt cleanup functions in sender state.
Gabe Black [Wed, 4 Mar 2020 00:28:19 +0000 (16:28 -0800)]
x86: Track message based interrupt cleanup functions in sender state.

This makes sure the completion function follows the packet, and allows
multiple packets to be in flight at once without the functions
overwritting each other.

Change-Id: Ic49c7b646d56b32c0453931942ee22ae07828bb6
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/26163
Reviewed-by: Jason Lowe-Power <jason@lowepower.com>
Reviewed-by: Ayaz Akram <yazakram@ucdavis.edu>
Maintainer: Jason Lowe-Power <jason@lowepower.com>
Tested-by: kokoro <noreply+kokoro@google.com>
4 years agoarch,cpu,mem: Replace the mmmapped IPR mechanism with local accesses.
Gabe Black [Tue, 26 Nov 2019 03:41:51 +0000 (19:41 -0800)]
arch,cpu,mem: Replace the mmmapped IPR mechanism with local accesses.

The new local access mechanism installs a callback in the request which
implements what the mmapped IPR was doing. That avoids having to have
stubs in ISAs that don't have mmapped IPRs, avoids having to encode
what to do to communicate from the TLB and the mmapped IPR functions,
and gets rid of another global ISA interface function and header files.

Jira Issue: https://gem5.atlassian.net/browse/GEM5-187

Change-Id: I772c2ae2ca3830a4486919ce9804560c0f2d596a
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/23188
Reviewed-by: Matthew Poremba <matthew.poremba@amd.com>
Maintainer: Gabe Black <gabeblack@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
4 years agoext: Disable the unused-value warning in clang for pybind.
Gabe Black [Mon, 10 Feb 2020 03:57:17 +0000 (19:57 -0800)]
ext: Disable the unused-value warning in clang for pybind.

pybind internally uses a construct which initializes an array of bools
as a way to run a function on each member of a parameter pack. It then
discards the array since it was just trying to run the function. This
triggers a warning in clang 11 called unused-value which breaks the
build.

This change adds some pragmas to the pybind11.h header which disable
that warning while in pybind11 which is less intrusive than trying to
fix the false positive warning, and better than disabling the warning
universally. Since g++ and clang++ will complain if they see this
pragma guarded by the other's name, these pragmas are also surrounded
by ifdefs which should make them only visible to clang.

Change-Id: Ie9b5c65e8cadc8b96fbc1bd7971bed4a61c4340d
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/25228
Maintainer: Jason Lowe-Power <jason@lowepower.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Jason Lowe-Power <jason@lowepower.com>
4 years agotests,misc: Created presubmit.yaml Google Cloud Build files
Bobby R. Bruce [Fri, 17 Jan 2020 18:08:12 +0000 (10:08 -0800)]
tests,misc: Created presubmit.yaml Google Cloud Build files

This will replicate kokoro on Google Cloud services. At present, this
can be run via execution of `gcloud builds submit--config
cloudbuild_presubmit.yaml`.

Jira: https://gem5.atlassian.net/browse/GEM5-271
Change-Id: I5a71ef7fdbe5546b4e6970e4f4641f9e14cc640b
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/24543
Reviewed-by: Bobby R. Bruce <bbruce@ucdavis.edu>
Reviewed-by: Jason Lowe-Power <jason@lowepower.com>
Maintainer: Bobby R. Bruce <bbruce@ucdavis.edu>
Tested-by: kokoro <noreply+kokoro@google.com>
4 years agotests: simple_ruby_test's valid_host is X86 only
Giacomo Travaglini [Mon, 2 Mar 2020 10:49:46 +0000 (10:49 +0000)]
tests: simple_ruby_test's valid_host is X86 only

This is because the binary is dynamically linked thus it can run
on a x86 host only.

Change-Id: I7391414fdcd8f861f62e54c4d681e29360eb7443
Signed-off-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
Reviewed-by: Ciro Santilli <ciro.santilli@arm.com>
Reviewed-by: Nikos Nikoleris <nikos.nikoleris@arm.com>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/26103
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Jason Lowe-Power <jason@lowepower.com>
Maintainer: Jason Lowe-Power <jason@lowepower.com>

4 years agopython: Add a warning if pydot is not available.
Yu-hsin Wang [Mon, 2 Mar 2020 03:11:10 +0000 (11:11 +0800)]
python: Add a warning if pydot is not available.

Silently failing makes it hard to debug what happened. Add a warning.

Change-Id: Ia61b8de937bb254898726ad551fb5c894104d771
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/26045
Reviewed-by: Gabe Black <gabeblack@google.com>
Maintainer: Gabe Black <gabeblack@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
4 years agocpu-o3: Fix corrupted rename map in vector mode switching
Hsuan Hsu [Fri, 14 Feb 2020 10:32:46 +0000 (18:32 +0800)]
cpu-o3: Fix corrupted rename map in vector mode switching

This patch fixes the AArch32-AArch64 interprocessing issue introduced in
3d15150d cpu, arch, arch-arm: Wire unused VecElem code in the O3 model.

When O3CPU switches vector renaming mode, architectural-physical mapping
and physical free list are switched in the following way so that content
of vectors has no change from software view:

Case 1. Full mode -> Elem mode (AArch64 -> AArch32):
1.1. Split vector-vector mapping into element-element mapping.
1.2. Split vectors in free list into elements.

Case 2. Elem mode -> Full mode (AArch32 -> AArch64):
2.1. Move content of all N*M mapped physical elements to first N*M
     physical elements in architectural order (N = number of
     architectural vectors, M = number of elements per vector).
2.2. Map N architectural vectors to first N physical vectors (i.e.
     initial mapping in full mode).
2.3. Place remaining physical vectors in free list (i.e. initial free
     list in full mode).

Previous gem5 revision misses step 2.2 when AArch32->AArch64 switch.
The wrong mapping will lead to the situation in which a physical vector
is assigned twice to a same architectural vector without being freed.
Once this occurs, the physical vector will not be freed anymore, since
it is treated as a special register (e.g. zero or misc) by O3CPU's
renaming logic. Eventually O3CPU will either stall forever when all
physical vectors get stuck, or trigger the panic condition "The free
list has lost vector registers" when AArch64->AArch32 switch. This patch
adds the missing step and fixes the issue.

Change-Id: I32233635c28763260bcbb776b52ed198a9abace9
Signed-off-by: Hsuan Hsu <hsuan.hsu@mediatek.com>
Signed-off-by: Howard Wang <Howard.Wang@mediatek.com>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/25743
Reviewed-by: Jason Lowe-Power <jason@lowepower.com>
Reviewed-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
Maintainer: Jason Lowe-Power <jason@lowepower.com>
Maintainer: Giacomo Travaglini <giacomo.travaglini@arm.com>
Tested-by: kokoro <noreply+kokoro@google.com>
4 years agotests: Added MIPS ISA test to learning_gem5/part1_tests.py
Bobby R. Bruce [Tue, 25 Feb 2020 18:19:15 +0000 (10:19 -0800)]
tests: Added MIPS ISA test to learning_gem5/part1_tests.py

Running these tests on the MIPS ISA was part of the old scons-based
scripts and was not present in the Python testlib framework (those
executed via `tests/main.py`). This has been migrated.

Jira: https://gem5.atlassian.net/browse/GEM5-109
Change-Id: Id87022e99ea83768710fb96b55136f777182fd43
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/25803
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Jason Lowe-Power <jason@lowepower.com>
Maintainer: Jason Lowe-Power <jason@lowepower.com>

4 years agotests: Updated 'hello_se' to include other CPU types
Bobby R. Bruce [Wed, 5 Feb 2020 22:01:02 +0000 (14:01 -0800)]
tests: Updated 'hello_se' to include other CPU types

Some tests are ignored due to bugs in the test executables. This has
been logged in the Jira issue here:
https://gem5.atlassian.net/browse/GEM5-356

Jira: https://gem5.atlassian.net/browse/GEM5-109
Change-Id: Idd2db04175333d1c24604e736df7833c1e441480
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/25063
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Bobby R. Bruce <bbruce@ucdavis.edu>
Maintainer: Bobby R. Bruce <bbruce@ucdavis.edu>

4 years agocpu: update info related direction into BP if mispredicted.
tv-reddy [Wed, 26 Feb 2020 23:16:58 +0000 (15:16 -0800)]
cpu: update info related direction into BP if mispredicted.

Update direction info of a branch into BP if, the branch is not
found in the target buffer. Therefore, this  updated direction is
used to squash the branch later on. Previously, some mispredicted
branches were not sqaushed as the BP had old info.

Reported-by: Dimitrios Chasapis
Change-Id: I4be2eb706edc5ffa9935948fb52a01667286c721
jira-issue: https://gem5.atlassian.net/browse/GEM5-355
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/25903
Reviewed-by: Bobby R. Bruce <bbruce@ucdavis.edu>
Reviewed-by: Ayaz Akram <yazakram@ucdavis.edu>
Reviewed-by: Jason Lowe-Power <jason@lowepower.com>
Reviewed-by: Dimitrios Chasapis <k4s4s.heavener@gmail.com>
Reviewed-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
Maintainer: Jason Lowe-Power <jason@lowepower.com>
Tested-by: kokoro <noreply+kokoro@google.com>