Commit Graph

18668 Commits

Author SHA1 Message Date
Gabe Black
d73ce0f593 arch-x86: Implement real mode far call.
Change-Id: I720a0b0e4aa227171c59804d899baba64b8d320b
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/55623
Reviewed-by: Gabe Black <gabe.black@gmail.com>
Maintainer: Gabe Black <gabe.black@gmail.com>
Tested-by: kokoro <noreply+kokoro@google.com>
2022-02-26 07:47:23 +00:00
Gabe Black
7468d4169c arch-x86: Straighten out the segment and selector for real far jumps.
These had been partially transposed in the microcode for this
instruction.

Change-Id: Ida31e74d5096c6b8cf77dc49b9a0f480c1358009
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/55591
Reviewed-by: Gabe Black <gabe.black@gmail.com>
Maintainer: Gabe Black <gabe.black@gmail.com>
Tested-by: kokoro <noreply+kokoro@google.com>
2022-02-26 07:47:03 +00:00
Gabe Black
802f14bb52 arch-x86: Implement popping into a stack selector in real mode.
Segmentation is relatively easy to deal with in real mode, vs. protected
mode.

Change-Id: I4b93a7e321d5debb7240b002bb42fdecaafbfdfe
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/55590
Reviewed-by: Gabe Black <gabe.black@gmail.com>
Maintainer: Gabe Black <gabe.black@gmail.com>
Tested-by: kokoro <noreply+kokoro@google.com>
2022-02-26 07:30:24 +00:00
Gabe Black
c2c10dc647 arch-x86: Implement the real mode versions of LDS, LES, etc.
Change-Id: I8956d9871c8819acd4669423b3b59fa615ac2a7c
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/55588
Reviewed-by: Gabe Black <gabe.black@gmail.com>
Maintainer: Gabe Black <gabe.black@gmail.com>
Tested-by: kokoro <noreply+kokoro@google.com>
2022-02-26 07:30:06 +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
f12c330f40 arch-x86: Use different tables for 64 bit prefixes in the decoder.
There are instructions in 64 bit mode which have been turned into the
REX and VEX prefixes, and which should no longer behave as instructions.
When not in 64 bit mode however, those instructions still need to behave
properly.

We were handling that for the REX prefixes by explicitly checking if the
prefix we found was one of those, and then whether we were in 64 bit
mode or not. We were not handling the VEX prefixes at all, so those were
always acting as prefixes, even when not in 64 bit mode.

This change replaces the REX check and possible VEX check by having two
prefix tables, one for 64 bit mode, and one for otherwise. The REX and
VEX prefixes are simply left out of the non 64b it mode table, making an
explicit check for them unnecessary.

Change-Id: Ia2fc17074015e074d1f156177bd499d67da5411d
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/55587
Maintainer: Gabe Black <gabe.black@gmail.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Gabe Black <gabe.black@gmail.com>
2022-02-26 02:00:06 +00:00
Gabe Black
7a408e35fd dev,arch-x86: Add an x86/compatibility IDE controller.
This is essentially the same as the normal one, except it sets its
ProgIF bits to show that it works in compatibility mode only, with fixed
IO ports and fixed IRQs that it operates with which are outside of the
scope of the normal PCI mechanisms.

Change-Id: I69d04f5c9444e7e227588b96b7dd4123b2850e23
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/55586
Maintainer: Gabe Black <gabe.black@gmail.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Gabe Black <gabe.black@gmail.com>
2022-02-26 01:59:50 +00:00
Gabe Black
2bbcee7723 dev: Fix an assert in the I8259 interrupt controller.
If an *index* is equal to or greater than the size of the thing it's
indexing, then that's an error. Another count, on the other hand, must
be strictly greater for that to be a problem.

Change-Id: I9c891b37482fe72b6436850fc8c3c2fcef6f0476
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/55585
Maintainer: Gabe Black <gabe.black@gmail.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Gabe Black <gabe.black@gmail.com>
2022-02-26 01:59:30 +00:00
Gabe Black
72a455f9c9 dev: Don't implement the ATAPI_IDENTIFY_DEVICE command.
This command is one of two that should be implemented by ATAPI devices.
An ATAPI device are essentially optical devices which use SCSI commands
which are transported over ATA using two special commands, a PACKET
command which actually sends the SCSI commands, and an IDENTIFY command
which is basically the same as the ATA IDENTIFY command but which is
only implemented on ATAPI devices. In order to determine if the device
connected to an IDE controller is an optical drive or a regular ATA hard
drive, software can send the ATAPI_IDENTIFY_DEVICE command and see if
gets an appropriate response.

In gem5, this command was originally not implemented by the IDE disk
model. If a driver attempted to send it, the gem5 model would panic and
kill the simulation. To fix that problem, that command was added to the
list of supported commands and just made a synonym for the ATA IDENTIFY
command since they have essentially the same response.

Unfortunately, this makes all ATA devices look like ATAPI devices, which
is not what we have implemented.

Instead, when we get this command, what we *should* do, as far as I can
tell by reading this:

http://users.utcluj.ro/~baruch/media/siee/labor/ATA-Interface.pdf

is to set the ERR bit in the status register, and then set the ABRT bit
in the error register to indicate that the command was not implemented.

I've attempted to implement that into the model with this change by
setting those bits as described, and then setting the "action" member to
be ACT_CMD_ERROR. I think that action is there primarily to support
cancelled transfers, but it seems like it has the desired effect(?).

Since the error bits are not really explicitly set or managed by the
model in most cases, this change also adds a little bit of code at the
top of startCommand which clears them to zero. These bits are supposed
to "contain the status of the last command executed", and if we're
starting a new command, the error bits no longer apply.

I'm confident that conceptually this is how the ATAPI_IDENTIFY_DEVICE
command should behave in our model, at least unless we decide to
implement real ATAPI models which actually accept SCSI commands, etc.
I'm less confident that I've modified the model to actually implement
that behavior, but as far as I can tell it doesn't seem to have broken
anything, and now SeaBIOS no longer things our disk model is a CDROM
drive.

Change-Id: I2c0840e279e9caa89c21a4e7cbdbcaf6bccd92ac
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/55523
Maintainer: Gabe Black <gabe.black@gmail.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Gabe Black <gabe.black@gmail.com>
2022-02-26 01:59:13 +00:00
Gabe Black
5df52e0dca arch-x86: Overhaul how address size is handled, particularly for stack.
The stack size is something that applies to addresses when performing
accesses as part of some instructions. This was handled inconsistently
or incompletely or simply incorrectly in a few ways.

First, when pushing or popping from the stack, the *address size* should
be set to the stack size. The data size is generally the operand size.
When the stack pointer is incremented/decremented, it should be changed
by the data size. When a stack pointer is manipulated, the data size
for those calculations should be the stack size. Importantly that does
not change the value of the increment/decrement, which is the operand
size still. This usage has been fixed throughout.

The TLB generally needs to know what the address size was in order to
figure out what segment offset was used so that it can do limit checks.
There is some inherent inaccuracy in doing things in reverse like this,
but that's how it works currently. To find that size, the TLB tried to
start from first principles to figure out what the default address size
was, and then whether there was an override was passed in through the
request flags.

This is *very* inaccurate for a few reasons. First, the override doesn't
always apply. Second, the address size used by a particular instruction
doesn't have to be based on any particular size, whether that is the
default or alternate address size, the stack size, etc.

Instead, the instructions now pass the actual size being used in as a 2
bit value (0 -> 1 byte, 1 -> 2 bytes, 2 -> 4 bytes, 3 -> 8 bytes),
avoiding most of the inaccuracy and approximation.

Because the CPU won't embed any size information into fetches, we'll
just assume those have no wrap around within the address size.

Finally, there were microops that had been added which overrode the
address size to be the stack size internally, and try to help the TLB
figure out what to do to figure out the address size. Because both of
those things are now handled in a different way, those microops are no
longer needed or used and have been deleted.

Change-Id: I2b1bdf1acf1540bf643fac6d49fe1a5a576ba5c1
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/55443
Tested-by: kokoro <noreply+kokoro@google.com>
Maintainer: Gabe Black <gabe.black@gmail.com>
Reviewed-by: Gabe Black <gabe.black@gmail.com>
2022-02-26 01:58:23 +00:00
Gabe Black
375236082d scons: Use env and not main in SConscripts.
"env" is the environment for the current variant, where "main" is the
environment that was derived from.

Change-Id: I71e30684aa82a297241820502f204400c89c80cf
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/56890
Maintainer: Gabe Black <gabe.black@gmail.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Daniel Carvalho <odanrc@yahoo.com.br>
2022-02-25 09:32:14 +00:00
Gabe Black
e5281da388 sim: Fix style in insttracer.hh.
Change-Id: Iddf032ae03ef20d6220c298424779dad726f5179
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/49706
Reviewed-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
Maintainer: Giacomo Travaglini <giacomo.travaglini@arm.com>
Tested-by: kokoro <noreply+kokoro@google.com>
2022-02-25 08:08:32 +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
ksco
0eff31e564 arch-riscv: Fix a typo in fsgnjn_s decoder
Negating the register value before unboxing to float32 will
generally result in a canonical 32-bit NaN (without the sign
bit set) so the result was incorrect in many cases.

Change-Id: I0c1bb3aadfca135ab0cc5ba1b58fc83d71fd300c
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/57069
Reviewed-by: Alex Richardson <alexrichardson@google.com>
Reviewed-by: Gabe Black <gabe.black@gmail.com>
Maintainer: Gabe Black <gabe.black@gmail.com>
Reviewed-by: Luming Wang <wlm199558@126.com>
Tested-by: kokoro <noreply+kokoro@google.com>
2022-02-24 12:30:11 +00:00
Gabe Black
3ba623d673 arch: Stop using TheISA:: in the ISA parser.
The ISA description provides us with a namespace to use, so we can use
that instead of TheISA.

Change-Id: If1a13c39a09ab22c7cab1138220fa0162fc2effa
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/49707
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 09:10:26 +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
eefe075d3b arm: Replace readVecPredReg with getReg in the tarmac tracer.
Change-Id: Id290b4b63ca0cf9982327e1451d12917e9d99272
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/49701
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
973d9c82c0 arm: Collapse (set|read)VecPredReg in htm.cc.
Replace these helpers with calls to the underlying setReg and getReg.

Change-Id: I1b811f5dab2d23aafc2f373f743126a54b8c3d73
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/49699
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
322f1d8fe7 arm: Use custom RegClassOps for vector and vector pred registers.
Change-Id: Icef429d5c9c036541472c470d5009c8d29a74548
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/49695
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
6cc3a27e09 arch-x86: Fix some settings installed by the init interrupt.
VMX requires that the present bit of the LDT and the TR are set, and
that the unusable bit of the TR is zero.

Change-Id: I4c4feba38d4fef11ad3b804d41dacb69cc3e6bd5
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/57051
Maintainer: Gabe Black <gabe.black@gmail.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Bobby Bruce <bbruce@ucdavis.edu>
Maintainer: Bobby Bruce <bbruce@ucdavis.edu>
2022-02-23 19:57:13 +00:00
Gabe Black
70ee16a387 arch-x86: Propogate the unusable bit to KVM.
The unusable bit is now used by gem5. Pass that bit through to KVM
instead of a dummy value 0.

Change-Id: I59912b478a3de95684fb0cc65ff5703d201df8cb
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/57050
Maintainer: Gabe Black <gabe.black@gmail.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Bobby Bruce <bbruce@ucdavis.edu>
Maintainer: Bobby Bruce <bbruce@ucdavis.edu>
2022-02-23 19:57:13 +00:00
Gabe Black
0e65df2cf5 arch-x86: Respect LDT and TR bases in long mode.
The LDT and TR bases *are* respected in 64 bit mode, so the base values
need to be set as specified.

Change-Id: Ieb1b58511d9651e6e59be199059b9d2b8c670472
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/57049
Maintainer: Gabe Black <gabe.black@gmail.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Bobby Bruce <bbruce@ucdavis.edu>
Maintainer: Bobby Bruce <bbruce@ucdavis.edu>
2022-02-23 19:57:13 +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
Gabe Black
ff4a8b15a0 scons: Handle TARGET_GPU_ISA not being set.
If TARGET_GPU_ISA is not set, even if the GPU ISA namespace isn't used
by anything, the logic which figures out what to set it to will fail.
This checks for that condition and sets it to something invalid, but
doesn't crash. If that namespace is actually used, then the build will
still fail.

Change-Id: Iec44255cccbafa4aceaa68bdd8b6a835dc0637a0
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/56895
Reviewed-by: Matthew Poremba <matthew.poremba@amd.com>
Maintainer: Gabe Black <gabe.black@gmail.com>
Tested-by: kokoro <noreply+kokoro@google.com>
2022-02-23 02:31:56 +00:00
Hoa Nguyen
52485bbc38 dev: Make VirtIORng device use gem5's rng instead of C++'s
Currently, VirtIORng uses C++'s RNG. This causes nondeterminism
across simulations using this device. One example is the example RISC-V
board booting Ubuntu,

configs/example/gem5_library/riscv-ubuntu-run.py

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

Change-Id: I299e72eb891819007b4260390f5c2ba94d2dec7b
Signed-off-by: Hoa Nguyen <hoanguyen@ucdavis.edu>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/56889
Maintainer: Bobby Bruce <bbruce@ucdavis.edu>
Reviewed-by: Jason Lowe-Power <power.jg@gmail.com>
Tested-by: kokoro <noreply+kokoro@google.com>
2022-02-23 02:21:15 +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
Luming Wang
211c7df045 arch-riscv: fix memory leak problem in page table walker
Valgrind detects memory leak problems in RISC-V's page table
walker(`Walker::WalkerState::stepWalk()`). In some situation,
the response packet is not freed. This patch partially fix
these memory leak problems.

Change-Id: I86d4c69c3c502bd92856a3d8863bfa1722a94512
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/56609
Reviewed-by: Jason Lowe-Power <power.jg@gmail.com>
Maintainer: Jason Lowe-Power <power.jg@gmail.com>
Reviewed-by: Ayaz Akram <yazakram@ucdavis.edu>
Tested-by: kokoro <noreply+kokoro@google.com>
2022-02-19 11:49:44 +00:00
Gabe Black
0d59a8417a ext-testlib: Import MutableSet properly.
The MutableSet class used to be part of the collections module directly,
but in 3.3 was moved to collections.abc. Apparently there was still a
version in collections, since we had been importing it from that old
location and it had been working up until now. After a recent update,
this stopped working for me, and may be tied to an update to the local
version of python on my machine.

This change imports MutableSet from collections.abc instead of
collections directly. I found only one place that this class was used in
src or ext, so I don't think it needs to be fixed anywhere else.

Change-Id: I8b2e82160fd433d57af4a7008ec282ee8ad8a422
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/56849
Maintainer: Bobby Bruce <bbruce@ucdavis.edu>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Gabe Black <gabeblack@google.com>
2022-02-19 01:13:46 +00:00
Kyle Roarty
78451f6685 gpu-compute: Fix register checking and allocation in dyn manager
This patch updates the canAllocate function to account both for
the number of regions of registers that need to be allocated,
and for the fact that the registers aren't one continuous chunk.

The patch also consolidates the registers as much as possible when
a register chunk is freed. This prevents fragmentation from making
it impossible to allocate enough registers

Change-Id: Ic95cfe614d247add475f7139d3703991042f8149
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/56909
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>
2022-02-18 18:46:33 +00:00
Kyle Roarty
4d2cbefd1e gpu-compute: Set scratch_base, lds_base for gfx902
When updating how scratch_base and lds_base were set, gfx902 was left out.
This adds in gfx902 to the case statement, allowing the apertures to be set
and for simulations using gfx902 to not error out

Change-Id: I0e1adbdf63f7c129186fb835e30adac9cd4b72d0
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/54663
Reviewed-by: Matt Sinclair <mattdsinclair@gmail.com>
Maintainer: Matt Sinclair <mattdsinclair@gmail.com>
Reviewed-by: Matthew Poremba <matthew.poremba@amd.com>
Maintainer: Matthew Poremba <matthew.poremba@amd.com>
Tested-by: kokoro <noreply+kokoro@google.com>
2022-02-17 21:20:16 +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
48aa4692df configs: Allow for no DMAs in Ruby GPU tester
If there are no DMA devices, we should not create any tester threads,
sequencers, or an IO crossbar.

Change-Id: I5762a70a064df5310e3f30d41bffc7800b53eb0b
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/56451
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
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
Matthew Poremba
1bc23ca966 mem-ruby: Add protocol prints to MOESI_AMD_BASE-dma
Change-Id: I59ed7311a8dc2a06ce1df0027891ba8e24e8a89e
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/56447
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
Matthew Poremba
7018c2b34e mem-ruby: Remove DirectoryMemory storage in MOESI_AMD_BASE-dir
This protocol is using an old style where read/writes to memory were
being done by writing to a DataBlock in a DirectoryMemory entry. This
results in having multiple copies of memory, leads to stale copies in at
least one memory (usually DRAM), and require --access-backing-store in
most cases to work properly. This changeset removes all references to
getDirectoryEntry(...).DataBlk and instead forwards those reads and
writes to DRAM always.

This results in new transient states BL_WM, BDW_WM, and B_WM which are
blocked states waiting on memory acks indicating a write request is
complete. The appropriate transitions are updates to move to these new
states and stall states are updated to include them. DMA write ACK is
also moved to when the request is sent to memory, rather than when the
request is received.

Change-Id: Ic5bd6a8a8881d7df782e0f7eed8be9d873610e04
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/56446
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
Matthew Poremba
54fc137945 mem-ruby: Ensure MOESI_AMD_Base-dir has probe destinations
The directory has an assert that this is at least one destination for a
probe when sending an invalidation or shared probe to coherence end
points in the protocol (TCC, LLC). This is not necessarily request and
for certain configurations there will be no probes required and none
will be sent. One such configuration is the GPU protocol tester which
would not require a probe to the CPU if it does not exist.

To fix this we first collect the probe destinations. Then we check if
any destinations exist. If so, we send the probe message. Otherwise we
immediately enqueue a probe complete message to the trigger queue. This
reorganization prevents messages with no destinations from being
enqueued, meeting the criteria for the assertion.

Change-Id: If016f457cb8c9e0277a910ac2c3f315c25b50ce8
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/55543
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
Tiago Mück
b354e1a252 mem-ruby: Fix handling of stale CleanUnique
JIRA: https://gem5.atlassian.net/browse/GEM5-1185

Fixed an issue in which a CleanUnique responder would incorrectly
deallocate the cache block when handling an stale CU when the state
is UD_RU or UC_RU (thus incorrectly transitioning to RU).

The fix is to handle stale CUs similarly to stale WBs where we
override the dataValid TBE field to prevent the wrong state
transition.

This patch moves the stale code path to a separate transition
(similarly to stale WBs/Evicts) and moves the dataValid override to
Initiate_Request_Stale so it applies to all stale request types.
Notice now the stale field is also set on stale Comp_UC responses.

Additional minor change: CheckUpgrade_FromRU is the same as
CheckUpgrade_FromStore so it was removed.

Change-Id: I0a2cedcfde1dc30d67aa2c16d71b7470369c2b6e
Signed-off-by: Tiago Mück <tiago.muck@arm.com>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/56810
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: Meatboy 106 <garbage2collector@gmail.com>
2022-02-17 15:21:45 +00:00
Gabe Black
88e12c5d01 scons: Work around a SCons bug in Glob.
The recent change to add an "exclude" pattern to Glob in SCons also
seems to have triggered a bug where SCons has decided directories that
don't exist are files, and then gets upset later when we try to treat
them as directories.

To avoid that bug, and to also make recursive searching for isa parser
.py files work, we can replace the call to Glob with a loop based on
os.walk.

Also, tell the microcode assembler not to generate the parsetab.py file
in the first place. This comes with a minor performance overhead, but
shouldn't matter for us since there are *much* bigger overheads when
processing ISA descriptions.

Change-Id: Ia84e97dab72723ad3f4350798ad70178e231144c
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/56749
Maintainer: Bobby Bruce <bbruce@ucdavis.edu>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Gabe Black <gabe.black@gmail.com>
2022-02-15 22:55:35 +00:00
Gabe Black
b4c285b3c0 arch-x86: Make sure the TLB checks against CS for fetches.
When instructions perform accesses, they embed the segment being used
into the request flags. When the CPU creates a request instead, for
instance when fetching an instruction, it doesn't know to do that.

This change adds a check in the TLB when makes sure CS is used when
checking a fetch, even if the flags didn't say to.

Change-Id: Ie9da3afc0b10eeb96247353150c64f1829cea41b
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/55247
Reviewed-by: Matthew Poremba <matthew.poremba@amd.com>
Maintainer: Gabe Black <gabe.black@gmail.com>
Tested-by: kokoro <noreply+kokoro@google.com>
2022-02-15 08:54:36 +00:00
Gabe Black
15df63624b arch-x86: Add some DPRINTFs to the TLB.
These DPRINTFs are related to segmentation handling when in 32 bit
protected mode.

Change-Id: I47eb2bc834fc748b5d01d85e02ea8b3f6e03091b
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/55246
Reviewed-by: Matthew Poremba <matthew.poremba@amd.com>
Reviewed-by: Matt Sinclair <mattdsinclair@gmail.com>
Maintainer: Matt Sinclair <mattdsinclair@gmail.com>
Tested-by: kokoro <noreply+kokoro@google.com>
2022-02-15 08:54:11 +00:00
Zhengrong Wang
c71058cfa5 configs: Call createThreads() for FutureCPUs.
When using fast forwarding, createThreads() is not
called upon FutureCPUs. This causes segment fault
as the decoder is initialized in createThreads() and
needed when instantiating CPUs.

This commit basically fixes this by invoking
createThreads() on FutureCPUs after they are created.

Change-Id: I812d18f06878f9fc3fa2183a2c8a64d316413398
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/56812
Reviewed-by: Jason Lowe-Power <power.jg@gmail.com>
Maintainer: Jason Lowe-Power <power.jg@gmail.com>
Reviewed-by: Luming Wang <wlm199558@126.com>
Tested-by: kokoro <noreply+kokoro@google.com>
2022-02-15 05:07:38 +00:00