dma-mapping: force bouncing if the kmalloc() size is not cache-line-aligned
[platform/kernel/linux-starfive.git] / kernel / dma / direct.h
index e38ffc5..97ec892 100644 (file)
@@ -94,7 +94,8 @@ static inline dma_addr_t dma_direct_map_page(struct device *dev,
                return swiotlb_map(dev, phys, size, dir, attrs);
        }
 
-       if (unlikely(!dma_capable(dev, dma_addr, size, true))) {
+       if (unlikely(!dma_capable(dev, dma_addr, size, true)) ||
+           dma_kmalloc_needs_bounce(dev, size, dir)) {
                if (is_pci_p2pdma_page(page))
                        return DMA_MAPPING_ERROR;
                if (is_swiotlb_active(dev))