-
Notifications
You must be signed in to change notification settings - Fork 12
[ot] hw/opentitan: otp: set OTP image perms during realization #182
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
b2c32af
to
5272a41
Compare
If we leave this until reset time, the QEMU process may have `-daemonize`d and changed its directory to `/`. This will cause any relative paths given to `-drive` arguments to be invalid. Signed-off-by: James Wainwright <james.wainwright@lowrisc.org>
5272a41
to
5daef1e
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.
This LGTM after my comments are addressed. I've walked through the issue with @jwnrt and this seems like the correct solution as far as I understand, but I'd definitely wait until @rivos-eblot or @loiclefort can check first since maybe I'm missing some understanding about the different QEMU stages.
Edit: also maybe should this be extracted to its own function to avoid cluttering _realize
?
I need to check what if there could be any issue with multiple resets and OTP/LC update. We never used/have to use I guess that this issue might also affect other devices that use the same API (flash device for example) |
Yes, |
No regression found. |
Thank you for checking |
Fixes a bug where QEMU will fail to find the OTP drive on reset if the
-daemonize
flag is used. This flag detaches the QEMU subprocess from the current parent and changes its CWD to the root. It runs after realization and once all IOs are connected to chardevs.If a relative path is given to
-drive
for the raw OTP image, it will become invalid whenblk_set_perms
tries to re-open the OTP image file again post-daemonization.