Skip to content

virt_kvm: add aarch64 irqfd routing#3419

Open
jstarks wants to merge 1 commit intomicrosoft:mainfrom
jstarks:kvm_irqfd
Open

virt_kvm: add aarch64 irqfd routing#3419
jstarks wants to merge 1 commit intomicrosoft:mainfrom
jstarks:kvm_irqfd

Conversation

@jstarks
Copy link
Copy Markdown
Member

@jstarks jstarks commented May 2, 2026

Move irqfd route construction behind an architecture-specific builder so the shared KVM GSI and irqfd lifetime code can be used outside x86 MSI routing.

x86 keeps using the existing MSI translation path, now rejecting invalid MSI addresses before installing routes. aarch64 partitions with a GICv2m frame can now expose irqfd support by translating valid SETSPI messages into irqchip routes.

Move irqfd route construction behind an architecture-specific builder so the shared KVM GSI and irqfd lifetime code can be used outside x86 MSI routing.

x86 keeps using the existing MSI translation path, now rejecting invalid MSI addresses before installing routes. aarch64 partitions with a GICv2m frame can now expose irqfd support by translating valid SETSPI messages into irqchip routes.
Copilot AI review requested due to automatic review settings May 2, 2026 20:24
@jstarks jstarks requested a review from a team as a code owner May 2, 2026 20:24
@github-actions github-actions Bot added the unsafe Related to unsafe code label May 2, 2026
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 2, 2026

⚠️ Unsafe Code Detected

This PR modifies files containing unsafe Rust code. Extra scrutiny is required during review.

For more on why we check whole files, instead of just diffs, check out the Rustonomicon

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 extends the KVM backend’s irqfd support beyond x86 by moving GSI/irqfd route construction behind an architecture-specific builder, enabling aarch64 guests with a GICv2m MSI frame to translate SETSPI messages into irqchip routes.

Changes:

  • Generalize KVM GSI/irqfd routing so both x86 (MSI routing) and aarch64 (GICv2m SETSPI → irqchip routing) can share the same lifetime/state management.
  • Add x86-side validation to reject invalid MSI addresses before installing routes/requests.
  • Update vmcore::irqfd documentation to describe architecture-specific “interrupt message” routing rather than x86-only MSI wording.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
vmm_core/virt_kvm/src/lib.rs Makes gsi/irqfd state available across architectures by removing x86-only gating and storing KvmIrqFdState in the partition.
vmm_core/virt_kvm/src/gsi.rs Refactors route lifetime management and introduces an architecture-specific routing-entry builder used by irqfd routes.
vmm_core/virt_kvm/src/arch/x86_64/mod.rs Adds MSI address validation and plugs x86 MSI route construction into the new builder-based irqfd route path.
vmm_core/virt_kvm/src/arch/aarch64/mod.rs Adds aarch64 irqfd exposure when GICv2m is present and implements SETSPI→irqchip route translation.
vm/vmcore/src/irqfd.rs Updates trait documentation to describe architecture-specific interrupt message routing (not just x86 MSI).
Comments suppressed due to low confidence (1)

vm/vmcore/src/irqfd.rs:26

  • The IrqFd::new_irqfd_route doc still says the event injects the configured "MSI" into the guest, but this module now describes irqfd as injecting an architecture-specific interrupt message. Please update this wording (and similar references like "Clears the MSI routing") to match the generalized semantics.
    ///
    /// Allocates a GSI, creates an event, and registers the event with the
    /// hypervisor so that signaling it injects the configured MSI into the
    /// guest.

Comment thread vmm_core/virt_kvm/src/arch/x86_64/mod.rs
Comment thread vmm_core/virt_kvm/src/arch/aarch64/mod.rs
Comment thread vmm_core/virt_kvm/src/arch/aarch64/mod.rs
Comment thread vmm_core/virt_kvm/src/gsi.rs
Comment on lines 161 to 162
/// This actually leaves the route configured, but it disables the irqfd and
/// clears the `enabled` bool so that `signal` won't.
Comment thread vmm_core/virt_kvm/src/gsi.rs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

unsafe Related to unsafe code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants