Skip to content

After one sleep attempt with the modem up, CPIF can't reach the CP until a reboot (PCI sleep callbacks on the CP's link) #620

Open

Description

@W4HO-ham

Found on the Pixel 9a (#601), on both link drivers: the bring-up modules and the in-tree pcie_gs201_cp with CPIF, which the Pixel 7 Pro uses too. It is why the modem's sleep inhibitor must not be passed or gone round.

What was seen (2026-11-09, five boots, 25 sleep requests with the modem ONLINE and registered): nothing hung or reset. But in every boot, after the first sleep attempt, whether it was entered or refused, omamobile-sitd's requests to the CP began to time out within 95 s ("poll failed: TimeoutError") and never came back until a reboot, while omamobile-sit status went on showing the last state it had read.

The kernel log of the first attempt, the same on both drivers:

pcieport ...: Unable to change power state from D0 to D3hot, device inaccessible
pcieport ...: Unable to change power state from D3cold to D0, device inaccessible
... Data Link Layer Link Active not set in 100 msec
(the link driver brings the link up again, Gen3 x2)
cpif: s51xx_pcie_restore_state: Can't set D0 state!!!!
cpif: s51xx_pcie_send_doorbell_int: Can't send Interrupt(not setted bme_en, 0xffff)
cpif: ... cmd reg = 0xffff ... BME is not set ... link-down recovery requested

On the owner's kernel the doorbell then failed about 3000 times in 40 s. The CP's state went on reading ONLINE, and every systemctl reboot afterwards still logged the confirmed stop.

Our reading, not tested. The PCI core's system-sleep callbacks put the CP's root port and endpoint through D3 while CPIF, which powers this link up and down itself and saves and restores the endpoint's state itself, has the PHY down; afterwards the endpoint is not in the state CPIF expects (its command register reads 0xffff).

What's wanted. The CP's PCI devices kept out of the PCI core's system sleep, or their state restored after it, in the shared link driver; then a sleep attempt with the modem up that leaves the phone service working, checked by sitd's own poll and not by omamobile-sit status.

Until then. With the modem up nothing passes or goes round its sleep inhibitor except an attended test on the charger that ends in a reboot (AGENTS.md, "Suspend with the modem on", with #601). Not tried on the 7 Pro.

Record: device/tegu/MODEM-PLAN.md, "Suspend with the modem on, with the sleep fixes" (#601); the test script is device/tegu/bringup/modem-sleep-test.sh.

Activity

  1. derekross commented on Nov 11, 2026

    @derekross
    Owner

    Thank you, @W4HO-ham. This is the one of the three that matters most, and
    I'm glad it was found on the charger with a reboot ready rather than by
    somebody's missed call. Thank you too for checking sitd's own poll: the
    status command would have said everything was fine.

    Your reading is right, and it has been seen on the Pixel 7 Pro as well, so
    "not tried on the 7 Pro" can come out. @ikegam hit the same lines there,
    and kernel
    #232 is the
    fix: its second commit quotes Unable to change power state from D0 to D3hot, device inaccessible, the D3cold line and Data Link Layer Link Active not set in 100 msec from the first sleep with the modem online, and
    its third quotes Can't set D0 state!!!! and BME is not set from the
    second. It marks the root port PCI_DEV_FLAGS_NO_D3 and gives the devices
    below it a zero d3cold_delay, so the link stays CPIF's business through a
    sleep, as it is at runtime. With it, eight sleeps in one boot kept the modem
    on his 7 Pro. Your test build (the tip plus kernel #224, #236 and #237)
    didn't have #232, so your run is its "before" on a second SoC, on the same
    driver. That's useful evidence for #232, and I'll link this issue there.

    It also explains "entered or refused": the root port and the modem are
    suspended before the devices above them, so by the time CPIF refuses, the
    PCI core has already tried D3hot on a port whose link is down.

    Two questions, if the logs still have it:

    • In each of the five boots, was the first attempt entered or refused, and
      was cp2ap_wakeup high before it? CPIF refused 22 of your 25, where the
      7 Pro's eight were all entered. I wonder whether the later refusals are a
      consequence of this (a CP that can't be answered keeps the line up)
      rather than a second problem.
    • Did the doorbell failures start at the first link-up after the attempt,
      or only after a while? The 95 s tells me how long a check after a wake
      has to wait before it means anything.

    When #232 has been through review, a run of it on the palmtop would be very
    welcome: modem up, one attempt, then sitd's poll watched for two minutes,
    then a second attempt in the same boot (that is the case its third commit
    is for). Attended, on the charger, ending in a reboot, as #601 says, and
    with the modem stopped before the reboot. Until #232 is in the kernel a
    phone runs, nothing passes or goes round the modem's sleep inhibitor on
    either phone, and #556's switch stays off; I'll say so there.

    I'll keep this open until #232 is merged and a sleep attempt with the modem
    up has left the phone service working on both phones.

  2. W4HO-ham commented on Nov 11, 2026

    @W4HO-ham
    ContributorAuthor

    The journals of the five boots are still on the palmtop, so both questions have answers from the log (read today, nothing run). Times are seconds of uptime.

    The first attempt in each boot

    Boot (2026-11-09, MST) Kernel First attempt ap_wakeup_handler: cp2ap_wakeup work pending during it Root port's "D0 to D3hot, device inaccessible" First Can't set D0 state
    22:32 build #100, bring-up modules refused (-16) gpio_val : 1 yes 0.03 s after PM: suspend exit
    22:38 build #100 refused (-16) gpio_val : 0 no not after this attempt; 62 s later, after the third (below)
    22:43 build #100 refused (-16) gpio_val : 1 yes 0.05 s after exit
    22:51 build #100, screen-off request sent first refused (-16) gpio_val : 1 yes 0.04 s after exit
    23:08 the in-tree build entered, woke on cp2ap_wakeup after about 2 s gpio_val : 1 yes (0001:00:00.0 there) 0.04 s after exit

    The log has no reading of cp2ap_wakeup from before an attempt; the handler's line during it is the nearest thing, so that is what the column is. In the three seconds before each attempt the link went up about every 0.2 s, so the modem was busy each time.

    The 22:38 boot is the one that separates the cases, because its first two attempts did no harm:

    Attempt Uptime What happened Port's D3hot line Link afterwards
    1 115.7 refused, handler gpio_val : 0 (then systemd's second write, which failed on brcmfmac, #619) no working
    2 145.1 entered, woke after about 4 s on the PCIe interrupt, gpio_val : 0 no working
    3 177.8 entered, woke on cp2ap_wakeup, gpio_val : 1 yes Can't set D0 state 0.04 s after exit, 77 BME is not set lines from there
    4 to 6 207.8 on refused, twice each (not logged again) broken

    So in all five boots the failure begins at the first link-up after the attempt in which the root port logged "Unable to change power state from D0 to D3hot, device inaccessible", within 0.05 s of PM: suspend exit, and not before. An attempt without that line, refused or entered, left the link working. That fits your reading of #232: the damage is the PCI core's try at D3hot on a port whose link CPIF has down at that moment, and whether CPIF then refuses doesn't matter.

    Your first question, the later refusals. They do look like a consequence. Of the 22 refusals, 18 came after the link had broken, and after it broke no attempt was entered in any boot (3 of 3 cycles, 9 of 9, 4 of 4, 2 of 2). Three more are the first attempts of the 22:32, 22:43 and 22:51 boots, which are also the attempts that broke it. Only one refusal happened on a working link and left it working: the 22:38 boot's first. The three sleeps that were entered were all on a link that still worked when they started.

    Your second question, how long a check has to wait. The kernel's line is there at once (0.03 to 0.05 s). sitd's first SIM status poll failed: TimeoutError came 5 s after the breaking attempt's exit in two boots, and 19 s, 23 s and 31 s after it in the others. The 95 s I wrote was that same 22:38 boot counted from its first attempt (93 s), with the two harmless attempts in between, so it overstates it: about half a minute after the wake is long enough for sitd's poll to tell, and Can't set D0 state in the kernel log tells immediately.

    "Not tried on the 7 Pro" can come out, as you say. I'll hold the run of #232 until it has been through review and you ask for it: modem up, one attempt, sitd's poll watched for two minutes, a second attempt in the same boot, attended, on the charger, the modem stopped before the reboot, with the owner's yes for that run.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions