]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - rpmsg/rpmsg.git/commitdiff
remoteproc/pru: deny rproc sysfs ops for PRU client driven boots
authorSuman Anna <s-anna@ti.com>
Tue, 19 Feb 2019 02:03:11 +0000 (20:03 -0600)
committerSuman Anna <s-anna@ti.com>
Sun, 24 Feb 2019 01:20:51 +0000 (19:20 -0600)
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 'deny_sysfs_ops' 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>
drivers/remoteproc/pru_rproc.c

index ae18d27b3a602b92d66fc9d596566ff052b38a03..a7c6e523726c4122116c0d7e536c61a09eedf213 100644 (file)
@@ -182,6 +182,7 @@ struct rproc *pru_rproc_get(struct device_node *np, int index)
        }
 
        pru->client_np = np;
+       rproc->deny_sysfs_ops = 1;
 
        mutex_unlock(&pru->lock);
 
@@ -213,6 +214,7 @@ void pru_rproc_put(struct rproc *rproc)
 
        mutex_lock(&pru->lock);
        pru->client_np = NULL;
+       rproc->deny_sysfs_ops = 0;
        mutex_unlock(&pru->lock);
 
        put_device(&rproc->dev);