From nobody Thu Nov 6 10:24:01 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1540338254792516.8661867697151; Tue, 23 Oct 2018 16:44:14 -0700 (PDT) Received: from localhost ([::1]:44738 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gF6LN-0005LC-H3 for importer@patchew.org; Tue, 23 Oct 2018 19:44:13 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51421) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gF6JF-0003C5-4I for qemu-devel@nongnu.org; Tue, 23 Oct 2018 19:42:06 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gF6JC-00088X-Fx for qemu-devel@nongnu.org; Tue, 23 Oct 2018 19:42:00 -0400 Received: from [185.30.24.106] (port=13424 helo=hotspot.internet-for-guests.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gF6JB-000812-IC for qemu-devel@nongnu.org; Tue, 23 Oct 2018 19:41:58 -0400 Received: from redhat.com (unknown [172.29.18.113]) by hotspot.internet-for-guests.com (Postfix) with SMTP id 7ECD96402F9; Wed, 24 Oct 2018 00:41:30 +0100 (BST) Date: Tue, 23 Oct 2018 19:41:31 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Message-ID: <20181023234112.188140-8-mst@redhat.com> References: <20181023234112.188140-1-mst@redhat.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20181023234112.188140-1-mst@redhat.com> X-Mailer: git-send-email 2.17.1.1206.gb667731e2e.dirty X-Mutt-Fcc: =sent X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 185.30.24.106 Subject: [Qemu-devel] [PULL 07/28] x86_iommu: move the kernel-irqchip check in common code 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 , "Singh, Brijesh" , Eduardo Habkost , Tom Lendacky , Peter Xu , Paolo Bonzini , Suravee Suthikulpanit , Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RDMRC_1 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: "Singh, Brijesh" Interrupt remapping needs kernel-irqchip=3D{off|split} on both Intel and AMD platforms. Move the check in common place. Signed-off-by: Brijesh Singh Reviewed-by: Peter Xu Cc: Peter Xu Cc: "Michael S. Tsirkin" Cc: Paolo Bonzini Cc: Richard Henderson Cc: Eduardo Habkost Cc: Marcel Apfelbaum Cc: Tom Lendacky Cc: Suravee Suthikulpanit Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/i386/intel_iommu.c | 7 ------- hw/i386/x86-iommu.c | 9 +++++++++ 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/hw/i386/intel_iommu.c b/hw/i386/intel_iommu.c index f24ebfca1c..015a6fc492 100644 --- a/hw/i386/intel_iommu.c +++ b/hw/i386/intel_iommu.c @@ -3262,13 +3262,6 @@ static bool vtd_decide_config(IntelIOMMUState *s, Er= ror **errp) { X86IOMMUState *x86_iommu =3D X86_IOMMU_DEVICE(s); =20 - /* Currently Intel IOMMU IR only support "kernel-irqchip=3D{off|split}= " */ - if (x86_iommu->intr_supported && kvm_irqchip_in_kernel() && - !kvm_irqchip_is_split()) { - error_setg(errp, "Intel Interrupt Remapping cannot work with " - "kernel-irqchip=3Don, please use 'split|off'."); - return false; - } if (s->intr_eim =3D=3D ON_OFF_AUTO_ON && !x86_iommu->intr_supported) { error_setg(errp, "eim=3Don cannot be selected without intremap=3Do= n"); return false; diff --git a/hw/i386/x86-iommu.c b/hw/i386/x86-iommu.c index 8a01a2dd25..7440cb8d60 100644 --- a/hw/i386/x86-iommu.c +++ b/hw/i386/x86-iommu.c @@ -25,6 +25,7 @@ #include "qapi/error.h" #include "qemu/error-report.h" #include "trace.h" +#include "sysemu/kvm.h" =20 void x86_iommu_iec_register_notifier(X86IOMMUState *iommu, iec_notify_fn fn, void *data) @@ -94,6 +95,14 @@ static void x86_iommu_realize(DeviceState *dev, Error **= errp) return; } =20 + /* Both Intel and AMD IOMMU IR only support "kernel-irqchip=3D{off|spl= it}" */ + if (x86_iommu->intr_supported && kvm_irqchip_in_kernel() && + !kvm_irqchip_is_split()) { + error_setg(errp, "Interrupt Remapping cannot work with " + "kernel-irqchip=3Don, please use 'split|off'."); + return; + } + if (x86_class->realize) { x86_class->realize(dev, errp); } --=20 MST