From patchwork Wed May 11 06:53:18 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Xu X-Patchwork-Id: 9065411 Return-Path: X-Original-To: patchwork-qemu-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id D2D489F372 for ; Wed, 11 May 2016 06:53:42 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id CE6EA20172 for ; Wed, 11 May 2016 06:53:38 +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 16E4020154 for ; Wed, 11 May 2016 06:53:38 +0000 (UTC) Received: from localhost ([::1]:50743 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b0O1Y-000783-Sl for patchwork-qemu-devel@patchwork.kernel.org; Wed, 11 May 2016 02:53:36 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51076) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b0O1Q-00075R-Sx for qemu-devel@nongnu.org; Wed, 11 May 2016 02:53:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1b0O1L-0008Fb-MS for qemu-devel@nongnu.org; Wed, 11 May 2016 02:53:27 -0400 Received: from mx1.redhat.com ([209.132.183.28]:48558) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b0O1L-0008FX-Gc for qemu-devel@nongnu.org; Wed, 11 May 2016 02:53:23 -0400 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) (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 A676F6264D; Wed, 11 May 2016 06:53:22 +0000 (UTC) Received: from pxdev.xzpeter.org (dhcp-14-147.nay.redhat.com [10.66.14.147]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u4B6rICs007611 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Wed, 11 May 2016 02:53:20 -0400 Date: Wed, 11 May 2016 14:53:18 +0800 From: Peter Xu To: qemu-devel@nongnu.org Message-ID: <20160511065318.GA13293@pxdev.xzpeter.org> References: <1462948831-931-1-git-send-email-peterx@redhat.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <1462948831-931-1-git-send-email-peterx@redhat.com> User-Agent: Mutt/1.5.24 (2015-08-30) X-Scanned-By: MIMEDefang 2.68 on 10.5.11.24 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Wed, 11 May 2016 06:53:22 +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: Re: [Qemu-devel] [PATCH] pci: fix requester id with PCI bridges 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: pbonzini@redhat.com, alex.williamson@redhat.com, mst@redhat.com, jan.kiszka@web.de, rkrcmar@redhat.com 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 On Wed, May 11, 2016 at 02:40:30PM +0800, Peter Xu wrote: > Recently I encountered issue when debugging Intel IOMMU IR codes, > that interrupts are not working correctly with PCI bridges (reported > by Radim). This patch fixes the problem. I assume requester ID > should be the devfn on root PCI bus (that's how I understand it > before, and also in guest kernel, IRTE entry SID is filled in that > way), however I failed to find any good document to confirm > this. Please let me know if this is correct (or I made any > mistake). One thing to mention is that, this patch does *not* fix the problem if directly applied, because IR patchset introduced another patch that also need a similar fix. In case if there is someone (Radim?) who would like to try this patch, we need to apply this patch as well: ---8<--- --->8--- This should be able to be applied directly onto IR v6 patchset as well. Thanks, -- peterx diff --git a/target-i386/kvm.c b/target-i386/kvm.c index 80b3251..0876a1c 100644 --- a/target-i386/kvm.c +++ b/target-i386/kvm.c @@ -3342,7 +3342,8 @@ int kvm_arch_fixup_msi_route(struct kvm_irq_routing_entry *route, src.data = route->u.msi.data; ret = class->int_remap(iommu, &src, &dst, dev ? \ - pci_requester_id(dev) : X86_IOMMU_SID_INVALID); + pci_requester_id_recursive(dev) : \ + X86_IOMMU_SID_INVALID); if (ret) { trace_kvm_x86_fixup_msi_error(route->gsi); return 1;