Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- static int k3_r5_rproc_stop(struct rproc *rproc)
- {
- struct k3_r5_rproc *kproc = rproc->priv;
- struct k3_r5_cluster *cluster = kproc->cluster;
- struct device *dev = kproc->dev;
- struct k3_r5_core *core1, *core = kproc->core;
- int ret;
- if (cluster->mode != CLUSTER_MODE_LOCKSTEP) {
- /* do not allow core 0 to stop before core 1 */
- core1 = list_last_entry(&cluster->cores, struct k3_r5_core,
- elem);
- if (core != core1 && core1->rproc->state != RPROC_OFFLINE &&
- core1->rproc->state != RPROC_SUSPENDED) {
- dev_err(dev, "%s: can not stop core 0 before core 1\n",
- __func__);
- ret = -EPERM;
- goto out;
- }
- }
- /* halt all applicable cores */
- if (cluster->mode == CLUSTER_MODE_LOCKSTEP) {
- list_for_each_entry(core, &cluster->cores, elem) {
- ret = k3_r5_core_halt(core);
- if (ret) {
- core = list_prev_entry(core, elem);
- goto unroll_core_halt;
- }
- }
- } else {
- ret = k3_r5_core_halt(core);
- if (ret)
- goto out;
- }
- mbox_free_channel(kproc->mbox);
- return 0;
- unroll_core_halt:
- list_for_each_entry_from_reverse(core, &cluster->cores, elem) {
- if (k3_r5_core_run(core))
- dev_warn(core->dev, "core run back failed\n");
- }
- out:
- return ret;
- }
Advertisement
Add Comment
Please, Sign In to add comment