]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commit - drivers/remoteproc/remoteproc_core.c
remoteproc: fix recovery procedure
authorLoic Pallardy <loic.pallardy@st.com>
Mon, 21 Jan 2019 13:55:15 +0000 (14:55 +0100)
committerBjorn Andersson <bjorn.andersson@linaro.org>
Thu, 21 Feb 2019 05:34:17 +0000 (21:34 -0800)
commitd4c036fec321341f378ca95d3e99976e835a7404
treedc5d196e59042a93e165225df1f89cacf008a7dc
parent6de1c933246f4acd17c692e33b02e96abd6037e1
remoteproc: fix recovery procedure

Commit 7e83cab824a87e83cab824a8 ("remoteproc: Modify recovery path
to use rproc_{start,stop}()") replaces rproc_{shutdown,boot}() with
rproc_{stop,start}(), which skips destroy the virtio device at stop
but re-initializes it again at start.

Issue is that struct virtio_dev is not correctly reinitialized like done
at initial allocation thanks to kzalloc() and kobject is considered as
already initialized by kernel. That is due to the fact struct virtio_dev
is allocated and released at vdev resource handling level managed and
virtio device is registered and unregistered at rproc subdevices level.

Moreover kernel documentation mentions that device struct must be
zero initialized before calling device_initialize().

This patch disentangles struct virtio_dev from struct rproc_vdev as
the two struct don't have the same life-cycle.

struct virtio_dev is now allocated on rproc_start() and released
on rproc_stop().

This patch applies on top of patch
remoteproc: create vdev subdevice with specific dma memory pool [1]

[1]: https://patchwork.kernel.org/patch/10755781/

Fixes: 7e83cab824a8 ("remoteproc: Modify recovery path to use rproc_{start,stop}()")
Reported-by: Xiang Xiao <xiaoxiang781216@gmail.com>
Signed-off-by: Loic Pallardy <loic.pallardy@st.com>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
drivers/remoteproc/remoteproc_core.c
drivers/remoteproc/remoteproc_internal.h
drivers/remoteproc/remoteproc_virtio.c
include/linux/remoteproc.h