• Cristian Marussi's avatar
    firmware: arm_scmi: Handle concurrent and out-of-order messages · ed7c04c1
    Cristian Marussi authored
    Even though in case of asynchronous commands an SCMI platform is
    constrained to emit the delayed response message only after the related
    message response has been sent, the configured underlying transport could
    still deliver such messages together or in inverted order, causing races
    due to the concurrent or out-of-order access to the underlying xfer.
    
    Introduce a mechanism to grant exclusive access to an xfer in order to
    properly serialize concurrent accesses to the same xfer originating from
    multiple correlated messages.
    
    Add additional state information to xfer descriptors so as to be able to
    identify out-of-order message deliveries and act accordingly:
    
     - when a delayed response is expected but delivered before the related
       response, the synchronous response is considered as successfully
       received and the delayed response processing is carried on as usual.
    
     - when/if the missing synchronous response is subsequently received, it
       is discarded as not congruent with the current state of the xfer, or
       simply, because the xfer has been already released and so, now, the
       monotonically increasing sequence number carried by the late response
       is stale.
    
    Link: https://lore.kernel.org/r/20210803131024.40280-6-cristian.marussi@arm.comSigned-off-by: default avatarCristian Marussi <cristian.marussi@arm.com>
    Signed-off-by: default avatarSudeep Holla <sudeep.holla@arm.com>
    ed7c04c1
common.h 15.4 KB