mbox series

[0/2] Refactor Data Structures for TI K3 R5 remoteproc

Message ID 20250219091042.263819-1-b-padhi@ti.com (mailing list archive)
Headers show
Series Refactor Data Structures for TI K3 R5 remoteproc | expand

Message

Beleswar Prasad Padhi Feb. 19, 2025, 9:10 a.m. UTC
This series aligns the K3 R5 remoteproc's data structures with that of M4 and
DSP data structures, so that common functionalities between R5, DSP, M4 can be
refactored out later[0]. Thanks to Andrew for suggesting this idea[1], however I
have tweaked the implementation a bit, reasoning in Appendix.

Testing Done:
1. Tested boot of R5F remoteprocs in MCU and MAIN voltage domain in both
IPC-Only mode and Kernel remoteproc mode in all K3 J7* devices.
2. Tested IPC in Lockstep, Split and Single-CPU Mode configuration (wherever
applicable) of R5F remoteprocs in all K3 J7* devices.
3. Tested shutdown and power-up of R5F remoteprocs from Linux userspace in
Lockstep, Split and Single-CPU Mode configuration. (with additional patches for
graceful shutdown)
4. Verified no errors in device removal path by executing
`modprobe -r ti_k3_r5_remoteproc`
5. Tested that each patch in this series generates no new warnings/errors.

Note:
Could not test the Single-core mode configuration for R5F cluster, as J7*
devices do not have them.

[0]: https://lore.kernel.org/all/20250103101231.1508151-1-b-padhi@ti.com
[1]: https://lore.kernel.org/all/da80e039-bcea-41a3-83ec-e10ffb4b0c46@ti.com

Thanks,
Beleswar

Appendix:
Tried with both approaches suggested in [1]:
a. Two pointers for cores: With this approach, had to write lot of extra code in
error paths, which could be done easier with a loop. Sample code snippet: 
https://gist.github.com/3V3RYONE/8ee52c38a2411a0a5d31217781f1dc56

b. Array of two pointers: Got better with looping around cores, but still had to
check for out of bound edge cases etc, Plus had to loop at all error paths,
lengthier code.

c. Current Implementation: So, if we are already looping, why not use a list
instead of array, and let the list_* helpers take care of traversal etc. With
this, I had to do the least changes, plus we need not merge the two structs now,
thanks to void pointers. I think this was the thought when we first wrote the
driver (using list instead of arrays). Let me know if there is any drawbacks.

Beleswar Padhi (2):
  remoteproc: k3-r5: Re-order internal memory initialization function
  remoteproc: k3-r5: Refactor Data Structures to Align with DSP and M4

 drivers/remoteproc/ti_k3_r5_remoteproc.c | 510 ++++++++++++-----------
 1 file changed, 262 insertions(+), 248 deletions(-)