-
Notifications
You must be signed in to change notification settings - Fork 45
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
libcaliptra: add SHA accelerator API #1637
base: main
Are you sure you want to change the base?
Conversation
|
a103c9f
to
219441c
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.
I think there are some issues when it comes to obtaining and releasing the lock. It think there should also be a test that performs these operations with a known answer to ensure this is working.
|
||
if (mode == CALIPTRA_SHA_ACCELERATOR_MODE_MBOX_384 || mode == CALIPTRA_SHA_ACCELERATOR_MODE_MBOX_512) { | ||
// Writing 1 will clear the lock | ||
caliptra_write_u32(CALIPTRA_SHA_ACCELERATOR_LOCK_ADDR, 0x1); |
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.
Don't we need to obtain the lock before interacting with it? I think we'll also want to return a busy error if it's not available as we do for the mailbox.
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 manually ran a test on the FPGA for that back when I wrote it but I might have just been lucky that nothing interfered. But I agree, I'll add a tests around locking and unlocking the accelerator and check if that handling needs to be revised.
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'm somewhat confused about the locking behavior. Writing 1 will clear the lock and "reading 0" will set the lock but how does "reading 0" even work? That documentation looks odd to me now that I went over it again and it also seems like the emulator is not really doing what is written in the documentation.
86ab97c
to
3eef2a0
Compare
Signed-off-by: Marvin Drees <marvin.drees@9elements.com>
Resolves #1361 by providing an abstraction above the
caliptra_write_u32
andcaliptra_read_u32
function calls according to the info at https://chipsalliance.github.io/caliptra-rtl/main/external-regs/?p=caliptra_top_reg.sha512_acc_csr