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)
Mon, Nov 4, 10:43 PM
Unknown Object (File)
Mon, Nov 4, 10:43 PM
Unknown Object (File)
Mon, Nov 4, 10:43 PM
Unknown Object (File)
Mon, Nov 4, 10:26 PM
Unknown Object (File)
Oct 13 2024, 6:19 AM
Unknown Object (File)
Oct 1 2024, 5:04 AM
Unknown Object (File)
Sep 30 2024, 2:31 AM
Unknown Object (File)
Sep 30 2024, 2:23 AM
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