-
Notifications
You must be signed in to change notification settings - Fork 13
ot_otp: unify implementations
#272
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
Conversation
32de450 to
a5cad1d
Compare
e6edb49 to
4eb19dc
Compare
8494dad to
56b1a5e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Partial review (reviewed up to the "merge OTP implementation" commit, and I only looked at the ot_otp_engine.h and ot_otp_{dj,eg}_parts.c files in that commit so far).
b588e1b to
5e0c13a
Compare
Disable all LLVM rules as they hard-code paths from LLVM project. llvm-header-guard therefore suggests to replace header guard path with the full absolute path of the current local check out directory path! It appears that llvm-* rules are only to be used for the LLVM project itself, but they are nevertheless automatically added with the default `*` wildcard... Signed-off-by: Emmanuel Blot <[email protected]>
…erator Signed-off-by: Emmanuel Blot <[email protected]>
- move partition names to the OtOTPPartDesc array - allocate arrays of string properties and their matching byte values at runtime, - rename partition-related variables, as several new variables are added - replace statically defined constants with dynamic variables - clean up Signed-off-by: Emmanuel Blot <[email protected]>
- move partition names to the OtOTPPartDesc array - allocate arrays of string properties and their matching byte values at runtime, - rename partition-related variables, as several new variables are added - replace statically defined constants with dynamic variables - clean up Signed-off-by: Emmanuel Blot <[email protected]>
…erface. This is the second step towards unification of OtOTP* implementations. It is better to expose the OtOTPState feature as an interface, so that OtOTPState can later implement the common feature for all OtOTP Top-specialized implementation. Signed-off-by: Emmanuel Blot <[email protected]>
…TP devices Signed-off-by: Emmanuel Blot <[email protected]>
… file Signed-off-by: Emmanuel Blot <[email protected]>
5e0c13a to
fbe0c39
Compare
1aadd5c to
d7b4ee4
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, this LGTM once my remaining comments are addressed. With a PR this large I will probably have missed a few things but all the Earlgrey OTP tests I have are passing for me, so there are no obvious regressions at least.
d7b4ee4 to
64a23e2
Compare
Thanks for the reviews. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
… Darjeeling - merge and adapt common code into OtOTPEngine - keep only OTP top-specific implementation in ot_otp_eg.c and ot_otp_dj.c, which implement the OtOTPImplIf interface (specialization for Tops) - regenerate OTP partition descriptions and key seed definition with otptool.py Signed-off-by: Emmanuel Blot <[email protected]>
- use Top defined constants - simplify stack of macro calls - remove definitions from ot_otp_engine.h Signed-off-by: Emmanuel Blot <[email protected]>
…ctory This is needed to implement other OTP top-specific implementations. Signed-off-by: Emmanuel Blot <[email protected]>
…rties - secret_scrambling_keys: the exact number of such properties is created. this avoid allocated useless memory, and ensure QEMU property subsystem may report any attempt to define values for keys that do not exist - secret_scrambling_key and inv_default_data values are now tied to the partition controller, rather than to be allocated as separate arrays Signed-off-by: Emmanuel Blot <[email protected]>
Should start with OT_OTP, OtOtp, ot_otp to prevent from unexpected conflicts Signed-off-by: Emmanuel Blot <[email protected]>
64a23e2 to
b4bfe87
Compare
…TP prefix Signed-off-by: Emmanuel Blot <[email protected]>
…d data Signed-off-by: Emmanuel Blot <[email protected]>
b4bfe87 to
8bad622
Compare
This PR generalizes OTP implementation, so that code is no longer duplicated for each top.
Most of the code is now implemented in a new component
OtOTPEngineState(ot_otp_engine.c) which contains over 4/5 of the duplicated code that used to exist inot_otp_eg.candot_otp_dj.cfiles.Those two latter files now only contain what is specific to each Top:
Some note about the interfaces/classes:
OtOTPIf(Class)interface exposes the public interface of the OTP, i.e. the API that other OpenTitan "HW" devices can use to communicate with the OTPOtOTPImplIf(Class)interface exposes the semi- private interface that a top-specific OTP implementation exposes to theOtOTPEngineStateOtOtpBeIf(Class)interface exposes the public interface of an OTP backend, which describes the characteristics of a specific backend. Note that ideally, this component should manage the QEMU OTP image file, which is not (yet) the case.OtOTPEngineState/Classimplements the whole OTP emulation. It is an abstract class whose concrete implementation is Top-specific.OtOTPEgState/ClassandOtOTPDjState/Classare two concrete implementations ofOtOTPEngineState/Class. Each implements the implements theOtOTPIfinterface which is exposed to the OTP clients, and implement theOtOTPImplIfto provide the features required by their abstract classOtOTPEngineState/Class.