[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ad2ad5b3-9cd4-d0a8-ddec-e078f0ad87a1@foss.st.com>
Date: Mon, 4 Jul 2022 16:55:05 +0200
From: Arnaud POULIQUEN <arnaud.pouliquen@...s.st.com>
To: "Peng Fan (OSS)" <peng.fan@....nxp.com>,
<bjorn.andersson@...aro.org>, <mathieu.poirier@...aro.org>
CC: <linux-remoteproc@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
Peng Fan <peng.fan@....com>
Subject: Re: [PATCH V6 1/2] remoteproc: introduce rproc features
Hello,
On 7/1/22 11:37, Peng Fan (OSS) wrote:
> From: Peng Fan <peng.fan@....com>
>
> remote processor may support:
> - firmware recovery with help from main processor
> - self recovery without help from main processor
> - iommu
> - etc
>
> Introduce rproc features could simplify code to avoid adding more bool
> flags
>
> Signed-off-by: Peng Fan <peng.fan@....com>
> ---
> drivers/remoteproc/remoteproc_internal.h | 15 +++++++++++++++
> include/linux/remoteproc.h | 15 +++++++++++++++
> 2 files changed, 30 insertions(+)
>
> diff --git a/drivers/remoteproc/remoteproc_internal.h b/drivers/remoteproc/remoteproc_internal.h
> index 72d4d3d7d94d..82247cb5d0c2 100644
> --- a/drivers/remoteproc/remoteproc_internal.h
> +++ b/drivers/remoteproc/remoteproc_internal.h
> @@ -24,6 +24,21 @@ struct rproc_debug_trace {
> struct rproc_mem_entry trace_mem;
> };
>
> +static inline bool rproc_has_feature(struct rproc *rproc, unsigned int feature)
> +{
> + return test_bit(feature, rproc->features);
> +}
> +
> +static inline int rproc_set_feature(struct rproc *rproc, unsigned int feature)
> +{
> + if (feature >= RPROC_MAX_FEATURES)
> + return -EINVAL;
> +
> + set_bit(feature, rproc->features);
> +
> + return 0;
> +}
> +
> /* from remoteproc_core.c */
> void rproc_release(struct kref *kref);
> irqreturn_t rproc_vq_interrupt(struct rproc *rproc, int vq_id);
> diff --git a/include/linux/remoteproc.h b/include/linux/remoteproc.h
> index aea79c77db0f..bbfb3affff32 100644
> --- a/include/linux/remoteproc.h
> +++ b/include/linux/remoteproc.h
> @@ -489,6 +489,19 @@ struct rproc_dump_segment {
> loff_t offset;
> };
>
> +/**
> + * enum rproc_features - features supported
> + *
> + * @RPROC_FEAT_ATTACH_ON_RECOVERY: remote processor no need help from Linux
> + * to recover, such as firmware loading.
typo:
s/remote processor no need/ The remote processor does not need/
> + * Linux just need to attach after recovery.
typo
s/need/needs/
Regards,
Arnaud
> + */
> +
> +enum rproc_features {
> + RPROC_FEAT_ATTACH_ON_RECOVERY,
> + RPROC_MAX_FEATURES,
> +};
> +
> /**
> * struct rproc - represents a physical remote processor device
> * @node: list node of this rproc object
> @@ -530,6 +543,7 @@ struct rproc_dump_segment {
> * @elf_machine: firmware ELF machine
> * @cdev: character device of the rproc
> * @cdev_put_on_release: flag to indicate if remoteproc should be shutdown on @char_dev release
> + * @features: indicate remoteproc features
> */
> struct rproc {
> struct list_head node;
> @@ -570,6 +584,7 @@ struct rproc {
> u16 elf_machine;
> struct cdev cdev;
> bool cdev_put_on_release;
> + DECLARE_BITMAP(features, RPROC_MAX_FEATURES);
> };
>
> /**
Powered by blists - more mailing lists