-
Notifications
You must be signed in to change notification settings - Fork 791
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
[edn/rtl] Adapt sw_cmd_sts register #20873
Conversation
fb673dd
to
0293f15
Compare
765ed1c
to
576f15a
Compare
576f15a
to
e6af7aa
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.
Great work @h-filali , this was a major piece of work! I just have a few questions and nits.
I've reviewed RTL, DV and the DIF as well as the cryptolib changes and it looks good to me. But I think it would be great if @jadephilipoom could also review the software changes.
abs_mmio_write32(kBaseCsrng + CSRNG_INTR_STATE_REG_OFFSET, reg); | ||
abs_mmio_write32(base_address + CSRNG_INTR_STATE_REG_OFFSET, reg); |
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.
Nit: this change seems not required as the if
is only true for CSRNG anyway.
e6af7aa
to
64c5fd3
Compare
Thanks @vogelpi for your review, some very helpful inputs. I believe all your points should be addressed now. |
64c5fd3
to
489cc5a
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.
Looked over the changes in cryptolib and dif files and it looks good to me! Just a few small comments.
// passes to CSRNG. In this case, the check_completion register should only be | ||
// true for non-generate commands issued to the SW register. |
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.
nit: I think here the comment refers to the argument to the function below
// passes to CSRNG. In this case, the check_completion register should only be | |
// true for non-generate commands issued to the SW register. | |
// passes to CSRNG. In this case, the check_completion argument should only be | |
// true for non-generate commands issued to the SW register. |
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.
You're right, I'll change that.
@@ -361,10 +390,11 @@ static status_t csrng_send_app_cmd(uint32_t reg_address, | |||
return OTCRYPTO_RECOV_ERR; | |||
} | |||
|
|||
if (check_completion) { | |||
if (check_completion && (cmd_type == kEntropyCsrngSendAppCmdTypeCsrng)) { |
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.
In this and the following check, is check_completion
actually serving a purpose now? Should we just remove that argument from the function and use cmd_type
instead to determine where and whether to look for the done bit?
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.
I guess this could still have a use case if one would like to send a CSRNG/EDN_SW command without waiting for the acknowledgement.
uint32_t cmd_reg; | ||
uint32_t sts_reg; | ||
uint32_t rdy_bit; |
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.
nit: I'd rename these slightly so that it's clear they hold register addresses, not register contents; this will better match naming elsewhere in the cryptolib drivers.
uint32_t cmd_reg; | |
uint32_t sts_reg; | |
uint32_t rdy_bit; | |
uint32_t cmd_reg_addr; | |
uint32_t sts_reg_addr; | |
uint32_t rdy_bit_addr; |
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.
Good point, thanks!
489cc5a
to
254d8ce
Compare
Thanks a lot for your inputs @jadephilipoom ! I hope I was able to address everything properly. |
ada8810
to
b0c327d
Compare
b0c327d
to
fb97c5b
Compare
This commit changes the sw_cmd_sts register. The register now contains the following fields: cmd_reg_rdy, cmd_rdy, cmd_sts and cmd_ack. An explanation for these fields can be found in the contents of this commit. The command reg ready signal should be high when the EDN is ready to accept new SW command data and the output FIFO is ready to accept data. This commit should make it easier for firmware to check whether a command has been acked by CSRNG. Now software shouldn't need to check the intr signal any more and it should be possible to find out whether the ack has happened and the sts is succesful with a single read. Signed-off-by: Hakim Filali <[email protected]>
… vseq This commit fixes some rare instances where the edn_err_vseq fails because the data is unstable after the EDN has been disabled. The assertions can be disabled here, since the specification says that the CSRNG and ES have to be disabled and re-enabled before the EDN is turned back on. Signed-off-by: Hakim Filali <[email protected]>
This commit adds new checks to the scoreboard for the new cmd_ack and cmd_sts fields of the sw_cmd_sts register. The cmd_rdy and cmd_reg_rdy fields are not checked yet since there is another HW change planned where we remove the output FIFO. It would be fairly complicated to track those two fields and since we plan on changing the behaviour for those two regs a bit it would not be worth to write the tracking code in the scoreboard yet. Signed-off-by: Hakim Filali <[email protected]>
This commit aligns the documentation with the new behavior of the sw_cmd_sts register. This commit also gets rid of the existing amiguity in our documentation regarding the sw_cmd_sts register. Signed-off-by: Hakim Filali <[email protected]>
This commit adds two new cover groups. One for each time the sw_cmd_sts register is read. The other for the sts signal that gets recorded each time the edn receives an acknowledgement from the CSRNG agent. Signed-off-by: Hakim Filali <[email protected]>
This commit sets the time out for two of the chip level EDN tests to long. These tests were failing or are now failing with the added HW changes, because the timeout values were too low. This commit fixes this issue and removes the broken tag from one of the tests. Signed-off-by: Hakim Filali <[email protected]>
This commit aligns the EDN difs with the HW changes in prior commits. Some of the difs are shared between the EDN and CSRNG. The main difference is that now the difs can see when a command is done by looking at the ack bit in the sw_cmd_sts register. Signed-off-by: Hakim Filali <[email protected]>
This commit aligns the crypto library to the new behavior of the EDN's sw_cmd_sts register. This commit is similar to the previous commit for the dif's. Signed-off-by: Hakim Filali <[email protected]>
fb97c5b
to
57be4c4
Compare
This PR contains changes for the sw_cmd_sts register. The register now includes four fields.
Namely: sw_cmd_rdy, sw_cmd_reg_rdy, sw_cmd_ack and sw_cmd_sts.
Through this PR the documentation should now be consistent within itself and with the RTL (regarding the sw_cmd_sts reg).
For further information please see the individual commit messages.
Some of the commits in this PR are already contained in #20293
This PR is a precursor of the fix for #15561