From 0ea1472dc50a9488e87c4d19329c7d5c63eb7076 Mon Sep 17 00:00:00 2001 From: Jan Kiszka Date: Mon, 27 Aug 2018 10:47:51 +0200 Subject: [PATCH] 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") Reported-by: Christopher Goldsworthy Signed-off-by: Jan Kiszka Message-Id: <48ae78d8-58ec-8813-8680-6f407ea46041@siemens.com> Reviewed-by: Peter Xu Reviewed-by: Michael S. Tsirkin Signed-off-by: Paolo Bonzini --- target/i386/kvm.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/target/i386/kvm.c b/target/i386/kvm.c index 0b2a07d3a4..de892db671 100644 --- a/target/i386/kvm.c +++ b/target/i386/kvm.c @@ -3669,6 +3669,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;