-
Notifications
You must be signed in to change notification settings - Fork 792
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
[base,ottf,opentitanlib,test] Impl spi device ottf RX console #24345
[base,ottf,opentitanlib,test] Impl spi device ottf RX console #24345
Conversation
c484642
to
0703e30
Compare
Looks like you have some build errors. Trying seeing what they are locally by running: |
0703e30
to
ff86aa2
Compare
Thanks for the instructions. Those build errors have been addressed in the new commits. Not sure why those errors didn't appear when I ran the newly added test for OTTF spi_device console though. The I also tried to run this test locally |
f9154bb
to
badba4b
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 for the PR, we were look for forwarding for this feature.
I left a few comments below.
161d7c4
to
5a918c6
Compare
5a918c6
to
728fdde
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.
Couple more minor improvements, otherwise this looks great! Thanks @anthonychen1251 . Once you make the last couple improvements, and this passes CI. I can merge it.
This implements a new spi_device RX console by using the SPI device flash mode feature. The flash read buffer is used as a circular buffer. Reuses framing protocol from lowRISC#17494 with minor modifications to distinguish fresh data from stale values in the read buffer. Signed-off-by: Anthony Chen <[email protected]>
This updates the console module to use SPI device flash mode feature to support SPI device console. It's currently a one way console. Signed-off-by: Anthony Chen <[email protected]>
728fdde
to
36406c9
Compare
This tests the OTTF spi_device console, which uses the OT spi_device in flash mode, along with the flash read buffer and a lightweight framing protocol to implement a one-way (RX) console. Signed-off-by: Anthony Chen <[email protected]>
36406c9
to
c01bbc7
Compare
Thanks for the changes. After a discussion with @jwnrt @HU90m, we came up with a suggestion for the protocol that we believe would simplify the implementation and be more robust, by leveraging the spi_flash features to control the data flow.
Does that make sense? One downside thought is that we could have a deadlock in the device if the host does not poll the device. But that can be sorted with a timeout. |
Minor nit: I don't think this protocol would deadlock, it would just be blocked on the host doing its own thing |
This seems like it would lower the potential throughput always having to align the frame header at the beginning of the buffer no? Let's get this merged before making any further improvements to it. It is blocking critical provisioning work. |
You mean because the current implementation can queue up multiple frames in the circular buffer without having to wait for the host to read them out? |
Yes, can your proposal achieve the same? |
If we're sending lots of small frames at once, then no. If it's large amounts of data filling the buffer then it should be the same. |
I'm happy to merge as it is, and we can experiment other protocols later. |
This removes 2 flash ECC error test cases that were brittle since the test was self-corrupting itself (by design) in locations where test code could be executing. Signed-off-by: Tim Trippel <[email protected]>
Looks like the test that was failing was a flaky test that provided no additional value to the test scenario it was exercising so I added a commit to this PR that should fix the issue and get this to pass CI. |
Thanks for your thoughtful suggestions! Before creating this PR, I did experiment with a similar approach where the host issued an upload command to signal the device that the frame has been read. In this protocol, each data chunk transfer is a blocking operation, even if there is free space in the read buffer to accommodate the next chunk. While the proposed protocol in this PR utilizes the To illustrate this potential advantage, I conducted a simple experiment by logging a test message
I acknowledge that the suggested protocol offers implementation simplicity. It seems there's a trade-off here between potential throughput performance and implementation simplicity/robustness. |
Backport failed for Please cherry-pick the changes locally and resolve any conflicts. git fetch origin earlgrey_1.0.0
git worktree add -d .worktree/backport-24345-to-earlgrey_1.0.0 origin/earlgrey_1.0.0
cd .worktree/backport-24345-to-earlgrey_1.0.0
git switch --create backport-24345-to-earlgrey_1.0.0
git cherry-pick -x 4f8b2a75623dc5c52790ad469592433a25d6837c 0d95dfc9a5784115df75d3d267c352b8a6373dea c01bbc7c43c042d4389f570081d046c99898e314 39b3f76a0daf287ec257987d6994333240f1eef2 |
This PR has three commits that:
This PR addresses #21726 partially. The TX (input) direction will be added in another PR.