diff options
author | Victor Hsu <hsuvictor@google.com> | 2021-11-26 13:06:54 +0800 |
---|---|---|
committer | Victor Hsu <hsuvictor@google.com> | 2021-12-13 13:39:14 +0800 |
commit | 84364e386a0abebdf85e149073ec8e040b05800a (patch) | |
tree | df2ef1081254b82e50c824347e04cfd71efb2be1 /cnss2 | |
parent | 5cfb486d3f2b5f46683495ae82c1060da8118be4 (diff) | |
download | cnss2-84364e386a0abebdf85e149073ec8e040b05800a.tar.gz |
wcn6740: Change DMA allocation methods in mhi & cnss2
PCI rc driver hooks the op of dma_alloc_attrs() for S2MPU
To solve the allocation failure problem, change to use
dma_direct_alloc() instead.
Bug: 204280094
Signed-off-by: Victor Hsu <hsuvictor@google.com>
Change-Id: I86bdb8529d3fd2d3711ec8acbee76702ec9a4c06
Diffstat (limited to 'cnss2')
-rw-r--r-- | cnss2/pci.c | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/cnss2/pci.c b/cnss2/pci.c index c0853e6..4b764b1 100644 --- a/cnss2/pci.c +++ b/cnss2/pci.c @@ -13,6 +13,9 @@ #include <linux/suspend.h> #include <linux/memblock.h> #include <linux/completion.h> +#ifdef CONFIG_WCN_GOOGLE +#include <linux/dma-direct.h> +#endif #include "main.h" #include "bus.h" @@ -3590,10 +3593,15 @@ int cnss_pci_alloc_fw_mem(struct cnss_pci_data *pci_priv) for (i = 0; i < plat_priv->fw_mem_seg_len; i++) { if (!fw_mem[i].va && fw_mem[i].size) { fw_mem[i].va = +#ifdef CONFIG_WCN_GOOGLE + dma_direct_alloc(dev, fw_mem[i].size, + &fw_mem[i].pa, GFP_KERNEL, + fw_mem[i].attrs); +#else dma_alloc_attrs(dev, fw_mem[i].size, &fw_mem[i].pa, GFP_KERNEL, fw_mem[i].attrs); - +#endif if (!fw_mem[i].va) { cnss_pr_err("Failed to allocate memory for FW, size: 0x%zx, type: %u\n", fw_mem[i].size, fw_mem[i].type); @@ -3618,9 +3626,15 @@ static void cnss_pci_free_fw_mem(struct cnss_pci_data *pci_priv) cnss_pr_dbg("Freeing memory for FW, va: 0x%pK, pa: %pa, size: 0x%zx, type: %u\n", fw_mem[i].va, &fw_mem[i].pa, fw_mem[i].size, fw_mem[i].type); +#ifdef CONFIG_WCN_GOOGLE + dma_direct_free(dev, fw_mem[i].size, + fw_mem[i].va, fw_mem[i].pa, + fw_mem[i].attrs); +#else dma_free_attrs(dev, fw_mem[i].size, fw_mem[i].va, fw_mem[i].pa, fw_mem[i].attrs); +#endif fw_mem[i].va = NULL; fw_mem[i].pa = 0; fw_mem[i].size = 0; |