2022-10-31 07:52:21

by MD Danish Anwar

[permalink] [raw]
Subject: [PATCH v7 3/5] remoteproc: pru: Make sysfs entries read-only for PRU client driven boots

From: Suman Anna <[email protected]>

The PRU remoteproc driver is not configured for 'auto-boot' by default,
and allows to be booted either by in-kernel PRU client drivers or by
userspace using the generic remoteproc sysfs interfaces. The sysfs
interfaces should not be permitted to change the remoteproc firmwares
or states when a PRU is being managed by an in-kernel client driver.
Use the newly introduced remoteproc generic 'sysfs_read_only' flag to
provide these restrictions by setting and clearing it appropriately
during the PRU acquire and release steps.

Signed-off-by: Suman Anna <[email protected]>
Co-developed-by: Grzegorz Jaszczyk <[email protected]>
Signed-off-by: Grzegorz Jaszczyk <[email protected]>
Signed-off-by: Puranjay Mohan <[email protected]>
---
drivers/remoteproc/pru_rproc.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/drivers/remoteproc/pru_rproc.c b/drivers/remoteproc/pru_rproc.c
index 9ba73cfc29e2..14eb27bb5f3f 100644
--- a/drivers/remoteproc/pru_rproc.c
+++ b/drivers/remoteproc/pru_rproc.c
@@ -230,6 +230,7 @@ struct rproc *pru_rproc_get(struct device_node *np, int index,
}

pru->client_np = np;
+ rproc->sysfs_read_only = true;

mutex_unlock(&pru->lock);

@@ -268,6 +269,7 @@ void pru_rproc_put(struct rproc *rproc)
}

pru->client_np = NULL;
+ rproc->sysfs_read_only = false;
mutex_unlock(&pru->lock);

rproc_put(rproc);
--
2.25.1



2022-11-04 13:41:04

by Roger Quadros

[permalink] [raw]
Subject: Re: [PATCH v7 3/5] remoteproc: pru: Make sysfs entries read-only for PRU client driven boots



On 31/10/2022 09:37, MD Danish Anwar wrote:
> From: Suman Anna <[email protected]>
>
> The PRU remoteproc driver is not configured for 'auto-boot' by default,
> and allows to be booted either by in-kernel PRU client drivers or by
> userspace using the generic remoteproc sysfs interfaces. The sysfs
> interfaces should not be permitted to change the remoteproc firmwares
> or states when a PRU is being managed by an in-kernel client driver.
> Use the newly introduced remoteproc generic 'sysfs_read_only' flag to
> provide these restrictions by setting and clearing it appropriately
> during the PRU acquire and release steps.
>
> Signed-off-by: Suman Anna <[email protected]>
> Co-developed-by: Grzegorz Jaszczyk <[email protected]>
> Signed-off-by: Grzegorz Jaszczyk <[email protected]>
> Signed-off-by: Puranjay Mohan <[email protected]>

Reviewed-by: Roger Quadros <[email protected]>

> ---
> drivers/remoteproc/pru_rproc.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/drivers/remoteproc/pru_rproc.c b/drivers/remoteproc/pru_rproc.c
> index 9ba73cfc29e2..14eb27bb5f3f 100644
> --- a/drivers/remoteproc/pru_rproc.c
> +++ b/drivers/remoteproc/pru_rproc.c
> @@ -230,6 +230,7 @@ struct rproc *pru_rproc_get(struct device_node *np, int index,
> }
>
> pru->client_np = np;
> + rproc->sysfs_read_only = true;
>
> mutex_unlock(&pru->lock);
>
> @@ -268,6 +269,7 @@ void pru_rproc_put(struct rproc *rproc)
> }
>
> pru->client_np = NULL;
> + rproc->sysfs_read_only = false;
> mutex_unlock(&pru->lock);
>
> rproc_put(rproc);