Lines Matching +full:memory +full:- +full:mapped
8 of the API (and actual examples), see Documentation/core-api/dma-api-howto.rst.
11 Part II describes extensions for supporting non-consistent memory
13 non-consistent platforms (this is usually only legacy platforms) you
16 Part I - dma_API
17 ----------------
19 To get the dma_API, you must #include <linux/dma-mapping.h>. This
27 Part Ia - Using large DMA-coherent buffers
28 ------------------------------------------
36 Consistent memory is memory for which a write by either the device or
40 devices to read that memory.)
42 This routine allocates a region of <size> bytes of consistent memory.
51 Note: consistent memory can be expensive on some platforms, and the
53 consolidate your requests for consistent memory as much as possible.
59 the returned memory, like GFP_DMA).
67 Free a region of consistent memory you previously allocated. dev,
76 Part Ib - Using small DMA-coherent buffers
77 ------------------------------------------
81 Many drivers need lots of small DMA-coherent memory regions for DMA
84 much like a struct kmem_cache, except that they use the DMA-coherent allocator,
86 for alignment, like queue heads needing to be aligned on N-byte boundaries.
95 dma_pool_create() initializes a pool of DMA-coherent buffers
103 crossing restrictions, pass 0 for alloc; passing 4096 says memory allocated
112 Wraps dma_pool_alloc() and also zeroes the returned memory if the
122 This allocates memory from the pool; the returned memory will meet the
136 This puts memory back into the pool. The pool is what was passed to
138 were returned when that routine allocated the memory being freed.
147 memory back to the pool before you destroy it.
150 Part Ic - DMA addressing limitations
151 ------------------------------------
190 is the minimum required to cover all of memory. Examining the
213 transfer memory ownership. Returns %false if those calls can be skipped.
223 Part Id - Streaming DMA mappings
224 --------------------------------
232 Maps a piece of processor virtual memory so it can be accessed by the
233 device and returns the DMA address of the memory.
241 DMA_TO_DEVICE data is going from the memory to the device
242 DMA_FROM_DEVICE data is coming from the device to the memory
248 Not all memory regions in a machine can be mapped by this API.
250 physical memory. Since this API does not provide any scatter/gather
251 capability, it will fail if the user tries to map a non-physically
252 contiguous piece of memory. For this reason, memory to be mapped by
256 Further, the DMA address of the memory must be within the
259 the memory ANDed with the dma_mask is still equal to the DMA
260 address, then the device can perform DMA to the memory). To
261 ensure that the memory allocated by kmalloc is within the dma_mask,
262 the driver may specify various platform-dependent flags to restrict
269 maps an I/O DMA address to a physical memory address). However, to be
275 Memory coherency operates at a granularity called the cache
276 line width. In order for memory mapped by this API to operate
277 correctly, the mapped region must begin exactly on a cache line
278 boundary and end exactly on one (to prevent two separately mapped
287 of the memory region by the software and before it is handed off to
288 the device. Once this primitive is used, memory covered by this
289 primitive should be treated as read-only by the device. If the device
294 accesses data that may be changed by the device. This memory should
295 be treated as read-only by the driver. If the driver needs to write
299 isn't sure if the memory was modified before being handed off to the
301 you must always sync bidirectional memory twice: once before the
302 memory is handed off to the device (to make sure all memory changes
313 Unmaps the region previously mapped. All the parameters passed in
355 the returned DMA address with dma_mapping_error(). A non-zero return value
365 Returns: the number of DMA address segments mapped (this may be shorter
370 Please note that the sg cannot be mapped again if it has been mapped once.
394 mapped them to. On failure 0, is returned.
398 accessed sg->address and sg->length as shown above.
406 Unmap the previously mapped scatter/gather list. All the parameters
446 - Before reading values that have been written by DMA from the device
448 - After writing values that will be written to the device using DMA
450 - before *and* after handing memory to the device if the memory is
481 The interpretation of DMA attributes is architecture-specific, and
483 Documentation/core-api/dma-attributes.rst.
491 you could pass an attribute DMA_ATTR_FOO when mapping memory
494 #include <linux/dma-mapping.h>
495 /* DMA_ATTR_FOO should be defined in linux/dma-mapping.h and
496 * documented in Documentation/core-api/dma-attributes.rst */
520 Part II - Non-coherent DMA allocations
521 --------------------------------------
524 by the passed in device, but which need explicit management of memory ownership
536 This routine allocates a region of <size> bytes of non-coherent memory. It
549 kmalloc()) for the allocation, but rejects flags used to specify a memory
552 Before giving the memory to the device, dma_sync_single_for_device() needs
553 to be called, and before reading memory written by the device,
563 Free a region of memory previously allocated using dma_alloc_pages().
585 kernel virtual address for the allocated memory instead of the page structure.
593 Free a region of memory previously allocated using dma_alloc_noncoherent().
605 This routine allocates <size> bytes of non-coherent and possibly non-contiguous
606 memory. It returns a pointer to struct sg_table that describes the allocated
607 and DMA mapped memory, or NULL if the allocation failed. The resulting memory
608 can be used for struct page mapped into a scatterlist are suitable for.
610 The return sg_table is guaranteed to have 1 single DMA mapped segment as
611 indicated by sgt->nents, but it might have multiple CPU side segments as
612 indicated by sgt->orig_nents.
618 kmalloc()) for the allocation, but rejects flags used to specify a memory
623 Before giving the memory to the device, dma_sync_sgtable_for_device() needs
624 to be called, and before reading memory written by the device,
635 Free memory previously allocated using dma_alloc_noncontiguous(). dev, size,
650 Once a non-contiguous allocation is mapped using this function, the
683 memory or doing partial flushes.
693 Part III - Debug drivers use of the DMA-API
694 -------------------------------------------
696 The DMA-API as described above has some constraints. DMA addresses must be
702 To debug drivers and find bugs in the usage of the DMA-API checking code can
705 debugging of DMA-API usage" option in your kernel configuration. Enabling this
709 about what DMA memory was allocated for which device. If this code detects an
713 WARNING: at /data2/repos/linux-2.6-iommu/lib/dma-debug.c:448
716 forcedeth 0000:00:08.0: DMA-API: device driver frees DMA memory with wrong
717 function [device address=0x00000000640444be] [size=66 bytes] [mapped as
720 Pid: 0, comm: swapper Tainted: G W 2.6.28-dmatest-09289-g8bb99c0 #1
741 <EOI> <4>---[ end trace f6435a98e2a38c0e ]---
744 of the DMA-API call which caused this warning.
752 The debugfs directory for the DMA-API debugging code is called dma-api/. In
756 dma-api/all_errors This file contains a numeric value. If this
762 dma-api/disabled This read-only file contains the character 'Y'
764 happen when it runs out of memory or if it was
767 dma-api/dump This read-only file contains current DMA
770 dma-api/error_count This file is read-only and shows the total
773 dma-api/num_errors The number in this file shows how many
779 dma-api/min_free_entries This read-only file can be read to get the
785 dma-api/num_free_entries The current number of free dma_debug_entries
788 dma-api/nr_total_entries The total number of dma_debug_entries in the
791 dma-api/driver_filter You can write a name of a driver into this file
800 'dma_debug=off' as a boot parameter. This will disable DMA-API debugging.
810 out of dma_debug_entries and was unable to allocate more on-demand. 65536
811 entries are preallocated at boot - if this is too low for you boot with
825 dma-debug interface debug_dma_mapping_error() to debug drivers that fail