<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux/kernel/dma, branch v5.14</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/
</subtitle>
<id>https://git.shady.money/linux/atom?h=v5.14</id>
<link rel='self' href='https://git.shady.money/linux/atom?h=v5.14'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/'/>
<updated>2021-07-16T09:30:26Z</updated>
<entry>
<title>dma-mapping: handle vmalloc addresses in dma_common_{mmap,get_sgtable}</title>
<updated>2021-07-16T09:30:26Z</updated>
<author>
<name>Roman Skakun</name>
<email>Roman_Skakun@epam.com</email>
</author>
<published>2021-07-16T08:39:34Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=40ac971eab89330d6153e7721e88acd2d98833f9'/>
<id>urn:sha1:40ac971eab89330d6153e7721e88acd2d98833f9</id>
<content type='text'>
xen-swiotlb can use vmalloc backed addresses for dma coherent allocations
and uses the common helpers.  Properly handle them to unbreak Xen on
ARM platforms.

Fixes: 1b65c4e5a9af ("swiotlb-xen: use xen_alloc/free_coherent_pages")
Signed-off-by: Roman Skakun &lt;roman_skakun@epam.com&gt;
Reviewed-by: Andrii Anisov &lt;andrii_anisov@epam.com&gt;
[hch: split the patch, renamed the helpers]
Signed-off-by: Christoph Hellwig &lt;hch@lst.de&gt;
</content>
</entry>
<entry>
<title>Merge tag 'dma-mapping-5.14' of git://git.infradead.org/users/hch/dma-mapping</title>
<updated>2021-07-02T20:31:08Z</updated>
<author>
<name>Linus Torvalds</name>
<email>torvalds@linux-foundation.org</email>
</author>
<published>2021-07-02T20:31:08Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=e72b069609aa76cc1de35f5d434dbfaa5392ae9a'/>
<id>urn:sha1:e72b069609aa76cc1de35f5d434dbfaa5392ae9a</id>
<content type='text'>
Pull dma-mapping updates from Christoph Hellwig:

 - a trivivial whitespace fix (Zhen Lei)

 - report -EEXIST errors in add_dma_entry (Hamza Mahfooz)

* tag 'dma-mapping-5.14' of git://git.infradead.org/users/hch/dma-mapping:
  dma-debug: report -EEXIST errors in add_dma_entry
  dma-mapping: remove a trailing space
</content>
</entry>
<entry>
<title>Merge branch 'stable/for-linus-5.14' of git://git.kernel.org/pub/scm/linux/kernel/git/konrad/swiotlb</title>
<updated>2021-06-23T16:04:07Z</updated>
<author>
<name>Linus Torvalds</name>
<email>torvalds@linux-foundation.org</email>
</author>
<published>2021-06-23T16:04:07Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=8fd2ed1c01dd96396c39dfa203c54705c6b6e03b'/>
<id>urn:sha1:8fd2ed1c01dd96396c39dfa203c54705c6b6e03b</id>
<content type='text'>
Pull swiotlb fix from Konrad Rzeszutek Wilk:
 "A fix for the regression for the DMA operations where the offset was
  ignored and corruptions would appear.

  Going forward there will be a cleanups to make the offset and
  alignment logic more clearer and better test-cases to help with this"

* 'stable/for-linus-5.14' of git://git.kernel.org/pub/scm/linux/kernel/git/konrad/swiotlb:
  swiotlb: manipulate orig_addr when tlb_addr has offset
</content>
</entry>
<entry>
<title>dma-debug: report -EEXIST errors in add_dma_entry</title>
<updated>2021-06-22T06:15:47Z</updated>
<author>
<name>Hamza Mahfooz</name>
<email>someguy@effective-light.com</email>
</author>
<published>2021-05-18T12:54:43Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=2b4bbc6231d789f58676d2ccc42177df163e1c4a'/>
<id>urn:sha1:2b4bbc6231d789f58676d2ccc42177df163e1c4a</id>
<content type='text'>
Since, overlapping mappings are not supported by the DMA API we should
report an error if active_cacheline_insert returns -EEXIST.

Suggested-by: Dan Williams &lt;dan.j.williams@intel.com&gt;
Signed-off-by: Hamza Mahfooz &lt;someguy@effective-light.com&gt;
Signed-off-by: Christoph Hellwig &lt;hch@lst.de&gt;
</content>
</entry>
<entry>
<title>dma-mapping: remove a trailing space</title>
<updated>2021-06-22T06:15:46Z</updated>
<author>
<name>Zhen Lei</name>
<email>thunder.leizhen@huawei.com</email>
</author>
<published>2021-06-08T07:52:19Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=bab1622350699dc209db4f50d9ab99e6f6465334'/>
<id>urn:sha1:bab1622350699dc209db4f50d9ab99e6f6465334</id>
<content type='text'>
Signed-off-by: Zhen Lei &lt;thunder.leizhen@huawei.com&gt;
Signed-off-by: Christoph Hellwig &lt;hch@lst.de&gt;
</content>
</entry>
<entry>
<title>swiotlb: manipulate orig_addr when tlb_addr has offset</title>
<updated>2021-06-21T12:59:02Z</updated>
<author>
<name>Bumyong Lee</name>
<email>bumyong.lee@samsung.com</email>
</author>
<published>2021-05-10T09:10:04Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=5f89468e2f060031cd89fd4287298e0eaf246bf6'/>
<id>urn:sha1:5f89468e2f060031cd89fd4287298e0eaf246bf6</id>
<content type='text'>
in case of driver wants to sync part of ranges with offset,
swiotlb_tbl_sync_single() copies from orig_addr base to tlb_addr with
offset and ends up with data mismatch.

It was removed from
"swiotlb: don't modify orig_addr in swiotlb_tbl_sync_single",
but said logic has to be added back in.

From Linus's email:
"That commit which the removed the offset calculation entirely, because the old

        (unsigned long)tlb_addr &amp; (IO_TLB_SIZE - 1)

was wrong, but instead of removing it, I think it should have just
fixed it to be

        (tlb_addr - mem-&gt;start) &amp; (IO_TLB_SIZE - 1);

instead. That way the slot offset always matches the slot index calculation."

(Unfortunatly that broke NVMe).

The use-case that drivers are hitting is as follow:

1. Get dma_addr_t from dma_map_single()

dma_addr_t tlb_addr = dma_map_single(dev, vaddr, vsize, DMA_TO_DEVICE);

    |&lt;---------------vsize-------------&gt;|
    +-----------------------------------+
    |                                   | original buffer
    +-----------------------------------+
  vaddr

 swiotlb_align_offset
     |&lt;-----&gt;|&lt;---------------vsize-------------&gt;|
     +-------+-----------------------------------+
     |       |                                   | swiotlb buffer
     +-------+-----------------------------------+
          tlb_addr

2. Do something
3. Sync dma_addr_t through dma_sync_single_for_device(..)

dma_sync_single_for_device(dev, tlb_addr + offset, size, DMA_TO_DEVICE);

  Error case.
    Copy data to original buffer but it is from base addr (instead of
  base addr + offset) in original buffer:

 swiotlb_align_offset
     |&lt;-----&gt;|&lt;- offset -&gt;|&lt;- size -&gt;|
     +-------+-----------------------------------+
     |       |            |##########|           | swiotlb buffer
     +-------+-----------------------------------+
          tlb_addr

    |&lt;- size -&gt;|
    +-----------------------------------+
    |##########|                        | original buffer
    +-----------------------------------+
  vaddr

The fix is to copy the data to the original buffer and take into
account the offset, like so:

 swiotlb_align_offset
     |&lt;-----&gt;|&lt;- offset -&gt;|&lt;- size -&gt;|
     +-------+-----------------------------------+
     |       |            |##########|           | swiotlb buffer
     +-------+-----------------------------------+
          tlb_addr

    |&lt;- offset -&gt;|&lt;- size -&gt;|
    +-----------------------------------+
    |            |##########|           | original buffer
    +-----------------------------------+
  vaddr

[One fix which was Linus's that made more sense to as it created a
symmetry would break NVMe. The reason for that is the:
 unsigned int offset = (tlb_addr - mem-&gt;start) &amp; (IO_TLB_SIZE - 1);

would come up with the proper offset, but it would lose the
alignment (which this patch contains).]

Fixes: 16fc3cef33a0 ("swiotlb: don't modify orig_addr in swiotlb_tbl_sync_single")
Signed-off-by: Bumyong Lee &lt;bumyong.lee@samsung.com&gt;
Signed-off-by: Chanho Park &lt;chanho61.park@samsung.com&gt;
Reviewed-by: Christoph Hellwig &lt;hch@lst.de&gt;
Reported-by: Dominique MARTINET &lt;dominique.martinet@atmark-techno.com&gt;
Reported-by: Horia Geantă &lt;horia.geanta@nxp.com&gt;
Tested-by: Horia Geantă &lt;horia.geanta@nxp.com&gt;
CC: stable@vger.kernel.org
Signed-off-by: Konrad Rzeszutek Wilk &lt;konrad.wilk@oracle.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'stable/for-linus-5.13' of git://git.kernel.org/pub/scm/linux/kernel/git/konrad/swiotlb</title>
<updated>2021-05-04T17:58:49Z</updated>
<author>
<name>Linus Torvalds</name>
<email>torvalds@linux-foundation.org</email>
</author>
<published>2021-05-04T17:58:49Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=74d6790cdaaf3825afe53e668b32e662ad5e2e12'/>
<id>urn:sha1:74d6790cdaaf3825afe53e668b32e662ad5e2e12</id>
<content type='text'>
Pull swiotlb updates from Konrad Rzeszutek Wilk:
 "Christoph Hellwig has taken a cleaver and trimmed off the not-needed
  code and nicely folded duplicate code in the generic framework.

  This lays the groundwork for more work to add extra DMA-backend-ish in
  the future. Along with that some bug-fixes to make this a nice working
  package"

* 'stable/for-linus-5.13' of git://git.kernel.org/pub/scm/linux/kernel/git/konrad/swiotlb:
  swiotlb: don't override user specified size in swiotlb_adjust_size
  swiotlb: Fix the type of index
  swiotlb: Make SWIOTLB_NO_FORCE perform no allocation
  ARM: Qualify enabling of swiotlb_init()
  swiotlb: remove swiotlb_nr_tbl
  swiotlb: dynamically allocate io_tlb_default_mem
  swiotlb: move global variables into a new io_tlb_mem structure
  xen-swiotlb: remove the unused size argument from xen_swiotlb_fixup
  xen-swiotlb: split xen_swiotlb_init
  swiotlb: lift the double initialization protection from xen-swiotlb
  xen-swiotlb: remove xen_io_tlb_start and xen_io_tlb_nslabs
  xen-swiotlb: remove xen_set_nslabs
  xen-swiotlb: use io_tlb_end in xen_swiotlb_dma_supported
  xen-swiotlb: use is_swiotlb_buffer in is_xen_swiotlb_buffer
  swiotlb: split swiotlb_tbl_sync_single
  swiotlb: move orig addr and size validation into swiotlb_bounce
  swiotlb: remove the alloc_size parameter to swiotlb_tbl_unmap_single
  powerpc/svm: stop using io_tlb_start
</content>
</entry>
<entry>
<title>Merge tag 'dma-mapping-5.13' of git://git.infradead.org/users/hch/dma-mapping</title>
<updated>2021-05-04T17:52:09Z</updated>
<author>
<name>Linus Torvalds</name>
<email>torvalds@linux-foundation.org</email>
</author>
<published>2021-05-04T17:52:09Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=954b7207059cc4004f2e18f49c335304b1c6d64a'/>
<id>urn:sha1:954b7207059cc4004f2e18f49c335304b1c6d64a</id>
<content type='text'>
Pull dma-mapping updates from Christoph Hellwig:

 - add a new dma_alloc_noncontiguous API (me, Ricardo Ribalda)

 - fix a copyright notice (Hao Fang)

 - add an unlikely annotation to dma_mapping_error (Heiner Kallweit)

 - remove a pointless empty line (Wang Qing)

 - add support for multi-pages map/unmap bencharking (Xiang Chen)

* tag 'dma-mapping-5.13' of git://git.infradead.org/users/hch/dma-mapping:
  dma-mapping: add unlikely hint to error path in dma_mapping_error
  dma-mapping: benchmark: Add support for multi-pages map/unmap
  dma-mapping: benchmark: use the correct HiSilicon copyright
  dma-mapping: remove a pointless empty line in dma_alloc_coherent
  media: uvcvideo: Use dma_alloc_noncontiguous API
  dma-iommu: implement -&gt;alloc_noncontiguous
  dma-iommu: refactor iommu_dma_alloc_remap
  dma-mapping: add a dma_alloc_noncontiguous API
  dma-mapping: refactor dma_{alloc,free}_pages
  dma-mapping: add a dma_mmap_pages helper
</content>
</entry>
<entry>
<title>kernel/dma: remove unnecessary unmap_kernel_range</title>
<updated>2021-04-30T18:20:40Z</updated>
<author>
<name>Nicholas Piggin</name>
<email>npiggin@gmail.com</email>
</author>
<published>2021-04-30T05:58:55Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=e82b9b3086b93857b1b46341714751b123a4d08b'/>
<id>urn:sha1:e82b9b3086b93857b1b46341714751b123a4d08b</id>
<content type='text'>
vunmap will remove ptes.

Link: https://lkml.kernel.org/r/20210322021806.892164-3-npiggin@gmail.com
Signed-off-by: Nicholas Piggin &lt;npiggin@gmail.com&gt;
Reviewed-by: Christoph Hellwig &lt;hch@lst.de&gt;
Cc: Cédric Le Goater &lt;clg@kaod.org&gt;
Cc: Uladzislau Rezki &lt;urezki@gmail.com&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>swiotlb: don't override user specified size in swiotlb_adjust_size</title>
<updated>2021-04-29T18:46:06Z</updated>
<author>
<name>Christoph Hellwig</name>
<email>hch@lst.de</email>
</author>
<published>2021-04-29T06:28:59Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=dfc06b389a4f54e78c03abecd5b42ab6ea8d492a'/>
<id>urn:sha1:dfc06b389a4f54e78c03abecd5b42ab6ea8d492a</id>
<content type='text'>
If the user already specified a swiotlb size on the command line,
swiotlb_adjust_size should not overwrite it.

Fixes: 2cbc2776efe4 ("swiotlb: remove swiotlb_nr_tbl")
Reported-by: Tom Lendacky &lt;thomas.lendacky@amd.com&gt;
Tested-by: Tom Lendacky &lt;thomas.lendacky@amd.com&gt;
Signed-off-by: Christoph Hellwig &lt;hch@lst.de&gt;
Signed-off-by: Konrad Rzeszutek Wilk &lt;konrad.wilk@oracle.com&gt;
</content>
</entry>
</feed>
