Conversation
Co-authored-by: Copilot <copilot@github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Refactors the kernel PCIe stack to improve ECAM host-bridge probing, bus enumeration, and resource/BAR allocation (aimed at restoring PCIe availability on RISC-V), and updates QEMU platform configs accordingly.
Changes:
- Split PCIe “domain” concerns into dedicated modules (resources/apertures/interrupt routing) and updated host-bridge probing to populate them from DT properties.
- Reworked PCIe bridge/bus enumeration and introduced an explicit resource-allocation stage (
alloc_resources) for BAR/aperture programming. - Updated PCIe remap registry semantics (store
Weak<IoRemap>) and modernized ECAM/address-type utilities and docs.
Reviewed changes
Copilot reviewed 22 out of 22 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
| conf/platforms/qemu-virt-rv64.toml | Adds commented QEMU PCIe virtio-blk configuration snippets. |
| conf/platforms/qemu-virt-la64.toml | Adjusts rootfs block device path to vdb. |
| anemone-kernel/src/driver/virtio/pcie.rs | Updates PCI function identifier type and endpoint matching. |
| anemone-kernel/src/driver/pcie_drivers/platform.rs | Refactors generic ECAM host-bridge probe to build a PcieDomain from DT ranges/interrupt-map. |
| anemone-kernel/src/driver/pcie_drivers/mod.rs | Adds module docs and fixes module ordering. |
| anemone-kernel/src/driver/pcie_drivers/bus.rs | Major rewrite of bridge driver: enumeration, resource allocation, and teardown logic. |
| anemone-kernel/src/device/mod.rs | Enhances device listing output with device-kind labeling. |
| anemone-kernel/src/device/bus/pcie/remap.rs | Changes remap registry to store Weak<IoRemap> and lazily purge expired entries. |
| anemone-kernel/src/device/bus/pcie/mod.rs | Exposes new domain module and renames class-code constants. |
| anemone-kernel/src/device/bus/pcie/fwnode.rs | Updates interrupt-info type imports and adds docs. |
| anemone-kernel/src/device/bus/pcie/ecam.rs | Adds richer typed helpers/iterators and more ECAM/config-space documentation. |
| anemone-kernel/src/device/bus/pcie/driver.rs | Introduces BAR probing/allocation + default alloc_resources hook in PcieDriver. |
| anemone-kernel/src/device/bus/pcie/domain/resources.rs | New PCIe domain resource manager (bus numbers, apertures, IRQ routing). |
| anemone-kernel/src/device/bus/pcie/domain/mod.rs | New domain module wrapper and domain ID type. |
| anemone-kernel/src/device/bus/pcie/domain/intr.rs | New interrupt routing table with mask-based matching. |
| anemone-kernel/src/device/bus/pcie/domain/aperture.rs | New aperture allocators + AvailableApertures selection for BAR allocation. |
| anemone-kernel/src/device/bus/pcie/domain.rs | Removes the previous monolithic domain implementation (replaced by modules above). |
| anemone-kernel/src/device/bus/pcie/device.rs | Refactors PCIe device types (bus vs endpoint+subbus) and adds BAR bookkeeping. |
| anemone-kernel/src/device/bus/pcie/bus.rs | Reworks bus registration flow to run preinit → alloc_resources → postinit → probe. |
| anemone-kernel/src/device/bus/pcie/addr.rs | Renames PCI function address type and improves formatting/docs. |
| anemone-kernel/crates/range-allocator/src/lib.rs | Changes aligned allocation preconditions (currently breaks zero-align behavior). |
| anemone-kernel/crates/range-allocator/src/increasing.rs | Adds free_size and adjusts alignment validation (currently breaks zero-align tests). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
doruche
approved these changes
Apr 29, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Refactored the PCIe driver to fix the issue of PCIe being unavailable on RISC-V.
AI Usage Status
AI is used in generating docs.