Skip to content

target/arm/kvm: check get_msi_direct_gpa before &address_space_memory guard#22

Closed
mmhonap wants to merge 1 commit into
NVIDIA:nvidia_unstable-10.1from
mmhonap:msi_as_fix
Closed

target/arm/kvm: check get_msi_direct_gpa before &address_space_memory guard#22
mmhonap wants to merge 1 commit into
NVIDIA:nvidia_unstable-10.1from
mmhonap:msi_as_fix

Conversation

@mmhonap

@mmhonap mmhonap commented Jun 15, 2026

Copy link
Copy Markdown

For vfio-pci endpoints behind an accelerated SMMUv3, smmuv3_accel_find_add_as() returns &address_space_memory from get_address_space(). This is by design: the host S2 mappings handle DMA without an IOMMU address space on the QEMU side.

pci_device_iommu_address_space() uses the same path, so it also returns &address_space_memory for these devices. kvm_arch_fixup_msi_route() then hits the early-exit guard and returns before calling pci_device_iommu_msi_direct_gpa(). The MSI route goes unfixed, the guest sees no MSI domain, and the NVIDIA driver fails to load.

The bug was introduced by commit a509f10, which reverted the SAUCE pci_device_iommu_msi_address_space() helper and switched kvm.c back to pci_device_iommu_address_space(). That revert is correct: the upstream get_msi_direct_gpa mechanism replaces the SAUCE approach. The problem is that pci_device_iommu_msi_direct_gpa() was left after the early-exit guard rather than before it.

Move pci_device_iommu_msi_direct_gpa() above the &address_space_memory guard. If the callback is implemented (accelerated SMMUv3 + vfio-pci), the doorbell GPA is obtained directly and the function jumps to set_doorbell. Otherwise the existing early-exit and translation paths run unchanged.

Fixes: a509f10 ("Revert 'NVIDIA: SAUCE: hw/pci/pci: Introduce optional get_msi_address_space() callback'")

… guard

For vfio-pci endpoints behind an accelerated SMMUv3,
smmuv3_accel_find_add_as() returns &address_space_memory from
get_address_space(). This is by design: the host S2 mappings handle DMA
without an IOMMU address space on the QEMU side.

pci_device_iommu_address_space() uses the same path, so it also returns
&address_space_memory for these devices. kvm_arch_fixup_msi_route() then
hits the early-exit guard and returns before calling
pci_device_iommu_msi_direct_gpa(). The MSI route goes unfixed, the guest
sees no MSI domain, and the NVIDIA driver fails to load.

The bug was introduced by commit a509f10, which reverted the SAUCE
pci_device_iommu_msi_address_space() helper and switched kvm.c back to
pci_device_iommu_address_space(). That revert is correct: the upstream
get_msi_direct_gpa mechanism replaces the SAUCE approach. The problem is
that pci_device_iommu_msi_direct_gpa() was left after the early-exit
guard rather than before it.

Move pci_device_iommu_msi_direct_gpa() above the &address_space_memory
guard. If the callback is implemented (accelerated SMMUv3 + vfio-pci),
the doorbell GPA is obtained directly and the function jumps to
set_doorbell. Otherwise the existing early-exit and translation paths run
unchanged.

Fixes: a509f10 ("Revert 'NVIDIA: SAUCE: hw/pci/pci: Introduce optional get_msi_address_space() callback'")
Signed-off-by: Shameer Kolothum <skolothumtho@nvidia.com>
@mmhonap mmhonap marked this pull request as draft June 15, 2026 07:50
@mmhonap mmhonap marked this pull request as ready for review June 15, 2026 07:51
@mmhonap mmhonap closed this Jun 15, 2026
@mmhonap mmhonap deleted the msi_as_fix branch June 15, 2026 15:14
@mmhonap

mmhonap commented Jun 15, 2026

Copy link
Copy Markdown
Author

Dropping this over shamiali2008/qemu-master@a3c05f9

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.

1 participant