Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 18 additions & 2 deletions drivers/thunderbolt/apple.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -1613,15 +1614,29 @@ 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)
{
struct apple_cio *acio = cookie;
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=");
Expand Down Expand Up @@ -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);
Expand Down
Loading