From ca3e7ebe4fa60545dd3296e507607da921cb895d Mon Sep 17 00:00:00 2001 From: "Isaac J. Manjarres" Date: Wed, 20 May 2020 17:19:09 -0700 Subject: [PATCH] soc: qcom: mem-buf: Configure the mem-buf device's DMA mask The mem-buf device can handle memory from anywhere in the system. This includes memory with a physical address above 32 bits, so configure the DMA mask for the mem-buf device based on the system configuration. Change-Id: If91bb6d8044e8e6f47994acd7e50633b46596808 Signed-off-by: Isaac J. Manjarres --- drivers/soc/qcom/mem-buf.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/soc/qcom/mem-buf.c b/drivers/soc/qcom/mem-buf.c index 6636ba5c3dad..4a4af066ea90 100644 --- a/drivers/soc/qcom/mem-buf.c +++ b/drivers/soc/qcom/mem-buf.c @@ -1560,6 +1560,8 @@ static int mem_buf_probe(struct platform_device *pdev) int ret; struct device *dev = &pdev->dev; struct device *class_dev; + u64 dma_mask = IS_ENABLED(CONFIG_ARM64) ? DMA_BIT_MASK(64) : + DMA_BIT_MASK(32); if (of_property_match_string(dev->of_node, "qcom,mem-buf-capabilities", "supplier") >= 0) { @@ -1577,6 +1579,12 @@ static int mem_buf_probe(struct platform_device *pdev) return -EINVAL; } + ret = dma_set_mask_and_coherent(dev, dma_mask); + if (ret) { + dev_err(dev, "Unable to set dma mask: %d\n", ret); + return ret; + } + mem_buf_msgq_recv_thr = kthread_create(mem_buf_msgq_recv_fn, NULL, "mem_buf_rcvr"); if (IS_ERR(mem_buf_msgq_recv_thr)) {