Skip to content
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

RFC: Initial ROM vendor hooks implementation #25642

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

sameo
Copy link
Contributor

@sameo sameo commented Dec 13, 2024

This PR implements an initial framework for allowing vendors to customize OpenTitan ROMs with external , potentially closed-source hooks. See #25633 for more details on the problem statement and the proposed solution.

This pull request is made of three commits:

  1. [sw,silicon_creator,rom] Add a ROM state API is the main ROM vendor hooks implementation. It provides a set of C macros for defining ROM states and binding them with a run callback implementation. It also provides a simple API for walking through all defined states.
  2. [sw,silicon_creator,rom] Add dummy ROM state hooks expands the hooks_setup bazel rules for supporting external ROM hooks repository. It also provides a dummy example of such a repository, with basic documentation on how to replicate that setup to actually implement custom ROM hooks
  3. [sw,silicon_creator,rom] Convert the OpenTitan ROM to the ROM state API is really just a PoC as it converts the existing Earlgrey ROM to this new framework. In this commit, the ROM state definitions are wrapper around the existing high level functions of the Earlgrey ROM. A real conversion would split those functions into more granular ones and map those to a finer ROM state machine. This is not done in this commit to keep it as little intrusive as possible, mostly for readability purposes.

Fixes #25633

@sameo sameo requested review from cfrantz and a team as code owners December 13, 2024 13:35
@sameo sameo requested review from engdoreis, timothytrippel, cfrantz, andreaskurth and loiclefort and removed request for a team, cfrantz and engdoreis December 13, 2024 13:35
@sameo sameo force-pushed the topic/rom-vendor-hooks branch from 889f41f to 867bb64 Compare December 13, 2024 13:51
The ROM state API allows for defining a set of ROM states and their
associated hooks and callback. Each state is defined by its run
callback, and two hooks: the pre-run hook is executed prior to the run
callback while the post-run one runs after.
The rom_state_fsm() function walks through the ROM states, as each state
run callback returns the next ROM state to transition to.

ROM state hooks can be overridden by silicon creator implementations,
through an external, potentially closed source, code repository.

Signed-off-by: Samuel Ortiz <[email protected]>
And define the hooks setup bazel rules for silicon creators to provide
their own ROM state hooks implementations.

Signed-off-by: Samuel Ortiz <[email protected]>
@sameo sameo force-pushed the topic/rom-vendor-hooks branch from 867bb64 to e7044c9 Compare December 14, 2024 11:29
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.

[ROM] [RFC] Support vendor customizations
1 participant