From patchwork Fri Dec 11 14:29:31 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Grzegorz Jaszczyk X-Patchwork-Id: 341973 Delivered-To: patch@linaro.org Received: by 2002:a02:85a7:0:0:0:0:0 with SMTP id d36csp592070jai; Fri, 11 Dec 2020 06:33:57 -0800 (PST) X-Google-Smtp-Source: ABdhPJxn92ZuWU//0IPbebvbqfEO3peYz5XpNWfH2SdLrdwMlbeol7iEEcShD6a5sf9gxeOgdHZC X-Received: by 2002:a05:6402:16c8:: with SMTP id r8mr11868779edx.59.1607697236940; Fri, 11 Dec 2020 06:33:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607697236; cv=none; d=google.com; s=arc-20160816; b=a3maCY9HxZGsqKzFTZFX0T++LKYI6ynWLSxtNKjFkAk88ZqayUS38udUWvpiHOgcwx zVtRtwZTGmmOpwKhMz+UWaUj2gRSzQyt6QBAEkPYOVvrcqKSjG6C/Dz/PyulFc/1wPc4 2SmIn2UIwYfrQ7EG6ToJGfnAW63D9Ycac6B19tpqcM1xsgYJ0KCsJtCTqqLQrtiuPfVS DR891aVI6Zds+TGM709KO65Y4ijvXc3FiVHc84ec144gL4Ps8uA6kAc3wXnYOj5FRRyh I4rlCwizOdKVcwGh5E8BoLhg/5FH1+HPYZOW8l2tcCIS1RzvyDpw/Jdi3UgjNAKwOYku EBTA== 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=KzgrCmH/eCO9qwatLqerAu63cLWMPxg2Jyv56DEYGnKLW3DFZxMAIXuaww+dBZvejV Tn4DcFeWmnNocwXBhoeXI6xlnZtkrwuPFL1gvIn+1J2NZzqCWuFbMqaCs7wl0F5VYLOy 6aWpr650A4F7tCsXwpvQUOno2t39p0UBztFEDNnbAd9k0d7CSlq9DN9td4xx6Qi8tUDY ogzEiRoD1eS63E1zUET5UL7vRgcZpVKPfpm0/P5iwFqyWZ9E0531JiYXL5ZNoghxxEEQ ZYXRvahcG7AR4WnN03bz1qsuDW6uZGdpsnMW5hRkMdaQhcKGaqPxpYem85krQTXw5Uh7 Siew== 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 devicetree-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=devicetree-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 l89si5784444ede.577.2020.12.11.06.33.56; Fri, 11 Dec 2020 06:33:56 -0800 (PST) Received-SPF: pass (google.com: domain of devicetree-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 devicetree-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=devicetree-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 S2406254AbgLKOcP (ORCPT + 7 others); Fri, 11 Dec 2020 09:32:15 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45010 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2406247AbgLKOcF (ORCPT ); Fri, 11 Dec 2020 09:32:05 -0500 Received: from mail-lj1-x244.google.com (mail-lj1-x244.google.com [IPv6:2a00:1450:4864:20::244]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 662C3C0611C5 for ; Fri, 11 Dec 2020 06:30:47 -0800 (PST) Received: by mail-lj1-x244.google.com with SMTP id f11so11140104ljn.2 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=rVAZ0n2RgaiN20hUN425gJi1CMHpWX9hv8Kiwipvh9E0aJRDZEByNdrJaKk+DEafy5 7oYuID8wvYVt7V7tG1iv/ZtnqtYNh1TkjTEkBZ0TLoV1HsHWI53QyDT3urJ0O5DFfPPL xtI11i6bzm603OnsWNJCOBA1KCCStznL/k5gFIXKP7tVI/hUa1UFJ1PFh4bhuzEI9qWq b1+/IlkaNaM0Ty7fq2BmTW7XvOfZ4ZqqsPGiewUrZYuC2HBJKdctD6Qp6psKJyYQF6if 6Zhzx/lZM1xHoHrwfqDAPl4Rf6/YJlwum4s9zBiUcvcfXWhFPDI47QNew1fZ+prbO45J upFw== X-Gm-Message-State: AOAM532yWsB+iD00v3yOgE4qgBAjOk6IpAAf52mIhXXBGM2+JVeAxbvV KdC03NXPo/mi6HMhPVFKWnSKBQ== 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 Precedence: bulk List-ID: X-Mailing-List: devicetree@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(+) -- 2.29.0 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);