RE: [PATCH 2/9] iommu/vt-d: add bind_pasid_table function

2017-07-05 Thread Tian, Kevin
> From: Jacob Pan [mailto:jacob.jun@linux.intel.com] > Sent: Wednesday, June 28, 2017 3:48 AM > > Add Intel VT-d ops to the generic iommu_bind_pasid_table API > functions. > > The primary use case is for direct assignment of SVM capable > device. Originated from emulated IOMMU in the guest,

RE: [PATCH v3 2/2] iommu/arm-smmu-v3:Enable ACPI based HiSilicon erratum 161010801

2017-07-05 Thread Shameerali Kolothum Thodi
> -Original Message- > From: Will Deacon [mailto:will.dea...@arm.com] > Sent: Tuesday, July 04, 2017 6:38 PM > To: Shameerali Kolothum Thodi > Cc: lorenzo.pieral...@arm.com; marc.zyng...@arm.com; > sudeep.ho...@arm.com; robin.mur...@arm.com; hanjun@linaro.org; > Gabriele Paoloni;

[RFC PATCH 4/5] iommu/dma: Export non-static functions to use in modules

2017-07-05 Thread Tomasz Figa
There is nothing wrong in having a loadable module implementing DMA API, for example to be used for sub-devices registered by the module. However, most of the functions from dma-iommu do not have their symbols exported, making it impossible to use them from loadable modules. Export all the

[RFC PATCH 0/5] Fixes for loadable modules implementing DMA/IOMMU APIs

2017-07-05 Thread Tomasz Figa
This series attempts to prepare the common DMA mapping helpers, IOMMU subsystem and IOMMU DMA helpers to be used from within loadable modules. It does not introduce any functional changes to the code itself. The only things done are: - exporting related non-static functions, - adding a common

[RFC PATCH 2/5] base: dma-mapping: Provide a function to look up remapped pages

2017-07-05 Thread Tomasz Figa
DMA API implementations, which use the dma_common_*() helpers, typically use them in pair with other helpers, such as iommu_dma_*(). For example, a typical .free() callback needs to retrieve the pages remapped earlier by dma_common_remap() and call iommu_dma_unmap() on them. Currently it is done

[RFC PATCH 5/5] iommu/dma: Add iommu_dma_cleanup()

2017-07-05 Thread Tomasz Figa
In case of loadable modules using dma-iommu helpers, it makes sense to drop the reference to the iova cache on module exit. Add a helper called iommu_dma_cleanup() that undoes the effects of iommu_dma_init(), so that modules can be unloaded cleanly. Signed-off-by: Tomasz Figa

Re: [PATCH 0/8] io-pgtable lock removal

2017-07-05 Thread Will Deacon
On Tue, Jul 04, 2017 at 06:45:17PM -0700, Ray Jui wrote: > Hi Will/Robin, > > Has anything functionally changed between PATCH v2 and v1? I'm seeing a > very different L2 throughput with v2 (in general a lot worse with v2 vs. > v1); however, I'm currently unable to reproduce the TLB sync timed out

RE: [PATCH 3/9] iommu: Introduce iommu do invalidate API function

2017-07-05 Thread Tian, Kevin
> From: Jean-Philippe Brucker [mailto:jean-philippe.bruc...@arm.com] > Sent: Thursday, June 29, 2017 1:08 AM > > On 28/06/17 17:09, Jacob Pan wrote: > > On Wed, 28 Jun 2017 12:08:23 +0200 > > Joerg Roedel wrote: > > > >> On Tue, Jun 27, 2017 at 12:47:57PM -0700, Jacob Pan wrote:

RE: [Qemu-devel] [RFC PATCH 7/8] VFIO: Add new IOCTL for IOMMU TLB invalidate propagation

2017-07-05 Thread Tian, Kevin
> From: Liu, Yi L > Sent: Monday, July 3, 2017 6:31 PM > > Hi Jean, > > > > > > > 2. Define a structure in include/uapi/linux/iommu.h(newly added header > file) > > > > > > struct iommu_tlb_invalidate { > > > __u32 scope; > > > /* pasid-selective invalidation described by @pasid */ > > >

[RFC PATCH 1/5] base: dma-mapping: Export commonly used symbols

2017-07-05 Thread Tomasz Figa
There is nothing wrong in having a loadable module implementing DMA API, for example to be used for sub-devices registered by the module. However, most of the functions from dma-mapping do not have their symbols exported, making it impossible to use them from loadable modules. Export the

[RFC PATCH 3/5] iommu: Export non-static functions to use in modules

2017-07-05 Thread Tomasz Figa
There are some non-static functions potentially useful in IOMMU drivers that do not have their symbols exported. Export them too, so that loadable modules can benefit from them. Use EXPORT_SYMBOL_GPL() for consistency with other exports in the file. Signed-off-by: Tomasz Figa

Re: [Qemu-devel] [RFC PATCH 7/8] VFIO: Add new IOCTL for IOMMU TLB invalidate propagation

2017-07-05 Thread Jean-Philippe Brucker
On 05/07/17 07:45, Tian, Kevin wrote: >> From: Liu, Yi L >> Sent: Monday, July 3, 2017 6:31 PM >> >> Hi Jean, >> >> >>> 2. Define a structure in include/uapi/linux/iommu.h(newly added header >> file) struct iommu_tlb_invalidate { __u32 scope; /* pasid-selective

Re: [PATCH 3/9] iommu: Introduce iommu do invalidate API function

2017-07-05 Thread Jean-Philippe Brucker
On 05/07/17 08:57, Tian, Kevin wrote: >> From: Jean-Philippe Brucker [mailto:jean-philippe.bruc...@arm.com] >> Sent: Thursday, June 29, 2017 1:08 AM >> >> On 28/06/17 17:09, Jacob Pan wrote: >>> On Wed, 28 Jun 2017 12:08:23 +0200 >>> Joerg Roedel wrote: >>> On Tue, Jun 27,

Re: [RFC PATCH 1/5] base: dma-mapping: Export commonly used symbols

2017-07-05 Thread Christoph Hellwig
Please use EXPORT_SYMBOL_GPL for any of these exports, as they are internal linux implementration details by any definition of it. On Wed, Jul 05, 2017 at 04:12:11PM +0900, Tomasz Figa wrote: > There is nothing wrong in having a loadable module implementing DMA API, > for example to be used for

Re: [RFC PATCH 1/5] base: dma-mapping: Export commonly used symbols

2017-07-05 Thread Tomasz Figa
Hi Christoph, Thanks for comments! On Thu, Jul 6, 2017 at 12:17 AM, Christoph Hellwig wrote: > Please use EXPORT_SYMBOL_GPL for any of these exports, as they are > internal linux implementration details by any definition of it. Right. I typically lean towards EXPORT_SYMBOL_GPL(),

Re: [RFC PATCH 4/5] iommu/dma: Export non-static functions to use in modules

2017-07-05 Thread Robin Murphy
On 05/07/17 08:12, Tomasz Figa wrote: > There is nothing wrong in having a loadable module implementing DMA API, > for example to be used for sub-devices registered by the module. However, > most of the functions from dma-iommu do not have their symbols exported, > making it impossible to use them

[PATCH v1 1/4] iommu/tegra: gart: Don't unnecessarily allocate registers context

2017-07-05 Thread Dmitry Osipenko
GART looses it's state only in case of a deepest suspend level. Let's not waste memory if machine doesn't support that suspend level. Signed-off-by: Dmitry Osipenko --- drivers/iommu/tegra-gart.c | 36 +--- 1 file changed, 25 insertions(+), 11

[PATCH v1 3/4] iommu/tegra: gart: Move PFN validation out of spinlock

2017-07-05 Thread Dmitry Osipenko
Validation of page frame number doesn't require protection with a spinlock, let's move it out of spinlock for consistency. Signed-off-by: Dmitry Osipenko --- drivers/iommu/tegra-gart.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git

[PATCH] iommu: Correct iommu_map / iommu_unmap prototypes

2017-07-05 Thread Dmitry Osipenko
Commit 7d3002cc8c16 ("iommu/core: split mapping to page sizes as supported by the hardware") replaced 'int gfp_order' with a 'size_t size' of iommu_map / iommu_unmap function arguments, but missed the function prototypes for the disabled CONFIG_IOMMU_API case, let's correct them for consistency.

[PATCH v1 0/4] iommu/tegra: gart: Couple corrections

2017-07-05 Thread Dmitry Osipenko
I've added an experimental support of the GART to the Tegra DRM driver and it ended up with a very positive result. During the testing of the GART driver I've noticed couple of its minor shortcomings, so here the patches to remedy them. Dmitry Osipenko (4): iommu/tegra: gart: Don't

[PATCH v1 4/4] iommu/tegra: gart: Correct number of unmapped bytes

2017-07-05 Thread Dmitry Osipenko
The iommu_unmap() treats zero bytes number returned by an IOMMU driver as an indicator that unmapping should be stopped. As a result, GART driver unmaps only the first page entry of the whole range, which is incorrect. Signed-off-by: Dmitry Osipenko ---

[PATCH v1 2/4] iommu/tegra: gart: Check whether page is already mapped

2017-07-05 Thread Dmitry Osipenko
Due to a bug, multiple devices may try to map the same IOVA region. We can catch that case by checking that 'VALID' bit of the GART's page entry is unset prior to mapping of the page. Signed-off-by: Dmitry Osipenko --- drivers/iommu/tegra-gart.c | 7 +++ 1 file changed, 7

Re: [RFC PATCH 1/5] base: dma-mapping: Export commonly used symbols

2017-07-05 Thread Tomasz Figa
On Thu, Jul 6, 2017 at 2:20 AM, Christoph Hellwig wrote: > On Thu, Jul 06, 2017 at 12:22:35AM +0900, Tomasz Figa wrote: >> Generally the user is a work in progress that should be posted in a >> very near future. You can find a reference to our downstream tree at >> chromium.org in

Re: [PATCH 0/8] io-pgtable lock removal

2017-07-05 Thread Ray Jui via iommu
Hi Will, On 7/5/17 1:41 AM, Will Deacon wrote: > On Tue, Jul 04, 2017 at 06:45:17PM -0700, Ray Jui wrote: >> Hi Will/Robin, >> >> Has anything functionally changed between PATCH v2 and v1? I'm seeing a >> very different L2 throughput with v2 (in general a lot worse with v2 vs. >> v1); however,

[PATCH] iommu/amd: Enable ga_log_intr when enabling guest_mode

2017-07-05 Thread Suravee Suthikulpanit
IRTE[GALogIntr] bit should set when enabling guest_mode, which enables IOMMU to generate entry in GALog when IRTE[IsRun] is not set, and send an interrupt to notify IOMMU driver. Signed-off-by: Suravee Suthikulpanit Cc: Joerg Roedel Fixes:

Re: [RFC PATCH 1/5] base: dma-mapping: Export commonly used symbols

2017-07-05 Thread Christoph Hellwig
On Thu, Jul 06, 2017 at 12:22:35AM +0900, Tomasz Figa wrote: > Generally the user is a work in progress that should be posted in a > very near future. You can find a reference to our downstream tree at > chromium.org in the cover letter. Obviously I don't mind including > patches from this series

Re: [Qemu-devel] [RFC PATCH 7/8] VFIO: Add new IOCTL for IOMMU TLB invalidate propagation

2017-07-05 Thread Alex Williamson
On Wed, 5 Jul 2017 13:42:03 +0100 Jean-Philippe Brucker wrote: > On 05/07/17 07:45, Tian, Kevin wrote: > >> From: Liu, Yi L > >> Sent: Monday, July 3, 2017 6:31 PM > >> > >> Hi Jean, > >> > >> > >>> > 2. Define a structure in

Re: DMA_ATTR_WEAK_ORDERING defintion, was Re: [PATCH] nvme: set DMA_ATTR_WEAK_ORDERING attribute on dma buffers

2017-07-05 Thread Christoph Hellwig
On Tue, Jun 27, 2017 at 04:46:31PM -0400, chris hyser wrote: > I put this in for SPARC. In our case the host bridge/RC itself follows very > strict ordering unless the relaxed order bit is set in the TLP. This works > great for devices that actually allow the driver to enable it. We however >

RE: [Qemu-devel] [RFC PATCH 7/8] VFIO: Add new IOCTL for IOMMU TLB invalidate propagation

2017-07-05 Thread Tian, Kevin
> From: Alex Williamson [mailto:alex.william...@redhat.com] > Sent: Thursday, July 6, 2017 1:28 AM > > On Wed, 5 Jul 2017 13:42:03 +0100 > Jean-Philippe Brucker wrote: > > > On 05/07/17 07:45, Tian, Kevin wrote: > > >> From: Liu, Yi L > > >> Sent: Monday, July 3,

RE: [Qemu-devel] [RFC PATCH 7/8] VFIO: Add new IOCTL for IOMMU TLB invalidate propagation

2017-07-05 Thread Tian, Kevin
> From: Jean-Philippe Brucker > Sent: Wednesday, July 5, 2017 8:42 PM > > On 05/07/17 07:45, Tian, Kevin wrote: > >> From: Liu, Yi L > >> Sent: Monday, July 3, 2017 6:31 PM > >> > >> Hi Jean, > >> > >> > >>> > 2. Define a structure in include/uapi/linux/iommu.h(newly added > header > >>