Skip to content

pci_core: make 64bit BARs prefetchable#3775

Open
shenw0000 wants to merge 2 commits into
microsoft:mainfrom
shenw0000:bug_fix_cxl_rp_use_64bit_pref_bar
Open

pci_core: make 64bit BARs prefetchable#3775
shenw0000 wants to merge 2 commits into
microsoft:mainfrom
shenw0000:bug_fix_cxl_rp_use_64bit_pref_bar

Conversation

@shenw0000

Copy link
Copy Markdown
Contributor

Boot configuration only places 64bit BARs in the MMIO high if the BAR is also marked as prefetchable. Mark all emulated 64bit BARs prefetchable.

Copilot AI review requested due to automatic review settings June 18, 2026 19:10
@shenw0000 shenw0000 requested a review from a team as a code owner June 18, 2026 19:10

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 prefetchable when constructing config-space BAR masks.
  • Preserves BAR attribute bits (64-bit + prefetchable) when the guest writes BAR values.

Comment thread vm/devices/pci/pci_core/src/cfg_space_emu.rs
Comment thread vm/devices/pci/pci_core/src/cfg_space_emu.rs Outdated
@jstarks jstarks changed the title Bug fix: make 64bit BARs prefetchable pci_core: make 64bit BARs prefetchable Jun 18, 2026
Comment thread vm/devices/pci/pci_core/src/cfg_space_emu.rs Outdated
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())

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants