From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54683) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bmP3w-0002Qs-PX for qemu-devel@nongnu.org; Tue, 20 Sep 2016 13:42:36 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bmP3r-0003Xn-P8 for qemu-devel@nongnu.org; Tue, 20 Sep 2016 13:42:31 -0400 Received: from mail-wm0-f67.google.com ([74.125.82.67]:35317) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bmP3r-0003XV-ID for qemu-devel@nongnu.org; Tue, 20 Sep 2016 13:42:27 -0400 Received: by mail-wm0-f67.google.com with SMTP id 133so4587160wmq.2 for ; Tue, 20 Sep 2016 10:42:27 -0700 (PDT) From: David Kiarie Date: Tue, 20 Sep 2016 20:40:46 +0300 Message-Id: <1474393246-29085-7-git-send-email-davidkiarie4@gmail.com> In-Reply-To: <1474393246-29085-1-git-send-email-davidkiarie4@gmail.com> References: <1474393246-29085-1-git-send-email-davidkiarie4@gmail.com> Subject: [Qemu-devel] [V5 6/6] hw/iommu: share common code between IOMMUs List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org, rkrcmar@redhat.com, mst@redhat.com, peterx@redhat.com, alex.williamson@redhat.com, jan.kiszka@web.de, pbonzini@redhat.com Cc: David Kiarie Enabling interrupt remapping with kernel_irqchip=on should result in an error for both VT-d and AMD-Vi Signed-off-by: David Kiarie --- hw/i386/intel_iommu.c | 9 --------- hw/i386/x86-iommu.c | 8 ++++++++ 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/hw/i386/intel_iommu.c b/hw/i386/intel_iommu.c index 3f6da40..18709d2 100644 --- a/hw/i386/intel_iommu.c +++ b/hw/i386/intel_iommu.c @@ -30,7 +30,6 @@ #include "hw/boards.h" #include "hw/i386/x86-iommu.h" #include "hw/pci-host/q35.h" -#include "sysemu/kvm.h" /*#define DEBUG_INTEL_IOMMU*/ #ifdef DEBUG_INTEL_IOMMU @@ -2463,14 +2462,6 @@ static void vtd_realize(DeviceState *dev, Error **errp) Q35_PSEUDO_DEVFN_IOAPIC); /* Pseudo address space under root PCI bus. */ pcms->ioapic_as = vtd_host_dma_iommu(bus, s, Q35_PSEUDO_DEVFN_IOAPIC); - - /* Currently Intel IOMMU IR only support "kernel-irqchip={off|split}" */ - if (x86_iommu->intr_supported && kvm_irqchip_in_kernel() && - !kvm_irqchip_is_split()) { - error_report("Intel Interrupt Remapping cannot work with " - "kernel-irqchip=on, please use 'split|off'."); - exit(1); - } } static void vtd_class_init(ObjectClass *klass, void *data) diff --git a/hw/i386/x86-iommu.c b/hw/i386/x86-iommu.c index 2278af7..66510f7 100644 --- a/hw/i386/x86-iommu.c +++ b/hw/i386/x86-iommu.c @@ -21,6 +21,7 @@ #include "hw/sysbus.h" #include "hw/boards.h" #include "hw/i386/x86-iommu.h" +#include "sysemu/kvm.h" #include "qemu/error-report.h" #include "trace.h" @@ -84,6 +85,13 @@ static void x86_iommu_realize(DeviceState *dev, Error **errp) if (x86_class->realize) { x86_class->realize(dev, errp); } + /* Currently IOMMU IR only support "kernel-irqchip={off|split}" */ + if (x86_iommu->intr_supported && kvm_irqchip_in_kernel() && + !kvm_irqchip_is_split()) { + error_report("Interrupt Remapping cannot work with " + "kernel-irqchip=on, please use 'split|off'."); + exit(1); + } x86_iommu_set_default(X86_IOMMU_DEVICE(dev)); } -- 2.1.4