mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-11 15:11:48 -04:00
qcacmn: Add QDF WAR for x86 to allocate consistent memory from high mem
Add a WAR to ensure consistent memory allocation is above 0x50000000 region for x86 builds for Lithium CRs-Fixed: 1112381 Change-Id: If9e05f9d4ba05676d66e065d663a268058f0c110
This commit is contained in:
parent
a447105852
commit
28285a0ac7
1 changed files with 32 additions and 0 deletions
|
|
@ -1454,6 +1454,38 @@ void *qdf_mem_alloc_consistent(qdf_device_t osdev, void *dev, qdf_size_t size,
|
|||
return vaddr;
|
||||
}
|
||||
|
||||
#elif defined(QCA_WIFI_QCA8074) && defined(BUILD_X86)
|
||||
#define QCA8074_RAM_BASE 0x50000000
|
||||
#define QDF_MEM_ALLOC_X86_MAX_RETRIES 10
|
||||
void *qdf_mem_alloc_consistent(qdf_device_t osdev, void *dev, qdf_size_t size,
|
||||
qdf_dma_addr_t *phy_addr)
|
||||
{
|
||||
int flags = GFP_KERNEL;
|
||||
void *alloc_mem = NULL;
|
||||
int alloc_try_high_mem = 0;
|
||||
|
||||
if (in_interrupt() || irqs_disabled() || in_atomic())
|
||||
flags = GFP_ATOMIC;
|
||||
|
||||
*phy_addr = 0;
|
||||
|
||||
while (alloc_try_high_mem++ < QDF_MEM_ALLOC_X86_MAX_RETRIES) {
|
||||
alloc_mem = dma_alloc_coherent(dev, size, phy_addr, flags);
|
||||
|
||||
if (alloc_mem == NULL) {
|
||||
qdf_print("%s failed , size: %zu!\n", __func__, size);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (*phy_addr < QCA8074_RAM_BASE) {
|
||||
dma_free_coherent(dev, size, alloc_mem, *phy_addr);
|
||||
alloc_mem = NULL;
|
||||
} else
|
||||
break;
|
||||
}
|
||||
|
||||
return alloc_mem;
|
||||
}
|
||||
#else
|
||||
void *qdf_mem_alloc_consistent(qdf_device_t osdev, void *dev, qdf_size_t size,
|
||||
qdf_dma_addr_t *phy_addr)
|
||||
|
|
|
|||
Loading…
Reference in a new issue