From patchwork Thu Jun 23 15:31:23 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joerg Roedel X-Patchwork-Id: 909152 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter2.kernel.org (8.14.4/8.14.4) with ESMTP id p5NFWGWN026635 for ; Thu, 23 Jun 2011 15:32:17 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759593Ab1FWPbr (ORCPT ); Thu, 23 Jun 2011 11:31:47 -0400 Received: from ch1ehsobe004.messaging.microsoft.com ([216.32.181.184]:26561 "EHLO CH1EHSOBE018.bigfish.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1757484Ab1FWPbo (ORCPT ); Thu, 23 Jun 2011 11:31:44 -0400 Received: from mail41-ch1-R.bigfish.com (216.32.181.169) by CH1EHSOBE018.bigfish.com (10.43.70.68) with Microsoft SMTP Server id 14.1.225.22; Thu, 23 Jun 2011 15:31:44 +0000 Received: from mail41-ch1 (localhost.localdomain [127.0.0.1]) by mail41-ch1-R.bigfish.com (Postfix) with ESMTP id 0DE13C08118; Thu, 23 Jun 2011 15:31:44 +0000 (UTC) X-SpamScore: 1 X-BigFish: VPS1(zzzz1202hzz8275bhz32i668h839h62h) X-Spam-TCS-SCL: 1:0 X-Forefront-Antispam-Report: CIP:163.181.249.109; KIP:(null); UIP:(null); IPVD:NLI; H:ausb3twp02.amd.com; RD:none; EFVD:NLI Received: from mail41-ch1 (localhost.localdomain [127.0.0.1]) by mail41-ch1 (MessageSwitch) id 1308843103744258_8499; Thu, 23 Jun 2011 15:31:43 +0000 (UTC) Received: from CH1EHSMHS022.bigfish.com (snatpool1.int.messaging.microsoft.com [10.43.68.243]) by mail41-ch1.bigfish.com (Postfix) with ESMTP id A413E36804C; Thu, 23 Jun 2011 15:31:43 +0000 (UTC) Received: from ausb3twp02.amd.com (163.181.249.109) by CH1EHSMHS022.bigfish.com (10.43.70.22) with Microsoft SMTP Server id 14.1.225.22; Thu, 23 Jun 2011 15:31:40 +0000 X-WSS-ID: 0LN91SP-02-H5Z-02 X-M-MSG: Received: from sausexedgep01.amd.com (sausexedgep01-ext.amd.com [163.181.249.72]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) by ausb3twp02.amd.com (Axway MailGate 3.8.1) with ESMTP id 2816FC83E8; Thu, 23 Jun 2011 10:31:37 -0500 (CDT) Received: from sausexhtp01.amd.com (163.181.3.165) by sausexedgep01.amd.com (163.181.36.54) with Microsoft SMTP Server (TLS) id 8.3.106.1; Thu, 23 Jun 2011 10:32:29 -0500 Received: from storexhtp02.amd.com (172.24.4.4) by sausexhtp01.amd.com (163.181.3.165) with Microsoft SMTP Server (TLS) id 8.3.83.0; Thu, 23 Jun 2011 10:31:39 -0500 Received: from gwo.osrc.amd.com (165.204.16.204) by storexhtp02.amd.com (172.24.4.4) with Microsoft SMTP Server id 8.3.83.0; Thu, 23 Jun 2011 11:31:37 -0400 Received: from lemmy.osrc.amd.com (lemmy.osrc.amd.com [165.204.15.93]) by gwo.osrc.amd.com (Postfix) with ESMTP id 91C8B49C5E9; Thu, 23 Jun 2011 16:31:36 +0100 (BST) Received: by lemmy.osrc.amd.com (Postfix, from userid 1000) id 81B5E100270; Thu, 23 Jun 2011 17:31:36 +0200 (CEST) From: Joerg Roedel To: CC: , David Woodhouse , Ohad Ben-Cohen , David Brown , , Avi Kivity , Alex Williamson , Joerg Roedel Subject: [PATCH 2/2] KVM: IOMMU: Use iommu_commit() in device-passthrough code Date: Thu, 23 Jun 2011 17:31:23 +0200 Message-ID: <1308843083-10442-3-git-send-email-joerg.roedel@amd.com> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1308843083-10442-1-git-send-email-joerg.roedel@amd.com> References: <1308843083-10442-1-git-send-email-joerg.roedel@amd.com> MIME-Version: 1.0 X-OriginatorOrg: amd.com Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter2.kernel.org [140.211.167.43]); Thu, 23 Jun 2011 15:32:17 +0000 (UTC) Use the new iommu_commit() function in the KVM device passthrough code. Signed-off-by: Joerg Roedel --- virt/kvm/iommu.c | 8 ++++++++ 1 files changed, 8 insertions(+), 0 deletions(-) diff --git a/virt/kvm/iommu.c b/virt/kvm/iommu.c index 62a9caf..87ef85a 100644 --- a/virt/kvm/iommu.c +++ b/virt/kvm/iommu.c @@ -187,6 +187,8 @@ int kvm_assign_device(struct kvm *kvm, PCI_SLOT(assigned_dev->host_devfn), PCI_FUNC(assigned_dev->host_devfn)); + iommu_commit(domain); + return 0; out_unmap: kvm_iommu_unmap_memslots(kvm); @@ -215,6 +217,8 @@ int kvm_deassign_device(struct kvm *kvm, PCI_SLOT(assigned_dev->host_devfn), PCI_FUNC(assigned_dev->host_devfn)); + iommu_commit(domain); + return 0; } @@ -235,6 +239,8 @@ int kvm_iommu_map_guest(struct kvm *kvm) if (r) goto out_unmap; + iommu_commit(kvm->arch.iommu_domain); + return 0; out_unmap: @@ -283,6 +289,8 @@ static void kvm_iommu_put_pages(struct kvm *kvm, gfn += unmap_pages; } + + iommu_commit(domain); } static int kvm_iommu_unmap_memslots(struct kvm *kvm)