sc846: add remoteproc support - #3499
artursartamonovsadi wants to merge 3 commits into
Conversation
Update the SC846 SoM SHARC-FX node for the new remoteproc interface, including reset, system-vector, mailbox and vring configuration. Correct the L1 and L2 address ranges and relocate the resource table and vring into L2 memory. Signed-off-by: Arturs Artamonovs <Arturs.Artamonovs@analog.com>
Allow ADI_REMOTEPROC to be selected on ARCH_SC84X platforms so their SHARC DSP cores can use the ADI remoteproc driver. Signed-off-by: Arturs Artamonovs <Arturs.Artamonovs@analog.com>
Enable the ADI remoteproc driver to load ELF firmware alongside existing LDR images. Translate SHARC device addresses to physical memory and use MDMA to load segments and clear zero-filled regions, avoiding unsupported narrow ARM accesses to SHARC-FX instruction RAM. Set the system vector from the ELF entry point and use an embedded resource table when available. Fall back to the driver's built-in table for firmware without a resource table so RPMsg remains supported. Also correct L1 device-to-virtual address translation. Signed-off-by: Arturs Artamonovs <Arturs.Artamonovs@analog.com>
ukleinek
left a comment
There was a problem hiding this comment.
I didn't test this yet on sc5xx (but intent to). Just some general, mostly nitpick comments.
| u32 verify; | ||
| struct adi_sharc_resource_table *adi_rsc_table; | ||
| struct sharc_resource_table *loaded_rsc_table; | ||
| /* True when the resource table came from the firmware image itself |
There was a problem hiding this comment.
| /* True when the resource table came from the firmware image itself | |
| /* | |
| * True when the resource table came from the firmware image itself |
| * adi_elf_load_segments: load ELF PT_LOAD segments over MDMA | ||
| * | ||
| * Mirrors rproc_elf_load_segments() but routes every write through MDMA | ||
| * rather than memcpy(), because IRAM cannot take narrow accesses from the | ||
| * ARM. See adi_rproc_dma_write(). | ||
| * | ||
| * The SPU is held open for the duration of the load, as the LDR path does: | ||
| * the SHARC-FX bus completer ports reject non-secure accesses with an error | ||
| * response rather than completing them. | ||
| */ |
There was a problem hiding this comment.
I don't see how, but this would be considerably easier to mainline if it could reuse rproc_elf_load_segments() somehow (or a generic extension of it).
There was a problem hiding this comment.
I will try to look into it. As far as I understood problem is that Linux is non-secure level, and L2 access to SHARC-FX is only allowed to use with MDMA from non-secure state, when its also set in SPU to accept non secure access. MDMA SPU configured from U-boot
| * ELF has no equivalent pass, and without this ldr_load_addr would | ||
| * still hold SHARC_IDLE_ADDR from probe, leaving the core spinning in | ||
| * the bootrom idle loop instead of running the loaded firmware. Use | ||
| * the entry point remoteproc resolved through .get_boot_addr. |
There was a problem hiding this comment.
| * the entry point remoteproc resolved through .get_boot_addr. | |
| * the entry point remoteproc resolved through .get_boot_addr(). |
| if (ret < 0) | ||
| if (ret < 0) { | ||
| return ret; | ||
| } |
There was a problem hiding this comment.
This hunk should be dropped.
| if (da >= rproc_data->l1_da_range[0] && da < rproc_data->l1_da_range[1]) | ||
| ret = L1_shared_base + da; | ||
| else if (da >= rproc_data->l2_da_range[0] && da < rproc_data->l2_da_range[1]) | ||
| if (da >= rproc_data->l1_da_range[0] && da < rproc_data->l1_da_range[1]) { | ||
| ret = L1_shared_base + (da - rproc_data->l1_da_range[0]); | ||
| } | ||
| else if (da >= rproc_data->l2_da_range[0] && da < rproc_data->l2_da_range[1]) { | ||
| ret = L2_shared_base + (da - rproc_data->l2_da_range[0]); | ||
| } |
There was a problem hiding this comment.
This only adds curly braces that are not welcome in the kernel coding style. Please drop this hunk.
| &svect_args); | ||
| if (ret) | ||
| return dev_err_probe(dev, ret, "Missing adi,svect property\n"); | ||
|
|
There was a problem hiding this comment.
I would keep this empty line.
PR Description
Add support for remoteproc support on sc846 platform
PR Type
PR Checklist