<div dir="auto">That would be great!</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed., Aug. 26, 2020, 2:14 p.m. Robin Murphy, <<a href="mailto:robin.murphy@arm.com">robin.murphy@arm.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Tom,<br>
<br>
On 2019-12-21 15:03, Tom Murphy wrote:<br>
> This patchset converts the intel iommu driver to the dma-iommu api.<br>
> <br>
> While converting the driver I exposed a bug in the intel i915 driver which causes a huge amount of artifacts on the screen of my laptop. You can see a picture of it here:<br>
> <a href="https://github.com/pippy360/kernelPatches/blob/master/IMG_20191219_225922.jpg" rel="noreferrer noreferrer" target="_blank">https://github.com/pippy360/kernelPatches/blob/master/IMG_20191219_225922.jpg</a><br>
> <br>
> This issue is most likely in the i915 driver and is most likely caused by the driver not respecting the return value of the dma_map_ops::map_sg function. You can see the driver ignoring the return value here:<br>
> <a href="https://github.com/torvalds/linux/blob/7e0165b2f1a912a06e381e91f0f4e495f4ac3736/drivers/gpu/drm/i915/gem/i915_gem_dmabuf.c#L51" rel="noreferrer noreferrer" target="_blank">https://github.com/torvalds/linux/blob/7e0165b2f1a912a06e381e91f0f4e495f4ac3736/drivers/gpu/drm/i915/gem/i915_gem_dmabuf.c#L51</a><br>
> <br>
> Previously this didn’t cause issues because the intel map_sg always returned the same number of elements as the input scatter gather list but with the change to this dma-iommu api this is no longer the case. I wasn’t able to track the bug down to a specific line of code unfortunately.<br>
> <br>
> Could someone from the intel team look at this?<br>
> <br>
> <br>
> I have been testing on a lenovo x1 carbon 5th generation. Let me know if there’s any more information you need.<br>
> <br>
> To allow my patch set to be tested I have added a patch (patch 8/8) in this series to disable combining sg segments in the dma-iommu api which fixes the bug but it doesn't fix the actual problem.<br>
> <br>
> As part of this patch series I copied the intel bounce buffer code to the dma-iommu path. The addition of the bounce buffer code took me by surprise. I did most of my development on this patch series before the bounce buffer code was added and my reimplementation in the dma-iommu path is very rushed and not properly tested but I’m running out of time to work on this patch set.<br>
> <br>
> On top of that I also didn’t port over the intel tracing code from this commit:<br>
> <a href="https://github.com/torvalds/linux/commit/3b53034c268d550d9e8522e613a14ab53b8840d8#diff-6b3e7c4993f05e76331e463ab1fc87e1" rel="noreferrer noreferrer" target="_blank">https://github.com/torvalds/linux/commit/3b53034c268d550d9e8522e613a14ab53b8840d8#diff-6b3e7c4993f05e76331e463ab1fc87e1</a><br>
> So all the work in that commit is now wasted. The code will need to be removed and reimplemented in the dma-iommu path. I would like to take the time to do this but I really don’t have the time at the moment and I want to get these changes out before the iommu code changes any more.<br>
<br>
Further to what we just discussed at LPC, I've realised that tracepoints <br>
are actually something I could do with *right now* for debugging my Arm <br>
DMA ops series, so if I'm going to hack something up anyway I may as <br>
well take responsibility for polishing it into a proper patch as well :)<br>
<br>
Robin.<br>
<br>
> <br>
> Tom Murphy (8):<br>
> iommu/vt-d: clean up 32bit si_domain assignment<br>
> iommu/vt-d: Use default dma_direct_* mapping functions for direct<br>
> mapped devices<br>
> iommu/vt-d: Remove IOVA handling code from non-dma_ops path<br>
> iommu: Handle freelists when using deferred flushing in iommu drivers<br>
> iommu: Add iommu_dma_free_cpu_cached_iovas function<br>
> iommu: allow the dma-iommu api to use bounce buffers<br>
> iommu/vt-d: Convert intel iommu driver to the iommu ops<br>
> DO NOT MERGE: iommu: disable list appending in dma-iommu<br>
> <br>
> drivers/iommu/Kconfig | 1 +<br>
> drivers/iommu/amd_iommu.c | 14 +-<br>
> drivers/iommu/arm-smmu-v3.c | 3 +-<br>
> drivers/iommu/arm-smmu.c | 3 +-<br>
> drivers/iommu/dma-iommu.c | 183 +++++--<br>
> drivers/iommu/exynos-iommu.c | 3 +-<br>
> drivers/iommu/intel-iommu.c | 936 ++++----------------------------<br>
> drivers/iommu/iommu.c | 39 +-<br>
> drivers/iommu/ipmmu-vmsa.c | 3 +-<br>
> drivers/iommu/msm_iommu.c | 3 +-<br>
> drivers/iommu/mtk_iommu.c | 3 +-<br>
> drivers/iommu/mtk_iommu_v1.c | 3 +-<br>
> drivers/iommu/omap-iommu.c | 3 +-<br>
> drivers/iommu/qcom_iommu.c | 3 +-<br>
> drivers/iommu/rockchip-iommu.c | 3 +-<br>
> drivers/iommu/s390-iommu.c | 3 +-<br>
> drivers/iommu/tegra-gart.c | 3 +-<br>
> drivers/iommu/tegra-smmu.c | 3 +-<br>
> drivers/iommu/virtio-iommu.c | 3 +-<br>
> drivers/vfio/vfio_iommu_type1.c | 2 +-<br>
> include/linux/dma-iommu.h | 3 +<br>
> include/linux/intel-iommu.h | 1 -<br>
> include/linux/iommu.h | 32 +-<br>
> 23 files changed, 345 insertions(+), 908 deletions(-)<br>
> <br>
</blockquote></div>