From patchwork Tue Apr 19 08:38:40 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Xu X-Patchwork-Id: 8877961 Return-Path: X-Original-To: patchwork-qemu-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id DCD67BF29F for ; Tue, 19 Apr 2016 08:42:58 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 4C2D220204 for ; Tue, 19 Apr 2016 08:42:58 +0000 (UTC) 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.kernel.org (Postfix) with ESMTPS id 977C020125 for ; Tue, 19 Apr 2016 08:42:57 +0000 (UTC) Received: from localhost ([::1]:53974 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1asRFI-0004k6-VC for patchwork-qemu-devel@patchwork.kernel.org; Tue, 19 Apr 2016 04:42:56 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38532) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1asRCD-0007NV-UC for qemu-devel@nongnu.org; Tue, 19 Apr 2016 04:39:49 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1asRCD-0006Mh-4G for qemu-devel@nongnu.org; Tue, 19 Apr 2016 04:39:45 -0400 Received: from mx1.redhat.com ([209.132.183.28]:36409) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1asRCC-0006Md-V1 for qemu-devel@nongnu.org; Tue, 19 Apr 2016 04:39:45 -0400 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) (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 93B0BC05E169; Tue, 19 Apr 2016 08:39:44 +0000 (UTC) Received: from pxdev.xzpeter.org.com (dhcp-14-238.nay.redhat.com [10.66.14.238]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u3J8clBU031338; Tue, 19 Apr 2016 04:39:41 -0400 From: Peter Xu To: qemu-devel@nongnu.org Date: Tue, 19 Apr 2016 16:38:40 +0800 Message-Id: <1461055122-32378-15-git-send-email-peterx@redhat.com> In-Reply-To: <1461055122-32378-1-git-send-email-peterx@redhat.com> References: <1461055122-32378-1-git-send-email-peterx@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.27 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 v4 14/16] 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+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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);