From patchwork Wed Aug 10 19:42:59 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Kiarie X-Patchwork-Id: 9273769 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 23FD9600CA for ; Wed, 10 Aug 2016 19:47:24 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 13747283FC for ; Wed, 10 Aug 2016 19:47:24 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0832928413; Wed, 10 Aug 2016 19:47:24 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 9B965283FC for ; Wed, 10 Aug 2016 19:47:23 +0000 (UTC) Received: from localhost ([::1]:43576 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bXZTG-00058n-Ol for patchwork-qemu-devel@patchwork.kernel.org; Wed, 10 Aug 2016 15:47:22 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48285) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bXZPQ-0001vr-Kz for qemu-devel@nongnu.org; Wed, 10 Aug 2016 15:43:25 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bXZPO-0003cU-IT for qemu-devel@nongnu.org; Wed, 10 Aug 2016 15:43:23 -0400 Received: from mail-wm0-x243.google.com ([2a00:1450:400c:c09::243]:35026) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bXZPO-0003cO-BY for qemu-devel@nongnu.org; Wed, 10 Aug 2016 15:43:22 -0400 Received: by mail-wm0-x243.google.com with SMTP id i5so11577066wmg.2 for ; Wed, 10 Aug 2016 12:43:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=sFgyV3CJyNWzNAMslQVVngHrkJ+r0jgCcRvPkhFORp4=; b=W3+HKvDfBql2hRufS8acjVvekRMD1oSVqBUzDwCxfH4ucDlrW2lcWIxDROeTQ5XAOj WlmhOcP0Kl+QG2KLJGxNvYy/8E2ReJnxTmVWiN3fS7aI13fq1Rks0OXvjz54CVGzWsm6 OoIjMM6F/L5I6xi5u9B6I2pX5MkeR33Lb7pfra1jqFg4XQeJJbFVc3JYY8Bu358DOnYg /X8vd2wWrOe9w4jOunI6kI4BjaPt8Kvt/5bhhUTm10Z6ay1fGSXrHbJbYkLsVoix7YH3 nV/9cm8WVGSGJ2RzFrHfZA37E1P/9IAnSxekdRH64TXTrV/Ya814phf5tpnvEYmCNLWo 4wmw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=sFgyV3CJyNWzNAMslQVVngHrkJ+r0jgCcRvPkhFORp4=; b=BwHRHhEGeArM2kSb36xnKXZmQ916cSfmNixMS3r6xOs0eANg2LjjAI+hCMjvIjf0oA oYG+UiZsHDWUsgjeto54+tB/bfU7NcnuETUZ/tZXUGMufxhme1hP00spXtAPdF1tvI12 ZeMGPaZqsxfx5nRKV9AuxRu2YRuTNdGp9dX6O4+J2Z2cZjTWcx68fiBHqAhnFvdL908O DUh5Vm2gslipppVxivAMFVxXSisvILlCDFvzDmwmdyLEDrzr/U7VX1P7N25TtFD0RDQf UsjWOv1hund2eA/0JqWDwj3rOStEYmfPB3QhTzjRCa7Gz3re9zSSJFoayQwGa6n2dsQB PBWQ== X-Gm-Message-State: AEkoouthsmFv+jVzdru44yeJxSwhV7BvUYOmCOoq5JJwCoPLOtBlluuL9NZizRn9sEnQeQ== X-Received: by 10.194.0.211 with SMTP id 19mr5527048wjg.124.1470858201535; Wed, 10 Aug 2016 12:43:21 -0700 (PDT) Received: from debian.flybox.orange ([154.123.49.212]) by smtp.googlemail.com with ESMTPSA id a2sm44514443wjg.46.2016.08.10.12.43.18 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 10 Aug 2016 12:43:21 -0700 (PDT) From: David Kiarie To: qemu-devel@nongnu.org Date: Wed, 10 Aug 2016 22:42:59 +0300 Message-Id: <1470858179-27754-5-git-send-email-davidkiarie4@gmail.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1470858179-27754-1-git-send-email-davidkiarie4@gmail.com> References: <1470858179-27754-1-git-send-email-davidkiarie4@gmail.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2a00:1450:400c:c09::243 Subject: [Qemu-devel] [V1 4/4] hw/iommu: share common between IOMMUs X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, ehabkost@redhat.com, mst@redhat.com, jan.kiszka@siemens.com, valentine.sinitsyn@gmail.com, pbonzini@redhat.com, David Kiarie Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Enabling interrupt remapping with kernel_irqchip=on should result in 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 7c80907..857f9f1 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 @@ -2472,14 +2471,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)); }