Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

remoteproc: pru: Make sysfs entries read-only for PRU client driven boots

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 <s-anna@ti.com>
Signed-off-by: Grzegorz Jaszczyk <grzegorz.jaszczyk@linaro.org>
Signed-off-by: MD Danish Anwar <danishanwar@ti.com>
Reviewed-by: Roger Quadros <rogerq@kernel.org>
Link: https://lore.kernel.org/r/20230106121046.886863-5-danishanwar@ti.com
Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>

authored by

Suman Anna and committed by
Mathieu Poirier
2da812ff 919e8942

+2
+2
drivers/remoteproc/pru_rproc.c
··· 223 223 } 224 224 225 225 pru->client_np = np; 226 + rproc->sysfs_read_only = true; 226 227 227 228 mutex_unlock(&pru->lock); 228 229 ··· 262 261 } 263 262 264 263 pru->client_np = NULL; 264 + rproc->sysfs_read_only = false; 265 265 mutex_unlock(&pru->lock); 266 266 267 267 rproc_put(rproc);