]> www.infradead.org Git - nvme.git/commit
firmware: arm_scmi: Queue in scmi layer for mailbox implementation
authorJustin Chen <justin.chen@broadcom.com>
Mon, 14 Oct 2024 16:07:17 +0000 (09:07 -0700)
committerSudeep Holla <sudeep.holla@arm.com>
Mon, 14 Oct 2024 20:36:46 +0000 (21:36 +0100)
commitda1642bc97c4ef67f347edcd493bd0a52f88777b
tree4ff8bd9db3431e488c066d779b142e20bb886fcd
parentdb8f0b8088865150e4c9a8b8ffc9abdfd58bc4f7
firmware: arm_scmi: Queue in scmi layer for mailbox implementation

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: 5c8a47a5a91d ("firmware: arm_scmi: Make scmi core independent of the transport type")
Signed-off-by: Justin Chen <justin.chen@broadcom.com>
Message-Id: <20241014160717.1678953-1-justin.chen@broadcom.com>
Reviewed-by: Cristian Marussi <cristian.marussi@arm.com>
Tested-by: Cristian Marussi <cristian.marussi@arm.com>
Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
drivers/firmware/arm_scmi/transports/mailbox.c