07 Mar, 2012

2 commits

  • 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
     
  • The resource table is an array of 'struct fw_resource' members, where
    each resource entry is expressed as a single member of that array.

    This approach got us this far, but it has a few drawbacks:

    1. Different resource entries end up overloading the same members of 'struct
    fw_resource' with different meanings. The resulting code is error prone
    and hard to read and maintain.

    2. It's impossible to extend 'struct fw_resource' without breaking the
    existing firmware images (and we already want to: we can't introduce the
    new virito device resource entry with the current scheme).

    3. It doesn't scale: 'struct fw_resource' must be as big as the largest
    resource entry type. As a result, smaller resource entries end up
    utilizing only small part of it.

    This is fixed by defining a dedicated structure for every resource type,
    and then converting the resource table to a list of type-value members.
    Instead of a rigid array of homogeneous structs, the resource table
    is turned into a collection of heterogeneous structures.

    This way:
    1. Resource entries consume exactly the amount of bytes they need.
    2. It's easy to extend: just create a new resource entry structure, and assign
    it a new type.
    3. The code is easier to read and maintain: the structures' members names are
    meaningful.

    While we're at it, this patch has several other resource table changes:
    1. The resource table gains a simple header which contains the
    number of entries in the table and their offsets within the table. This
    makes the parsing code simpler and easier to read.
    2. A version member is added to the resource table. Should we change the
    format again, we'll bump up this version to prevent breakage with
    existing firmware images.
    3. The VRING and VIRTIO_DEV resource entries are combined to a single
    VDEV entry. This paves the way to supporting multiple VDEV entries.
    4. Since we don't really support 64-bit rprocs yet, convert two stray u64
    members to u32.

    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