From: Ben-Ami Yassour Subject: Re: [PATCH] KVM: PCIPT: VT-d support Date: Thu, 10 Jul 2008 12:51:53 +0300 Message-ID: <1215683513.31546.175.camel@cluwyn.haifa.ibm.com> References: <1215681282-3449-1-git-send-email-benami@il.ibm.com> <1215681282-3449-2-git-send-email-benami@il.ibm.com> <1215681282-3449-3-git-send-email-benami@il.ibm.com> <200807101730.26586.sheng.yang@intel.com> Mime-Version: 1.0 Content-Type: text/plain Content-Transfer-Encoding: 7bit Cc: kvm@vger.kernel.org, amit.shah@qumranet.com, Muli Ben-Yehuda , weidong.han@intel.com, anthony@codemonkey.ws, "Kay, Allen M" To: "Yang, Sheng" Return-path: Received: from mtagate7.uk.ibm.com ([195.212.29.140]:28482 "EHLO mtagate7.uk.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752326AbYGJJwo (ORCPT ); Thu, 10 Jul 2008 05:52:44 -0400 Received: from d06nrmr1407.portsmouth.uk.ibm.com (d06nrmr1407.portsmouth.uk.ibm.com [9.149.38.185]) by mtagate7.uk.ibm.com (8.13.8/8.13.8) with ESMTP id m6A9ptT6169688 for ; Thu, 10 Jul 2008 09:51:55 GMT Received: from d06av01.portsmouth.uk.ibm.com (d06av01.portsmouth.uk.ibm.com [9.149.37.212]) by d06nrmr1407.portsmouth.uk.ibm.com (8.13.8/8.13.8/NCO v9.0) with ESMTP id m6A9ptMC2187408 for ; Thu, 10 Jul 2008 10:51:55 +0100 Received: from d06av01.portsmouth.uk.ibm.com (loopback [127.0.0.1]) by d06av01.portsmouth.uk.ibm.com (8.12.11.20060308/8.13.3) with ESMTP id m6A9psad002703 for ; Thu, 10 Jul 2008 10:51:55 +0100 In-Reply-To: <200807101730.26586.sheng.yang@intel.com> Sender: kvm-owner@vger.kernel.org List-ID: On Thu, 2008-07-10 at 17:30 +0800, Yang, Sheng wrote: > On Thursday 10 July 2008 17:14:42 Ben-Ami Yassour wrote: > > From: Kay, Allen M > > > > This patch includes the functions to support VT-d for passthrough > > devices. > > > > [Ben: fixed memory pinning] > > > > Signed-off-by: Kay, Allen M > > Signed-off-by: Weidong Han > > Signed-off-by: Ben-Ami Yassour > > --- > > arch/x86/kvm/Makefile | 2 +- > > arch/x86/kvm/vtd.c | 176 > > ++++++++++++++++++++++++++++++++++++++++++++ arch/x86/kvm/x86.c > > | 10 +++ > > include/asm-x86/kvm_host.h | 1 + > > include/linux/kvm_host.h | 6 ++ > > virt/kvm/kvm_main.c | 6 ++ > > 6 files changed, 200 insertions(+), 1 deletions(-) > > create mode 100644 arch/x86/kvm/vtd.c > > > > diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c > > index 531d635..dc67d90 100644 > > --- a/virt/kvm/kvm_main.c > > +++ b/virt/kvm/kvm_main.c > > @@ -41,6 +41,7 @@ > > #include > > #include > > #include > > +#include > > > > #include > > #include > > @@ -422,6 +423,11 @@ int __kvm_set_memory_region(struct kvm *kvm, > > } > > > > kvm_free_physmem_slot(&old, &new); > > + > > + /* map the pages in iommu page table */ > > + if (intel_iommu_found()) > > + kvm_iommu_map_pages(kvm, base_gfn, npages); > > + > > I don't understand why we need this along with > kvm_iommu_map_memslots(). This works during the memory setup, and in > kvm_iommu_map_guest() we do it again with the overlapped memory > region? > > I think even if we need pin all pages, we still just need do it > once... We map the entire guest memory on initialization by going over all the existing memory slots. If a new slot is created later then we need to map it as well, this is the call that you see here. Regards, Ben