[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20150929093257.GE9460@ulmo.nvidia.com>
Date: Tue, 29 Sep 2015 11:32:57 +0200
From: Thierry Reding <thierry.reding@...il.com>
To: Tomasz Figa <tfiga@...omium.org>
Cc: iommu@...ts.linux-foundation.org, Joerg Roedel <joro@...tes.org>,
Hiroshi Doyu <hdoyu@...dia.com>,
Stephen Warren <swarren@...dotorg.org>,
Alexandre Courbot <gnurou@...il.com>,
Vince Hsu <vince.h@...dia.com>,
Russell King <rmk+kernel@....linux.org.uk>,
Paul Walmsley <paul@...an.com>,
Mikko Perttunen <mperttunen@...dia.com>,
Tomeu Vizoso <tomeu.vizoso@...labora.com>,
Will Deacon <will.deacon@....com>,
Alex Williamson <alex.williamson@...hat.com>,
Marek Szyprowski <m.szyprowski@...sung.com>,
Arnd Bergmann <arnd@...db.de>,
Antonios Motakis <a.motakis@...tualopensystems.com>,
Olav Haugan <ohaugan@...eaurora.org>,
Nicolas Iooss <nicolas.iooss_linux@....org>,
linux-kernel@...r.kernel.org, linux-tegra@...r.kernel.org,
Rob Clark <robdclark@...il.com>
Subject: Re: [RFC PATCH 1/3] iommu: Add support for out of band flushing
On Tue, Sep 29, 2015 at 02:25:24PM +0900, Tomasz Figa wrote:
> This patch adds a new "flush" callback to iommu_ops, which is supposed
> to perform any necessary flushes within given IOMMU domain to make any
> changes to mappings of given area [iova; iova + size) be reflected to
> IOMMU clients.
>
> The purpose is to let IOMMU drivers skip page-by-page flushes and
> replace it with one flush of full address range on devices which support
> it.
>
> Signed-off-by: Tomasz Figa <tfiga@...omium.org>
> ---
> drivers/iommu/iommu.c | 33 ++++++++++++++++++++++++++++++---
> include/linux/iommu.h | 2 ++
> 2 files changed, 32 insertions(+), 3 deletions(-)
I seem to remember that Rob Clark had proposed something like this back
before it was decided to introduce the ->map_sg() callback instead. I
can't find a reference to the discussion, so perhaps I'm misremembering
but adding Rob Clark in case he has any recollection of why the outcome
was what it was.
> diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c
[...]
> @@ -1389,6 +1410,7 @@ size_t iommu_unmap(struct iommu_domain *domain, unsigned long iova, size_t size)
> unmapped += unmapped_page;
> }
>
> + iommu_flush(domain, orig_iova, unmapped);
> trace_unmap(orig_iova, size, unmapped);
> return unmapped;
> }
> @@ -1419,19 +1441,24 @@ size_t default_iommu_map_sg(struct iommu_domain *domain, unsigned long iova,
> if (!IS_ALIGNED(s->offset, min_pagesz))
> goto out_err;
>
> - ret = iommu_map(domain, iova + mapped, phys, s->length, prot);
> + ret = __iommu_map(domain, iova + mapped, phys, s->length, prot);
> if (ret)
> goto out_err;
>
> mapped += s->length;
> }
>
> + iommu_flush(domain, iova, mapped);
> +
> return mapped;
>
> out_err:
> /* undo mappings already done */
> iommu_unmap(domain, iova, mapped);
>
> + /* flush in case part of our mapping already got cached */
> + iommu_flush(domain, iova, mapped);
> +
> return 0;
>
> }
iommu_unmap() already does an iommu_flush(), so why flush again after
iommu_unmap()?
Thierry
Download attachment "signature.asc" of type "application/pgp-signature" (820 bytes)
Powered by blists - more mailing lists