diff options
| -rw-r--r-- | drivers/remoteproc/remoteproc_core.c | 15 | ||||
| -rw-r--r-- | include/linux/remoteproc.h | 2 |
2 files changed, 17 insertions, 0 deletions
diff --git a/drivers/remoteproc/remoteproc_core.c b/drivers/remoteproc/remoteproc_core.c index 29fc8236cac9..b6c622982f8c 100644 --- a/drivers/remoteproc/remoteproc_core.c +++ b/drivers/remoteproc/remoteproc_core.c | |||
| @@ -228,6 +228,9 @@ int rproc_alloc_vring(struct rproc_vdev *rvdev, int i) | |||
| 228 | return ret; | 228 | return ret; |
| 229 | } | 229 | } |
| 230 | 230 | ||
| 231 | /* Store largest notifyid */ | ||
| 232 | rproc->max_notifyid = max(rproc->max_notifyid, notifyid); | ||
| 233 | |||
| 231 | dev_dbg(dev, "vring%d: va %p dma %x size %x idr %d\n", i, va, | 234 | dev_dbg(dev, "vring%d: va %p dma %x size %x idr %d\n", i, va, |
| 232 | dma, size, notifyid); | 235 | dma, size, notifyid); |
| 233 | 236 | ||
| @@ -269,13 +272,25 @@ rproc_parse_vring(struct rproc_vdev *rvdev, struct fw_rsc_vdev *rsc, int i) | |||
| 269 | return 0; | 272 | return 0; |
| 270 | } | 273 | } |
| 271 | 274 | ||
| 275 | static int rproc_max_notifyid(int id, void *p, void *data) | ||
| 276 | { | ||
| 277 | int *maxid = data; | ||
| 278 | *maxid = max(*maxid, id); | ||
| 279 | return 0; | ||
| 280 | } | ||
| 281 | |||
| 272 | void rproc_free_vring(struct rproc_vring *rvring) | 282 | void rproc_free_vring(struct rproc_vring *rvring) |
| 273 | { | 283 | { |
| 274 | int size = PAGE_ALIGN(vring_size(rvring->len, rvring->align)); | 284 | int size = PAGE_ALIGN(vring_size(rvring->len, rvring->align)); |
| 275 | struct rproc *rproc = rvring->rvdev->rproc; | 285 | struct rproc *rproc = rvring->rvdev->rproc; |
| 286 | int maxid = 0; | ||
| 276 | 287 | ||
| 277 | dma_free_coherent(rproc->dev.parent, size, rvring->va, rvring->dma); | 288 | dma_free_coherent(rproc->dev.parent, size, rvring->va, rvring->dma); |
| 278 | idr_remove(&rproc->notifyids, rvring->notifyid); | 289 | idr_remove(&rproc->notifyids, rvring->notifyid); |
| 290 | |||
| 291 | /* Find the largest remaining notifyid */ | ||
| 292 | idr_for_each(&rproc->notifyids, rproc_max_notifyid, &maxid); | ||
| 293 | rproc->max_notifyid = maxid; | ||
| 279 | } | 294 | } |
| 280 | 295 | ||
| 281 | /** | 296 | /** |
diff --git a/include/linux/remoteproc.h b/include/linux/remoteproc.h index 2ccc3fe2046d..faf33324c78f 100644 --- a/include/linux/remoteproc.h +++ b/include/linux/remoteproc.h | |||
| @@ -400,6 +400,7 @@ enum rproc_crash_type { | |||
| 400 | * @crash_cnt: crash counter | 400 | * @crash_cnt: crash counter |
| 401 | * @crash_comp: completion used to sync crash handler and the rproc reload | 401 | * @crash_comp: completion used to sync crash handler and the rproc reload |
| 402 | * @recovery_disabled: flag that state if recovery was disabled | 402 | * @recovery_disabled: flag that state if recovery was disabled |
| 403 | * @max_notifyid: largest allocated notify id. | ||
| 403 | */ | 404 | */ |
| 404 | struct rproc { | 405 | struct rproc { |
| 405 | struct klist_node node; | 406 | struct klist_node node; |
| @@ -427,6 +428,7 @@ struct rproc { | |||
| 427 | unsigned crash_cnt; | 428 | unsigned crash_cnt; |
| 428 | struct completion crash_comp; | 429 | struct completion crash_comp; |
| 429 | bool recovery_disabled; | 430 | bool recovery_disabled; |
| 431 | int max_notifyid; | ||
| 430 | }; | 432 | }; |
| 431 | 433 | ||
| 432 | /* we currently support only two vrings per rvdev */ | 434 | /* we currently support only two vrings per rvdev */ |
