14 Dec, 2020

2 commits

  • To i.MX8QM/QXP partitioned M4 case, M4 will do self recovery when
    crashed. It not need Linux to reload firmware. So add a flag to indicate
    there is no need to request firmware when recovery.

    Acked-by: Richard Zhu
    Signed-off-by: Peng Fan

    Peng Fan
     
  • To arm64, "dc zva, dst" is used in memset.
    Per ARM DDI 0487A.j, chapter C5.3.8 DC ZVA, Data Cache Zero by VA,

    "If the memory region being zeroed is any type of Device memory,
    this instruction can give an alignment fault which is prioritized
    in the same way as other alignment faults that are determined
    by the memory type."

    On i.MX platforms, when elf is loaded to onchip TCM area, the region
    is ioremapped, so "dc zva, dst" will trigger abort. And ioremap_wc()
    on i.MX not able to write correct data to TCM area.

    So we need to use io helpers, and extend the elf loader to support
    platform specific memory functions.

    Acked-by: Richard Zhu
    Signed-off-by: Peng Fan

    Peng Fan
     

14 Oct, 2020

1 commit

  • Currently "default" configuration option means coredumps are
    enabled. To avoid confusion rename the "default" configuration
    option to "enabled" and disable collection of dumps by default
    as doing so makes sense for production devices.

    Signed-off-by: Rishabh Bhatnagar
    Link: https://lore.kernel.org/r/1601662144-5964-2-git-send-email-rishabhb@codeaurora.org
    Signed-off-by: Bjorn Andersson

    Rishabh Bhatnagar
     

05 Aug, 2020

1 commit

  • Add the character device interface into remoteproc framework.
    This interface can be used in order to boot/shutdown remote
    subsystems and provides a basic ioctl based interface to implement
    supplementary functionality. An ioctl call is implemented to enable
    the shutdown on release feature which will allow remote processors to
    be shutdown when the controlling userspace application crashes or hangs.

    Reviewed-by: Bjorn Andersson
    Reviewed-by: Mathieu Poirier
    Signed-off-by: Rishabh Bhatnagar
    Signed-off-by: Siddharth Gupta
    Link: https://lore.kernel.org/r/1596044401-22083-2-git-send-email-sidgup@codeaurora.org
    [bjorn: s/int32_t/s32/ per checkpatch]
    Signed-off-by: Bjorn Andersson

    Siddharth Gupta
     

22 Jul, 2020

2 commits

  • The current coredump implementation uses vmalloc area to copy
    all the segments. But this might put strain on low memory targets
    as the firmware size sometimes is in tens of MBs. The situation
    becomes worse if there are multiple remote processors undergoing
    recovery at the same time. This patch adds inline coredump
    functionality that avoids extra memory usage. This requires
    recovery to be halted until data is read by userspace and free
    function is called.

    Reviewed-by: Bjorn Andersson
    Reviewed-by: Sibi Sankar
    Reviewed-by: Mathieu Poirier
    Signed-off-by: Rishabh Bhatnagar
    Tested-by: Sibi Sankar
    Link: https://lore.kernel.org/r/1594938035-7327-5-git-send-email-rishabhb@codeaurora.org
    Signed-off-by: Bjorn Andersson

    Rishabh Bhatnagar
     
  • Change the segment dump API signature to include size and offset
    arguments. Refactor the qcom_q6v5_mss driver to use these
    arguments while copying the segment. Doing this lays the ground
    work for "inline" coredump functionality being added in the next
    patch.

    Tested-by: Sibi Sankar
    Reviewed-by: Bjorn Andersson
    Reviewed-by: Sibi Sankar
    Reviewed-by: Mathieu Poirier
    Signed-off-by: Rishabh Bhatnagar
    Link: https://lore.kernel.org/r/1594938035-7327-4-git-send-email-rishabhb@codeaurora.org
    Signed-off-by: Bjorn Andersson

    Rishabh Bhatnagar
     

18 Jul, 2020

1 commit

  • Make function rproc_resource_cleanup() public so that it can be
    used by platform drivers when allocating resources to be used by
    a detached remote processor.

    Acked-by: Arnaud Pouliquen
    Signed-off-by: Mathieu Poirier
    Link: https://lore.kernel.org/r/20200714200445.1427257-8-mathieu.poirier@linaro.org
    Signed-off-by: Bjorn Andersson

    Mathieu Poirier
     

17 Jul, 2020

3 commits

  • This patch prevents the firmware image name from being displayed when
    the remoteproc core is attaching to a remote processor. This is needed
    needed since there is no guarantee about the nature of the firmware
    image that is loaded by the external entity.

    Signed-off-by: Mathieu Poirier
    Reviewed-by: Arnaud Pouliquen
    Reviewed-by: Bjorn Andersson
    Tested-by: Arnaud Pouliquen
    Link: https://lore.kernel.org/r/20200714195035.1426873-10-mathieu.poirier@linaro.org
    Signed-off-by: Bjorn Andersson

    Mathieu Poirier
     
  • Add an new attach() operation in order to properly deal with
    scenarios where the remoteproc core needs to attach to a
    remote processor that has been booted by another entity.

    Signed-off-by: Mathieu Poirier
    Reviewed-by: Bjorn Andersson
    Tested-by: Arnaud Pouliquen
    Link: https://lore.kernel.org/r/20200714195035.1426873-3-mathieu.poirier@linaro.org
    Signed-off-by: Bjorn Andersson

    Mathieu Poirier
     
  • Add a new RPROC_DETACHED state to take into account scenarios
    where the remoteproc core needs to attach to a remote processor
    that is booted by another entity.

    Signed-off-by: Mathieu Poirier
    Reviewed-by: Bjorn Andersson
    Tested-by: Arnaud Pouliquen
    Link: https://lore.kernel.org/r/20200714195035.1426873-2-mathieu.poirier@linaro.org
    Signed-off-by: Bjorn Andersson

    Mathieu Poirier
     

13 May, 2020

1 commit

  • The current codebase makes use of the zero-length array language
    extension to the C90 standard, but the preferred mechanism to declare
    variable-length types such as these ones is a flexible array member[1][2],
    introduced in C99:

    struct foo {
    int stuff;
    struct boo array[];
    };

    By making use of the mechanism above, we will get a compiler warning
    in case the flexible array does not occur last in the structure, which
    will help us prevent some kind of undefined behavior bugs from being
    inadvertently introduced[3] to the codebase from now on.

    Also, notice that, dynamic memory allocations won't be affected by
    this change:

    "Flexible array members have incomplete type, and so the sizeof operator
    may not be applied. As a quirk of the original implementation of
    zero-length arrays, sizeof evaluates to zero."[1]

    sizeof(flexible-array-member) triggers a warning because flexible array
    members have incomplete type[1]. There are some instances of code in
    which the sizeof operator is being incorrectly/erroneously applied to
    zero-length arrays and the result is zero. Such instances may be hiding
    some bugs. So, this work (flexible-array member conversions) will also
    help to get completely rid of those sorts of issues.

    This issue was found with the help of Coccinelle.

    [1] https://gcc.gnu.org/onlinedocs/gcc/Zero-Length.html
    [2] https://github.com/KSPP/linux/issues/21
    [3] commit 76497732932f ("cxgb3/l2t: Fix undefined behaviour")

    Signed-off-by: Gustavo A. R. Silva
    Link: https://lore.kernel.org/r/20200507191943.GA16033@embeddedor
    Signed-off-by: Bjorn Andersson

    Gustavo A. R. Silva
     

23 Apr, 2020

1 commit

  • On some SoC architecture, it is needed to enable HW like
    clock, bus, regulator, memory region... before loading
    co-processor firmware.

    This patch introduces prepare and unprepare ops to execute
    platform specific function before firmware loading and after
    stop execution.

    Signed-off-by: Loic Pallardy
    Signed-off-by: Suman Anna
    Reviewed-by: Bjorn Andersson
    Reviewed-by: Mathieu Poirier
    Link: https://lore.kernel.org/r/20200417002036.24359-2-s-anna@ti.com
    Signed-off-by: Bjorn Andersson

    Loic Pallardy
     

21 Apr, 2020

2 commits

  • Add API functions devm_rproc_alloc() and devm_rproc_add(), which behave
    like rproc_alloc() and rproc_add() respectively, but register their
    respective cleanup function to be called on driver detach.

    Reviewed-by: Bjorn Andersson
    Signed-off-by: Paul Cercueil
    Link: https://lore.kernel.org/r/20200417170040.174319-2-paul@crapouillou.net
    Signed-off-by: Bjorn Andersson

    Paul Cercueil
     
  • For cases where @firmware is declared "const char *", use function
    kstrdup_const() to avoid needlessly creating another copy on the
    heap.

    Suggested-by: Bjorn Andersson
    Signed-off-by: Mathieu Poirier
    Reviewed-by: Alex Elder
    Reviewed-by: Bjorn Andersson
    Link: https://lore.kernel.org/r/20200420231601.16781-2-mathieu.poirier@linaro.org
    Signed-off-by: Bjorn Andersson

    Mathieu Poirier
     

20 Apr, 2020

1 commit

  • This function allows drivers to correctly setup the coredump output
    elf information.

    Reviewed-by: Bjorn Andersson
    Reviewed-by: Mathieu Poirier
    Signed-off-by: Clement Leger
    Link: https://lore.kernel.org/r/20200410102433.2672-2-cleger@kalray.eu
    Signed-off-by: Bjorn Andersson

    Clement Leger
     

26 Mar, 2020

5 commits

  • Introduce generic support for handling kernel panics in remoteproc
    drivers, in order to allow operations needed for aiding in post mortem
    system debugging, such as flushing caches etc.

    The function can return a number of milliseconds needed by the remote to
    "settle" and the core will wait the longest returned duration before
    returning from the panic handler.

    Reviewed-by: Mathieu Poirier
    Link: https://lore.kernel.org/r/20200324052904.738594-3-bjorn.andersson@linaro.org
    Signed-off-by: Bjorn Andersson

    Bjorn Andersson
     
  • Now that remoteproc can load an elf64, coredump elf class should be
    the same as the loaded elf class. In order to do that, add a
    elf_class field to rproc with default values. If an elf is loaded
    successfully, this field will be updated with the loaded elf class.
    Then, the coredump core code has been modified to use the generic elf
    macro in order to create an elf file with correct class.

    Reviewed-by: Mathieu Poirier
    Reviewed-by: Bjorn Andersson
    Signed-off-by: Clement Leger
    Link: https://lore.kernel.org/r/20200302093902.27849-9-cleger@kalray.eu
    Signed-off-by: Bjorn Andersson

    Clement Leger
     
  • elf64 entry is defined as a u64. Since boot_addr is used to store the
    elf entry point, change boot_addr type to u64 to support both elf32
    and elf64. In the same time, fix users that were using this variable.

    Reviewed-by: Bjorn Andersson
    Signed-off-by: Clement Leger
    Link: https://lore.kernel.org/r/20200302093902.27849-4-cleger@kalray.eu
    [bjorn: Fixes up return type of rproc_get_boot_addr()]
    Signed-off-by: Bjorn Andersson

    Clement Leger
     
  • Now that rproc_da_to_va uses a size_t for length, use a size_t for len
    field of rproc_mem_entry. Function used to create such structures now
    takes a size_t instead of int to allow full size range to be handled.

    Reviewed-by: Bjorn Andersson
    Reviewed-by: Mathieu Poirier
    Signed-off-by: Clement Leger
    Link: https://lore.kernel.org/r/20200302093902.27849-3-cleger@kalray.eu
    Signed-off-by: Bjorn Andersson

    Clement Leger
     
  • With upcoming changes in elf loader for elf64 support, section size will
    be a u64. When used with da_to_va, this will potentially lead to
    overflow if using the current "int" type for len argument. Change
    da_to_va prototype to use a size_t for len and fix all users of this
    function.

    Reviewed-by: Bjorn Andersson
    Reviewed-by: Mathieu Poirier
    Signed-off-by: Clement Leger
    Link: https://lore.kernel.org/r/20200302093902.27849-2-cleger@kalray.eu
    Signed-off-by: Bjorn Andersson

    Clement Leger
     

30 Jun, 2019

1 commit

  • In order to allow rproc backend to handle vendor resources such as in
    OpenAMP, add a handle_rsc hook. This hook allow the rproc backends to
    handle vendor resources as they like. The hook will be called only for
    vendor resources and should return RSC_HANDLED on successful resource
    handling, RSC_IGNORED if resource was ignored, or a negative value on
    error.

    Signed-off-by: Clement Leger
    Signed-off-by: Bjorn Andersson

    Clement Leger
     

21 Feb, 2019

2 commits

  • Commit 7e83cab824a87e83cab824a8 ("remoteproc: Modify recovery path
    to use rproc_{start,stop}()") replaces rproc_{shutdown,boot}() with
    rproc_{stop,start}(), which skips destroy the virtio device at stop
    but re-initializes it again at start.

    Issue is that struct virtio_dev is not correctly reinitialized like done
    at initial allocation thanks to kzalloc() and kobject is considered as
    already initialized by kernel. That is due to the fact struct virtio_dev
    is allocated and released at vdev resource handling level managed and
    virtio device is registered and unregistered at rproc subdevices level.

    Moreover kernel documentation mentions that device struct must be
    zero initialized before calling device_initialize().

    This patch disentangles struct virtio_dev from struct rproc_vdev as
    the two struct don't have the same life-cycle.

    struct virtio_dev is now allocated on rproc_start() and released
    on rproc_stop().

    This patch applies on top of patch
    remoteproc: create vdev subdevice with specific dma memory pool [1]

    [1]: https://patchwork.kernel.org/patch/10755781/

    Fixes: 7e83cab824a8 ("remoteproc: Modify recovery path to use rproc_{start,stop}()")

    Reported-by: Xiang Xiao
    Signed-off-by: Loic Pallardy
    Signed-off-by: Bjorn Andersson

    Loic Pallardy
     
  • This patch creates a dedicated vdev subdevice for each vdev declared
    in firmware resource table and associates carveout named "vdev%dbuffer"
    (with %d vdev index in resource table) if any as dma coherent memory pool.

    Then vdev subdevice is used as parent for virtio device.

    Signed-off-by: Loic Pallardy
    Signed-off-by: Bjorn Andersson

    Loic Pallardy
     

07 Jan, 2019

1 commit


20 Oct, 2018

2 commits


15 Oct, 2018

1 commit

  • Current version of rproc_alloc_vring function supports only dynamic vring
    allocation.

    This patch allows to allocate vrings based on memory region declatation.
    Vrings are now manage like memory carveouts, to communize memory management
    code in rproc_alloc_registered_carveouts().

    Allocated buffer is retrieved in rp_find_vq() thanks to
    rproc_find_carveout_by_name() functions for.

    This patch sets vrings names to vdev"x"vring"y" with x vdev index in
    resource table and y vring index in vdev. This will be updated when
    name will be associated to vdev in firmware resource table.

    Signed-off-by: Loic Pallardy
    Signed-off-by: Bjorn Andersson

    Loic Pallardy
     

10 Oct, 2018

6 commits

  • This patch introduces rproc_res_mem_entry_init() helper function to
    allocate a rproc_mem_entry structure from a reserved memory region.
    In that case, rproc_mem_entry structure has no alloc and release ops.
    It will be used to assigned the specified reserved memory to any
    rproc sub device.
    Relation between rproc_mem_entry and rproc sub device will be done
    by name.

    Signed-off-by: Loic Pallardy
    Signed-off-by: Bjorn Andersson

    Loic Pallardy
     
  • Memory entry could be allocated in different ways (ioremap,
    dma_alloc_coherent, internal RAM allocator...).
    This patch introduces an alloc ops in rproc_mem_entry structure
    to associate dedicated allocation mechanism to each memory entry
    descriptor in order to do remote core agnostic from memory allocators.

    The introduction of this ops allows to perform allocation of all registered
    carveout at the same time, just before calling rproc_start().
    It simplifies and makes uniform carveout management whatever origin.

    Signed-off-by: Loic Pallardy
    Signed-off-by: Bjorn Andersson

    Loic Pallardy
     
  • This patch introduces a new API to allow platform driver to register
    platform specific carveout regions.

    Signed-off-by: Loic Pallardy
    Acked-by: Bjorn Andersson
    Signed-off-by: Bjorn Andersson

    Loic Pallardy
     
  • This patch introduces rproc_mem_entry_init helper function to
    simplify rproc_mem_entry structure allocation and filling by
    client.

    Signed-off-by: Loic Pallardy
    Signed-off-by: Bjorn Andersson

    Loic Pallardy
     
  • Add name field in struct rproc_mem_entry.
    This new field will be used to match memory area
    requested in resource table with pre-registered carveout.

    Signed-off-by: Loic Pallardy
    Acked-by: Bjorn Andersson
    Signed-off-by: Bjorn Andersson

    Loic Pallardy
     
  • Memory entry could be allocated in different ways (ioremap,
    dma_alloc_coherent, internal RAM allocator...).
    This patch introduces a release ops in rproc_mem_entry structure
    to associate dedicated release mechanism to each memory entry descriptor
    in order to keep remoteproc core generic.

    Signed-off-by: Loic Pallardy
    Acked-by: Bjorn Andersson
    Signed-off-by: Bjorn Andersson

    Loic Pallardy
     

06 Oct, 2018

1 commit


27 Jun, 2018

3 commits

  • On rare occasions a subdevice might need to prepare some hardware
    resources before a remote processor is booted, and clean up some
    state after it has been shut down.

    One such example is the IP Accelerator found in various Qualcomm
    platforms, which is accessed directly from both the modem remoteproc
    and the application subsystem and requires an intricate lockstep
    process when bringing the modem up and down.

    Tested-by: Fabien Dessenne
    Signed-off-by: Bjorn Andersson
    [elder@linaro.org: minor description and comment edits]
    Signed-off-by Alex Elder
    Signed-off-by: Bjorn Andersson

    Bjorn Andersson
     
  • In preparation of adding the additional prepare and unprepare operations
    make the client responsible for filling out the function pointers of the
    rproc_subdev. This makes the arguments to rproc_add_subdev() more
    manageable, in particular when some of the functions are left out.

    Tested-by: Fabien Dessenne
    Signed-off-by: Bjorn Andersson
    [elder@linaro.org: added comment about assigning function pointers]
    Signed-off-by Alex Elder
    Signed-off-by: Bjorn Andersson

    Bjorn Andersson
     
  • "start" and "stop" are more suitable names for how these two operations
    are used, and they fit better with the upcoming introduction of two
    additional operations in the struct.

    Tested-by: Fabien Dessenne
    Signed-off-by: Bjorn Andersson
    [elder@linaro.org: minor comment edits]
    Signed-off-by Alex Elder
    Signed-off-by: Bjorn Andersson

    Bjorn Andersson
     

26 Apr, 2018

1 commit


13 Feb, 2018

2 commits