Message ID | 20200601175139.22097-3-mathieu.poirier@linaro.org (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | remoteproc: Add support for attaching with rproc | expand |
On Mon 01 Jun 10:51 PDT 2020, Mathieu Poirier wrote: > Add an new attach() operation in order to properly deal with > scenarios where the remoteproc core needs to attach to a > remote processor that has been booted by another entity. > > Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org> > --- > drivers/remoteproc/remoteproc_internal.h | 8 ++++++++ > include/linux/remoteproc.h | 2 ++ > 2 files changed, 10 insertions(+) > > diff --git a/drivers/remoteproc/remoteproc_internal.h b/drivers/remoteproc/remoteproc_internal.h > index 4ba7cb59d3e8..fc710866f8ce 100644 > --- a/drivers/remoteproc/remoteproc_internal.h > +++ b/drivers/remoteproc/remoteproc_internal.h > @@ -79,6 +79,14 @@ static inline int rproc_unprepare_device(struct rproc *rproc) > return 0; > } > > +static inline int rproc_attach_device(struct rproc *rproc) > +{ > + if (rproc->ops->attach) > + return rproc->ops->attach(rproc); > + > + return 0; Afaict we don't allow the registration of a remoteproc in DETACHED state without an "attach" function specified and as such we shouldn't be able to end up here. On the other hand I think it would make sense to have a system where "attach" simply just means bring up the communication with the remote processor, so let's keep it as is and we can adjust it as necessary later. Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org> Regards, Bjorn > +} > + > static inline > int rproc_fw_sanity_check(struct rproc *rproc, const struct firmware *fw) > { > diff --git a/include/linux/remoteproc.h b/include/linux/remoteproc.h > index 21182ad2d059..bf6a310ba870 100644 > --- a/include/linux/remoteproc.h > +++ b/include/linux/remoteproc.h > @@ -359,6 +359,7 @@ enum rsc_handling_status { > * @unprepare: unprepare device after stop > * @start: power on the device and boot it > * @stop: power off the device > + * @attach: attach to a device that his already powered up > * @kick: kick a virtqueue (virtqueue id given as a parameter) > * @da_to_va: optional platform hook to perform address translations > * @parse_fw: parse firmware to extract information (e.g. resource table) > @@ -379,6 +380,7 @@ struct rproc_ops { > int (*unprepare)(struct rproc *rproc); > int (*start)(struct rproc *rproc); > int (*stop)(struct rproc *rproc); > + int (*attach)(struct rproc *rproc); > void (*kick)(struct rproc *rproc, int vqid); > void * (*da_to_va)(struct rproc *rproc, u64 da, size_t len); > int (*parse_fw)(struct rproc *rproc, const struct firmware *fw); > -- > 2.20.1 >
diff --git a/drivers/remoteproc/remoteproc_internal.h b/drivers/remoteproc/remoteproc_internal.h index 4ba7cb59d3e8..fc710866f8ce 100644 --- a/drivers/remoteproc/remoteproc_internal.h +++ b/drivers/remoteproc/remoteproc_internal.h @@ -79,6 +79,14 @@ static inline int rproc_unprepare_device(struct rproc *rproc) return 0; } +static inline int rproc_attach_device(struct rproc *rproc) +{ + if (rproc->ops->attach) + return rproc->ops->attach(rproc); + + return 0; +} + static inline int rproc_fw_sanity_check(struct rproc *rproc, const struct firmware *fw) { diff --git a/include/linux/remoteproc.h b/include/linux/remoteproc.h index 21182ad2d059..bf6a310ba870 100644 --- a/include/linux/remoteproc.h +++ b/include/linux/remoteproc.h @@ -359,6 +359,7 @@ enum rsc_handling_status { * @unprepare: unprepare device after stop * @start: power on the device and boot it * @stop: power off the device + * @attach: attach to a device that his already powered up * @kick: kick a virtqueue (virtqueue id given as a parameter) * @da_to_va: optional platform hook to perform address translations * @parse_fw: parse firmware to extract information (e.g. resource table) @@ -379,6 +380,7 @@ struct rproc_ops { int (*unprepare)(struct rproc *rproc); int (*start)(struct rproc *rproc); int (*stop)(struct rproc *rproc); + int (*attach)(struct rproc *rproc); void (*kick)(struct rproc *rproc, int vqid); void * (*da_to_va)(struct rproc *rproc, u64 da, size_t len); int (*parse_fw)(struct rproc *rproc, const struct firmware *fw);
Add an new attach() operation in order to properly deal with scenarios where the remoteproc core needs to attach to a remote processor that has been booted by another entity. Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org> --- drivers/remoteproc/remoteproc_internal.h | 8 ++++++++ include/linux/remoteproc.h | 2 ++ 2 files changed, 10 insertions(+)