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

2017-07-29 Thread Dmitry Osipenko
On 29.07.2017 14:04, Dmitry Osipenko wrote: > On 25.07.2017 17:43, Joerg Roedel wrote: >> On Wed, Jul 05, 2017 at 07:29:44PM +0300, Dmitry Osipenko wrote: >>> I've added an experimental support of the GART to the Tegra DRM driver >>> and it ended up with a very positive

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

2017-07-29 Thread Dmitry Osipenko
On 25.07.2017 17:43, Joerg Roedel wrote: > On Wed, Jul 05, 2017 at 07:29:44PM +0300, Dmitry Osipenko wrote: >> 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

Re: [PATCH 2/2] iommu/tegra-gart: Add support for struct iommu_device

2017-08-16 Thread Dmitry Osipenko
-off-by: Joerg Roedel <jroe...@suse.de> > --- > drivers/iommu/tegra-gart.c | 26 ++ > 1 file changed, 26 insertions(+) > Reviewed-by: Dmitry Osipenko <dig...@gmail.com> Tested-by: Dmitry Osipenko <dig...@gmail.com> > diff --git a/dri

Re: [PATCH 3/4] iommu/tegra-gart: Add iommu_group support

2017-07-26 Thread Dmitry Osipenko
ain existing behaviour with respect to the API. > > Signed-off-by: Robin Murphy <robin.mur...@arm.com> > --- > drivers/iommu/tegra-gart.c | 19 +++ > 1 file changed, 19 insertions(+) > Tested-by: Dmitry Osipenko <dig...@gmail.com> -- Dmitry ___

[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 <dig...@gmail.com> --- drivers/iommu/tegra-gart.c | 36 +--- 1 file changed, 25 insertions(

[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 <dig...@gmail.com> --- drivers/iommu/tegra-gart.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/iommu

[PATCH] iommu: Correct iommu_map / iommu_unmap prototypes

2017-07-05 Thread Dmitry Osipenko
onsistency. Signed-off-by: Dmitry Osipenko <dig...@gmail.com> --- include/linux/iommu.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/linux/iommu.h b/include/linux/iommu.h index 2cb54adc4a33..f1ce8e517d8d 100644 --- a/include/linux/iommu.h +++ b/inclu

[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 <dig...@gmail.com> --- drivers/iommu

[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 <dig...@gmail.com> --- drivers/iommu/tegra-gart.c | 7 +++ 1 file chan

Re: [PATCH 2/2] iommu/tegra-gart: Add support for struct iommu_device

2017-08-17 Thread Dmitry Osipenko
On 17.08.2017 16:52, Thierry Reding wrote: > On Thu, Aug 17, 2017 at 01:21:52AM +0300, Dmitry Osipenko wrote: >> Hello Joerg, >> >> On 10.08.2017 01:29, Joerg Roedel wrote: >>> From: Joerg Roedel <jroe...@suse.de> >>> >>> Add

Re: [PATCH v2 1/2] iommu/tegra: gart: Optionally check for overwriting of page mappings

2017-10-13 Thread Dmitry Osipenko
On 13.10.2017 11:38, Joerg Roedel wrote: > On Thu, Oct 12, 2017 at 05:27:26PM +0300, Dmitry Osipenko wrote: >> I'm not talking about any specific bug, but in general if allocator re-maps >> already mapped region or unmaps the wrong-and-used region. I had those >>

Re: [PATCH v2 1/2] iommu/tegra: gart: Optionally check for overwriting of page mappings

2017-10-12 Thread Dmitry Osipenko
On 10.10.2017 12:53, Joerg Roedel wrote: > On Wed, Oct 04, 2017 at 04:02:31AM +0300, Dmitry Osipenko wrote: >> Due to a bug in IOVA allocator, page mapping could accidentally overwritten. >> We can catch this case by checking 'VALID' bit of GART's page entry prior to >> map

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

2017-09-26 Thread Dmitry Osipenko
On 26.09.2017 19:07, Thierry Reding wrote: > On Tue, Sep 26, 2017 at 04:49:52PM +0300, Dmitry Osipenko wrote: >> On 26.09.2017 14:06, Thierry Reding wrote: >>> On Wed, Jul 05, 2017 at 07:29:46PM +0300, Dmitry Osipenko wrote: >>>> Due to a bug, multiple devices may t

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

2017-09-26 Thread Dmitry Osipenko
On 26.09.2017 14:06, Thierry Reding wrote: > On Wed, Jul 05, 2017 at 07:29:46PM +0300, Dmitry Osipenko wrote: >> 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 >> u

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

2017-09-26 Thread Dmitry Osipenko
On 26.09.2017 14:19, Thierry Reding wrote: > On Wed, Jul 05, 2017 at 07:29:45PM +0300, Dmitry Osipenko wrote: >> 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-o

[PATCH v2 2/2] iommu/tegra: gart: Move PFN validation out of spinlock

2017-10-03 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 <dig...@gmail.com> Acked-by: Thierry Reding <tred...@nvidia.com> --- drivers/iommu/tegra-gart.c | 4 ++-- 1 file changed, 2 inse

[PATCH v2 1/2] iommu/tegra: gart: Optionally check for overwriting of page mappings

2017-10-03 Thread Dmitry Osipenko
CONFIG_TEGRA_IOMMU_GART_DEBUG option. Signed-off-by: Dmitry Osipenko <dig...@gmail.com> --- drivers/iommu/Kconfig | 9 + drivers/iommu/tegra-gart.c | 16 +++- 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/drivers/iommu/Kconfig b/drivers/iommu/Kconfig index f3a213

[PATCH v2 0/2] TEGRA GART cleanup and new debug option

2017-10-03 Thread Dmitry Osipenko
not entirely correct. - Replaced "Correct number of unmapped bytes" and "Check whether page is already mapped" patches with a new GART debug Kconfig option patch. Dmitry Osipenko (2): iommu/tegra: gart: Optionally check for overwriting of page mappings io

[PATCH v2 1/2] iommu/tegra: gart: Add optional debug checking for overwriting of page mappings

2017-10-03 Thread Dmitry Osipenko
CONFIG_TEGRA_IOMMU_GART_DEBUG option. Signed-off-by: Dmitry Osipenko <dig...@gmail.com> --- drivers/iommu/Kconfig | 9 + drivers/iommu/tegra-gart.c | 16 +++- 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/drivers/iommu/Kconfig b/drivers/iommu/Kconfig index f3a213

Re: [PATCH v2 1/2] iommu/tegra: gart: Add optional debug checking for overwriting of page mappings

2017-10-03 Thread Dmitry Osipenko
On 04.10.2017 04:02, Dmitry Osipenko wrote: > Due to a bug in IOVA allocator, page mapping could accidentally overwritten. > We can catch this case by checking 'VALID' bit of GART's page entry prior to > mapping of a page. Since that check introduces a noticeable performance > impac

Re: [PATCH v1 4/4] iommu/tegra: gart: Optimize map/unmap

2018-05-06 Thread Dmitry Osipenko
On 27.04.2018 15:36, Robin Murphy wrote: > Hi Thierry, > > On 27/04/18 11:02, Thierry Reding wrote: >> On Mon, Apr 09, 2018 at 11:07:22PM +0300, Dmitry Osipenko wrote: >>> Currently GART writes one page entry at a time. More optimal would be to >>> aggregat

Re: [PATCH v1 4/4] iommu/tegra: gart: Optimize map/unmap

2018-05-07 Thread Dmitry Osipenko
On 07.05.2018 10:59, Joerg Roedel wrote: > On Fri, Apr 27, 2018 at 12:02:02PM +0200, Thierry Reding wrote: >> Joerg, I've gone over the git log and header files and I see no mention >> of why the TLB flush interface isn't used for mapping. Do you recall any >> special reasons why the same

Re: [PATCH v1 4/4] iommu/tegra: gart: Optimize map/unmap

2018-04-27 Thread Dmitry Osipenko
On 27.04.2018 13:02, Thierry Reding wrote: > On Mon, Apr 09, 2018 at 11:07:22PM +0300, Dmitry Osipenko wrote: >> Currently GART writes one page entry at a time. More optimal would be to >> aggregate the writes and flush BUS buffer in the end, this gives map/unmap >> 10-4

Re: [PATCH v1 7/9] iommu/tegra: gart: Provide single domain and group for all devices

2018-05-11 Thread Dmitry Osipenko
On 08.05.2018 21:16, Dmitry Osipenko wrote: > GART aperture is shared by all devices, hence there is a single IOMMU > domain and group shared by these devices. Allocation of a group per > device only wastes resources and allowance of having more than one domain > is simply wrong b

[PATCH v1 7/9] iommu/tegra: gart: Provide single domain and group for all devices

2018-05-11 Thread Dmitry Osipenko
On 11.05.2018 15:32, Robin Murphy wrote: > On 08/05/18 19:16, Dmitry Osipenko wrote: >> GART aperture is shared by all devices, hence there is a single IOMMU >> domain and group shared by these devices. Allocation of a group per >> device only wastes resources and allowance of

[PATCH v1 8/9] iommu: Introduce iotlb_sync_map callback

2018-05-11 Thread Dmitry Osipenko
On 11.05.2018 16:02, Robin Murphy wrote: > On 08/05/18 19:16, Dmitry Osipenko wrote: >> Introduce iotlb_sync_map() callback that is invoked in the end of >> iommu_map(). This new callback allows IOMMU drivers to avoid syncing >> on mapping of each contiguous chunk and sync on

Re: [PATCH v1 6/9] iommu/tegra: gart: Ignore devices without IOMMU phandle in DT

2018-05-11 Thread Dmitry Osipenko
Hi Robin, On 11.05.2018 14:34, Robin Murphy wrote: > Hi Dmitry, > > On 08/05/18 19:16, Dmitry Osipenko wrote: >> GART can't handle all devices, ignore devices that aren't related to GART. >> Device tree must explicitly assign GART IOMMU to the devices. >> >> Si

Re: [PATCH v1 4/4] iommu/tegra: gart: Optimize map/unmap

2018-05-07 Thread Dmitry Osipenko
On 07.05.2018 11:04, Joerg Roedel wrote: > On Mon, May 07, 2018 at 12:19:01AM +0300, Dmitry Osipenko wrote: >> Probably the best variant would be to give an explicit control over syncing >> to a >> user of the IOMMU API, like for example device driver may perform multiple >

[PATCH v1 1/9] memory: tegra: Provide facility for integration with the GART driver

2018-05-08 Thread Dmitry Osipenko
In order to report clients name and access direction on GART page fault, MC driver needs to access GART registers. Add facility that provides access to the GART. Signed-off-by: Dmitry Osipenko <dig...@gmail.com> --- drivers/memory/tegra/mc.c | 26 +++--- include/soc

[PATCH v1 0/9] Tegra GART driver clean up and optimization

2018-05-08 Thread Dmitry Osipenko
dead code, allowing to have one IOMMU domain at max, etc. 4. This series introduces and utilizes iotlb_sync_map() callback that was previously suggested by Joerg Roedel in [1]. [1] https://www.spinics.net/lists/linux-tegra/msg32914.html Dmitry Osipenko (9): memory: tegra: Provid

[PATCH v1 4/9] iommu/tegra: gart: Remove pr_fmt and clean up includes

2018-05-08 Thread Dmitry Osipenko
Remove unneeded 'includes' and sort them in alphabet order. Also remove pr_fmt since there is no pr_xxx() and it doesn't affect dev_xxx(). Signed-off-by: Dmitry Osipenko <dig...@gmail.com> --- drivers/iommu/tegra-gart.c | 17 + 1 file changed, 5 insertions(+), 12 del

[PATCH v1 2/9] iommu/tegra: gart: Provide access to Memory Controller driver

2018-05-08 Thread Dmitry Osipenko
GART contains registers needed by the Memory Controller driver. Provide access to the MC driver by utilizing its GART-integration facility. Signed-off-by: Dmitry Osipenko <dig...@gmail.com> --- drivers/iommu/tegra-gart.c | 23 +++ 1 file changed, 23 insertions(+) diff

[PATCH v1 5/9] iommu/tegra: gart: Clean up driver probe failure unwinding

2018-05-08 Thread Dmitry Osipenko
Properly clean up allocated resources on driver probe failure. Signed-off-by: Dmitry Osipenko <dig...@gmail.com> --- drivers/iommu/tegra-gart.c | 13 ++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/drivers/iommu/tegra-gart.c b/drivers/iommu/tegra-gart.c

[PATCH v1 3/9] iommu/tegra: gart: Remove code related to module unloading

2018-05-08 Thread Dmitry Osipenko
GART driver is built-in, hence it can't be unloaded. This patch merely removes the dead code. Signed-off-by: Dmitry Osipenko <dig...@gmail.com> --- drivers/iommu/tegra-gart.c | 25 +++-- 1 file changed, 3 insertions(+), 22 deletions(-) diff --git a/drivers/iommu/tegra-

[PATCH v1 6/9] iommu/tegra: gart: Ignore devices without IOMMU phandle in DT

2018-05-08 Thread Dmitry Osipenko
GART can't handle all devices, ignore devices that aren't related to GART. Device tree must explicitly assign GART IOMMU to the devices. Signed-off-by: Dmitry Osipenko <dig...@gmail.com> --- drivers/iommu/tegra-gart.c | 33 - 1 file changed, 32 insertions

[PATCH v1 7/9] iommu/tegra: gart: Provide single domain and group for all devices

2018-05-08 Thread Dmitry Osipenko
t; domains will stomp on each other. Signed-off-by: Dmitry Osipenko <dig...@gmail.com> --- drivers/iommu/tegra-gart.c | 107 + 1 file changed, 24 insertions(+), 83 deletions(-) diff --git a/drivers/iommu/tegra-gart.c b/drivers/iommu/tegra-gart.c index 5b2d276203

[PATCH v1 9/9] iommu/tegra: gart: Optimize mapping / unmapping performance

2018-05-08 Thread Dmitry Osipenko
Currently GART writes one page entry at a time. More optimal would be to aggregate the writes and flush BUS buffer in the end, this gives map/unmap 10-40% (depending on size of mapping) performance boost compared to a flushing after each entry update. Signed-off-by: Dmitry Osipenko <

[PATCH v1 8/9] iommu: Introduce iotlb_sync_map callback

2018-05-08 Thread Dmitry Osipenko
Introduce iotlb_sync_map() callback that is invoked in the end of iommu_map(). This new callback allows IOMMU drivers to avoid syncing on mapping of each contiguous chunk and sync only when whole mapping is completed, optimizing performance of the mapping operation. Signed-off-by: Dmitry Osipenko

Re: [PATCH v1 4/4] iommu/tegra: gart: Optimize map/unmap

2018-05-07 Thread Dmitry Osipenko
On 07.05.2018 18:51, Dmitry Osipenko wrote: [snip] > Secondly, the interesting part is that mapping / unmapping of a contiguous > allocation (CMA using DMA API) is slower by ~50% then doing it for a sparse > allocation (get_pages using bare IOMMU API). /I think/ it's a sh

Re: [PATCH v1 7/9] iommu/tegra: gart: Provide single domain and group for all devices

2018-05-16 Thread Dmitry Osipenko
On 14.05.2018 21:18, Robin Murphy wrote: > On 11/05/18 21:05, Dmitry Osipenko wrote: >> On 11.05.2018 15:32, Robin Murphy wrote: >>> On 08/05/18 19:16, Dmitry Osipenko wrote: >>>> GART aperture is shared by all devices, hence there is a single IOMMU >>>>

Re: [RFC PATCH v1 0/6] Resolve unwanted DMA backing with IOMMU

2018-08-02 Thread Dmitry Osipenko
On Friday, 27 July 2018 20:16:53 MSK Dmitry Osipenko wrote: > On Friday, 27 July 2018 20:03:26 MSK Jordan Crouse wrote: > > On Fri, Jul 27, 2018 at 05:02:37PM +0100, Robin Murphy wrote: > > > On 27/07/18 15:10, Dmitry Osipenko wrote: > > > >On Friday, 27 July 2018

Re: [RFC PATCH v1 0/6] Resolve unwanted DMA backing with IOMMU

2018-07-28 Thread Dmitry Osipenko
On Friday, 27 July 2018 20:16:53 MSK Dmitry Osipenko wrote: > On Friday, 27 July 2018 20:03:26 MSK Jordan Crouse wrote: > > On Fri, Jul 27, 2018 at 05:02:37PM +0100, Robin Murphy wrote: > > > On 27/07/18 15:10, Dmitry Osipenko wrote: > > > >On Friday, 27 July 2018

[PATCH v1] iommu/ipmmu-vmsa: Don't register as BUS IOMMU if machine doesn't have IPMMU-VMSA

2018-07-26 Thread Dmitry Osipenko
This fixes kernel crashing on NVIDIA Tegra if kernel is compiled in a multiplatform configuration and IPMMU-VMSA driver is enabled. Cc: # v3.20+ Signed-off-by: Dmitry Osipenko --- drivers/iommu/ipmmu-vmsa.c | 7 +++ 1 file changed, 7 insertions(+) diff --git a/drivers/iommu/ipmmu-vmsa.c b

[RFC PATCH v1 0/6] Resolve unwanted DMA backing with IOMMU

2018-07-26 Thread Dmitry Osipenko
device driver structure that allows device drivers to explicitly convey to the drivers core that the implicit IOMMU backing for devices must not happen. Dmitry Osipenko (6): driver core: Add option for disabling of backing devices DMA with IOMMU of/device: Don't back devices DMA with IOMMU

[RFC PATCH v1 2/6] of/device: Don't back devices DMA with IOMMU if that's undesired by driver

2018-07-26 Thread Dmitry Osipenko
Respect device driver requirement for device DMA not to be implicitly backed with IOMMU by skipping the backing setup for drivers that do not want that. Signed-off-by: Dmitry Osipenko --- drivers/of/device.c | 7 +++ 1 file changed, 7 insertions(+) diff --git a/drivers/of/device.c b

[RFC PATCH v1 1/6] driver core: Add option for disabling of backing devices DMA with IOMMU

2018-07-26 Thread Dmitry Osipenko
This allows device drivers to convey the drivers core that implicit IOMMU backing for devices DMA shouldn't happen. It is needed for drivers that manage IOMMU by themselves, like for example it is needed by the NVIDIA Tegra GPU driver. Signed-off-by: Dmitry Osipenko --- include/linux/device.h

[RFC PATCH v1 3/6] drm/tegra: Avoid implicit DMA backing with IOMMU

2018-07-26 Thread Dmitry Osipenko
Tegra DRM manages IOMMU by itself, backing DMA with IOMMU by the drivers core breaks the Tegra driver. Signed-off-by: Dmitry Osipenko --- drivers/gpu/drm/tegra/dc.c | 1 + drivers/gpu/drm/tegra/gr2d.c | 1 + drivers/gpu/drm/tegra/gr3d.c | 1 + drivers/gpu/drm/tegra/vic.c | 1 + 4 files

[RFC PATCH v1 4/6] gpu: host1x: Avoid implicit DMA backing with IOMMU

2018-07-26 Thread Dmitry Osipenko
Host1x driver manages IOMMU by itself, backing DMA with IOMMU by the drivers core breaks the Host1x driver. Signed-off-by: Dmitry Osipenko --- drivers/gpu/host1x/dev.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/gpu/host1x/dev.c b/drivers/gpu/host1x/dev.c index afabd33a48d9

[RFC PATCH v1 6/6] Revert "drm/nouveau: tegra: Detach from ARM DMA/IOMMU mapping"

2018-07-26 Thread Dmitry Osipenko
Improper DMA backing with IOMMU has been resolved now using the new drivers core option that allows to avoid the implicit backing, hence detaching isn't necessary anymore. This reverts commit b59fb482b52269977ee5de205308e5b236a03917. Signed-off-by: Dmitry Osipenko --- drivers/gpu/drm/nouveau

[RFC PATCH v1 5/6] drm/nouveau: tegra: Universally avoid implicit DMA backing with IOMMU

2018-07-26 Thread Dmitry Osipenko
rm64 which doesn't have that config option. Drivers core now allows to avoid the implicit backing, that is a universal solution unlike the current variant with the detaching. Signed-off-by: Dmitry Osipenko --- drivers/gpu/drm/nouveau/nouveau_platform.c | 1 + 1 file changed, 1 insertion(+) diff --git

Re: [RFC PATCH v1 0/6] Resolve unwanted DMA backing with IOMMU

2018-07-27 Thread Dmitry Osipenko
On Friday, 27 July 2018 12:03:28 MSK Will Deacon wrote: > On Fri, Jul 27, 2018 at 10:25:13AM +0200, Joerg Roedel wrote: > > On Fri, Jul 27, 2018 at 02:16:18AM +0300, Dmitry Osipenko wrote: > > > The proposed solution adds a new option to the base device driver > > > s

Re: [RFC PATCH v1 0/6] Resolve unwanted DMA backing with IOMMU

2018-07-27 Thread Dmitry Osipenko
On Friday, 27 July 2018 20:03:26 MSK Jordan Crouse wrote: > On Fri, Jul 27, 2018 at 05:02:37PM +0100, Robin Murphy wrote: > > On 27/07/18 15:10, Dmitry Osipenko wrote: > > >On Friday, 27 July 2018 12:03:28 MSK Will Deacon wrote: > > >>On Fri, Jul 27, 2018 at 10:25:

[PATCH v2 4/8] iommu/tegra: gart: Remove pr_fmt and clean up includes

2018-08-04 Thread Dmitry Osipenko
Remove unneeded headers inclusion and sort the headers in alphabet order. Remove pr_fmt macro since there is no pr_*() in the code and it doesn't affect dev_*() functions. Signed-off-by: Dmitry Osipenko --- drivers/iommu/tegra-gart.c | 17 + 1 file changed, 5 insertions(+), 12

[PATCH v2 3/8] iommu/tegra: gart: Clean up drivers module code

2018-08-04 Thread Dmitry Osipenko
and actually nothing should cause the deferred probe. Signed-off-by: Dmitry Osipenko --- drivers/iommu/tegra-gart.c | 27 --- 1 file changed, 4 insertions(+), 23 deletions(-) diff --git a/drivers/iommu/tegra-gart.c b/drivers/iommu/tegra-gart.c index f8b653e25914

[PATCH v2 7/8] iommu: Introduce iotlb_sync_map callback

2018-08-04 Thread Dmitry Osipenko
Introduce iotlb_sync_map() callback that is invoked in the end of iommu_map(). This new callback allows IOMMU drivers to avoid syncing after mapping of each contiguous chunk and sync only when the whole mapping is completed, optimizing performance of the mapping operation. Signed-off-by: Dmitry

[PATCH v2 8/8] iommu/tegra: gart: Optimize mapping / unmapping performance

2018-08-04 Thread Dmitry Osipenko
Currently GART writes one page entry at a time. More optimal would be to aggregate the writes and flush BUS buffer in the end, this gives map/unmap 10-40% performance boost (depending on size of mapping) in comparison to flushing after each page entry update. Signed-off-by: Dmitry Osipenko

[PATCH v2 6/8] iommu/tegra: gart: Ignore devices without IOMMU phandle in DT

2018-08-04 Thread Dmitry Osipenko
GART can't handle all devices, hence ignore devices that aren't related to GART. IOMMU phandle must be explicitly assign to devices in the device tree. Signed-off-by: Dmitry Osipenko --- drivers/iommu/tegra-gart.c | 14 +- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git

[PATCH v2 5/8] iommu/tegra: gart: Clean up driver probe errors handling

2018-08-04 Thread Dmitry Osipenko
Properly clean up allocated resources on the drivers probe failure and remove unneeded checks. Signed-off-by: Dmitry Osipenko --- drivers/iommu/tegra-gart.c | 16 ++-- 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/drivers/iommu/tegra-gart.c b/drivers/iommu/tegra

[PATCH v2 0/8] Tegra GART driver clean up and optimization

2018-08-04 Thread Dmitry Osipenko
switching of virtual IOMMU domains. Some very minor code cleanups, reworded commit messages. Dmitry Osipenko (8): memory: tegra: Provide facility for integration with the GART driver iommu/tegra: gart: Provide access to Memory Controller driver iommu/tegra: gart: Clean up drivers modul

[PATCH v2 1/8] memory: tegra: Provide facility for integration with the GART driver

2018-08-04 Thread Dmitry Osipenko
In order to report clients name and access direction on GART's page fault, MC driver need to access GART registers. Add facility that provides access to the GART. Signed-off-by: Dmitry Osipenko --- drivers/memory/tegra/mc.c | 26 +++--- include/soc/tegra/mc.h| 13

[PATCH v2 2/8] iommu/tegra: gart: Provide access to Memory Controller driver

2018-08-04 Thread Dmitry Osipenko
GART contain registers needed by the Memory Controller driver, provide access to the MC driver by utilizing its GART-integration facility. Signed-off-by: Dmitry Osipenko --- drivers/iommu/tegra-gart.c | 23 +++ 1 file changed, 23 insertions(+) diff --git a/drivers/iommu

Re: [RFC PATCH v1 0/6] Resolve unwanted DMA backing with IOMMU

2018-07-27 Thread Dmitry Osipenko
On Friday, 27 July 2018 21:31:34 MSK Joerg Roedel wrote: > On Fri, Jul 27, 2018 at 11:13:31AM -0600, Rob Herring wrote: > > I don't follow why we need a property rather than being implied by the > > device's (the GPU) compatible string. > > There might be devices where either setup works, with or

Re: [PATCH v2 2/8] iommu/tegra: gart: Provide access to Memory Controller driver

2018-08-09 Thread Dmitry Osipenko
On Thursday, 9 August 2018 14:17:46 MSK Thierry Reding wrote: > On Sat, Aug 04, 2018 at 05:29:57PM +0300, Dmitry Osipenko wrote: > > GART contain registers needed by the Memory Controller driver, provide > > access to the MC driver by utilizing its GART-integration facility. >

Re: [PATCH v2 2/8] iommu/tegra: gart: Provide access to Memory Controller driver

2018-08-09 Thread Dmitry Osipenko
On Thursday, 9 August 2018 17:52:06 MSK Thierry Reding wrote: > On Thu, Aug 09, 2018 at 05:22:59PM +0300, Dmitry Osipenko wrote: > > On Thursday, 9 August 2018 16:59:24 MSK Thierry Reding wrote: > > > On Thu, Aug 09, 2018 at 02:39:03PM +0300, Dmitry Osipenko wrote: > > &

Re: [PATCH v2 2/8] iommu/tegra: gart: Provide access to Memory Controller driver

2018-08-09 Thread Dmitry Osipenko
On Thursday, 9 August 2018 16:59:24 MSK Thierry Reding wrote: > On Thu, Aug 09, 2018 at 02:39:03PM +0300, Dmitry Osipenko wrote: > > On Thursday, 9 August 2018 14:17:46 MSK Thierry Reding wrote: > > > On Sat, Aug 04, 2018 at 05:29:57PM +0300, Dmitry Osipenko wrote: > > &g

Re: [RFC PATCH v1 0/6] Resolve unwanted DMA backing with IOMMU

2018-08-15 Thread Dmitry Osipenko
On Friday, 3 August 2018 18:43:41 MSK Robin Murphy wrote: > On 02/08/18 19:24, Dmitry Osipenko wrote: > > On Friday, 27 July 2018 20:16:53 MSK Dmitry Osipenko wrote: > >> On Friday, 27 July 2018 20:03:26 MSK Jordan Crouse wrote: > >>> On Fri, Jul 27, 2018 at 05:02:

Re: [PATCH v3 06/19] dt-bindings: memory: tegra: Squash tegra20-gart into tegra20-mc

2018-08-20 Thread Dmitry Osipenko
On 20.08.2018 22:12, Rob Herring wrote: > On Sat, Aug 18, 2018 at 06:54:17PM +0300, Dmitry Osipenko wrote: >> Splitting GART and Memory Controller wasn't a good decision that was made >> back in the day. Given that the GART driver hasn't ever been used by >> anything in t

Re: [PATCH v3 06/19] dt-bindings: memory: tegra: Squash tegra20-gart into tegra20-mc

2018-08-20 Thread Dmitry Osipenko
On 20.08.2018 22:27, Dmitry Osipenko wrote: > On 20.08.2018 22:12, Rob Herring wrote: >> On Sat, Aug 18, 2018 at 06:54:17PM +0300, Dmitry Osipenko wrote: >>> Splitting GART and Memory Controller wasn't a good decision that was made >>> back in the day. Given that the G

Re: [PATCH v3 06/19] dt-bindings: memory: tegra: Squash tegra20-gart into tegra20-mc

2018-08-28 Thread Dmitry Osipenko
On 28.08.2018 13:47, Thierry Reding wrote: > On Mon, Aug 20, 2018 at 10:35:54PM +0300, Dmitry Osipenko wrote: >> On 20.08.2018 22:27, Dmitry Osipenko wrote: >>> On 20.08.2018 22:12, Rob Herring wrote: >>>> On Sat, Aug 18, 2018 at 06:54:17PM +0300, Dmitry Osipen

[PATCH v3 00/19] IOMMU: Tegra GART driver clean up and optimization

2018-08-18 Thread Dmitry Osipenko
sparent context switching of virtual IOMMU domains. Some very minor code cleanups, reworded commit messages. Dmitry Osipenko (19): iommu/tegra: gart: Remove pr_fmt and clean up includes iommu/tegra: gart: Clean up driver probe errors handling iommu/tegra: gart: Ignore devices without IOM

[PATCH v3 03/19] iommu/tegra: gart: Ignore devices without IOMMU phandle in DT

2018-08-18 Thread Dmitry Osipenko
GART can't handle all devices, hence ignore devices that aren't related to GART. IOMMU phandle must be explicitly assign to devices in the device tree. Signed-off-by: Dmitry Osipenko --- drivers/iommu/tegra-gart.c | 14 +- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git

[PATCH v3 01/19] iommu/tegra: gart: Remove pr_fmt and clean up includes

2018-08-18 Thread Dmitry Osipenko
Remove unneeded headers inclusion and sort the headers in alphabet order. Remove pr_fmt macro since there is no pr_*() in the code and it doesn't affect dev_*() functions. Signed-off-by: Dmitry Osipenko --- drivers/iommu/tegra-gart.c | 17 + 1 file changed, 5 insertions(+), 12

[PATCH v3 06/19] dt-bindings: memory: tegra: Squash tegra20-gart into tegra20-mc

2018-08-18 Thread Dmitry Osipenko
there is a DT ABI change for the Memory Controller that allows not to break newer kernels using older DT by introducing a new required property, the memory clock. Adding the new clock property also puts the tegra20-mc binding in line with the bindings of the later Tegra generations. Signed-off-by: Dmitry

[PATCH v3 04/19] iommu: Introduce iotlb_sync_map callback

2018-08-18 Thread Dmitry Osipenko
Introduce iotlb_sync_map() callback that is invoked in the end of iommu_map(). This new callback allows IOMMU drivers to avoid syncing after mapping of each contiguous chunk and sync only when the whole mapping is completed, optimizing performance of the mapping operation. Signed-off-by: Dmitry

[PATCH v3 05/19] iommu/tegra: gart: Optimize mapping / unmapping performance

2018-08-18 Thread Dmitry Osipenko
Currently GART writes one page entry at a time. More optimal would be to aggregate the writes and flush BUS buffer in the end, this gives map/unmap 10-40% performance boost (depending on size of mapping) in comparison to flushing after each page entry update. Signed-off-by: Dmitry Osipenko

[PATCH v3 08/19] memory: tegra: Don't invoke Tegra30+ specific memory timing setup on Tegra20

2018-08-18 Thread Dmitry Osipenko
This fixes irrelevant "tegra-mc 7000f000.memory-controller: no memory timings for RAM code 0 registered" warning message during of kernels boot-up on Tegra20. Fixes: a8d502fd3348 ("memory: tegra: Squash tegra20-mc into common tegra-mc driver") Signed-off-by: Dmitry Osipenko

[PATCH v3 09/19] memory: tegra: Adapt to Tegra20 device-tree binding changes

2018-08-18 Thread Dmitry Osipenko
The tegra20-mc DT binding has been changed, GART has been squashed into Memory Controller and now the clock property is mandatory for Tegra20. Adapt driver the to DT changes. Signed-off-by: Dmitry Osipenko --- drivers/memory/tegra/mc.c | 19 +++ drivers/memory/tegra/mc.h | 6

[PATCH v3 07/19] ARM: dts: tegra20: Update Memory Controller node to the new binding

2018-08-18 Thread Dmitry Osipenko
Device tree binding of Memory Controller has been changed: GART has been squashed into the MC, there are a new mandatory clock and #iommu-cells properties. Signed-off-by: Dmitry Osipenko --- arch/arm/boot/dts/tegra20.dtsi | 13 + 1 file changed, 5 insertions(+), 8 deletions(-) diff

[PATCH v3 02/19] iommu/tegra: gart: Clean up driver probe errors handling

2018-08-18 Thread Dmitry Osipenko
Properly clean up allocated resources on the drivers probe failure and remove unneeded checks. Signed-off-by: Dmitry Osipenko --- drivers/iommu/tegra-gart.c | 16 ++-- 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/drivers/iommu/tegra-gart.c b/drivers/iommu/tegra

[PATCH v3 12/19] iommu/tegra: gart: Fix spinlock recursion

2018-08-18 Thread Dmitry Osipenko
Fix spinlock recursion bug that happens on IOMMU domain destruction if any of the allocated domains have devices attached to them. Signed-off-by: Dmitry Osipenko --- drivers/iommu/tegra-gart.c | 24 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/drivers

[PATCH v3 16/19] iommu/tegra: gart: Prepend error/debug messages with "GART:"

2018-08-18 Thread Dmitry Osipenko
from the MC. Signed-off-by: Dmitry Osipenko --- drivers/iommu/tegra-gart.c | 36 ++-- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/drivers/iommu/tegra-gart.c b/drivers/iommu/tegra-gart.c index d019ae8ecfc9..284cddf90888 100644 --- a/drivers/iomm

[PATCH v3 15/19] iommu/tegra: gart: Don't use managed resources

2018-08-18 Thread Dmitry Osipenko
GART is a part of the Memory Controller driver that is always built-in, hence there is no benefit from the use of managed resources. Signed-off-by: Dmitry Osipenko --- drivers/iommu/tegra-gart.c | 12 +++- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/drivers/iommu/tegra

[PATCH v3 14/19] iommu/tegra: gart: Allow only one active domain at a time

2018-08-18 Thread Dmitry Osipenko
GART has a single address space that is shared by all devices, hence only one domain could be active at a time. Signed-off-by: Dmitry Osipenko --- drivers/iommu/tegra-gart.c | 9 + 1 file changed, 9 insertions(+) diff --git a/drivers/iommu/tegra-gart.c b/drivers/iommu/tegra-gart.c

[PATCH v3 17/19] iommu/tegra: gart: Don't detach devices from inactive domains

2018-08-18 Thread Dmitry Osipenko
There could be unlimited number of allocated domains, but only one domain can be active at a time. Hence devices must be detached only from the active domain. Signed-off-by: Dmitry Osipenko --- drivers/iommu/tegra-gart.c | 8 +--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git

[PATCH v3 18/19] iommu/tegra: gart: Simplify clients-tracking code

2018-08-18 Thread Dmitry Osipenko
GART is a simple IOMMU provider that has single address space. There is no need to setup global clients list and manage it for tracking of the active domain, hence lot's of code could be safely removed and replaced with a simpler alternative. Signed-off-by: Dmitry Osipenko --- drivers/iommu

[PATCH v3 19/19] iommu/tegra: gart: Perform code refactoring

2018-08-18 Thread Dmitry Osipenko
reshuffling and variables/whitespaces clean up. Signed-off-by: Dmitry Osipenko --- drivers/iommu/tegra-gart.c | 203 +++-- 1 file changed, 79 insertions(+), 124 deletions(-) diff --git a/drivers/iommu/tegra-gart.c b/drivers/iommu/tegra-gart.c index 7182445c3b76

[PATCH v3 13/19] iommu/tegra: gart: Fix NULL pointer dereference

2018-08-18 Thread Dmitry Osipenko
Fix NULL pointer dereference on IOMMU domain destruction that happens because clients list is being iterated unsafely and its elements are getting deleted during the iteration. Signed-off-by: Dmitry Osipenko --- drivers/iommu/tegra-gart.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions

[PATCH v3 11/19] iommu/tegra: gart: Integrate with Memory Controller driver

2018-08-18 Thread Dmitry Osipenko
The device-tree binding has been changed. There is no separate GART device anymore, it is squashed into the Memory Controller. Integrate GART module with the MC in a way it is done for the SMMU of Tegra30+. Signed-off-by: Dmitry Osipenko --- drivers/iommu/Kconfig | 1 + drivers/iommu

[PATCH v1 1/4] iommu/tegra: gart: Add debugging facility

2018-04-09 Thread Dmitry Osipenko
-off-by: Dmitry Osipenko <dig...@gmail.com> --- drivers/iommu/tegra-gart.c | 13 + 1 file changed, 13 insertions(+) diff --git a/drivers/iommu/tegra-gart.c b/drivers/iommu/tegra-gart.c index b62f790ad1ba..4c0abdcd1ad2 100644 --- a/drivers/iommu/tegra-gart.c +++ b/drivers/iommu

[PATCH v1 3/4] iommu/tegra: gart: Constify number of GART pages

2018-04-09 Thread Dmitry Osipenko
GART has a fixed aperture size, hence the number of pages is constant. Signed-off-by: Dmitry Osipenko <dig...@gmail.com> --- drivers/iommu/tegra-gart.c | 14 -- 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/drivers/iommu/tegra-gart.c b/drivers/iommu/tegra-gart.c

[PATCH v1 0/4] Tegra GART fixes and improvements

2018-04-09 Thread Dmitry Osipenko
GART driver wasn't ever been utilized in upstream, but finally this should change sometime soon with Tegra's DRM driver rework. In general GART driver works fine, though there are couple things that could be improved. Dmitry Osipenko (4): iommu/tegra: gart: Add debugging facility iommu/tegra

[PATCH v1 2/4] iommu/tegra: gart: Fix gart_iommu_unmap()

2018-04-09 Thread Dmitry Osipenko
It must return the number of unmapped bytes on success, returning 0 means that unmapping failed and in result only one page is unmapped. Signed-off-by: Dmitry Osipenko <dig...@gmail.com> --- drivers/iommu/tegra-gart.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/d

[PATCH v1 4/4] iommu/tegra: gart: Optimize map/unmap

2018-04-09 Thread Dmitry Osipenko
Currently GART writes one page entry at a time. More optimal would be to aggregate the writes and flush BUS buffer in the end, this gives map/unmap 10-40% (depending on size of mapping) performance boost compared to a flushing after each entry update. Signed-off-by: Dmitry Osipenko <

Re: [PATCH v5 00/21] IOMMU: Tegra GART driver clean up and optimization

2018-11-16 Thread Dmitry Osipenko
On 01.10.2018 1:48, Dmitry Osipenko wrote: > Hello, > > This patch-series integrates the GART (IOMMU) driver with the Memory > Controller driver, that allows to report the name of a faulty memory > client on GART page fault. A major code clean up and performance > optimiz

Re: [PATCH v3 09/19] memory: tegra: Adapt to Tegra20 device-tree binding changes

2018-09-04 Thread Dmitry Osipenko
On Tuesday 04 September 2018 00:06:01 Marcel Ziswiler wrote: > On Sat, 2018-08-18 at 18:54 +0300, Dmitry Osipenko wrote: > > The tegra20-mc DT binding has been changed, GART has been squashed > > into Memory Controller and now the clock property is mandatory for > > Tegra20. A

Re: [PATCH v4 09/20] memory: tegra: Adapt to Tegra20 device-tree binding changes

2018-09-24 Thread Dmitry Osipenko
On 9/24/18 1:02 PM, Thierry Reding wrote: On Mon, Sep 24, 2018 at 03:41:42AM +0300, Dmitry Osipenko wrote: The tegra20-mc device-tree binding has been changed, GART has been squashed into Memory Controller and now the clock property is mandatory for Tegra20, the DT compatible has been changed

Re: [PATCH v4 20/20] iommu/tegra: gart: Perform code refactoring

2018-09-24 Thread Dmitry Osipenko
On 9/24/18 2:34 PM, Thierry Reding wrote: > On Mon, Sep 24, 2018 at 03:41:53AM +0300, Dmitry Osipenko wrote: >> Perform a major code cleanup to make it more readable and as a result >> easier to maintain. I removed some redundant safety-checks in the code >> and some debug cod

Re: [PATCH v4 18/20] iommu/tegra: gart: Don't detach devices from inactive domains

2018-09-24 Thread Dmitry Osipenko
On 9/24/18 2:00 PM, Thierry Reding wrote: > On Mon, Sep 24, 2018 at 03:41:51AM +0300, Dmitry Osipenko wrote: >> There could be unlimited number of allocated domains, but only one domain >> can be active at a time. Hence devices must be detached only from the >> active dom

Re: [PATCH v4 17/20] iommu/tegra: gart: Prepend error/debug messages with "GART:"

2018-09-24 Thread Dmitry Osipenko
On 9/24/18 1:57 PM, Thierry Reding wrote: > On Mon, Sep 24, 2018 at 03:41:50AM +0300, Dmitry Osipenko wrote: >> GART became a part of Memory Controller, hence now the drivers device >> is Memory Controller and not GART. As a result all printed messages are >> prepended with t

  1   2   3   4   >