Skip to contentSkip to conversation

kvm: x86: Fix kvm_arch_fixup_msi_route for remap-less case

PATCH Applied Jan Kiszka 4 participants 4 messages Aug 27, 2018 – Sep 11, 2018

lore
Share & tools
lore

Jan Kiszka

author
#0 lore raw

PATCH 1/1 kvm: x86: Fix kvm_arch_fixup_msi_route for remap-less case

The AMD IOMMU does not (yet) support interrupt remapping. But kvm_arch_fixup_msi_route assumes that all implementations do and crashes when the AMD IOMMU is used in KVM mode.

Fixes 8b5ed7dffa1f ("intel_iommu: add support for split irqchip")
---
 target/i386/kvm.c | 4 ++++
 1 file changed, 4 insertions(+)
target/i386/kvm.c +4 -0
index 9313602d3d..1fe3a73a10 100644
@@ -3677,6 +3677,10 @@ int kvm_arch_fixup_msi_route(struct kvm_irq_routing_entry *route,
         MSIMessage src, dst;
         X86IOMMUClass *class = X86_IOMMU_GET_CLASS(iommu);
 
+        if (!class->int_remap) {
+            return 0;
+        }
+
         src.address = route->u.msi.address_hi;
         src.address <<= VTD_MSI_ADDR_HI_SHIFT;
         src.address |= route->u.msi.address_lo;
Signature · 1 line
2.16.4
Reviewed-by on v1 1/1
#1 lore raw
Quoted 7 lines · Jan Kiszka

The AMD IOMMU does not (yet) support interrupt remapping. But kvm_arch_fixup_msi_route assumes that all implementations do and crashes when the AMD IOMMU is used in KVM mode.

Fixes 8b5ed7dffa1f ("intel_iommu: add support for split irqchip")

Thanks!

Signature · 1 line
Peter Xu
Reviewed-by on v1 1/1
#2 lore raw
In reply to Jan Kiszka
Quoted 7 lines · Jan Kiszka

The AMD IOMMU does not (yet) support interrupt remapping. But kvm_arch_fixup_msi_route assumes that all implementations do and crashes when the AMD IOMMU is used in KVM mode.

Fixes 8b5ed7dffa1f ("intel_iommu: add support for split irqchip")
Quoted 21 lines
---
 target/i386/kvm.c | 4 ++++
 1 file changed, 4 insertions(+)
target/i386/kvm.c +4 -0
index 9313602d3d..1fe3a73a10 100644
@@ -3677,6 +3677,10 @@ int kvm_arch_fixup_msi_route(struct kvm_irq_routing_entry *route,
         MSIMessage src, dst;
         X86IOMMUClass *class = X86_IOMMU_GET_CLASS(iommu);
 
+        if (!class->int_remap) {
+            return 0;
+        }
+
         src.address = route->u.msi.address_hi;
         src.address <<= VTD_MSI_ADDR_HI_SHIFT;
         src.address |= route->u.msi.address_lo;
Signature · 1 line
2.16.4
#3 lore raw
In reply to Jan Kiszka
Quoted 17 lines · Jan Kiszka

The AMD IOMMU does not (yet) support interrupt remapping. But kvm_arch_fixup_msi_route assumes that all implementations do and crashes when the AMD IOMMU is used in KVM mode.

Fixes 8b5ed7dffa1f ("intel_iommu: add support for split irqchip")
---
 target/i386/kvm.c | 4 ++++
 1 file changed, 4 insertions(+)
target/i386/kvm.c +0 -0
index 9313602d3d..1fe3a73a10 100644

target/i386/kvm.c int kvm_arch_fixup_msi_route(struct kvm_irq_routing_entry *route, · line 3686

Quoted 10 lines
target/i386/kvm.c +4 -0
@@ -3677,6 +3677,10 @@ int kvm_arch_fixup_msi_route(struct kvm_irq_routing_entry *route,
         MSIMessage src, dst;
         X86IOMMUClass *class = X86_IOMMU_GET_CLASS(iommu);
 
+        if (!class->int_remap) {
+            return 0;
+        }
+
         src.address = route->u.msi.address_hi;
         src.address <<= VTD_MSI_ADDR_HI_SHIFT;
         src.address |= route->u.msi.address_lo;

Queued, thanks.

Paolo