kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Avi Kivity <avi@redhat.com>
To: "Han, Weidong" <weidong.han@intel.com>
Cc: kvm@vger.kernel.org, Amit Shah <amit.shah@redhat.com>,
	"Kay, Allen M" <allen.m.kay@intel.com>,
	benami@il.ibm.com
Subject: Re: [PATCH] VT-d: Fix iommu map page for mmio pages
Date: Thu, 25 Sep 2008 13:27:03 +0300	[thread overview]
Message-ID: <48DB6777.7070709@redhat.com> (raw)
In-Reply-To: <0122C7C995D32147B66BF4F440D3016301BE2C10@pdsmsx415.ccr.corp.intel.com>

Han, Weidong wrote:
> Don't need to map mmio pages for iommu. When find mmio pages in
> kvm_iommu_map_pages(), don't map them, and shouldn't return error due to
> it's not an error. If return error (such as -EINVAL), device assigment
> will fail.
>
>   


I don't understand.  Why don't we need to map mmio pages?  We certainly 
don't want them emulated.

> @@ -36,14 +36,13 @@ int kvm_iommu_map_pages(struct kvm *kvm,
>  {
>  	gfn_t gfn = base_gfn;
>  	pfn_t pfn;
> -	int i, r;
> +	int i, r = 0;
>  	struct dmar_domain *domain = kvm->arch.intel_iommu_domain;
>  
>  	/* check if iommu exists and in use */
>  	if (!domain)
>  		return 0;
>  
> -	r = -EINVAL;
>  	for (i = 0; i < npages; i++) {
>  		/* check if already mapped */
>  		pfn = (pfn_t)intel_iommu_iova_to_pfn(domain,
> @@ -60,13 +59,14 @@ int kvm_iommu_map_pages(struct kvm *kvm,
>  						     DMA_PTE_READ |
>  						     DMA_PTE_WRITE);
>  			if (r) {
> -				printk(KERN_DEBUG "kvm_iommu_map_pages:"
> +				printk(KERN_ERR "kvm_iommu_map_pages:"
>  				       "iommu failed to map pfn=%lx\n",
> pfn);
>  				goto unmap_pages;
>  			}
>  		} else {
> -			printk(KERN_DEBUG "kvm_iommu_map_page:"
> -			       "invalid pfn=%lx\n", pfn);
> +			printk(KERN_DEBUG "kvm_iommu_map_pages:"
> +			       "invalid pfn=%lx, iommu needn't map "
> +			       "MMIO pages!\n", pfn);
>  			goto unmap_pages;
>  		}

If a slot has a mix of mmio and non-mmio pages, you will unmap the 
non-mmio pages, yet return no error.

-- 
error compiling committee.c: too many arguments to function


  reply	other threads:[~2008-09-25 10:28 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-09-19  7:15 [PATCH] VT-d: Fix iommu map page for mmio pages Han, Weidong
2008-09-25 10:27 ` Avi Kivity [this message]
2008-09-25 13:44   ` Han, Weidong
2008-09-25 13:58     ` Avi Kivity
2008-09-25 14:07       ` Han, Weidong
2008-09-25 14:45         ` Avi Kivity
2008-09-25 15:04           ` Anthony Liguori
2008-09-25 15:19             ` Han, Weidong
2008-09-25 21:14           ` Muli Ben-Yehuda
2008-09-25 21:51             ` Anthony Liguori
2008-09-26 23:57               ` Muli Ben-Yehuda
2008-09-27 10:24                 ` Avi Kivity
2008-09-28  6:07                   ` Muli Ben-Yehuda
2008-09-28  8:45                     ` Avi Kivity

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=48DB6777.7070709@redhat.com \
    --to=avi@redhat.com \
    --cc=allen.m.kay@intel.com \
    --cc=amit.shah@redhat.com \
    --cc=benami@il.ibm.com \
    --cc=kvm@vger.kernel.org \
    --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;
as well as URLs for NNTP newsgroup(s).