• Justin Chen's avatar
    firmware: arm_scmi: Queue in scmi layer for mailbox implementation · da1642bc
    Justin Chen authored
    send_message() does not block in the MBOX implementation. This is
    because the mailbox layer has its own queue. However, this confuses
    the per xfer timeouts as they all start their timeout ticks in
    parallel.
    
    Consider a case where the xfer timeout is 30ms and a SCMI transaction
    takes 25ms:
    
      | 0ms: Message #0 is queued in mailbox layer and sent out, then sits
      |      at scmi_wait_for_message_response() with a timeout of 30ms
      | 1ms: Message #1 is queued in mailbox layer but not sent out yet.
      |      Since send_message() doesn't block, it also sits at
      |      scmi_wait_for_message_response() with a timeout of 30ms
      |  ...
      | 25ms: Message #0 is completed, txdone is called and message #1 is sent
      | 31ms: Message #1 times out since the count started at 1ms. Even though
      |       it has only been inflight for 6ms.
    
    Fixes: 5c8a47a5 ("firmware: arm_scmi: Make scmi core independent of the transport type")
    Signed-off-by: default avatarJustin Chen <justin.chen@broadcom.com>
    Message-Id: <20241014160717.1678953-1-justin.chen@broadcom.com>
    Reviewed-by: default avatarCristian Marussi <cristian.marussi@arm.com>
    Tested-by: default avatarCristian Marussi <cristian.marussi@arm.com>
    Signed-off-by: default avatarSudeep Holla <sudeep.holla@arm.com>
    da1642bc
mailbox.c 10.5 KB