<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux/kernel/dma/remap.c, branch v5.6</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.6</id>
<link rel='self' href='https://git.shady.money/linux/atom?h=v5.6'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/'/>
<updated>2019-12-05T03:44:13Z</updated>
<entry>
<title>lib/genalloc.c: rename addr_in_gen_pool to gen_pool_has_addr</title>
<updated>2019-12-05T03:44:13Z</updated>
<author>
<name>Huang Shijie</name>
<email>sjhuang@iluvatar.ai</email>
</author>
<published>2019-12-05T00:52:03Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=964975ac6677c97ae61ec9d6969dd5d03f18d1c3'/>
<id>urn:sha1:964975ac6677c97ae61ec9d6969dd5d03f18d1c3</id>
<content type='text'>
Follow the kernel conventions, rename addr_in_gen_pool to
gen_pool_has_addr.

[sjhuang@iluvatar.ai: fix Documentation/ too]
 Link: http://lkml.kernel.org/r/20181229015914.5573-1-sjhuang@iluvatar.ai
Link: http://lkml.kernel.org/r/20181228083950.20398-1-sjhuang@iluvatar.ai
Signed-off-by: Huang Shijie &lt;sjhuang@iluvatar.ai&gt;
Reviewed-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Cc: Russell King &lt;linux@armlinux.org.uk&gt;
Cc: Arnd Bergmann &lt;arnd@arndb.de&gt;
Cc: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
Cc: Christoph Hellwig &lt;hch@lst.de&gt;
Cc: Marek Szyprowski &lt;m.szyprowski@samsung.com&gt;
Cc: Robin Murphy &lt;robin.murphy@arm.com&gt;
Cc: Stephen Rothwell &lt;sfr@canb.auug.org.au&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>dma-mapping: merge the generic remapping helpers into dma-direct</title>
<updated>2019-11-11T09:52:18Z</updated>
<author>
<name>Christoph Hellwig</name>
<email>hch@lst.de</email>
</author>
<published>2019-10-29T10:06:32Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=3acac065508f6cc60ac9d3e4b7c6cc37fd91d531'/>
<id>urn:sha1:3acac065508f6cc60ac9d3e4b7c6cc37fd91d531</id>
<content type='text'>
Integrate the generic dma remapping implementation into the main flow.
This prepares for architectures like xtensa that use an uncached
segment for pages in the kernel mapping, but can also remap highmem
from CMA.  To simplify that implementation we now always deduct the
page from the physical address via the DMA address instead of the
virtual address.

Signed-off-by: Christoph Hellwig &lt;hch@lst.de&gt;
Reviewed-by: Max Filippov &lt;jcmvbkbc@gmail.com&gt;
</content>
</entry>
<entry>
<title>dma-direct: provide mmap and get_sgtable method overrides</title>
<updated>2019-11-11T09:52:15Z</updated>
<author>
<name>Christoph Hellwig</name>
<email>hch@lst.de</email>
</author>
<published>2019-10-29T10:01:37Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=34dc0ea6bc960f1f57b2148f01a3f4da23f87013'/>
<id>urn:sha1:34dc0ea6bc960f1f57b2148f01a3f4da23f87013</id>
<content type='text'>
For dma-direct we know that the DMA address is an encoding of the
physical address that we can trivially decode.  Use that fact to
provide implementations that do not need the arch_dma_coherent_to_pfn
architecture hook.  Note that we still can only support mmap of
non-coherent memory only if the architecture provides a way to set an
uncached bit in the page tables.  This must be true for architectures
that use the generic remap helpers, but other architectures can also
manually select it.

Signed-off-by: Christoph Hellwig &lt;hch@lst.de&gt;
Reviewed-by: Max Filippov &lt;jcmvbkbc@gmail.com&gt;
</content>
</entry>
<entry>
<title>dma-direct: remove the dma_handle argument to __dma_direct_alloc_pages</title>
<updated>2019-11-07T16:25:57Z</updated>
<author>
<name>Christoph Hellwig</name>
<email>hch@lst.de</email>
</author>
<published>2019-10-29T08:57:32Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=4e1003aa56a7d60ddb048e43a7a51368fcfe36af'/>
<id>urn:sha1:4e1003aa56a7d60ddb048e43a7a51368fcfe36af</id>
<content type='text'>
The argument isn't used anywhere, so stop passing it.

Signed-off-by: Christoph Hellwig &lt;hch@lst.de&gt;
Reviewed-by: Max Filippov &lt;jcmvbkbc@gmail.com&gt;
</content>
</entry>
<entry>
<title>dma-direct: remove __dma_direct_free_pages</title>
<updated>2019-11-07T16:25:40Z</updated>
<author>
<name>Christoph Hellwig</name>
<email>hch@lst.de</email>
</author>
<published>2019-10-29T08:57:09Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=acaade1af3587132e7ea585f470a95261e14f60c'/>
<id>urn:sha1:acaade1af3587132e7ea585f470a95261e14f60c</id>
<content type='text'>
We can just call dma_free_contiguous directly instead of wrapping it.

Signed-off-by: Christoph Hellwig &lt;hch@lst.de&gt;
Reviewed-by: Max Filippov &lt;jcmvbkbc@gmail.com&gt;
</content>
</entry>
<entry>
<title>dma-mapping: fix false positivse warnings in dma_common_free_remap()</title>
<updated>2019-10-05T08:24:17Z</updated>
<author>
<name>Andrey Smirnov</name>
<email>andrew.smirnov@gmail.com</email>
</author>
<published>2019-10-05T08:23:30Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=2cf2aa6a69db0b17b3979144287af8775c1c1534'/>
<id>urn:sha1:2cf2aa6a69db0b17b3979144287af8775c1c1534</id>
<content type='text'>
Commit 5cf4537975bb ("dma-mapping: introduce a dma_common_find_pages
helper") changed invalid input check in dma_common_free_remap() from:

    if (!area || !area-&gt;flags != VM_DMA_COHERENT)

to

    if (!area || !area-&gt;flags != VM_DMA_COHERENT || !area-&gt;pages)

which seem to produce false positives for memory obtained via
dma_common_contiguous_remap()

This triggers the following warning message when doing "reboot" on ZII
VF610 Dev Board Rev B:

WARNING: CPU: 0 PID: 1 at kernel/dma/remap.c:112 dma_common_free_remap+0x88/0x8c
trying to free invalid coherent area: 9ef82980
Modules linked in:
CPU: 0 PID: 1 Comm: systemd-shutdow Not tainted 5.3.0-rc6-next-20190820 #119
Hardware name: Freescale Vybrid VF5xx/VF6xx (Device Tree)
Backtrace:
[&lt;8010d1ec&gt;] (dump_backtrace) from [&lt;8010d588&gt;] (show_stack+0x20/0x24)
 r7:8015ed78 r6:00000009 r5:00000000 r4:9f4d9b14
[&lt;8010d568&gt;] (show_stack) from [&lt;8077e3f0&gt;] (dump_stack+0x24/0x28)
[&lt;8077e3cc&gt;] (dump_stack) from [&lt;801197a0&gt;] (__warn.part.3+0xcc/0xe4)
[&lt;801196d4&gt;] (__warn.part.3) from [&lt;80119830&gt;] (warn_slowpath_fmt+0x78/0x94)
 r6:00000070 r5:808e540c r4:81c03048
[&lt;801197bc&gt;] (warn_slowpath_fmt) from [&lt;8015ed78&gt;] (dma_common_free_remap+0x88/0x8c)
 r3:9ef82980 r2:808e53e0
 r7:00001000 r6:a0b1e000 r5:a0b1e000 r4:00001000
[&lt;8015ecf0&gt;] (dma_common_free_remap) from [&lt;8010fa9c&gt;] (remap_allocator_free+0x60/0x68)
 r5:81c03048 r4:9f4d9b78
[&lt;8010fa3c&gt;] (remap_allocator_free) from [&lt;801100d0&gt;] (__arm_dma_free.constprop.3+0xf8/0x148)
 r5:81c03048 r4:9ef82900
[&lt;8010ffd8&gt;] (__arm_dma_free.constprop.3) from [&lt;80110144&gt;] (arm_dma_free+0x24/0x2c)
 r5:9f563410 r4:80110120
[&lt;80110120&gt;] (arm_dma_free) from [&lt;8015d80c&gt;] (dma_free_attrs+0xa0/0xdc)
[&lt;8015d76c&gt;] (dma_free_attrs) from [&lt;8020f3e4&gt;] (dma_pool_destroy+0xc0/0x154)
 r8:9efa8860 r7:808f02f0 r6:808f02d0 r5:9ef82880 r4:9ef82780
[&lt;8020f324&gt;] (dma_pool_destroy) from [&lt;805525d0&gt;] (ehci_mem_cleanup+0x6c/0x150)
 r7:9f563410 r6:9efa8810 r5:00000000 r4:9efd0148
[&lt;80552564&gt;] (ehci_mem_cleanup) from [&lt;80558e0c&gt;] (ehci_stop+0xac/0xc0)
 r5:9efd0148 r4:9efd0000
[&lt;80558d60&gt;] (ehci_stop) from [&lt;8053c4bc&gt;] (usb_remove_hcd+0xf4/0x1b0)
 r7:9f563410 r6:9efd0074 r5:81c03048 r4:9efd0000
[&lt;8053c3c8&gt;] (usb_remove_hcd) from [&lt;8056361c&gt;] (host_stop+0x48/0xb8)
 r7:9f563410 r6:9efd0000 r5:9f5f4040 r4:9f5f5040
[&lt;805635d4&gt;] (host_stop) from [&lt;80563d0c&gt;] (ci_hdrc_host_destroy+0x34/0x38)
 r7:9f563410 r6:9f5f5040 r5:9efa8800 r4:9f5f4040
[&lt;80563cd8&gt;] (ci_hdrc_host_destroy) from [&lt;8055ef18&gt;] (ci_hdrc_remove+0x50/0x10c)
[&lt;8055eec8&gt;] (ci_hdrc_remove) from [&lt;804a2ed8&gt;] (platform_drv_remove+0x34/0x4c)
 r7:9f563410 r6:81c4f99c r5:9efa8810 r4:9efa8810
[&lt;804a2ea4&gt;] (platform_drv_remove) from [&lt;804a18a8&gt;] (device_release_driver_internal+0xec/0x19c)
 r5:00000000 r4:9efa8810
[&lt;804a17bc&gt;] (device_release_driver_internal) from [&lt;804a1978&gt;] (device_release_driver+0x20/0x24)
 r7:9f563410 r6:81c41ed0 r5:9efa8810 r4:9f4a1dac
[&lt;804a1958&gt;] (device_release_driver) from [&lt;804a01b8&gt;] (bus_remove_device+0xdc/0x108)
[&lt;804a00dc&gt;] (bus_remove_device) from [&lt;8049c204&gt;] (device_del+0x150/0x36c)
 r7:9f563410 r6:81c03048 r5:9efa8854 r4:9efa8810
[&lt;8049c0b4&gt;] (device_del) from [&lt;804a3368&gt;] (platform_device_del.part.2+0x20/0x84)
 r10:9f563414 r9:809177e0 r8:81cb07dc r7:81c78320 r6:9f563454 r5:9efa8800
 r4:9efa8800
[&lt;804a3348&gt;] (platform_device_del.part.2) from [&lt;804a3420&gt;] (platform_device_unregister+0x28/0x34)
 r5:9f563400 r4:9efa8800
[&lt;804a33f8&gt;] (platform_device_unregister) from [&lt;8055dce0&gt;] (ci_hdrc_remove_device+0x1c/0x30)
 r5:9f563400 r4:00000001
[&lt;8055dcc4&gt;] (ci_hdrc_remove_device) from [&lt;805652ac&gt;] (ci_hdrc_imx_remove+0x38/0x118)
 r7:81c78320 r6:9f563454 r5:9f563410 r4:9f541010
[&lt;8056538c&gt;] (ci_hdrc_imx_shutdown) from [&lt;804a2970&gt;] (platform_drv_shutdown+0x2c/0x30)
[&lt;804a2944&gt;] (platform_drv_shutdown) from [&lt;8049e4fc&gt;] (device_shutdown+0x158/0x1f0)
[&lt;8049e3a4&gt;] (device_shutdown) from [&lt;8013ac80&gt;] (kernel_restart_prepare+0x44/0x48)
 r10:00000058 r9:9f4d8000 r8:fee1dead r7:379ce700 r6:81c0b280 r5:81c03048
 r4:00000000
[&lt;8013ac3c&gt;] (kernel_restart_prepare) from [&lt;8013ad14&gt;] (kernel_restart+0x1c/0x60)
[&lt;8013acf8&gt;] (kernel_restart) from [&lt;8013af84&gt;] (__do_sys_reboot+0xe0/0x1d8)
 r5:81c03048 r4:00000000
[&lt;8013aea4&gt;] (__do_sys_reboot) from [&lt;8013b0ec&gt;] (sys_reboot+0x18/0x1c)
 r8:80101204 r7:00000058 r6:00000000 r5:00000000 r4:00000000
[&lt;8013b0d4&gt;] (sys_reboot) from [&lt;80101000&gt;] (ret_fast_syscall+0x0/0x54)
Exception stack(0x9f4d9fa8 to 0x9f4d9ff0)
9fa0:                   00000000 00000000 fee1dead 28121969 01234567 379ce700
9fc0: 00000000 00000000 00000000 00000058 00000000 00000000 00000000 00016d04
9fe0: 00028e0c 7ec87c64 000135ec 76c1f410

Restore original invalid input check in dma_common_free_remap() to
avoid this problem.

Fixes: 5cf4537975bb ("dma-mapping: introduce a dma_common_find_pages helper")
Signed-off-by: Andrey Smirnov &lt;andrew.smirnov@gmail.com&gt;
[hch: just revert the offending hunk instead of creating a new helper]
Signed-off-by: Christoph Hellwig &lt;hch@lst.de&gt;
</content>
</entry>
<entry>
<title>dma-mapping: introduce a dma_common_find_pages helper</title>
<updated>2019-09-04T09:13:20Z</updated>
<author>
<name>Christoph Hellwig</name>
<email>hch@lst.de</email>
</author>
<published>2019-06-03T07:14:31Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=5cf4537975bbd5691b9ddd015d540bb92f61e322'/>
<id>urn:sha1:5cf4537975bbd5691b9ddd015d540bb92f61e322</id>
<content type='text'>
A helper to find the backing page array based on a virtual address.
This also ensures we do the same vm_flags check everywhere instead
of slightly different or missing ones in a few places.

Signed-off-by: Christoph Hellwig &lt;hch@lst.de&gt;
</content>
</entry>
<entry>
<title>dma-mapping: always use VM_DMA_COHERENT for generic DMA remap</title>
<updated>2019-09-04T09:13:20Z</updated>
<author>
<name>Christoph Hellwig</name>
<email>hch@lst.de</email>
</author>
<published>2019-08-30T06:51:01Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=512317401f6a337e617ec284d20dec5fa3a951ec'/>
<id>urn:sha1:512317401f6a337e617ec284d20dec5fa3a951ec</id>
<content type='text'>
Currently the generic dma remap allocator gets a vm_flags passed by
the caller that is a little confusing.  We just introduced a generic
vmalloc-level flag to identify the dma coherent allocations, so use
that everywhere and remove the now pointless argument.

Signed-off-by: Christoph Hellwig &lt;hch@lst.de&gt;
</content>
</entry>
<entry>
<title>dma-mapping: make dma_atomic_pool_init self-contained</title>
<updated>2019-08-29T14:43:33Z</updated>
<author>
<name>Christoph Hellwig</name>
<email>hch@lst.de</email>
</author>
<published>2019-08-03T09:42:15Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=8e3a68fb55e00e0760bd8023883e064f1f93c62d'/>
<id>urn:sha1:8e3a68fb55e00e0760bd8023883e064f1f93c62d</id>
<content type='text'>
The memory allocated for the atomic pool needs to have the same
mapping attributes that we use for remapping, so use
pgprot_dmacoherent instead of open coding it.  Also deduct a
suitable zone to allocate the memory from based on the presence
of the DMA zones.

Signed-off-by: Christoph Hellwig &lt;hch@lst.de&gt;
</content>
</entry>
<entry>
<title>dma-mapping: fix page attributes for dma_mmap_*</title>
<updated>2019-08-10T17:52:45Z</updated>
<author>
<name>Christoph Hellwig</name>
<email>hch@lst.de</email>
</author>
<published>2019-07-26T07:26:40Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=33dcb37cef741294b481f4d889a465b8091f11bf'/>
<id>urn:sha1:33dcb37cef741294b481f4d889a465b8091f11bf</id>
<content type='text'>
All the way back to introducing dma_common_mmap we've defaulted to mark
the pages as uncached.  But this is wrong for DMA coherent devices.
Later on DMA_ATTR_WRITE_COMBINE also got incorrect treatment as that
flag is only treated special on the alloc side for non-coherent devices.

Introduce a new dma_pgprot helper that deals with the check for coherent
devices so that only the remapping cases ever reach arch_dma_mmap_pgprot
and we thus ensure no aliasing of page attributes happens, which makes
the powerpc version of arch_dma_mmap_pgprot obsolete and simplifies the
remaining ones.

Note that this means arch_dma_mmap_pgprot is a bit misnamed now, but
we'll phase it out soon.

Fixes: 64ccc9c033c6 ("common: dma-mapping: add support for generic dma_mmap_* calls")
Reported-by: Shawn Anastasio &lt;shawn@anastas.io&gt;
Reported-by: Gavin Li &lt;git@thegavinli.com&gt;
Signed-off-by: Christoph Hellwig &lt;hch@lst.de&gt;
Acked-by: Catalin Marinas &lt;catalin.marinas@arm.com&gt; # arm64
</content>
</entry>
</feed>
