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

> From: Ben-Ami Yassour <[EMAIL PROTECTED]>
> 
> 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 <[EMAIL PROTECTED]>
> ---
>  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
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to