Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'dma-mapping-5.17-1' of git://git.infradead.org/users/hch/dma-mapping

Pull dma-mapping fix from Christoph Hellwig:

- fix a swiotlb info leak (Halil Pasic)

* tag 'dma-mapping-5.17-1' of git://git.infradead.org/users/hch/dma-mapping:
swiotlb: fix info leak with DMA_FROM_DEVICE

+18 -1
+8
Documentation/core-api/dma-attributes.rst
··· 130 130 subsystem that the buffer is fully accessible at the elevated privilege 131 131 level (and ideally inaccessible or at least read-only at the 132 132 lesser-privileged levels). 133 + 134 + DMA_ATTR_OVERWRITE 135 + ------------------ 136 + 137 + This is a hint to the DMA-mapping subsystem that the device is expected to 138 + overwrite the entire mapped size, thus the caller does not require any of the 139 + previous buffer contents to be preserved. This allows bounce-buffering 140 + implementations to optimise DMA_FROM_DEVICE transfers.
+8
include/linux/dma-mapping.h
··· 62 62 #define DMA_ATTR_PRIVILEGED (1UL << 9) 63 63 64 64 /* 65 + * This is a hint to the DMA-mapping subsystem that the device is expected 66 + * to overwrite the entire mapped size, thus the caller does not require any 67 + * of the previous buffer contents to be preserved. This allows 68 + * bounce-buffering implementations to optimise DMA_FROM_DEVICE transfers. 69 + */ 70 + #define DMA_ATTR_OVERWRITE (1UL << 10) 71 + 72 + /* 65 73 * A dma_addr_t can hold any valid DMA or bus address for the platform. It can 66 74 * be given to a device to use as a DMA source or target. It is specific to a 67 75 * given device and there may be a translation between the CPU physical address
+2 -1
kernel/dma/swiotlb.c
··· 628 628 mem->slots[index + i].orig_addr = slot_addr(orig_addr, i); 629 629 tlb_addr = slot_addr(mem->start, index) + offset; 630 630 if (!(attrs & DMA_ATTR_SKIP_CPU_SYNC) && 631 - (dir == DMA_TO_DEVICE || dir == DMA_BIDIRECTIONAL)) 631 + (!(attrs & DMA_ATTR_OVERWRITE) || dir == DMA_TO_DEVICE || 632 + dir == DMA_BIDIRECTIONAL)) 632 633 swiotlb_bounce(dev, tlb_addr, mapping_size, DMA_TO_DEVICE); 633 634 return tlb_addr; 634 635 }