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
     

29 Jul, 2020

1 commit

  • Add a new helper function rproc_of_parse_firmware() to the remoteproc
    core that can be used by various remoteproc drivers to look up the
    the "firmware-name" property from a rproc device node. This property
    is already being used by multiple drivers, so this helper can avoid
    repeating equivalent code in remoteproc drivers.

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

    Suman Anna
     

22 Jul, 2020

1 commit

  • Move all coredump functionality to an individual file. This is
    being done so that the current functionality can be extended
    in future patchsets.

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

    Rishabh Bhatnagar
     

17 Jul, 2020

1 commit

  • 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
     

23 Apr, 2020

2 commits

  • 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
     
  • Since checks are present in the remoteproc elf loader before calling
    da_to_va, loading a elf64 will work on 32bits flavors of kernel.
    Indeed, if a segment size is larger than what size_t can hold, the
    loader will return an error so the functionality is equivalent to
    what exists today.

    Acked-by: Suman Anna
    Signed-off-by: Clement Leger
    Link: https://lore.kernel.org/r/20200422093017.10985-1-cleger@kalray.eu
    Signed-off-by: Bjorn Andersson

    Clement Leger
     

26 Mar, 2020

4 commits

  • In order to support elf64, use macros from remoteproc_elf_helpers.h
    to access elf headers depending on elf class.
    To allow new drivers to support elf64, add rproc_elf_sanity_check
    function which make more sense than adding a elf64 named one since
    it will support both elf versions.
    Driver which need to support both elf32/elf64 should use this new
    function for elf sanity check instead of the elf32 one.

    Signed-off-by: Clement Leger
    Tested-by: Arnaud POULIQUEN
    Link: https://lore.kernel.org/r/20200302093902.27849-7-cleger@kalray.eu
    Signed-off-by: Bjorn Andersson

    Clement Leger
     
  • Since this function will be modified to support both elf32 and elf64,
    rename the existing one to elf32 (which is the only supported format
    at the moment). This will allow not to introduce possible side effect
    when adding elf64 support (ie: all backends will still support only
    elf32 if not requested explicitely using rproc_elf_sanity_check).

    Signed-off-by: Clement Leger
    Link: https://lore.kernel.org/r/20200302093902.27849-6-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
     
  • 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
     

18 Jul, 2019

1 commit

  • Pull remoteproc updates from Bjorn Andersson:
    "This adds support for the STM32 remoteproc, additional i.MX platforms
    with Cortex M4 remoteprocs and Qualcomm's QCS404 Compute DSP.

    Also initial support for vendor specific resource table entries and
    support for unprocessed Qualcomm firmware files"

    * tag 'rproc-v5.3' of git://github.com/andersson/remoteproc:
    remoteproc: stm32: fix building without ARM SMCC
    remoteproc: qcom: q6v5-mss: Fix build error without QCOM_MDT_LOADER
    remoteproc: copy parent dma_pfn_offset for vdev
    remoteproc: qcom: q6v5-mss: Support loading non-split images
    soc: qcom: mdt_loader: Support loading non-split images
    remoteproc: stm32: add an ST stm32_rproc driver
    dt-bindings: remoteproc: add bindings for stm32 remote processor driver
    dt-bindings: stm32: add bindings for ML-AHB interconnect
    remoteproc: Use struct_size() helper
    remoteproc: add vendor resources handling
    remoteproc: imx: Fix typo in "failed"
    remoteproc: imx: Broaden the Kconfig selection logic
    remoteproc,rpmsg: add missing MAINTAINERS file entries
    remoteproc: qcom: qdsp6-adsp: Add support for QCS404 CDSP
    dt-bindings: remoteproc: Rename and amend Hexagon v56 binding

    Linus Torvalds
     

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
     

05 Jun, 2019

1 commit

  • Based on 1 normalized pattern(s):

    this software is licensed under the terms of the gnu general public
    license version 2 as published by the free software foundation and
    may be copied distributed and modified under those terms this
    program is distributed in the hope that it will be useful but
    without any warranty without even the implied warranty of
    merchantability or fitness for a particular purpose see the gnu
    general public license for more details

    extracted by the scancode license scanner the SPDX license identifier

    GPL-2.0-only

    has been chosen to replace the boilerplate/reference in 285 file(s).

    Signed-off-by: Thomas Gleixner
    Reviewed-by: Alexios Zavras
    Reviewed-by: Allison Randal
    Cc: linux-spdx@vger.kernel.org
    Link: https://lkml.kernel.org/r/20190529141900.642774971@linutronix.de
    Signed-off-by: Greg Kroah-Hartman

    Thomas Gleixner
     

21 Feb, 2019

3 commits

  • With rproc_alloc_registered_carveouts() introduction, carveouts are
    allocated after resource table parsing.
    rproc_da_to_va() may return NULL at trace resource registering.
    This patch modifies trace debufs registering to provide device address
    (da) instead of va.
    da to va translation is done at each trace buffer access
    through debugfs interface.

    Fixes: d7c51706d095 ("remoteproc: add alloc ops in rproc_mem_entry struct")

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

    Loic Pallardy
     
  • 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
     

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
     

13 Feb, 2018

1 commit


16 Jan, 2018

2 commits

  • Extend the previous operation of finding the resource table in the ELF
    with the extra step of populating the rproc struct with a copy and the
    size. This allows drivers to override the mechanism used for acquiring
    the resource table, or omit it for firmware that is known not to have a
    resource table.

    This leaves the custom, dummy, find_rsc_table implementations found in
    some drivers dangling.

    Reviewed-By: Loic Pallardy
    Tested-By: Loic Pallardy
    Signed-off-by: Bjorn Andersson

    Bjorn Andersson
     
  • There are currently a few different schemes used for overriding fw_ops
    or parts of fw_ops. Merge fw_ops into rproc_ops and expose the default
    ELF-loader symbols so that they can be assigned by the drivers.

    To keep backwards compatibility with the "default" case, a driver not
    specifying the "load" operation is assumed to want the full ELF-loader
    suit of functions.

    Reviewed-By: Loic Pallardy
    Tested-By: Loic Pallardy
    Signed-off-by: Bjorn Andersson

    Bjorn Andersson
     

27 Jul, 2017

1 commit

  • The additional arguments in the internal __rproc_boot() function
    were dropped in commit 2bfc311a57f5 ("remoteproc: Drop wait in
    __rproc_boot()"). The exported rproc_boot() is now just a wrapper
    around this internal function, so merge them together.

    While at this, also remove the declaration for the previously
    cleaned up rproc_boot_nowait() function.

    Signed-off-by: Suman Anna
    Signed-off-by: Bjorn Andersson

    Suman Anna
     

15 Nov, 2016

1 commit


01 Nov, 2016

1 commit

  • This patch adds a sysfs interface to rproc allowing the firmware name
    and processor state to be changed dynamically.

    State was previously available in debugfs, and is replicated here. The
    firmware file allows retrieval of the running firmware name, and a new
    one to be specified at run time, so long as the remote processor has
    been stopped.

    Signed-off-by: Matt Redfearn
    Signed-off-by: Bjorn Andersson

    Matt Redfearn
     

13 Aug, 2016

1 commit


07 May, 2016

1 commit

  • By default, rproc_fw_boot() needs to wait for rproc to be configured,
    but a race may occur when using rpmsg/virtio. In this case, it can
    be called locally in a safe manor.

    This patch represents two usecases:

    - External call (via exported rproc_boot()), which waits
    - Internal call can use 'nowait' version of rproc_boot()

    Signed-off-by: Fabrice Gasnier
    Signed-off-by: Lee Jones
    Signed-off-by: Bjorn Andersson

    Lee Jones
     

02 May, 2015

1 commit

  • Fix all the checkpatch warnings in the core remoteproc
    code. The fixes cover the following warnings:
    1. WARNING: void function return statements are not generally useful
    2. WARNING: Possible unnecessary 'out of memory' message
    3. WARNING: line over 80 characters
    4. WARNING: braces {} are not necessary for single statement blocks
    5. WARNING: Unnecessary space before function pointer arguments

    Signed-off-by: Suman Anna
    Signed-off-by: Ohad Ben-Cohen

    Suman Anna
     

30 Jun, 2013

1 commit


05 Apr, 2013

1 commit

  • Add function find_loaded_rsc_table to firmware ops. This function
    returns the location of the resource table in shared memory
    after loading.

    Signed-off-by: Sjur Brændeland
    Acked-by: Ido Yariv
    [align function name with existing terminology, update commit log]
    [document new function, rebase patch, small cleanups]
    Signed-off-by: Ohad Ben-Cohen

    Sjur Brændeland
     

18 Sep, 2012

1 commit

  • Add rproc_trigger_recovery() which takes care of the recovery itself,
    by removing, and re-adding, all of the remoteproc's virtio devices.

    This resets all virtio users of the remote processor, during which
    the remote processor is powered off and on again.

    Signed-off-by: Fernando Guzman Lugo
    [ohad: introduce rproc_add_virtio_devices to avoid 1.copying code 2.anomaly]
    [ohad: some white space, naming and commit log changes]
    Signed-off-by: Ohad Ben-Cohen

    Fernando Guzman Lugo
     

15 Jul, 2012

2 commits

  • Firmware handling is made customizable.
    This is done by creating a separate ops structure for the
    firmware functions that depends on a particular firmware
    format (such as ELF). The ELF functions are default used
    unless the HW driver explicitly injects another firmware
    handler by updating rproc->fw_ops.
    The function rproc_da_to_va() is exported, as custom
    firmware handlers may need to use this function.

    Signed-off-by: Sjur Brændeland
    [ohad: namespace fixes, whitespace fixes, style fixes]
    Signed-off-by: Ohad Ben-Cohen

    Sjur Brændeland
     
  • Prepare for introduction of custom firmware loaders by
    moving all ELF related handling into a separate file.

    The functions: rproc_find_rsc_table(), rproc_fw_sanity_check(),
    rproc_find_rsc_table() and rproc_get_boot_addr() are moved
    to the new file remoteproc_elf_loader.c. The function
    rproc_da_to_va() is made non-static and is declared in
    remoteproc_internal.h

    No functional changes are introduced in this patch.

    Signed-off-by: Sjur Brændeland
    [ohad: rebase, fix kerneldoc, put prototypes in remoteproc_internal.h]
    Signed-off-by: Ohad Ben-Cohen

    Sjur Brændeland
     

04 Jul, 2012

1 commit

  • Dynamically allocate the vrings' DMA when the remote processor
    is about to be powered on (i.e. when ->find_vqs() is invoked),
    and release them as soon as it is powered off (i.e. when ->del_vqs()
    is invoked).

    The obvious and immediate benefit is better memory utilization, since
    memory for the vrings is now only allocated when the relevant remote
    processor is used.

    Additionally, this approach also makes recovery of a (crashing)
    remote processor easier: one just needs to remove the relevant
    vdevs, and the entire vrings cleanup takes place automagically.

    Tested-by: Fernando Guzman Lugo
    Signed-off-by: Ohad Ben-Cohen

    Ohad Ben-Cohen
     

07 Mar, 2012

1 commit

  • Now that the resource table supports publishing a virtio device
    in a single resource entry, firmware images can start supporting
    more than a single vdev.

    This patch removes the single vdev limitation of the remoteproc
    framework so multi-vdev firmwares can be leveraged: VDEV resource
    entries are parsed when the rproc is registered, and as a result
    their vrings are set up and the virtio devices are registered
    (and they go away when the rproc goes away).

    Moreover, we no longer only support VIRTIO_ID_RPMSG vdevs; any
    virtio device type goes now. As a result, there's no more any
    rpmsg-specific APIs or code in remoteproc: it all becomes generic
    virtio handling.

    Signed-off-by: Ohad Ben-Cohen
    Cc: Brian Swetland
    Cc: Iliyan Malchev
    Cc: Arnd Bergmann
    Cc: Grant Likely
    Cc: Rusty Russell
    Cc: Mark Grosen
    Cc: John Williams
    Cc: Michal Simek
    Cc: Loic PALLARDY
    Cc: Ludovic BARRE
    Cc: Omar Ramirez Luna
    Cc: Guzman Lugo Fernando
    Cc: Anna Suman
    Cc: Clark Rob
    Cc: Stephen Boyd
    Cc: Saravana Kannan
    Cc: David Brown
    Cc: Kieran Bingham
    Cc: Tony Lindgren

    Ohad Ben-Cohen
     

09 Feb, 2012

1 commit

  • Modern SoCs typically employ a central symmetric multiprocessing (SMP)
    application processor running Linux, with several other asymmetric
    multiprocessing (AMP) heterogeneous processors running different instances
    of operating system, whether Linux or any other flavor of real-time OS.

    Booting a remote processor in an AMP configuration typically involves:
    - Loading a firmware which contains the OS image
    - Allocating and providing it required system resources (e.g. memory)
    - Programming an IOMMU (when relevant)
    - Powering on the device

    This patch introduces a generic framework that allows drivers to do
    that. In the future, this framework will also include runtime power
    management and error recovery.

    Based on (but now quite far from) work done by Fernando Guzman Lugo
    .

    ELF loader was written by Mark Grosen , based on
    msm's Peripheral Image Loader (PIL) by Stephen Boyd .

    Designed with Brian Swetland .

    Signed-off-by: Ohad Ben-Cohen
    Acked-by: Grant Likely
    Cc: Brian Swetland
    Cc: Arnd Bergmann
    Cc: Tony Lindgren
    Cc: Russell King
    Cc: Rusty Russell
    Cc: Andrew Morton
    Cc: Greg KH
    Cc: Stephen Boyd

    Ohad Ben-Cohen