public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: "Yang, Sheng" <sheng.yang@intel.com>
To: Ben-Ami Yassour <benami@il.ibm.com>
Cc: kvm@vger.kernel.org, amit.shah@qumranet.com,
	Muli Ben-Yehuda <muli@il.ibm.com>,
	weidong.han@intel.com, anthony@codemonkey.ws, "Kay,
	Allen M" <allen.m.kay@intel.com>
Subject: Re: [PATCH] KVM: PCIPT: VT-d support
Date: Thu, 10 Jul 2008 18:07:27 +0800	[thread overview]
Message-ID: <200807101807.28719.sheng.yang@intel.com> (raw)
In-Reply-To: <1215683513.31546.175.camel@cluwyn.haifa.ibm.com>

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 <allen.m.kay@intel.com>
> > >
> > > This patch includes the functions to support VT-d for
> > > passthrough devices.
> > >
> > > [Ben: fixed memory pinning]
> > >
> > > Signed-off-by: Kay, Allen M <allen.m.kay@intel.com>
> > > Signed-off-by: Weidong Han <weidong.han@intel.com>
> > > Signed-off-by: Ben-Ami Yassour <benami@il.ibm.com>
> > > ---
> > >  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 <linux/pagemap.h>
> > >  #include <linux/mman.h>
> > >  #include <linux/swap.h>
> > > +#include <linux/intel-iommu.h>
> > >
> > >  #include <asm/processor.h>
> > >  #include <asm/io.h>
> > > @@ -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

  reply	other threads:[~2008-07-10 10:06 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-07-10  9:14 VT-d pci passthrough patches Ben-Ami Yassour
2008-07-10  9:14 ` [PATCH] VT-d : changes to support KVM Ben-Ami Yassour
2008-07-10  9:14   ` [PATCH] KVM: PCIPT: VT-d support Ben-Ami Yassour
2008-07-10  9:30     ` Yang, Sheng
2008-07-10  9:51       ` Ben-Ami Yassour
2008-07-10 10:07         ` Yang, Sheng [this message]
2008-07-10 14:41           ` Muli Ben-Yehuda
2008-07-10 14:57             ` Avi Kivity
2008-07-10 16:00               ` Muli Ben-Yehuda
2008-07-13  7:34                 ` Avi Kivity
2008-07-14  7:49                   ` Ben-Ami Yassour
2008-07-14  8:48                     ` Avi Kivity
  -- strict thread matches above, loose matches on Subject: below --
2008-07-06 10:52 VT-d pci passthrough patches Ben-Ami Yassour
2008-07-06 10:52 ` [PATCH] VT-d : changes to support KVM Ben-Ami Yassour
2008-07-06 10:52   ` [PATCH] KVM: PCIPT: VT-d support Ben-Ami Yassour
2008-07-09 15:49     ` Anthony Liguori
2008-07-10  9:19       ` Ben-Ami Yassour
2008-07-02 15:33 VT-d pci passthrough patches Ben-Ami Yassour
2008-07-02 15:33 ` [PATCH] VT-d : changes to support KVM Ben-Ami Yassour
2008-07-02 15:33   ` [PATCH] KVM: PCIPT: VT-d support Ben-Ami Yassour
2008-07-03  4:55     ` Han, Weidong
2008-07-06 11:15       ` Ben-Ami Yassour
     [not found]     ` <08DF4D958216244799FC84F3514D70F00181AB10@pdsmsx415.ccr.corp.intel.com>
2008-07-03  6:16       ` Han, Weidong
2008-07-03 11:33         ` Ben-Ami Yassour

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200807101807.28719.sheng.yang@intel.com \
    --to=sheng.yang@intel.com \
    --cc=allen.m.kay@intel.com \
    --cc=amit.shah@qumranet.com \
    --cc=anthony@codemonkey.ws \
    --cc=benami@il.ibm.com \
    --cc=kvm@vger.kernel.org \
    --cc=muli@il.ibm.com \
    --cc=weidong.han@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox