Skip to content

Stop pci_runtime_pm defaulting to dpv1 devices and surface skipped holds#48

Merged
timkpaine merged 1 commit into
mainfrom
tkp/dau-utils-pm-fix
Jul 19, 2026
Merged

Stop pci_runtime_pm defaulting to dpv1 devices and surface skipped holds#48
timkpaine merged 1 commit into
mainfrom
tkp/dau-utils-pm-fix

Conversation

@timkpaine

Copy link
Copy Markdown
Member

What

dau_utils/pci_runtime_pm.py baked dpv1/Xilinx board identity into a generic host-op utility and defaulted discovery to those patterns whenever the CLI got no --pattern. It also silently skipped writes to absent sysfs paths and still returned success, so a caller could believe PM was held after zero holds landed.

  • Remove DEFAULT_DEVICE_PATTERNS; discover_pci_devices now defaults to () (no patterns -> no devices matched). The dpv1 authoritative pattern set stays only in dau-build's platform config.
  • main with neither --device nor --pattern now matches nothing and returns 0, without shelling out to lspci. This aligns with dau-build's contract that an empty runtime_pm_patterns produces zero holds (a hold with no --pattern is a successful no-op).
  • apply_runtime_pm_writes drops the redundant and write.path.parent.exists() check. main now prints a stderr line per skipped write and exits nonzero with an applied N of M runtime PM writes count when fewer holds are applied than planned.

Notes

dau-build already passes --pattern explicitly per pattern, and the recovery bash scripts use their own lspci discovery, so no consumer relied on the removed default.

Tests cover explicit-pattern discovery, empty discovery, the no-pattern no-op, all-missing and partial (1-of-2) skip diagnostics with nonzero exit, and successful writes, using a tmp_path fake sysfs. pytest dau_utils/tests green (25 passed); ruff check + format clean.

Discovery now matches nothing when no --pattern is given instead of
falling back to the baked-in dpv1/Xilinx identifiers, aligning with
dau-build's contract that an empty runtime_pm_patterns means no holds.

apply now reports each skipped write to stderr and main exits nonzero
with an N-of-M count when fewer holds are applied than planned, so a
caller can no longer believe PM is held after zero writes landed.

Signed-off-by: Tim Paine <3105306+timkpaine@users.noreply.github.com>
@timkpaine
timkpaine merged commit 9074a67 into main Jul 19, 2026
1 check passed
@timkpaine
timkpaine deleted the tkp/dau-utils-pm-fix branch July 19, 2026 15:05
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.

1 participant