diff --git a/drivers/thunderbolt/apple.c b/drivers/thunderbolt/apple.c index cb3a94977182a..b6c286e8ad342 100644 --- a/drivers/thunderbolt/apple.c +++ b/drivers/thunderbolt/apple.c @@ -601,6 +601,7 @@ struct apple_cio { atomic_t fw_wake_seen; /* "Waking up from sleep!" */ atomic_t fw_at_answers; /* "Got AT register 12" */ atomic_t fw_at_timeouts; /* "Timeout for at_rt command response" */ + atomic_t fw_at_read_timeout_logged; /* suppress repeated Phase 3 AT read timeout spam */ bool sleep_aborted_early; /* protected by lock: devices never suspended */ u32 current_cable_info; @@ -1613,8 +1614,9 @@ static int apple_cio_rtkit_shmem_setup(void *cookie, struct apple_rtkit_shmem *b * "Entering Phase 1. action=4", "ACIO SLEEP process completed" before the processor's * power-off; "Waking up from sleep!", "Entering Phase 1. action=5", "Got AT register 12" * after the restart). A router restarted without its sleep runs action 0 and the dock's - * retimer never answers register 12. The records are only read here: every one is still - * logged and acknowledged as before. + * retimer never answers register 12. Except for repeated Phase 3 AT register read timeouts + * (downgraded to debug), the records are only read here: every one is still logged and + * acknowledged as before. */ static bool apple_cio_rtkit_syslog(void *cookie, const char *context, const char *message) { @@ -1622,6 +1624,19 @@ static bool apple_cio_rtkit_syslog(void *cookie, const char *context, const char unsigned int action, from, to; const char *p; + /* + * While waiting in Phase 3 for an answering peer, AppleCIOFirmware + * retries reading the AT register every 100 ms indefinitely. Log the + * first timeout at info per lane-init/connect cycle and downgrade + * repeats to debug so an unanswered port cannot flood the log ring. + */ + if (!strcmp(message, "Timeout reading AT register")) + return atomic_xchg(&acio->fw_at_read_timeout_logged, 1) != 0; + if (strstr(message, "Entering Phase 1") || + strstr(message, "Got AT register 12") || + strstr(message, "Entering Connected")) + atomic_set(&acio->fw_at_read_timeout_logged, 0); + if (acio->hw != &apple_cio_t6050_hw) return false; p = strstr(message, "Entering Phase 1. action="); @@ -3721,6 +3736,7 @@ static int apple_cio_start(struct apple_cio *acio) } } + atomic_set(&acio->fw_at_read_timeout_logged, 0); acio->rtk = apple_rtkit_init(acio->dev, acio, NULL, 0, &apple_cio_rtkit_ops); if (IS_ERR(acio->rtk)) { ret = PTR_ERR(acio->rtk);