Uploaded image for project: 'ROGUE'
  1. ROGUE
  2. ESROGUE-658

aes-stream-driver: dma_map_single() being depreciated in future

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: resolved
    • Icon: Major Major
    • None
    • None

      https://github.com/search?q=repo%3Aslaclab%2Faes-stream-drivers%20dma_map_single&type=code

      From https://gemini.google.com/app:

      Out of the presented functions, **only `dma_map_single()` is used for "zero copy" DMA**. However, it's important to understand limitations and better alternatives in the context of kernel 6.5.0:
      **`dma_map_single()`:**
      - While technically performing "zero copy" by avoiding extra data copies, it has potential **invalidation issues** and doesn't offer optimal DMA efficiency in all scenarios.
      - In kernel 6.5.0, its usage is **discouraged** due to these reasons.
      **Alternative functions:**
      - **`dma_alloc_coherent()**: This function allocates **physically contiguous and cache-coherent memory**, eliminating manual cache invalidation and supporting "zero copy" transfers.
      - **`dma_map_page()` or `dma_map_sg()`**: These functions map **scatter-gather lists (SG lists)** for DMA. While they still involve copying data within the kernel, they can be more efficient for **discontiguous buffers** or complex DMA operations.
      **Choosing the right approach:**
      The best approach depends on your specific use case and buffer characteristics:
      - For simple, physically contiguous buffers and hardware that supports cache coherency, **`dma_alloc_coherent()`** is optimal for "zero copy" transfers.
      - For discontiguous buffers or scenarios where you don't need full cache coherency, SG lists and their mapping functions provide a more efficient alternative.
      **Key points:**
      - **Avoid `dma_map_single()`** in kernel 6.5.0 for new development due to its limitations.
      - Choose **`dma_alloc_coherent()`** for simple contiguous buffers and "zero copy" with cache coherency.
      - Use **SG lists and their mapping functions** for discontiguous buffers or when full cache coherency isn't required.
      Remember that understanding both "zero copy" concepts and specific function characteristics is crucial for selecting the optimal approach for your driver in kernel 6.5.0.
       

              Unassigned Unassigned
              ruckman Larry Ruckman
              Larry Ruckman, Ryan Herbst
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: