← Back to Pull requests

P1.7: PCI(e) enumeration through the MCFG ECAM window #101

Closed
unknown closed this pull request without merging on Sep 28, 2026 00:05 UTC
View on GitHub
unknown unknown commented on Sep 27, 2026 23:57 UTC
Author

Summary

Plan task P1.7, the last of Phase 1: PCI(e) is enumerated through the ECAM window the MCFG (P1.6) describes, and the virtio devices show up by name.

Design


  • platform::pci::enumerate(&summary.ecam) walks each ECAM region: bus 0 first, then the secondary buses of any PCI-to-PCI bridge (header type 1, register 0x19), devices 0–31, functions 0–7 when the header's multi-function bit is set.

  • Each candidate function's 4 KiB configuration page (base + (bus << 20 | dev << 15 | fn << 12)) is mapped into a single scratch slot at KERNEL_MMIO_BASE + 4 MiB, its header read, and the page unmapped again, so enumeration needs no permanent mappings however many buses the MCFG advertises; drivers map their own device page later from the recorded config_phys. Configuration space is device memory, so the MMIO path is the right one here (unlike the ACPI tables in #98). Secondary buses are followed only inside the region's bus range.

  • Per function it records segment, bus/device/function, vendor, device, class/subclass/prog-if, header type and the config page's physical address; PciDevice::virtio_name names virtio-net/blk/rng/console/9p by device id (legacy and modern ids).

  • Boot log (q35):

  •   pci: 7 function(s) found via ECAM
      pci: 0000:00:00.0 8086:29c0 class 06.00.00
      pci: 0000:00:01.0 1234:1111 class 03.00.00
      pci: 0000:00:02.0 1af4:1001 class 01.00.00 virtio-blk
      pci: 0000:00:03.0 1af4:1000 class 02.00.00 virtio-net
      pci: 0000:00:1f.0 8086:2918 class 06.01.00
      pci: 0000:00:1f.2 8086:2922 class 01.06.01
      pci: 0000:00:1f.3 8086:2930 class 0c.05.00
      

    The uefi and bios smoke scenarios now require virtio-blk and virtio-net in the output.
  • Drivers (P4) will consume pci::devices(); interrupt routing waits for the I/O APIC work in P2.8.
  • Tests (AC: boot log lists virtio-blk and virtio-net devices)


  • pci_enumeration_finds_virtio_blk_and_net: at least one function, the q35 Intel host bridge at 00:00.0, both virtio devices present, and their class codes agree with their names (mass storage 01, network 02).
  • Verification


    test summary:
      PASS  host unit tests: passed
      PASS  in-kernel tests (QEMU): chisel-test: 15 passed; 0 failed
      PASS  boot smoke (UEFI, BIOS, panic, double fault, page fault, stack overflow, OOM): 7 scenarios passed
    perf: all budgets met (kernel 106.3 KiB, ISO 3.89 MiB, boot 2316 ms)
    

    fmt, clippy (host + kernel), docs-gate clean. PLAN §11: P1.7 done, Phase 1 complete.

    Also fixes the ACPI test assertion message from #100 (lists the parsed table signatures instead of a count).

    Closes #53
    Closes #100
    task: P1.7

    🤖 Generated with Claude Code

    Diff: 336 lines (+252 / -84) across 4 files Reviewer: garrickdabbs Review duration: 7m
    All Vouch review confidence checks passed
    Residual risk 0.20 = Change Risk (0.42) × (1 − Review Confidence (0.54)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.42 · 336 lines diff across 4 files
    0.42
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 87% · Reviewer familiarity: 35%
    53%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.348
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #101"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 53.7% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 42.2% (MEDIUM) · Higher = larger blast radius
    42.2%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 53.7% · Lower = rushed or shallow review
    53.7%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 19.6% · Safe to merge
    19.6%