Dasharo / twpm-docs

Trustworthy Platform Module (TwPM) documentation
https://twpm.dasharo.com
5 stars 0 forks source link

7. Implement SPI TPM protocol #22

Closed BeataZdunczyk closed 5 months ago

BeataZdunczyk commented 1 year ago

SPI implementation on MCU may not be feasible because some of the registers must return proper values immediately. This task consists of repeating all the tasks that were done on FPGA side for LPC, but this time SPI is used as physical interface.

Milestones:

krystian-hebel commented 6 months ago

Design, implementation and testbench for simulation:

Changes to the toplevel:

Documentation:

krystian-hebel commented 5 months ago

Linux SPI TPM driver doesn't support wait states, defined by TPM specification. Because of that, testing on Raspberry Pi doesn't give positive results. After few failed attempts to rewrite the code in a way that would avoid those wait states, we decided to not pursue this path any further, and switched to testing on Protectli.

krystian-hebel commented 5 months ago

Both SPI and register modules' testbenches work on PRs listed above. SPI:

VCD info: dumpfile spi_periph_tb.vcd opened for output.
Performing TPM write w/o delay
Performing TPM write with delay
Performing TPM read with delay
Performing TPM read w/o delay
Testing transfers with scattered clock between bytes
Testing over-sized transfers
Testing non-TPM addresses
Testing crossing registers boundary
spi_periph_tb.v:349: $stop called at 86540000 (1ps)

Registers:

VCD info: dumpfile regs_tb.vcd opened for output.
Testing simple register reads without delay
Testing simple register reads with delay
Checking register values against expected.txt
Checking if RO registers are writable
Testing mechanisms for changing locality
Testing mechanisms for seizing locality
Testing TPM_INT_VECTOR write without delay - proper locality
Testing TPM_INT_VECTOR write with delay - proper locality
Testing TPM_INT_VECTOR write without delay - wrong locality
Testing TPM_INT_VECTOR write with delay - wrong locality
Testing TPM_INT_VECTOR write without delay - no locality
Testing TPM_INT_VECTOR write with delay - no locality
Testing command/response exchange and TPM state machine - basic
Testing command/response exchange and TPM state machine - advanced
regs_tb.v:1075: $stop called at 2023220000 (1ps)
tym2k1 commented 5 months ago

Verified and approved changes for:

By following those updated instructions I managed to setup a working TwPM on Orange Crab over SPI with Protectli VP66xx.

BeataZdunczyk commented 5 months ago

The latest changelog is now live: https://twpm.dasharo.com/changelog/#2024-03-14. All checks are completed, so I'm closing this issue.