From patchwork Fri Apr 15 03:31:39 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Xu X-Patchwork-Id: 610750 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org 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 ozlabs.org (Postfix) with ESMTPS id 3qmNng47jMz9sDb for ; Fri, 15 Apr 2016 13:49:11 +1000 (AEST) Received: from localhost ([::1]:53193 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aqukn-00022q-MI for incoming@patchwork.ozlabs.org; Thu, 14 Apr 2016 23:49:09 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56676) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aquXm-00024e-7k for qemu-devel@nongnu.org; Thu, 14 Apr 2016 23:35:43 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aquXl-0005Bi-EP for qemu-devel@nongnu.org; Thu, 14 Apr 2016 23:35:42 -0400 Received: from mx1.redhat.com ([209.132.183.28]:53785) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aquXl-0005Be-9f for qemu-devel@nongnu.org; Thu, 14 Apr 2016 23:35:41 -0400 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id DB2606407D; Fri, 15 Apr 2016 03:35:40 +0000 (UTC) Received: from pxdev.xzpeter.org.com (vpn1-4-123.pek2.redhat.com [10.72.4.123]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u3F3VgWH002504; Thu, 14 Apr 2016 23:35:35 -0400 From: Peter Xu To: qemu-devel@nongnu.org Date: Fri, 15 Apr 2016 11:31:39 +0800 Message-Id: <1460691099-3024-14-git-send-email-peterx@redhat.com> In-Reply-To: <1460691099-3024-1-git-send-email-peterx@redhat.com> References: <1460691099-3024-1-git-send-email-peterx@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Fri, 15 Apr 2016 03:35:40 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v3 13/13] q35: add "int-remap" flag to enable intr 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: ehabkost@redhat.com, mst@redhat.com, jasowang@redhat.com, rkrcmar@redhat.com, peterx@redhat.com, alex.williamson@redhat.com, jan.kiszka@web.de, wexu@redhat.com, pbonzini@redhat.com, marcel@redhat.com, imammedo@redhat.com, rth@twiddle.net Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" One flag is added to specify whether to enable INTR for emulated IOMMU. By default, interrupt remapping is not supportted. To enable it, we should specify something like: $ qemu-system-x86_64 -M q35,iommu=on,intr=on To be more clear, the following command: $ qemu-system-x86_64 -M q35,iommu=on Will enable IOMMU only, without interrupt remapping support. Currently, Intel IOMMU IR only support kernel-irqchip={off|split}. We need to specify either of it in -M as well. Signed-off-by: Peter Xu --- hw/core/machine.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/hw/core/machine.c b/hw/core/machine.c index 276ad61..b00f39f 100644 --- a/hw/core/machine.c +++ b/hw/core/machine.c @@ -300,6 +300,20 @@ static void machine_set_iommu(Object *obj, bool value, Error **errp) ms->iommu = value; } +static bool machine_get_intr(Object *obj, Error **errp) +{ + MachineState *ms = MACHINE(obj); + + return ms->iommu_intr; +} + +static void machine_set_intr(Object *obj, bool value, Error **errp) +{ + MachineState *ms = MACHINE(obj); + + ms->iommu_intr = value; +} + static void machine_set_suppress_vmdesc(Object *obj, bool value, Error **errp) { MachineState *ms = MACHINE(obj); @@ -480,6 +494,12 @@ static void machine_initfn(Object *obj) object_property_set_description(obj, "iommu", "Set on/off to enable/disable Intel IOMMU (VT-d)", NULL); + object_property_add_bool(obj, "intr", machine_get_intr, + machine_set_intr, NULL); + object_property_set_description(obj, "intr", + "Set on/off to enable/disable IOMMU" + " interrupt remapping", + NULL); object_property_add_bool(obj, "suppress-vmdesc", machine_get_suppress_vmdesc, machine_set_suppress_vmdesc, NULL);