remoteproc updates for v4.7

Introduces a synchronization point between the async firmware loading
 and clients requesting the remote processor to boot, as well as support
 for remote processors that are not interested in the resource table
 information.
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQIcBAABAgAGBQJXOmIsAAoJEAsfOT8Nma3FlBcP/0We51mcbfrhJuwH5DTCJoOi
 lIUJnrwH595Z1I4aOhD9auoHfl5LbCTheQLuAO55ynxbPKHxaYBDBHcVuyzfcyL+
 ibzK5iWTT6v8IxK+gFSZHcbUU5uEFGnxCb1iweEgnxVvhbS+4Eo6Wfww+eAkYiR/
 RuHvVn8hOQplwhSQnyBJFq2WQbRLTHVEkAMd13ZSQhFEnBV9LEutJfGfVi3jk9jb
 L1Oh01t+7TreCs/qhmZWi2E49BbNf/fThqP3cwPnWEfDd1YpiVgTnxrvGn/EpPK6
 YFp5OcNtZND4mt7M7ErcdLMSIDcPAfbPXWQcvfoSdk/aWazGk8vdG/DaMopdHUw8
 Tkc95UCtbjmZMimNJUD+NWmFTtQ5VHgUOm2vtjLTEIHhz81PyxFsI0AqcM3Dw2BA
 4X/nk1axCFJKhh/YO1aqOELJBPacu0YIDbHHxQc0rHHOQAqlzIGUMuQ5Ljb0nTCG
 GQBup4FSqv9uIhvVJhZoGl68MA9+ADAPEJsKl/+b9PkP24WPo+sdCsistBf0r4b+
 T92ReBFiR9UHBOeHaXjbtJar6j+JZvdO8HSKSNMUuzkSimC7CBUgp3JkAXfa8ZwB
 2cOrB7mrmpstAaf5F4rd7jS5/sf3YG/8YufrshMGh3FHvnVoGShClSqkAh+1jsBO
 hW19d7Yxmp0rXMywsYtP
 =Bo8Q
 -----END PGP SIGNATURE-----

Merge tag 'rproc-v4.7' of git://github.com/andersson/remoteproc

Pull remoteproc updates from Bjorn Andersson:
 "Introduce a synchronization point between the async firmware loading
  and clients requesting the remote processor to boot, as well as
  support for remote processors that are not interested in the resource
  table information"

* tag 'rproc-v4.7' of git://github.com/andersson/remoteproc:
  remoteproc: Add additional crash reasons
  remoteproc: core: Make the loaded resource table optional
  remoteproc: core: Task sync during rproc_fw_boot()
This commit is contained in:
Linus Torvalds 2016-05-18 17:22:19 -07:00
commit 97f00905ec
4 changed files with 37 additions and 9 deletions

View File

@ -57,6 +57,8 @@ static DEFINE_IDA(rproc_dev_index);
static const char * const rproc_crash_names[] = {
[RPROC_MMUFAULT] = "mmufault",
[RPROC_WATCHDOG] = "watchdog",
[RPROC_FATAL_ERROR] = "fatal error",
};
/* translate rproc_crash_type to string */
@ -856,12 +858,8 @@ static int rproc_fw_boot(struct rproc *rproc, const struct firmware *fw)
* copy this information to device memory.
*/
loaded_table = rproc_find_loaded_rsc_table(rproc, fw);
if (!loaded_table) {
ret = -EINVAL;
goto clean_up;
}
memcpy(loaded_table, rproc->cached_table, tablesz);
if (loaded_table)
memcpy(loaded_table, rproc->cached_table, tablesz);
/* power up the remote processor */
ret = rproc->ops->start(rproc);
@ -1030,8 +1028,9 @@ static void rproc_crash_handler_work(struct work_struct *work)
}
/**
* rproc_boot() - boot a remote processor
* __rproc_boot() - boot a remote processor
* @rproc: handle of a remote processor
* @wait: wait for rproc registration completion
*
* Boot a remote processor (i.e. load its firmware, power it on, ...).
*
@ -1040,7 +1039,7 @@ static void rproc_crash_handler_work(struct work_struct *work)
*
* Returns 0 on success, and an appropriate error value otherwise.
*/
int rproc_boot(struct rproc *rproc)
static int __rproc_boot(struct rproc *rproc, bool wait)
{
const struct firmware *firmware_p;
struct device *dev;
@ -1088,6 +1087,10 @@ int rproc_boot(struct rproc *rproc)
goto downref_rproc;
}
/* if rproc virtio is not yet configured, wait */
if (wait)
wait_for_completion(&rproc->firmware_loading_complete);
ret = rproc_fw_boot(rproc, firmware_p);
release_firmware(firmware_p);
@ -1101,8 +1104,28 @@ unlock_mutex:
mutex_unlock(&rproc->lock);
return ret;
}
/**
* rproc_boot() - boot a remote processor
* @rproc: handle of a remote processor
*/
int rproc_boot(struct rproc *rproc)
{
return __rproc_boot(rproc, true);
}
EXPORT_SYMBOL(rproc_boot);
/**
* rproc_boot_nowait() - boot a remote processor
* @rproc: handle of a remote processor
*
* Same as rproc_boot() but don't wait for rproc registration completion
*/
int rproc_boot_nowait(struct rproc *rproc)
{
return __rproc_boot(rproc, false);
}
/**
* rproc_shutdown() - power off the remote processor
* @rproc: the remote processor

View File

@ -48,6 +48,7 @@ struct rproc_fw_ops {
/* from remoteproc_core.c */
void rproc_release(struct kref *kref);
irqreturn_t rproc_vq_interrupt(struct rproc *rproc, int vq_id);
int rproc_boot_nowait(struct rproc *rproc);
/* from remoteproc_virtio.c */
int rproc_add_virtio_dev(struct rproc_vdev *rvdev, int id);

View File

@ -161,7 +161,7 @@ static int rproc_virtio_find_vqs(struct virtio_device *vdev, unsigned nvqs,
}
/* now that the vqs are all set, boot the remote processor */
ret = rproc_boot(rproc);
ret = rproc_boot_nowait(rproc);
if (ret) {
dev_err(&rproc->dev, "rproc_boot() failed %d\n", ret);
goto error;

View File

@ -365,6 +365,8 @@ enum rproc_state {
/**
* enum rproc_crash_type - remote processor crash types
* @RPROC_MMUFAULT: iommu fault
* @RPROC_WATCHDOG: watchdog bite
* @RPROC_FATAL_ERROR fatal error
*
* Each element of the enum is used as an array index. So that, the value of
* the elements should be always something sane.
@ -373,6 +375,8 @@ enum rproc_state {
*/
enum rproc_crash_type {
RPROC_MMUFAULT,
RPROC_WATCHDOG,
RPROC_FATAL_ERROR,
};
/**