pci_core: make 64bit BARs prefetchable#3775
Open
shenw0000 wants to merge 2 commits into
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR aims to ensure emulated 64-bit PCI BARs are treated as prefetchable so platform/firmware BAR placement will put them into the MMIO-high region, and updates BAR write handling to preserve BAR attribute bits.
Changes:
- Marks 64-bit BAR masks as
prefetchablewhen constructing config-space BAR masks. - Preserves BAR attribute bits (64-bit + prefetchable) when the guest writes BAR values.
jstarks
reviewed
Jun 18, 2026
| bar_value = cfg_space::BarEncodingBits::from_bits(bar_value) | ||
| .with_type_64_bit(true) | ||
| .with_type_64_bit(attrs.type_64_bit()) | ||
| .with_prefetchable(attrs.prefetchable()) |
Contributor
There was a problem hiding this comment.
I agree that 64bit bars don't have to start on an even index, but won't this new logic accidentally interpret the upper 32-bits of the 64bit BAR as encoding bits?
Contributor
There was a problem hiding this comment.
ie. if there's a 64bit BAR spanning BAR indices 1 and 2, I think it'll interpret the 4 least significant bits of BAR2 as encoding bits, but isn't that wrong because it's an upper-BAR?
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.
Boot configuration only places 64bit BARs in the MMIO high if the BAR is also marked as prefetchable. Mark all emulated 64bit BARs prefetchable.