public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Muli Ben-Yehuda <muli@il.ibm.com>
To: Ben-Ami Yassour1 <BENAMI@il.ibm.com>
Cc: amit.shah@qumranet.com, weidong.han@intel.com,
	raharper@us.ibm.com, kvm@vger.kernel.org
Subject: Re: [PATCH] KVM: PCIPT: VT-d: fix context mapping
Date: Wed, 18 Jun 2008 23:30:05 +0300	[thread overview]
Message-ID: <20080618203005.GA7186@il.ibm.com> (raw)
In-Reply-To: <1213729526-10410-5-git-send-email-benami@il.ibm.com>

On Tue, Jun 17, 2008 at 10:05:26PM +0300, Ben-Ami Yassour1 wrote:

> From: Ben-Ami Yassour <benami@il.ibm.com>
> 
> When changing the VT-d context mapping, according to the spec, it is
> required to first set the context to not present, flush and only
> then apply the new context.
> 
> Signed-off-by: Ben-Ami Yassour <benami@il.ibm.com>
> ---
>  drivers/pci/intel-iommu.c |   17 +++++++++++++++++
>  1 files changed, 17 insertions(+), 0 deletions(-)
> 
> diff --git a/drivers/pci/intel-iommu.c b/drivers/pci/intel-iommu.c
> index 930874f..dcdfa97 100644
> --- a/drivers/pci/intel-iommu.c
> +++ b/drivers/pci/intel-iommu.c
> @@ -56,6 +56,7 @@
>  
>  
>  static void flush_unmaps_timeout(unsigned long data);
> +static void detach_domain_for_dev(struct dmar_domain *domain, u8 bus, u8 devfn);
>  
>  DEFINE_TIMER(unmap_timer,  flush_unmaps_timeout, 0, 0);
>  
> @@ -1264,7 +1265,23 @@ static int domain_context_mapping_one(struct dmar_domain *domain,
>  	if (!context)
>  		return -ENOMEM;
>  	spin_lock_irqsave(&iommu->lock, flags);
> +	
> +	if (context_present(*context) &&
> +	    (context_domain_id(*context) == domain->id) &&
> +	    (context_address_width(*context) == domain->agaw) &&
> +	    (context_address_root(*context) == virt_to_phys(domain->pgd)) &&
> +	    (context_translation_type(*context) == CONTEXT_TT_MULTI_LEVEL) &&
> +	    (!context_fault_disable(*context))) {
> +		spin_unlock_irqrestore(&iommu->lock, flags);
> +		return 0;
> +	}

Can we wrap this in a descriptively named function, which will also
and release the lock? I think it will make the flow more obvious here.

Cheers,
Muli

  parent reply	other threads:[~2008-06-18 20:31 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-06-17 19:05 Patches for vtd pci passthrough benami
2008-06-17 19:05 ` [PATCH] KVM: PCIPT: fix compilation errors benami
2008-06-17 19:05   ` [PATCH] KVM: PCIPT: VT-d: fix guest unmap benami
2008-06-17 19:05     ` [PATCH] KVM: PCIPT: free device structure on vm destroy benami
2008-06-17 19:05       ` [PATCH] KVM: PCIPT: VT-d: fix context mapping benami
2008-06-17 19:25         ` KVM: PCIPT: temporary fix for pio (userspace part) benami
2008-06-17 19:25           ` [PATCH] " benami
2008-06-18 20:30         ` Muli Ben-Yehuda [this message]
2008-06-19  8:59         ` [PATCH] KVM: PCIPT: VT-d: fix context mapping Han, Weidong
2008-06-19 12:28           ` Ben-Ami Yassour
2008-06-19 14:18             ` Han, Weidong
2008-06-19 17:44               ` Ben-Ami Yassour1
2008-06-20  6:23                 ` Han, Weidong
2008-06-30 15:32                   ` Ben-Ami Yassour
2008-07-01  2:22                     ` Han, Weidong
2008-06-17 21:29     ` [PATCH] KVM: PCIPT: VT-d: fix guest unmap Anthony Liguori
2008-06-18 12:06       ` Ben-Ami Yassour
2008-06-18 20:48         ` Anthony Liguori
2008-06-18 21:23           ` Muli Ben-Yehuda
2008-06-18 21:41             ` Anthony Liguori
2008-06-20 18:59       ` Avi Kivity
2008-06-20 19:28         ` Anthony Liguori

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=20080618203005.GA7186@il.ibm.com \
    --to=muli@il.ibm.com \
    --cc=BENAMI@il.ibm.com \
    --cc=amit.shah@qumranet.com \
    --cc=kvm@vger.kernel.org \
    --cc=raharper@us.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