Commit Graph

21638 Commits

Author SHA1 Message Date
Lukas Zenick
b279e40cb7 configs: nvm sweep fix (#1114)
These changes to sweep and sweep_hybrid for NVM allow them to run. I'm
not an expert on this, so I'm not sure if these are technically correct,
but they no longer fail when running
`build/X86/gem5.opt configs/nvm/sweep.py` and `build/X86/gem5.opt
configs/nvm/sweep_hybrid.py`

GitHub Issue: #669
2024-05-13 14:51:39 -07:00
Zhantong Qiu
6b427a84f7 stdlib: change default exit event for SIMPOINT_BEGIN (#1085)
The SIMPOINT_BEGIN should do nothing by default since it might be used
in various cases.

In
[https://www.mail-archive.com/gem5-users@gem5.org/msg22383.html](mailing
list), a user discovered a bug with the current
`simpoints-se-restore.py` example.
The bug is caused by the default behavior of the SIMPOINT_BEGIN exit
event.
When taking a checkpoint with `simpoints-se-checkpoint.py`, it stores
the future exit event scheduled at the beginning of the simulation. I
did not notice this when I wrote and tested the example script due to
the long print out log and my custom handler of the SIMPOINT_BEGIN exit
event.
In the restoring, the SIMPOINT_BEGIN exit event was triggered right
before the region end, so it resets the stats before the final stats
dump. Therefore, the simulation time is 0 as the user discovered.
This patch should fix this bug.

Change-Id: I800dfbd28d7b2c842864a1ab7d84b8f8e17b9b3c
2024-05-13 14:11:00 -07:00
Ivana Mitrovic
10b24dc9a4 arch-arm: Implement FEAT_MPAM in CPU (#1082)
This PR implements FEAT_MPAM on the CPU side. We define a MPAM system
registers and a mechanism
for tagging memory requests with the MPAM information bundle as
specified in existing documentation [1].

What this PR is *not* covering is the MPAM implementation in a MSC
(Memory System Component).
Which means at the moment it's only possible to have static partitioning
schemes (via the PartitioningPolicies
already part of gem5) and there is currently no way to dynamically
program partitions at runtime.

[1]: https://developer.arm.com/documentation/ddi0487/latest/
2024-05-13 08:56:23 -07:00
Ivana Mitrovic
53245fa0e8 arch-riscv: Fix CSR instruction behavior 2nd attempts (#1099)
Quote from change[1]

> The RISC-V spec clarifies the CSR instruction operation, some of them
shall not read or write CSR by the hints of RD/RS1/uimm, but the
original version use the 'data != oldData' condition to determine
whether write or not, and always read CSR first.
See CSR instruction in spec:
Section 9.1 Page 56 of
https://github.com/riscv/riscv-isa-manual/releases/download/Ratified-IMAFDQC/riscv-spec-20191213.pdf

|||Register operand|||
|--- |--- |--- |--- |--- |
|Instruction|rd is x0|rs1 is x0|Reads CSR|Writes CSR|
|CSRRW|Yes|-|No|Yes|
|CSRRW|No|-|Yes|Yes|
|CSRRS/CSRRC|-|Yes|Yes|No|
|CSRRS/CSRRC|-|No|Yes|Yes|
|||Immediate operand|||
|Instruction|rd is x0|uimm = 0|Reads CSR|Writes
CSR|
|CSRRWI|Yes|-|No|Yes|
|CSRRWI|No|-|Yes|Yes|
|CSRRSI/CSRRCI|-|Yes|Yes|No|
|CSRRSI/CSRRCI|-|No|Yes|Yes|

The issue cause the ubuntu hanging because we shared the same status CSR
with `mstatus`, `sstatus` and `ustatus` and interrupt enabling CSR with
mip, sip and uip. We may need to read origin CSR without effect of
unmask bits to avoid override the bits of other CSR. Now the ubuntu can
work after the patch merged.

[1] https://gem5-review.googlesource.com/c/public/gem5/+/67717
2024-05-10 10:21:48 -07:00
Matthew Poremba
e3c2a322a1 arch-vega: Fix SDWA dst select (#1120)
The destination select should take a value of the selection size (dword,
word, or byte) starting at bit 0, move that to the selected destination,
and then apply the unused constraint (DST_U) to the remaining word or
bytes. Currently the code is selecting the word/byte currently being
iterated over, rather than the least significant word/byte. As a result,
any selection that is not word 0 or byte 0 will be replaced with the
original destination value at those bits. This results in the wrong
value.

This commit changes the orig bits to be the original dest value at the
lowest word / byte location. Tested with the mfma_i32_16x16x16i8 example
which uses an SDWA V_OR_B32 to pack i8 values into VGPRs for the MFMA.

Change-Id: I54ed819479a25fa9276d29a8f14f0fea7fd71afe
2024-05-10 08:49:13 -07:00
Chong-Teng Wang
8c4d5f8e27 arch-riscv: Fix narrowing/widening type-convert instructions (#1079)
Correct ei calculation under VectorFloatWideningCvtFormat and
VectorFloatNarrowingCvtFormat.

Change-Id: I08699ffe3b9f8a7d4543023437626cc054344053
2024-05-09 10:17:15 -07:00
Harshil Patel
5c82447653 misc: Add resource versions to examples (#1110)
- Explicitly defining resource version in obtain resource calls in
examples.

Change-Id: I74ab5d2f5e9bc73a0145585a0fe75f2ec905472f
2024-05-09 10:16:27 -07:00
Matthew Poremba
e4ebe29f43 util: Bump gpu-fs docker to ROCm 6.1 (#1097)
This version matches the disk image on gem5-resources.

Change-Id: I69a45ef290f0fdf2167ead4d67d4d789d30e0e91
2024-05-09 10:11:54 -07:00
Ivana Mitrovic
233135da81 mem-ruby: Fix NullPointerException in RubyRequest (#1118)
This PR includes a check for `m_pkt` being null and appropriately
handles that case. This issue was causing the Daily tests to fail.

Change-Id: I87142ca14ca4ab3d8306153a1cf34c2629a119ba
2024-05-09 08:46:13 -07:00
Giacomo Travaglini
0df5635bdf mem-ruby: Implement NS bit for CHI transactions (#1100)
This patch is adding the NS bit to CHI requests to make sure they are
properly tagged according to their security


Change-Id: I33d3610edefbb5a05a6090e9125c35d4fb8bca58
Reviewed-by: Tiago Muck <tiago.muck@arm.com>

Signed-off-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
2024-05-08 07:46:50 +02:00
Ivana Mitrovic
bc0f388316 util: Update gem5-resource-manager requirements (#1115)
Bumps [jinja2](https://github.com/pallets/jinja) from 3.1.3 to 3.1.4.

Bumps [werkzeug](https://github.com/pallets/werkzeug) from 2.3.8 to
3.0.3.

Change-Id: I88e97c3c546c8dcfaa8c310a537def850177f0b9
2024-05-07 17:33:51 -07:00
Ivana Mitrovic
06ab3f9b18 misc: Update version in optional-requirements (#1109)
Bumps [tqdm](https://github.com/tqdm/tqdm) from 4.66.2 to 4.66.3.
2024-05-07 17:33:30 -07:00
Roger Chang
c1713a0b18 arch-riscv: Fix CSR instruction behavior 2nd attempts
Change-Id: Id0a9a374281445c7821863f0f74564857d3d8fa2
2024-05-07 20:32:56 +08:00
Roger Chang
1a81144985 arch-riscv: Move FCSR implementation to isa.cc
Change-Id: I132edfe2c0ae4caecaa9e6209249662895b5c608
2024-05-07 20:32:56 +08:00
Matthew Poremba
6ed446e546 arch-x86: Add XCR0 register and add to X86KvmCPU (#1040)
The extended control registers were not being updated in the KVM thread
context nor updated in the KVM state. This was causing issues when
checkpointing since the XCR0 value was reverting to the default value
rather than what it was previously before the checkpoint. THis was
causing multiple applications to crash due to executing instructions
which are now illegal instructions due to XCR0 being incorrect.

This commit adds the XCR0 as a misc register similar to the exiting x86
control registers and adds all of the helper functions to access and set
the register value. It also adds support for updating the KVM CPU's
state with the register value and updating the thread context's misc reg
value so that it is checkpointed along with the other misc regs.

Note that this does *not* add support for XSAVE of the AVX state (i.e.,
the upper 128 bits of YMM registers). It does however fix the immediate
problem in issue #958 .

Change-Id: I97456c8b57cbc7b381bd4be94944ce6567a43c76
2024-05-06 09:58:07 -07:00
Matthew Poremba
cb47755e15 gpu: Consolidated fixes for v24.0 (#1103)
Includes fixes for several bugs reported via email, self found, and
internal reports. Also includes runs through Valgrind and UBsan. See
individual commits for more details.
2024-05-06 07:35:57 -07:00
Matthew Poremba
0d3d456894 gpu-compute: Invalidate Scalar cache when SQC invalidates (#1093)
The scalar cache is not being invalidated which causes stale data to be
left in the scalar cache between GPU kernels. This commit sends
invalidates to the scalar cache when the SQC is invalidated. This is a
sufficient baseline for simulation.

Since the number of invalidates might be larger than the mandatory queue
can hold and no flash invalidate mechanism exists in the VIPER protocol,
the command line option for the mandatory queue size is removed, which
is the same behavior as the SQC.

Change-Id: I1723f224711b04caa4c88beccfa8fb73ccf56572
2024-05-06 07:35:38 -07:00
Giacomo Travaglini
36c1ea9c61 mem-ruby: Implement MakeReadUnique in CHI (#1101)
Change-Id: I64cd3c62804cca184d68287fc099534e9205f2b8
Reviewed-by: Tiago Muck <tiago.muck@arm.com>

Signed-off-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
2024-05-06 08:30:59 +02:00
Giacomo Travaglini
7c9925bafa arch-generic: Fix reading from special :semihosting-features file (#1089)
The implementation of SYS_FLEN was missing, which caused picolibc to
treat this file as not implemented. Additionally, there was a bug in the
SYS_READ call that was comparing the wrong variable against the passed
buffer length. It was comparing the current file position against the
buffer length instead of the number of written bytes. Finally, pos was
unititialized which could result in spurious errors.

Change-Id: I8b487a79df5970a5001d3fef08d5579bb4aa0dd0
2024-05-06 07:30:13 +01:00
dependabot[bot]
d834e8bf4e misc: bump mypy from 1.9.0 to 1.10.0 (#1092)
Bumps [mypy](https://github.com/python/mypy) from 1.9.0 to 1.10.0.

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-05-03 21:00:51 -07:00
Matthew Poremba
3490d5bf18 gpu-compute: Add DebugFlag for LDS
This prints what values are read/written to LDS and the previous value
on write. This is useful for debugging problems with LDS instructions.

Change-Id: I30063327bec1a1a808914a018467d5d78d5d58b4
2024-05-03 14:31:17 -07:00
Matthew Poremba
29f63f630b dev-amdgpu: Correct missing GART warning
SDMA ptePde packets are generating a warning that a GART address is
missing, causing a wrong address to be clobbered by the operation.

This commit fixes this by converting the GART address when the queue is
running in privledged mode, which is the only mode allowed to use GART
addresses. This removes the warnings and writes to the correct memory
region.

Change-Id: I64acac308db2431c5996b876bf4cda704f51cf25
2024-05-03 14:31:17 -07:00
Matthew Poremba
8249d6d1cd arch-vega: Remove FP asserts in VOP3 lane manip insts
The VOP3 instruction encoding generally states that ABS/NEG modifiers in
the instruction encoding are only valid on floating point data types.
This is currently coded in gem5 to mean floating point *instructions*.
For untyped instructions like V_CNDMASK_B32, we don't actually know what
the data type is. We must trust that the compiler did not attempt to
apply these bits to non-FP data types.

This commit simply removes the asserts. The ABS/NEG modifiers are
therefore ignored which is consistent with the ISA documentation.
This is done on the lane manipulation instructions V_CNDMASK_B32,
V_READLINE_B32, and V_WRITELANE_B32 which are typically used to mask off
or move data between registers. Other bitwise instructions (e.g.,
V_OR_B32) keep the asserts as bitwise operations on FP types are
genernally illegal in languages like C++.

Change-Id: I478c5272ba96383a063b2828de21d60948b25c8f
2024-05-03 14:31:17 -07:00
Matthew Poremba
2703fb5699 gpu-compute: Fix valgrind memleak complaints
Fixes several memory leaks, mostly of small and medium severity. Fixes
mismatched new/new[] and delete/delete[] calls.

Change-Id: Iedafc409389bd94e45f330bc587d6d72d1971219
2024-05-03 14:29:31 -07:00
Matthew Poremba
386fb3d1cc configs: Fix HSA packer processor address
The address has one too many zeros and is therefore placed in a memory
region usually used for system memory. As a result this causes failure
when trying to run a simulation with a huge amount of memory.

Change the address to be within the C000'0000h - FFFF'FFFFh X86 I/O hole
as was intended.

Change-Id: I5d03ac19ea3b2c01a8c431073c12fa1868b3df24
2024-05-03 14:29:30 -07:00
Matthew Poremba
0faa9510f9 arch-vega,gpu-compute: Fix misc ubsan runtime errors
Three main fixes:
 - Remove the initDynOperandInfo. UBSAN errors and exits due to things
   not being captured properly. After a few failed attempts playing with
   the capture list, just move the lambda to a new method.
 - Invalid data type size for some thread mask instructions. This might
   actually have caused silent bugs when the thread id was > 31.
 - Alignment issues with the operands.

Change-Id: I0297e10df0f0ab9730b6f1bd132602cd36b5e7ac
2024-05-03 14:26:46 -07:00
Harshil Patel
1164f9b81e tests: update resource to use new checkpoint
- Updated the id of the simpoint-se-checkpoint  resource.

Change-Id: Iab0b10da87b9790c24407e0edce7a18c38e0f48a
2024-05-03 10:55:04 -07:00
Yu-Cheng Chang
3a2a917a53 arch-riscv: Fix VCSR read behavoir (#1076)
The VCSR should read the value with VXSAT and VXRM

<table class="tableblock frame-all grid-all fit-content center">
<caption class="title">Table 40. vcsr layout</caption>
<colgroup>
<col>
<col>
<col>
</colgroup>
<thead>
<tr>
<th class="tableblock halign-right valign-top">Bits</th>
<th class="tableblock halign-left valign-top">Name</th>
<th class="tableblock halign-left valign-top">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="tableblock halign-right valign-top"><p
class="tableblock">XLEN-1:3</p></td>
<td class="tableblock halign-left valign-top"></td>
<td class="tableblock halign-left valign-top"><p
class="tableblock">Reserved</p></td>
</tr>
<tr>
<td class="tableblock halign-right valign-top"><p
class="tableblock">2:1</p></td>
<td class="tableblock halign-left valign-top"><p
class="tableblock">vxrm[1:0]</p></td>
<td class="tableblock halign-left valign-top"><p
class="tableblock">Fixed-point rounding mode</p></td>
</tr>
<tr>
<td class="tableblock halign-right valign-top"><p
class="tableblock">0</p></td>
<td class="tableblock halign-left valign-top"><p
class="tableblock">vxsat</p></td>
<td class="tableblock halign-left valign-top"><p
class="tableblock">Fixed-point accrued saturation flag</p></td>
</tr>
</tbody>
</table>

Change-Id: I1227b920da78026951dfa548e41c8cc56da6caac
2024-05-03 09:53:43 -07:00
Yu-Cheng Chang
8b885222b1 arch-riscv: Fix interrupt and status CSR behavoir (#1091)
From sepc

> Instructions that access a non-existent CSR are reserved. Attempts to
access a CSR without appropriate privilege level raise
illegal-instruction exceptions or, as described in Section 13.6.1,
virtual-instruction exceptions. Attempts to write a read-only register
raise illegal-instruction exceptions. A read/write register might also
contain some bits that are read-only, in which case writes to the
read-only bits are ignored.

Setting the bit not in the mask should be ignore rather than raise the
illegal exception. The unmask bits of xstatus CSR are `WPRI`, the
unmasks bits of xie are `RO`(above priv v1.12) or `WPRI`(priv v1.11 and
priv v1.10), the unmask bits of xip CSR are `RO`(above priv v1.12) or
`WPRI`(priv v1.11) or `WIRI` (priv v1.10).

Note: The workload of `riscv-ubuntu-20.04-boot` uses the priv v1.10.

More details please see the `RISC-V spec:  Privileged Architecture`
v1.10:
https://github.com/riscv/riscv-isa-manual/releases/tag/riscv-priv-1.10
v1.11(20190608):
https://github.com/riscv/riscv-isa-manual/releases/tag/Ratified-IMFDQC-and-Priv-v1.11
v1.12(20211213):
https://github.com/riscv/riscv-isa-manual/releases/tag/Priv-v1.12

Change-Id: I5d6e964e99b30b71da3dc267cd1575665d922633
2024-05-02 09:07:30 -07:00
Giacomo Travaglini
a6b20eae80 Merge branch 'develop' into semihosting-features-fix 2024-05-02 10:12:27 +01:00
Alexander Richardson
aa2fade12e Drop unrelated change 2024-05-01 18:00:09 +01:00
Alexander Richardson
e7566448fa arch-generic: More reliable special file name handling in semihosting (#1090)
Currently, the filesRootDir is prepended for all paths that do not start
with '/'. However, we should not be doing this for the special files :tt
and :semihosting-features. Noticed this while testing semihosting with a
non-empty filesRootDir.

Change-Id: I156c8b680cb71cdc88788be3b0e93fc1d52e11e5
2024-05-01 17:41:55 +01:00
Alex Richardson
bb4c13143c arch-generic: Fix reading from special :semihosting-features file
The implementation of SYS_FLEN was missing, which caused picolibc to
treat this file as not implemented. Additionally, there was a bug in
the SYS_READ call that was comparing the wrong variable against the
passed buffer length. It was comparing the current file position against
the buffer length instead of the number of written bytes.
Finally, pos was unititialized which could result in spurious errors.

Change-Id: I8b487a79df5970a5001d3fef08d5579bb4aa0dd0
2024-04-30 16:28:06 -07:00
Yangyu Chen
666d1dd9a2 arch-riscv: Add Integer Conditional operations extension (Zicond) instructions (#1078)
This PR added RISC-V Integer Conditional Operations Extension, which is
in the RVA23U64 Profile Mandatory Base. And the performance of
conditional move instructions in micro-architecture is an interesting
point to explore.

Zicond instructions added: czero.eqz, czero.nez

Changes based on spec:

https://github.com/riscvarchive/riscv-zicond/releases/download/v1.0.1/riscv-zicond_1.0.1.pdf
2024-04-30 05:44:45 -07:00
Matthew Poremba
c495ff84ec util: Make x86-add-xcr0 work for testlib checkpoints
Change-Id: I7b93d7afc7710bd43412a77a204ce8838d0bfb4e
2024-04-29 11:45:55 -07:00
OdnetninI (Eduardo José Gómez Hernández)
17cbbd84ae cpu: Indirect predictor track conditional indirect (#1077)
As discussed in https://github.com/orgs/gem5/discussions/954: 

In the refactor made by commit f65df9b959 conditional indirect
branches are no longer updated in the indirect predictor.
This kind of branches do not exist in x86 neither arm, but they are
present in PowerPC.

This patch, enables the indirect predictor to track this kind of
branches.
2024-04-29 11:38:22 +01:00
Giacomo Travaglini
b8e414f14d arch-arm: Implement FEAT_MPAM
With this patch we are adding the specific logic required to tag memory
requests from the PE with MPAM data. This is happening within the MMU
before a translation is completed

Change-Id: Ifecb285244dd469a639150d69a7e884fe3c441be
Signed-off-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
Reviewed-by: Richard Cooper <richard.cooper@arm.com>
2024-04-29 11:32:39 +01:00
Adrián Herrera
c988642ca8 arch-arm: Define system registers for FEAT_MPAM
This patch is adding FEAT_MPAM register definition/decoding.

Co-authored-by: Hristo Belchev <hristo.belchev@arm.com>
Co-authored-by: Giacomo Travaglini <giacomo.travaglini@arm.com>

Change-Id: I70483fcc758419365f4b3762479684c6c52f4d62
Signed-off-by: Adrián Herrera <adrian.herrera@arm.com>
Reviewed-by: Richard Cooper <richard.cooper@arm.com>
2024-04-29 11:32:39 +01:00
Giacomo Travaglini
65cf6b0a1c arch-arm: Cache the highestEL in the ISA object
This is for fast retrieval of the highest implemented
exception level

Change-Id: Id631c2b999d46a8b79570e4043ae04bc2b2e7531
Signed-off-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
Reviewed-by: Richard Cooper <richard.cooper@arm.com>
2024-04-29 10:38:08 +01:00
Alexander Richardson
1bb5d3b99e arch-riscv: Add support for RISC-V semihosting (#681)
See https://github.com/riscv-software-src/riscv-semihosting for the
current specification. Almost all code is shared with the Arm
implementation.

Tested by running some binaries built with
[picolibc](https://github.com/picolibc/picolibc).
2024-04-27 05:12:32 -07:00
Ivana Mitrovic
939d8e28df mem-cache: Fix TreePLRU num leaves error (#1075)
This PR fixes the error noted here #1073. 

Change-Id: I5d31c259ac5ee93f46f28b20eda4f58460ba8523
2024-04-26 20:22:20 -07:00
Harshil Patel
a6138777e2 tests: update versions for new checkpoints
Change-Id: I075110b68a7aa762fb060fcae7bb74ee8ec581b0
2024-04-26 09:54:43 -07:00
Matthew Poremba
a6f2c8afdb arch-x86: Add XCR0 register and add to X86KvmCPU
The extended control registers were not being updated in the KVM thread
context nor updated in the KVM state. This was causing issues when
checkpointing since the XCR0 value was reverting to the default value
rather than what it was previously before the checkpoint. THis was
causing multiple applications to crash due to executing instructions
which are now illegal instructions due to XCR0 being incorrect.

This commit adds the XCR0 as a misc register similar to the exiting x86
control registers and adds all of the helper functions to access and set
the register value. It also adds support for updating the KVM CPU's
state with the register value and updating the thread context's misc reg
value so that it is checkpointed along with the other misc regs.

Note that this does *not* add support for XSAVE of the AVX state (i.e.,
the upper 128 bits of YMM registers). It does however fix the immediate
problem in issue #958 .

A checkpoint upgrader is also provided to add the default value of XCR0
if the checkpoint tag is missing.

Change-Id: I97456c8b57cbc7b381bd4be94944ce6567a43c76
2024-04-25 11:24:53 -07:00
Robert Hauser
1b323a9571 systemc: remove if clause in Gem5ToTlmBridgeBase (#1059)
In the payload event queue in Gem5ToTlmBridgeBase, the phase is checked
twice for BEGIN_RESP. This commit removes the second if clause since it
is unnecessary.

Duplicate if clause in line 234 & line 256


dd2689905f/src/systemc/tlm_bridge/gem5_to_tlm.cc (L234-L267)

please correct me if I am missing something important
2024-04-25 11:15:30 -07:00
Nicholas Mosier
c679c9c127 cpu-o3: prioritize exiting threads when committing (#1056)
Fix #1055. Prioritize committing from exiting threads before we consider
other threads using the specified SMT commit policy. All instructions in
the ROB for exiting threads should already have been squashed. Thus,
this ensures that the ROB instruction queues for all exiting threads
will be empty at the end of the current cycle, avoiding the assertion
failure encountered in #1055.

Change-Id: Ib0178a1aa6e94bce2b6c49dd87750e82776639dc
2024-04-25 11:15:14 -07:00
Nicholas Mosier
51d546cb06 cpu-o3: Clear current macro-op in fetch if squashing after last micro-op (#1047)
Fix #1042. Clear the current fetch macro-op if the instruction
initiating the squash is the last micro-op in its macro-op.

Change-Id: I77f60334771277e47f19573d4067b3a7bc5488b2
2024-04-25 11:14:58 -07:00
Nicholas Mosier
66decb2e93 mem-ruby: Fix functional reads for MESI Three-Level messages (#1045)
Fix #1044. This patch adds checks for message types (PUTX_COPY, DATA,
DATA_EXCLUSIVE) that contain data blocks but were missing from the
original `functionalRead` method in MESI Three-Level messages.

Change-Id: I0cedc314166c9cc037bf20f5b7fef5552dd1253c
2024-04-25 11:14:37 -07:00
Harshil Patel
d75afeabb1 tests: fix persistence issue in pyunit tests (#1070)
- Fixed patching/ mocking of functions and global variables to reset for
each test.
- Uncommented tests as they should pass now.
2024-04-25 10:03:10 -07:00
Giacomo Travaglini
83e55743e1 arch-arm: Add misc_accessor templated functions to read/write regs at different ELs (#1072)
A usual system register read/write pattern is something like the
following

```
switch(el) {
    case EL1:
        tc->readMiscReg(REG_EL1);
    case EL2:
        tc->readMiscReg(REG_EL2);
    case EL3:
        tc->readMiscReg(REG_EL3);
}
```

To avoid repeating these switch statements all over gem5, we define
templated functions which have
an accessor struct as a template parameter. These accessor will help
populating the templated switch
construct. We provide the FAR register accessor as an example. The
accessor should define the following
fields: (type, el0, el1, el2, el3)

Example:

```
struct FarAccessor
{
    using type = RegVal;
    static const MiscRegIndex el0 = NUM_MISCREGS;
    static const MiscRegIndex el1 = MISCREG_FAR_EL1;
    static const MiscRegIndex el2 = MISCREG_FAR_EL2;
    static const MiscRegIndex el3 = MISCREG_FAR_EL3;
};
```
2024-04-25 14:57:10 +01:00
Andreas Sandberg
85d21b5718 cpu-kvm: Support perf counters on hybrid host architectures (#1065)
Fix #1064 by adding support for hardware performance counters on hybrid
architectures like Intel Alder Lake.

Hybrid architectures have multiple types of cores, each of which require
the instantiation of a separate performance counter. The KVM CPU's
PerfKvmCounter class was not aware of this, any only instantiated a
single performance counter, implicitly bound to the P-core only. This
meant that if gem5 ever ran on an E-core, the various hardware
performance counters would not get updated properly, in some cases
always zero (e.g., for the number of instructions executed).

This patch adds support for hybrid host architectures as follows. First,
we convert PerfKvmCounter into an abstract class, which has two concrete
implementations: SimplePerfKvmCounter and HybridPerfKvmCounter. The
former is used for non-hybrid architectures or for non-hardware
performance counters and is functionally equivalent to the prior
implementation of PerfKvmCounter. The latter is used for instantiating
hardware performance counters (i.e., of type PERF_TYPE_HARDWARE) on
hybrid host architectures. It does so by internally instantiating two
SimplePerfKvmCounters, one for a P-core and one for an E-core. Upon
read, it sums the results of reading the two internal counters.

Change-Id: If64fcb0e2fcc1b3a6a37d77455c2b21e1fc81150
2024-04-25 10:45:47 +01:00