firmware: arm_scmi: Set polling timeout to max_rx_timeout_ms
authorCristian Marussi <cristian.marussi@arm.com>
Mon, 29 Nov 2021 19:11:42 +0000 (19:11 +0000)
committerSudeep Holla <sudeep.holla@arm.com>
Mon, 13 Dec 2021 17:41:47 +0000 (17:41 +0000)
Use transport specific transmission timeout (max_rx_timeout_ms) also for
polling transactions.

Initially when polling mode was added, it was intended to be used only
in scheduler context and hence the choice of 100us for the polling timeout.
However the only user for that was dropped for other SCMI concurrency
issues, so it shouldn't cause any issue to increase this timeout value now.

Link: https://lore.kernel.org/r/20211129191156.29322-3-cristian.marussi@arm.com
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: Cristian Marussi <cristian.marussi@arm.com>
[sudeep.holla: Updated commit message with historical facts about 100us timeout]
Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
drivers/firmware/arm_scmi/driver.c

index 3cf161f..5685621 100644 (file)
@@ -724,8 +724,6 @@ static void xfer_put(const struct scmi_protocol_handle *ph,
        __scmi_xfer_put(&info->tx_minfo, xfer);
 }
 
-#define SCMI_MAX_POLL_TO_NS    (100 * NSEC_PER_USEC)
-
 static bool scmi_xfer_done_no_timeout(struct scmi_chan_info *cinfo,
                                      struct scmi_xfer *xfer, ktime_t stop)
 {
@@ -799,7 +797,8 @@ static int do_xfer(const struct scmi_protocol_handle *ph,
        }
 
        if (xfer->hdr.poll_completion) {
-               ktime_t stop = ktime_add_ns(ktime_get(), SCMI_MAX_POLL_TO_NS);
+               ktime_t stop = ktime_add_ms(ktime_get(),
+                                           info->desc->max_rx_timeout_ms);
 
                spin_until_cond(scmi_xfer_done_no_timeout(cinfo, xfer, stop));
                if (ktime_before(ktime_get(), stop)) {