Page MenuHomeFreeBSD

scmi: Protect SCMI/SMT channels from concurrent transmissions
ClosedPublic

Authored by cristian.marussi_arm.com on Dec 13 2023, 6:37 PM.
Tags
None
Referenced Files
Unknown Object (File)
Fri, May 3, 7:39 AM
Unknown Object (File)
Thu, May 2, 11:19 PM
Unknown Object (File)
Fri, Apr 26, 2:40 AM
Unknown Object (File)
Sat, Apr 20, 11:41 PM
Unknown Object (File)
Sat, Apr 20, 8:30 PM
Unknown Object (File)
Thu, Apr 11, 10:54 AM
Unknown Object (File)
Mar 28 2024, 4:36 AM
Unknown Object (File)
Feb 10 2024, 9:40 PM
Subscribers

Details

Summary

The SCMI/SMT memory areas are used from the agent and the platform as
channels to exchage commands and replies.

Once the platform has completed its processing and a reply is ready to
be read from the agent, the platform will relinquish the channel to the
agent by setting the CHANNEL_FREE bits in the related SMT area.

When this happens, though, the agent has still to effectively read back
the reply message and any other concurrent request happened to have been
issued in the meantime will have been to be hold back until the reply
is processed or risk to be overwritten by the new request.

The base->mtx lock that currently guards the whole scmi_request()
operation is released when sleeping waiting for a reply, so the above
mentioned race can still happen or, in a slightly different scenario,
the concurrent transmission could just fail, finding the channel busy,
after having sneaked through the mutex.

Adding a new mechanism to let the agent explicitly acquire/release the
channel paves the way, in the future, to remove such central commmon
lock in favour of new dedicated per-transport locking mechanisms, since
not all transports will necessarily need the same level of protection.

Add a flag, controlled by the agent, to mark when the channel has an
inflight command transaction still pending to be completed and make the
agent spin on it when queueing multiple concurrent messages on the same
SMT channel.

Tested on: ARM Morello Board
Sponsored by: Arm Ltd

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable