Skip to contentSkip to conversation

drivers: dma-coherent: Change order of allocation to PAGE_SIZE

RFC New Sricharan R 1 participant 1 message Jul 9, 2015

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

RFC 1/1 drivers: dma-coherent: Change order of allocation to PAGE_SIZE

dma_alloc_from_coherent uses get_order(size) which makes carve-out allocations not aligned on order boundaries to fail even though they are page aligned. So wanted to know why is it required to have the size aligned on order boundary. Changing it to get_order(PAGE_SIZE) makes the non aligned carve-out allocations to go through.

---
 drivers/base/dma-coherent.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/base/dma-coherent.c +1 -1
index 55b8398..72bdc6f 100644
@@ -156,7 +156,7 @@ int dma_alloc_from_coherent(struct device *dev, ssize_t size,
 				       dma_addr_t *dma_handle, void **ret)
 {
 	struct dma_coherent_mem *mem;
-	int order = get_order(size);
+	int order = get_order(PAGE_SIZE);
 	unsigned long flags;
 	int pageno;
 
Signature · 1 line
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation