Skip to content

Import latest changes from Darjeeling #155

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 69 commits into
base: ot-earlgrey-9.2.0
Choose a base branch
from

Conversation

rivos-eblot
Copy link

@rivos-eblot rivos-eblot commented Apr 18, 2025

This very large commit imports (and adapts) changes that have recently been made on the Darjeeling branch.

  1. many changes (".*replace legacy reset API with Resettable API$) address a QEMU API change. Simple legacy reset call has been replaced in QEMU 9.x with a more recent "Resettable" API which performs a 3-step reset (enter, hold, exit), which is really useful to manage the complex reset management in OpenTitan devices. The legacy API has been fully replaced; there is one commit for each IP
  2. Ibex Wrapper implementations that had diverged between EarlGrey and Darjeeling (only due to different address translation slots which led to incompatible register map) have been merged back into a unique implementation. The code is less readable (as would be any out-of-tree OT SW...) but it simplifies maintenance
  3. The initial address remapper feature has been rewritten from scrach, replacing QEMU MemoryRegion aliasing with a new ot_vmapper component that replaces the RISC-V MMU (which is not an OpenTitan feature). The new implementation is much more flexible and addresses entangled issues with MemoryRegion aliasing which is used in other components, which in turn led to hard-to-solve inter-IP dependencies (such as SRAM controller early initialization and invalid DMA address space (which ended up seeing the remapped addresses in QEMU whereas they should only be available to the Ibex core). It does come with a limitation though: it can only be used with 4KiB+ translation regions - see the documentation on this feature for more details. It is possible to force the previous implementation that did not exhibit this limitation to run special OT unit tests that rely on 256-byte translation region...
  4. 3 out-of-bound buffer issues that have been reported by the sanitizer have been fixed
  5. Known DMA discrepancies with the real HW have been fixed
  6. For some (unexpected) reason the SPI device HW permutes the device ID part of the JEDEC ID; the emulation now also permutes those bytes
  7. OTP back end file is reloaded on each reset, so that the content (and ECC checks) are performed without the need of spawning a new QEMU session. This improves confidence in generated OTP content
  8. Life Cycle ECC bytes were corrupted on LC state changes; this issue has been fixed
  9. Some bottom halves & timers were not cancelled on reset, which could led to unexpected behavior after a reset
  10. ot_id debug properties have been unified and simplified; there are now mandatory, i.e. the SoC should initialize them before realizing the devices. The ibex helpers take care of this step at machine creation.

rivos-eblot and others added 27 commits May 6, 2025 10:52
This may be useful to delay initial connection to the QEMU SPI device
socket when QEMU start up / initial FW boot time is slow.

Signed-off-by: Emmanuel Blot <eblot@rivosinc.com>
Tiny tool to convert time absolute log time into relative log time.
It enables comparing different runs time-wise with log files produced
with OT scripts using the --log-time option.

   timelog.py < pyot.log > pyot-rel.log

Signed-off-by: Emmanuel Blot <eblot@rivosinc.com>
…e inclusion"

There are header guards on both cpu.h and pmp.h which avoids any
conflict on duplicated header inclusion.

Signed-off-by: Rob Bradford <rbradford@rivosinc.com>
strchrnul function has been introduced in macOS 15.4, with a warning message that
shows up on almost every single C file being built as:

   "note: 'strchrnul' has been marked as being introduced in macOS 15.4 here, but
    the deployment target is macOS 15.0.0"

This commit hides the presence of strchrnul on macOS, so the default QEMU
implementation is used instead, as it was on previous macOS versions.

This is a workaround till this issue is addressed upstream.

Signed-off-by: Emmanuel Blot <eblot@rivosinc.com>
…pper implementation

Signed-off-by: Emmanuel Blot <eblot@rivosinc.com>
…lementations.

Merge both implementation into a single one with dynamic register definition.
The code is less readable, but there is no longer two concurrent implementations
of the same IP for the sake of managing different number of remapping regions.

Signed-off-by: Emmanuel Blot <eblot@rivosinc.com>
…er implementation

Instantiate and configure the virtual remapper.

Signed-off-by: Emmanuel Blot <eblot@rivosinc.com>
LC state support on EarlGrey is not yet fully implemented, bypass its
execution control line.

Signed-off-by: Emmanuel Blot <eblot@rivosinc.com>
(cherry picked from commit bd1b7acb45dda7203045669ef936c4c43f01cb56)
…ations

Signed-off-by: Emmanuel Blot <eblot@rivosinc.com>
This changes enables providing custom address translation engine.
OpenTitan does not have an MMU, but support a custom virtual remapper.

Signed-off-by: Emmanuel Blot <eblot@rivosinc.com>
On OpenTitan devices, PMP is validating translated addresses, not
physical ones.

Signed-off-by: Emmanuel Blot <eblot@rivosinc.com>
…anslation

Signed-off-by: Emmanuel Blot <eblot@rivosinc.com>
Signed-off-by: Emmanuel Blot <eblot@rivosinc.com>
Instantiate and configure the virtual remapper.

Signed-off-by: Emmanuel Blot <eblot@rivosinc.com>
…mentation

Replace MR alias based memory mapping with ot_vmapper engine by default.
Use `alias-mode=true` to revert to the legacy implementation.

Signed-off-by: Emmanuel Blot <eblot@rivosinc.com>
…eature

Signed-off-by: Emmanuel Blot <eblot@rivosinc.com>
…or on invalid range

Signed-off-by: Emmanuel Blot <eblot@rivosinc.com>
Signed-off-by: Emmanuel Blot <eblot@rivosinc.com>
Only RESET_INFO needs to be preserved on reset.

Signed-off-by: Emmanuel Blot <eblot@rivosinc.com>
If the guest randomly write in the PULP debug module, this would made
the QEMU machine to crash.

Signed-off-by: Emmanuel Blot <eblot@rivosinc.com>
Each state contains word_count uint16_t entries.

Signed-off-by: Emmanuel Blot <eblot@rivosinc.com>
Invalid CSID should not be used to index the banked configopts registers.

Signed-off-by: Emmanuel Blot <eblot@rivosinc.com>
Signed-off-by: Emmanuel Blot <eblot@rivosinc.com>
Also add an extra sanity check.

Signed-off-by: Emmanuel Blot <eblot@rivosinc.com>
Signed-off-by: Emmanuel Blot <eblot@rivosinc.com>
Signed-off-by: Emmanuel Blot <eblot@rivosinc.com>
OTP content used to be loaded in PoR reset, the OTP implementation maintaining
a synchronized copy of its buffer in the file backend. However this led to
never checking the actual back end content in the current QEMU session, which
is a far too strong departure from the actual HW.

This new implementation reloads the OTP content from the back end file on
each reset, to ensure that data committed to the back end is actually used
on each OT run session.

Signed-off-by: Emmanuel Blot <eblot@rivosinc.com>
rivos-eblot added 29 commits May 6, 2025 10:54
… API

Signed-off-by: Emmanuel Blot <eblot@rivosinc.com>
Signed-off-by: Emmanuel Blot <eblot@rivosinc.com>
Signed-off-by: Emmanuel Blot <eblot@rivosinc.com>
…e API

Signed-off-by: Emmanuel Blot <eblot@rivosinc.com>
Signed-off-by: Emmanuel Blot <eblot@rivosinc.com>
…le API

Signed-off-by: Emmanuel Blot <eblot@rivosinc.com>
Signed-off-by: Emmanuel Blot <eblot@rivosinc.com>
Signed-off-by: Emmanuel Blot <eblot@rivosinc.com>
…able API

Signed-off-by: Emmanuel Blot <eblot@rivosinc.com>
…able API

Signed-off-by: Emmanuel Blot <eblot@rivosinc.com>
…able API

Signed-off-by: Emmanuel Blot <eblot@rivosinc.com>
…ble API

Signed-off-by: Emmanuel Blot <eblot@rivosinc.com>
…e API

Signed-off-by: Emmanuel Blot <eblot@rivosinc.com>
…e API

Signed-off-by: Emmanuel Blot <eblot@rivosinc.com>
…able API

Signed-off-by: Emmanuel Blot <eblot@rivosinc.com>
…ttable API

Signed-off-by: Emmanuel Blot <eblot@rivosinc.com>
…table API

Signed-off-by: Emmanuel Blot <eblot@rivosinc.com>
Signed-off-by: Emmanuel Blot <eblot@rivosinc.com>
…able API

Signed-off-by: Emmanuel Blot <eblot@rivosinc.com>
… API

Signed-off-by: Emmanuel Blot <eblot@rivosinc.com>
Signed-off-by: Emmanuel Blot <eblot@rivosinc.com>
Signed-off-by: Emmanuel Blot <eblot@rivosinc.com>
Signed-off-by: Emmanuel Blot <eblot@rivosinc.com>
Signed-off-by: Emmanuel Blot <eblot@rivosinc.com>
ot_common_configure_devices_with_id already takes care of identifying devices.

Signed-off-by: Emmanuel Blot <eblot@rivosinc.com>
Signed-off-by: Emmanuel Blot <eblot@rivosinc.com>
Signed-off-by: Emmanuel Blot <eblot@rivosinc.com>
The parent should specify this property.

Signed-off-by: Emmanuel Blot <eblot@rivosinc.com>
(cherry picked from commit 851989e)
Signed-off-by: Emmanuel Blot <eblot@rivosinc.com>
@rivos-eblot rivos-eblot force-pushed the dev/ebl/resync_on_dj branch from 6d71e6a to 1e17ee0 Compare May 6, 2025 09:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants