[PATCH 3/4] VT-d: skip IOMMU bitmap cleanup for phantom devices

Jan Beulich posted 4 patches 3 years, 2 months ago
There is a newer version of this series
[PATCH 3/4] VT-d: skip IOMMU bitmap cleanup for phantom devices
Posted by Jan Beulich 3 years, 2 months ago
Doing the cleanup also for phantom devices is at best redundant with
doing it for the corresponding real device. I couldn't force myself into
checking all the code paths whether it really is: It seems better to
explicitly skip this step in such cases.

Signed-off-by: Jan Beulich <jbeulich@suse.com>

--- a/xen/drivers/passthrough/vtd/iommu.c
+++ b/xen/drivers/passthrough/vtd/iommu.c
@@ -1733,7 +1733,7 @@ static int domain_context_unmap(struct d
         return -EINVAL;
     }
 
-    if ( ret || QUARANTINE_SKIP(domain) )
+    if ( ret || QUARANTINE_SKIP(domain) || pdev->devfn != devfn )
         return ret;
 
     /*


RE: [PATCH 3/4] VT-d: skip IOMMU bitmap cleanup for phantom devices
Posted by Tian, Kevin 3 years, 2 months ago
> From: Jan Beulich <jbeulich@suse.com>
> Sent: Wednesday, September 15, 2021 5:13 PM
> 
> Doing the cleanup also for phantom devices is at best redundant with
> doing it for the corresponding real device. I couldn't force myself into
> checking all the code paths whether it really is: It seems better to
> explicitly skip this step in such cases.
> 
> Signed-off-by: Jan Beulich <jbeulich@suse.com>

Reviewed-by: Kevin Tian <kevin.tian@intel.com>

> 
> --- a/xen/drivers/passthrough/vtd/iommu.c
> +++ b/xen/drivers/passthrough/vtd/iommu.c
> @@ -1733,7 +1733,7 @@ static int domain_context_unmap(struct d
>          return -EINVAL;
>      }
> 
> -    if ( ret || QUARANTINE_SKIP(domain) )
> +    if ( ret || QUARANTINE_SKIP(domain) || pdev->devfn != devfn )
>          return ret;
> 
>      /*