From patchwork Sat Oct 18 05:04:49 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Blaschka X-Patchwork-Id: 400655 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 8F45B14008C for ; Sat, 18 Oct 2014 16:06:01 +1100 (AEDT) Received: from localhost ([::1]:35689 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XfMDG-0005GS-JN for incoming@patchwork.ozlabs.org; Sat, 18 Oct 2014 01:05:58 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33820) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XfMCs-000502-AL for qemu-devel@nongnu.org; Sat, 18 Oct 2014 01:05:43 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XfMCj-0006HX-23 for qemu-devel@nongnu.org; Sat, 18 Oct 2014 01:05:34 -0400 Received: from e06smtp14.uk.ibm.com ([195.75.94.110]:42967) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XfMCi-0006HE-Iv for qemu-devel@nongnu.org; Sat, 18 Oct 2014 01:05:24 -0400 Received: from /spool/local by e06smtp14.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Sat, 18 Oct 2014 06:05:20 +0100 Received: from d06dlp03.portsmouth.uk.ibm.com (9.149.20.15) by e06smtp14.uk.ibm.com (192.168.101.144) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Sat, 18 Oct 2014 06:05:17 +0100 Received: from b06cxnps4074.portsmouth.uk.ibm.com (d06relay11.portsmouth.uk.ibm.com [9.149.109.196]) by d06dlp03.portsmouth.uk.ibm.com (Postfix) with ESMTP id 8B0381B08023 for ; Sat, 18 Oct 2014 06:06:36 +0100 (BST) Received: from d06av10.portsmouth.uk.ibm.com (d06av10.portsmouth.uk.ibm.com [9.149.37.251]) by b06cxnps4074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id s9I55Hmo17301760 for ; Sat, 18 Oct 2014 05:05:17 GMT Received: from d06av10.portsmouth.uk.ibm.com (localhost [127.0.0.1]) by d06av10.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id s9I55G4I021476 for ; Fri, 17 Oct 2014 23:05:16 -0600 Received: from tuxmaker.boeblingen.de.ibm.com (tuxmaker.boeblingen.de.ibm.com [9.152.85.9]) by d06av10.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id s9I55G5P021473; Fri, 17 Oct 2014 23:05:16 -0600 From: Frank Blaschka To: alex.williamson@redhat.com Date: Sat, 18 Oct 2014 07:04:49 +0200 Message-Id: <1413608689-62203-1-git-send-email-blaschka@linux.vnet.ibm.com> X-Mailer: git-send-email 1.8.5.5 X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 14101805-0017-0000-0000-0000017CDA35 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 195.75.94.110 Cc: Frank Blaschka , qemu-devel@nongnu.org Subject: [Qemu-devel] [PATCH] vfio: fix adding memory listener to the right address space X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Depending on the device, container->space->as contains the valid AddressSpace. Using address_space_memory breaks devices sitting behind an iommu (and using a separate address space). Signed-off-by: Frank Blaschka --- hw/misc/vfio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/misc/vfio.c b/hw/misc/vfio.c index d66f3d2..fcc1958 100644 --- a/hw/misc/vfio.c +++ b/hw/misc/vfio.c @@ -3703,7 +3703,7 @@ static int vfio_connect_container(VFIOGroup *group, AddressSpace *as) container->iommu_data.release = vfio_listener_release; memory_listener_register(&container->iommu_data.type1.listener, - &address_space_memory); + container->space->as); if (container->iommu_data.type1.error) { ret = container->iommu_data.type1.error;