[i2c] investigate and add MCTP mode to I2C
@igk8 @tunghoang290780 @martin-lueker
It has been requested for us to look into adding MCTP mode into our I2C functionality. Please research and let us know the ramifications for adding this feature into the existing design.
@sjgitty Are you referring to MCTP 1.2.0 specification? https://www.dmtf.org/sites/default/files/standards/documents/DSP0237_1.2.0.pdf
I can check if that is the most appropriate version, but that appears to be the right one.
A quick read of that in section 6.3 it indicates "All MCTP transactions are based on the SMBus Block Write bus protocol". We can support that (example in the util/i2csvg/smbus) so the basics are there. It uses PEC which is an 8-bit CRC we can calculate and check in software (although we need to understand how to react if it does not match).
The spec does (or at least can) make use of the SMBus ARP and UDID framework. I have never delved into this before (or seen it used). From a scan of the SMBus spec we may: (a) want something special to allow the device interface to accept transactions on the couple of special addresses: the default address 1100_001 and smbus host 0001_000, each would need an enable (b) need to look very carefully at the collision detection because that is critical to operation (c) need to think hard about the special cases where late in the transaction the receiver discovers it is for another device and NAK is needed on subsequent bytes.
I did just notice that SMBus defines "Host" as distinct from "Master", a "Host" must be "Master-Slave"
Hi @mdhayter, Thanks for the analysis! I am unfamiliar with the MCTP protocol, but I'm optimistic that we should be able to do this given all the analysis you've already done in helping us support SMBus. I'll continue to look this protocol over. Meanwhile @igk8: Do you think there would be any issue with supporting the special cases (a), (b) & (c) that @mdhayter mentions above?
I have never encountered MCTP before, so a deeper review is probably needed than the one I did.
@sjgitty is there anyone who would be coding up the software side of the protocol who should review?
I have never encountered MCTP before, so a deeper review is probably needed than the one I did.
@sjgitty is there anyone who would be coding up the software side of the protocol who should review?
I don't have a name for you at this time. The request was from an external interested party, so not native to our project. I'll see if they can formulate the request a bit more narrowly, but the first request was to keep this spec in mind while working on I2C as it has some features that aren't intrinsically obvious. @gkelly for visibility.
Pinging @igk8 about the MCTP questions posed earlier on this thread.
MCTP is just a layer on top of SMBus. There is already a Rust implementation available here: https://github.com/westerndigitalcorporation/libmctp
I have tested MCTP on an ARM board with Tock and libMCTP and it works with just a standard I2C master that supports SMBus. There shouldn't be any hardware changes required for MCTP, as long as SMBus works MCTP will work.
Does the I2C/SMBUS block need multi-master support to enable MCTP?
Does the I2C/SMBUS block need multi-master support to enable MCTP?
Yes. MCTP messages are always transmitted as a block write, so in slave mode to receive messages.
MCTP shouldn't required multi-master support, but other layers on top might (Cerberus does for example)
From the MCTP smbus/i2c Transport binding spec https://www.dmtf.org/sites/default/files/standards/documents/DSP0237_1.2.0.pdf
It looks like a slave address is required at both ends, spec quoted below.
" 6.11.1 Slave addresses Each device on SMBus/I2C shall have a slave address to be the target of transactions by bus masters. The MCTP transport protocol solely utilizes Master Write transactions to transfer MCTP packets between MCTP endpoints. For endpoint "A" to send an MCTP packet to endpoint "B", endpoint A shall master the bus and issue a Block-Write transaction to the slave address of endpoint B. Similarly, for endpoint B to send an MCTP packet to endpoint A, it shall master the bus and issue a Block-Write transaction to the slave address of endpoint A. Thus, bi-directional transfer of MCTP packets requires that both sides of the communication have slave addresses. "
@alistair23 - do lets know how to get it working without multi-master support - that would be great - thanks
Ah you're right! I forgot about that Sorry, it's been ages since I looked at this
Inspired by IPMI, looks like.
Need to figure out whether this is relevant for PROD. CC @GregAC @jesultra @moidx @moidx for thoughts.
I am not sure we will be able to implement this for PROD given our current schedule, hence I am placing this into the backlog. Please let me know if you think otherwise.
Moving back to PROD.M2 as this may be precluding the implementation of MCTP in firmware. @a-will can you confirm? I am not sure if there is a separate issue for tracking I2C multi-master support.
Moving back to PROD.M2 as this may be precluding the implementation of MCTP in firmware. @a-will can you confirm? I am not sure if there is a separate issue for tracking I2C multi-master support.
That's correct. I2C multi-master support is required for the MCTP over I2C binding. There are additional requirements beyond just that, though, such as needing to be able to time out clock stretching (and following up with NACK for that byte).
For that particular one, this issue is related: https://github.com/lowRISC/opentitan/issues/15227
In addition, the controller and target mode FSMs would likely need to become independent, for simplicity in having them active simultaneously. Semi-related issue: https://github.com/lowRISC/opentitan/issues/18655
I'm moving this to M4: The scoping was part of M2 and that is complete. After decisions have been taken, there may be DD and DV work but that comes after M2.
Note that this is currently a scoping issue and as such doesn't directly have DD or DV effort associated with it; those efforts are tracked in separate issues.
Closing as this has been used for scoping, which is complete, and https://github.com/lowRISC/opentitan/issues/22569 now tracks MCTP implementation.