Skip to content

vpci: add the ability to defer write results to configuration space#3207

Open
mfrohlich-msft wants to merge 4 commits intomicrosoft:mainfrom
mfrohlich-msft:vpci_deferred_write
Open

vpci: add the ability to defer write results to configuration space#3207
mfrohlich-msft wants to merge 4 commits intomicrosoft:mainfrom
mfrohlich-msft:vpci_deferred_write

Conversation

@mfrohlich-msft
Copy link
Copy Markdown
Contributor

@mfrohlich-msft mfrohlich-msft commented Apr 6, 2026

Currently, vpci bus mmio writes do not allow deferral of pci config space writes because an unwrap() call will panic on the deferred access.

This change allows emulated configuration space accesses for VPCI devices to defer their configuration space write requests to be completed asynchronously. If multiple chunked accesses result in deferred writes, collects the tasks and polls them to completion in a separate deferred task returned to the vmotherboard.

This retains the same expectation that all deferred writes must return IoResult::Ok or it panics.

@mfrohlich-msft mfrohlich-msft requested a review from a team as a code owner April 6, 2026 21:28
Copilot AI review requested due to automatic review settings April 6, 2026 21:28
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

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 updates the VPCI bus MMIO config-space write path to support devices that return deferred completion for PCI config writes, by aggregating multiple deferred write tokens into a single deferred operation that vmotherboard can poll to completion.

Changes:

  • Teach VpciBusDevice::mmio_write to handle IoResult::Defer from pci_cfg_write instead of panicking.
  • Add a VmTaskDriver spawner to VpciBusDevice and spawn a task to await multiple deferred write tokens, completing an outer deferred write token.
  • Add futures and pal_async dependencies to support polling and spawning.

Reviewed changes

Copilot reviewed 2 out of 3 changed files in this pull request and generated 4 comments.

File Description
vm/devices/pci/vpci/src/bus.rs Collect deferred config-write tokens and return a combined deferred write to the motherboard, driven by a spawned task.
vm/devices/pci/vpci/Cargo.toml Add futures and pal_async dependencies required by the new deferred-write combiner.

Copilot AI review requested due to automatic review settings April 6, 2026 21:43
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 3 out of 4 changed files in this pull request and generated 4 comments.

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.

2 participants