From patchwork Fri Dec 30 08:55:59 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Xu X-Patchwork-Id: 709678 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 3tqgcJ3MS1z9ssP for ; Fri, 30 Dec 2016 20:08:15 +1100 (AEDT) Received: from localhost ([::1]:38997 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cMtAb-0008HW-LX for incoming@patchwork.ozlabs.org; Fri, 30 Dec 2016 04:08:13 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34547) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cMszT-00007A-Nj for qemu-devel@nongnu.org; Fri, 30 Dec 2016 03:56:44 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cMszT-0008O5-2H for qemu-devel@nongnu.org; Fri, 30 Dec 2016 03:56:43 -0500 Received: from mx1.redhat.com ([209.132.183.28]:57826) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cMszS-0008Ns-S8 for qemu-devel@nongnu.org; Fri, 30 Dec 2016 03:56:42 -0500 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) (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 E382F81129; Fri, 30 Dec 2016 08:56:41 +0000 (UTC) Received: from pxdev.xzpeter.org (vpn1-4-51.pek2.redhat.com [10.72.4.51]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id uBU8u2Lx011949; Fri, 30 Dec 2016 03:56:38 -0500 From: Peter Xu To: qemu-devel@nongnu.org, kvm@vger.kernel.org Date: Fri, 30 Dec 2016 16:55:59 +0800 Message-Id: <1483088160-6714-8-git-send-email-peterx@redhat.com> In-Reply-To: <1483088160-6714-1-git-send-email-peterx@redhat.com> References: <1483088160-6714-1-git-send-email-peterx@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.26 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Fri, 30 Dec 2016 08:56:41 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [kvm-unit-tests PATCH 7/8] intel-iommu: allow setup trigger mode for irte 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: Andrew Jones , =?UTF-8?q?Radim=20Kr=C4=8Dm=C3=A1=C5=99?= , peterx@redhat.com, agordeev@redhat.com, Jan Kiszka , Paolo Bonzini Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" IOAPIC interrupts need this. Let's be prepared. Signed-off-by: Peter Xu --- lib/x86/intel-iommu.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/x86/intel-iommu.c b/lib/x86/intel-iommu.c index a3ce678..0585248 100644 --- a/lib/x86/intel-iommu.c +++ b/lib/x86/intel-iommu.c @@ -250,13 +250,13 @@ static uint16_t vtd_intr_index_alloc(void) } static void vtd_setup_irte(struct pci_dev *dev, vtd_irte_t *irte, - int vector, int dest_id) + int vector, int dest_id, trigger_mode_t trigger) { assert(sizeof(vtd_irte_t) == 16); memset(irte, 0, sizeof(*irte)); irte->fault_disable = 1; irte->dest_mode = 0; /* physical */ - irte->trigger_mode = 0; /* edge */ + irte->trigger_mode = trigger; irte->delivery_mode = 0; /* fixed */ irte->irte_mode = 0; /* remapped */ irte->vector = vector; @@ -301,7 +301,9 @@ bool vtd_setup_msi(struct pci_dev *dev, int vector, int dest_id) assert(sizeof(vtd_msi_addr_t) == 8); assert(sizeof(vtd_msi_data_t) == 4); - vtd_setup_irte(dev, irte + index, vector, dest_id); + /* Use edge irq as default */ + vtd_setup_irte(dev, irte + index, vector, + dest_id, TRIGGER_EDGE); msi_addr.handle_15 = index >> 15 & 1; msi_addr.shv = 0;