[FEATURE] Retain assigned PCI resources through platform takeover #145
Labels
No labels
alpha-1
bug
ci
docs
duplicate
enhancement
help wanted
invalid
performance
phase-6
question
refactor
security
wontfix
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
erix/kernel#145
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
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
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.