Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp1297759pxu; Sat, 12 Dec 2020 08:13:19 -0800 (PST) X-Google-Smtp-Source: ABdhPJx+2B9RDyuXWIV2K9lmh90Sy6j/ZOzXsoMMePOWsgpJGZRJ28iepFHVG2c7zXtopDnZsNAU X-Received: by 2002:a05:6402:697:: with SMTP id f23mr4866412edy.318.1607789599415; Sat, 12 Dec 2020 08:13:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607789599; cv=none; d=google.com; s=arc-20160816; b=oahOIMTupJeXgRLLCuTZb1u+eusYQD+G5pyJK12n02vRDUQgnr9BvPk5VU6SBGspxd AMM4uV+QHm7zJQ31hgmbyjcnufTZL0tNLb3yIlYIV1DIs6v1pR7qb2x0mMhLGvmNEJZk CmYmnsJdS/6u/DajX8iBgDo9gk2Xl2j66SPJCl87VI9xjZtxT+SF/rxSMBhXLZouBaMs QeX4GOEPySH3HEYgIKwF1YQNk/6W90aGBDaB/cqiQdrtTof9y0LX8UH3ye4yXZYwmTPu J0a+H4Z8HquWilJgxv94QKNkvwDy67mrx3P3ON1po9lAY6PwWhSmT7dZxnOOoIjeVjxF FOuA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=9s2KpvaYSw4t1bCR1j0Xjb/I6S5cN8m0t3IpN4+bDAo=; b=mkb1Y42HKlSvd2twVX8btZekKNWDSPYuTU5MU5aJgiE7GVFNA3lLEEGo+Pb0GLIoeK Z/tnR985cC9PjVL+msxVGJN4BroZAUeQoxfdC1kZJOtRnfr/5DMaZLloeTaqEsYZeth4 cYeg9B8caNCkRKqneJ2tIvpbWbnHOlUHdXWmRrKKzaOnaB7Zx9gxzWsO/4dGnXh2NLzD ZHzdat9DX6LoThPGjGJVNQ4Ei4eZ+0VeGoVZP7LgyfdGmUgerVbmT/VsiHOOUf9cCxmn M9JyT+RZTP4IL3mac4/F49VsuM3KuNaZbbar7IsJ9PwvoWZdS2YVDZBDvaI1ucG3eGxN soig== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=kJPwUO5U; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h27si6292004ejl.529.2020.12.12.08.12.56; Sat, 12 Dec 2020 08:13:19 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=kJPwUO5U; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2406273AbgLKOdw (ORCPT + 99 others); Fri, 11 Dec 2020 09:33:52 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44996 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2406255AbgLKOcU (ORCPT ); Fri, 11 Dec 2020 09:32:20 -0500 Received: from mail-lj1-x242.google.com (mail-lj1-x242.google.com [IPv6:2a00:1450:4864:20::242]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 66A33C0611CA for ; Fri, 11 Dec 2020 06:30:47 -0800 (PST) Received: by mail-lj1-x242.google.com with SMTP id t22so11133134ljk.0 for ; Fri, 11 Dec 2020 06:30:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=9s2KpvaYSw4t1bCR1j0Xjb/I6S5cN8m0t3IpN4+bDAo=; b=kJPwUO5UuwXNyW/ebEs5EvhbjUqSE88TXvhu4eiG8sLKbdu7OKM74z1RwuRjjeHkii qavyLXpEpZKdIcu70f4Qfh0M0ctJAaM2Er8ozd93xT7AbXsYrCIlID+8Bk9nI/5zVHQe D9e/6zcvjh27WV20GIAIP0a9PQVVyTo5v6udkGqE2v9GN+JqUgFS0+lAZlTr8qZO7Mnw eAXID3uJk+ncUCJ3iBAjVfZ3qlcT8OfOpVnXyEGlwDV52a2ztWeIcAle96h387AUQDmj zSVoLQLspaeJZc48LdZFKWGXrOy/1jwTK6I7vfAO0/pJ4PoQCMuQ/IdsTdeKD/v9Gf2g u/Hw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=9s2KpvaYSw4t1bCR1j0Xjb/I6S5cN8m0t3IpN4+bDAo=; b=PbTf13QCPdooVNNhaVumFRMlEq8JHa4y8kRWjCcF++UH27In6Hgs+/80YYCzX2gh+R 9EZtVYYHhLmHMEe+BPYN9D1rO/bfzFUfJvmP41g4Ilaa5WBwEyz+J+KelEI4IbEXp//A vlWSKLzJbI8ClIqV8QoxuXD2IxdMrL+lL1Vskxed89FNeU1OSKbmGesTmVTNMbiiofC0 IfH4/F/bjn4v0YFyCtSWlEoYIYQLS0dR0qCzJXSSkXdniE2qUB51ncGSm4l5ZKFmsMxW mFP2m52pwBtD8l9Qm+xenD4/ekwIyB4ZfZBgbmQY1dYdeUW8wkiW/nyjswmHO64Jo7we PE+Q== X-Gm-Message-State: AOAM5327D93ZZa8ZDOW8mp1bkSPi0MiIZqasV520BUOUkyN+t0LLuHsz x3npchCs5WlmO9D9x2QxEPCqlg== X-Received: by 2002:a2e:9e87:: with SMTP id f7mr5454185ljk.358.1607697045950; Fri, 11 Dec 2020 06:30:45 -0800 (PST) Received: from gilgamesh.semihalf.com (193-106-246-138.noc.fibertech.net.pl. [193.106.246.138]) by smtp.gmail.com with ESMTPSA id x26sm906491lfq.112.2020.12.11.06.30.44 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 11 Dec 2020 06:30:45 -0800 (PST) From: Grzegorz Jaszczyk To: ohad@wizery.com, bjorn.andersson@linaro.org, mathieu.poirier@linaro.org, robh+dt@kernel.org, s-anna@ti.com, ssantosh@kernel.org Cc: grzegorz.jaszczyk@linaro.org, linux-remoteproc@vger.kernel.org, lee.jones@linaro.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-omap@vger.kernel.org, linux-arm-kernel@lists.infradead.org, praneeth@ti.com, rogerq@ti.com Subject: [PATCH 3/5] remoteproc: pru: Deny rproc sysfs ops for PRU client driven boots Date: Fri, 11 Dec 2020 15:29:31 +0100 Message-Id: <20201211142933.25784-4-grzegorz.jaszczyk@linaro.org> X-Mailer: git-send-email 2.29.0 In-Reply-To: <20201211142933.25784-1-grzegorz.jaszczyk@linaro.org> References: <20201211142933.25784-1-grzegorz.jaszczyk@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Suman Anna 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 Co-developed-by: Grzegorz Jaszczyk Signed-off-by: Grzegorz Jaszczyk --- 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 cc2e585778b1..bfb53967edda 100644 --- a/drivers/remoteproc/pru_rproc.c +++ b/drivers/remoteproc/pru_rproc.c @@ -228,6 +228,7 @@ struct rproc *pru_rproc_get(struct device_node *np, int index, } pru->client_np = np; + rproc->deny_sysfs_ops = true; mutex_unlock(&pru->lock); @@ -258,6 +259,7 @@ void pru_rproc_put(struct rproc *rproc) mutex_lock(&pru->lock); pru->client_np = NULL; + rproc->deny_sysfs_ops = false; mutex_unlock(&pru->lock); put_device(&rproc->dev); -- 2.29.0