Commit Graph

2440 Commits

Author SHA1 Message Date
Samuel Stark
eafc6ea626 cpu: Handle external TLBI Sync requests in TimingCPU
JIRA: https://gem5.atlassian.net/browse/GEM5-1097

Change-Id: I4e92f7886a296f119720b8bcda6bea722df76153
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/57291
Reviewed-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
Maintainer: Giacomo Travaglini <giacomo.travaglini@arm.com>
Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com>
Tested-by: kokoro <noreply+kokoro@google.com>
2022-04-06 16:17:57 +00:00
Giacomo Travaglini
39ed6e0373 cpu, arch-arm: Rename initiateSpecialMemCmd to initateMemMgmtCmd
This is aligning with the name of the generated memory requests

Change-Id: Ifdfa01477abf7ff597dce3b5cff78f9a27fdcbcc
Signed-off-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/58511
Reviewed-by: Jason Lowe-Power <power.jg@gmail.com>
Maintainer: 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>
2022-04-05 09:24:16 +00:00
Gabe Black
e6c0ba97db scons: Put all config variables in an env['CONF'] sub-dict.
This makes what are configuration and what are internal SCons variables
explicit and separate, and makes it unnecessary to call out what
variables to export to C++.

These variables will also be plumbed into and out of kconfiglib in later
changes.

Change-Id: Iaf5e098d7404af06285c421dbdf8ef4171b3f001
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/56892
Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com>
Maintainer: Gabe Black <gabe.black@gmail.com>
Tested-by: kokoro <noreply+kokoro@google.com>
2022-03-28 20:31:21 +00:00
Richard Cooper
48ed8407c9 cpu: Fix build for MacOS.
* The value of build environment variable KVM_ISA is serialized into
  the generated file `kvm_isa.hh'. This value should be a string, but on
  hosts where the KVM headers are not available, the default `None` is
  inserted. Changed the default value to the string `""` in this case.

* Added missing include for `std::array`.

Change-Id: I651122cc46fc9c0757f592b05f4b4cab285cb91f
Reviewed-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/57889
Reviewed-by: Gabe Black <gabe.black@gmail.com>
Maintainer: Gabe Black <gabe.black@gmail.com>
Tested-by: kokoro <noreply+kokoro@google.com>
2022-03-23 13:58:28 +00:00
Gabe Black
06117275fa scons: Make all sticky variables automatically exported.
All sticky vars are exported, but not all exported vars are sticky. The
vars which are exported but not sticky are (at least in general) found
with Configure() style measurement.

Change-Id: Idebf17e44c2eeca745cdfdd9f42eddcfdb0cf9ed
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/56891
Maintainer: Gabe Black <gabe.black@gmail.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com>
2022-03-15 00:45:30 +00:00
Samuel Stark
139f635bde cpu: Allow TLB shootdown requests in the o3 cpu
JIRA: https://gem5.atlassian.net/browse/GEM5-1097

Change-Id: Ie698efd583f592e5564af01c2150fbec969f56a2
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/56600
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-03-09 10:47:16 +00:00
Samuel Stark
9dfac01243 cpu: Allow TLB shootdown requests in the timing cpu
JIRA: https://gem5.atlassian.net/browse/GEM5-1097

Change-Id: Ied38e9ed1f02d8e48bc5d62cc34baaec740bf6b8
Signed-off-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/56599
Reviewed-by: Jason Lowe-Power <power.jg@gmail.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-03-09 10:47:16 +00:00
Samuel Stark
de9cdc28ce cpu: Rename initiateHtmCmd to be more generic
To prepare for future CHI work, rename ExecContext::initiateHtmCmd to
ExecContext::initiateSpecialMemCmd

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

Change-Id: I7c7aed8ec06a66d9023c14dba37eae42907df222
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/56598
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-03-09 10:47:16 +00:00
Gabe Black
cbb495334c cpu: Make getIsaPtr const.
This accessor shouldn't modify the ThreadContext.

Change-Id: I6f2629f950b0379573e51e337626ef6b1429a14d
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/50250
Reviewed-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
Maintainer: Giacomo Travaglini <giacomo.travaglini@arm.com>
Tested-by: kokoro <noreply+kokoro@google.com>
2022-03-03 19:39:26 +00:00
Giacomo Travaglini
a3e481c024 cpu: Fix SimpleExecContext coding style
JIRA: https://gem5.atlassian.net/browse/GEM5-1097

Change-Id: I3b9107943732503055008f843a21925574dad930
Signed-off-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/56597
Reviewed-by: Jason Lowe-Power <power.jg@gmail.com>
Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com>
Maintainer: Jason Lowe-Power <power.jg@gmail.com>
Maintainer: Andreas Sandberg <andreas.sandberg@arm.com>
Tested-by: kokoro <noreply+kokoro@google.com>
2022-03-02 08:22:41 +00:00
Gabe Black
efdba6d353 cpu-o3: Initialize register maps and free lists with loops.
Now that these can be referenced by index instead of by a fixed name, we
can manage them more generically using loops.

Change-Id: I7bb7a6b712ee66f22fa809feef4abfcd1851f237
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/49717
Reviewed-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
Maintainer: Giacomo Travaglini <giacomo.travaglini@arm.com>
Tested-by: kokoro <noreply+kokoro@google.com>
2022-03-01 22:01:01 +00:00
Gabe Black
56fba14e7d cpu-o3: Manage per-register-type free lists with an array.
Change-Id: Ie32b9fda87780c3ac15e0a5e309d50df05a99f0c
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/49716
Reviewed-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
Maintainer: Giacomo Travaglini <giacomo.travaglini@arm.com>
Tested-by: kokoro <noreply+kokoro@google.com>
2022-03-01 22:01:01 +00:00
Gabe Black
412ae3f8df cpu,sim: Don't tie ThreadContext contextId to the CPU ID.
The contextId is generally treated as (and should be) an opaque index
into the System objects threadContext array. When forcing it to
particular values, that introduces gaps in the threadContext array which
trips up other code which is expecting the array to have only valid
entries.

Change-Id: I4997e989b436a3008f65f348722dfb843b2f110a
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/57089
Maintainer: Gabe Black <gabe.black@gmail.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Yu-hsin Wang <yuhsingw@google.com>
2022-03-01 02:55:20 +00:00
Gabe Black
76c0466557 cpu-o3: Use an array to hold rename maps in UnifiedRenameMap.
Change-Id: I3ae1d6ecb103d2b877aba36050cd7b148742b503
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/49715
Reviewed-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
Maintainer: Giacomo Travaglini <giacomo.travaglini@arm.com>
Tested-by: kokoro <noreply+kokoro@google.com>
2022-03-01 01:36:07 +00:00
Gabe Black
39d25eebd0 cpu-o3: Make canRename extract register counts locally.
This avoids having an argument for each register type, which prevents
building in an assumption about what register types exist.

Change-Id: I81473db51d930c757f4e0b24e6f3017a4965a721
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/49714
Reviewed-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
Maintainer: Giacomo Travaglini <giacomo.travaglini@arm.com>
Tested-by: kokoro <noreply+kokoro@google.com>
2022-03-01 01:36:07 +00:00
Gabe Black
a5ab19d3ef arch,cpu: Replace num${Type}DestReg accessors with numDestReg(type).
Change-Id: I32be58cce831c8c7d5b9e3d3f49f428a06c722a2
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/49713
Reviewed-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
Maintainer: Giacomo Travaglini <giacomo.travaglini@arm.com>
Tested-by: kokoro <noreply+kokoro@google.com>
2022-03-01 01:36:07 +00:00
Gabe Black
967bada8db arch,cpu: Replace StaticInst::_num${TYPE}DestRegs members with an array.
The array is indexed using the register class.

Change-Id: I6cfd9735afa03e386e01e9e255fd6e55b7ba7272
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/49712
Maintainer: Gabe Black <gabe.black@gmail.com>
Reviewed-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
Tested-by: kokoro <noreply+kokoro@google.com>
2022-03-01 01:36:07 +00:00
Gabe Black
ec4d6c0daf cpu,arch-arm: Use a sentry class valid for invalid RegIds.
The default constructor for RegId would initialize it with the
IntRegClass and register index 0. This is arbitrary and
indistinguishable from a real ID to the first integer register.

Instead, add a new class type constant InvalidRegClass, and use that to
initialize an otherwise uninitialized RegId.

Also, fill out some enums that needed to handle that value to silence
compiler warnings.

Change-Id: I3b58559f41adc1da5f661121225dbd389230e3af
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/49710
Reviewed-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
Maintainer: Giacomo Travaglini <giacomo.travaglini@arm.com>
Tested-by: kokoro <noreply+kokoro@google.com>
2022-02-28 22:04:27 +00:00
Gabe Black
7dfca8531d cpu: Remove an unused variable from one of the branch predictors.
The variable upsets clang and breaks the build.

Change-Id: Ia2315e1753b6e9e701bf18eadf8cf448643577b4
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/57172
Maintainer: Gabe Black <gabe.black@gmail.com>
Reviewed-by: Daniel Carvalho <odanrc@yahoo.com.br>
Tested-by: kokoro <noreply+kokoro@google.com>
2022-02-26 13:06:07 +00:00
Gabe Black
001e17890c misc: Use the new bufval helpers in RegClass and Packet.
Those makes generally useful mechanisms are now available to any code
that wants to use it, and are covered by a unit test.

Change-Id: If918eba3b81443019c5789ab132de45c65f93072
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/57150
Reviewed-by: Jason Lowe-Power <power.jg@gmail.com>
Reviewed-by: Daniel Carvalho <odanrc@yahoo.com.br>
Maintainer: Jason Lowe-Power <power.jg@gmail.com>
Tested-by: kokoro <noreply+kokoro@google.com>
2022-02-26 09:56:26 +00:00
Gabe Black
aa4b6047e5 cpu-simple: Ignore writes to the "zero" register.
Rather than constantly overwriting the "zero" register to return its
value to zero, just ignore writes to it.

We assume here that the "zero" register is a standard RegVal type
register (ie not bigger than 64 bits) and is accessed as such.

Change-Id: I06029b78103019c668647569c6037ca64a4d9c76
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/49709
Maintainer: Gabe Black <gabe.black@gmail.com>
Reviewed-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
Tested-by: kokoro <noreply+kokoro@google.com>
2022-02-26 05:02:35 +00:00
Gabe Black
3e846d20ed cpu: Remove VecRegContainer from ThreadContext::compare.
Change-Id: I5a0f9d30fe56806d46fb54d62e1e58d02a319879
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/49708
Reviewed-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
Maintainer: Giacomo Travaglini <giacomo.travaglini@arm.com>
Tested-by: kokoro <noreply+kokoro@google.com>
2022-02-24 23:22:24 +00:00
Gabe Black
b5edb3b0e4 cpu-o3: Print vec and vec pred reg values with valString.
Remove the need for the VecRegContainer and VecPredRegContainer types.

Change-Id: If230449d7f43a5a9b7c3e00b2692cc35ce971c63
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/49705
Reviewed-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
Maintainer: Giacomo Travaglini <giacomo.travaglini@arm.com>
Tested-by: kokoro <noreply+kokoro@google.com>
2022-02-24 23:21:45 +00:00
Gabe Black
9950d58e16 cpu-o3: Remove some unused accessors on the PhysRegFile.
Change-Id: I2d3d4845ae1a7e4329985a1d8bc011e2f5cf83d1
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/49704
Reviewed-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
Maintainer: Giacomo Travaglini <giacomo.travaglini@arm.com>
Tested-by: kokoro <noreply+kokoro@google.com>
2022-02-24 23:21:30 +00:00
Gabe Black
d53f75c1eb cpu: Eliminate the (read|set)VecPredReg helpers from ThreadContext.
Change-Id: I9f220ba4f28d6a63e4f037388b0431dfe123a8a9
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/49703
Maintainer: Gabe Black <gabe.black@gmail.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
2022-02-24 00:10:17 +00:00
Gabe Black
5c3a6a4e13 cpu,arm: Eliminate the now unused helpers (read|set)VecPredReg.
Change-Id: I27533d7ff97cb7a08db6234c0dd73d5327cf06b2
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/49702
Reviewed-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
Maintainer: Giacomo Travaglini <giacomo.travaglini@arm.com>
Tested-by: kokoro <noreply+kokoro@google.com>
2022-02-24 00:10:17 +00:00
Gabe Black
22eeeaff86 cpu: Remove readVecPredReg from ThreadContext::compare.
Use the generic getReg method to avoid having to use the
TheISA::VecPredRegContainer type.

Change-Id: I8240dd85f2db2f8125d7944135c4361866fba057
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/49700
Reviewed-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
Maintainer: Giacomo Travaglini <giacomo.travaglini@arm.com>
Tested-by: kokoro <noreply+kokoro@google.com>
2022-02-24 00:10:17 +00:00
Gabe Black
40b9c0d2bd cpu: Remove the default implementation of (get|set)RegFlat.
This was originally intended to call back into the original readIntReg,
setIntReg, etc, but now that *those* are implemented by calling into
getRegFlat, setRegFlat, etc, that's a circular dependency and makes that
implementation unusable.

Change-Id: I4135f0d8721f5f9d724be590767bed0023a9de20
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/49698
Reviewed-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
Maintainer: Giacomo Travaglini <giacomo.travaglini@arm.com>
Tested-by: kokoro <noreply+kokoro@google.com>
2022-02-24 00:10:17 +00:00
Gabe Black
ae10990287 cpu: Use arrays and abstraction to handle regs in SimpleThread.
This gets rid of quite a bit of switch statements and one or two
sequences of performing the same operation on each register file
explicitly.

Change-Id: Ifd343563c87530a022c74ea6e25416be4fb5236f
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/49697
Reviewed-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
Maintainer: Giacomo Travaglini <giacomo.travaglini@arm.com>
Tested-by: kokoro <noreply+kokoro@google.com>
2022-02-24 00:10:17 +00:00
Gabe Black
64171d4d14 cpu,arch: Attach a debug flag to each RegClass.
This can be used for DPRINTFs related to those registers using DPRINTFV.

Change-Id: I0fccb12b70fdb74e01022fe0d3d9c2f92425a5bf
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/49696
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
Maintainer: Giacomo Travaglini <giacomo.travaglini@arm.com>
2022-02-24 00:10:17 +00:00
Gabe Black
85b769a68e cpu,arm: Add a method to RegClass-es to print register values.
This further abstracts the properties of registers so they can be
removed from the CPUs.

Change-Id: I2aa1bffe8b095a0301579e60270965c611d6db4e
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/49694
Maintainer: Gabe Black <gabe.black@gmail.com>
Reviewed-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
Maintainer: Giacomo Travaglini <giacomo.travaglini@arm.com>
Tested-by: kokoro <noreply+kokoro@google.com>
2022-02-23 09:30:09 +00:00
Giacomo Travaglini
b4ba4916dd cpu: Handle Request::NO_ACCESS flag in MinorCPU and O3CPU
The Request::NO_ACCESS flag instructs the cpu model to not issue
the request to the memory port.

While Atomic and Timing CPU models properly implement it [1], [2],

* MinorCPU is not looking at the flag
* O3CPU is looking at the flag only in case of a nested transaction
start/commit

This patch is extending NO_ACCESS support to all memory instructions.
This is achieved by using the localAccess callback in the Request object.

Handling of nested hardware transactions in the O3 LSQUnit is moved within
the local accessor callback

[1]: https://github.com/gem5/gem5/blob/v21.1.0.2/\
    src/cpu/simple/timing.cc#L318
[2]: https://github.com/gem5/gem5/blob/v21.1.0.2/\
    src/cpu/simple/atomic.cc#L396

Change-Id: Ifd5b388c53ead4fe358aa35d2197c12f1c5bb4f2
Signed-off-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/56591
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: ZHENGRONG WANG <seanyukigeek@gmail.com>
Reviewed-by: Jason Lowe-Power <power.jg@gmail.com>
Maintainer: Jason Lowe-Power <power.jg@gmail.com>
2022-02-22 10:09:16 +00:00
Gabe Black
071858595d cpu: In SimpleExecContext, use arrays to map reg classes to stats.
Use arrays to more efficiently look up what stats to increment instead
of using switch statements.

Change-Id: I845d0c01ba5b930d46b36147a3136fd721241ed9
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/49693
Reviewed-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
Maintainer: Giacomo Travaglini <giacomo.travaglini@arm.com>
Tested-by: kokoro <noreply+kokoro@google.com>
2022-02-19 20:23:51 +00:00
Gabe Black
6d27a3bb50 cpu,arch: Turn the read|set*Operand methods into get/setRegOperand.
This simplifies and generalizes the ExecContext interface significantly.
This does *not* change the "Writeable" accessors for the vec and pred
registers, and it also ignores MiscRegs which have some different
semantics.

Change-Id: I8cb80da890fc8915f03be04e136662a257d06946
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/49114
Reviewed-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
Maintainer: Giacomo Travaglini <giacomo.travaglini@arm.com>
Tested-by: kokoro <noreply+kokoro@google.com>
2022-02-19 20:23:51 +00:00
Tiago Mück
f5fc1006c3 cpu: fix issues with ruby's memtest
If the size of the address range is smaller than the maximum number
of outstanding requests allowed downstream, the tester will get stuck
trying to find a unique address. This patch adds a check for this
condition and forces the tester to wait for responses before
trying to generate another request.

Change-Id: Ie894a074cc4f8c7ad3d875dc21e8eb4f04562d72
Signed-off-by: Tiago Mück <tiago.muck@arm.com>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/56811
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-02-17 20:43:08 +00:00
Matthew Poremba
5530bd42d5 cpu: Only acquire needed tokens in PTL tester
The tester currently assumes that one token per lane is needed when
checking if an action is ready to be issued. When actually issuing
requests, it is possible that a memory location is not valid for various
reasons. This was not being considered when checking for tokens causing
the tester to acquire more tokens than requests sent. Since tokens are
returned when requests are coalesced, this was causing some tokens never
to be returned, eventually depleting the token pool and causing a
deadlock.

Add a new method which determines the number of tokens needed for an
action. This is called by both the ready check method and the method to
issue the action to ensure they are aligned.

Change-Id: Ic1af72085c3b077539eb3fd129331e776ebdffbc
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/56450
Reviewed-by: Matt Sinclair <mattdsinclair@gmail.com>
Maintainer: Matt Sinclair <mattdsinclair@gmail.com>
Tested-by: kokoro <noreply+kokoro@google.com>
2022-02-17 17:03:19 +00:00
Gabe Black
a19bb5f5ab arch,cpu: Turn (read|set)*Reg into inline helpers.
Eliminate readFloatRegFlat and setFloatRegFlat for the Fast Model
ThreadContext since ARM doesn't use those register types, and those
methods are no longer required by the ThreadContext interface.

Change-Id: Ic149c64e2fbf1d313066fefe480c435eef6d66e5
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/49113
Maintainer: Gabe Black <gabe.black@gmail.com>
Reviewed-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
Maintainer: Giacomo Travaglini <giacomo.travaglini@arm.com>
Tested-by: kokoro <noreply+kokoro@google.com>
2022-02-14 21:48:37 +00:00
Gabe Black
17c7f33fdb cpu: Implement (get|set)Reg(Flat|) for the checker CPU.
These are very simple, since they just delegate to other TCs.

Change-Id: I08fd8de09c90c74548987d537e282edc297ac4e8
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/49111
Maintainer: Gabe Black <gabe.black@gmail.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
Maintainer: Giacomo Travaglini <giacomo.travaglini@arm.com>
2022-02-10 23:56:37 +00:00
Gabe Black
5c9b4c096f cpu: Implement (get|set)Reg(Flat|) for SimpleThread.
Change-Id: Iddda31746606865d746df98e9e6d5adfa7266745
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/49110
Reviewed-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
Maintainer: Giacomo Travaglini <giacomo.travaglini@arm.com>
Tested-by: kokoro <noreply+kokoro@google.com>
2022-02-10 23:56:37 +00:00
Gabe Black
3ca13734ac cpu: Implement getReg and setReg for O3.
Change-Id: I3f0bf1e75a5191be98c79fede5aad854a920e9c9
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/49109
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
Maintainer: Gabe Black <gabe.black@gmail.com>
2022-02-10 23:56:37 +00:00
Gabe Black
06d455ec4e cpu: Add generalized register accessors setReg and getReg.
These will read registers of any type, as described by a RegId. These
currently have default implementations which just delegate to the
existing, register type specific accessors.

Change-Id: I980ca15b3acd9a5a796c977276201d64c69398b8
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/49107
Maintainer: Giacomo Travaglini <giacomo.travaglini@arm.com>
Reviewed-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
Maintainer: Gabe Black <gabe.black@gmail.com>
Tested-by: kokoro <noreply+kokoro@google.com>
2022-02-07 09:59:00 +00:00
Gabe Black
d0b7de0f87 cpu: Store raw byte vectors for register files.
Individual register files, like the ones for scalar integer, floating
point, or condition code registers, are now declared as vectors of their
actual type. Accessing them is simple, since the register you want can
be accessed simply by indexing into the vector.

Unfortunately, that means the code that sets up that storage has to know
what that underlying type is, and that means knowing (and hard coding)
information about the ISA being built.

Instead, this change makes the SimpleThread and O3 PhysRegFile classes
store registers as vectors of bytes, and offsets into those vectors
using computed offsets. Because the elements of the register files are
forced to be offset by powers of 2, computing the offsets can be done
with a shift rather than a multiplication.

The accessors which actually pull values in and out of these vectors are
still specific to each register type and need to know what the
underlying type is, but this change pulls that one level out of the CPUs
towards their peripheral APIs. Later changes will factor these uses out
as well.

Change-Id: I5e19d359a0e83e5827ae263d369999f90c7aa63d
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/49105
Maintainer: Gabe Black <gabe.black@gmail.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
2022-02-07 09:58:38 +00:00
Gabe Black
97d5120982 cpu,arch-arm: Track register size in RegClassInfo.
By default, registers are the size of RegVal, the type often used to
store them. For some types of registers, like vector or vector predicate
registers, the size of each individual register is larger, and can't fit
in a primitive type.

To help facilitate storing even these outliers in a generalized way,
this change adds two fields to RegClassInfo to track the size of
individual registers. One tracks the raw size of the registers
themselves, and the other tracks the minimal shift necessary to find the
offset of a register in a contiguous(ish) array of bytes. By forcing
each register to be aligned to a power of two boundary, we avoid having
to do a multiplication to find their address even if the registers are
oddly sized. We can instead do a shift with a precomputed shift amount
which should be faster.

Change-Id: I035f1b4cb00ece4e8306d7953ea358af75a0d1de
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/49104
Reviewed-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
Maintainer: Giacomo Travaglini <giacomo.travaglini@arm.com>
Tested-by: kokoro <noreply+kokoro@google.com>
2022-02-04 12:12:37 +00:00
Gabe Black
a0e36759a1 cpu: rename RegClass::size to RegClass::numRegs.
This will make the coming addition of a regBytes method less ambiguous.

Change-Id: If4b9369dbe484154eec7bf651642cb1d820283e4
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/56303
Reviewed-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
Maintainer: Giacomo Travaglini <giacomo.travaglini@arm.com>
Tested-by: kokoro <noreply+kokoro@google.com>
2022-02-04 12:11:59 +00:00
Gabe Black
9c7576d8e7 cpu-kvm,sim: Reverse the relationship between System and KvmVM.
The KvmVM will declare itself to the System object, instead of the other
way around. This way the System object can just keep an opaque KvmVM
pointer which does not depend on the KvmVM code even being compiled into
gem5. If there is a KvmVM object, that can more safely assume there is a
corresponding System object to attach itself to.

Also move use of the KvmVM pointer out of constructors, since the VM may
not have registered itself with the System object yet. Those uses can
happen in the init() method instead.

Change-Id: Ia0842612b101315bc1af0232d7f5ae2b55a15922
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/56187
Reviewed-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
Maintainer: Gabe Black <gabe.black@gmail.com>
Tested-by: kokoro <noreply+kokoro@google.com>
2022-02-04 12:11:32 +00:00
Gabe Black
0e0ca633a2 cpu: Get rid of the unused o3::ThreadContext::readReg.
Change-Id: I5c654240d7ccb09f983b4e87dde15e317fb7d953
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/49106
Maintainer: Gabe Black <gabe.black@gmail.com>
Maintainer: Giacomo Travaglini <giacomo.travaglini@arm.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
2022-02-03 00:42:53 +00:00
Gabe Black
ac5f79af28 cpu-kvm: Move the validKvmEnvironment method into KvmVM.
This makes the generic System class consistent whether you have KVM
enabled or not.

Change-Id: Ie6928961200943d1d4e3bd129a4e4269e9f12950
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/56263
Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com>
Maintainer: Gabe Black <gabe.black@gmail.com>
Tested-by: kokoro <noreply+kokoro@google.com>
2022-02-02 01:45:58 +00:00
Gabe Black
a00a6f953f cpu: Stop using NumVecElemPerVecReg.
Use the register classes regName method, or if necessary, the ratio
between the size of the vector register file and the vector element
register file.

Change-Id: Ibf63ce2b3cc3e3cc3261e5a9b8dcbfdc0af5035b
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/49164
Maintainer: Gabe Black <gabe.black@gmail.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
Maintainer: Giacomo Travaglini <giacomo.travaglini@arm.com>
2022-02-01 18:47:17 +00:00
Gabe Black
c537d9ad10 arch-arm,cpu: Add a class for ops for vec reg elements.
This lets a caller print the name of a register in a friendly way
without having to know how many elements go with each vector register.

Change-Id: I85598c078c604f1bebdba797308102482639c209
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/49163
Reviewed-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
Maintainer: Giacomo Travaglini <giacomo.travaglini@arm.com>
Tested-by: kokoro <noreply+kokoro@google.com>
2022-01-24 22:18:17 +00:00
Gabe Black
528d184ac7 misc: Linearlize VecElem indexing.
These registers used to be accessed with a two dimensional index, with
one dimension specifying the register, and the second index specifying
the element within that register. This change linearizes that index down
to one dimension, where the elements of each register are laid out one
after the other in sequence.

Change-Id: I41110f57b505679a327108369db61c826d24922e
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/49148
Reviewed-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
Maintainer: Giacomo Travaglini <giacomo.travaglini@arm.com>
Tested-by: kokoro <noreply+kokoro@google.com>
2022-01-21 23:05:47 +00:00