Commit Graph

247 Commits

Author SHA1 Message Date
Sarangdhar Joshi b003d45b37 remoteproc: Move rproc_delete_debug_dir() to rproc_del()
The "remoteproc{0,1...}" sysfs entries are added in
rproc_add() and deleted in rproc_type_release() instead of
in rproc_del(). That leaves these lingering entries sticking
around after we return from rproc_del(). Move the
rproc_delete_debug_dir() to rproc_del() to fix this.

Signed-off-by: Sarangdhar Joshi <spjoshi@codeaurora.org>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2017-01-30 14:18:40 -08:00
Bjorn Andersson a0c10687ec Revert "remoteproc: Merge table_ptr and cached_table pointers"
Following any fw_rsc_vdev entries in the resource table are two variable
length arrays, the first one reference vring resources and the second
one is the virtio config space.  The virtio config space is used by
virtio to communicate status and configuration changes and must as such
be shared with the remote.

The reverted commit incorrectly made any changes to the virtio config
space only affect the local copy, in an attempt to allowing memory
protection of the shared resource table.

This reverts commit cda8529346.
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2016-12-30 03:26:31 -08:00
Loic Pallardy c81c0e0710 remoteproc: fix vdev reference management
Commit 2b45cef586 ("remoteproc: Further extend the vdev life cycle")
extends kref support for vdev management.
It introduces a regression when following sequence is executed:
rproc_boot --> rproc_shutdown --> rproc_boot
Second rproc_boot call crashes on register_virtio_device as device
is already existing.
Issue is previous vdev is never released when rproc is stop because
associated refcount is too high.

kref_get introduces is not needed as kref_init already initializes
krefcount to 1 because it considers associated variable as used.
This introduces a misalignment between kref_get and kref_put calls.

Fixes: 2b45cef586 ("remoteproc: Further extend the vdev life cycle")
Signed-off-by: Loic Pallardy <loic.pallardy@st.com>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2016-12-30 03:15:42 -08:00
Bjorn Andersson 2bfc311a57 remoteproc: Drop wait in __rproc_boot()
In the event that rproc_boot() is called before the firmware loaded
completion has been flagged it will wait with the mutex held,
obstructing the request_firmware_nowait() callback from completing the
wait.

As rproc_fw_config_virtio() has been reduced to only triggering
auto-boot there is no longer a reason for waiting in rproc_boot(), so
drop this.

Cc: Sarangdhar Joshi <spjoshi@codeaurora.org>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2016-12-09 16:16:55 -08:00
Bjorn Andersson a4ff18e9ed remoteproc: Remove "experimental" warning
Warning users that remoteproc and it's binary format are under
development doesn't serve much of a purpose. Different drivers support
different image formats and the resource table has a version field that
would need to be bumped when incompatible changes are introduced.

So lets drop this warning to clean up the kernel log.

Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2016-12-09 16:13:19 -08:00
Bjorn Andersson cda8529346 remoteproc: Merge table_ptr and cached_table pointers
As all vdev resources are allocated before we boot the remote processor
we no longer need to support modifying the resource table while the
remote is running.

This saves us from the table_ptr dance, but more importantly allow the
remote processor to enable security lock down of the loaded table memory
region.

Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2016-11-14 21:52:18 -08:00
Bjorn Andersson 2ca7d866ca remoteproc: Remove custom vdev handler list
The vdev handler is now just another resource allocator, so handle all
resource types in a single pass.

Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2016-11-14 21:52:18 -08:00
Bjorn Andersson 48f18f8989 remoteproc: Update max_notifyid as we allocate vrings
Vrings are now allocated as we parse the resource table, before we
boot the rproc or register any virtio devices, so it's safe to bump
max_notifyid as part of this process.

Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2016-11-14 21:52:17 -08:00
Bjorn Andersson f5bcb35387 remoteproc: Decouple vdev resources and devices
Represent the virtio device part of the vdev resources as remoteproc
subdevices to finalize the decoupling of the virtio resource and device
handling.

Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2016-11-14 21:52:17 -08:00
Bjorn Andersson 2b45cef586 remoteproc: Further extend the vdev life cycle
Tie the vdev (and hence vring) life cycle to the resource parsing and
resource cleanup operations, allowing us to safely register and
unregister virtio devices on the go.

Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2016-11-14 21:52:16 -08:00
Bjorn Andersson a863af5d41 remoteproc: virtio: Anchor vring life cycle in vdev
Instead of having the vrings being allocated and freed as they are
requested by the virtio device tie their life cycle to the vdev
resource. This allows us to decouple the vdev resource management from
the virtio device management.

Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2016-11-14 21:52:16 -08:00
Bjorn Andersson aab8d80223 remoteproc: Assign kref to rproc_vdev
No functional change

Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2016-11-14 21:52:15 -08:00
Bjorn Andersson 7bdc9650f0 remoteproc: Introduce subdevices
A subdevice is an abstract entity that can be used to tie actions to the
booting and shutting down of a remote processor. The subdevice object is
expected to be embedded in concrete implementations, allowing for a
variety of use cases to be implemented.

Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2016-11-09 21:17:08 -08:00
Matt Redfearn 2aefbef041 remoteproc: Add a sysfs interface for firmware and state
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 <matt.redfearn@imgtec.com>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2016-10-31 17:24:46 -07:00
Matt Redfearn 0f57dc6ae1 remoteproc: Keep local copy of firmware name
Storage of the firmware name was inconsistent, either storing a pointer
to a name stored with unknown ownership, or a variable length tacked
onto the end of the struct proc allocated in rproc_alloc.

In preparation for allowing the firmware of an already allocated struct
rproc to be changed, instead always keep a locally maintained copy of
the firmware name.

Signed-off-by: Matt Redfearn <matt.redfearn@imgtec.com>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2016-10-18 15:03:35 -07:00
Bjorn Andersson fbb6aacb07 remoteproc: Refactor rproc module locking
Lock the implementation as we hand out references to client drivers
rather than when they try to boot the remote processor. This allows
auto-booting remote processors to be shut down by unloading their
module, in addition to first unbinding them.

Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2016-10-02 22:50:22 -07:00
Bjorn Andersson 433c0e04bc remoteproc: Split driver and consumer dereferencing
In order to be able to lock a rproc driver implementations only when
used by a client, we must differ between the dereference operation of a
client and the implementation itself.

This patch brings no functional change.

Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2016-10-02 22:50:21 -07:00
Bjorn Andersson 229b85a6a5 remoteproc: Correct resource handling upon boot failure
The freeing of resources will attempt to clear values previously set in
the cached resource table, so make sure to free the table after we have
cleaned up the resources.

Fixes: 988d204cda ("remoteproc: Move handling of cached table to boot/shutdown")
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2016-10-02 22:50:21 -07:00
Bjorn Andersson eeac0a8788 remoteproc: Drop unnecessary NULL check
rproc_alloc() will make sure that the "firmware" pointer is either a
driver supplied value or pointing to a generated firmware filename, it
can't be NULL. So drop the extra check in the rproc_boot() path.

Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2016-09-19 16:28:22 -07:00
Loic PALLARDY 21b6657ef4 remoteproc: core: transform struct fw_rsc_vdev_vring reserved field in pa
In current implementation, struct fw_rsc_vdev_vring which describes
vring resource in firmware resource table owns only device address,
because it assumes that host is responsible of vring allocation and
only device address is needed by coprocessor.
But if vrings need to be fixed in system memory map for any reasons
(security, SoC charactieristics...), physical address is needed exatly
identified the memory chunck by host.

For that let's transform reserved field of struct fw_rsc_vdev_vring
to pa (physical address).

Signed-off-by: Loic Pallardy <loic.pallardy@st.com>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2016-09-06 11:06:40 -07:00
Bjorn Andersson 13c4245b53 remoteproc: Only update table_ptr if we have a loaded table
In the case that we have a resource table, but not a loaded one we
should leave the table_ptr intact, as subsequent resource handling could
otherwise dereference the NULL pointer.

Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2016-08-18 12:33:20 -07:00
Bjorn Andersson 988d204cda remoteproc: Move handling of cached table to boot/shutdown
As we moved the vdev handling to the main boot/shutdown code path we can
further simplify the resource table handling by moving the parsing spet
to boot as well. The lifespan of the resource table is changed to live
from rproc_boot() to rproc_shutdown().

Cc: Lee Jones <lee.jones@linaro.org>
Cc: Loic Pallardy <loic.pallardy@st.com>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2016-08-17 23:20:51 -07:00
Bjorn Andersson d81fb32f3d remoteproc: Move vdev handling to boot/shutdown
The newly introduced "always-on" flag allows us to stop giving the vdevs
special treatment. The ordering of resource allocation and life cycle of
the remote processor is kept intact.

This allows us to mark a remote processor with vdevs to not boot unless
explicitly requested to do so by a client driver.

Cc: Lee Jones <lee.jones@linaro.org>
Cc: Loic Pallardy <loic.pallardy@st.com>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2016-08-17 23:18:51 -07:00
Bjorn Andersson b35d7afc3b remoteproc: Calculate max_notifyid during load
The calculation of max_notifyid must only be done before we call start()
on the remoteproc drivers, so move the calculation to be part of the
loading steps.

Cc: Lee Jones <lee.jones@linaro.org>
Cc: Loic Pallardy <loic.pallardy@st.com>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2016-08-17 23:18:51 -07:00
Bjorn Andersson ddf711872c remoteproc: Introduce auto-boot flag
Introduce an "auto-boot" flag on rprocs to make it possible to flag
remote processors without vdevs to automatically boot once the firmware
is found.

Preserve previous behavior of the wkup_m3 processor being explicitly
booted by a consumer.

Cc: Lee Jones <lee.jones@linaro.org>
Cc: Loic Pallardy <loic.pallardy@st.com>
Cc: Suman Anna <s-anna@ti.com>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2016-08-17 23:17:42 -07:00
Anna, Suman 9d7814a9a4 remoteproc: print hex numbers with a leading 0x format
There are couple of debug statements that are printing hexadecimal
numbers without the leading 0x. Fix these and use the standard 0x%x
format specifier so that there is no confusion when looking at the
traces.

Signed-off-by: Suman Anna <s-anna@ti.com>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2016-08-12 21:27:49 -07:00
Anna, Suman 730f84ce6d remoteproc: align code with open parenthesis
This patch fixes the existing alignment checkpatch check
warnings of the type "Alignment should match open parenthesis"
in the remoteproc core source files.

Signed-off-by: Suman Anna <s-anna@ti.com>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2016-08-12 21:27:49 -07:00
Anna, Suman 899585ad39 remoteproc: use variable names for sizeof() operator
Fix the code formatting to use the kernel preferred style
of using the actual variables to determize the size using
the sizeof() operator.

Signed-off-by: Suman Anna <s-anna@ti.com>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2016-08-12 21:27:47 -07:00
Anna, Suman 56324d7a22 remoteproc: fix couple of minor typos
Fix couple of minor mis-spelled words in all the remoteproc
source files.

Signed-off-by: Suman Anna <s-anna@ti.com>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2016-08-12 21:27:47 -07:00
Anna, Suman b605ed8b2d remoteproc: use proper format-specifier for printing dma_addr_t
The dma_addr_t types can be printed properly using the %pad
printk format-specifier, there is no need to resort to the
unsigned long long type-casting to deal with different possible
type sizes.

Signed-off-by: Suman Anna <s-anna@ti.com>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2016-08-12 21:27:46 -07:00
Lee Jones c14b9a940e remoteproc: core: Remove pointless OOM print
These types of error prints are superfluous.  The system will
pick up on OOM issues and let the user know.

Signed-off-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2016-08-10 10:46:14 -07:00
Lee Jones 353861660a remoteproc: core: Trivial: Improve error checking, spelling and debug prints
Trivial patch to clean up a couple of minor misgivings.

Signed-off-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2016-08-10 10:46:10 -07:00
Lee Jones 9c219b2337 remoteproc: core: Ensure error message is clear
Before this patch, the dma_alloc_coherent() failure path printed out:

  "dma_alloc_coherent err: 16760832"

... alluding to the Linux error code being 16760832, but seeing as
Linux error codes are all negative, this looks like a signed/unsigned
issue.  In fact, the message is trying to print the length of the
requested memory region.  Let's clear that up.

While we're at it, let's standardise the way 'len' is printed.  In
all other locations 'len' is in hex prefixed by a '0x' for clarity.

Signed-off-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2016-08-10 10:46:04 -07:00
Dave Gerlach d2e12e66a9 remoteproc: Fix potential race condition in rproc_add
rproc_add adds the newly created remoteproc to a list for use by
rproc_get_by_phandle and then does some additional processing to finish
adding the remoteproc. This leaves a small window of time in which the
rproc is available in the list but not yet fully initialized, so if
another driver comes along and gets a handle to the rproc, it will be
invalid. Rearrange the code in rproc_add to make sure the rproc is added
to the list only after it has been successfuly initialized.

Fixes: fec47d8635 ("remoteproc: introduce rproc_get_by_phandle API")
Cc: stable@vger.kernel.org
Signed-off-by: Dave Gerlach <d-gerlach@ti.com>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2016-06-14 11:08:16 -07:00
Bjorn Andersson b3d39032d7 remoteproc: Add additional crash reasons
The Qualcomm WCNSS can crash by watchdog or a fatal software error. Add
these types to the list of remoteproc crash reasons.

Signed-off-by: Bjorn Andersson <bjorn.andersson@sonymobile.com>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2016-05-12 15:50:19 -07:00
Bjorn Andersson e395f9ce49 remoteproc: core: Make the loaded resource table optional
Remote processors like the ones found in the Qualcomm SoCs does not have
a resource table passed to them, so make it optional by only populating
it if it does exist.

Signed-off-by: Bjorn Andersson <bjorn.andersson@sonymobile.com>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2016-05-12 15:50:04 -07:00
Lee Jones 3d87fa1d47 remoteproc: core: Task sync during rproc_fw_boot()
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 <fabrice.gasnier@st.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2016-05-06 11:46:36 -07:00
Stefan Agner a66a5114b3 remoteproc: report error if resource table doesn't exist
Currently, if the resource table is completely missing in the
firmware, powering up the remoteproc fails silently. Add a message
indicating that the resource table is missing in the firmware.

Signed-off-by: Stefan Agner <stefan@agner.ch>
Acked-by: Suman Anna <s-anna@ti.com>
Signed-off-by: Ohad Ben-Cohen <ohad@wizery.com>
2016-01-29 17:26:45 -08:00
Suman Anna f42f79af16 remoteproc: fix memory leak of remoteproc ida cache layers
The remoteproc core uses a static ida named rproc_dev_index for
assigning an automatic index number to a registered remoteproc.
The ida core may allocate some internal idr cache layers and ida
bitmap upon any ida allocation, and all these layers are truely
freed only upon the ida destruction. The rproc_dev_index ida is
not destroyed at present, leading to a memory leak when using the
remoteproc core as a module and atleast one rproc device is
registered and unregistered.

Fix this by invoking ida_destroy() in the remoteproc core module
exit.

Signed-off-by: Suman Anna <s-anna@ti.com>
Signed-off-by: Ohad Ben-Cohen <ohad@wizery.com>
2015-11-26 17:44:28 +02:00
Ohad Ben-Cohen 8de3dbd089 remoteproc: fix !CONFIG_OF build breakage
Fix this:

drivers/remoteproc/remoteproc_core.c: In function 'rproc_get_by_phandle':
>> drivers/remoteproc/remoteproc_core.c:1167:2: error: implicit declaration of function 'of_find_node_by_phandle' [-Werror=implicit-function-declaration]
     np = of_find_node_by_phandle(phandle);

Reported-by: kbuild test robot <fengguang.wu@intel.com>
Cc: Dave Gerlach <d-gerlach@ti.com>
Cc: Suman Anna <s-anna@ti.com>
Signed-off-by: Ohad Ben-Cohen <ohad@wizery.com>
2015-06-18 11:44:41 +03:00
Suman Anna a01f7cd657 remoteproc: add a rproc ops for performing address translation
The rproc_da_to_va API is currently used to perform any device to
kernel address translations to meet the different needs of the remoteproc
core/drivers (eg: loading). The functionality is achieved within the
remoteproc core, and is limited only for carveouts allocated within the
core.

A new rproc ops, da_to_va, is added to provide flexibility to platform
implementations to perform the address translation themselves when the
above conditions cannot be met by the implementations. The rproc_da_to_va()
API is extended to invoke this ops if present, and fallback to regular
processing if the platform implementation cannot provide the translation.
This will allow any remoteproc implementations to translate addresses for
dedicated memories like internal memories.

While at this, also update the rproc_da_to_va() documentation since it
is an exported function.

Signed-off-by: Suman Anna <s-anna@ti.com>
Signed-off-by: Dave Gerlach <d-gerlach@ti.com>
Signed-off-by: Ohad Ben-Cohen <ohad@wizery.com>
2015-06-17 09:57:12 +03:00
Dave Gerlach fec47d8635 remoteproc: introduce rproc_get_by_phandle API
Allow users of remoteproc the ability to get a handle to an rproc by
passing a phandle supplied in the user's device tree node. This is
useful in situations that require manual booting of the rproc.

This patch uses the code removed by commit 40e575b1d0 ("remoteproc:
remove the get_by_name/put API") for the ref counting but is modified
to use a simple list and locking mechanism and has rproc_get_by_name
replaced with an rproc_get_by_phandle API.

Signed-off-by: Dave Gerlach <d-gerlach@ti.com>
Signed-off-by: Suman Anna <s-anna@ti.com>
[fix order of Signed-off-by tags]
Signed-off-by: Ohad Ben-Cohen <ohad@wizery.com>
2015-06-16 21:12:52 +03:00
Suman Anna 172e6ab1ca remoteproc: fix various checkpatch warnings
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 <s-anna@ti.com>
Signed-off-by: Ohad Ben-Cohen <ohad@wizery.com>
2015-05-02 11:07:34 +03:00
Suman Anna 315491e5d6 remoteproc: add IOMMU hardware capability flag
The remoteproc framework currently relies on iommu_present() on
the bus the device is on, to perform MMU management. However, this
logic doesn't scale for multi-arch, especially for processors that
do not have an IOMMU. Replace this logic instead by using a h/w
capability flag for the presence of IOMMU in the rproc structure.

This issue is seen on OMAP platforms when trying to add a remoteproc
driver for a small Cortex M3 called the WkupM3 used for suspend /
resume management on TI AM335/AM437x SoCs. This processor does not
have an MMU. Same is the case with another processor subsystem
PRU-ICSS on AM335/AM437x. All these are platform devices, and the
current iommu_present check will not scale for the same kernel image
to support OMAP4/OMAP5 and AM335/AM437x.

The existing platform implementation drivers - OMAP remoteproc, STE
Modem remoteproc and DA8xx remoteproc, are updated as well to properly
configure the newly added rproc field.

Cc: Robert Tivy <rtivy@ti.com>
Cc: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Suman Anna <s-anna@ti.com>
[small change in the commit title and in a single comment]
Signed-off-by: Ohad Ben-Cohen <ohad@wizery.com>
2015-03-12 10:43:26 +02:00
Thomas Meyer 95cee62cb4 remoteproc: Cocci spatch "memdup.spatch"
Use kmemdup instead of kmalloc + memcpy.

Signed-off-by: Thomas Meyer <thomas@m3y3r.de>
Signed-off-by: Ohad Ben-Cohen <ohad@wizery.com>
2013-07-01 17:23:58 +03:00
Suman Anna b6356a013a remoteproc: free carveout memories only after unmapping them
It is not preferable to have the allocated pages for carveout
memories freed before they are unmapped. The code that deals
with the cleanup of carveout memories is therefore moved after
the corresponding mapping entries were cleaned up.

This is mostly a no-op since the remote processors are already
stopped when the cleanup function is called, but this will make
the cleanup code follow the exact reverse path of allocation.

Signed-off-by: Suman Anna <s-anna@ti.com>
Signed-off-by: Ohad Ben-Cohen <ohad@wizery.com>
2013-07-01 17:01:56 +03:00
Wei Yongjun 89970d28cb remoteproc: fix error return code in rproc_fw_boot()
Set 'ret' to -EINVAL when needed, so a sensible return value
is returned on errors.

Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
[fix additional instances of this bug as well, update commit log]
Signed-off-by: Ohad Ben-Cohen <ohad@wizery.com>
2013-06-30 11:07:13 +03:00
Linus Torvalds de9c9f86be This pull request contains:
- Some refactoring, cleanups and small improvements
   from Sjur Brændeland. The improvements are mainly
   about better supporting varios virtio properties
   (such as virtio's config space, status and features).
   I now see that I messed up while commiting one of Sjur's
   patches and erroneously put myself as the author, as well
   as letting a nasty typo sneak in. I will not fix this in
   order to avoid rebasing the patches. Sjur - sorry!
 - A new remoteproc driver for OMAP-L13x (technically a
   DaVinci platform) from Robert Tivy.
 - Extend OMAP support to OMAP5 as well, from Vincent Stehlé.
 - Fix Kconfig VIRTUALIZATION dependency, from Suman Anna
   (a non-critical fix which arrived late during the rc cycle).
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.4.11 (GNU/Linux)
 
 iQIcBAABAgAGBQJRiPCwAAoJELLolMlTRIoMRoQP/ivAF3r9jPaMizky82T0mDs0
 kUPz6sz0zwb412h/IVtCo0ChJ1Jv4rVgo5u4klzDS5wfOutRiwDFIa8ZQF484nRb
 gTIFHtqy+xk82aHAR9PWi2G3QWJ9hplZ7m52aaOIG7E6BaY3EfWL7fnt5QGBAb/O
 vcR3rrj7QNQcB963PQl7cYWSX966ipzfX1g7VxFk/Ah8m9rjQp0xZgg3a5svGmq7
 5iQcdxiXm63RAfgN9kbZrxWjX5/7m1N1WOfK5CE1H2jnGObttNdhN5xr7Ky5TXyN
 sVJvoVhIbylSzDVl/LH6v/V9T/is+VCZOPs+erXVGv2vGctNY5Cs+RAVPF4bz4UC
 R9/LDRbdZtbvcKo0TiPAjsIN3t+Rg1EDBnjOImi5kN5bYASpfcoRE0hpicL51S01
 HzdT5+k3Xo5RS0EWakITc1ecc+7kfMVjLjn59/Im+bWVGhv2Lzq1pCFQ+XAcfvL9
 FrQCGYCn8QZFWBHgeDRzg1ysK4hDNPo1UkEbLTTXjFcaMLeMczSSRagCi4Fk2RjL
 QYmtDzKbm7Tc03Yi6ac7A8I2lgeQRsXNENLxtTtONu9rNKf4O0Of86KCLhtUtDqb
 6SUxn2ZvG+maXwyrqbIjak+CKphimOnOEEIxur3viuKLs4sM8yuZCzU+v56bPbdb
 Pqcdo7VOhqAwTBoW3NUp
 =IUfO
 -----END PGP SIGNATURE-----

Merge tag 'remoteproc-3.10' of git://git.kernel.org/pub/scm/linux/kernel/git/ohad/remoteproc

Pull remoteproc update from Ohad Ben-Cohen:

 - Some refactoring, cleanups and small improvements from Sjur
   Brændeland.  The improvements are mainly about better supporting
   varios virtio properties (such as virtio's config space, status and
   features).  I now see that I messed up while commiting one of Sjur's
   patches and erroneously put myself as the author, as well as letting
   a nasty typo sneak in.  I will not fix this in order to avoid
   rebasing the patches.  Sjur - sorry!

 - A new remoteproc driver for OMAP-L13x (technically a DaVinci
   platform) from Robert Tivy.

 - Extend OMAP support to OMAP5 as well, from Vincent Stehlé.

 - Fix Kconfig VIRTUALIZATION dependency, from Suman Anna (a
   non-critical fix which arrived late during the rc cycle).

* tag 'remoteproc-3.10' of git://git.kernel.org/pub/scm/linux/kernel/git/ohad/remoteproc:
  remoteproc: fix kconfig dependencies for VIRTIO
  remoteproc/davinci: add a remoteproc driver for OMAP-L13x DSP
  remoteproc: support default firmware name in rproc_alloc()
  remoteproc/omap: support OMAP5 too
  remoteproc: set vring addresses in resource table
  remoteproc: support virtio config space.
  remoteproc: perserve resource table data
  remoteproc: calculate max_notifyid by counting vrings
  remoteproc: code cleanup of resource parsing
  remoteproc: parse STE-firmware and find resource table address
  remoteproc: add find_loaded_rsc_table firmware ops
  remoteproc: refactor rproc_elf_find_rsc_table()
2013-05-07 14:04:56 -07:00
Linus Torvalds 5d434fcb25 Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial
Pull trivial tree updates from Jiri Kosina:
 "Usual stuff, mostly comment fixes, typo fixes, printk fixes and small
  code cleanups"

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial: (45 commits)
  mm: Convert print_symbol to %pSR
  gfs2: Convert print_symbol to %pSR
  m32r: Convert print_symbol to %pSR
  iostats.txt: add easy-to-find description for field 6
  x86 cmpxchg.h: fix wrong comment
  treewide: Fix typo in printk and comments
  doc: devicetree: Fix various typos
  docbook: fix 8250 naming in device-drivers
  pata_pdc2027x: Fix compiler warning
  treewide: Fix typo in printks
  mei: Fix comments in drivers/misc/mei
  treewide: Fix typos in kernel messages
  pm44xx: Fix comment for "CONFIG_CPU_IDLE"
  doc: Fix typo "CONFIG_CGROUP_CGROUP_MEMCG_SWAP"
  mmzone: correct "pags" to "pages" in comment.
  kernel-parameters: remove outdated 'noresidual' parameter
  Remove spurious _H suffixes from ifdef comments
  sound: Remove stray pluses from Kconfig file
  radio-shark: Fix printk "CONFIG_LED_CLASS"
  doc: put proper reference to CONFIG_MODULE_SIG_ENFORCE
  ...
2013-04-30 09:36:50 -07:00
Masanari Iida b23f7a09f9 treewide: Fix typo in printk and comments
Fix typo in printk and comments within various drivers.

Signed-off-by: Masanari Iida <standby24x7@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2013-04-24 16:43:00 +02:00
Robert Tivy 8b4aec9ac7 remoteproc: support default firmware name in rproc_alloc()
If rproc_alloc isn't given a firmware name, look for a default
one using the "rproc-%s-fw" template.

Signed-off-by: Robert Tivy <rtivy@ti.com>
[add commit log, document change, use snprintf, minor style change]
Signed-off-by: Ohad Ben-Cohen <ohad@wizery.com>
2013-04-07 15:40:04 +03:00
Sjur Brændeland c0d631570a remoteproc: set vring addresses in resource table
Set the vring addresses in the resource table so that
the remote device can read the actual addresses used.

Signed-off-by: Sjur Brændeland <sjur.brandeland@stericsson.com>
Acked-by: Ido Yariv <ido@wizery.com>
[rebase]
Signed-off-by: Ohad Ben-Cohen <ohad@wizery.com>
2013-04-07 14:06:17 +03:00
Sjur Brændeland 92b38f8514 remoteproc: support virtio config space.
Support virtio configuration space and device status. The virtio
device can now access the resource table in shared memory.

Signed-off-by: Sjur Brændeland <sjur.brandeland@stericsson.com>
Acked-by: Ido Yariv <ido@wizery.com>
[rebase and style changes]
Signed-off-by: Ohad Ben-Cohen <ohad@wizery.com>
2013-04-07 14:06:17 +03:00
Ohad Ben-Cohen a2b950ac7b remoteproc: perserve resource table data
Copy resource table from first to second firmware loading.
After firmware is loaded to memory, update the vdevs resource
pointer to the resource table kept in device memory.

Signed-off-by: Sjur Brændeland <sjur.brandeland@stericsson.com>
Acked-by: Ido Yariv <ido@wizery.com>
[rebase, terminology and style changes]
Signed-off-by: Ohad Ben-Cohen <ohad@wizery.com>
2013-04-07 14:06:07 +03:00
Sjur Brændeland ba7290e016 remoteproc: calculate max_notifyid by counting vrings
Simplify handling of max_notifyid by simply counting the
number of vrings.

Signed-off-by: Sjur Brændeland <sjur.brandeland@stericsson.com>
Acked-by: Ido Yariv <ido@wizery.com>
[small terminology changes]
Signed-off-by: Ohad Ben-Cohen <ohad@wizery.com>
2013-04-07 14:04:25 +03:00
Sjur Brændeland 232fcdbb45 remoteproc: code cleanup of resource parsing
Combine the almost identical functions rproc_handle_virtio_rsc
and rproc_handle_boot_rsc.

Signed-off-by: Sjur Brændeland <sjur.brandeland@stericsson.com>
Acked-by: Ido Yariv <ido@wizery.com>
[small terminology and style changes]
Signed-off-by: Ohad Ben-Cohen <ohad@wizery.com>
2013-04-05 08:50:07 +03:00
Sjur Brændeland cde42e076c remoteproc: fix error path of handle_vdev
Remove the vdev entry from the list before freeing it,
otherwise rproc->vdevs will explode.

Cc: stable@vger.kernel.org
Signed-off-by: Sjur Brændeland <sjur.brandeland@stericsson.com>
Acked-by: Ido Yariv <ido@wizery.com>
[edit subject, minor commit log edit, cc stable]
Signed-off-by: Ohad Ben-Cohen <ohad@wizery.com>
2013-04-05 08:47:57 +03:00
Suman Anna b39599b7cb remoteproc: fix the error check for idr_alloc
The new idr_alloc interface returns the allocated id back
on success, so fix the error path to check for negative
values. This was missed out in the newer idr interface
adoption patch, 15fc611 "remoteproc: convert to idr_alloc()".

Signed-off-by: Suman Anna <s-anna@ti.com>
Acked-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Ohad Ben-Cohen <ohad@wizery.com>
2013-04-05 08:47:38 +03:00
Tejun Heo 15fc61106a remoteproc: convert to idr_alloc()
Convert to the much saner new idr interface.

Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: Ohad Ben-Cohen <ohad@wizery.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2013-02-27 19:10:18 -08:00
Tejun Heo 045dc40d9e remoteproc: don't use idr_remove_all()
idr_destroy() can destroy idr by itself and idr_remove_all() is being
deprecated.  Drop its usage.

Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: Ohad Ben-Cohen <ohad@wizery.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2013-02-27 19:10:13 -08:00
Emil Goode d09f53a735 remoteproc: Fix use of format specifyer
The dma_addr_t type can be either u32 or u64 depending on
the configuration. We should use a format specifyer for the
larger type and explicitly cast to it.

Sparse warnings:
drivers/remoteproc/remoteproc_core.c:234:2: warning:
	format ‘%x’ expects argument of type ‘unsigned int’,
	but argument 6 has type ‘dma_addr_t’ [-Wformat]

drivers/remoteproc/remoteproc_core.c:596:2: warning:
	format ‘%x’ expects argument of type ‘unsigned int’,
	but argument 5 has type ‘dma_addr_t’ [-Wformat]

drivers/remoteproc/remoteproc_core.c:634:3:
	warning: format ‘%x’ expects argument of type ‘unsigned int’,
	but argument 5 has type ‘dma_addr_t’ [-Wformat]

Signed-off-by: Emil Goode <emilgoode@gmail.com>
[fix commit log typos]
Signed-off-by: Ohad Ben-Cohen <ohad@wizery.com>
2012-10-02 10:14:43 +02:00
Dan Carpenter 7168d914a7 remoteproc: fix a potential NULL-dereference on cleanup
We only need to allocate mapping if there is an IOMMU domain.

Otherwise, when the mappings are released, the assumption that
an IOMMU domain is there will crash and burn.

CC: stable@vger.kernel.org
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
[ohad: revise commit log]
Signed-off-by: Ohad Ben-Cohen <ohad@wizery.com>
2012-10-02 09:57:28 +02:00
Sjur Brændeland 099a3f33c8 remtoteproc: maintain max notifyid
Some of the rproc drivers (STE modem specifically) needs to know
the range of the notification IDs used for notifying the device.

Maintain a variable in struct rproc holding the largest allocated
notification id, so low-level rproc drivers could access it.

Signed-off-by: Sjur Brændeland <sjur.brandeland@stericsson.com>
[ohad: rebase, slightly edit commit log]
Signed-off-by: Ohad Ben-Cohen <ohad@wizery.com>
2012-09-18 21:55:52 +03:00
Fernando Guzman Lugo 2e37abb89a remoteproc: create a 'recovery' debugfs entry
Add a 'recovery' debugfs entry to dynamically disable/enable recovery
at runtime. This is useful when one is trying to debug an rproc crash;
without it, a recovery will immediately take place, making it harder
to debug the crash.

Contributions from Subramaniam Chanderashekarapuram.

Examples:

- disabling recovery:
$ echo disabled > <debugfs>/remoteproc/remoteproc0/recovery

- in case you want to recover a crash, but keep recovery disabled
  (useful in debugging sessions when you expect additional crashes
   you want to debug):
$ echo recover > <debugfs>/remoteproc/remoteproc0/recovery

- enabling recovery:
$ echo enabled > <debugfs>/remoteproc/remoteproc0/recovery

Signed-off-by: Fernando Guzman Lugo <fernando.lugo@ti.com>
[ohad: some white space, commentary and commit log changes]
Signed-off-by: Ohad Ben-Cohen <ohad@wizery.com>
2012-09-18 12:53:41 +03:00
Fernando Guzman Lugo 70b85ef83c remoteproc: add actual recovery implementation
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 <fernando.lugo@ti.com>
[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 <ohad@wizery.com>
2012-09-18 12:53:33 +03:00
Fernando Guzman Lugo 8afd519c34 remoteproc: add rproc_report_crash function to notify rproc crashes
Allow low-level remoteproc drivers to report rproc crashes by exporting
a new rproc_report_crash() function (invoking this from non-rproc drivers
is probably wrong, and should be carefully scrutinized if ever needed).

rproc_report_crash() can be called from any context; it offloads the
tasks of handling the crash to a separate thread.

Handling the crash from a separate thread is helpful because:
- Ability to call invoke rproc_report_crash() from atomic context, due to
  the fact that many crashes trigger an interrupt, so this function can be
  called directly from ISR context.
- Avoiding deadlocks which could happen if rproc_report_crash() is called
  from a function which indirectly holds the rproc lock.

Handling the crash might involve:
- Remoteproc register dump
- Remoteproc stack dump
- Remoteproc core dump
- Saving Remoteproc traces so they can be read after the crash
- Reseting the remoteproc in order to make it functional again (hard recovery)

Right now, we only print the crash type which was detected, and only the
mmufault type is supported. Remoteproc low-level drivers can add more types
when needed.

Signed-off-by: Fernando Guzman Lugo <fernando.lugo@ti.com>
[ohad: some commentary, white space and commit log changes]
Signed-off-by: Ohad Ben-Cohen <ohad@wizery.com>
2012-09-18 12:53:22 +03:00
Linus Torvalds a9197f903f A batch of remoteproc patches for 3.6:
- custom binary format support from Sjur Brændeland
 - groundwork for recovery and runtime pm support
 - some cleanups and API simplifications
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.4.11 (GNU/Linux)
 
 iQIcBAABAgAGBQJQD75aAAoJELLolMlTRIoMM84P/RfnGhFl/mzKmDssFtwkajIb
 HRrZ1/YWjAjnSOvD5FF+LrS4TtxPgx9747I1Xh49Uk7DHb6siNTDUNbFJNifWo7g
 TbKo3LgLllfNXnwbunIfiGqOW2HzaCVo6vhk59fL3QAsdtCDlROegt1NbOrV8T2S
 +XZlgYhhUSlIQQCgsRBVJWbwP4k5PtAYmwL1VN7ONgj2ILJDP7MhAasDMl+KeGSG
 128g+aCoIkfc9vC+ghDNAfE6DsHHeVyXAWPoWHoyjiteZ1NDkGxUBdTbsrtMYM2K
 ZguEISfVNcMSk10HhoYWtqYZfZUTEM18kOt/182CEwpRVRE34Z7fhcQCiCGX6u6v
 E+7tNj/0qow+dcj2OtS3NEePIHKcuvjBQ09b6GED+qsmC8lENo2Ly364T6JfriNl
 tv1PShvmodrBlLFusAikJKuzYFI9xgQawpL3oV0pMrEiujHqgNhuqrCQJkIWnA8d
 9At2RZAMdFBFa7gd90lPicVqPR9HcGipVk7bKRyFAoqmpPLI85Nm1r9l4TPqEXpC
 Otb373gX30yqWNRD9Hmmxx/+40S2odELEDN4wrPRF+cCAbmWtFey415gdoaqBESn
 BiTRrHxNy2+dKsCgSUQMyn59rF552qrCb31REYAyMMImpftAaWP35OREFNn6oqj2
 vzxsc4wcWZaLflrqQGj6
 =vBgg
 -----END PGP SIGNATURE-----

Merge tag 'remoteproc-for-3.6' of git://git.kernel.org/pub/scm/linux/kernel/git/ohad/remoteproc

Pull remoteproc update from Ohad Ben-Cohen:
 - custom binary format support from Sjur Brændeland
 - groundwork for recovery and runtime pm support
 - some cleanups and API simplifications

Fix up conflicts in drivers/remoteproc/remoteproc_core.c due to clashes
with earlier cleanups by Sjur Brændeland (with part of the cleanups
moved into the new remoteproc_elf_loader.c file).

* tag 'remoteproc-for-3.6' of git://git.kernel.org/pub/scm/linux/kernel/git/ohad/remoteproc:
  MAINTAINERS: add remoteproc's git
  remoteproc: Support custom firmware handlers
  remoteproc: Move Elf related functions to separate file
  remoteproc: Add function rproc_get_boot_addr
  remoteproc: Pass struct fw to load_segments and find_rsc_table.
  remoteproc: adopt the driver core's alloc/add/del/put naming
  remoteproc: remove the get_by_name/put API
  remoteproc: support non-iommu carveout assignment
  remoteproc: simplify unregister/free interfaces
  remoteproc: remove the now-redundant kref
  remoteproc: maintain a generic child device for each rproc
  remoteproc: allocate vrings on demand, free when not needed
2012-07-26 16:19:08 -07:00
Sjur Brændeland 4afc89d66c remoteproc: Support custom firmware handlers
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 <sjur.brandeland@stericsson.com>
[ohad: namespace fixes, whitespace fixes, style fixes]
Signed-off-by: Ohad Ben-Cohen <ohad@wizery.com>
2012-07-15 11:39:01 +03:00
Sjur Brændeland 72854fb042 remoteproc: Move Elf related functions to separate file
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 <sjur.brandeland@stericsson.com>
[ohad: rebase, fix kerneldoc, put prototypes in remoteproc_internal.h]
Signed-off-by: Ohad Ben-Cohen <ohad@wizery.com>
2012-07-15 11:25:27 +03:00
Sjur Brændeland 3e5f9eb5d9 remoteproc: Add function rproc_get_boot_addr
Prepare for introduction of custom firmware loaders by
moving the function operating on ELF data-structures into
separate functions. Move lookup of the boot_addr in the
ELF binary to the function rproc_get_boot_addr().

Signed-off-by: Sjur Brændeland <sjur.brandeland@stericsson.com>
[rproc_get_boot_addr's kerneldoc: add missing @rproc line]
[rproc_get_boot_addr's kerneldoc: minor style changes]
Signed-off-by: Ohad Ben-Cohen <ohad@wizery.com>
2012-07-15 11:14:45 +03:00
Sjur Brændeland bd48498487 remoteproc: Pass struct fw to load_segments and find_rsc_table.
Prepare for introduction of custom firmware loaders by changing
the functions rproc_find_rcs_table() and rproc_load_segments()
to use struct firmware as parameter.

When the custom loader framework is introduced all calls into
the firmware specific function must use struct firmware as
parameter.

Signed-off-by: Sjur Brændeland <sjur.brandeland@stericsson.com>
Signed-off-by: Ohad Ben-Cohen <ohad@wizery.com>
2012-07-15 11:14:26 +03:00
Ohad Ben-Cohen 160e7c840f remoteproc: adopt the driver core's alloc/add/del/put naming
To make remoteproc's API more intuitive for developers, we adopt
the driver core's naming, i.e. alloc -> add -> del -> put. We'll also
add register/unregister when their first user shows up.

Otherwise - there's no functional change here.

Suggested by Russell King <linux@arm.linux.org.uk>.

Cc: Russell King <linux@arm.linux.org.uk>
Cc: Fernando Guzman Lugo <fernando.lugo@ti.com>
Cc: Sjur Brændeland <sjur.brandeland@stericsson.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Acked-by: Stephen Boyd <sboyd@codeaurora.org>
Signed-off-by: Ohad Ben-Cohen <ohad@wizery.com>
2012-07-06 00:53:27 +03:00
Ohad Ben-Cohen 40e575b1d0 remoteproc: remove the get_by_name/put API
Remove rproc_get_by_name() and rproc_put(), and the associated
remoteproc infrastructure that supports it (i.e. klist and friends),
because:

1. No one uses them
2. Using them is highly discouraged, and any potential user
   will be deeply scrutinized and encouraged to move.

If a user, that absolutely can't live with the direct boot/shutdown
model, does show up one day, then bringing this functionality back
is going to be trivial.

At this point though, keeping this functionality around is way too
much of a maintenance burden.

Cc: Sjur Brændeland <sjur.brandeland@stericsson.com>
Cc: Loic Pallardy <loic.pallardy@stericsson.com>
Cc: Ludovic BARRE <ludovic.barre@stericsson.com>
Cc: Michal Simek <monstr@monstr.eu>
Cc: Fernando Guzman Lugo <fernando.lugo@ti.com>
Cc: Suman Anna <s-anna@ti.com>
Cc: Mark Grosen <mgrosen@ti.com>
Acked-by: Stephen Boyd <sboyd@codeaurora.org>
Signed-off-by: Ohad Ben-Cohen <ohad@wizery.com>
2012-07-06 00:53:27 +03:00
Ohad Ben-Cohen 0e49b72c8c remoteproc: support non-iommu carveout assignment
Publish carveout addresses on non-iommu setups too.

Reported-and-acked-by: Sjur Brændeland <sjur.brandeland@stericsson.com>
Signed-off-by: Ohad Ben-Cohen <ohad@wizery.com>
2012-07-06 00:53:26 +03:00
Ohad Ben-Cohen c6b5a27628 remoteproc: simplify unregister/free interfaces
Simplify the unregister/free interfaces, and make them easier
to understand and use, by moving to a symmetric and consistent
alloc() -> register() -> unregister() -> free() flow.

To create and register an rproc instance, one needed to invoke
rproc_alloc() followed by rproc_register().

To unregister and free an rproc instance, one now needs to invoke
rproc_unregister() followed by rproc_free().

Cc: Stephen Boyd <sboyd@codeaurora.org>
Signed-off-by: Ohad Ben-Cohen <ohad@wizery.com>
2012-07-06 00:53:25 +03:00
Ohad Ben-Cohen 7183a2a799 remoteproc: remove the now-redundant kref
Now that every rproc instance contains a device, we don't need a
kref anymore to maintain the refcount of the rproc instances:
that's what device are good with!

This patch removes the now-redundant kref, and switches to
{get, put}_device instead of kref_{get, put}.

We also don't need the kref's release function anymore, and instead,
we just utilize the class's release handler (which is now responsible
for all memory de-allocations).

Cc: Stephen Boyd <sboyd@codeaurora.org>
Cc: Fernando Guzman Lugo <fernando.lugo@ti.com>
Signed-off-by: Ohad Ben-Cohen <ohad@wizery.com>
2012-07-06 00:53:25 +03:00
Ohad Ben-Cohen b5ab5e24e9 remoteproc: maintain a generic child device for each rproc
For each registered rproc, maintain a generic remoteproc device whose
parent is the low level platform-specific device (commonly a pdev, but
it may certainly be any other type of device too).

With this in hand, the resulting device hierarchy might then look like:

omap-rproc.0
 |
 - remoteproc0  <---- new !
    |
    - virtio0
    |
    - virtio1
       |
       - rpmsg0
       |
       - rpmsg1
       |
       - rpmsg2

Where:
- omap-rproc.0 is the low level device that's bound to the
  driver which invokes rproc_register()
- remoteproc0 is the result of this patch, and will be added by the
  remoteproc framework when rproc_register() is invoked
- virtio0 and virtio1 are vdevs that are registered by remoteproc
  when it realizes that they are supported by the firmware
  of the physical remote processor represented by omap-rproc.0
- rpmsg0, rpmsg1 and rpmsg2 are rpmsg devices that represent rpmsg
  channels, and are registerd by the rpmsg bus when it gets notified
  about their existence

Technically, this patch:
- changes 'struct rproc' to contain this generic remoteproc.x device
- creates a new "remoteproc" type, to which this new generic remoteproc.x
  device belong to.
- adds a super simple enumeration method for the indices of the
  remoteproc.x devices
- updates all dev_* messaging to use the generic remoteproc.x device
  instead of the low level platform-specific device
- updates all dma_* allocations to use the parent of remoteproc.x (where
  the platform-specific memory pools, most commonly CMA, are to be found)

Adding this generic device has several merits:
- we can now add remoteproc runtime PM support simply by hooking onto the
  new "remoteproc" type
- all remoteproc log messages will now carry a common name prefix
  instead of having a platform-specific one
- having a device as part of the rproc struct makes it possible to simplify
  refcounting (see subsequent patch)

Thanks to Stephen Boyd <sboyd@codeaurora.org> for suggesting and
discussing these ideas in one of the remoteproc review threads and
to Fernando Guzman Lugo <fernando.lugo@ti.com> for trying them out
with the (upcoming) runtime PM support for remoteproc.

Cc: Fernando Guzman Lugo <fernando.lugo@ti.com>
Reviewed-by: Stephen Boyd <sboyd@codeaurora.org>
Signed-off-by: Ohad Ben-Cohen <ohad@wizery.com>
2012-07-06 00:53:03 +03:00
Ohad Ben-Cohen 6db20ea8d8 remoteproc: allocate vrings on demand, free when not needed
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 <fernando.lugo@ti.com>
Signed-off-by: Ohad Ben-Cohen <ohad@wizery.com>
2012-07-04 13:27:04 +03:00
Sjur Brændeland 30338cf09f remoteproc: fix missing fault indication in error-path
If rproc_find_rsc_table() fails, rproc_fw_boot() must set
return-value before jumping to clean_up label. Otherwise no
error value is returned.

Signed-off-by: Sjur Brændeland <sjur.brandeland@stericsson.com>
Signed-off-by: Ohad Ben-Cohen <ohad@wizery.com>
Cc: stable@vger.kernel.org
2012-06-10 14:49:46 +03:00
Sjur Brændeland e981f6d41a remoteproc: fix print format warnings
Fix compile warnings from GCC 4.6.1 when printing values of type size_t.

drivers/remoteproc/remoteproc_core.c:251:6:
warning: format ‘%x’ expects argument of type ‘unsigned int’,
but argument 4 has type ‘size_t’ [-Wformat]
drivers/remoteproc/remoteproc_core.c:938:9:
warning: format ‘%u’ expects argument of type ‘unsigned int’,
but argument 4 has type ‘size_t’ [-Wformat]
drivers/remoteproc/remoteproc_core.c:1023:2:
warning: format ‘%d’ expects argument of type ‘int’,
but argument 4 has type ‘size_t’ [-Wformat]

Signed-off-by: Sjur Brændeland <sjur.brandeland@stericsson.com>
Signed-off-by: Ohad Ben-Cohen <ohad@wizery.com>
Cc: stable@vger.kernel.org
2012-06-10 14:49:39 +03:00
Linus Torvalds 2f83766d4b IOMMU Updates for Linux 3.5
Not much stuff this time. The only change to the IOMMU core code is the
 addition of a handle to the fault handling code. A few updates to the
 AMD IOMMU driver to work around new errata. The other patches are mostly
 fixes and enhancements to the existing ARM IOMMU drivers and
 documentation updates.
 
 A new IOMMU driver for the Exynos platform was also underway but got
 merged via the Samsung tree and is not part of this tree.
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.4.11 (GNU/Linux)
 
 iQIcBAABAgAGBQJPxfseAAoJECvwRC2XARrjvL4QAL39988y7ajHSI3ym3Dxovn9
 w8md63xKNlTpCB8NJPRIJpcGrE7QFtNXPFCagTqO713ulwCoKayEwKGOU7VQagFc
 0/JoHxE5usE5OuA6tyAJbpWK10kWKDzu6HjZfqF2yoa0q/REbsu65KsY7zc7HbpF
 qEAXX1xr9IC7GUM7gv75OR8CP2VJCW3+6VyhiD/37t3KpNwINMpRDO/eN/KiwoUI
 1t+/DVwO6pH5UrGReWrmjs/gcxFMzkeelt+iCA32kzkWLtyWjeWBujVWnFvVtpkz
 R4pV2T2jvs6fWPU5MMBXZRd5AvLLqcu/g/Yr21WYHz07jCcGxlCUp9qpnGLt2el0
 /YTY3LBZUQJ5sx3OSJV+oQVTtI5x0EkAiOrJ8Dx20wNAFqun9bhJb1WX0IXflmZc
 oC7SF5wjXq8pUQmX/wpGMbW7XYompypJGqlEsftJEytf4dfR6KJ2Vo1h3pHtpaex
 IaY6TqmdW44e0EgbFTM7RMNFtC7GrIY9NE+WKlrFtsHhUFrqt1NVBEcO3faU0ES6
 UAguFRPM/HAdkVmY620+DUT/JkEMemWq2jgWExLGLC9gI8L1Xj2cdU8esstuMUoV
 GGG4u9a5W1rALwg+zPCQGoVxPKmd6fpeC3U+Rmg2639chy+h4c/cBXkzfUsxe2lg
 wvMDVbjDN1Fz0c29YJit
 =K23I
 -----END PGP SIGNATURE-----

Merge tag 'iommu-updates-v3.5' of git://git.kernel.org/pub/scm/linux/kernel/git/joro/iommu

Pull IOMMU updates from Joerg Roedel:
 "Not much stuff this time.  The only change to the IOMMU core code is
  the addition of a handle to the fault handling code.  A few updates to
  the AMD IOMMU driver to work around new errata.  The other patches are
  mostly fixes and enhancements to the existing ARM IOMMU drivers and
  documentation updates.

  A new IOMMU driver for the Exynos platform was also underway but got
  merged via the Samsung tree and is not part of this tree."

* tag 'iommu-updates-v3.5' of git://git.kernel.org/pub/scm/linux/kernel/git/joro/iommu:
  Documentation: kernel-parameters.txt Add amd_iommu_dump
  iommu/core: pass a user-provided token to fault handlers
  iommu/tegra: gart: Fix register offset correctly
  iommu: OMAP: device detach on domain destroy
  iommu: tegra/gart: Add device tree support
  iommu: tegra/gart: use correct gart_device
  iommu/tegra: smmu: Print device name correctly
  iommu/amd: Add workaround for event log erratum
  iommu/amd: Check for the right TLP prefix bit
  dma-debug: release free_entries_lock before saving stack trace
2012-05-30 08:49:28 -07:00
Linus Torvalds e8650a0823 Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial
Pull trivial updates from Jiri Kosina:
 "As usual, it's mostly typo fixes, redundant code elimination and some
  documentation updates."

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial: (57 commits)
  edac, mips: don't change code that has been removed in edac/mips tree
  xtensa: Change mail addresses of Hannes Weiner and Oskar Schirmer
  lib: Change mail address of Oskar Schirmer
  net: Change mail address of Oskar Schirmer
  arm/m68k: Change mail address of Sebastian Hess
  i2c: Change mail address of Oskar Schirmer
  net: Fix tcp_build_and_update_options comment in struct tcp_sock
  atomic64_32.h: fix parameter naming mismatch
  Kconfig: replace "--- help ---" with "---help---"
  c2port: fix bogus Kconfig "default no"
  edac: Fix spelling errors.
  qla1280: Remove redundant NULL check before release_firmware() call
  remoteproc: remove redundant NULL check before release_firmware()
  qla2xxx: Remove redundant NULL check before release_firmware() call.
  aic94xx: Get rid of redundant NULL check before release_firmware() call
  tehuti: delete redundant NULL check before release_firmware()
  qlogic: get rid of a redundant test for NULL before call to release_firmware()
  bna: remove redundant NULL test before release_firmware()
  tg3: remove redundant NULL test before release_firmware() call
  typhoon: get rid of redundant conditional before all to release_firmware()
  ...
2012-05-22 19:22:50 -07:00
Ohad Ben-Cohen 77ca233235 iommu/core: pass a user-provided token to fault handlers
Sometimes a single IOMMU user may have to deal with several
different IOMMU devices (e.g. remoteproc).

When an IOMMU fault happens, such users have to regain their
context in order to deal with the fault.

Users can't use the private fields of neither the iommu_domain nor
the IOMMU device, because those are already used by the IOMMU core
and low level driver (respectively).

This patch just simply allows users to pass a private token (most
notably their own context pointer) to iommu_set_fault_handler(),
and then makes sure it is provided back to the users whenever
an IOMMU fault happens.

The patch also adopts remoteproc to the new fault handling
interface, but the real functionality using this (recovery of
remote processors) will only be added later in a subsequent patch
set.

Cc: Fernando Guzman Lugo <fernando.lugo@ti.com>
Signed-off-by: Ohad Ben-Cohen <ohad@wizery.com>
Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
2012-05-22 18:08:08 +02:00
Subramaniam Chanderashekarapuram 6fd98c124c remoteproc: fix off-by-one bug in __rproc_free_vrings
Fix a nasty off-by-one bug in __rproc_free_vrings which
resulted in a memory leak and (for some platforms) failures
to reload the remote processor.

Signed-off-by: Subramaniam Chanderashekarapuram <subramaniam.ca@ti.com>
[ohad@wizery.com: reword commit log, stick with the for loop]
Signed-off-by: Ohad Ben-Cohen <ohad@wizery.com>
2012-05-13 23:15:42 +03:00
Jesper Juhl 3cc6e78777 remoteproc: remove redundant NULL check before release_firmware()
release_firmware deals gracefully with NULL pointers, so checking
first is redundant.

Signed-off-by: Jesper Juhl <jj@chaosbits.net>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2012-04-30 13:24:45 +02:00
Ohad Ben-Cohen 1e3e2c7c46 remoteproc: cleanup resource table parsing paths
rproc_handle_resources() looks for the resource table and then
invokes a resource handler function which it took as a parameter.

This works, but it's a bit unintuitive to follow.

Instead of passing around function pointers, this patch changes
rproc_handle_resource() to just find and return the resource table,
and then the calling sites of rproc_handle_resource() invoke their
resource handlers directly.

Signed-off-by: Ohad Ben-Cohen <ohad@wizery.com>
Cc: Brian Swetland <swetland@google.com>
Cc: Iliyan Malchev <malchev@google.com>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Grant Likely <grant.likely@secretlab.ca>
Cc: Rusty Russell <rusty@rustcorp.com.au>
Cc: Mark Grosen <mgrosen@ti.com>
Cc: John Williams <john.williams@petalogix.com>
Cc: Michal Simek <monstr@monstr.eu>
Cc: Loic PALLARDY <loic.pallardy@stericsson.com>
Cc: Ludovic BARRE <ludovic.barre@stericsson.com>
Cc: Omar Ramirez Luna <omar.luna@linaro.org>
Cc: Guzman Lugo Fernando <fernando.lugo@ti.com>
Cc: Anna Suman <s-anna@ti.com>
Cc: Clark Rob <rob@ti.com>
Cc: Stephen Boyd <sboyd@codeaurora.org>
Cc: Saravana Kannan <skannan@codeaurora.org>
Cc: David Brown <davidb@codeaurora.org>
Cc: Kieran Bingham <kieranbingham@gmail.com>
Cc: Tony Lindgren <tony@atomide.com>
2012-03-06 19:14:44 +02:00
Ohad Ben-Cohen 63140e0ed2 remoteproc: remove the hardcoded vring alignment
Remove the hardcoded vring alignment of 4096 bytes,
and instead utilize tha vring alignment as specified in
the resource table.

This is needed for remote processors that have rigid
memory requirement, and which have found the alignment of
4096 bytes to be excessively big.

Signed-off-by: Ohad Ben-Cohen <ohad@wizery.com>
Cc: Brian Swetland <swetland@google.com>
Cc: Iliyan Malchev <malchev@google.com>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Grant Likely <grant.likely@secretlab.ca>
Cc: Rusty Russell <rusty@rustcorp.com.au>
Cc: Mark Grosen <mgrosen@ti.com>
Cc: John Williams <john.williams@petalogix.com>
Cc: Michal Simek <monstr@monstr.eu>
Cc: Loic PALLARDY <loic.pallardy@stericsson.com>
Cc: Ludovic BARRE <ludovic.barre@stericsson.com>
Cc: Omar Ramirez Luna <omar.luna@linaro.org>
Cc: Guzman Lugo Fernando <fernando.lugo@ti.com>
Cc: Anna Suman <s-anna@ti.com>
Cc: Clark Rob <rob@ti.com>
Cc: Stephen Boyd <sboyd@codeaurora.org>
Cc: Saravana Kannan <skannan@codeaurora.org>
Cc: David Brown <davidb@codeaurora.org>
Cc: Kieran Bingham <kieranbingham@gmail.com>
Cc: Tony Lindgren <tony@atomide.com>
2012-03-06 19:14:37 +02:00
Ohad Ben-Cohen 7a18694162 remoteproc: remove the single rpmsg vdev limitation
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 <ohad@wizery.com>
Cc: Brian Swetland <swetland@google.com>
Cc: Iliyan Malchev <malchev@google.com>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Grant Likely <grant.likely@secretlab.ca>
Cc: Rusty Russell <rusty@rustcorp.com.au>
Cc: Mark Grosen <mgrosen@ti.com>
Cc: John Williams <john.williams@petalogix.com>
Cc: Michal Simek <monstr@monstr.eu>
Cc: Loic PALLARDY <loic.pallardy@stericsson.com>
Cc: Ludovic BARRE <ludovic.barre@stericsson.com>
Cc: Omar Ramirez Luna <omar.luna@linaro.org>
Cc: Guzman Lugo Fernando <fernando.lugo@ti.com>
Cc: Anna Suman <s-anna@ti.com>
Cc: Clark Rob <rob@ti.com>
Cc: Stephen Boyd <sboyd@codeaurora.org>
Cc: Saravana Kannan <skannan@codeaurora.org>
Cc: David Brown <davidb@codeaurora.org>
Cc: Kieran Bingham <kieranbingham@gmail.com>
Cc: Tony Lindgren <tony@atomide.com>
2012-03-06 19:14:12 +02:00
Ohad Ben-Cohen fd2c15ec1d remoteproc: resource table overhaul
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 <ohad@wizery.com>
Cc: Brian Swetland <swetland@google.com>
Cc: Iliyan Malchev <malchev@google.com>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Grant Likely <grant.likely@secretlab.ca>
Cc: Rusty Russell <rusty@rustcorp.com.au>
Cc: Mark Grosen <mgrosen@ti.com>
Cc: John Williams <john.williams@petalogix.com>
Cc: Michal Simek <monstr@monstr.eu>
Cc: Loic PALLARDY <loic.pallardy@stericsson.com>
Cc: Ludovic BARRE <ludovic.barre@stericsson.com>
Cc: Omar Ramirez Luna <omar.luna@linaro.org>
Cc: Guzman Lugo Fernando <fernando.lugo@ti.com>
Cc: Anna Suman <s-anna@ti.com>
Cc: Clark Rob <rob@ti.com>
Cc: Stephen Boyd <sboyd@codeaurora.org>
Cc: Saravana Kannan <skannan@codeaurora.org>
Cc: David Brown <davidb@codeaurora.org>
Cc: Kieran Bingham <kieranbingham@gmail.com>
Cc: Tony Lindgren <tony@atomide.com>
2012-03-06 19:13:39 +02:00
Ohad Ben-Cohen 40b78b2cc7 remoteproc: make sure we're parsing a 32bit firmware
Make sure we're parsing a 32bit image, since we only support
the ELF32 binary format at this point.

This should prevent unexpected behavior with non 32bit binaries.

Signed-off-by: Ohad Ben-Cohen <ohad@wizery.com>
Cc: Grant Likely <grant.likely@secretlab.ca>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Mark Grosen <mgrosen@ti.com>
Cc: Suman Anna <s-anna@ti.com>
Cc: Fernando Guzman Lugo <fernando.lugo@ti.com>
Cc: Rob Clark <rob@ti.com>
Cc: Ludovic BARRE <ludovic.barre@stericsson.com>
Cc: Loic PALLARDY <loic.pallardy@stericsson.com>
Cc: Omar Ramirez Luna <omar.luna@linaro.org>
2012-02-28 18:03:40 +02:00
Ohad Ben-Cohen e12bc14b88 remoteproc: s/big switch/lookup table/
A lookup table would be easier to extend, and the resulting
code is a bit cleaner.

Reported-by: Grant Likely <grant.likely@secretlab.ca>
Signed-off-by: Ohad Ben-Cohen <ohad@wizery.com>
2012-02-22 18:28:49 +02:00
Ohad Ben-Cohen cf59d3e9a7 remoteproc: bail out if firmware has different endianess
At this point we don't support remote processors that have
a different endianess than the host.

Look out for these unsupported scenarios, and bail out if
encountered.

Reported-by: Grant Likely <grant.likely@secretlab.ca>
Signed-off-by: Ohad Ben-Cohen <ohad@wizery.com>
Cc: Mark Grosen <mgrosen@ti.com>
Acked-by: Grant Likely <grant.likely@secretlab.ca>
2012-02-22 18:28:49 +02:00
Ohad Ben-Cohen 489d129a2f remoteproc: depend on EXPERIMENTAL
Remoteproc is still under development and as it gets traction we
definitely expect to do some changes in the binary format (most probably
only in the resource table, e.g. the upcoming move to TLV-based entries).

Active testing and use of remoteproc is most welcome, but we don't want
users to expect backward binary compatibility with the preliminary
images we have today.

Therefore mark remoteproc as EXPERIMENTAL, and explicitly inform the user
about this when a new remote processor is registered.

Signed-off-by: Ohad Ben-Cohen <ohad@wizery.com>
Cc: Stephen Boyd <sboyd@codeaurora.org>
Cc: Rob Clark <rob@ti.com>
Cc: Mark Grosen <mgrosen@ti.com>
Cc: Ludovic BARRE <ludovic.barre@stericsson.com>
2012-02-22 18:28:34 +02:00
Ohad Ben-Cohen 9bc9123117 remoteproc: look for truncated firmware images
Make sure firmware isn't truncated before accessing its data.

Reported-by: Stephen Boyd <sboyd@codeaurora.org>
Signed-off-by: Ohad Ben-Cohen <ohad@wizery.com>
2012-02-08 22:54:37 +02:00
Mark Grosen 7d2d3956fb remoteproc: avoid registering a virtio device if not supported
Let remoteproc know when the firmware doesn't support any virtio
functionality, so registering a virtio device can be avoided.

This is needed for remote processors that doesn't require any
virtio-based communications, but are still controlled via remoteproc.

[ohad@wizery.com: write commit log]

Signed-off-by: Mark Grosen <mgrosen@ti.com>
Signed-off-by: Ohad Ben-Cohen <ohad@wizery.com>
2012-02-08 22:54:17 +02:00
Mark Grosen 0798e1da7a remoteproc: do not require an iommu
Not all remote processors employ an IOMMU, so do not error out
on !iommu_present().

Note: we currently still use iommu_present() to tell whether we need
to configure an IOMMU or not. That works for simple cases, but will
easily fail with more complicated ones (e.g. where an IOMMU exists,
but not all remote processors use it). When those use cases show up,
we will solve them by introducing something like remoteproc hw
capabilities.

[ohad@wizery.com: write commit log]

Signed-off-by: Mark Grosen <mgrosen@ti.com>
Signed-off-by: Ohad Ben-Cohen <ohad@wizery.com>
2012-02-08 22:54:11 +02:00
Ohad Ben-Cohen 400e64df6b remoteproc: add framework for controlling remote processors
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
<fernando.lugo@ti.com>.

ELF loader was written by Mark Grosen <mgrosen@ti.com>, based on
msm's Peripheral Image Loader (PIL) by Stephen Boyd <sboyd@codeaurora.org>.

Designed with Brian Swetland <swetland@google.com>.

Signed-off-by: Ohad Ben-Cohen <ohad@wizery.com>
Acked-by: Grant Likely <grant.likely@secretlab.ca>
Cc: Brian Swetland <swetland@google.com>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Tony Lindgren <tony@atomide.com>
Cc: Russell King <linux@arm.linux.org.uk>
Cc: Rusty Russell <rusty@rustcorp.com.au>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Greg KH <greg@kroah.com>
Cc: Stephen Boyd <sboyd@codeaurora.org>
2012-02-08 22:52:56 +02:00