[FEATURE] Retain assigned PCI resources through platform takeover #145

Open
opened 2026-11-13 16:45:39 +01:00 by erikinkinen · 0 comments
Owner

Problem and motivation

DeviceFrame derivation needs an original physical-resource source as well as configuration permission. BAR addresses, probes and root-bridge windows describe resources; they do not transfer an allocation.

Proposed behavior and scope

Retain actual firmware-assigned PCI resources across successful native platform takeover. UEFI transfers platform resource management at ExitBootServices. Bootloader captures the actual function/parent associations, root-bridge scopes and fixed allocations before that transition; Kernel admits their original source only through its one-shot native handover.

Coordinate a separate Handoff extension for root bridges, translated windows, function ancestry and assigned BARs. Preserve CPU and PCI address domains, exact byte lengths, provider translation conventions, logical UEFI BAR numbers and actual configuration-word slots. UEFI PCI bus protocols define those distinct descriptions.

Capture and live-protocol confirmation finish before the first ExitBootServices attempt. Retain the immutable assignment ledger through exit retries; invoke no UEFI/PCI protocol after that first attempt. Kernel then confirms fixed identity, BARs and bridge routing through its genuine original controller after takeover, before publishing resource issuers. A changed assignment closes PCI admission rather than importing replacement geometry. Volatile/W1C status is not mistaken for immutable assignment state.

Firmware driver-model children may flatten physical bridges. Retain actual root-protocol child usage and corroborate physical ancestors with the original bridge routing and device paths. Keep both checked address spans and raw translation provenance; unresolved translation closes that resource.

The initial wire has no GOP source association. Retain VGA assignment data and independent framebuffer custody, but deny overlapping BAR loans without failing unrelated normal boot.

Retain every assigned extent of a logical BAR, including multiple firmware descriptors and split parent windows. A BAR occupation groups those exact extents; it does not replace them with a hull. Mapping requests need compatible coverage for every exposed byte.

Keep the legacy (base, size) and sequential mapping interface only where complete affine coverage proves that representation. Add an explicit BAR-relative extent query and offset-based mapping surface for sparse or non-affine groups, with coordinated Kernel, IPC and native-service consumers in separate feature branches. Queries return descriptions; only the retained grant and mapping duties authorize access. Device offsets are relative to the original configuration BAR's PCI base, independently of CPU addresses.

The initial policy preserves assigned resources. Relocation, reset, removal and bridge rerouting require a separate withdrawal/reassignment protocol. DeviceFrame grants do not confer configuration rights or establish DMA isolation.

Authority, security and reliability

The source is the genuine platform takeover, scoped by retained original assignments. Safe decoding cannot create it. Configuration-only discovery cannot derive physical resources. Original issuers, device/ancestor occupations, independent grants, aliases and native mappings retain their respective duties through revocation and uncertain cleanup.

Exclude RAM, runtime images, tables, stacks, startup scratch, APIC and other original resources. Shared framebuffer ownership requires an actual same-origin child relationship. Page rounding must not expose neighboring bytes. Live loans and unresolved DMA obligations prevent invalidating configuration effects or reassignment; command readback and CPU TLB clearance cannot prove DMA quiescent.

Acceptance criteria

  • Capture original assigned resources and real parent associations in Bootloader; retain them through successful takeover.
  • Validate the coordinated wire, translation domains, logical/config BAR association and conflict ledger without creating authority from metadata.
  • Confirm fixed assignments through the original native controller after takeover without later protocol calls or geometry imports.
  • Bind the one-shot native source to explicit issuer endpoints and retained device/ancestor occupations.
  • Retain independent grant, alias, mapping and lineage duties through local deletion, source revocation and retryable physical withdrawal.
  • Refuse out-of-scope resources, unsafe writes, unsupported controllers, ambiguous ownership and exposure beyond granted bytes without effects.
  • Implement the explicit BAR-relative query/mapping protocol and migrate native service consumers without packing holes or manufacturing contiguous geometry.
  • Demonstrate multiple BARs, nonidentity translation, mapping lifetime, revocation, failed cleanup and configuration refusal on the matching image.

Alternatives and tradeoffs

Fixed assignments preserve the original allocation. General relocation needs actual parent allocation authority, complete alias withdrawal and device-specific DMA quiescence. Deriving ownership from configuration observations would lose that distinction.

Tracking and rollout

Part of #11 and a prerequisite for #141. Land the agreed Handoff contract, actual Bootloader producer and Kernel source intake together before opening native loan construction. Link companion PRs as they become available. Replace coordinate-only DeviceFrame bindings with retained original loans.

## Problem and motivation DeviceFrame derivation needs an original physical-resource source as well as configuration permission. BAR addresses, probes and root-bridge windows describe resources; they do not transfer an allocation. ## Proposed behavior and scope Retain actual firmware-assigned PCI resources across successful native platform takeover. UEFI transfers platform resource management at [ExitBootServices](https://uefi.org/specs/UEFI/2.10/07_Services_Boot_Services.html). Bootloader captures the actual function/parent associations, root-bridge scopes and fixed allocations before that transition; Kernel admits their original source only through its one-shot native handover. Coordinate a separate Handoff extension for root bridges, translated windows, function ancestry and assigned BARs. Preserve CPU and PCI address domains, exact byte lengths, provider translation conventions, logical UEFI BAR numbers and actual configuration-word slots. [UEFI PCI bus protocols](https://uefi.org/specs/UEFI/2.10/14_Protocols_PCI_Bus_Support.html) define those distinct descriptions. Capture and live-protocol confirmation finish before the first ExitBootServices attempt. Retain the immutable assignment ledger through exit retries; invoke no UEFI/PCI protocol after that first attempt. Kernel then confirms fixed identity, BARs and bridge routing through its genuine original controller after takeover, before publishing resource issuers. A changed assignment closes PCI admission rather than importing replacement geometry. Volatile/W1C status is not mistaken for immutable assignment state. Firmware driver-model children may flatten physical bridges. Retain actual root-protocol child usage and corroborate physical ancestors with the original bridge routing and device paths. Keep both checked address spans and raw translation provenance; unresolved translation closes that resource. The initial wire has no GOP source association. Retain VGA assignment data and independent framebuffer custody, but deny overlapping BAR loans without failing unrelated normal boot. Retain every assigned extent of a logical BAR, including multiple firmware descriptors and split parent windows. A BAR occupation groups those exact extents; it does not replace them with a hull. Mapping requests need compatible coverage for every exposed byte. Keep the legacy `(base, size)` and sequential mapping interface only where complete affine coverage proves that representation. Add an explicit BAR-relative extent query and offset-based mapping surface for sparse or non-affine groups, with coordinated Kernel, IPC and native-service consumers in separate feature branches. Queries return descriptions; only the retained grant and mapping duties authorize access. Device offsets are relative to the original configuration BAR's PCI base, independently of CPU addresses. The initial policy preserves assigned resources. Relocation, reset, removal and bridge rerouting require a separate withdrawal/reassignment protocol. DeviceFrame grants do not confer configuration rights or establish DMA isolation. ## Authority, security and reliability The source is the genuine platform takeover, scoped by retained original assignments. Safe decoding cannot create it. Configuration-only discovery cannot derive physical resources. Original issuers, device/ancestor occupations, independent grants, aliases and native mappings retain their respective duties through revocation and uncertain cleanup. Exclude RAM, runtime images, tables, stacks, startup scratch, APIC and other original resources. Shared framebuffer ownership requires an actual same-origin child relationship. Page rounding must not expose neighboring bytes. Live loans and unresolved DMA obligations prevent invalidating configuration effects or reassignment; command readback and CPU TLB clearance cannot prove DMA quiescent. ## Acceptance criteria - [ ] Capture original assigned resources and real parent associations in Bootloader; retain them through successful takeover. - [ ] Validate the coordinated wire, translation domains, logical/config BAR association and conflict ledger without creating authority from metadata. - [ ] Confirm fixed assignments through the original native controller after takeover without later protocol calls or geometry imports. - [ ] Bind the one-shot native source to explicit issuer endpoints and retained device/ancestor occupations. - [ ] Retain independent grant, alias, mapping and lineage duties through local deletion, source revocation and retryable physical withdrawal. - [ ] Refuse out-of-scope resources, unsafe writes, unsupported controllers, ambiguous ownership and exposure beyond granted bytes without effects. - [ ] Implement the explicit BAR-relative query/mapping protocol and migrate native service consumers without packing holes or manufacturing contiguous geometry. - [ ] Demonstrate multiple BARs, nonidentity translation, mapping lifetime, revocation, failed cleanup and configuration refusal on the matching image. ## Alternatives and tradeoffs Fixed assignments preserve the original allocation. General relocation needs actual parent allocation authority, complete alias withdrawal and device-specific DMA quiescence. Deriving ownership from configuration observations would lose that distinction. ## Tracking and rollout Part of #11 and a prerequisite for #141. Land the agreed Handoff contract, actual Bootloader producer and Kernel source intake together before opening native loan construction. Link companion PRs as they become available. Replace coordinate-only DeviceFrame bindings with retained original loans.
erikinkinen added this to the Alpha 1 milestone 2026-11-13 16:45:39 +01:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
erix/kernel#145
No description provided.