From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Yang, Sheng" Subject: Re: [PATCH] KVM: PCIPT: VT-d support Date: Thu, 10 Jul 2008 18:07:27 +0800 Message-ID: <200807101807.28719.sheng.yang@intel.com> References: <1215681282-3449-1-git-send-email-benami@il.ibm.com> <200807101730.26586.sheng.yang@intel.com> <1215683513.31546.175.camel@cluwyn.haifa.ibm.com> Mime-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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: Ben-Ami Yassour Return-path: Received: from mga02.intel.com ([134.134.136.20]:32362 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752913AbYGJKGN (ORCPT ); Thu, 10 Jul 2008 06:06:13 -0400 In-Reply-To: <1215683513.31546.175.camel@cluwyn.haifa.ibm.com> Content-Disposition: inline Sender: kvm-owner@vger.kernel.org List-ID: On Thursday 10 July 2008 17:51:53 Ben-Ami Yassour wrote: > 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. I think it's may be unnecessary to map pages when device assigned. The table can be set up along with set_memory_region(), it covered all memory slots already, or I miss something here? -- Thanks Yang, Sheng