[PATCH] Handle init_iova_flush_queue failure in dma-iommu path

2020-09-10 Thread Tom Murphy
init_iova_flush_queue can fail if we run out of memory. Fall back to noflush queue if it fails. Signed-off-by: Tom Murphy --- drivers/iommu/dma-iommu.c | 7 +-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/iommu/dma-iommu.c b/drivers/iommu/dma-iommu.c index

Re: [Intel-gfx] [PATCH 0/8] Convert the intel iommu driver to the dma-iommu api

2020-09-10 Thread Tom Murphy
On Thu, 10 Sep 2020 at 14:33, Tom Murphy wrote: > > On Wed, 9 Sep 2020 at 13:56, Tvrtko Ursulin > wrote: > > > > > > On 09/09/2020 10:16, Tvrtko Ursulin wrote: > > > On 08/09/2020 23:43, Tom Murphy wrote: > > >> On Tue, 8 Sep 2020 at 16:56, Tvrtko

Re: [Intel-gfx] [PATCH 0/8] Convert the intel iommu driver to the dma-iommu api

2020-09-10 Thread Tom Murphy
On Wed, 9 Sep 2020 at 13:56, Tvrtko Ursulin wrote: > > > On 09/09/2020 10:16, Tvrtko Ursulin wrote: > > On 08/09/2020 23:43, Tom Murphy wrote: > >> On Tue, 8 Sep 2020 at 16:56, Tvrtko Ursulin > >> wrote: > >>> On 08/09/2020 16:44, Logan Gunthorpe

Re: [Intel-gfx] [PATCH 0/8] Convert the intel iommu driver to the dma-iommu api

2020-09-08 Thread Tom Murphy
On Tue, 8 Sep 2020 at 16:56, Tvrtko Ursulin wrote: > > > On 08/09/2020 16:44, Logan Gunthorpe wrote: > > On 2020-09-08 9:28 a.m., Tvrtko Ursulin wrote: > >>> > >>> diff --git a/drivers/gpu/drm/i915/i915_scatterlist.h > >>> b/drivers/gpu/drm/i915/i915 > >>> index b7b59328cb76..9367ac801f0c 100644 >

Re: [PATCH V2 5/5] DO NOT MERGE: iommu: disable list appending in dma-iommu

2020-09-07 Thread Tom Murphy
On Mon, 7 Sep 2020 at 08:00, Christoph Hellwig wrote: > > On Thu, Sep 03, 2020 at 09:18:37PM +0100, Tom Murphy wrote: > > Disable combining sg segments in the dma-iommu api. > > Combining the sg segments exposes a bug in the intel i915 driver which > > causes visual art

Re: [PATCH 0/8] Convert the intel iommu driver to the dma-iommu api

2020-09-03 Thread Tom Murphy
On Fri, 28 Aug 2020 at 00:34, Tom Murphy wrote: > > On Thu, 27 Aug 2020 at 22:36, Logan Gunthorpe wrote: > > > > > > > > On 2020-08-23 6:04 p.m., Tom Murphy wrote: > > > I have added a check for the sg_dma_len == 0 : > > > "&qu

[PATCH V2 5/5] DO NOT MERGE: iommu: disable list appending in dma-iommu

2020-09-03 Thread Tom Murphy
value specifying the number of elements in the list and instead depends on the previous behaviour of the intel iommu driver which would return the same number of elements in the output list as in the input list. Signed-off-by: Tom Murphy --- drivers/iommu/dma-iommu.c

[PATCH V2 2/5] iommu: Add iommu_dma_free_cpu_cached_iovas function

2020-09-03 Thread Tom Murphy
to dma-iommu ops Add a iommu_dma_free_cpu_cached_iovas function to allow drivers which use the dma-iommu ops to free cached cpu iovas. Signed-off-by: Tom Murphy --- drivers/iommu/dma-iommu.c | 9 + include/linux/dma-iommu.h | 3 +++ 2 files changed, 12 insertions(+) diff --git a

[PATCH V2 4/5] iommu/vt-d: Convert intel iommu driver to the iommu ops

2020-09-03 Thread Tom Murphy
Convert the intel iommu driver to the dma-iommu api. Remove the iova handling and reserve region code from the intel iommu driver. Signed-off-by: Tom Murphy --- drivers/iommu/Kconfig | 1 + drivers/iommu/intel/iommu.c | 756 +++- 2 files changed, 51

[PATCH V2 3/5] iommu: allow the dma-iommu api to use bounce buffers

2020-09-03 Thread Tom Murphy
Allow the dma-iommu api to use bounce buffers for untrusted devices. This is a copy of the intel bounce buffer code. Signed-off-by: Tom Murphy --- drivers/iommu/dma-iommu.c | 94 ++--- drivers/iommu/intel/iommu.c | 6 +++ drivers/iommu/iommu.c | 10

[PATCH V2 1/5] iommu: Handle freelists when using deferred flushing in iommu drivers

2020-09-03 Thread Tom Murphy
freed. This way we can still batch ioTLB free operations and handle the freelists. Signed-off-by: Tom Murphy --- drivers/iommu/dma-iommu.c | 30 ++-- drivers/iommu/intel/iommu.c | 55 - include/linux/iommu.h | 1 + 3 files changed, 59

[PATCH V2 0/5] Convert the intel iommu driver to the dma-iommu api

2020-09-03 Thread Tom Murphy
the freelist parameter to iommu_iotlb_gather Signed-off-by: Tom Murphy Tom Murphy (5): iommu: Handle freelists when using deferred flushing in iommu drivers iommu: Add iommu_dma_free_cpu_cached_iovas function iommu: allow the dma-iommu api to use bounce buffers iommu/vt-d: Convert intel iomm

Re: [PATCH 0/8] Convert the intel iommu driver to the dma-iommu api

2020-08-27 Thread Tom Murphy
On Thu, 27 Aug 2020 at 22:36, Logan Gunthorpe wrote: > > > > On 2020-08-23 6:04 p.m., Tom Murphy wrote: > > I have added a check for the sg_dma_len == 0 : > > """ > > } __sgt_iter(struct scatterlist *sgl, bool dma) { > > struct s

Re: [PATCH 0/8] Convert the intel iommu driver to the dma-iommu api

2020-08-23 Thread Tom Murphy
Hi Logan/All, I have added a check for the sg_dma_len == 0 : """ } __sgt_iter(struct scatterlist *sgl, bool dma) { struct sgt_iter s = { .sgp = sgl }; + if (sgl && sg_dma_len(sgl) == 0) + s.sgp = NULL; if (s.sgp) { . """ at location [1]. but it do

Re: [PATCH V2 1/2] Add new flush_iotlb_range and handle freelists when using iommu_unmap_fast

2020-08-18 Thread Tom Murphy
On Tue, 18 Aug 2020 at 16:17, Robin Murphy wrote: > > On 2020-08-18 07:04, Tom Murphy wrote: > > Add a flush_iotlb_range to allow flushing of an iova range instead of a > > full flush in the dma-iommu path. > > > > Allow the iommu_unmap_fast to return newly freed pag

[PATCH V2 1/2] Add new flush_iotlb_range and handle freelists when using iommu_unmap_fast

2020-08-17 Thread Tom Murphy
intel iommu driver) which need to wait for the ioTLB to be flushed before newly free/unmapped page table pages can be freed. This way we can still batch ioTLB free operations and handle the freelists. Change-log: V2: -fix missing parameter in mtk_iommu_v1.c Signed-off-by: Tom Murphy --- drivers

[PATCH V2 2/2] Handle init_iova_flush_queue failure in dma-iommu path

2020-08-17 Thread Tom Murphy
init_iova_flush_queue can fail if we run out of memory. Fall back to no flush queue if it fails. Signed-off-by: Tom Murphy --- drivers/iommu/dma-iommu.c | 8 +--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/iommu/dma-iommu.c b/drivers/iommu/dma-iommu.c index

[PATCH 2/2] Handle init_iova_flush_queue failure in dma-iommu path

2020-08-17 Thread Tom Murphy
init_iova_flush_queue can fail if we run out of memory. Fall back to no flush queue if it fails. Signed-off-by: Tom Murphy --- drivers/iommu/dma-iommu.c | 8 +--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/iommu/dma-iommu.c b/drivers/iommu/dma-iommu.c index

[PATCH 1/2] Add new flush_iotlb_range and handle freelists when using iommu_unmap_fast

2020-08-17 Thread Tom Murphy
intel iommu driver) which need to wait for the ioTLB to be flushed before newly free/unmapped page table pages can be freed. This way we can still batch ioTLB free operations and handle the freelists. Signed-off-by: Tom Murphy --- drivers/iommu/amd/iommu.c | 14 - drivers/iommu/arm-smmu

Rename iommu_tlb_* functions to iommu_iotlb_*

2020-08-17 Thread Tom Murphy
To keep naming consistent we should stick with *iotlb*. This patch renames a few remaining functions. Signed-off-by: Tom Murphy --- drivers/iommu/dma-iommu.c | 2 +- drivers/iommu/iommu.c | 4 ++-- drivers/vfio/vfio_iommu_type1.c | 2 +- include/linux/io-pgtable.h | 2

Re: [PATCH V6 4/5] iommu/dma-iommu: Use the dev->coherent_dma_mask

2020-07-10 Thread Tom Murphy
>Btw, what is the current state of converting intel-iommu to the dma-iommu These changes expose a bug in the i915 intel driver which hasn't been fixed yet. I don't think anyone is actively working on it but I plan on merging as many patches as I can so it's easier to do the intel-iommu -> dma-iomm

[PATCH V6 5/5] iommu/amd: Convert AMD iommu driver to the dma-iommu api

2019-09-08 Thread Tom Murphy
Convert the AMD iommu driver to the dma-iommu api. Remove the iova handling and reserve region code from the AMD iommu driver. Signed-off-by: Tom Murphy --- drivers/iommu/Kconfig | 1 + drivers/iommu/amd_iommu.c | 677 -- 2 files changed, 68 insertions

[PATCH V6 2/5] iommu: Add gfp parameter to iommu_ops::map

2019-09-08 Thread Tom Murphy
i uses gfp_atomic in it's iommu_ops::map function. But doing this wastes the memory allocators atomic pools. Signed-off-by: Tom Murphy Reviewed-by: Robin Murphy Reviewed-by: Christoph Hellwig --- drivers/iommu/amd_iommu.c | 3 ++- drivers/iommu/arm-smmu-v3.c| 2 +- drivers/iommu/arm

[PATCH v6 0/5] iommu/amd: Convert the AMD iommu driver to the dma-iommu api

2019-09-08 Thread Tom Murphy
s.3 -Add a gfp_t parameter to the iommu_ops::map function. -Made use of the reserve region code inside the dma-iommu api Tom Murphy (5): iommu/amd: Remove unnecessary locking from AMD iommu driver iommu: Add gfp parameter to iommu_ops::map iommu/dma-iommu: Handle deferred devices iommu/dma-

[PATCH V6 3/5] iommu/dma-iommu: Handle deferred devices

2019-09-08 Thread Tom Murphy
Handle devices which defer their attach to the iommu in the dma-iommu api Signed-off-by: Tom Murphy Reviewed-by: Robin Murphy --- drivers/iommu/dma-iommu.c | 27 ++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/drivers/iommu/dma-iommu.c b/drivers/iommu

[PATCH V6 1/5] iommu/amd: Remove unnecessary locking from AMD iommu driver

2019-09-08 Thread Tom Murphy
t can atomically allocate middle pages using "cmpxchg64()". Signed-off-by: Tom Murphy --- drivers/iommu/amd_iommu.c | 10 +- drivers/iommu/amd_iommu_types.h | 1 - 2 files changed, 1 insertion(+), 10 deletions(-) diff --git a/drivers/iommu/amd_iommu.c b/drivers/i

[PATCH V6 4/5] iommu/dma-iommu: Use the dev->coherent_dma_mask

2019-09-08 Thread Tom Murphy
Use the dev->coherent_dma_mask when allocating in the dma-iommu ops api. Signed-off-by: Tom Murphy Reviewed-by: Robin Murphy Reviewed-by: Christoph Hellwig --- drivers/iommu/dma-iommu.c | 12 +++- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/drivers/iommu/dma-iomm

Re: [PATCH v2 3/4] iommu/dma-iommu: Use the dev->coherent_dma_mask

2019-05-06 Thread Tom Murphy
Just to make this clear, I won't apply Christoph's patch (the one in this email thread) and instead the only change I will make is to rename dma_limit to dma_mask. On Tue, Apr 30, 2019 at 1:05 PM Robin Murphy wrote: > > On 30/04/2019 12:32, Christoph Hellwig wrote: > > On Tue, Apr 30, 2019 at 12:

Re: [PATCH 9/9] iommu/amd: Add allocated domain to global list earlier

2019-04-15 Thread Tom Murphy
>This seems like a fix to the existing code and should probably go out first. I'll send this patch out on it's own now. On Mon, Apr 15, 2019 at 7:23 AM Christoph Hellwig wrote: > > On Thu, Apr 11, 2019 at 07:47:38PM +0100, Tom Murphy via iommu wrote: > > dma_ops_domain

[PATCH] fix flush_tlb_all typo

2019-02-11 Thread Tom Murphy
Fix typo, flush_tlb_all should be flush_iotlb_all Signed-off-by: Tom Murphy --- include/linux/iommu.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/linux/iommu.h b/include/linux/iommu.h index a1d28f42cb77..bb4bf1269e5d 100644 --- a/include/linux/iommu.h +++ b

Re: [PATCH] fix dma-buf/udmabuf selftest

2019-02-08 Thread Tom Murphy
s from this (it needs the F_ADD_SEALS too) so that should also be fixed if anyone gets a chance On Wed, 9 Jan 2019 at 10:44, Geert Uytterhoeven wrote: > > Hi Tom, > > On Tue, Nov 27, 2018 at 7:53 PM Tom Murphy wrote: > > This patch fixes the udmabuf selftest. Currently the self

[PATCH] fix flush_tlb_all typo

2019-02-08 Thread Tom Murphy
--- include/linux/iommu.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/linux/iommu.h b/include/linux/iommu.h index a1d28f42cb77..bb4bf1269e5d 100644 --- a/include/linux/iommu.h +++ b/include/linux/iommu.h @@ -167,7 +167,7 @@ struct iommu_resv_region { * @detach_dev

[PATCH] remove unused end_pfn

2019-02-08 Thread Tom Murphy
This variable is useless. --- drivers/iommu/dma-iommu.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/iommu/dma-iommu.c b/drivers/iommu/dma-iommu.c index 8e04b0603a4a..eff301d5e496 100644 --- a/drivers/iommu/dma-iommu.c +++ b/drivers/iommu/dma-iommu.c @@ -291,7 +29

Re: [PATCH] Fix typo. Change tlb_range_add to iotlb_range_add and tlb_sync to iotlb_sync

2018-12-20 Thread Tom Murphy
Ah shoot, it looks like I forgot to change flush_tlb_all -> flush_iotlb_all Should I submit another patch? On Wed, 5 Dec 2018 at 16:04, Joerg Roedel wrote: > > On Tue, Dec 04, 2018 at 06:27:34PM +0000, Tom Murphy wrote: > > From: tom > > > > Someone fo

[PATCH] fix dma-buf/udmabuf selftest

2018-11-27 Thread Tom Murphy
This patch fixes the udmabuf selftest. Currently the selftest is broken. I fixed the selftest by setting the F_SEAL_SHRINK seal on the memfd file descriptor which is required by udmabuf and added the test to the selftest Makefile. Signed-off-by: Tom Murphy --- tools/testing/selftests

2.4.0-test12-pre7 shutdowns and eepro100 woes

2000-12-11 Thread Tom Murphy
Hello all, test12-pre7 seems to randomly just power off my machine. CONFIG_APM=y and CONFIG_APM_REAL_MODE_POWER_OFF=y as well. Could this be what is making it power off the machine randomly? Has it been fixed in pre8? I wasn't doing much on the machine at the time.. it just happens sporadi

IDE fs corruption in 2.4.0-test11?

2000-12-06 Thread Tom Murphy
My system running 2.4.0-test11 recently trashed itself and I was wondering what steps I should take to ensure UDMA is running OK and not trashing itself. Are there options in hdparm that could conflict with 2.4's handling of UDMA that would cause all writable partitions on the drive to self-destr

Intel ICH audio problems

2000-10-23 Thread Tom Murphy
Hi all, I'm having problems getting Intel ICH audio driver working properly. It plays MP3's like 1.5-2x faster than normal. lspci -n: 00:1f.5 Class 0401: 8086:2445 (rev 01) It's an AC97-compatible embedded soundchip (SoundMAX audio) in a Compaq Deskpro EN .. intel i810 chipset. In 2.4-test10