qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH Kernel v22 3/8] vfio iommu: Cache pgsize_bitmap in struct vfi


From: Cornelia Huck
Subject: Re: [PATCH Kernel v22 3/8] vfio iommu: Cache pgsize_bitmap in struct vfio_iommu
Date: Wed, 20 May 2020 12:08:25 +0200

On Mon, 18 May 2020 11:26:32 +0530
Kirti Wankhede <address@hidden> wrote:

> Calculate and cache pgsize_bitmap when iommu->domain_list is updated
> and iommu->external_domain is set for mdev device.
> Add iommu->lock protection when cached pgsize_bitmap is accessed.
> 
> Signed-off-by: Kirti Wankhede <address@hidden>
> Reviewed-by: Neo Jia <address@hidden>
> ---
>  drivers/vfio/vfio_iommu_type1.c | 88 
> +++++++++++++++++++++++------------------
>  1 file changed, 49 insertions(+), 39 deletions(-)
> 

(...)

> @@ -805,15 +806,14 @@ static void vfio_remove_dma(struct vfio_iommu *iommu, 
> struct vfio_dma *dma)
>       iommu->dma_avail++;
>  }
>  
> -static unsigned long vfio_pgsize_bitmap(struct vfio_iommu *iommu)
> +static void vfio_pgsize_bitmap(struct vfio_iommu *iommu)

Minor nit: I'd have renamed this function to
vfio_update_pgsize_bitmap().

>  {
>       struct vfio_domain *domain;
> -     unsigned long bitmap = ULONG_MAX;
>  
> -     mutex_lock(&iommu->lock);
> +     iommu->pgsize_bitmap = ULONG_MAX;
> +
>       list_for_each_entry(domain, &iommu->domain_list, next)
> -             bitmap &= domain->domain->pgsize_bitmap;
> -     mutex_unlock(&iommu->lock);
> +             iommu->pgsize_bitmap &= domain->domain->pgsize_bitmap;
>  
>       /*
>        * In case the IOMMU supports page sizes smaller than PAGE_SIZE

(...)

Reviewed-by: Cornelia Huck <address@hidden>




reply via email to

[Prev in Thread] Current Thread [Next in Thread]