Commit Graph

66 Commits

Author SHA1 Message Date
Jingyu Su
c82996e90f msm: eva: Extract DSP buffer info from debug queue
Extracts DSP buffer information for log printing upon SMMU faults

Change-Id: I36b1900ea84a85cdfdb2dec8ad62b67a5ff57119
Signed-off-by: Jingyu Su <quic_jingyus@quicinc.com>
2023-09-15 16:16:59 -07:00
George Shen
8adf2c6b69 msm: eva: Map dsp hfi queue using dma alloc api
Use dma_alloc_coherent to allocate 4MB dsp hfi queues and map
them in non-io-coherent way.

Change-Id: I6d8adb58ebcddae569259862a83e3aeffa3d2304
Signed-off-by: George Shen <quic_sqiao@quicinc.com>
2023-08-21 23:18:59 -07:00
George Shen
1028da124c msm: eva: Reduce HFI processing timeout to 1s
From original 2s. It enables CPU and DSP communication timeout
to 1.5s.

Change-Id: I33cba756e95cd2cc535927960610c1dab26d4242
Signed-off-by: George Shen <quic_sqiao@quicinc.com>
2023-08-02 11:25:32 -07:00
George Shen
b293b5b713 msm: eva: Rename hfi related devices
To avoid confusion in code reading and prepare for
future compatibility changes.

Change-Id: I43d61e18d2e2d75d1fd46ceb2e763511329ee32d
Signed-off-by: George Shen <quic_sqiao@quicinc.com>
2023-07-29 16:34:22 -07:00
George Shen
2c6f9ca542 msm: eva: Validate DSP buffer size
In case clients passing larger size than the actual dma-buf size.
It may avoid DSP caused SMMU fault.

Change-Id: I1f87d203f65a2d18d1a35e9e0b8dec281020150b
Signed-off-by: George Shen <quic_sqiao@quicinc.com>
2023-07-21 07:38:04 -07:00
Sabharsh Sidhu
0deded3f88 msm: eva: Enhance WarpNCC buffer validation
Add dmabuf-based WarpNCC metadata buffer
size validation to prevent fault in case
of erroneous OOB buffer content.

Change-Id: Iaa89e6c52d2c262d2266bdc3151b5b3feee79c5a
Signed-off-by: Sabharsh Sidhu <quic_ssidhu@quicinc.com>
2023-07-12 12:44:21 -07:00
George Shen
1e4ff767c3 msm: eva: Avoid double session close
In case DSP session creation failed due to reaching max
number of EVA sessions. There is a chance DSP may resend
delete session. Blocks re-deletion attempt.

Change-Id: Idf54a9eff124c60af5867b013de641c93450960f
Signed-off-by: George Shen <quic_sqiao@quicinc.com>
2023-06-30 07:38:55 -07:00
George Shen
b029f87904 msm: eva: Avoid using wrong bus client to vote
Fix a racing between power voting and SSR shutdown.

Change-Id: I75c13353174a514ef175056dd98f827a987bff7a
Signed-off-by: George Shen <quic_sqiao@quicinc.com>
2023-06-24 14:50:50 -07:00
Sabharsh Sidhu
fef6ef9ce5 msm: eva: Enhance WarpNCC OOB santization
Add WarpNCC user-space OOB pointer access
checks to improve code safety in case of
an under-allocated buffer.

Change-Id: I51e8464b37711d8ffcc1847376e2ebfb80f035b0
Signed-off-by: Sabharsh Sidhu <quic_ssidhu@quicinc.com>
2023-06-21 17:19:38 -07:00
George Shen
ea94318515 msm: eva: mmap firmware debug memory
For user mode to save into a dump file. It helps FW debugging.

Change-Id: I1c9c52d27d0dfd20e3eeb54b203416f6df095c8d
Signed-off-by: George Shen <quic_sqiao@quicinc.com>
2023-06-20 14:14:02 -07:00
George Shen
33825ea411 msm: eva: Fix KW issue
Change-Id: I93a8ff3ac20de452c2aa220a3dc4bc052880762e
Signed-off-by: George Shen <quic_sqiao@quicinc.com>
2023-06-05 17:01:56 -07:00
George Shen
304e2cf9c0 msm: eva: Allocate 1MB debug buffer for FW
For FW to hold debug info. Simplify driver structure for easy
dump in T32.

Change-Id: Ib310a3d9fe3437d5ce49783eb813fbb2d8bd3216
Signed-off-by: George Shen <quic_sqiao@quicinc.com>
2023-06-02 14:40:35 -07:00
George Shen
0ae23cf079 msm: eva: fix a compilation issue
That breaks kernel compilation due to PW setting override.

Change-Id: I9b15fe2676a9f2350684066363c4915fa3203016
Signed-off-by: George Shen <quic_sqiao@quicinc.com>
2023-06-01 10:55:54 -07:00
George Shen
43c37a29e1 msm: eva: Send EVA session error to UMD
Through POLL SSR event, only notify the error session. Other
sessions will not be impacted. This is different than SSR
handling.

Change-Id: I5acb4e21c19909b16350816621ae085d54fe05ac
Signed-off-by: George Shen <quic_sqiao@quicinc.com>
2023-06-01 08:36:30 -07:00
George Shen
4bd20f9c7c msm: eva: Fix a race in frame buf un-mapping
Fix the racing in buf-unmap between session close and frame
processing in fence path.

Change-Id: Ia7e7ac6549a856b97c583c00f526a81c575a3cb2
Signed-off-by: George Shen <quic_sqiao@quicinc.com>
2023-05-31 22:26:37 -07:00
George Shen
064e379912 msm: eva: Avoid printing freed dma_buf name
Drop dma_buf name from debugging property of smem. fd can provide
similar debug value for EVA clients.

Change-Id: I8a6ccf394f274e990efa6e3eef33e1fd84b362df
Signed-off-by: George Shen <quic_sqiao@quicinc.com>
2023-05-23 11:44:18 -07:00
George Shen
4e37a3a40b msm: eva: Adopt Fastrpc Feature Request
To support multi-PDs per user process. Fastrpc handle is
no longer PID. Add change to support the FR.

Change-Id: I39d7043f048597f1e4e728c48d588f12bb740b56
Signed-off-by: George Shen <quic_sqiao@quicinc.com>
2023-05-17 21:46:43 -07:00
George Shen
55c9e97cab msm: eva: Enhance DSP debugging
Validate session pointer passed in by DSP driver and save the
most recently un-mapped DSP buffers for SMMU fault debugging.

Change-Id: I1beebcce190874e3129fc1bd3806ffee61eb6d4d
Signed-off-by: George Shen <quic_sqiao@quicinc.com>
2023-05-05 12:18:43 -07:00
George Shen
2bdff6770e msm: eva: Enhance session error handling
Ensure smmu fault dump before calling BUG_ON. Rely on WD timeout
for FW hang debugging.

Change-Id: I0d7fba31dbc602b244af74da6774885c56af0fcc
Signed-off-by: George Shen <quic_sqiao@quicinc.com>
2023-05-01 21:46:25 -07:00
George Shen
1f5a03e9a6 msm: eva: Use pool allocator to allocate wncc oobs
Keep wncc working in case of kernel heap leakage. wncc buffer
requires 128kb. Driver will pre-allocate and store 8 buffers
in the pool if wncc use case starts.

Save all recently de-register wncc buffer mappings through
deregister_buffer API.

Change-Id: Iaa422bed9d3dd6f6cfe349a4931bfde28a3e3a51
Signed-off-by: George Shen <quic_sqiao@quicinc.com>
2023-04-27 13:52:41 -07:00
Sabharsh Sidhu
28d5691237 msm: eva: Update WarpNCC-related UAPI
Update UAPI for future backward compatibility.
Add mechanism to dynamically specify WarpNCC
metadata buffer offset instead of using macro.
Add UMD-KMD shared definitions header file.

Change-Id: If8ea7046e692eef1a784d2744228846b6f752d0d
Signed-off-by: Sabharsh Sidhu <quic_ssidhu@quicinc.com>
Signed-off-by: George Shen <quic_sqiao@quicinc.com>
2023-04-25 16:59:57 -07:00
George Shen
9d1d8dfa53 msm: eva: Use ratelimited kernel logging
In case of error recurring frequently.

Change-Id: I5d8f9b3a65a3d1faa6646c38dbd2e96d3beeca1b
Signed-off-by: George Shen <quic_sqiao@quicinc.com>
2023-03-31 10:03:42 -07:00
George Shen
5d31120817 msm: eva: Save buffer mappings of last frame
Help debugging SMMU fault.

Change-Id: I93f041b9c117f1cce0d4a8ad9f723d9d31b02010
Signed-off-by: George Shen <quic_sqiao@quicinc.com>
2023-03-19 22:06:35 -07:00
Sabharsh Sidhu
db7c8ad719 msm: eva: Add CVP_CMD debug logging
Add cmd logging functionality as an
alternative to pkt logging. This has
advantages related to log dropping
and log mangling.

Change-Id: I0ff6801445821e1224f83fa7e2eb8bf8a849962b
2023-03-17 15:17:23 -07:00
George Shen
e3d980caa1 msm: eva: Fix logging and timeout issues
synx signal used wrong logging tag. PARAMs buffer is treated
as persistent buffer to avoid unnecessary warning messages
complaining mapping in-use when session closed.

Change-Id: Ia44b943ba0d41d9f7fa276eabb369597552a4956
Signed-off-by: George Shen <quic_sqiao@quicinc.com>
2023-03-08 13:43:28 -08:00
George Shen
d665182aed msm: eva: Add FW 17 support due to HFI change
Non-secure ARP and CRC in BUFFER_TYPE, enabling IFPC.

Change-Id: I551e29e7770cdfd83b0ed9f7f925fb8bd6e6a4a6
Signed-off-by: George Shen <quic_sqiao@quicinc.com>
2023-02-24 12:14:27 -08:00
George Shen
4be6d0c36b msm: eva: Reset IOVA in invalid buf entry
Set 0 as IOVA and SIZE of the invalid buffer entry in HFI
packet.

Change-Id: I1ea90d2188a0dd6047fd24a44e16b9a40fc4d8dc
Signed-off-by: George Shen <quic_sqiao@quicinc.com>
2022-11-21 11:41:19 -08:00
George Shen
75bac29145 msm: eva: port eva-kernel.lnx.2.0 changes
Change-Id: I3121f71a11c8a48081309ad46c04bedc6b6a3ca1
Signed-off-by: George Shen <quic_sqiao@quicinc.com>
2022-11-15 10:06:14 -08:00
Ronald Karyodisa
816d381554 msm: eva: Fix dprintk compilation errors
Change-Id: Idc30f3b510ada403548f27df6dcb19793966e5f0
2022-11-08 09:29:44 -08:00
George Shen
1aed484f01 msm: eva: enabling support for data path bringup.
Add checksum support per packet type, configurable.
Add debug hook to print SID setting registers at SMMU fault.
Enable Auto-PIL.
Enable DSP interface.

Change-Id: Ie1fd2c584681b751836854667981a3c10beb56d4
Signed-off-by: George Shen <quic_sqiao@quicinc.com>
2022-10-26 15:29:57 -07:00
Yu SI
7597271dde msm: eva: synx v2 support
propagated sync v2 support from 2.0
reference 4162025

Change-Id: I3427657e21e7eda92088d828203a330ba3c86335
Signed-off-by: Yu SI <quic_ysi@quicinc.com>
Signed-off-by: George Shen <quic_sqiao@quicinc.com>
2022-10-10 18:20:57 -07:00
George Shen
991125b3b1 msm: eva: Enable Lanai compiling
EVA Kernel driver.

Change-Id: Ie415075a05707a20d9eac1e478a2f18c741b3446
Signed-off-by: George Shen <quic_sqiao@quicinc.com>
2022-09-28 18:33:20 -07:00
George Shen
fcbb3d87ab msm: eva: Propagate tip of 2.0 to 3.0
Add back all changes made after Aug. 3rd from
Kailua to Lanai.

Change-Id: I725b77892ab24354014b3d9bbc13d14c710aff5a
Signed-off-by: George Shen <quic_sqiao@quicinc.com>
2022-09-27 12:52:27 -07:00
George Shen
18119d7649 msm: eva: improve frame buf dump info
Fix a missing pkt_type dump from dma_cache.

Change-Id: I99bbbb7bd6278ecf04c8bfcbba041373ab28826d
Signed-off-by: George Shen <quic_sqiao@quicinc.com>
2022-08-05 18:30:43 -07:00
George Shen
e30e31d72b msm: eva: fix DSP session deletion racing
The racing to delete DSP session may happen after DSP SSR when
EVA DSP driver just sent session deletion command to CPU driver.

Change-Id: I252000bc2c04148874db02b50d0a94c10edbb6e6
Signed-off-by: George Shen <quic_sqiao@quicinc.com>
2022-08-03 08:56:21 -07:00
George Shen
dcbb74265f msm: eva: Add Lanai EVA HFI check
Adds XRA, DLFL, DLFD, RGE and ITOF packets sanity check.
Optimizes packet type table to avoid linear search during
each packet handling. Instead use packet type as index to expedite
searching. Packet type table grows to over 60 entries and each
entry uses 40B. There will be quite some memory access delay for
each packet handling without optimization.

Change-Id: I1ee26d0d5d0b83d3c15fbcafa7414017c418b6e3
Signed-off-by: George Shen <quic_sqiao@quicinc.com>
2022-07-29 11:02:27 -07:00
George Shen
04232ceea4 msm: eva: Fix fd reuse problem.
Fix KW issue and fd reuse issue in persistent buffer mapping.

Change-Id: I9d971abe14460ac57d9f48ee086f97abec1b6f2b
Signed-off-by: George Shen <quic_sqiao@quicinc.com>
2022-07-26 13:55:56 -07:00
George Shen
1cb056362c msm: eva: Add process name for debugging
Also fix a persistbuf optimization problem that failed
multi-loop DMM test.

Change-Id: Ib197077a708dea99967f0a9f4ed1c09d12023edc
Signed-off-by: George Shen <quic_sqiao@quicinc.com>
2022-07-08 16:57:03 -07:00
George Shen
e92994b6b9 msm: eva: Avoid caching persist buf mapping
Remove unused user persist buffer unmap code as the HFI of
UNMAP_USER_PERSIST is not supported.

Change-Id: If8ca0c24318adb1d33ab525ac0023bc5f8ae4573
Signed-off-by: George Shen <quic_sqiao@quicinc.com>
2022-07-06 12:51:32 -07:00
George Shen
4bfd66f039 msm: eva: Enhance SMMU fault debugability
Changes only applicable on CPU EVA path, including
- tracking packet type and buffer index for each dma_buf
- print feature config packet type
- print session properties in error cases.

Change-Id: I938cf463bee9284760145f3fd9e030b3b8134caa
Signed-off-by: George Shen <quic_sqiao@quicinc.com>
2022-07-01 09:25:43 -07:00
George Shen
6492155ccc msm: eva: Add LE support
Define CONFIG_EVA_LE compiler flag.
Add separate VM support module.
Define stub functions to initialize synx function table in case
SYNX is disabled.

Change-Id: I0f6b28cbd2a43cbb7f464629a329581a73c4de89
Signed-off-by: George Shen <quic_sqiao@quicinc.com>
2022-03-25 11:03:52 -07:00
George Shen
0c7f40b323 msm: eva: Validate WNCC table pointer before use
Reliably handle Kernel memory allocation failure.

Change-Id: I27fac01bf5ec45cc8d54757e245ef799f5459d1f
Signed-off-by: George Shen <quic_sqiao@quicinc.com>
2022-03-23 17:12:32 -07:00
Sabharsh Sidhu
01c34574ca msm: eva: Add WarpNCC CPU support
Adds Out-of-Band (OOB) functionality. Adds
WarpNCC OOB processing for metadata buffer
IOVA population. Adds WarpNCC source buffer
registration that does IOVA book-keeping and
returns buffer ID to UMD.

Change-Id: I182c270454eec194f28a31c494bae0ad9eface02
Signed-off-by: Sabharsh Sidhu <quic_ssidhu@quicinc.com>
2022-02-01 14:13:13 -08:00
Yu SI
4981885760 msm: eva: merged tip from eva-kernel.lnx.1.0
merged tip source code from eva-kernel.lnx.1.0,
and verify the promotion flow.

Change-Id: I031508fd8a23995a166506f3d190e5e228eb13c2
Signed-off-by: Yu SI <ysi@codeaurora.org>
2021-10-27 18:14:30 -07:00
George Shen
0e72292d71 msm: eva: Avoid dereference NULL smem
Check and return error in case of NULL smem.

Change-Id: I0f1f6a0746fe2110e0f5f306c22133caba6f2d63
Signed-off-by: George Shen <sqiao@codeaurora.org>
2021-09-20 16:18:54 -07:00
George Shen
f8342d4cf9 msm: eva: Remove deprecated header
Allows compiling independent of synx, fastrpc and mmrm readiness.

Avoid including KP 2.0 deprecated headers.

Change-Id: Ibf026f409b7f6284705c95b01a5251ac6a498b32
Signed-off-by: George Shen <sqiao@codeaurora.org>
2021-09-09 16:34:56 -07:00
George Shen
e230150be8 msm: eva: Check files pointer before accessing it
There is a chance user process crashed when EVA is being used.
In that case, files pointer is set to NULL by kernel. Add
support of global timestamp support. Check wfi after pc ready.

Change-Id: Id01d07a79beec03e48885dd051549b5c39bc4846
Signed-off-by: George Shen <sqiao@codeaurora.org>
2021-09-09 11:12:26 -07:00
George Shen
72eb20af3d msm: eva: Add SSR counter
Support configurable number of SSR tolerance before calling
BUG_ON in SMMU fault scenario.

Change-Id: I19dabbeaa1cf5be86f42a6ace62ef5da12743e79
Signed-off-by: George Shen <sqiao@codeaurora.org>
2021-08-13 13:43:45 -07:00
Chris Goldsworthy
30223d90a7 msm: eva: Fix DMA-BUF double free
msm_cvp_smem_put_dma_buf() releases the EVA driver's reference it uses
for DMA mappings, by decrementing the refcount of the underlying
struct file that all DMA-BUFs use for life cycle tracking. By
accident, the EVA driver held a direct reference to the underlying
file using the struct msm_cvp_smem->file variable. The EVA driver,
after releasing it's reference to the DMA-BUF, inadvertently called
fput() on the struct_cvp_smem->file variable, which leads to a double
free.

Resolve this by removing the struct msm_cvp_smmem->file variable, and
by removing the corresponding fput().

Change-Id: I108cd87509673008ff55fc94fda76aa21f21bd5d
Signed-off-by: Chris Goldsworthy <cgoldswo@codeaurora.org>
2021-07-30 10:22:54 -07:00
George Shen
966d521450 msm: eva: Remove warning during buf unmapping
Persistent buffer unmap is different than frame buffer. It's
expected to be released at the end of session instead of at
frame boundary. Remove the warning of "unexpected unmapping".

Change-Id: I24bfae0b67b1a8989e6a710556d94c8bc4e90aff
Signed-off-by: George Shen <sqiao@codeaurora.org>
2021-07-09 14:26:17 -07:00