This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TDA4VM: Remoteproc support for MCU R5Fs

Part Number: TDA4VM

Hello Karan/Gunter,

I'm posting this just to get a clear understanding of what's possible with TDA4VM MCU island. All in all our requirement is to be able to fully remoteproc launch firmware into MCU island R5Fs. Given the changes from SDK 7.1 (I'm using SDK 7.3) where a bunch DMSC stuff got moved to MCU R5F, such as Power Mgmt, Resource Mgmt, Sciserver, I wonder how we can provide Linux full remoteproc control to MCU R5F?

I get the below log on boot which indicates that MCU R5F has already started and will only operate in IPC-Only mode. Which makes sense given the boot procedure with ROM loading on MCU R5F.

[ 12.738925] [drm] Supports vblank timestamp caching Rev 2 (21.10.2013).
[ 12.745563] [drm] No driver support for vblank timestamp query.
[ 12.758442] [drm] Initialized tidss 1.0.0 20180215 for 4a00000.dss on minor 1
[ 12.766871] [drm] Cannot find any crtc or sizes
[ 12.915085] platform 41000000.r5f: R5F core may have been powered on by a different host, programmed state (0) != actual state (1)
[ 13.058331] platform 41000000.r5f: configured R5F for IPC-only mode
[ 13.197488] platform 41000000.r5f: assigned reserved memory node r5f-dma-memory@a0000000
[ 13.289958] remoteproc remoteproc3: 41000000.r5f is available
[ 13.414318] remoteproc remoteproc3: loading /lib/firmware/j7-mcu-r5f0_0-fw failed with error -22
[ 13.423916] platform 41400000.r5f: R5F core may have been powered on by a different host, programmed state (0) != actual state (1)
[ 13.435701] remoteproc remoteproc3: Direct firmware load for j7-mcu-r5f0_0-fw failed with error -22
[ 13.444758] remoteproc remoteproc3: powering up 41000000.r5f
[ 13.450456] remoteproc remoteproc3: loading /lib/firmware/j7-mcu-r5f0_0-fw failed with error -22
[ 13.465569] remoteproc remoteproc3: Direct firmware load for j7-mcu-r5f0_0-fw failed with error -22
[ 13.477577] remoteproc remoteproc3: request_firmware failed: -22
[ 13.652250] platform 41400000.r5f: configured R5F for IPC-only mode
[ 13.757735] platform 41400000.r5f: assigned reserved memory node r5f-dma-memory@a1000000
[ OK ] Created slice system-systemd\x2dfsck.slice.
[ 13.890109] remoteproc remoteproc4: 41400000.r5f is available
[ 14.019953] remoteproc remoteproc4: Direct firmware load for j7-mcu-r5f0_1-fw failed with error -2
[ 14.030786] remoteproc remoteproc4: powering up 41400000.r5f
[ 14.036493] remoteproc remoteproc4: Direct firmware load for j7-mcu-r5f0_1-fw failed with error -2
[ 14.053905] remoteproc remoteproc4: request_firmware failed: -2

The below log is from some changes I've made to Uboot to operate the MCU R5F in split mode. I see two rproc handles - seems the MCU is split. However, why does the second core still start in IPC-Only mode? How can I free the second core for full remoteproc control from Linux?

Is it possible to run everything that would normally run on lockstep MCU R5F on core0 and free up core1 for remoteproc?

It'd be good to understand what's possible and what the limitations are since I've not found documentation to help understand this.

Thanks

Vai

  • Hi Vai,

    Yes, your understanding is correct w.r.t 7.1+ SDK. The MCU R5F now runs a DM firmware that is integral to the functionality of the system alongwith TIFS/DMSC firmware. 

    The Linux R5 SPL does not perform any reset of MCU R5F, it rather loads a new DM firmware and branches to it. The MCU R5F cluster does come up in the same default mode the device is capable of at Power-On-Reset.  

    The LockStep-mode and Split-mode capability is dictated by eFuse for a given device. A LockStep-mode device is capable of supporting both through configuration, while a Split-mode device only ever supports Split-mode. On LockStep-mode devices, MCU R5F continues to stay in LockStep-mode and is running its firmware at R5 SPL, so it will always be in IPC-only mode and it is not possible to switch to remoteproc mode. On Split-mode only devices, MCU R5F Core0 will be running the DM firmware and will always be in IPC-only mode, and it should be possible to boot the Core1 at either U-Boot or in kernel.

    What is your device capable of? You should be able to tell by looking at the status bit-field values retrieved from a ti_sci_proc_get_status() call. 

    regards

    Suman

  • Hi Suman,

    I'm using TDA4VM - which has a configurable MCU island, so it can operate in either Lockstep or Split mode. Does this mean that despite the Uboot device config changes and boot mode = 2 (split), both core0 and core1 will start in IPC-only mode?

    Or is there a way to operate core1 differently and control it with Linux kernel/remoteproc?

    Also, can you send me some detailed documentation on this to better my understanding?

    Thanks

    Vai

  • Hi Vai,

    Please look up the register CTRLMMR_MCUSEC_CLSTR0_CFG in the TRM. The LOCKSTEP_EN bit is set for LockStep enabled devices, and this is the default value inherited by LOCKSTEP bit which dictates the active mode. On power-up, any R5F capable of LOCKSTEP_EN comes up by default in LockStep mode. This is the mode that R5 ROM brings up the MCU R5 while booting R5 SPL, and R5 SPL continues to run the DM firmware in the same state.

    The mode can only be changed when the cores are in reset. So, for you to be able to change MCU R5F into Split-mode, you would have to reset the MCU R5F, but that will break the system functionality. Please see the TRM chapter, "6.3.3.2 R5FSS Cortex-R5F Core", the description is not very detailed there. 

    I am not sure what changes you have made to U-Boot to put it into Split-mode. Are you sure you are running 7.1+ SDK when you did this?

    This should have errored out when trying to change the mode while the cores are running. It would have been possible only on 7.0 and prior SDKs where if R5 SPL hasn't enabled booting MCU R5F, it would be shutdown after launching ATF, and U-Boot or Kernel is free to change the modes and boot accordingly.

    regards

    Suman

  • Hi Suman,

    Yes, I'm using SDK 7.3.

    The changes I made are to R5 SPL and not Uboot. In particular, I applied the patch below and used the new tiboot3.bin. I also had a couple of device tree changes to Uboot to instantiate each MCU R5FSS core separately, but those are trivial. When I used the newly generated tispl.bin, yes I did get an error from A72 ATF. But the older version (vanilla SDK 7.3) did not complain.

    diff --git a/tools/k3_gen_x509_cert.sh b/tools/k3_gen_x509_cert.sh
    index b6d055f6f5..428abb7547 100755
    --- a/tools/k3_gen_x509_cert.sh
    +++ b/tools/k3_gen_x509_cert.sh
    @@ -204,6 +204,7 @@ if [ $BOOTCORE == 0 ]; then # BOOTCORE M3, loaded by ROM
    CERTTYPE=2
    elif [ $BOOTCORE == 16 ]; then # BOOTCORE R5, loaded by ROM
    CERTTYPE=1
    + BOOTCORE_OPTS=2
    else # Non BOOTCORE, loaded by SYSFW
    BOOTCORE_OPTS_VER=$(printf "%01x" 1)
    # Add input args option for SET and CLR flags.

    Yep, I've read the 6.3.3 section of TRM and also looked into what each piece of boot step is doing. I might need some clarification. You're saying that R5 ROM starts MCU R5 in lockstep mode (always?) and it needs to relinquish control by SPL shutdown before it can be reconfigured to split mode. Did I understand this right? Does this mean that given SDK 7.1+ DMSC running on it, it'll never be shutdown and hence we cannot ever operate MCU R5 in split mode (because it needs to be held in reset to configure MMR CLSTR CFG)?

    Is there any possible workaround to operate the MCU R5F in split mode at all?

    Thanks
    Vai

  • Hi Vai,

    With default SDK, R5 ROM starts the MCU R5 in LockStep mode on the devices capable of LockStep (most common behavior). The changes you made will bring up the MCU R5 in Split-mode, with Core0 running the regular SPL code and then branching off to DM binary. Core1 will be parked in WFI (arch/arm/mach-k3/lowlevel_init.S). ROM does bring up R5 SPL using a reset cycle, so this is possible (MCU R5 is running from totally different memories between ROM and SPL stages). But if MCU R5F is brought up in LockStep mode as with default SDK, then we cannot change the mode without breaking the system.

    The U-Boot code currently lacks the logic to shutdown this Core1. If this can be done in R5 SPL, then Core1 should be configurable from either U-Boot or from Kernel. Note that Core0 should never be powered down since it is running DM firmware. This behavior was possible in 7.0 SDK when there is no firmware found for MCU R5F at R5 SPL stage. 

    regards

    Suman

  • Hi Suman,

    Thanks a lot for this detail.

    Do you guys have a patch for R5 SPL that I could use to to shutdown core1? This would be really useful to us and possibly others experiencing the same bottleneck. We could use some help from TI to get this functionality.

    Thanks
    Vai

  • Hi Vai,

    Nope, there is no ready-made patch available that shuts down Core1. This definitely takes a bit of effort to get this feature functional and done cleanly.

    regards

    Suman 

  • Hi Suman,

    Thanks. Any idea when we can have this feature? This would really help us develop faster on MCU island.

    Thanks

    Vai

  • Hi Vai,

    This is going to be a new feature request/enhancement. We need few weeks to come back with a plan. I will close this thread for now.

    regards

    Suman