Remoteproc - shubhi1407/PRU-framework GitHub Wiki

Continued from previous post

This project is built on top of the existing pruss_remoteproc driver, extending it further. The remoteproc framework by linux provides a general implementation for primarily these 4 components:

  1. Power up remoteprocessor
  2. Boot processor with firmware image (only elf format is supported as of now)
  3. Handle all resources provided in resource table ( with help of user provided functions where platform specific implementations are required. Ex interrupt controllers, power management register configs etc )
  4. Shutdown remoteprocessor.

We will not delve into the workings of remoteproc. It is well explained in this kernel doc and platform specific implementations can be found here

To move further, a brief explanation of resource table is in line. Simply put, resource table is structure published in the remote processor's firmware (specifically ".resource_table" ELF section ) to tell it about the resources available to it along with some configuration data for each resource (since we are not having complex auto-discovery mechanisms here). Now the question arises, What are resources ? Resource can range from memory carveouts dedicated for this processor,allocated vrings to custom resource such as interrupt controllers. All this explained in detail in this excellent file

Thus, the remoteproc driver, prior to booting the PRU, looks for its resource table section inside the firmware and configures all resources published there. Configuring the PRU Interrupt Controller (PRU INTC) is a necessity in most projects and hence is almost always present in resource table. vdev and vring resource is added if required. Have a look at PRU's resource table files in this repo.

This file shows how a resource table with vdev along with its vrings is declared. It is necessary to go through the components of each struct in the resource table to get a clear understanding. One can notice that almost entire declaration of vdevs and vrings is definitive and it is unlikely to change to change for different projects. This is so because the kernel driver is responsible to register and configure our vdev (and vrings ) once it is found in the resource table. The only parameter decided by the user in the resource table is the number of buffers in each vring.

Once configured and allocated, fields which will be required by the PRU such as da of vring, notify_id are published to the resource table.
NOTE : The rsc table resides in the PRU DRAM. This location can be found in the linker file (*.cmd) which specifies where each section of elf resides inside PRU memory.Look at the last line.

Continued in next post ...