When DSP process successfully spawned on the ADSP ,
the APPS side init memory is getting unmapped due to an error in driver,
by the time error printing in user space logs the SMMU fault is happening in ADSP.
So add the error log in fastrpc_init_create_dynamic_process.
Acked-by: Ramesh Nallagopu <rnallago@qti.qualcomm.com>
Change-Id: I6df8000e9e34fa0916947528a52793b164ab3acb
Signed-off-by: Santosh Sakore <quic_ssakore@quicinc.com>
This change enables sharing of a new page to DSP.
New page will contain inital debug parameters which we
need to pass to the DSP during the process initiation.
Change-Id: I8ae12cb364811a97eca3f15e70106b36bcec3f54
Signed-off-by: Vamsi Krishna Gattupalli <quic_vgattupa@quicinc.com>
LE static analysis KW is giving error from fastrpc traces because
traces are using __assign_str() which translates to strcpy() and
this is a deprecated API.
Kernel team suggested to use memcpy instead of __assign_str().
Change-Id: Idf92446a26d8b6f472963e9215f738df3f6fcdef
Thread T1 add buffer to fl->cached_bufs and release fl->hlock and holding
buffer reference. Now thread T2 will aquire fl->hlock and free buffer in
fastrpc_cached_buf_list_free(). T1 will dereference the freed buffer.
Moving reference buffer uses for T1 inside fl->hlock to avoid UAF.
Change-Id: I5f08d5497099133f87d55f5879cfe50c2ba23ae6
Signed-off-by: Santosh Sakore <quic_ssakore@quicinc.com>
To log error for fastrpc_mmap_remove_ssr and
compat_fastrpc_get_dsp_info for avoiding null pointer
dereferences leading to kw issues.
Change-Id: I515485d891331e0740722a0de1291353db645b66
Acked-by: Ansa Ahmed <ansa@qti.qualcomm.com>
Signed-off-by: Vamsi Krishna Gattupalli <quic_vgattupa@quicinc.com>
Currently async job is first added to pending context list and later
job is send to remote sub system. After the job is added to pending
context list, if any SSR happens, all the async pending job contexts are
responded and freed in async response thread. Original thread that added
job to pending context list might not have sent the job, as there is SSR and can
free the context again in same thread. Queue response in SSR only when
the job is sent to remote sub system.
Signed-off-by: Himateja Reddy <quic_hmreddy@quicinc.com>
Change-Id: I1f880316f327a8345433d5d22b619ef0a50d7240
In TVM buffers might be lend from PVM and ownership might
be shared between TVM and PVM. This might lead to some issues
in TVM.
Change-Id: I9c2ea67c1c4664512881a301cf57ab5e204f6a65
Signed-off-by: Edgar Flores <quic_edgarf@quicinc.com>
In current code fastrpc_file_free and bus driver invoke call are in
parallel, we would see corruption as both try to access fastrpc_mmap
list. To resolve this issue added signaling mechanism between
fastrpc_file_free and bus driver invoke call. If bus driver invoke
call is running in parallel with fastrpc_file_free, it would wait
until the invoke call is completed. Also added locks in bus driver API
to protect fastrpc_mmap's.
To improve code readablity created separate API for bus driver map
and unmap.
Change-Id: I5fd6f331febdecb319b168b36590a73e4532038a
Signed-off-by: Anirudh Raghavendra <quic_araghave@quicinc.com>
after allocation of a buffer, verify if null is returned.
if null check is success then bailout.
Change-Id: Idbc94c6cf109d34340b55b25f8df74afd5975d36
Signed-off-by: Vamsi Krishna Gattupalli <quic_vgattupa@quicinc.com>
Acked-by: ANANDU E <anane@qti.qualcomm.com>
Current map and buf flags are not being printed in the debugfs data
of process. Print map and buf flags.
Change-Id: I621e7ca08de45f189d5b49046b3c37cfef968d54
Acked-by: DEEPAK SANNAPAREDDY <sdeeredd@qti.qualcomm.com>
Signed-off-by: Vamsi Krishna Gattupalli <quic_vgattupa@quicinc.com>
If pd is down, new device ioctls wait for pdup before
copying ioctl params and saving ctx information.
Shift logic to check pdup from device_ioctl to after
context creation and before invoke send to allow
current ioctl information to be store in pending ctx.
Change-Id: Ia9747394020fd35b02f4074a82edecace72f87db
Signed-off-by: nishant chaubey <quic_chaubey@quicinc.com>
Fixes to fastrpc trusted driver to run on TVM.
Added a workqueue for receiving kernel packets.
Changed array allocation of kernel sockets to save space.
Original design was allocating static 2-d array glist_session_ctrl
for all possible subsystems and domains.
New implementation is allocating staic 2-d reference array.
Each entry in the array will only be allocated if remote domain
is supported.
Change-Id: I303375822714aa6f8eadf525b09326aa05714fd7
Signed-off-by: Edgar Flores <quic_edgarf@quicinc.com>
Increasing number of allowed sessions from 13 to 14 to accomodate
the shared context banks for CPZ.
Change-Id: Ie0757dae9d0876f5e827daab4fe9e9a661fc0680
Signed-off-by: Anirudh Raghavendra <quic_araghave@quicinc.com>
CMA alloc will not work on TVM. Stubbing out fastrpc_alloc_cma_memory
in fastrpc_init to prevent errors during loading.
Change-Id: I5774f1f0333da86582b9aca8b9cdeae725eaf64f
Signed-off-by: Anirudh Raghavendra <quic_araghave@quicinc.com>
Currently hyp_assign_phys is being used to assign mmeory to remote
subsystems. hyp_assign_phys is not upstream friendly. Use qcom_scm_assign_mem
in place of hyp_assign_phys to deprecate downstream API.
Signed-off-by: Himateja Reddy <quic_hmreddy@quicinc.com>
Change-Id: Ic4aed6570598a96e6401777836bd390ede877ff2
Add copy_to_dist_dir to Bazel build to output kernel build outputs
to dist dir.
Change-Id: Ic6ae4a1b98e9672aa1beba11aeff3707b0d78667
Signed-off-by: John Moon <quic_johmoo@quicinc.com>
CDSP state flag is not updated after subsystem is shutdown. Due to
this CDSP image loading is skipped. Update state flag after unloading.
Change-Id: Ife49e6845da4a6bfe149c04459c6823c09ccde31
Signed-off-by: Abhinav Parihar <quic_parihar@quicinc.com>
Current subsystem state flag cannot define all state of the subsystem.
Different handling might be needed for different subsystem states.
Add multiple subsystem state support.
Change-Id: Id091dfded583c8cd7e95c0d306de6dd34b03485d
Acked-by: Santosh Sakore <ssakore@qti.qualcomm.com>
Signed-off-by: Vamsi Krishna Gattupalli <quic_vgattupa@quicinc.com>
Currently no debug information of when ctx interrupted,
restored. This make ioctl hang/high invoke time issues
hard to debug. Add variables to store interrupted, restore
timestamp in pending ctx and gmsg_log.
Change-Id: I32226e96c54acb5878f2b8d37110bae7f65d49f3
Signed-off-by: nishant chaubey <quic_chaubey@quicinc.com>
Add ioctl control support to exit notif and async
threads.
Change-Id: Ifc7212fd84bdba46724252e00e1d479865cefc64
Signed-off-by: nishant chaubey <quic_chaubey@quicinc.com>
spin_lock should be released before bailing.
Change-Id: I3ac6043221272fa1dda2f36f4add810df41a17f3
Acked-by: ANANDU E <anane@qti.qualcomm.com>
Signed-off-by: Vamsi Krishna Gattupalli <quic_vgattupa@quicinc.com>
Mapping refcount goes to negative value when internal invoke fails. This
prevents in hyp assigning the memory back to dsp.
Change-Id: I3b0f4a80e8fd1cde43e5b6fe94030258eb01ead1
Acked-by: Abhinav Parihar <parihar@qti.qualcomm.com>
Signed-off-by: Vamsi Krishna Gattupalli <quic_vgattupa@quicinc.com>
Signed-off-by: Himateja Reddy <quic_hmreddy@quicinc.com>
To log error for fastrpc_mmap_remove_ssr and
compat_fastrpc_get_dsp_info for avoiding null pointer
dereferences leading to kw issues.
Change-Id: I0f759ce5d9c3100a5cff3e61ad1499f6eb1b55dd
Signed-off-by: Ansa Ahmed <ansaahme@qti.qualcomm.com>
Add .am files for LE build compilation. These files will replace
Makefile and Kbuild files only on LE builds.
Change-Id: Ib8dfa89523adf802acce57be0d2064f790bac6d2
Signed-off-by: Anirudh Raghavendra <quic_araghave@quicinc.com>
Currently memory shared to QRTR is not mapped with IOMMU_CACHE
flag. When using iommu_map_sg, IOMMU_CACHE flag makes the memory
coherent. Add IOMMU_CACHE flag to iommu_mag_sg to make memory
shared to QRTR coherent on APPS. Also remove DMA_ATTR_NO_KERNEL_MAPPING
attribute while allocating memory as it doesn't have significance when
the memory is coherent.
Signed-off-by: Himateja Reddy <quic_hmreddy@quicinc.com>
Currently PD type is getting updated with some magic numbers. Add
enum with different PD type information and use these types instead
of magic numbers for better code readability.
Change-Id: I20eb03726cabfcc88589be215c3c967b608a9cdb
Acked-by: Ekansh Gupta <ekangupt@qti.qualcomm.com>
Signed-off-by: Vamsi Krishna Gattupalli <quic_vgattupa@quicinc.com>
Add support for fastrpc modules to be built with bazel for
pineapple
Change-Id: Iaf655ee70258c745c3885ac9b0c82ff9f0830a8b
Signed-off-by: Anirudh Raghavendra <quic_araghave@quicinc.com>
Signed-off-by: John Moon <quic_johmoo@quicinc.com>
iommu/dma header was made to be private, need to remove it.
Change-Id: I16472ecb8af26699e1fe5a5316c44c4df9069dab
Signed-off-by: Maria Yu <quic_aiquny@quicinc.com>
Currently the init memeory size allocated for user PD is fixed.
This may not be sufficent for some usecases. This change will
allow configuring initial memory size allocated for signed user PD.
Change-Id: I2b12cf98c96b1e11daaad7e1bbf1d3777f43c1b6
Acked-by: ANANDU E <anane@qti.qualcomm.com>
Signed-off-by: Vamsi Krishna Gattupalli <quic_vgattupa@quicinc.com>
Currently CPZ secure context banks are not shared on CDSP. Share
CP secure context banks among applications that use secure memory,
so that many CPZ applications can be spawned and offloaded to DSP.
Change-Id: I77d95bab86ef527e41c9fe79058742615f4adb0e
Signed-off-by: Himateja Reddy <quic_hmreddy@quicinc.com>
Added comment to fastrpc_check_pd_status for daemons to wait before
audio or sensors PD is up.
Change-Id: I2d908cbf4b642386aec97ef1afe38b6af572d9a5
Signed-off-by: Anirudh Raghavendra <quic_araghave@quicinc.com>
If a trusted process is requesting for unsigned PD, set process
attribute to launch it as a system unsigned PD on remote subsystem to
get additional privileges.
Change-Id: Ie29f02ba16f2c4e68bf4cd1c75731915d40a9241
Signed-off-by: Thyagarajan Venkatanarayanan <quic_venkatan@quicinc.com>
Number of parameters in print statement was less than number of
format specifiers. This was causing an error with the new kernel
compiler.
Change-Id: Iad4ed0ad373559ecd64e8d9bfb1da37532f443c9
Signed-off-by: Anirudh Raghavendra <quic_araghave@quicinc.com>
When the PDR mechanism is down, the value of ispdup is always 0.
This makes the sensors or audio daemon wait indefinitely in the
kernel.
Disabling wait in kernel when PDR mechanism is not working.
Change-Id: I556dc0aa3908bc97b433cbd6060b88a710923b58
Signed-off-by: Anirudh Raghavendra <quic_araghave@quicinc.com>
Adding rules for compiling frpc_adsprpc ko and cdsploader
ko.
Change-Id: Ie0d13018fea971ffa20f0183c17a299ca47f29c7
Signed-off-by: Anirudh Raghavendra <quic_araghave@quicinc.com>