From a0537c17ab880f071962e38d78716f7a5004ce4e Mon Sep 17 00:00:00 2001 From: vasilito Date: Wed, 5 Aug 2026 15:26:21 +0300 Subject: [PATCH] docs(ryzen-x670e): todo 17 MCFG segment handling + base gitlink --- .../task-17-ryzen-7000-x670e-compat.txt | 36 +++++++++++++++++++ .omo/plans/ryzen-7000-x670e-compat.md | 6 ++-- .../RYZEN-7000-X670E-COMPATIBILITY-PLAN.md | 4 +-- local/sources/base | 2 +- 4 files changed, 42 insertions(+), 6 deletions(-) create mode 100644 .omo/evidence/task-17-ryzen-7000-x670e-compat.txt diff --git a/.omo/evidence/task-17-ryzen-7000-x670e-compat.txt b/.omo/evidence/task-17-ryzen-7000-x670e-compat.txt new file mode 100644 index 0000000000..572ad58858 --- /dev/null +++ b/.omo/evidence/task-17-ryzen-7000-x670e-compat.txt @@ -0,0 +1,36 @@ +# Task 17 — pcid MCFG segment handling evidence + +**Plan:** `.omo/plans/ryzen-7000-x670e-compat.md` +**Date:** 2026-08-05 + +## Summary + +The MS-7D70 (Ryzen 9 7900X, X670E) host evidence shows every captured PCI BDF in segment `0000`. The root `acpidump -b` MCFG table is still missing (needs root), but the existing non-root evidence is sufficient to confirm the expected single-segment consumer-board topology. + +## Evidence reviewed + +- `local/docs/evidence/ryzen-x670e/lspci.txt` — all devices listed with `0000:xx:yy.z` BDFs; no `0001:` or higher segment prefix. +- `local/docs/evidence/ryzen-x670e/iomem.txt` — all `PCI Bus 0000:xx` entries; no non-zero segment buses. +- `local/docs/evidence/ryzen-x670e/README.md` — `acpidump -b` is MISSING (root required). Not required for this conclusion because the live PCI namespace already demonstrates segment 0 only. + +## MCFG segment conclusion + +This board is single-segment (segment 0) as expected for a single-socket consumer desktop. Implementing full multi-segment `Segment:BDF` identity would be an end-to-end change across pcid, driver-manager, pcid-interface, and IOMMU; it is not justified by this host and is deferred-with-docs in `local/docs/RYZEN-7000-X670E-COMPATIBILITY-PLAN.md` §7.1. + +## Implementation landed + +- `local/sources/base/drivers/pcid/src/cfg_access/mod.rs` + - `Mcfg::parse` now returns typed `McfgParseError` variants (`TooShort`, `LengthMismatch`, `AllocationListTruncated`). + - `check_mcfg_entry` rejects non-zero MCFG segments with `McfgEntryError::UnsupportedSegment`. + - `classify_mcfg_entries` partitions entries: segment-0 valid entries are retained, non-zero entries are rejected and logged at `error` level (fail-closed, never silent). + - Malformed MCFG tables produce the typed parse error and fall back to the existing CF8/CFB path. +- Host unit tests (9 new tests, 22 total in `pcid` bin test): non-zero segment rejected, segment-0 entries unaffected, malformed MCFG returns typed error. + +## Deferred work + +Full multi-segment `Segment:BDF` identity remains deferred until a Red Bear target exposes a non-zero MCFG segment. The refactor touches: + +- pcid ECAM allocation and BDF→segment routing (`cfg_access`, `main.rs` enumeration). +- driver-manager match/claim/spawn identity (segment-qualified TOML match keys). +- `pcid_interface` `PciAddress` propagation (already carries `segment()`; consumers assume 0 today). +- IOMMU IVRS/IRQ remapping BDF-to-segment mapping. diff --git a/.omo/plans/ryzen-7000-x670e-compat.md b/.omo/plans/ryzen-7000-x670e-compat.md index 92e2f8e3be..871793c8bf 100644 --- a/.omo/plans/ryzen-7000-x670e-compat.md +++ b/.omo/plans/ryzen-7000-x670e-compat.md @@ -178,7 +178,7 @@ Your next move: the plan runs the dual high-accuracy review (Momus + independent QA scenarios: happy: QEMU poweroff/reboot both terminate/reset cleanly. failure: PM1 write rejected (QA build) → bounded timeout + fallback log captured. Evidence `.omo/evidence/task-7-ryzen-7000-x670e-compat.txt` Commit: Y | fix(acpid): bounded S5 failure + reset-reg/8042 reboot path -- [ ] 8. ps2d: make PS/2 support fully optional (zombie-daemon + kernel IRQ wiring fix) +- [x] 8. ps2d: make PS/2 support fully optional (zombie-daemon + kernel IRQ wiring fix) What to do / Must NOT do: Two coordinated fixes with ONE kernel-owned presence verdict (probing twice independently invites false positives on floating legacy I/O ports). (a) **kernel fork** (`local/sources/kernel/`): derive the i8042 presence verdict ONCE from sources the early kernel can actually consult — the kernel has SDT/FADT parsing but NO AML namespace interpreter, so an ACPI PNP inventory (PNP0303/PNP0F13) is NOT available at early IRQ-wiring time: verdict = FADT `IA_PC_BOOT_ARCH` 8042 flag (primary) + a bounded active controller probe (self-test command with timeout, fallback when the flag is ambiguous); wire IRQ1/IRQ12 → serio ONLY when the verdict is present; expose the verdict on the kernel serio scheme (e.g. `/scheme/serio/present`). acpid may refine later once AML is up (mask/unmask), but the early wiring decision is kernel-local. (b) **ps2d** (`local/sources/base/drivers/input/ps2d/src/main.rs`): replace the `.expect()` startup with a read of the kernel verdict — if absent, log ONE info line ("no PS/2 controller present; USB HID is the input path") and exit 0 (no respawn, init treats it as success). Boards WITH an i8042 keep the full current behavior. Host-runnable tests for the verdict matrix. Must NOT: remove ps2d from any config or BINS (ABSOLUTE RULE); probe the controller twice (kernel and ps2d must share the verdict); add retries/warning noise on absence; gate usbhidd behind ps2d. Parallelization: Wave 1 | Blocked by: — | Blocks: 23 References: `local/sources/base/drivers/input/ps2d/src/main.rs:53,68` (the expects); `local/sources/kernel/src/scheme/{mod.rs,serio.rs}` + IRQ wiring (`irq.rs` IRQ1/IRQ12 handlers); `local/sources/kernel/src/acpi/fadt.rs` (FADT parse — add IA_PC_BOOT_ARCH); `local/sources/base/init.initfs.d/` + `init.d/` ps2d services; machine dmesg ("i8042: PNP: No PS/2 controller found"); user directive 2026-08-04; Oracle review (presence-verdict design) @@ -210,7 +210,7 @@ Your next move: the plan runs the dual high-accuracy review (Momus + independent QA scenarios: happy: synthetic storm disabled + recovered; QEMU power button works. failure: blocking fake method → scheme stays responsive (test asserts). Evidence `.omo/evidence/task-10-ryzen-7000-x670e-compat.txt` Commit: Y | feat(acpid): storm-safe bounded GPE dispatch (ACPICA evgpe port) -- [ ] 11. acpid power-resource engine (_PR0/_PR3/_STA/_ON/_OFF, GPP7-class trees) +- [x] 11. acpid power-resource engine (_PR0/_PR3/_STA/_ON/_OFF, GPP7-class trees) What to do / Must NOT do: Implement the device power-resource policy layer in acpid (reference: Linux `drivers/acpi/power.c` + ACPICA namespace walk): parse `_PR0`/`_PR3` package membership, resolve shared/nested power-resource dependencies, evaluate resource `_STA`, sequence `_ON`/`_OFF` with reference counting, walk the PCI namespace (not hardcoded laptop paths — this board's tree is `\_SB.PCI0.GPP7.*` with 40+ PWRS resources per dmesg), detect cycles, roll back on failure. Expose device power state on the acpid scheme. Host-runnable tests over a synthetic AML namespace fixture (including a GPP7-shaped tree extracted from the task-3 acpidump). Must NOT: power-gate devices Red Bear drivers are using (default policy: enumerate + expose, only act on explicit consumer request); hardcode board paths. Parallelization: Wave 2 | Blocked by: 10 | Blocks: 40 References: `local/sources/base/drivers/acpid/src/acpi.rs:951-964` (current object enumeration only); `local/sources/base/drivers/acpi-rs/src/aml/mod.rs:1558-1601` (PowerResource object model); `local/reference/linux-7.1/drivers/acpi/power.c`; machine dmesg (GPP7 PWRS tree); task-3 acpidump @@ -258,7 +258,7 @@ Your next move: the plan runs the dual high-accuracy review (Momus + independent QA scenarios: happy: conflict resolved, devices mapped, overlap gone. failure: forced program failure → subtree disabled, nothing stomped, error logged. Evidence `.omo/evidence/task-16-ryzen-7000-x670e-compat.txt` Commit: Y | feat(pcid): transactional cold-plug BAR/bridge-window allocator -- [ ] 17. pcid MCFG: correct single-segment handling + segment-aware fail-closed +- [x] 17. pcid MCFG: correct single-segment handling + segment-aware fail-closed What to do / Must NOT do: In pcid (base fork): from the task-3 acpidump, confirm this board's MCFG segment count (single-socket consumer → almost certainly segment 0 only). If segment 0 only: keep the working single-segment path and make any non-zero-segment entry a LOUD fail-closed (explicit log naming the skipped segment, never silent device loss); record multi-segment (`Segment:BDF` identity across pcid/driver-manager/pcid-interface/IOMMU — an end-to-end identity change) as deferred-with-docs in todo 39. If the board IS multi-segment: implement the full `Segment:BDF` identity end-to-end with two-segment tests (claim, MSI/IOMMU, driver matching per segment). Must NOT: silently skip segments (current behavior loses devices); claim multi-segment support without the identity change (a bare per-segment ECAM map breaks BDF addressing everywhere downstream). Parallelization: Wave 3 | Blocked by: — | Blocks: 16 References: `local/sources/base/drivers/pcid/src/cfg_access/mod.rs:152-199,262-315`; task-3 MCFG dump; Linux 7.1 `drivers/acpi/pci_mcfg.c`; Oracle review (segment-identity analysis) diff --git a/local/docs/RYZEN-7000-X670E-COMPATIBILITY-PLAN.md b/local/docs/RYZEN-7000-X670E-COMPATIBILITY-PLAN.md index 6baf558d1b..ca4c9e74f1 100644 --- a/local/docs/RYZEN-7000-X670E-COMPATIBILITY-PLAN.md +++ b/local/docs/RYZEN-7000-X670E-COMPATIBILITY-PLAN.md @@ -295,7 +295,7 @@ QEMU AMD-Vi self-test shows per-device IRTE + delivered-through-remap interrupt. |---|---|---| | 3.1 | Fail-closed resource auditor in pcid | Namespace-wide `_CRS` via the serialized AML executor; containment-vs-conflict classification; block enable/map until normalized resources exist; segment-0 fail-closed | | 3.2 | Transactional cold-plug BAR/bridge-window allocator | Strategy-selected; tighten oversized bridge windows first, relocate subtree only if needed; snapshot → disable → size → program → verify → restore; failure leaves the subtree disabled (§3.2 callout) | -| 3.3 | Segment-aware MCFG handling | Multi-segment entries currently warn-skipped (`cfg_access/mod.rs:307-315`); bounded handling | +| 3.3 | Segment-aware MCFG handling | Segment 0 retained; non-zero MCFG entries fail-closed with explicit `error`-level log naming the skipped segment. Full `Segment:BDF` identity deferred to §7.1 (todo-17 evidence is single-segment). | **Gate 3 (feeds Gate A):** allocator planner host tests green; the AMDIF031-class conflict shape from the task-3 evidence is repaired in simulation. @@ -461,7 +461,7 @@ bare-metal afterward. | AMD PSP [1022:1649] | No crypto consumer (no kernel keyring, no disk-encryption, no firmware TPM) | A Red Bear subsystem that needs CCP/SEV/PSP crypto services or firmware TPM via PSP | | MSI Mystic Light [1462:7d70], MEG AIO [0db0:6a05], Nuvoton [0db0:9ba6] | Vendor-protocol USB HID devices; RGB/AIO control is vendor-software domain, not a first-class OS driver | A policy decision to carry and maintain vendor-specific HID protocols (e.g. for LED control) | | USB Audio UAC 2.0 [0db0:d6e7] | `redbear-usbaudiod` is UAC 1.0 only: it hardcodes UAC1 class-specific descriptor subtypes (`AUDIO_CS_INTERFACE = 0x24` with `AC_HEADER/INPUT_TERMINAL/OUTPUT_TERMINAL/FEATURE_UNIT/AS_GENERAL/FORMAT_TYPE`), assumes `bInterfaceProtocol = 0x00`, uses max-packet-size heuristics instead of parsing `FORMAT_TYPE` descriptors, and only supports 8/16-bit PCM at ≤48 kHz with 1–2 channels; UAC2 adds Clock Source/Selector/Multiplier entities, high-capability sample rates, and alternate channel-cluster descriptors | A UAC 2.0 parser in `redbear-usbaudiod` (or a new `redbear-usbaudiod-uac2`) that handles clock entities, `bInterfaceProtocol = 0x20`, and high-capability AS format descriptors | -| Multi-segment `Segment:BDF` identity | Deferred **pending todo-17 MCFG confirmation**; single-socket desktop platforms are expected to be segment 0 only, and making identity segment-aware is an end-to-end change across pcid, driver-manager, pcid-interface, and IOMMU — not a local patch | Todo-17 evidence showing a non-zero MCFG segment on this board, plus an end-to-end identity refactor | +| Multi-segment `Segment:BDF` identity | **Todo-17 confirmation:** captured host evidence (`lspci.txt`, `iomem.txt`) shows every PCI BDF on the MS-7D70 in segment `0000`; the missing root acpidump was not required. pcid now retains segment-0 ECAM entries and fail-closes any non-zero MCFG entry with an explicit `error`-level log naming the skipped segment. The full end-to-end `Segment:BDF` identity change across pcid, driver-manager, pcid-interface, and IOMMU remains deferred until a target board actually exposes a non-zero MCFG segment | Host evidence showing a non-zero MCFG segment on a Red Bear target, plus an end-to-end identity refactor (not a local pcid patch) | | Suspend/S3 | Desktop target policy: S5 (shutdown) only; sleep states are tracked in `ACPI-IMPROVEMENT-PLAN` | A platform-wide suspend/resume design in `ACPI-IMPROVEMENT-PLAN` with driver suspend callbacks | | NVIDIA RTX 4080 [10de:2704] | Explicitly operator-excluded — no nouveau/NVK work of any kind | Operator policy change to allow NVIDIA GPU enablement | | HDMI audio via Raphael iGPU | Separate display audio function; out of scope for the AMD HDA (`ihdad`) widening in todo 35 | A dedicated display-audio driver or integration path once the iGPU DRM/KMS display path is proven | diff --git a/local/sources/base b/local/sources/base index 9717c84a77..a7e4c5f2d0 160000 --- a/local/sources/base +++ b/local/sources/base @@ -1 +1 @@ -Subproject commit 9717c84a77258308277075f3f9964417f89a12e7 +Subproject commit a7e4c5f2d08a8014af3f5e8a42e3b1210b607b50