Commit Graph

12908 Commits

Author SHA1 Message Date
Alistair Delva
75cd1ff764 dev-arm: Add RealView support for initrd/initramfs
Update the RealView bootloader simulator to set up the initrd_addr. The
load address is derived from the dtb_addr plus the maximum allowable DTB
blob size.

Change-Id: I2eaeb1ade38d24ad8e02230cc99d12873c2f56f9
Signed-off-by: Alistair Delva <adelva@google.com>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/54185
Reviewed-by: Richard Cooper <richard.cooper@arm.com>
Maintainer: Giacomo Travaglini <giacomo.travaglini@arm.com>
Tested-by: kokoro <noreply+kokoro@google.com>
2022-01-05 23:07:07 +00:00
Alistair Delva
cb7799648b arch-arm: Add support for initrd/initramfs
Add initrd_filename and initrd_addr parameters to specify that an
initrd/initramfs should be loaded into memory from a file, just like the
DTB blob. The user must specify the initrd file, and they can specify
the initrd load address as well. However, in practice, it's expected
that the dev/machine backend will derive the initrd load address from
the dtb load address, which is how a bootloader would typically do it.

Change-Id: I6378927c2984b7ccdd1471486dd7803500ef5883
Signed-off-by: Alistair Delva <adelva@google.com>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/54184
Reviewed-by: Richard Cooper <richard.cooper@arm.com>
Reviewed-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
Maintainer: Giacomo Travaglini <giacomo.travaglini@arm.com>
Tested-by: kokoro <noreply+kokoro@google.com>
2022-01-05 21:38:34 +00:00
Alistair Delva
5af49d03da base: Add support for DT initrd/initramfs
Add a new API function, addBootData(), which allows the ports to specify
the size and load address of the initrd/initramfs via DeviceTree. This
uses the standard chosen nodes for initrd-start/initrd-end.

Update the addBootCmdline() to call addBootData() with no
initrd/initramfs so as to maintain backwards compatibility.

Change-Id: I7b1d5cf2a0b18685eaadf1d881434f3d48c45d8b
Signed-off-by: Alistair Delva <adelva@google.com>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/54183
Reviewed-by: Richard Cooper <richard.cooper@arm.com>
Maintainer: Giacomo Travaglini <giacomo.travaglini@arm.com>
Tested-by: kokoro <noreply+kokoro@google.com>
2022-01-05 21:38:34 +00:00
Eric Ye
f894de5486 scons: Try to fix build dependency bug when generating fastmodels
Bug: 201084562
Change-Id: I33cc9e09b1ce46f80864d75f088a2534949e55e1
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/55043
Reviewed-by: Gabe Black <gabeblack@google.com>
Maintainer: Gabe Black <gabeblack@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
2022-01-05 15:29:32 +00:00
Alex Richardson
5ac54aab7e misc: Generate StateMachine debug includes in deterministic order
Since 3454a4a36e the order of the debug/
includes is non-deterministic which can result in unnecessary rebuilds.

Change-Id: I583d2caf70632e08fa59ac85073786270991edbc
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/54983
Reviewed-by: Jason Lowe-Power <power.jg@gmail.com>
Maintainer: Jason Lowe-Power <power.jg@gmail.com>
Tested-by: kokoro <noreply+kokoro@google.com>
2022-01-05 10:15:55 +00:00
Luming Wang
1f155ffd90 arch-riscv,sim-se: Complements the system calls on RISC-V
There are many SE mode system calls that are implemented
in src/sim/syscall_emul.cc or src/sim/syscall_emul.hh.
And they work well under X86 and ARM platforms. However,
they are not supported in se_workload.cc under the RISC-V
platform. This patch adds support for all the system calls
already implemented in syscall_emul.hh/cc to the RISC-V
platform (in arch/riscv/linux/se_workload.cc).

Change-Id: Ia47c3c113767b50412b1c8ade3c1047c894376cf
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/54803
Reviewed-by: Jason Lowe-Power <power.jg@gmail.com>
Maintainer: Jason Lowe-Power <power.jg@gmail.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Bobby Bruce <bbruce@ucdavis.edu>
2022-01-05 03:25:58 +00:00
Jiasen Huang
ec32f6c6f0 mem-cache: Add switch on/off duplicate entries into RMOB
Change-Id: I394d7c852a439be5315c4755b091c8741e671ea3
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/55083
Reviewed-by: Daniel Carvalho <odanrc@yahoo.com.br>
Maintainer: Daniel Carvalho <odanrc@yahoo.com.br>
Tested-by: kokoro <noreply+kokoro@google.com>
2022-01-05 01:18:14 +00:00
Jiasen Huang
66e6e59666 mem-cache: pstAddress should be inserted into PST in STeMS
Change-Id: Ib2c4c5fb0fec32e63947d3ee8dcb5c3d7e2555ab
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/55084
Reviewed-by: Jason Lowe-Power <power.jg@gmail.com>
Maintainer: Jason Lowe-Power <power.jg@gmail.com>
Reviewed-by: Daniel Carvalho <odanrc@yahoo.com.br>
Tested-by: kokoro <noreply+kokoro@google.com>
2022-01-05 01:14:48 +00:00
Daecheol You
ec58d9d7f3 mem-ruby: Fix message stall time calculation
Three changes below:
1. The m_stall_time was declared as statistics::Average, but
statistics::Average uses AvgStor as storage and this works as per-tick
average stat. In the case of m_stall_time, Scalar should be used to get
the calculation right.

2. The function used to get an enqueue time was changed since the
getTime() returns the time when the message was created.

3. Record the stall time only when the message is really dequeued
from the buffer (stall time is not evaluated when the message is moved
to stall map).

Change-Id: I090d19828b5c43f0843a8b735d3f00f312c436e9
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/54363
Reviewed-by: Jason Lowe-Power <power.jg@gmail.com>
Maintainer: Jason Lowe-Power <power.jg@gmail.com>
Tested-by: kokoro <noreply+kokoro@google.com>
2022-01-03 02:18:41 +00:00
Bobby R. Bruce
ee5b65955e python: Fix get_simstat func for non-Root SimObject case
The `get_simstat` function in `src/python/m5/stats/gem5stats.py` was
returning an error when a non-Root Simobject was passed:

```
AttributeError: object 'PyTrafficGen' has no attribute 'name'
At:
  build/NULL_MESI_Two_Level/python/m5/SimObject.py(1430): __getattr__
  build/NULL_MESI_Two_Level/python/m5/stats/gem5stats.py(279): get_simstat
```

The issue was an assumption that SimObjects have a field `name`. They
do not. To get a SimObject's name the `get_name()` function must be
used. This patch fixes this issue.

In addition to this fix, the documentation in this function has been
improved to state more clearly what can be passed  and what shall be
returned. Previously it was somewhat unclear.

Change-Id: I33538120015280bb6260ccf8eba6b75ff43d280e
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/54943
Reviewed-by: Bobby Bruce <bbruce@ucdavis.edu>
Maintainer: Bobby Bruce <bbruce@ucdavis.edu>
Tested-by: kokoro <noreply+kokoro@google.com>
2021-12-30 23:15:24 +00:00
Bobby R. Bruce
6a44472b1c mem: Add 'controller()' function to NVMInterface.py
As noted here: https://gem5.atlassian.net/browse/GEM5-1133,
NVMInterface.py does not have a `controller()` function, which is used
by `configs/common/MemConfig.py` to obtain a memory controller for a
specific memory type selected. This patch adds a `controller()`
function to `NVNInterface.py` to avoid the reported error.

It should be noted that we do not enforce a rule that a memory type
must include a `controller()` function. `se.py`, and other scrips
that use `configs/common/MemConfigs.py`, should not rely on this
false assumption.

Change-Id: Ieba62f803d3b9f9c5c3c863d5a8c4ca16c5e5e82
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/54923
Reviewed-by: Bobby Bruce <bbruce@ucdavis.edu>
Maintainer: Bobby Bruce <bbruce@ucdavis.edu>
Tested-by: kokoro <noreply+kokoro@google.com>
2021-12-30 03:03:15 +00:00
Bobby R. Bruce
5e6a561a3f misc: Revert v21.2 specific commits for develop
These changes were made to the release staging branch for the v21.2
release. This commit reverts them for the develop branch.

Change-Id: I9f02470d00d5034a0797f32d4c1fe0e7055860a6
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/54904
Reviewed-by: Bobby Bruce <bbruce@ucdavis.edu>
Maintainer: Bobby Bruce <bbruce@ucdavis.edu>
Tested-by: kokoro <noreply+kokoro@google.com>
2021-12-28 21:30:21 +00:00
Bobby R. Bruce
065a7dbf1b misc: Merge branch release-staging-v21-2 into develop
Change-Id: I8200ac51c20117f63b51d555fa2f12e5dd35f22e
2021-12-26 23:59:41 -08:00
Jiasen Huang
398d4f9d07 mem-cache: Init lastTriggerCounter for STeMS Prefetcher
Change-Id: I43a0093e6d35a39799d724e7dee15c95dbc26343
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/54643
Reviewed-by: Daniel Carvalho <odanrc@yahoo.com.br>
Maintainer: Daniel Carvalho <odanrc@yahoo.com.br>
Tested-by: kokoro <noreply+kokoro@google.com>
2021-12-23 01:40:09 +00:00
Cui Jin
2194aea053 arch-riscv: rvc instruction is mistaken as branch
Fetch in O3CPU mistakes the normal non-branching compressed
instructions, and regards it as a branch. This issue interrupts
the consecutive instruction stream, thus affecting performance
of cpu front-end.
This fix sets the compressed for PCState during decoding.

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

Change-Id: I7607d563bba8a08869e104877fc3c11c94cbe904
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/54644
Reviewed-by: Jin Cui <cuijinbird@gmail.com>
Reviewed-by: Ayaz Akram <yazakram@ucdavis.edu>
Maintainer: Jason Lowe-Power <power.jg@gmail.com>
Tested-by: kokoro <noreply+kokoro@google.com>
2021-12-22 23:51:50 +00:00
Jiasen Huang
7910926631 mem-cache: Set prefetch bit if the blk comes from Prefetch only.
Original logic setting prefetch inside serviceMSHRTargets
did not exclude the blks that both came from CORE and Prefetch

Change-Id: Iab56b9266eb64baf972b160774aca0823faea458
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/54364
Reviewed-by: Daniel Carvalho <odanrc@yahoo.com.br>
Maintainer: Daniel Carvalho <odanrc@yahoo.com.br>
Tested-by: kokoro <noreply+kokoro@google.com>
2021-12-22 01:02:22 +00:00
Bobby R. Bruce
b959fbac7b stdlib: Update the stdlib resource downloader for versions
The 'resources.json' file in gem5 resources is used to lookup resources.
The stdlib resource downloader was hardcoded to the 'resources.json'
stored in the gem5 resources stable branch. This change allows the gem5
downloader to obtain the specific resources.json.

Change-Id: Ie119ed9326b359055bf5bc347ca89336a5cc2e5d
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/54466
Maintainer: Bobby Bruce <bbruce@ucdavis.edu>
Reviewed-by: Bobby Bruce <bbruce@ucdavis.edu>
Tested-by: kokoro <noreply+kokoro@google.com>
2021-12-21 22:28:42 +00:00
Bobby R. Bruce
bf2740096e base: Update the version to v21.2.0.0
Change-Id: Ib4b3d0a370498c59d6b56701bfa5018d8c1cb709
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/54464
Reviewed-by: Bobby Bruce <bbruce@ucdavis.edu>
Maintainer: Bobby Bruce <bbruce@ucdavis.edu>
Tested-by: kokoro <noreply+kokoro@google.com>
2021-12-21 22:28:42 +00:00
Daniel R. Carvalho
0d1a40602f base: Finish deprecating SatCounter
SatCounter has been marked as deprecated for at least 2 versions,
so it can be removed.

Change-Id: Iffb75822cc0d09d8b7d9b86828b26198865ce407
Signed-off-by: Daniel R. Carvalho <odanrc@yahoo.com.br>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/54523
Reviewed-by: Jason Lowe-Power <power.jg@gmail.com>
Maintainer: Jason Lowe-Power <power.jg@gmail.com>
Tested-by: kokoro <noreply+kokoro@google.com>
2021-12-20 21:55:01 +00:00
Kyle Roarty
f9deeea427 arch-gcn3,arch-vega: Select proper data on misaligned access
req1->getSize() returns the size in bytes, but because we're using it
in an array index, we need to scale it by the size of the data type.

This ensures we give the second request the proper data.

Change-Id: I578665406762d5d0c95f2ea8297c362e1cc0620b
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/54503
Reviewed-by: Matt Sinclair <mattdsinclair@gmail.com>
Maintainer: Matt Sinclair <mattdsinclair@gmail.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Matthew Poremba <matthew.poremba@amd.com>
2021-12-20 18:28:08 +00:00
Bobby R. Bruce
123d5dbdf7 misc: Merge branch 'release-staging-v21-2' into develop
Change-Id: Icc03e585d87cf89ed844a0249c365cc296fa2d14
2021-12-16 23:07:43 -08:00
Gabe Black
f278b1ea36 systemc: Change how python initialization callbacks are handled.
Because the python environment may already be up and running by the time
static initializers are run, specifically when gem5 is built as a
library and loaded with dlopen, we can't rely on all of the objects
declaring python initialization callbacks having been constructed by the
time the code which would execute them runs.

To address that problem, this change keeps track of whether the
initialization has already happened when a callback is installed, and if
so, runs the callback immediately.

The original implementation also had users install callbacks by
overriding a virtual function in the PythonInitFunc class, and then
statically allocating an instance of that subclass so its constructor
would be called at initialization time. Calling the function manually if
initialization has already happened won't work in that case, because you
can't call a virtual function from a constructor and get the behavior
you'd want.

Instead, this change makes the PythonInitFunc wrap the actual callback
which is outside of the structure itself. Because the callback is not a
virtual function of PythonInitFunc, we can call it in the constructor
without issue.

Also, the Callback type has to be a bare function pointer and not a
std::function<...> because the argument it takes is a pybind11::module_
reference. Pybind11 sets the visibility of all of its code to hidden to
improve binary size, but unfortunately that causes problems when
accepting one as an argument in a publically accessible lambda in g++.
clang doesn't raise a warning, but g++ does which breaks the build. We
could potentially disable this warning, but accepting a function pointer
instead works just as well, since captureless lambdas can be trivially
converted into function pointers, and they don't seem to upset g++.

Change-Id: I3fb321b577090df67c7be3be0e677c2c2055d446
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/54325
Maintainer: Gabe Black <gabe.black@gmail.com>
Reviewed-by: Jason Lowe-Power <power.jg@gmail.com>
Tested-by: kokoro <noreply+kokoro@google.com>
2021-12-17 06:58:46 +00:00
Gabe Black
372601772c systemc: Update the testing framework to get it working again.
The systemc testing framework is not used regularly, and had bit rot and
stopped working. This change updates it so that it runs again, and all
previously passing tests pass again.

These changes were mostly in the related SConscript now that top level
targets are built a little differently and that the gem5 shared library
is no longer stored in a special construction environment variable.
verify.py also needed to be updated since warn() and info() lines now
have file and line number information in them, throwing off pre diff
filtering of gem5 outputs.

Change-Id: Ifdcbd92eab8b9b2168c449bfbcebf52dbe1f016a
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/54324
Maintainer: Gabe Black <gabe.black@gmail.com>
Reviewed-by: Jason Lowe-Power <power.jg@gmail.com>
Tested-by: kokoro <noreply+kokoro@google.com>
2021-12-17 06:58:46 +00:00
Gabe Black
52c04aa517 systemc: Eliminate the unused PythonReadyFunc mechanism.
Change-Id: I8892e4d209901454f2ab923aa3fa9932d7963274
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/54323
Maintainer: Gabe Black <gabe.black@gmail.com>
Reviewed-by: Jason Lowe-Power <power.jg@gmail.com>
Tested-by: kokoro <noreply+kokoro@google.com>
2021-12-17 06:58:46 +00:00
Gabe Black
2e4b7d9091 sim,python: Use scoped_interpreter_guard's argc and argv ctor arguments.
When pybind11's scoped_interpreter_guard is constructed, it can take
argc and argv parameters which it uses to intitialize the sys.argv list
in python. We can use that mechanism instead of setting that up manually
ourselves.

Change-Id: If34fac610d1f829aef313bb9ea4c9dfe6bc8fc0f
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/54309
Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com>
Maintainer: Gabe Black <gabe.black@gmail.com>
Reviewed-by: Jason Lowe-Power <power.jg@gmail.com>
Tested-by: kokoro <noreply+kokoro@google.com>
2021-12-17 06:58:46 +00:00
Gabe Black
7f8bbe01be sim-se: (Re)add support for retrying system calls.
The previous incarnation of this support used faults to make the CPU
reexecute the system call instruction again and again to prevent
emulating/passing through blocking system calls from blocking gem5 as
a whole. That support was accidentally removed a while ago. This new
version suspends the thread context executing the system call, and
periodically wakes it up to retry using a periodically scheduled event.

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

Change-Id: I155fa8205d7ea45e3d102216aeca6ee1979a522f
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/54205
Reviewed-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
Maintainer: Giacomo Travaglini <giacomo.travaglini@arm.com>
Tested-by: kokoro <noreply+kokoro@google.com>
2021-12-17 05:45:26 +00:00
Gabe Black
c154888b2a arch,sim-se: Handle syscall retry/suppression in the syscall desc.
Rather than make each ISA include boilerplate to ignore a
SyscallReturn's value when it's marked as suppressed or needing a retry,
put that code into the SyscallDesc::doSyscall method instead.

That has two benefits. First, it removes a decent amount of code
duplication which is nice from a maintenance perspective. Second, it
puts the SyscallDesc in charge of figuring out what to do once a system
call implementation finishes. That will let it schedule a retry of the
system call for instance, without worrying about what the ISA is doing
with the SyscallReturn behind its back.

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

Change-Id: I76760cba75fd23e6e3357f6169c0140bee3f01b6
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/54204
Reviewed-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
Maintainer: Giacomo Travaglini <giacomo.travaglini@arm.com>
Tested-by: kokoro <noreply+kokoro@google.com>
2021-12-17 05:45:26 +00:00
Jiasen Huang
735f768cc8 mem-cache: Added stats filtering both useful and spanPage prefetch.
Change-Id: I2570ee47f064ac999f2dcc813c9e39174a2ad8af
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/54163
Reviewed-by: Daniel Carvalho <odanrc@yahoo.com.br>
Reviewed-by: Jason Lowe-Power <power.jg@gmail.com>
Maintainer: Jason Lowe-Power <power.jg@gmail.com>
Tested-by: kokoro <noreply+kokoro@google.com>
2021-12-17 01:04:21 +00:00
Yu-hsin Wang
110e22439f arch-arm: gdb support Thumb-2 ISA
From the document*1, we should allow 2,3,4 in kind check function for
supporting all kinds of ARM breakpoint.

1. https://sourceware.org/gdb/current/onlinedocs/gdb/ARM-Breakpoint-Kinds.html

Change-Id: I82bcb88cfe6e80e7f17cd6bb68a26a45ace7b174
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/54124
Reviewed-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
Maintainer: Giacomo Travaglini <giacomo.travaglini@arm.com>
Tested-by: kokoro <noreply+kokoro@google.com>
2021-12-16 13:26:45 +00:00
Yu-hsin Wang
46957f4337 base: Correct checkBpLen naming with checkBpKind
In gdb document*1, the second parameter of checkpoint command(Z0, Z1) is
named after kind. Although underlying implementation probably considers
it as length*2, it's still good to follow the name described in gdb
document for avoiding any confusion.

Refs:
1. https://sourceware.org/gdb/onlinedocs/gdb/Packets.html
2. https://github.com/bminor/binutils-gdb/blob/master/gdb/arch-utils.h#L41

Change-Id: Ib4b585613b8018970b16355f96cdff2ce9d5bae6
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/54123
Reviewed-by: Daniel Carvalho <odanrc@yahoo.com.br>
Maintainer: Daniel Carvalho <odanrc@yahoo.com.br>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
2021-12-16 13:26:39 +00:00
Gabe Black
7f4a485fcf sim: Make the EmbeddedPyBind::initAll method work correctly.
This method depended on all of the EmbeddedPyBind objects having all
been constructed already so that it would have a complete list. This
would only be true if it was called after static intialization was
complete, which is not true if python is ready to go as soon as gem5
(in library form) is loaded.

This change makes EmbeddedPyBind able to defer initialization of a
module more generically than before, so that they can wait for either
another module to be initiailized, or the _m5 package itself.

Change-Id: I6b636524f969bd9882d8c1a7594dc36eb4e78037
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/54005
Maintainer: Bobby Bruce <bbruce@ucdavis.edu>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Bobby Bruce <bbruce@ucdavis.edu>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/54265
2021-12-16 01:57:26 +00:00
Gabe Black
ebbfe1d281 python: Replace PYBIND11_EMBEDDED_MODULE with GEM5_PYBIND_MODULE_INIT.
That will make it possible for gem5's static intializers to run even if
the python interpreter has started.

Change-Id: Ic3574c32244e5ac475222f6d305ddc70dd6298d6
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/54004
Maintainer: Bobby Bruce <bbruce@ucdavis.edu>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Bobby Bruce <bbruce@ucdavis.edu>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/54264
2021-12-16 01:57:26 +00:00
Gabe Black
4f987ff52d python: Add a mechanism for installing pybind modules.
pybind provides a mechanism for this already, but it assumes that
because it works through static initializers, it must run before the
python interpreter has started. That is not true when gem5 is built as a
library, since its static intitializers won't run until that library is
loaded.

Change-Id: I6f36c5f3831dda893039b4923902e9ce46a91808
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/54003
Maintainer: Bobby Bruce <bbruce@ucdavis.edu>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Bobby Bruce <bbruce@ucdavis.edu>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/54263
2021-12-16 01:57:26 +00:00
Gabe Black
a36c378b20 sim: Make the EmbeddedPyBind::initAll method work correctly.
This method depended on all of the EmbeddedPyBind objects having all
been constructed already so that it would have a complete list. This
would only be true if it was called after static intialization was
complete, which is not true if python is ready to go as soon as gem5
(in library form) is loaded.

This change makes EmbeddedPyBind able to defer initialization of a
module more generically than before, so that they can wait for either
another module to be initiailized, or the _m5 package itself.

Change-Id: I6b636524f969bd9882d8c1a7594dc36eb4e78037
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/54005
Maintainer: Bobby Bruce <bbruce@ucdavis.edu>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Bobby Bruce <bbruce@ucdavis.edu>
2021-12-15 19:05:31 +00:00
Gabe Black
765636b732 python: Replace PYBIND11_EMBEDDED_MODULE with GEM5_PYBIND_MODULE_INIT.
That will make it possible for gem5's static intializers to run even if
the python interpreter has started.

Change-Id: Ic3574c32244e5ac475222f6d305ddc70dd6298d6
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/54004
Maintainer: Bobby Bruce <bbruce@ucdavis.edu>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Bobby Bruce <bbruce@ucdavis.edu>
2021-12-15 19:05:31 +00:00
Gabe Black
fdf666a2e3 python: Add a mechanism for installing pybind modules.
pybind provides a mechanism for this already, but it assumes that
because it works through static initializers, it must run before the
python interpreter has started. That is not true when gem5 is built as a
library, since its static intitializers won't run until that library is
loaded.

Change-Id: I6f36c5f3831dda893039b4923902e9ce46a91808
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/54003
Maintainer: Bobby Bruce <bbruce@ucdavis.edu>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Bobby Bruce <bbruce@ucdavis.edu>
2021-12-15 19:05:31 +00:00
Gabe Black
2a5f2ef55a scons: Make the sim_objects parameter of SimObject mandantory.
If there really are no c++ sim_objects in the file, then sim_objects can
be set to [] which it used to default to.

This way, if someone hasn't remembered to update their SConscript files
for the new sim_objects and enums parameters, this will give them some
indication what's wrong, rather than the build just failing later.

Change-Id: Ic1933f7b9dfff7dd7e403c6c84f1f510c8ee8c72
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/54203
Maintainer: Gabe Black <gabe.black@gmail.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com>
2021-12-15 10:48:03 +00:00
Gabe Black
0679fc9c79 sim-se: (Re)add support for retrying system calls.
The previous incarnation of this support used faults to make the CPU
reexecute the system call instruction again and again to prevent
emulating/passing through blocking system calls from blocking gem5 as
a whole. That support was accidentally removed a while ago. This new
version suspends the thread context executing the system call, and
periodically wakes it up to retry using a periodically scheduled event.

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

Change-Id: I4fad23bd119021df23fe6082891fbcd0ee8fb839
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/54024
Reviewed-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
Maintainer: Giacomo Travaglini <giacomo.travaglini@arm.com>
Tested-by: kokoro <noreply+kokoro@google.com>
2021-12-14 23:18:29 +00:00
Giacomo Travaglini
a923674d62 arch-arm: Do not squash table walks if translation is partial
As partial translations have been introduced we cannot just
rely on checking if there is a valid translation when looking
for translations to squash.
The translation has to be complete as well.

This is fixing realview-o3-checker regression

Change-Id: I1ad42bd6172207a72f53b7a843c323c0eea88f06
Signed-off-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/54043
Reviewed-by: Jason Lowe-Power <power.jg@gmail.com>
Maintainer: Jason Lowe-Power <power.jg@gmail.com>
Tested-by: kokoro <noreply+kokoro@google.com>
(cherry picked from commit ec891adca9)
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/54103
Reviewed-by: Bobby Bruce <bbruce@ucdavis.edu>
Maintainer: Bobby Bruce <bbruce@ucdavis.edu>
2021-12-14 09:43:41 +00:00
Gabe Black
2be95c4470 arch,sim-se: Handle syscall retry/suppression in the syscall desc.
Rather than make each ISA include boilerplate to ignore a
SyscallReturn's value when it's marked as suppressed or needing a retry,
put that code into the SyscallDesc::doSyscall method instead.

That has two benefits. First, it removes a decent amount of code
duplication which is nice from a maintenance perspective. Second, it
puts the SyscallDesc in charge of figuring out what to do once a system
call implementation finishes. That will let it schedule a retry of the
system call for instance, without worrying about what the ISA is doing
with the SyscallReturn behind its back.

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

Change-Id: I3732a98c8e0d0b2b94d61313960aa0782c0b971f
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/54023
Maintainer: Gabe Black <gabe.black@gmail.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
2021-12-13 20:31:51 +00:00
Yu-hsin Wang
5762f66288 systemc: Add -Wno-free-nonheap-object for building scheduler.cc
GCC11 introduces a new warning, free-nonheap-object, which would check
if the code potentially calls delete with a nonheap object. The
scheduler is a global object, and its events members fall to this case.

Here's a simplified example.
https://godbolt.org/z/q6GqEfETa

We think this is a false positive warning, since we set auto delete to
false in the event constructor. To avoid performance penalty, we want to
keep current implementation. As the result, we disable the warning in
the SConscript.

Change-Id: I606ebfdec0af7c78d7bbb336faa1f587caa62855
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/54064
Reviewed-by: Gabe Black <gabe.black@gmail.com>
Maintainer: Gabe Black <gabe.black@gmail.com>
Tested-by: kokoro <noreply+kokoro@google.com>
2021-12-13 13:55:32 +00:00
Giacomo Travaglini
ec891adca9 arch-arm: Do not squash table walks if translation is partial
As partial translations have been introduced we cannot just
rely on checking if there is a valid translation when looking
for translations to squash.
The translation has to be complete as well.

This is fixing realview-o3-checker regression

Change-Id: I1ad42bd6172207a72f53b7a843c323c0eea88f06
Signed-off-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/54043
Reviewed-by: Jason Lowe-Power <power.jg@gmail.com>
Maintainer: Jason Lowe-Power <power.jg@gmail.com>
Tested-by: kokoro <noreply+kokoro@google.com>
2021-12-13 09:22:01 +00:00
Giacomo Travaglini
fcb544d569 arch-arm: Allow the L2 unified TLB to store partial translations
We are allowing the L2 TLB to store partial translations from the
second level of lookup

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

Change-Id: I1286c14a256470c2075fe5533930617139d4d087
Signed-off-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/52126
Reviewed-by: Jason Lowe-Power <power.jg@gmail.com>
Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com>
Maintainer: Andreas Sandberg <andreas.sandberg@arm.com>
Tested-by: kokoro <noreply+kokoro@google.com>
2021-12-12 05:04:24 +00:00
Giacomo Travaglini
6ea9a7fe73 arch-arm: Allowing table descriptor to be inserted in TLB
This patch is modifying both TableWalker and MMU to effectively
store/use partial translations

* TableWalker changes: If there is a TLB supporting partial
translations (implemented with previous patch), the TableWalker will
craft partial entries and forward them to the TLB as walks are performed

* MMU changes: We now instruct the table walker to start a page
table traversal even if we hit in the TLB, if the matching entry
holds a partial translation

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

Change-Id: Id20aaf4ea02960d50d8345f3e174c698af21ad1c
Signed-off-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/52125
Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com>
Maintainer: Andreas Sandberg <andreas.sandberg@arm.com>
Tested-by: kokoro <noreply+kokoro@google.com>
2021-12-12 05:04:24 +00:00
Giacomo Travaglini
49cb833ee6 arch-arm: Allow TLB to be used as a WalkCache
This patch allows partial translation entries (intermediate PAs obtained
from a table walk) to be stored in an ArmTLB. This effectively means
reserving a fraction of the TLB entries to cache table walks

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

Change-Id: Id0efb7d75dd017366c4c3b74de7b57355a53a01a
Signed-off-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/52124
Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com>
Maintainer: Andreas Sandberg <andreas.sandberg@arm.com>
Tested-by: kokoro <noreply+kokoro@google.com>
2021-12-12 05:04:24 +00:00
Gabe Black
8452e7bf19 arch,sim-se: Update the PC before emulating a system call.
For most system calls, it doesn't matter if the PC is advanced to the
instruction after the system call instruction before or after the system
call itself is invoked, because the system call itself doesn't interact
with it.

For some system calls however, specifically "clone" and "execve",
advancing the PC *after* the system call complicates things, because it
means the system call needs to set the PC to something that will equal
the desired value only *after* it's advanced.

By setting the PC *before* the system call, the system call can set the
PC to whatever it needs to. This means the new cloned context doesn't
need to advance the PC because it's already advanced, and execve doesn't
need to set NPC, it can leave the PC set to the correct value from the
entry point set during Process initialization.

Change-Id: I830607c2e9adcc22e738178fd3663417512e2e56
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/53983
Reviewed-by: Jason Lowe-Power <power.jg@gmail.com>
Maintainer: Jason Lowe-Power <power.jg@gmail.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Matt Sinclair <mattdsinclair@gmail.com>
Maintainer: Matt Sinclair <mattdsinclair@gmail.com>
Reviewed-by: Kyle Roarty <kyleroarty1716@gmail.com>
2021-12-12 00:29:53 +00:00
Matthew Poremba
9313294efe misc: Remove AMD license addition
Remove the line "For use for simulation and test purposes only" in files
were AMD is the only copyright holder listed in the header. This happens
to be the case for all files where this line exists, removing it
completely from gem5.

Change-Id: I623f266b002f564301b28774f49081099cfc60fd
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/53943
Reviewed-by: Jason Lowe-Power <power.jg@gmail.com>
Maintainer: Jason Lowe-Power <power.jg@gmail.com>
Tested-by: kokoro <noreply+kokoro@google.com>
2021-12-11 04:00:56 +00:00
Andreas Sandberg
d287d8e050 python: Add simulator instantiation checks
Check that m5.instantiate() has been called before m5.simulate() and
that m5.instantiate() is only called once.

Change-Id: Iced129cfd3d09564e2ef619eba829fd294c8a6ac
Signed-off-by: Andreas Sandberg <andreas.sandberg@arm.com>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/53923
Reviewed-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
Reviewed-by: Jason Lowe-Power <power.jg@gmail.com>
Maintainer: Jason Lowe-Power <power.jg@gmail.com>
Tested-by: kokoro <noreply+kokoro@google.com>
2021-12-11 04:00:06 +00:00
Matthew Poremba
0ae1a9d109 arch-vega: Implement S_SLEEP
This is merely copied from arch-gcn3.

Change-Id: Ibd2bda37fe9adc083a35efab0f59617d386019b9
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/53883
Reviewed-by: Matt Sinclair <mattdsinclair@gmail.com>
Maintainer: Matt Sinclair <mattdsinclair@gmail.com>
Tested-by: kokoro <noreply+kokoro@google.com>
2021-12-11 03:59:19 +00:00
Matthew Poremba
23aec13f07 arch-vega: Implement V_AND_OR_B32
Change-Id: I8daeb8de2db5996e132cf7ed729f02c3c94a6862
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/53868
Reviewed-by: Matt Sinclair <mattdsinclair@gmail.com>
Maintainer: Matt Sinclair <mattdsinclair@gmail.com>
Tested-by: kokoro <noreply+kokoro@google.com>
2021-12-11 03:59:19 +00:00