Add ioctl support for 32 bit userspace on 64bit platform.
Change-Id: I208c452993d10d1901eb926dcd4e4a0a1747eaea
Signed-off-by: Srinivas Marka <quic_smarka@quicinc.com>
dma_vmap is not freed in else case of is_iova, so kfree dma_vmap
when is_iova is false. And also if dma_buf_vmap kernel map is
failed, need to end cpu access dma buf.
Change-Id: I111fb7a2a367a8418f46a7b5fc1459d135d7115e
Signed-off-by: Prasad Kumpatla <quic_pkumpatl@quicinc.com>
add lock in ion free to protect dma buff and avoid
use after free.
Change-Id: I6376408ce1a5b98b7aeacc32e44ec4db08ff9df5
Signed-off-by: Prasad Kumpatla <quic_pkumpatl@quicinc.com>
Replace struct dam_buf_map with struct iosys_map and
Delete nonexistent header files and API calls.
Change-Id: I04f87dc9739b487b5a4fb7d7bb615198c27b9925
Signed-off-by: Prasad Kumpatla <quic_pkumpatl@quicinc.com>
Local variable is used for dma_vmap and same value is used for caching
which becomes invalid after going out of scope. Store in heap instead.
Change-Id: I2e291137dd461d0cdb49209a6c1d804f1e806457
If the userspace which has allocated & hyp assigned the CMA
memory crashes, the crash handler is just freeing the memory
without calling hyp assign to get access back. This leads
to crash when freeing the memory as HLOS driver does not have
access to memory.
Fix this by calling hyp_assign to get access back to
HLOS driver.
Change-Id: Ic04736cf241eb7e310b8ce0af260e147f4d1edc6
Signed-off-by: Vikram Panduranga <vpandura@codeaurora.org>
Signed-off-by: Akhil Karuturi <akarutur@codeaurora.org>
dma buffer virtuall mapping API has been updated in the kernel
update the ion driver to match the new interface
Change-Id: I3aab0609b91da7efcfb03dac99961ace498d79f3
Signed-off-by: Junkai Cai <junkai@quicinc.com>
ION_FLAG_CACHED is no longer supported for DMA
buf heap. Remove cache maintenance as it can be
counter productive for CMA memory.
Change-Id: I13c58a4304269c6140fbca891cf718ab6a0eb2fe
Signed-off-by: Vikram Panduranga <vpandura@codeaurora.org>
msm_audio_fd_data can be freed in msm_audio_delete_fd_entry and
msm_audio_ion_crash_handler.Add lock for msm_audio_ion_crash_handler
to avoid race condition during removal of msm_audio_fd_data and dereference.
Change-Id: I49dc0a1aca45ffad76b39e06fe075185d4281d00
Signed-off-by: Meng Wang <mengw@codeaurora.org>
Export symbol cannot be added for static functions.
Change-Id: Ief55b7868f2c16e5a11681e24432561d45765e52
Signed-off-by: Vikram Panduranga <vpandura@codeaurora.org>
Add change to properly handle the pointers by setting them to
NULL after free and adding some null checks before dereferencing.
Change-Id: I3e52b9a6885a8d8a91c09f75fe92ba69e3eb555f
Signed-off-by: Saurav Kumar <sauravk@codeaurora.org>
Add support for CMA heap allocation during call.
Change-Id: I65cd291a9db56bf53d9bb9b4e6c7236da9d7288c
Signed-off-by: Kunlei Zhang <kunleiz@codeaurora.org>
Rename casa to ar and gecko to spf in audio-kernel.
Change-Id: Ia37ee0497ce043443ca70131d2739737cb8f0366
Signed-off-by: Phani Kumar Uppalapati <phaniu@codeaurora.org>
Update the header file which defines ion allocation
in kernel 5.4.
Change-Id: I1dc09c32bf5ea611ba0e49c670d4dd32206dc1b3
Signed-off-by: Vignesh Kulothungan <vigneshk@codeaurora.org>
DMA buffer does not unmap after kernel ion map failure. It leads
to unexpected vaddr and memory leak.
Change-Id: I363dd9178a0bcbca601180bfd0a7bd7ef2430d3e
Signed-off-by: Xiaojun Sang <xsang@codeaurora.org>
Exposure of driver bind/unbind to userspace via sysfs may
lead to unexpected behavior.
Hide bind and unbind by driver attribute.
Change-Id: I20d6ee653bcc16af15d6368664aaf240c6645cd0
Signed-off-by: Xiaojun Sang <xsang@codeaurora.org>
Add a new API for mapping DMA resources
that needs to be attached to existing
SMMU SID.
Change-Id: I7a513d24ea30a5ead318e856e4c5317743fd0021
Signed-off-by: Vikram Panduranga <vpandura@codeaurora.org>
SMMU initialization is not required to be done in client
probe process. SMMU framework takes care of creating
domain and attaching device. Remove related code from
audio ion driver.
Change-Id: I3756c5abb7488afb43e20fae698c7008461a18cb
Signed-off-by: Meng Wang <mengw@codeaurora.org>
Switch audio drivers to SPDX identifier on msm-4.19.
Change-Id: Ic3f0230a516db251b8d81e8a7e73dbc04d66fe1b
Signed-off-by: Meng Wang <mengw@codeaurora.org>
In sm6150, LPASS has Agg NOC before SMMU transactions.
Agg NOC has HW limitation which considers IOVA as
physical DDR address and resulting in failure
for particular memory range. Update IOVA address
start address for audio to use different range.
CRs-Fixed: 2346788
Change-Id: Ieac3b8bdd6295a56039d9bca422d2f41e0d94944
Signed-off-by: Laxminath Kasam <lkasam@codeaurora.org>
If buf unmap is executed without successful kernel unmap
the vmap counter mismatches. Check for error scenarios in
kernel unmap function and ignore buf unmap if not necessary.
Change-Id: I3c5835dcdfe05db4baaa5cf904995ed8f89e9cfe
Signed-off-by: Karthikeyan Mani <kmani@codeaurora.org>
While allocating and importing ION buffers, make sure to check
for probe complete flag before proceeding instead of checking for
the flag AND smmu_enabled flag. This way the restriction will be
centralized for either types of targets with and without SMMU.
Change-Id: I558e19724d1002a602377a636e274bc90ca8262d
Signed-off-by: Banajit Goswami <bgoswami@codeaurora.org>
Device pointer needs to be stored during probe of msm_audio_ion
platform driver so that the same can be used later for mapping
dma_buff allocated for different clients. Store device pointer
for both cases where SMMU may be present or absent on a particular
platform.
Change-Id: I3d3d4ad254d41ac9490ff0dc98b95ffbc3e5042d
Signed-off-by: Banajit Goswami <bgoswami@codeaurora.org>
ION memory allocator is used for audio use cases even on targets
without SMMU. Add support for ION on those targets where ADSP
might not have an SMMU in front of it.
Change-Id: Iaacbd66edb32c8ee7c14a5ab291abe54960725b8
Signed-off-by: Banajit Goswami <bgoswami@codeaurora.org>
Update logic for pointer meant to hold virtual address of ION
buffers allocated, so that the pointer is available across
function boundary.
Change-Id: I7849498b9ccf0cbd7c357fa926eea6c4b65a194f
Signed-off-by: Banajit Goswami <bgoswami@codeaurora.org>
Use the newly added dma_buf_vmap API for mapping a dma_buf
to kernel address space.
Change-Id: Idacada71eb827b4af96a793a180456ae910e30e8
Signed-off-by: Banajit Goswami <bgoswami@codeaurora.org>
Update the API call sequence for cache operation for dma_buf.
Change-Id: I79ee36d083460b47c792120a857e92f26d9e3fe2
Signed-off-by: Banajit Goswami <bgoswami@codeaurora.org>
Add support for querying ION flags for dma_buf and for cache ops
on dma_buf with CACHED Flag on.
Change-Id: I219e564c477af8ba3b8676db1c9555a2b5b9ebab
Signed-off-by: Banajit Goswami <bgoswami@codeaurora.org>
Between Linux-4.9 and Linux-4.14, upstream has updated the
ION APIs significantly to make ION ready to bring out of
staging folder. This has changed the way ION and dma_buf
APIs used to work together for allocating, mapping and
deallocating ION buffers.
Update MSM Audio ION wrapper functions used by audio drivers
to reflect these ION API changes as per upstream ION.
Change-Id: I63097e147a397aa3a538f69ac88b6fb10871c3dc
Signed-off-by: Banajit Goswami <bgoswami@codeaurora.org>
Based on where the code is synced the driver should allow
both static and dynamic linked compilation.
Also remove __exit for modules loaded from another common
init/exit functions.
Change-Id: Ib58f152002aba3af4446f9bbd9b82c279212bd0a
Signed-off-by: Asish Bhattacharya <asishb@codeaurora.org>
Variable 'vm_page_prot' has different types in different
ARM platforms. Using macro "pgprot_val" to handle it to
fix compilation issue for sdxpoorwills targets.
Change-Id: Ic7b8de9860759cc56812e7a3ffb1aaea2b6779f9
Signed-off-by: Xiaoyu Ye <benyxy@codeaurora.org>
Switch to DLKM for all audio kernel modules.
Change-Id: I6a96023a21f655f873531af9ace81f2b01eb0f58
Signed-off-by: Laxminath Kasam <lkasam@codeaurora.org>