<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux/kernel/dma, branch v6.15</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=v6.15</id>
<link rel='self' href='https://git.shady.money/linux/atom?h=v6.15'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/'/>
<updated>2025-04-22T15:44:09Z</updated>
<entry>
<title>dma-coherent: Warn if OF reserved memory is beyond current coherent DMA mask</title>
<updated>2025-04-22T15:44:09Z</updated>
<author>
<name>Chen-Yu Tsai</name>
<email>wenst@chromium.org</email>
</author>
<published>2025-04-21T08:39:29Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=89461db349cc00816c01d55507d511466b3b7151'/>
<id>urn:sha1:89461db349cc00816c01d55507d511466b3b7151</id>
<content type='text'>
When a reserved memory region described in the device tree is attached
to a device, it is expected that the device's limitations are correctly
included in that description.

However, if the device driver failed to implement DMA address masking
or addressing beyond the default 32 bits (on arm64), then bad things
could happen because the DMA address was truncated, such as playing
back audio with no actual audio coming out, or DMA overwriting random
blocks of kernel memory.

Check against the coherent DMA mask when the memory regions are attached
to the device. Give a warning when the memory region can not be covered
by the mask.

A warning instead of a hard error was chosen, because it is possible
that existing drivers could be working fine even if they forgot to
extend the coherent DMA mask.

Signed-off-by: Chen-Yu Tsai &lt;wenst@chromium.org&gt;
Signed-off-by: Marek Szyprowski &lt;m.szyprowski@samsung.com&gt;
Link: https://lore.kernel.org/r/20250421083930.374173-1-wenst@chromium.org
</content>
</entry>
<entry>
<title>dma-mapping: Fix warning reported for missing prototype</title>
<updated>2025-04-22T13:06:33Z</updated>
<author>
<name>Balbir Singh</name>
<email>balbirs@nvidia.com</email>
</author>
<published>2025-04-22T11:40:34Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=cae5572ec9261f752af834cdaaf5a0ba0afcf256'/>
<id>urn:sha1:cae5572ec9261f752af834cdaaf5a0ba0afcf256</id>
<content type='text'>
lkp reported a warning about missing prototype for a recent patch.

The kernel-doc style comments are out of sync, move them to the right
function.

Cc: Marek Szyprowski &lt;m.szyprowski@samsung.com&gt;
Cc: Christoph Hellwig &lt;hch@lst.de&gt;

Reported-by: kernel test robot &lt;lkp@intel.com&gt;
Closes: https://lore.kernel.org/oe-kbuild-all/202504190615.g9fANxHw-lkp@intel.com/

Signed-off-by: Balbir Singh &lt;balbirs@nvidia.com&gt;
[mszyprow: reformatted subject]
Signed-off-by: Marek Szyprowski &lt;m.szyprowski@samsung.com&gt;
Link: https://lore.kernel.org/r/20250422114034.3535515-1-balbirs@nvidia.com
</content>
</entry>
<entry>
<title>dma/mapping.c: dev_dbg support for dma_addressing_limited</title>
<updated>2025-04-14T14:10:50Z</updated>
<author>
<name>Balbir Singh</name>
<email>balbirs@nvidia.com</email>
</author>
<published>2025-04-14T11:37:52Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=2042c352e21d19eaf5f9e22fb6afce72293ef28c'/>
<id>urn:sha1:2042c352e21d19eaf5f9e22fb6afce72293ef28c</id>
<content type='text'>
In the debug and resolution of an issue involving forced use of bounce
buffers, 7170130e4c72 ("x86/mm/init: Handle the special case of device
private pages in add_pages(), to not increase max_pfn and trigger
dma_addressing_limited() bounce buffers"). It would have been easier
to debug the issue if dma_addressing_limited() had debug information
about the device not being able to address all of memory and thus forcing
all accesses through a bounce buffer. Please see[2]

Implement dev_dbg to debug the potential use of bounce buffers
when we hit the condition. When swiotlb is used,
dma_addressing_limited() is used to determine the size of maximum dma
buffer size in dma_direct_max_mapping_size(). The debug prints could be
triggered in that check as well (when enabled).

Link: https://lore.kernel.org/lkml/20250401000752.249348-1-balbirs@nvidia.com/ [1]
Link: https://lore.kernel.org/lkml/20250310112206.4168-1-spasswolf@web.de/ [2]

Cc: Marek Szyprowski &lt;m.szyprowski@samsung.com&gt;
Cc: Robin Murphy &lt;robin.murphy@arm.com&gt;
Cc: "Christian König" &lt;christian.koenig@amd.com&gt;
Cc: Ingo Molnar &lt;mingo@kernel.org&gt;
Cc: Kees Cook &lt;kees@kernel.org&gt;
Cc: Bjorn Helgaas &lt;bhelgaas@google.com&gt;
Cc: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
Cc: Peter Zijlstra &lt;peterz@infradead.org&gt;
Cc: Andy Lutomirski &lt;luto@kernel.org&gt;
Cc: Alex Deucher &lt;alexander.deucher@amd.com&gt;
Cc: Bert Karwatzki &lt;spasswolf@web.de&gt;
Cc: Christoph Hellwig &lt;hch@infradead.org&gt;

Signed-off-by: Balbir Singh &lt;balbirs@nvidia.com&gt;
Reviewed-by: Christoph Hellwig &lt;hch@lst.de&gt;
Signed-off-by: Marek Szyprowski &lt;m.szyprowski@samsung.com&gt;
Link: https://lore.kernel.org/r/20250414113752.3298276-1-balbirs@nvidia.com
</content>
</entry>
<entry>
<title>dma/contiguous: avoid warning about unused size_bytes</title>
<updated>2025-04-09T15:28:53Z</updated>
<author>
<name>Arnd Bergmann</name>
<email>arnd@arndb.de</email>
</author>
<published>2025-04-09T15:15:42Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=d7b98ae5221007d3f202746903d4c21c7caf7ea9'/>
<id>urn:sha1:d7b98ae5221007d3f202746903d4c21c7caf7ea9</id>
<content type='text'>
When building with W=1, this variable is unused for configs with
CONFIG_CMA_SIZE_SEL_PERCENTAGE=y:

kernel/dma/contiguous.c:67:26: error: 'size_bytes' defined but not used [-Werror=unused-const-variable=]

Change this to a macro to avoid the warning.

Fixes: c64be2bb1c6e ("drivers: add Contiguous Memory Allocator")
Signed-off-by: Arnd Bergmann &lt;arnd@arndb.de&gt;
Signed-off-by: Marek Szyprowski &lt;m.szyprowski@samsung.com&gt;
Link: https://lore.kernel.org/r/20250409151557.3890443-1-arnd@kernel.org
</content>
</entry>
<entry>
<title>dma-mapping: fix missing clear bdr in check_ram_in_range_map()</title>
<updated>2025-03-12T12:41:44Z</updated>
<author>
<name>Baochen Qiang</name>
<email>quic_bqiang@quicinc.com</email>
</author>
<published>2025-03-07T03:03:50Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=8324993f60305e50f27b98358b01b9837e10d159'/>
<id>urn:sha1:8324993f60305e50f27b98358b01b9837e10d159</id>
<content type='text'>
As discussed in [1], if 'bdr' is set once, it would never get
cleared, hence 0 is always returned.

Refactor the range check hunk into a new helper dma_find_range(),
which allows 'bdr' to be cleared in each iteration.

Link: https://lore.kernel.org/all/64931fac-085b-4ff3-9314-84bac2fa9bdb@quicinc.com/ # [1]
Fixes: a409d9600959 ("dma-mapping: fix dma_addressing_limited() if dma_range_map can't cover all system RAM")
Suggested-by: Christoph Hellwig &lt;hch@lst.de&gt;
Signed-off-by: Baochen Qiang &lt;quic_bqiang@quicinc.com&gt;
Link: https://lore.kernel.org/r/20250307030350.69144-1-quic_bqiang@quicinc.com
Signed-off-by: Marek Szyprowski &lt;m.szyprowski@samsung.com&gt;
</content>
</entry>
<entry>
<title>dma-debug: fix physical address calculation for struct dma_debug_entry</title>
<updated>2024-11-28T09:19:16Z</updated>
<author>
<name>Fedor Pchelkin</name>
<email>pchelkin@ispras.ru</email>
</author>
<published>2024-11-27T18:59:26Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=aef7ee7649e02f7fc0d2e5e532f352496976dcb1'/>
<id>urn:sha1:aef7ee7649e02f7fc0d2e5e532f352496976dcb1</id>
<content type='text'>
Offset into the page should also be considered while calculating a physical
address for struct dma_debug_entry. page_to_phys() just shifts the value
PAGE_SHIFT bits to the left so offset part is zero-filled.

An example (wrong) debug assertion failure with CONFIG_DMA_API_DEBUG
enabled which is observed during systemd boot process after recent
dma-debug changes:

DMA-API: e1000 0000:00:03.0: cacheline tracking EEXIST, overlapping mappings aren't supported
WARNING: CPU: 4 PID: 941 at kernel/dma/debug.c:596 add_dma_entry
CPU: 4 UID: 0 PID: 941 Comm: ip Not tainted 6.12.0+ #288
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.16.2-debian-1.16.2-1 04/01/2014
RIP: 0010:add_dma_entry kernel/dma/debug.c:596
Call Trace:
 &lt;TASK&gt;
debug_dma_map_page kernel/dma/debug.c:1236
dma_map_page_attrs kernel/dma/mapping.c:179
e1000_alloc_rx_buffers drivers/net/ethernet/intel/e1000/e1000_main.c:4616
...

Found by Linux Verification Center (linuxtesting.org).

Fixes: 9d4f645a1fd4 ("dma-debug: store a phys_addr_t in struct dma_debug_entry")
Signed-off-by: Fedor Pchelkin &lt;pchelkin@ispras.ru&gt;
[hch: added a little helper to clean up the code]
Signed-off-by: Christoph Hellwig &lt;hch@lst.de&gt;
</content>
</entry>
<entry>
<title>dma-mapping: save base/size instead of pointer to shared DMA pool</title>
<updated>2024-11-14T09:45:09Z</updated>
<author>
<name>Geert Uytterhoeven</name>
<email>geert+renesas@glider.be</email>
</author>
<published>2024-11-12T18:39:37Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=22293c33738c14bb84b9d3e771bc37150e7cf8e7'/>
<id>urn:sha1:22293c33738c14bb84b9d3e771bc37150e7cf8e7</id>
<content type='text'>
On RZ/Five, which is non-coherent, and uses CONFIG_DMA_GLOBAL_POOL=y:

    Oops - store (or AMO) access fault [#1]
    CPU: 0 UID: 0 PID: 1 Comm: swapper Not tainted 6.12.0-rc1-00015-g8a6e02d0c00e #201
    Hardware name: Renesas SMARC EVK based on r9a07g043f01 (DT)
    epc : __memset+0x60/0x100
     ra : __dma_alloc_from_coherent+0x150/0x17a
    epc : ffffffff8062d2bc ra : ffffffff80053a94 sp : ffffffc60000ba20
     gp : ffffffff812e9938 tp : ffffffd601920000 t0 : ffffffc6000d0000
     t1 : 0000000000000000 t2 : ffffffffe9600000 s0 : ffffffc60000baa0
     s1 : ffffffc6000d0000 a0 : ffffffc6000d0000 a1 : 0000000000000000
     a2 : 0000000000001000 a3 : ffffffc6000d1000 a4 : 0000000000000000
     a5 : 0000000000000000 a6 : ffffffd601adacc0 a7 : ffffffd601a841a8
     s2 : ffffffd6018573c0 s3 : 0000000000001000 s4 : ffffffd6019541e0
     s5 : 0000000200000022 s6 : ffffffd6018f8410 s7 : ffffffd6018573e8
     s8 : 0000000000000001 s9 : 0000000000000001 s10: 0000000000000010
     s11: 0000000000000000 t3 : 0000000000000000 t4 : ffffffffdefe62d1
     t5 : 000000001cd6a3a9 t6 : ffffffd601b2aad6
    status: 0000000200000120 badaddr: ffffffc6000d0000 cause: 0000000000000007
    [&lt;ffffffff8062d2bc&gt;] __memset+0x60/0x100
    [&lt;ffffffff80053e1a&gt;] dma_alloc_from_global_coherent+0x1c/0x28
    [&lt;ffffffff80053056&gt;] dma_direct_alloc+0x98/0x112
    [&lt;ffffffff8005238c&gt;] dma_alloc_attrs+0x78/0x86
    [&lt;ffffffff8035fdb4&gt;] rz_dmac_probe+0x3f6/0x50a
    [&lt;ffffffff803a0694&gt;] platform_probe+0x4c/0x8a

If CONFIG_DMA_GLOBAL_POOL=y, the reserved_mem structure passed to
rmem_dma_setup() is saved for later use, by saving the passed pointer.
However, when dma_init_reserved_memory() is called later, the pointer
has become stale, causing a crash.

E.g. in the RZ/Five case, the referenced memory now contains the
reserved_mem structure for the "mmode_resv0@30000" node (with base
0x30000 and size 0x10000), instead of the correct "pma_resv0@58000000"
node (with base 0x58000000 and size 0x8000000).

Fix this by saving the needed reserved_mem structure's contents instead.

Fixes: 8a6e02d0c00e7b62 ("of: reserved_mem: Restructure how the reserved memory regions are processed")
Signed-off-by: Geert Uytterhoeven &lt;geert+renesas@glider.be&gt;
Reviewed-by: Oreoluwa Babatunde &lt;quic_obabatun@quicinc.com&gt;
Tested-by: Lad Prabhakar &lt;prabhakar.mahadev-lad.rj@bp.renesas.com&gt;
Signed-off-by: Christoph Hellwig &lt;hch@lst.de&gt;
</content>
</entry>
<entry>
<title>dma-mapping: fix swapped dir/flags arguments to trace_dma_alloc_sgt_err</title>
<updated>2024-11-08T13:56:39Z</updated>
<author>
<name>Sean Anderson</name>
<email>sean.anderson@linux.dev</email>
</author>
<published>2024-10-31T15:45:14Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=d5bbfbad58ec0ccd187282f0e171bc763efa6828'/>
<id>urn:sha1:d5bbfbad58ec0ccd187282f0e171bc763efa6828</id>
<content type='text'>
trace_dma_alloc_sgt_err was called with the dir and flags arguments
swapped. Fix this.

Fixes: 68b6dbf1f441 ("dma-mapping: trace more error paths")
Signed-off-by: Sean Anderson &lt;sean.anderson@linux.dev&gt;
Reported-by: kernel test robot &lt;lkp@intel.com&gt;
Closes: https://lore.kernel.org/oe-kbuild-all/202410302243.1wnTlPk3-lkp@intel.com/
Signed-off-by: Christoph Hellwig &lt;hch@lst.de&gt;
</content>
</entry>
<entry>
<title>dma-mapping: trace more error paths</title>
<updated>2024-10-29T07:54:06Z</updated>
<author>
<name>Sean Anderson</name>
<email>sean.anderson@linux.dev</email>
</author>
<published>2024-10-18T15:00:37Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=68b6dbf1f441c4eba3b8511728a41cf9b01dca35'/>
<id>urn:sha1:68b6dbf1f441c4eba3b8511728a41cf9b01dca35</id>
<content type='text'>
It can be surprising to the user if DMA functions are only traced on
success. On failure, it can be unclear what the source of the problem
is. Fix this by tracing all functions even when they fail. Cases where
we BUG/WARN are skipped, since those should be sufficiently noisy
already.

Signed-off-by: Sean Anderson &lt;sean.anderson@linux.dev&gt;
Reviewed-by: Steven Rostedt (Google) &lt;rostedt@goodmis.org&gt;
Signed-off-by: Christoph Hellwig &lt;hch@lst.de&gt;
</content>
</entry>
<entry>
<title>dma-mapping: use trace_dma_alloc for dma_alloc* instead of using trace_dma_map</title>
<updated>2024-10-29T07:54:03Z</updated>
<author>
<name>Sean Anderson</name>
<email>sean.anderson@linux.dev</email>
</author>
<published>2024-10-18T15:00:36Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=c4484ab86ee00f2d9236e2851621ea02c105f4cc'/>
<id>urn:sha1:c4484ab86ee00f2d9236e2851621ea02c105f4cc</id>
<content type='text'>
In some cases, we use trace_dma_map to trace dma_alloc* functions. This
generally follows dma_debug. However, this does not record all of the
relevant information for allocations, such as GFP flags. Create new
dma_alloc tracepoints for these functions. Note that while
dma_alloc_noncontiguous may allocate discontiguous pages (from the CPU's
point of view), the device will only see one contiguous mapping.
Therefore, we just need to trace dma_addr and size.

Signed-off-by: Sean Anderson &lt;sean.anderson@linux.dev&gt;
Reviewed-by: Steven Rostedt (Google) &lt;rostedt@goodmis.org&gt;
Signed-off-by: Christoph Hellwig &lt;hch@lst.de&gt;
</content>
</entry>
</feed>
