Commit Graph

19613 Commits

Author SHA1 Message Date
Bobby R. Bruce
d1c72cecb3 tests: Update the compiler-tests.sh to use the v22-1 images
This keeps the running of the compiler tests consistent by using a fixed
version of the compiler images.

Change-Id: I6e8d8313939696ed22f22e55f9c274c0105ce236
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/65918
Reviewed-by: Bobby Bruce <bbruce@ucdavis.edu>
Maintainer: Bobby Bruce <bbruce@ucdavis.edu>
Tested-by: kokoro <noreply+kokoro@google.com>
2022-12-05 20:25:53 +00:00
Bobby R. Bruce
ed6d80c273 util-docker: Add v22-1 tag to docker-compose.yaml
Change-Id: I91088efe4e0bcee9b9f83d5208a14932821a17c4
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/65917
Reviewed-by: Bobby Bruce <bbruce@ucdavis.edu>
Maintainer: Bobby Bruce <bbruce@ucdavis.edu>
Tested-by: kokoro <noreply+kokoro@google.com>
2022-12-05 20:25:53 +00:00
Bobby R. Bruce
3df8be981b util-docker: Update gcn-gpu Docker to use v22-1 ROCM patch
Change-Id: I21b530babe095861eb80fdfefd12d8e127ffa3c2
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/65916
Reviewed-by: Bobby Bruce <bbruce@ucdavis.edu>
Maintainer: Bobby Bruce <bbruce@ucdavis.edu>
Tested-by: kokoro <noreply+kokoro@google.com>
2022-12-05 20:25:53 +00:00
Bobby R. Bruce
7185c9ea19 stdlib: Update the gem5 resources' version to "v22.1"
This is required to ensure the correct version of the resources are
obtained for this version of gem5.

Change-Id: If316081c776d510ec9a2f7ff9e077a1f837d2d2e
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/65915
Reviewed-by: Bobby Bruce <bbruce@ucdavis.edu>
Tested-by: kokoro <noreply+kokoro@google.com>
Maintainer: Bobby Bruce <bbruce@ucdavis.edu>
2022-12-05 20:25:53 +00:00
Bobby R. Bruce
da2c70af6f python,tests: Update Resource URL path to v22-1
This change ensures the stable branch obtains the right resources for
the correct version of gem5.

Change-Id: Ie4e90529460d5058a7696d1c1d8f9678563be7bb
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/65914
Reviewed-by: Bobby Bruce <bbruce@ucdavis.edu>
Tested-by: kokoro <noreply+kokoro@google.com>
Maintainer: Bobby Bruce <bbruce@ucdavis.edu>
2022-12-05 20:25:53 +00:00
Bobby R. Bruce
363d65206a base: Update the version to v22.1.0.0
Change-Id: I4d511a8052cfa5b23e8fecff5e3565b7cfea1763
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/65913
Maintainer: Bobby Bruce <bbruce@ucdavis.edu>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Bobby Bruce <bbruce@ucdavis.edu>
2022-12-05 20:25:53 +00:00
Bobby R. Bruce
7dd61c8659 scons: Remove -Werror for the gem5 v22.1 release
While gem5 compiles on all our supported compilers, removing the -Werror
flag on the stable branch ensures that, as new compilers are released
with stricter warnings, gem5 remains compilable.

Change-Id: Ib6d4f86d9c7e60f23eba843e444cdd7812cdde41
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/65912
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Bobby Bruce <bbruce@ucdavis.edu>
Maintainer: Bobby Bruce <bbruce@ucdavis.edu>
2022-12-05 20:25:53 +00:00
Giacomo Travaglini
23a406e811 arch-arm: Setup TC/ISA at construction time 2nd attempt
This partly reverts commit ec75787aef
by fixing the original problem noted by Bobby (long regressions):

setupThreadContext has to be implemented otherswise the GICv3 cpu interface
will end up holding old references when switching TC/ISAs.

This new implementation is still setting up the cpu interface reference
in the ISA only when it is required, but it is storing the
TC/ISA reference within the interface every time the ISA::setupThreadContext
gets called.

Change-Id: I2f54f95761d63655162c253e887b872f3718c764
Signed-off-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/66291
Maintainer: Bobby Bruce <bbruce@ucdavis.edu>
Maintainer: Andreas Sandberg <andreas.sandberg@arm.com>
Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Bobby Bruce <bbruce@ucdavis.edu>
2022-12-05 20:25:33 +00:00
Melissa Jost
6f3f6c16f3 stdlib, configs: Updating configs/example/gem5_library
This commit updates all of the older tests in this directory to
use the Simulator to run instead of m5.simulate()

Change-Id: I2a81d5c2f27c89e8c03abb0203ca3e58a6688672
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/64791
Reviewed-by: Bobby Bruce <bbruce@ucdavis.edu>
Tested-by: kokoro <noreply+kokoro@google.com>
Maintainer: Bobby Bruce <bbruce@ucdavis.edu>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/66332
2022-12-02 17:24:04 +00:00
Bobby R. Bruce
005049f548 stdlib,python: Allow setting of to tick exits via m5
This commit adds the following functions to the `m5` python module:

- setMaxTick(tick) -> None
- getMaxTick() -> int
- getTicksUntilMax() -> int
- scheduleTickExitFromCurrent(tick, exit_string) -> None
- scheduleTickExitAbsolute(tick, exit_string) -> None

Until this patch the only way to set an exit at a particular tick was
via `simulate.run` which would reschedule the maximum tick. This
functionality has been explicity exposed via the new `setMaxTick`
function. However, as this is only rescheduling the maximum tick, it
stops scheduling exits at multiple different ticks.

To get around this problem the `scheduleTickExit` functions have been
added. These allow a user to schedule multiple exit events. The
functions contain a `exit_string` parameter that provides the string
the simulator is to return when the specified tick is met. By default
this string is "Tick exit reached" which is used by the stdlib
Simulator module to declare a new `SCHEDULED_TICK` exit event (Note:
this has been deliberatly kept seperate from the `MAX_TICK` exit event.
This commit serves as an attempt to decouple these are two concepts).

Tests are provided in this patch to ensure these new functions work as
intended.

Additional notes:
- The `simulate` function has been fixed to match the documentation. If
  the `num_cycles` is -1 then the maximum ticks is set to MaxTicks.
  Otherwise the max ticks is set to `curTicks() + num_cycles`. The
  functionality of this function will remain unchanged to the end-user.
- Full integration into the Simulator module is not complete as of this
  patch. Users must us the m5 python module to set these exit events.

Change-Id: I6c92b31dd409dc866152224600ea8166cfcba38b
Issue-on: https://gem5.atlassian.net/browse/GEM5-1131
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/66231
Reviewed-by: Jason Lowe-Power <power.jg@gmail.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Maintainer: Jason Lowe-Power <power.jg@gmail.com>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/66331
Reviewed-by: Bobby Bruce <bbruce@ucdavis.edu>
Maintainer: Bobby Bruce <bbruce@ucdavis.edu>
2022-12-02 17:24:04 +00:00
Matthew Poremba
ea3f13ff3b configs: Set CPU vendor to M5 Simulator in apu_se.py
Other vendor strings causes, for some reason, bad addresses to be
computed when running the GPU model. This change reverts back to M5
Simulator only for apu_se.py.

Change-Id: I5992b4e31569f5c0e5e49e523908c8fa0602f845
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/66171
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Bobby Bruce <bbruce@ucdavis.edu>
Maintainer: Bobby Bruce <bbruce@ucdavis.edu>
2022-11-28 23:02:55 +00:00
Bobby R. Bruce
ee9e07474b tests: Delete build directory before running KVM in nightly
The nightly tests failed here:
https://jenkins.gem5.org/job/nightly/430/. What seems to have happened
is the ALL/gem5.opt us compiled within the Docker container but then,
for the KVM tests, there is an attempt to recompile on the host, which
causes compilation problems. The safest strategy here is delete the
build directory prior to running the KVM tests.

In latest versions of our test infrastructure, the KVM tests should be
run completely separately (i.e., in different Jenkin's jobs) to avoid
this.

Change-Id: Id7d18c0504dd324f7a0e5e9a7809463520969dda
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/65911
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/+/65977
2022-11-28 18:52:51 +00:00
Bobby R. Bruce
d51ce0db94 configs: Add missing _pre_instantiate call in "run_lupv.py"
As of this change:
https://gem5-review.googlesource.com/c/public/gem5/+/65051, the
`_pre_instantiate` function must be called prior to `m5.instantiate`
when using the stdlib without the Simulator module.

Change-Id: Id5cec3b643d556b0f742719596abb53533b84cbd
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/65871
Reviewed-by: Bobby Bruce <bbruce@ucdavis.edu>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Jason Lowe-Power <power.jg@gmail.com>
Maintainer: Bobby Bruce <bbruce@ucdavis.edu>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/65976
2022-11-28 18:52:51 +00:00
Bobby R. Bruce
753470e8fa tests: Update riscvmatched tests to use ALL/gem5.opt
Where possible we are trying to use the ALL/gem5.opt compilation of
gem5. This change updates the riscvmatched tests to this.

Change-Id: I1c5f1d86cdf5cf29b8964f8a894a3476a7cb290a
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/65854
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Bobby Bruce <bbruce@ucdavis.edu>
Maintainer: Bobby Bruce <bbruce@ucdavis.edu>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/65975
2022-11-28 18:52:51 +00:00
Bobby R. Bruce
793076f2bd configs,stdlib,tests: Update riscvmatched-fs.py to-init
The "test-gem5-library-example-riscvmatched-fs" test, which runs
"configs/example/gem5_library/riscvmatched-fs.py", was running the
script in full. This takes a very long time. Given we already have boot
tests for RISCV, it's better to just run this configuration to just the
end of the Linux boot (significantly faster than a full OS boot). This
patch adds this feature to the config script and modifies the test to
utilize it.

Change-Id: I1e37a26aab5e9a127ebd64590be79fbc16fe53aa
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/65853
Reviewed-by: Bobby Bruce <bbruce@ucdavis.edu>
Maintainer: Bobby Bruce <bbruce@ucdavis.edu>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/65974
2022-11-28 18:52:51 +00:00
Bobby R. Bruce
373b8658f4 configs,stdlib: Fix import in riscvmatched-fs.py
Change-Id: I2ff4139457d32336f40c6655231064a12c4d8694
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/65852
Tested-by: kokoro <noreply+kokoro@google.com>
Maintainer: Bobby Bruce <bbruce@ucdavis.edu>
Reviewed-by: Bobby Bruce <bbruce@ucdavis.edu>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/65973
2022-11-28 18:52:51 +00:00
Bobby R. Bruce
f34f582dcf stdlib,configs: Update riscvmatched-fs example docstring
This documentation string provided in the
"config/example/gem5_library/riscvmatched-fs.py" was minimal. This patch
adds more detail.

Change-Id: I0f203ea6952fc72a078594d7c30853bd426017ff
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/65851
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Bobby Bruce <bbruce@ucdavis.edu>
Maintainer: Bobby Bruce <bbruce@ucdavis.edu>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/65972
2022-11-28 18:52:51 +00:00
Bobby R. Bruce
9696cb517a arch-arm: Revert 'Setup TC/ISA at construction time..'
Reverts:

dd2f1fb2f8
https://gem5-review.googlesource.com/c/public/gem5/+/65174

and

47bd56ee71
https://gem5-review.googlesource.com/c/public/gem5/+/65291

The 47bd56ee change resulted in the
`SuiteUID:tests/gem5/fs/linux/arm/test.py:realview-switcheroo-noncaching-timing-ALL-x86_64-opt`
nightly test stalling. This behavior can be reproduced with:

```
./build/ALL/gem5.opt tests/gem5/fs/linux/arm/run.py tests/gem5/configs/realview-switcheroo-noncaching-timing.py tests/gem5/resources/arm “$(pwd)”
```

The subsequent change, dd2f1fb2, must be reverted for this change to be
reverted.

Change-Id: I6fed74f33d013f321b93cf1a73eee404cb87ce18
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/65732
Reviewed-by: Jason Lowe-Power <power.jg@gmail.com>
Maintainer: Bobby Bruce <bbruce@ucdavis.edu>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/65971
Reviewed-by: Bobby Bruce <bbruce@ucdavis.edu>
2022-11-28 18:52:51 +00:00
Bobby R. Bruce
98f3d779b7 arch-x86: X86ISA default vector_string to HygonGenuine
This commit,
https://gem5-review.googlesource.com/c/public/gem5/+/64831, changed the
default 'vendor_string' for the 'X86ISA' SimObject from 'M5 Simulator'
and 'AuthenticAMD'. Unforunately due to an issue highlighted here:
https://gem5.atlassian.net/browse/GEM5-1300 we cannot use the
'AuthenticAMD'. Therefore, this change updates the default vector_string
to HygonGenuine.

The HygonGenuine is simple but works.

Change-Id: I21421da8ae73e76d9daaf2fdd0b3238d5b309172
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/65492
Tested-by: kokoro <noreply+kokoro@google.com>
Maintainer: Bobby Bruce <bbruce@ucdavis.edu>
Reviewed-by: Bobby Bruce <bbruce@ucdavis.edu>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/65611
Reviewed-by: Matt Sinclair <mattdsinclair@gmail.com>
2022-11-28 18:52:51 +00:00
Matthew Poremba
04767ddc62 dev-amdgpu: Fix SDMA ring buffer wrap around
The current SDMA wrap around handling only considers the ring buffer
location as seen by the GPU. Eventually when the end of the SDMA ring
buffer is reached, the driver waits until the rptr written back to the
host catches up to what the driver sees before wrapping around back to
the beginning of the buffer. This writeback currently does not happen at
all, causing hangs for applications with a lot of SDMA commands.

This changeset first fixes the sizes of the queues, especially RLC
queues, so that the wrap around occurs in the correct place. Second, we
now store the rptr writeback address and the absoluate (unwrapped) rptr
value in each SDMA queue. The absolulte rptr is what the driver sends to
the device and what it expects to be written back.

This was tested with an application which basically does a few hundred
thousand hipMemcpy() calls in a loop. It should also fix the issue with
pannotia BC in fullsystem mode.

Change-Id: I53ebdcc6b02fb4eb4da435c9a509544066a97069
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/65351
Maintainer: Jason Lowe-Power <power.jg@gmail.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Jason Lowe-Power <power.jg@gmail.com>
Reviewed-by: Matt Sinclair <mattdsinclair@gmail.com>
Maintainer: Matt Sinclair <mattdsinclair@gmail.com>
(cherry picked from commit c8d687b05c)
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/65451
Maintainer: Bobby Bruce <bbruce@ucdavis.edu>
Reviewed-by: Bobby Bruce <bbruce@ucdavis.edu>
Reviewed-by: Matthew Poremba <matthew.poremba@amd.com>
2022-11-11 00:11:21 +00:00
Matthew Poremba
729a9399e4 arch-vega: Fix SOPK instruction sign extends
See: https://gem5-review.googlesource.com/c/public/gem5/+/37495

Same patch but for vega. This fixes issues with lulesh and probably
rodinia - heartwall as well in fullsystem.

Change-Id: I3af36bb9b60d32dc96cc3b439bb1167be1b0945d
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/65432
Reviewed-by: Matt Sinclair <mattdsinclair@gmail.com>
Maintainer: Matt Sinclair <mattdsinclair@gmail.com>
Tested-by: kokoro <noreply+kokoro@google.com>
(cherry picked from commit 8693d725e2)
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/65453
Maintainer: Bobby Bruce <bbruce@ucdavis.edu>
Reviewed-by: Bobby Bruce <bbruce@ucdavis.edu>
Reviewed-by: Matthew Poremba <matthew.poremba@amd.com>
2022-11-11 00:11:05 +00:00
Matthew Poremba
56c359c41b dev-amdgpu: Handle ring buffer wrap for PM4 queue
Change-Id: I27bc274327838add709423b072d437c4e727a714
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/65431
Maintainer: Matt Sinclair <mattdsinclair@gmail.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Matt Sinclair <mattdsinclair@gmail.com>
(cherry picked from commit 623e2d3dac)
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/65452
Maintainer: Bobby Bruce <bbruce@ucdavis.edu>
Reviewed-by: Matthew Poremba <matthew.poremba@amd.com>
Reviewed-by: Bobby Bruce <bbruce@ucdavis.edu>
2022-11-11 00:10:59 +00:00
Jasjeet Rangi
f172c41c68 stdlib: Fix get_isa_from_str() exception behavior in isas.py
When given an input string that does not match any valid ISA, the
get_isa_from_str() function should call get_isas_str_set() to to print
the valid ISA strings in the exception. The current behavior is to
recursively call get_isa_from_str() with no input, which prevents
the correct exception from being raised. This change causes the
correct exception to be raised for invalid inputs.

Change-Id: I92bfe862bbd99ce0b63bfc124e539fab3b175e0c
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/65411
Reviewed-by: Jason Lowe-Power <power.jg@gmail.com>
Maintainer: Bobby Bruce <bbruce@ucdavis.edu>
Reviewed-by: Bobby Bruce <bbruce@ucdavis.edu>
Tested-by: kokoro <noreply+kokoro@google.com>
2022-11-09 18:37:14 +00:00
Matthew Poremba
8d63c9fc06 gpu-compute: Add granulated SGPR computation for gfx9
The granulated SGPR size is used when the number of SGPRs is unknown.
The computation for this has changed since gfx8 and is commented as a
TODO in a comment.

This changeset implements the change and also checks for an invalid SGPR
count. According to LLVM code this could happen "due to a compiler bug
or when using inline asm.":
https://github.com/llvm/llvm-project/blob/main/llvm/lib/Target/AMDGPU/
    AMDGPUAsmPrinter.cpp#L723

Change-Id: Ie487a53940b323a0002341075e0f81af4147a7d8
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/65252
Maintainer: Matt Sinclair <mattdsinclair@gmail.com>
Reviewed-by: Matt Sinclair <mattdsinclair@gmail.com>
Tested-by: kokoro <noreply+kokoro@google.com>
2022-11-08 21:34:11 +00:00
Matthew Poremba
f6dc5c6aa4 gpu-compute: Chunkify AMDKernelCode read from device
The AMDKernelCode object can span potentially span two pages. Currently
the copy loop from device memory only translates once at the base
address.

This changeset translates one cache line at a time before copying and
has the ancillary benefit for cleaning up this code a bit.

Change-Id: I602bc12d8f8c5d3a3e57ab3f42f7dd3df58dc144
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/65251
Reviewed-by: Matt Sinclair <mattdsinclair@gmail.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Jason Lowe-Power <power.jg@gmail.com>
Maintainer: Jason Lowe-Power <power.jg@gmail.com>
2022-11-08 21:34:11 +00:00
Hoa Nguyen
553096ee53 stdlib: Make the Matched board a package
So that the board and its components can be reused.

Change-Id: Idae1a4493fbb4d826ac8da76532692a985f8025f
Signed-off-by: Hoa Nguyen <hoanguyen@ucdavis.edu>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/65331
Maintainer: Jason Lowe-Power <power.jg@gmail.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Jason Lowe-Power <power.jg@gmail.com>
2022-11-08 05:32:32 +00:00
Hoa Nguyen
5d0a7b6a6c arch-riscv: Updating the SD bit of mstatus upon the register read
Per RISC-V ISA Manual, vol II, section 3.1.6.6, page 26, the SD bit is
a read-only bit indicating whether any of FS, VS, and XS fields being
in the respective dirty state.

Per section 3.1.6, page 20, the SD bit is the most significant bit of
the mstatus register for both RV32 and RV64.

Per section 3.1.6.6, page 29, the explicit formula for updating the SD is,
    SD = ((FS==DIRTY) | (XS==DIRTY) | (VS==DIRTY))

Previously in gem5, this bit is not updated anywhere in the gem5
implementation. This cause an issue of incorrectly saving the context
before entering the system call and consequently, incorecttly restoring
the context after a system call as described here [1].

Ideally, we want to update the SD after every relevant instruction;
however, lazily updating the Status register upon its read produces
the same effect.

[1] https://gem5-review.googlesource.com/c/public/gem5/+/65272/

Change-Id: I1db0cc619d43bc5bacb1d03f6f214345d9d90e28
Signed-off-by: Hoa Nguyen <hoanguyen@ucdavis.edu>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/65273
Maintainer: Jason Lowe-Power <power.jg@gmail.com>
Reviewed-by: Jason Lowe-Power <power.jg@gmail.com>
Tested-by: kokoro <noreply+kokoro@google.com>
2022-11-06 00:45:10 +00:00
Giacomo Travaglini
dd2f1fb2f8 arch-arm: Setup ISA::gicv3CpuInterface on demand only
This is aligning with what we are already doing with the CoreTimers:
rather than setting up the interface at ISA::startup, we set it
up on the first time the GIC cpu interface is actually required
by the ISA

Change-Id: Iec29b2098ea29ca2886a69c5db8a2bc8d2f6f71e
Signed-off-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/65174
Reviewed-by: Jason Lowe-Power <power.jg@gmail.com>
Maintainer: Andreas Sandberg <andreas.sandberg@arm.com>
Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com>
Maintainer: Jason Lowe-Power <power.jg@gmail.com>
Tested-by: kokoro <noreply+kokoro@google.com>
2022-11-04 21:25:37 +00:00
Giacomo Travaglini
47bd56ee71 dev-arm: Setup TC/ISA at construction time of Gicv3CPUInterface
We should initialize them as soon as possible to make sure
any Gicv3CPUInterface method uses a valid reference

Change-Id: I8fffebdab9136a9027c4f61bb9413e97031e1969
Signed-off-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/65291
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: Andreas Sandberg <andreas.sandberg@arm.com>
Maintainer: Andreas Sandberg <andreas.sandberg@arm.com>
2022-11-04 21:25:37 +00:00
Hoa Nguyen
a4f86df266 arch-riscv: Update FS field of mstatus register where approriate.
Per RISC-V ISA Manual, vol II, section 3.1.6.6, page 25, the
FS field of the mstatus register encodes the status of the floating
point unit, including the floating point registers. Per page 27,
microarchitecture can choose to set the FS field to Dirty even if
the floating point unit has not been modified.

Per section 3.1.6, page 20, the FS field is located at bits 14..13
of the mstatus register.

Per section 3.1.6.6, page 27, the FS field is used for saving
context.

Upon a system call, the Linux kernel relies on mstatus for
choosing registers to save for switching to kernel code.
In particular, if the SD bit (updating this bit is also a bug
in gem5 and will be explained in the next commit) is not set
properly due to the FS field being incorrect, the process of saving
the context and restoring the context result in the floating
point registers being zeroed out. I.e., upon the saving context
function call, the floating point registers are not saved, while
in restore context function call, the floating point registers
are overwritten with zero bits.

Previously, in gem5 RISC-V ISA, the FS field is not updated upon
floating point instruction execution. This caused issue on context
saving described above.

This change conservatively updates the FS field to Dirty on
the execution of any floating point instruction.

Change-Id: I8b3b4922e8da483cff3a2210ee80c163cace182a
Signed-off-by: Hoa Nguyen <hoanguyen@ucdavis.edu>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/65272
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-11-04 21:02:29 +00:00
Hoa Nguyen
3b8125d28e arch-riscv: Add VS field to the STATUS CSR
Per RISC-V ISA Manual, vol II, section 3.1.6, page 20, the VS field
is located at bits 10..9 of mstatus. Per section 4.1.1, page 63,
the VS field is located at the same bits of sstatus.

Change-Id: Ifda44441c551a23ed892fb8ac7ef31fa98f0b6db
Signed-off-by: Hoa Nguyen <hoanguyen@ucdavis.edu>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/65274
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-11-04 21:02:29 +00:00
Hoa Nguyen
26c27b1bf8 stdlib: Change the default kernel boot param from "ro" to "rw"
Running workloads likely causes some content to be written to
the disk image, e.g., `m5 readfile`. However, on riscv boards,
the default kernel param specifies the disk image to be read-only.

This change changes this param so that the disk image is
read-write by default.

Change-Id: I414e483ad11d747f34433560e32a8f91a425ce7e
Signed-off-by: Hoa Nguyen <hoanguyen@ucdavis.edu>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/65194
Maintainer: Jason Lowe-Power <power.jg@gmail.com>
Reviewed-by: Jason Lowe-Power <power.jg@gmail.com>
Tested-by: kokoro <noreply+kokoro@google.com>
2022-11-04 19:29:38 +00:00
Bobby R. Bruce
c871d25ede stdlib: Fixing erroneous typing in Simulator __init__
The key in the `on_exit_event` dictionary can only be an ExitEvent. The
typing information here suggested a string could be passed. This is not
the case. This patch fixes the issue.

Change-Id: Iaa4b66417c15e31f6aafe9e550a7552461a15be1
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/64773
Maintainer: Bobby Bruce <bbruce@ucdavis.edu>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Bobby Bruce <bbruce@ucdavis.edu>
2022-11-04 18:04:54 +00:00
Bobby R. Bruce
353c20e8bf stdlib: Fix typos and remove unneeded import in Simulator
Change-Id: I6faa63959d09444b8e931e14846fb1af98866ade
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/62931
Tested-by: kokoro <noreply+kokoro@google.com>
Maintainer: Bobby Bruce <bbruce@ucdavis.edu>
Reviewed-by: Bobby Bruce <bbruce@ucdavis.edu>
2022-11-04 18:04:54 +00:00
Bobby R. Bruce
c88b528738 stdlib: Update AbstractCore's 'set_inst_stop_any_thread'
This patch:
- Makes this function private.
- Updates the function's documentation.
- Changes the 'init' parameter to 'board_initialized'.

It doesn't make much sense for this function to be exposed directly to
the user as it requires knowing whether the board is initialized or not.

In addition to this I believe it makes more sense for the 'init' logic
to be flipped and renamed "board_initialized' so that this value is True
if the board has been initialized.

The documentation for this function has been updated.

Change-Id: I016c65bde88357111d3e648d7aa99aeb6e31f410
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/64833
Maintainer: Bobby Bruce <bbruce@ucdavis.edu>
Reviewed-by: Bobby Bruce <bbruce@ucdavis.edu>
Tested-by: kokoro <noreply+kokoro@google.com>
2022-11-04 18:04:54 +00:00
Bobby R. Bruce
12d8d5ca26 stdlib: Update AbstractCore set_simpoint func
This change:
- Makes this function private.
- Adds better documentation describing the usage.
- Changes the 'init' param to 'board_initialized'

This function really doesn't make much sense to set directly by an
stdlib user. It requires knowing whether or not the the board has been
initialized which is an annoying detail and will cause error if set
incorrectly.

The logic of the `init` parameter has been flipped to be
`board_initialized`. This makes it clearer what the parameter is
doing and what it's for.

The documentation for this function has been updated to make it clearer
on how the `board_initialized` parameter should be used correctly.

Change-Id: I567a48df06e6327b38673a2c510065d4334657e2
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/64832
Reviewed-by: Melissa Jost <mkjost@ucdavis.edu>
Reviewed-by: Jason Lowe-Power <power.jg@gmail.com>
Maintainer: Bobby Bruce <bbruce@ucdavis.edu>
Tested-by: kokoro <noreply+kokoro@google.com>
2022-11-04 18:04:54 +00:00
Bobby R. Bruce
905b71c375 python: Move find from group to AbstractStat
This expands the 'find' feature to be recursive and find all the
stats/groups of stats of that regex all the way down the SimStats tree.

Change-Id: Id888911a6189e0440d2537f9720aa594353e00c7
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/63692
Maintainer: Bobby Bruce <bbruce@ucdavis.edu>
Reviewed-by: Bobby Bruce <bbruce@ucdavis.edu>
Tested-by: kokoro <noreply+kokoro@google.com>
2022-11-03 22:32:36 +00:00
Bobby R. Bruce
b65fa9e0d8 python: Add AbstractStat for PyStats
Previously all PyStats inheritted from JsonSerializable. The
AbstractStat class has been added to give a cleaner, clearer Base class
for PyStats.

Change-Id: I7e1808c4b4dcd6110fd524ad3553a9dc19f72e24
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/63691
Reviewed-by: Bobby Bruce <bbruce@ucdavis.edu>
Maintainer: Bobby Bruce <bbruce@ucdavis.edu>
Tested-by: kokoro <noreply+kokoro@google.com>
2022-11-03 22:32:36 +00:00
Bobby R. Bruce
68f8c2946d stdlib: Add 'get_simstats' function to simulator
Change-Id: Iedf937a66f33c5a5feada4ffbf550540f65680d1
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/63272
Tested-by: kokoro <noreply+kokoro@google.com>
Maintainer: Jason Lowe-Power <power.jg@gmail.com>
Reviewed-by: Jason Lowe-Power <power.jg@gmail.com>
2022-11-03 22:32:36 +00:00
Bobby R. Bruce
4a06375212 stdlib: Add __repr__ to pystats
For Statistics the value is returned. E.g.:

```
print(simstats.board.core.some_integer)
> 5
```

For Groups the names of the stats in that group are listed.
E.g.:

```
print(stats.board.core)
> [Group: [some_integer, another_stat, another_group]]
```

Change-Id: I94cea907608fba622f4fc141d5b22ac95d8cde40
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/63271
Tested-by: kokoro <noreply+kokoro@google.com>
Maintainer: Bobby Bruce <bbruce@ucdavis.edu>
Reviewed-by: Bobby Bruce <bbruce@ucdavis.edu>
2022-11-03 22:32:36 +00:00
Bobby R. Bruce
be33be87da misc: Update black to process src/python/m5/ext/pystats
The exclusion in .pre-commit-config.yaml covered all files in
src/python/m5/ext. This excludes src/python/m5/exit/pystats, which we
want covered by black. This commit updates .pre-commit-config.yaml to
only exclude src/python/m5/ext/pyfdt.

This change also runs black on these files.

Change-Id: Iecff45ea2a27a37fc0d00b867d41300aad911c7a
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/63711
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Bobby Bruce <bbruce@ucdavis.edu>
Maintainer: Bobby Bruce <bbruce@ucdavis.edu>
2022-11-03 22:32:36 +00:00
Bobby R. Bruce
5204b58e19 stdlib: Rename JsonSerializable to SerializableStat
As this abstract class now allows the output of text stats, it's more
appropriate to rename it. It no longer handles processing just for JSON
output

Change-Id: Ia9a1e3ef4029de45a11ac261fb14c9bdfa412cdd
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/59273
Reviewed-by: Bobby Bruce <bbruce@ucdavis.edu>
Tested-by: kokoro <noreply+kokoro@google.com>
Maintainer: Bobby Bruce <bbruce@ucdavis.edu>
2022-11-03 22:32:36 +00:00
Bobby R. Bruce
2211fdb607 tests,stdlib: Add a test for JsonSerializable
Change-Id: I9e1fa6ee67f5d73d41fa9972bdb9a3da7dda8957
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/58729
Maintainer: Jason Lowe-Power <power.jg@gmail.com>
Reviewed-by: Jason Lowe-Power <power.jg@gmail.com>
Tested-by: kokoro <noreply+kokoro@google.com>
2022-11-03 22:32:36 +00:00
Melissa Jost
23d405ea55 tests, resources: CVE-2007-4559 Patch
Hi, we are security researchers from the Advanced Research Center at Trellix.
We have began a campaign to patch a widespread bug named CVE-2007-4559.
CVE-2007-4559 is a 15 year old bug in the Python tarfile package. By using
extract() or extractall() on a tarfile object without sanitizing input,
a maliciously crafted .tar file could perform a directory path traversal
attack. We found at least one unsantized extractall() in your codebase
and are providing a patch for you via pull request. The patch essentially
checks to see if all tarfile members will be extracted safely and throws
an exception otherwise. We encourage you to use this patch or your own
solution to secure against CVE-2007-4559.

If you have further questions you may contact us through this
projects lead researcher Kasimir Schulz.

Change-Id: I891ac6652cfbd479aed51d64ef6d4e0fe740e06d
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/65271
Reviewed-by: Bobby Bruce <bbruce@ucdavis.edu>
Maintainer: Jason Lowe-Power <power.jg@gmail.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Jason Lowe-Power <power.jg@gmail.com>
2022-11-03 22:17:50 +00:00
Jui-Min Lee
f61a640d30 mem: Fix SHM server path cleanup logic
Previously, shared memory server remove old socket *before* filling the
target path into API's data structure. However, the target path might
get truncated hence the path we check against might not be the one we
will be using in the end.

In a case where the path specified by user is free while the truncated
path is in used, gem5 will get a mysterious EADDRINUSE.

We swap the two steps in the CL, so we'll be checking against the actual
path we use, instead of the path user request to use.

Change-Id: Ib34f8b00ea1d2f15dcd4e7b6d2d4a6d6ddc4e411
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/65153
Reviewed-by: Gabe Black <gabeblack@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Maintainer: Gabe Black <gabeblack@google.com>
2022-11-03 07:31:36 +00:00
Earl Ou
5bf88bf7a1 sim: allow specifying remote gdb port for each workload
In a platform with multiple systems, we may want to specify the
remote gdb port for each system. This change makes it
possible to specify the port number at each Workload instance.

Change-Id: I755b3960ee920ae5289819aa05d98902614a5615
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/65151
Maintainer: Earl Ou <shunhsingou@google.com>
Reviewed-by: Yu-hsin Wang <yuhsingw@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
2022-11-03 05:34:09 +00:00
Yu-hsin Wang
540e6515de ext: upgrade to googletest 1.12.0
Upgrade googletest to 1.12.0
upstream commit: 15460959cbbfa20e66ef0b5ab497367e47fc0a04

sha1sum e1e4ab7f4add6d403c37970a83a596b3081077d6 generated by command:
find . -type f ! -name SConscript ! -path "./.*" -print0 \
| sort -z | xargs -0 sha1sum | sha1sum

This upgrade is mainly for solving the infinite-recursion warning from
g++12

ext/googletest/googlemock/include/gmock/internal/gmock-internal-utils.h: In function ‘testing::internal::Invalid<gem5::Port&>()gem5::Port&’:
ext/googletest/googlemock/include/gmock/internal/gmock-internal-utils.h:296:10: error: infinite recursion detected [-Werror=infinite-recursion]
  296 | inline T Invalid() {
      |          ^~~~~~~
ext/googletest/googlemock/include/gmock/internal/gmock-internal-utils.h:301:20: note: recursive call
  301 |   return Invalid<T>();
      |          ~~~~~~~~~~^~
ext/googletest/googlemock/include/gmock/internal/gmock-internal-utils.h: In function ‘testing::internal::Invalid<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&>()std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&’:
ext/googletest/googlemock/include/gmock/internal/gmock-internal-utils.h:296:10: error: infinite recursion detected [-Werror=infinite-recursion]
  296 | inline T Invalid() {
      |          ^~~~~~~
ext/googletest/googlemock/include/gmock/internal/gmock-internal-utils.h:301:20: note: recursive call
  301 |   return Invalid<T>();
      |          ~~~~~~~~~~^~

Change-Id: I14594f7bc148281784043b3f715173316e6d62d4
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/65211
Maintainer: Gabe Black <gabeblack@google.com>
Reviewed-by: Gabe Black <gabeblack@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
2022-11-03 02:44:51 +00:00
Jason Lowe-Power
c6918c8f74 python,stdlib: Add multiprocessing module
This changeset replicates some of the multiprocessing module
implementation from the python standard library in gem5. The goal of
this and following changesets is to enable users to use a *single* set
of python scripts to run and analyze a suite of gem5 simulations.

We must reimplement some of the multiprocessing module becaue it is not
flexible enough to allow for customized command line parameter to the
"python" executable (gem5 in our case). To get around this, I extended
the Process and context objects to be gem5 specific.

The next steps is to wrap the Process and Pool types with gem5-specific
versions that will improve their usability for our needs. With this
changeset, these objects are usable, but it will require significant
user effort to reach the goal of running/analyzing many different gem5
simulations.

There are some limitation:
- The pool will only work if the max tasks per child is 1
- The functions that are executed must come from another module

As an example, the following code should work after applying this
change.

test.py:
```python
from gem5.utils.multiprocessing import Process, Pool
from sim import info, run_sim
if __name__ == '__m5_main__' or __name__ == '__main__':
    info('main line')
    p1 = Process(target=run_sim, args=('bob',))
    p2 = Process(target=run_sim, args=('jane',))
    p1.start()
    p2.start()
    p2.join()
    p1.join()
    with Pool(processes=4, maxtasksperchild=1) as pool:
        pool.map(run_sim, range(10))
```

sim.py:
```
import os
def info(title):
    print(title)
    print('module name:', __name__)
    print('parent process:', os.getppid())
    print('process id:', os.getpid())
def run_sim(name):
    info('function g')
    from gem5.prebuilt.demo.x86_demo_board import X86DemoBoard
    from gem5.resources.resource import Resource
    from gem5.simulate.simulator import Simulator
    board = X86DemoBoard()
    board.set_kernel_disk_workload(
        kernel=Resource("x86-linux-kernel-5.4.49"),
        disk_image=Resource("x86-ubuntu-18.04-img"),
    )
    simulator = Simulator(board=board)
    simulator.run(max_ticks=10000000)
```

Change-Id: I4348ebaa75d006949ec96e732f5dc2a5173c6048
Signed-off-by: Jason Lowe-Power <jason@lowepower.com>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/63432
Tested-by: kokoro <noreply+kokoro@google.com>
Maintainer: Jason Lowe-Power <power.jg@gmail.com>
Reviewed-by: Bobby Bruce <bbruce@ucdavis.edu>
Reviewed-by: Richard Cooper <richard.cooper@arm.com>
2022-11-02 20:05:49 +00:00
Giacomo Travaglini
aead8fb0fd arch-arm: Remove ISA::haveGICv3CpuIfc method
The method is really not needed as we do not implement
GICv3 in legacy mode... Therefore when we want to check if
the GICv3 cpu interface is present, we can just check for
GICv3 being present

Change-Id: I264f887392d188a515480c2e31a4a4da3e67c498
Signed-off-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/65173
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-11-02 08:32:44 +00:00
Giacomo Travaglini
d348df8763 arch-arm: Fix GICv3 List register mapping
Change-Id: I870104cf27cc9ba28763adc5b43ff850c1ea279f
Signed-off-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/65172
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-11-02 08:32:44 +00:00