Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1397489

Re: [PATCH v9 3/7] vfio/type1: bypass unmap/unpin and replay for VFIO_IOVA_RESERVED slots

From Alex Williamson <alex.williamson@redhat.com>
Newsgroups linux.kernel
Subject Re: [PATCH v9 3/7] vfio/type1: bypass unmap/unpin and replay for VFIO_IOVA_RESERVED slots
Date 2016-05-10 00:50 +0200
Message-ID <rx29Y-6uv-5@gated-at.bofh.it> (permalink)
References <rv3Db-38F-1@gated-at.bofh.it> <rv3De-38F-59@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Wed,  4 May 2016 11:54:14 +0000
Eric Auger <eric.auger@linaro.org> wrote:

> Before allowing the end-user to create VFIO_IOVA_RESERVED dma slots,
> let's implement the expected behavior for removal and replay. As opposed
> to user dma slots, IOVAs are not systematically bound to PAs and PAs are
> not pinned. VFIO just initializes the IOVA "aperture". IOVAs are allocated
> outside of the VFIO framework, typically the MSI layer which is
> responsible to free and unmap them. The MSI mapping resources are freeed
> by the IOMMU driver on domain destruction.
> 
> Signed-off-by: Eric Auger <eric.auger@linaro.org>
> 
> ---
> 
> v7 -> v8:
> - do no destroy anything anymore, just bypass unmap/unpin and iommu_map
>   on replay
> ---
>  drivers/vfio/vfio_iommu_type1.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/vfio/vfio_iommu_type1.c b/drivers/vfio/vfio_iommu_type1.c
> index 2d769d4..94a9916 100644
> --- a/drivers/vfio/vfio_iommu_type1.c
> +++ b/drivers/vfio/vfio_iommu_type1.c
> @@ -391,7 +391,7 @@ static void vfio_unmap_unpin(struct vfio_iommu *iommu, struct vfio_dma *dma)
>  	struct vfio_domain *domain, *d;
>  	long unlocked = 0;
>  
> -	if (!dma->size)
> +	if (!dma->size || dma->type != VFIO_IOVA_USER)
>  		return;
>  	/*
>  	 * We use the IOMMU to track the physical addresses, otherwise we'd
> @@ -727,6 +727,9 @@ static int vfio_iommu_replay(struct vfio_iommu *iommu,
>  		dma = rb_entry(n, struct vfio_dma, node);
>  		iova = dma->iova;
>  
> +		if (dma->type == VFIO_IOVA_RESERVED)
> +			continue;
> +

But you do still need some sort of replay mechanism, right?  Not to
replay the IOVA to PA mapping, but to call iommu_msi_set_aperture() for
the new domain.  How will you know that this entry is an MSI reserved
range or something else?  Perhaps we can't have a generic "reserved"
type here.

>  		while (iova < dma->iova + dma->size) {
>  			phys_addr_t phys = iommu_iova_to_phys(d->domain, iova);
>  			size_t size;

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v9 0/7] KVM PCIe/MSI passthrough on ARM/ARM64: kernel part 3/3: vfio changes Eric Auger <eric.auger@linaro.org> - 2016-05-04 14:00 +0200
  [PATCH v9 5/7] vfio/type1: also check IRQ remapping capability at msi domain Eric Auger <eric.auger@linaro.org> - 2016-05-04 14:00 +0200
    Re: [PATCH v9 5/7] vfio/type1: also check IRQ remapping capability at  msi domain "Chalamarla, Tirumalesh" <Tirumalesh.Chalamarla@caviumnetworks.com> - 2016-05-05 21:30 +0200
      Re: [PATCH v9 5/7] vfio/type1: also check IRQ remapping capability at  msi domain Eric Auger <eric.auger@linaro.org> - 2016-05-09 10:10 +0200
    Re: [PATCH v9 5/7] vfio/type1: also check IRQ remapping capability  at msi domain Alex Williamson <alex.williamson@redhat.com> - 2016-05-10 00:50 +0200
      Re: [PATCH v9 5/7] vfio/type1: also check IRQ remapping capability at  msi domain Eric Auger <eric.auger@linaro.org> - 2016-05-10 18:20 +0200
        Re: [PATCH v9 5/7] vfio/type1: also check IRQ remapping capability at  msi domain Robin Murphy <robin.murphy@arm.com> - 2016-05-10 19:30 +0200
          Re: [PATCH v9 5/7] vfio/type1: also check IRQ remapping capability at  msi domain Eric Auger <eric.auger@linaro.org> - 2016-05-11 10:50 +0200
            Re: [PATCH v9 5/7] vfio/type1: also check IRQ remapping capability at  msi domain Robin Murphy <robin.murphy@arm.com> - 2016-05-11 11:40 +0200
              Re: [PATCH v9 5/7] vfio/type1: also check IRQ remapping capability at  msi domain Eric Auger <eric.auger@linaro.org> - 2016-05-11 11:50 +0200
                Re: [PATCH v9 5/7] vfio/type1: also check IRQ remapping capability at  msi domain Robin Murphy <robin.murphy@arm.com> - 2016-05-11 15:50 +0200
                Re: [PATCH v9 5/7] vfio/type1: also check IRQ remapping capability at  msi domain Eric Auger <eric.auger@linaro.org> - 2016-05-11 16:40 +0200
  [PATCH v9 6/7] iommu/arm-smmu: do not advertise IOMMU_CAP_INTR_REMAP Eric Auger <eric.auger@linaro.org> - 2016-05-04 14:00 +0200
  [PATCH v9 1/7] vfio: introduce a vfio_dma type field Eric Auger <eric.auger@linaro.org> - 2016-05-04 14:00 +0200
  [PATCH v9 7/7] vfio/type1: return MSI geometry through VFIO_IOMMU_GET_INFO capability chains Eric Auger <eric.auger@linaro.org> - 2016-05-04 14:00 +0200
    Re: [PATCH v9 7/7] vfio/type1: return MSI geometry through  VFIO_IOMMU_GET_INFO capability chains Eric Auger <eric.auger@linaro.org> - 2016-05-04 14:10 +0200
      Re: [PATCH v9 7/7] vfio/type1: return MSI geometry through  VFIO_IOMMU_GET_INFO capability chains Alex Williamson <alex.williamson@redhat.com> - 2016-05-10 01:10 +0200
        Re: [PATCH v9 7/7] vfio/type1: return MSI geometry through  VFIO_IOMMU_GET_INFO capability chains Eric Auger <eric.auger@linaro.org> - 2016-05-10 19:00 +0200
    Re: [PATCH v9 7/7] vfio/type1: return MSI geometry through  VFIO_IOMMU_GET_INFO capability chains Alex Williamson <alex.williamson@redhat.com> - 2016-05-10 01:00 +0200
      Re: [PATCH v9 7/7] vfio/type1: return MSI geometry through  VFIO_IOMMU_GET_INFO capability chains Eric Auger <eric.auger@linaro.org> - 2016-05-10 18:40 +0200
  [PATCH v9 2/7] vfio/type1: vfio_find_dma accepting a type argument Eric Auger <eric.auger@linaro.org> - 2016-05-04 14:00 +0200
    Re: [PATCH v9 2/7] vfio/type1: vfio_find_dma accepting a type  argument Alex Williamson <alex.williamson@redhat.com> - 2016-05-10 00:50 +0200
      Re: [PATCH v9 2/7] vfio/type1: vfio_find_dma accepting a type  argument Eric Auger <eric.auger@linaro.org> - 2016-05-10 17:00 +0200
  [PATCH v9 4/7] vfio: allow reserved msi iova registration Eric Auger <eric.auger@linaro.org> - 2016-05-04 14:00 +0200
    Re: [PATCH v9 4/7] vfio: allow reserved msi iova registration "Chalamarla, Tirumalesh" <Tirumalesh.Chalamarla@caviumnetworks.com> - 2016-05-05 21:40 +0200
      Re: [PATCH v9 4/7] vfio: allow reserved msi iova registration Eric Auger <eric.auger@linaro.org> - 2016-05-09 10:00 +0200
    Re: [PATCH v9 4/7] vfio: allow reserved msi iova registration Alex Williamson <alex.williamson@redhat.com> - 2016-05-10 17:40 +0200
      Re: [PATCH v9 4/7] vfio: allow reserved msi iova registration Eric Auger <eric.auger@linaro.org> - 2016-05-10 17:40 +0200
  [PATCH v9 3/7] vfio/type1: bypass unmap/unpin and replay for VFIO_IOVA_RESERVED slots Eric Auger <eric.auger@linaro.org> - 2016-05-04 14:00 +0200
    Re: [PATCH v9 3/7] vfio/type1: bypass unmap/unpin and replay for  VFIO_IOVA_RESERVED slots Alex Williamson <alex.williamson@redhat.com> - 2016-05-10 00:50 +0200
      Re: [PATCH v9 3/7] vfio/type1: bypass unmap/unpin and replay for  VFIO_IOVA_RESERVED slots Eric Auger <eric.auger@linaro.org> - 2016-05-11 15:00 +0200

csiph-web