Skip to content
Closed
Show file tree
Hide file tree
Changes from 25 commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
7988310
rtkit: wait for a stopped coprocessor's CPU_STATUS.STOPPED, not a fix…
RyanTheTide Nov 19, 2026
b70791e
kboot: refuse a trial payload whose watchdog U-Boot would take over
RyanTheTide Nov 19, 2026
713cf92
kboot: disable the T6040/T6041 AOP when its firmware segments are not…
RyanTheTide Nov 19, 2026
360177e
sptm_virt: call AURA_TRAP_DELAY_NS a diagnostic and record what it found
RyanTheTide Nov 19, 2026
d2c3686
usb_cdc: wait for the HPM firmware after the cold reset
RyanTheTide Nov 19, 2026
717b862
tps6598x: wait for the firmware after the debugusb reset
RyanTheTide Nov 19, 2026
72978d6
usb_cdc: name the schedule flags and the recovery budget
RyanTheTide Nov 19, 2026
5a4e6d5
usb: name the ATC USB2 PHY and PIPE register fields in the CDC paths
RyanTheTide Nov 19, 2026
decc58c
j813_n1: release the N1 through the ADT function-reset helper
RyanTheTide Nov 19, 2026
1930234
pcie: name the endpoint reset waits and poll config readiness
RyanTheTide Nov 19, 2026
1bf7d2f
pcie: take the N1's PERST# pad and refclk time from the ADT on J813
RyanTheTide Nov 19, 2026
14a1521
pcie, j813_n1: describe the steps, not macOS driver names, in comments
RyanTheTide Nov 19, 2026
5aa1f7f
pcie: stop the ANS power-off if a PHY clock does not drop
RyanTheTide Nov 19, 2026
f2a6f90
j873: poll for the eUSB2 PHY's UTMI clock and name its settle times
RyanTheTide Nov 19, 2026
37d6e76
kboot: remove a speaker amp group's configuration when its DT update …
RyanTheTide Nov 19, 2026
364b9d9
tests: build the T6030 display host test against today's kboot_atc.c
RyanTheTide Nov 19, 2026
f292cfe
ci: run the host tests that need no files from a Mac
RyanTheTide Nov 19, 2026
4a3d9dd
dptx-phy: T8152: fail activation when calibration does not complete
RyanTheTide Nov 19, 2026
d4e77e9
dcp: name the T8152 ATC and dptx-phy settle delays
RyanTheTide Nov 19, 2026
40803bd
dcp: dptx-port: name the IOReturn codes and the virtual device call
RyanTheTide Nov 19, 2026
517eefe
dcp: describe the T8152 ATC steps without driver-internal names
RyanTheTide Nov 19, 2026
c88906d
tests: give the PCIe sequence harness pcie.h's constants and the time…
RyanTheTide Nov 19, 2026
e6295e1
usb_cdc: keep the flag mask out of the aligned flag block
RyanTheTide Nov 19, 2026
570a76a
pcie: print the config address as unsigned long
RyanTheTide Nov 19, 2026
f0f6868
ci: install qemu-user for the host tests
RyanTheTide Nov 19, 2026
e668b43
tps6598x: fail the reset wait when the controller rejects Gaid
RyanTheTide Nov 21, 2026
c648d29
pcie: cap the ADT's perst-to-config at the 1 s reset-ready bound
RyanTheTide Nov 21, 2026
0d5dca0
kboot: AOP: disable a failed handoff in place when the DT is full
RyanTheTide Nov 21, 2026
50c21b0
pcie: wrap the perst-to-config comments at 100 columns
RyanTheTide Nov 21, 2026
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
23 changes: 23 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,29 @@ jobs:
CC: ${{ matrix.compiler == 'llvm' && 'clang' || 'gcc' }}
run: tests/run-t8122-gpu26-identity.sh

- name: Install host test tools
if: matrix.os == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get install --no-install-recommends -y device-tree-compiler qemu-user

# The host tests of tests/run-*.sh that need no files from a Mac
- name: Run host tests
if: matrix.os == 'ubuntu-latest'
env:
CC: ${{ matrix.compiler == 'llvm' && 'clang' || 'gcc' }}
run: |
for t in kboot-audio logo payload-profile t6030-display t8122-air-pmp t8122-full-start \
t8122-gpu-diagnostics; do
echo "::group::run-$t"
sh "tests/run-$t.sh"
echo "::endgroup::"
done

- name: Run the M3 start.S move gate under qemu
if: matrix.os == 'ubuntu-latest' && matrix.compiler == 'llvm'
run: PATH="$(llvm-config --prefix)/bin:$PATH" sh tests/run-m3-move-gate.sh

arm64-native:
name: Pytest (ubuntu-24.04-arm, native start.S)
runs-on: ubuntu-24.04-arm
Expand Down
2 changes: 1 addition & 1 deletion proxyclient/tools/run_guest_sptm.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
AURA_KEEP_ANE keep /arm-io/ane and dart-ane (the exclaves' manifests name its mappers)
AURA_KEEP_WIFI keep the kernelcache workaround's PCIe/Wi-Fi/Bluetooth nodes (not the
debug port's): WindowServer waits on TimeSync, which needs a network port
AURA_TRAP_DELAY_NS=<n> spin n ns in every GL trap (workaround: holds off the ~20 s stall)
AURA_TRAP_DELAY_NS=<n> spin n ns in every GL trap (diagnostic: delays the ~20 s stall)
AURA_TRAP_DELAY_MASK=<m> which GL traps spin: 1 GEXIT, 2 g-ERET, 4 IMPDEF, 8 SPTM's entry
sysreg read, 16 HVC, 32 rest, 64 other sysregs
AURA_SYSREG_CENSUS print which sysregs the guarded world traps on, every 20 s
Expand Down
6 changes: 6 additions & 0 deletions src/asc.c
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,12 @@ bool asc_cpu_running(asc_dev_t *asc)
return read32(asc->cpu_base + ASC_CPU_CONTROL) & ASC_CPU_CONTROL_START;
}

/* The coprocessor's CPU has halted (in its idle loop, or after asc_cpu_stop()). */
bool asc_cpu_stopped(asc_dev_t *asc)
{
return read32(asc->cpu_base + ASC_CPU_STATUS) & ASC_CPU_STATUS_STOPPED;
}

/* The mailbox's receive side (I2A) on or off, as macOS sets it around an IOP's power loss. */
void asc_i2a_enable(asc_dev_t *asc, bool on)
{
Expand Down
1 change: 1 addition & 0 deletions src/asc.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ bool asc_is_v8(asc_dev_t *asc);
void asc_cpu_start(asc_dev_t *asc);
void asc_cpu_stop(asc_dev_t *asc);
bool asc_cpu_running(asc_dev_t *asc);
bool asc_cpu_stopped(asc_dev_t *asc);
bool asc_cpu_idle(asc_dev_t *asc);
void asc_i2a_enable(asc_dev_t *asc, bool on);
u32 asc_cpu_status(asc_dev_t *asc);
Expand Down
88 changes: 53 additions & 35 deletions src/dcp/atc_phy.c
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* SPDX-License-Identifier: GPL-2.0-only */
/* T8152 ATC common/AUX initialization, derived from the matching 26A428
* driver and qualified incrementally on J873g. DP lanes and crossbar clocks
* are separate stages; common initialization alone does not establish a link. */
/* T8152 ATC common/AUX initialization, qualified incrementally on J873g.
* DP lanes and crossbar clocks are separate stages; common initialization
* alone does not establish a link. */
#include "atc_phy.h"
#include "dptx_phy.h"
#include "malloc.h"
Expand All @@ -18,9 +18,28 @@
#define ATC_XBAR 0x74000
#define ATC_TIMEOUT 10000
#define ATC_ALT_MODE_TIMEOUT 2000000
#define ATC_ALT_MODE_POLL_MS 50
#define ATC_SAVED_MAX 192
#define ATC_PSD58 0x303a13a00ULL

/* Gap between consecutive PHY control steps that have no status bit: lane
* clamp, power and isolation fields in AON 0x1e18/0x1e1c, the PMA clock and
* AUX sleep requests in AON 0x24, the CFG clock, reset and sleep controls,
* and the crossbar enable writes ahead of their acknowledgement polls. Steps
* that do report completion are polled instead (CFG status, crossbar acks,
* PSD). */
#define ATC_STEP_DELAY_US 1

/* Settle time after the DPTX enable in 0x2040 is withdrawn, before the
* transmitter control bits in 0x2000 are cleared. No status bit is known. */
#define ATC_DPTX_DISABLE_SETTLE_US 5

/* Wait after the DCP0 -> DFP0 route is configured, before the DCP continues
* link training. The route start already polls every crossbar acknowledgement;
* what this additionally waits for is not known. Kept as qualified on J873g
* (tracking: aura#344). */
#define ATC_ROUTE_SETTLE_MS 5

struct atc_saved {
u32 offset;
u32 value;
Expand Down Expand Up @@ -51,7 +70,7 @@ struct atc_tunable {
bool optional;
};

/* _sRegisters table indices 4, 8, 2, 82, 6, 5, 78 respectively. */
/* The ADT tunables applied by the common initialization, in order. */
static const struct atc_tunable tunables[] = {
{"tunable_ACIOPHY_CMN_DFLT", 0x800, 0x6c, false},
{"tunable_CIOPLL_CORE_DFLT", 0x1600, 0x280, false},
Expand Down Expand Up @@ -307,7 +326,7 @@ atc_phy_t *atc_phy_init(const char *path)
(data_status & TPS6598X_DATA_DP_CONNECTION)) ||
timeout_expired(deadline))
break;
mdelay(50);
mdelay(ATC_ALT_MODE_POLL_MS);
}
tps6598x_shutdown(tps);
spmi_shutdown(spmi);
Expand Down Expand Up @@ -382,7 +401,7 @@ static int atc_route_stop(atc_phy_t *phy)
if (atc_update(phy, ATC_XBAR + 0x3c, 1, 0) || atc_update(phy, ATC_XBAR, 1, 0) ||
atc_update(phy, ATC_XBAR + 0xc, 1, 0) || atc_update(phy, ATC_XBAR + 0x24, 0x100, 0))
return -1;
udelay(1);
udelay(ATC_STEP_DELAY_US);
if (poll32(phy->base + ATC_XBAR + 0x800, 1, 0, ATC_TIMEOUT) ||
poll32(phy->base + ATC_XBAR + 0x808, 1, 0, ATC_TIMEOUT) ||
poll32(phy->base + ATC_XBAR + 0x81c, 0x100, 0, ATC_TIMEOUT)) {
Expand All @@ -395,8 +414,8 @@ static int atc_route_stop(atc_phy_t *phy)
return -1;
for (unsigned int i = phy->saved_count; i > 0; i--) {
struct atc_saved *s = &phy->saved[i - 1];
/* This output latch ignores an ordinary clear. The matching driver's
* teardown leaves it set; it is not a reversible configuration field. */
/* This output latch ignores an ordinary clear and stays set after
* teardown; it is not a reversible configuration field. */
if (s->offset == ATC_XBAR + 0x4c) {
s->mask = 0;
continue;
Expand Down Expand Up @@ -426,7 +445,7 @@ static int atc_route_start(atc_phy_t *phy)
atc_update(phy, ATC_XBAR + 0x44, 0x00000f00, 0) || atc_update(phy, ATC_XBAR + 4, 1, 0) ||
atc_update(phy, ATC_XBAR + 0x1c, 1, 0) || atc_update(phy, ATC_XBAR + 0x34, 0x100, 0))
goto fail;
udelay(1);
udelay(ATC_STEP_DELAY_US);
if (poll32(base + 0x804, 1, 0, ATC_TIMEOUT) || poll32(base + 0x818, 1, 0, ATC_TIMEOUT) ||
poll32(base + 0x82c, 0x100, 0, ATC_TIMEOUT)) {
printf("ATC3: crossbar reset acknowledgement timeout\n");
Expand Down Expand Up @@ -459,7 +478,7 @@ static int atc_dp_stop(atc_phy_t *phy)
}
if (atc_update(phy, 0x2040, BIT(16), 0))
return -1;
udelay(5);
udelay(ATC_DPTX_DISABLE_SETTLE_US);
if (atc_update(phy, 0x2000, BIT(15), 0) || atc_update(phy, 0x2000, BIT(13), 0) ||
atc_update(phy, 0x2000, BIT(14), 0) || atc_update(phy, 0x2000, BIT(2), 0) ||
atc_update(phy, 0x2000, BIT(3), BIT(3)) || atc_update(phy, 0xe10, BIT(2), BIT(2)) ||
Expand All @@ -482,20 +501,20 @@ static int atc_dp_stop(atc_phy_t *phy)
for (unsigned int i = 0; i < ARRAY_SIZE(requests); i++)
if (atc_update(phy, ATC_AON + 0x24, requests[i], 0))
return -1;
udelay(1);
udelay(ATC_STEP_DELAY_US);
for (u32 offset = 0x1e18; offset <= 0x1e1c; offset += 4) {
if (atc_update(phy, offset, BIT(5), 0))
return -1;
udelay(1);
udelay(ATC_STEP_DELAY_US);
if (atc_update(phy, offset, BIT(0), BIT(0)))
return -1;
udelay(1);
udelay(ATC_STEP_DELAY_US);
if (atc_update(phy, offset, BIT(2), 0))
return -1;
udelay(1);
udelay(ATC_STEP_DELAY_US);
if (atc_update(phy, offset, BIT(1), 0))
return -1;
udelay(1);
udelay(ATC_STEP_DELAY_US);
}
phy->dp_started = false;
phy->link_rate = 0;
Expand All @@ -513,7 +532,7 @@ int atc_phy_set_route(atc_phy_t *phy, bool enable)
return -1;
int ret = atc_route_start(phy);
if (!ret)
mdelay(5);
mdelay(ATC_ROUTE_SETTLE_MS);
return ret;
}

Expand All @@ -530,16 +549,16 @@ int atc_phy_deactivate(atc_phy_t *phy)
if (phy->aux_started) {
u64 aux = phy->base + ATC_AON + 0x24;
set32(aux, BIT(10));
udelay(1);
udelay(ATC_STEP_DELAY_US);
clear32(aux, BIT(6));
udelay(1);
udelay(ATC_STEP_DELAY_US);
clear32(aux, BIT(8));
udelay(1);
udelay(ATC_STEP_DELAY_US);
phy->aux_started = false;
}
/* Assert main reset before restoring volatile setup. */
clear32(cfg, BIT(4));
udelay(1);
udelay(ATC_STEP_DELAY_US);
while (phy->saved_count) {
struct atc_saved *s = &phy->saved[--phy->saved_count];
if (atc_restore(phy, s))
Expand Down Expand Up @@ -585,22 +604,22 @@ int atc_phy_activate(atc_phy_t *phy)
goto fail;
phy->started = true;
set32(cfg + 0x30, BIT(0));
udelay(1);
udelay(ATC_STEP_DELAY_US);
set32(cfg, BIT(0));
if (poll32(cfg + 4, BIT(0), BIT(0), ATC_TIMEOUT))
goto fail;
set32(cfg, BIT(1));
if (poll32(cfg + 4, BIT(1), BIT(1), ATC_TIMEOUT))
goto fail;
clear32(cfg, BIT(2));
udelay(1);
udelay(ATC_STEP_DELAY_US);
set32(cfg, BIT(3));

for (unsigned int i = 0; i < 2; i++)
if (atc_tunable_check(phy, i, true))
goto fail;
/* aciophy_xbar_config(mode=3): both PMAs carry DisplayPort. This is the
* PHY's lane mapping, not the DCP-to-ATC display crossbar. */
/* PHY lane mapping: both PMAs carry DisplayPort. This is not the
* DCP-to-ATC display crossbar. */
if (atc_update(phy, 0x4c, 0x1f, 0x14) ||
atc_update(phy, 0x4c, 0x3ffe0, phy->swap ? 0x100 : 0x22000))
goto fail;
Expand All @@ -612,17 +631,17 @@ int atc_phy_activate(atc_phy_t *phy)
set32(cfg, BIT(4));
if ((read32(cfg) & 0x1f) != 0x1b)
goto fail;
/* aciophy_aux_init: release small/big sleep, then AUX clamp. */
/* AUX init: release small/big sleep, then AUX clamp. */
phy->aux_started = true;
if (atc_update(phy, ATC_AON + 0x24, BIT(8), BIT(8)))
goto fail;
udelay(1);
udelay(ATC_STEP_DELAY_US);
if (atc_update(phy, ATC_AON + 0x24, BIT(6), BIT(6)))
goto fail;
udelay(1);
udelay(ATC_STEP_DELAY_US);
if (atc_update(phy, ATC_AON + 0x24, BIT(10), 0))
goto fail;
udelay(1);
udelay(ATC_STEP_DELAY_US);
phy->active = true;
printf("ATC3: common PHY and AUX initialized, %u registers saved\n", phy->saved_count);
return 0;
Expand Down Expand Up @@ -696,24 +715,23 @@ int atc_phy_set_link_rate(atc_phy_t *phy, u32 rate)
for (u32 i = 0; i < 2; i++) {
if (atc_update(phy, ATC_AON + 0x24, BIT(12 + 2 * i), BIT(12 + 2 * i)))
goto fail;
udelay(1);
udelay(ATC_STEP_DELAY_US);
if (atc_update(phy, ATC_AON + 0x24, BIT(16 + 2 * i), BIT(16 + 2 * i)))
goto fail;
udelay(1);
udelay(ATC_STEP_DELAY_US);
u32 offset = 0x1e18 + 4 * i;
if (atc_update(phy, offset, BIT(1), BIT(1)))
goto fail;
udelay(1);
udelay(ATC_STEP_DELAY_US);
if (atc_update(phy, offset, BIT(2), BIT(2)))
goto fail;
udelay(1);
udelay(ATC_STEP_DELAY_US);
if (atc_update(phy, offset, BIT(0), 0))
goto fail;
udelay(1);
udelay(ATC_STEP_DELAY_US);
if (atc_update(phy, offset, BIT(5), BIT(5)))
goto fail;
udelay(1);
udelay(1);
udelay(ATC_STEP_DELAY_US);
}
if (atc_update(phy, 0x2000, 0x380000, r << 19))
goto fail;
Expand Down
Loading
Loading