Skip to content

Commit 567f6a6

Browse files
Nicolas Saenz JulienneChristoph Hellwig
authored andcommitted
dma-direct: provide function to check physical memory area validity
dma_coherent_ok() checks if a physical memory area fits a device's DMA constraints. Signed-off-by: Nicolas Saenz Julienne <[email protected]> Signed-off-by: Christoph Hellwig <[email protected]>
1 parent 0dc589d commit 567f6a6

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

include/linux/dma-direct.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ static inline bool dma_capable(struct device *dev, dma_addr_t addr, size_t size,
6969
u64 dma_direct_get_required_mask(struct device *dev);
7070
gfp_t dma_direct_optimal_gfp_mask(struct device *dev, u64 dma_mask,
7171
u64 *phys_mask);
72+
bool dma_coherent_ok(struct device *dev, phys_addr_t phys, size_t size);
7273
void *dma_direct_alloc(struct device *dev, size_t size, dma_addr_t *dma_handle,
7374
gfp_t gfp, unsigned long attrs);
7475
void dma_direct_free(struct device *dev, size_t size, void *cpu_addr,

kernel/dma/direct.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ gfp_t dma_direct_optimal_gfp_mask(struct device *dev, u64 dma_mask,
7070
return 0;
7171
}
7272

73-
static bool dma_coherent_ok(struct device *dev, phys_addr_t phys, size_t size)
73+
bool dma_coherent_ok(struct device *dev, phys_addr_t phys, size_t size)
7474
{
7575
return phys_to_dma_direct(dev, phys) + size - 1 <=
7676
min_not_zero(dev->coherent_dma_mask, dev->bus_dma_limit);

0 commit comments

Comments
 (0)