Skip to content

Preserve the parent-derived PCI bus when inspecting bridges - #1235

Open
Clowdyffs wants to merge 1 commit into
open-acpica:masterfrom
Clowdyffs:fix/pci-parent-derived-bus
Open

Clowdyffs wants to merge 1 commit into
open-acpica:masterfrom
Clowdyffs:fix/pci-parent-derived-bus

Conversation

@Clowdyffs

@Clowdyffs Clowdyffs commented Sep 20, 2026 •

Copy link
Copy Markdown

Found this bug while diagnosing various resume/firmware issues on my 2017 Macbook Pro. Some addresses can be overwritten with the incorrect address on resume. Fixing this issue speeds up resume by 3,779× on this hardware, since it tries to recover for ~7 seconds when given the "bad" address.

Below this line is ai-written

A PCI_Config operation region first used while a PCI bridge is powering up can be initialized before the bridge's bus-number registers have been restored. AcpiHwGetPciDeviceInfo() has already derived the bridge's bus from its parent, but overwrites that bus with the bridge's Primary Bus Number. When that register still contains zero, subsequent accesses target the wrong PCI device and the wrong address is retained in the operation-region context.

This patch preserves the parent-derived bus and removes the redundant primary-bus read. It fixes a traced resume failure on Apple MacBookPro14,1 and removes approximately 6.94 seconds of firmware retry time in the measured comparison.

Observed failure and why it needs fixing

The affected hardware is a 2017 13-inch MacBook Pro, two Thunderbolt 3 ports, no Touch Bar (DMI MacBookPro14,1), Intel x86-64, with firmware 451.120.7.0.0 and the Intel Alpine Ridge Thunderbolt hierarchy. The instrumented hardware comparison used Linux 7.2.3-arch1-3, with an otherwise matching local kernel carrying the equivalent ACPICA change. The machine now runs Omarchy's packaged linux-omarchy 7.2.5-3; the new package name is not the kernel used for those earlier timing measurements.

During the first affected resume-path region initialization, the PCI reads were:

RP05 00:1c.4: header type 0x81, primary bus 0, secondary bus 4
UPSB 04:00.0: header type 1, primary bus 0
              PciId->Bus is overwritten with 0
Next secondary-bus read: 00:00.0, rather than 04:00.0
Region derivation returns AE_OK with address 00:00.0

UPSB.A1E0 and UPSB.H530 consequently retained 00:00.0 instead of 04:00.0. Two DSB0 regions, A1E2 and A1E1, exhibited the same overwrite, losing the already-derived bus 5. Later regions could derive correctly after their ancestors had been restored, so inspecting only the final PCI topology misses the problem.

The H530 mailbox reads then went to the host bridge at 00:00.0. The capture recorded 150,120 command-register reads at offset 0x530, returning all ones; mailbox data accesses at 0x538 also used the wrong device. The traced accessor calls include writes to those unintended mailbox offsets as well. No resulting host-bridge corruption or exploit has been established.

Leaving this unchanged retains a demonstrated incorrect PCI address, including misdirected configuration accesses and exhausted firmware retries. The region initialization reports success, so ordinary error handling does not discard that wrong context. Fixing the derivation lets the original firmware operations complete against their intended bridge.

Why removing the read is sufficient

The helper already knows the current bridge's bus from the parent's secondary-bus number (or the initial root-bus value). It uses that address to read the bridge's header before it reaches the deleted code. On a normally configured hierarchy, the bridge's primary-bus value agrees with the address already derived; assigning it again provides no additional location information.

During this resume sequence, Linux can enter ACPI power-up before PCI state restoration. The primary register can therefore still hold its reset value while configuration reads already reach the bridge. Keeping the derived address also makes the following secondary-bus read use the correct bridge.

The change preserves bridge-type detection, secondary-bus reads, and their error handling. It adds no waits, allocations, model-specific bus numbers or changes to firmware retry limits. It removes one configuration read per bridge during derivation. There is no new performance work in this path; the compatibility question is whether some other platform depends on the overwritten value despite already having derived an address.

This code entered shared ACPICA in 08fd52445bf4, replacing OS-specific AcpiOsDerivePciId implementations, and entered Linux in 95abccb576c4. The history does not document a special reason to overwrite the parent-derived bus. Please flag any historical platform dependency that should be considered.

Measured result

Measurement Baseline Equivalent corrected Linux kernel
Combined duration of the three affected CRMW firmware sequences 6.939 seconds 1.836 milliseconds
UPSB region addresses 00:00.0 04:00.0
DSB0 region addresses 00:00.0 05:00.0
CIOR mailbox operations in the corrected capture — All six succeeded without exhausting retries

That is 6.937 seconds saved, approximately 99.97% less time (about 3,779× shorter duration) for those three firmware sequences. These are timings from the captured comparison, not a statistical benchmark or a claim that the entire system resumes 3,779× faster.

The timing comparison used automatic-return pm_test=platform, with the same temporary Thunderbolt LC-sleep-skip diagnostic in both baseline and corrected runs to keep a separate controller-loss problem from obscuring the measurement. This comparison did not enter actual sleep. The full diagnostic transition included its intentional five-second pause; the table reports only the measured firmware sequences. Subsequent combined real-sleep tests also completed, but they are not used to calculate the speedup above.

A same-boot control with the corrected kernel and original Thunderbolt driver still reproduced controller loss and its long recovery timeout, while the corrected firmware operations stayed fast. Thus this patch fixes the address/retry defect; it does not claim to solve that separate controller fault, intermittent Wi-Fi loss, lid-wake delivery or sleep power consumption.

Validation and universality limits

  • Applied to ACPICA base 98bbab7dbae0ff7941c4cf08d46f5d30978f809e; only source/components/hardware/hwpci.c changes (6 insertions, 11 deletions).
  • Built acpiexec and acpisrc, including the modified hardware component, without compiler warnings or errors. The code is byte-identical to the native correction corresponding to the earlier hardware-validated Linux patch.
  • Compiled the actual before/after helpers with -std=c11 -O2 -Wall -Wextra -Werror. 15 topology fixtures pass in both native ACPICA and current Linux form: the original two captured reset-primary failures, six original comparison cases, and seven additional nonzero-root-bus/CardBus cases. Four fixtures exercise the correction; eleven retain their original results.
  • The Linux-form diff applies without fuzz to mainline 518e5b794c06c0f0eb40df3e202274a66202c137 and passes strict checkpatch (the separate Linux-form draft was checked with --no-signoff; the submitted ACPICA commit carries the human submitter's sign-off). The introducing commit IDs/titles were verified against their respective repositories.

Hardware evidence is limited to this one MacBookPro14,1. The extra root-bus/CardBus cases are simulations, not tests on those physical devices. ACPICA serves other platforms and operating systems, and this is a generic helper change, so the local results cannot establish universal compatibility. No full ACPICA test-suite pass, cross-OS testing, or hardware validation of a newly built current-mainline Linux kernel is claimed. Maintainer review and wider testing are requested, particularly for any platform relying on the old overwrite. The patch also cannot reconstruct a downstream bus number if the ancestor's secondary-bus register itself is unavailable or incorrect.

Assistance and reproducer

OpenAI Codex assisted with source/history analysis, preparation of the patch and replay harness, and interpretation of local hardware traces during investigation of slow resume on this Mac. The human submitter has added the DCO sign-off; Assisted-by: LLM is included. No maintainer endorsement is implied.

The standalone reproducer below extracts the actual helper from each supplied C source. It stubs only the ACPI/PCI interfaces and performs no live hardware access. The reset-secondary values in leaf fixtures are assumptions; the observed defect is the captured primary-zero overwrite. The nonzero-root-bus and CardBus fixtures are synthetic regression checks.

From a checkout of the PR branch, save the script below as /tmp/replay-pci-expanded.py, then run:

git show 98bbab7dbae0ff7941c4cf08d46f5d30978f809e:source/components/hardware/hwpci.c > /tmp/hwpci-before.c
python3 /tmp/replay-pci-expanded.py /tmp/hwpci-before.c source/components/hardware/hwpci.c

Expected: "passed": true, "case_count": 15, and no compiler warnings. The output includes source hashes and the before/after address/status for every fixture.

Standalone 15-case actual-C replay (Python 3 and a C compiler)
#!/usr/bin/env python3
# SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0-only
"""Compile unchanged hwpci helpers against captured topology fixtures.

Usage: python replay-pci-expanded.py BEFORE_HWPci.c AFTER_HWPci.c
Accepts either native ACPICA or Linux style; stubs only ACPI/PCI interfaces.
No hardware access. Reset-secondary values in the leaf fixtures are assumed;
the captured defect is the observed primary-zero overwrite.
"""
import hashlib
import json
from pathlib import Path
import subprocess
import sys
import tempfile

PREAMBLE = r"""
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
typedef uint8_t u8;
typedef uint16_t u16;
typedef uint64_t u64;
typedef int acpi_status;
typedef int acpi_object_type;
struct node { unsigned address; int type; };
typedef struct node *acpi_handle;
struct acpi_pci_id { u16 segment, bus, device, function; };
#define AE_OK 0
#define TRUE 1
#define FALSE 0
#define ACPI_FAILURE(s) ((s) != AE_OK)
#define ACPI_TYPE_DEVICE 6
#define METHOD_NAME__ADR "_ADR"
#define ACPI_LODWORD(v) ((uint32_t)(v))
#define ACPI_HIWORD(v) ((uint16_t)((v)>>16))
#define ACPI_LOWORD(v) ((uint16_t)(v))
#define PCI_CFG_HEADER_TYPE_REG 0x0e
#define PCI_CFG_PRIMARY_BUS_NUMBER_REG 0x18
#define PCI_CFG_SECONDARY_BUS_NUMBER_REG 0x19
#define PCI_HEADER_TYPE_MASK 0x7f
#define PCI_TYPE_BRIDGE 1
#define PCI_TYPE_CARDBUS_BRIDGE 2
struct slot { int bus,dev,fn,header,primary,secondary; };
static struct slot slots[8];
static unsigned reads_to_host;
static acpi_status acpi_get_type(acpi_handle n,acpi_object_type *type)
{ *type=n->type; return AE_OK; }
static acpi_status acpi_ut_evaluate_numeric_object(const char *name,acpi_handle n,u64 *value)
{ (void)name; *value=n->address; return AE_OK; }
static acpi_status acpi_os_read_pci_configuration(struct acpi_pci_id *id,unsigned reg,u64 *value,unsigned width)
{
  (void)width;
  if (id->bus==0 && id->device==0 && id->function==0) ++reads_to_host;
  *value=0xffffffff;
  for (unsigned i=0;i<sizeof(slots)/sizeof(slots[0]);i++) {
    struct slot *s=&slots[i];
    if (s->bus!=id->bus || s->dev!=id->device || s->fn!=id->function) continue;
    if (reg==0x0e) *value=s->header;
    else if (reg==0x18) *value=s->primary;
    else if (reg==0x19) *value=s->secondary;
    return AE_OK;
  }
  return AE_OK;
}
"""

MAIN = r"""
int main(void) {
  struct node rp05={0x001c0004,6}, upsb={0,6}, dsb0={0,6}, nhi={0,6}, dsb2={0x00020000,6}, usb={0,6};
  struct node rp09={0x001d0000,6}, wifi={0,6}, scope={0,0};
  struct testcase { const char *name; struct node *nodes[5]; int count,up_reset,down_reset; } tests[]={
    {"root_port",{&rp05},1,0,0},
    {"restored_upstream",{&rp05,&upsb},2,0,0},
    {"captured_UPSB_primary_zero",{&rp05,&upsb},2,1,0},
    {"captured_DSB0_primary_zero",{&rp05,&upsb,&dsb0},3,0,1},
    {"NHI_endpoint",{&rp05,&upsb,&dsb0,&nhi},4,0,0},
    {"USB_endpoint",{&rp05,&upsb,&dsb2,&usb},4,0,0},
    {"WiFi_endpoint",{&rp09,&wifi},2,0,0},
    {"nondevice_namespace_scope",{&rp05,&scope,&upsb},3,0,0},
    {"nonzero_root_port",{&rp05},1,0,0},
    {"nonzero_root_upstream",{&rp05,&upsb},2,0,0},
    {"nonzero_root_endpoint",{&rp05,&upsb,&dsb0,&nhi},4,0,0},
    {"nonzero_root_primary_zero",{&rp05},1,0,0},
    {"cardbus_bridge",{&rp05,&upsb},2,0,0},
    {"cardbus_endpoint",{&rp05,&upsb,&nhi},3,0,0},
    {"cardbus_primary_zero",{&rp05,&upsb},2,1,0}
  };
  for(unsigned t=0;t<sizeof(tests)/sizeof(tests[0]);t++) {
    struct testcase *test=&tests[t];
    struct slot base[]={ {0,0,0,0,0,0},{0,28,4,0x81,0,4},
      {4,0,0,1,test->up_reset?0:4,test->up_reset?0:5},
      {5,0,0,1,test->down_reset?0:5,test->down_reset?0:6},
      {6,0,0,0,0,0},{5,2,0,1,5,7},{7,0,0,0,0,0},{0,29,0,0x81,0,2} };
    for(unsigned i=0;i<8;i++)slots[i]=base[i];
    u16 root_bus = 0;
    if (t >= 8 && t <= 11) {
      root_bus = 32;
      for (unsigned i=1;i<8;i++) {
        slots[i].bus += root_bus;
        if ((slots[i].header & 0x7f) == PCI_TYPE_BRIDGE) {
          slots[i].primary += root_bus;
          slots[i].secondary += root_bus;
        }
      }
      if (t == 11) slots[1].primary = 0;
    }
    if (t >= 12) {
      slots[2].header = 0x82; /* Multifunction CardBus bridge */
      /* The endpoint directly follows this bridge on its secondary bus. */
      slots[3].header = 0;
    }
    /* Missing Wi-Fi endpoint header returns ff; it must not alter its bus. */
    struct acpi_pci_id id={0}; id.bus=root_bus; u16 bus_number=root_bus; u8 is_bridge=TRUE; int status=0; reads_to_host=0;
    for(int i=0;i<test->count;i++) {
      status=acpi_hw_get_pci_device_info(&id,test->nodes[i],&bus_number,&is_bridge);
      if(status)break;
    }
    printf("%s %u %u %u %d %u\n",test->name,id.bus,id.device,id.function,status,reads_to_host);
  }
  return 0;
}
"""

ALIASES = r"""
typedef acpi_status ACPI_STATUS;
typedef acpi_handle ACPI_HANDLE;
typedef acpi_object_type ACPI_OBJECT_TYPE;
typedef struct acpi_pci_id ACPI_PCI_ID;
typedef u8 BOOLEAN;
typedef u16 UINT16;
typedef u64 UINT64;
#define Bus bus
#define Device device
#define Function function
#define AcpiGetType acpi_get_type
#define AcpiUtEvaluateNumericObject acpi_ut_evaluate_numeric_object
#define AcpiOsReadPciConfiguration acpi_os_read_pci_configuration
#define acpi_hw_get_pci_device_info AcpiHwGetPciDeviceInfo
"""

EXPECTED = {'root_port': (0, 28, 4),
 'restored_upstream': (4, 0, 0),
 'captured_UPSB_primary_zero': (4, 0, 0),
 'captured_DSB0_primary_zero': (5, 0, 0),
 'NHI_endpoint': (6, 0, 0),
 'USB_endpoint': (7, 0, 0),
 'WiFi_endpoint': (2, 0, 0),
 'nondevice_namespace_scope': (4, 0, 0),
 'nonzero_root_port': (32, 28, 4),
 'nonzero_root_upstream': (36, 0, 0),
 'nonzero_root_endpoint': (38, 0, 0),
 'nonzero_root_primary_zero': (32, 28, 4),
 'cardbus_bridge': (4, 0, 0),
 'cardbus_endpoint': (5, 0, 0),
 'cardbus_primary_zero': (4, 0, 0)}

FIXED_CASES = {'captured_UPSB_primary_zero', 'captured_DSB0_primary_zero',
               'nonzero_root_primary_zero', 'cardbus_primary_zero'}


def run(path, directory, label):
    source = path.read_text()
    native = 'AcpiHwGetPciDeviceInfo (' in source
    marker = ('static ACPI_STATUS\nAcpiHwGetPciDeviceInfo (' if native else
              'static acpi_status\nacpi_hw_get_pci_device_info(')
    if not native and marker not in source:
        marker = 'static acpi_status\nacpi_hw_get_pci_device_info ('
    start = source.rfind(marker)
    if start < 0:
        raise ValueError('Cannot locate actual hwpci helper')
    helper = source[start:]
    cfile = directory / (label + '.c')
    binary = directory / label
    cfile.write_text(PREAMBLE + (ALIASES if native else '') + helper + MAIN)
    build = subprocess.run(['cc', '-std=c11', '-O2', '-Wall', '-Wextra', '-Werror',
                            str(cfile), '-o', str(binary)],
                           text=True, capture_output=True, check=True)
    output = subprocess.check_output([str(binary)], text=True)
    rows = {}
    for line in output.splitlines():
        name, bus, device, function, status, host_reads = line.split()
        rows[name] = dict(zip(['bus', 'device', 'function', 'status', 'host_reads'],
                             map(int, [bus, device, function, status, host_reads])))
    return {'sha256': hashlib.sha256(source.encode()).hexdigest(),
            'compiler_stderr': build.stderr, 'cases': rows}


if __name__ == '__main__':
    if len(sys.argv) != 3:
        raise SystemExit(__doc__)
    with tempfile.TemporaryDirectory() as temporary:
        directory = Path(temporary)
        before = run(Path(sys.argv[1]), directory, 'before')
        after = run(Path(sys.argv[2]), directory, 'after')
    for name, address in EXPECTED.items():
        old, new = before['cases'][name], after['cases'][name]
        assert tuple(new[k] for k in ['bus', 'device', 'function']) == address, (name, new)
        assert new['status'] == 0 and new['host_reads'] == 0, (name, new)
        if name in FIXED_CASES:
            assert old['bus'] == 0, (name, old)
            if name != 'nonzero_root_primary_zero':
                assert old['host_reads'] > 0, (name, old)
        else:
            assert old == new, (name, old, new)
    print(json.dumps({'passed': True, 'case_count': len(EXPECTED),
                      'before': before, 'after': after}, indent=2))

A PCI_Config operation region first used during a bridge's ACPI power-up
can be initialized before the PCI core restores that bridge's bus-number
registers. AcpiHwGetPciDeviceInfo() has already located the bridge using
its parent's secondary bus. Reading a zero Primary Bus Number and
assigning it to PciId->Bus then misdirects the following secondary-bus
read and caches the wrong region address.

On MacBookPro14,1, first-resume tracing records UPSB at 04:00.0 with
header type 1 and primary bus 0. Region derivation returns 00:00.0
successfully. The H530 region then directs 150,120 mailbox polls to the
host bridge; three exhausted firmware retry sequences cost about seven
seconds. Two downstream-bridge regions show the same address loss.

Keep the address already derived from the parent and remove the
unnecessary primary-bus read. The secondary-bus read then uses that same
correct bridge address. This changes neither the PCI power sequence nor
firmware retry limits.

Hardware validation on MacBookPro14,1 confirms correct PCI region
addresses and successful mailbox access: the three firmware retry
sequences fell from 6.939 seconds to 1.836 milliseconds. A replay of the
actual C helper also corrects two captured reset-primary cases and
preserves six comparison cases.

A separate Thunderbolt controller power-transition failure still occurs
with this correction. This change fixes PCI region address derivation.

Fixes: 08fd524 ("Obsolete the AcpiOsDerivePciId OSL interface.")
Assisted-by: LLM
Signed-off-by: clowdyffs <alex@clowdydev.com>
kkkingqz added a commit to kkkingqz/wsconfig that referenced this pull request Oct 1, 2026
…d of ~23 s

ACPICA derives a PCI_Config region address once, on first access, from
the bridge Primary Bus Number. The UPSB regions of both Titan Ridge
controllers were first touched inside the first resume, while Primary
Bus was still 0, so they stayed cached at the host bridge 00:00.0 and
the firmware _PS0 mailbox polls timed out (~20 s per resume).
ws-tb-acpi-seed.service reads one field of every region via the ACPI
debugger after boot, before the first suspend (open-acpica/acpica#1235).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@aldervale

Copy link
Copy Markdown

Additional hardware evidence from MacBookPro13,3 (2016 15-inch, Alpine Ridge) using a built kernel with this correction.

I applied the Linux-form carry from omarchy-pkgs #544 at 4d81f4f8ad65b14f94a1f7e21d98b52a21e2e184, which carries this PR's 615f1b568156cf6a58040839f4ade773d8da7cf9, to my existing linux-omarchy 7.2.5-3 recipe. The resulting separate kernel is 7.2.5-3-omarchy-acpi-trial. Feature configuration and the existing sleep workaround were retained; the recorded bindgen tool version differs. Kernel/headers and the installed DKMS modules built successfully, and the 15-case C reproducer passed. This is not a build of #544's exact newer package recipes or BORE variant.

Before: an entry kprobe/histogram observed 200,160 matching 32-bit ACPI PCI reads at segment 0, register 0x530, all to 00:00.0, with no histogram drops. The firmware mailbox regions belong to the Thunderbolt upstream bridges at 04:00.0 and 7a:00.0. Their resume callbacks took 8.883304 and 8.768498 seconds; total noirq resume was 17.859020 seconds. Visible wake was consistently about 17–18 seconds. This supports the wrong-address polling diagnosis; the trace did not capture first-use region derivation.

After: three attended lid-sleep recoveries passed across two boots of the patched kernel. I observed about one second to illumination in the first, and nearly immediate wake in the second; the third passed without a numerical timing. The last two included 15 minutes asleep on battery. Touch Bar/Fn and controller bindings recovered. I have not captured corrected PCI addresses or new per-bridge timing, so the before/after latency comparison is an owner observation, not an instrumented benchmark.

These are undocked s2idle results with the existing EC lid-wake and Thunderbolt unload/reload workaround retained. T1Bridge PR #47 was present on both sides of the kernel comparison. This patch alone has not been shown to solve controller loss, and severe battery depletion remains a separate unresolved problem.

Public evidence and test boundaries. Thank you for the fix; this adds a tested 13,3 to the hardware evidence.

@patattzel

Copy link
Copy Markdown

Additional hardware evidence for this correction from a MacBookPro14,3 (2017 15-inch, two Alpine Ridge domains), using the Linux-form carry in omacom/omarchy-pkgs#544 built into a separate 7.2.15-2-macbook143 kernel, not a live probe equivalent.

A read-only inspection of selected initialized ACPICA PCI operation-region contexts before/after the platform transition found:

  • Before correction: all eight initialized selected regions cached 0000:00:00.0.
  • With correction: all eight matched their actual bridge topology: two regions each at 0000:04:00.0, 0000:05:00.0, 0000:7a:00.0, and 0000:7b:00.0.
  • Six additional selected regions stayed uninitialized; no claim about their cached addresses.

Comparable serialized pm_test=platform measurements reduced the separately measured noirq device-resume phase from 18449.478 ms to 1143.967 ms. These were automatic-return platform tests, not real sleep. An early pending wake skipped the corrected run's artificial five-second pause, so whole-transition durations must not be compared as equal-pause tests. No per-region access/polling counts were collected here.

The parent-derived-bus correction was carried unchanged from omacom/omarchy-pkgs#544 at 4d81f4f8ad65b14f94a1f7e21d98b52a21e2e184; zero-fuzz/offset application and the actual-C 15-case replay with ASan/UBSan passed. Running-BTF-validated metadata inspection used read-only access and model/kernel/boot guards; no AML evaluation or kernel-memory dump is being published.

Both sides retained the necessary Thunderbolt host protection from omacom/omarchy-pkgs#596. Separate EC/T1 issues are required for actual lid sleep on this machine, so this does not claim a complete suspend fix or universal compatibility.

The fuller comparison and its limitations are recorded in the accompanying hardware comment on omacom/omarchy-pkgs#544.

Prepared with AI assistance from local test records. This is Linux hardware-validation evidence, not a new test of the native ACPICA tools or this PR's packaging.

emirb added a commit to omacom/omarchy-pkgs that referenced this pull request Dec 2, 2026
A MacBookPro16,1 takes 28.5 seconds to wake from deep sleep, the median
of 10 on the charger. Its two Thunderbolt bridges spend 6.6 seconds
each in resume.

ACPICA builds the bridges' PCI config address from the primary bus
register. That register reads 0 before the PCI core restores it, so
the firmware's mailbox polls go to the host bridge and time out.

Carry the ACPICA fix from open-acpica/acpica#1235, which keeps the bus
found from the parent. Each bridge then resumes in 0.44 seconds, the
mean of 10, and the wake takes 10.5 seconds, the median of 10 on
battery.

Co-authored-by: clowdyffs <alex@clowdydev.com>
emirb added a commit to omacom/omarchy-pkgs that referenced this pull request Dec 2, 2026
A MacBookPro16,1 takes 28.5 seconds to wake from deep sleep, the median
of 10 sleeps on the charger. In the 9 of those wakes that logged it,
its two Thunderbolt bridges took a median 6.66 and 6.61 seconds each
to resume.

ACPICA builds the bridges' PCI config address from the primary bus
register. That register reads 0 before the PCI core restores it, so
the firmware's mailbox polls go to the host bridge and time out.

Carry the ACPICA fix from open-acpica/acpica#1235, which keeps the bus
found from the parent. In 10 sleeps on battery, each bridge then
resumes in a median 0.44 seconds, and the wake takes 10.5 seconds.

Co-authored-by: clowdyffs <alex@clowdydev.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants