From patchwork Wed Oct 21 11:47:03 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 55383 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lf0-f72.google.com (mail-lf0-f72.google.com [209.85.215.72]) by patches.linaro.org (Postfix) with ESMTPS id BF90C23024 for ; Wed, 21 Oct 2015 11:50:51 +0000 (UTC) Received: by lffv3 with SMTP id v3sf16558579lff.1 for ; Wed, 21 Oct 2015 04:50:50 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:subject:date:message-id :in-reply-to:references:precedence:list-id:list-unsubscribe :list-archive:list-post:list-help:list-subscribe:cc:mime-version :content-type:content-transfer-encoding:sender:errors-to :x-original-sender:x-original-authentication-results:mailing-list; bh=hrblZ1Pihnsmi0pJQHqEoqSGtYRZakm9tdwXMJ3qJHk=; b=FqEiaXDqwUM9kVvE7u87cqYPKbBjxzjrvs9ftPdyVrpSbBdKc5zlyjsIG4B6pBE556 fFsoxyG8jnZqVhaBtulZNKtl1sC0ZQ76nk89id5oObGsJ6LPdgxY3hXa2jOcpLRsQSZ6 8Ej4Pl46k+cO1jfn5t6UShTnIZvCrkzXpy/+RlUWKCiYOqGLQLNj0z57G6llhz86mpZq agUdlqvNqkeY50xJftu16Lg69DyowFCOsve/YcbPUEj2pyl3iwXw/7I+P6tb5208qBSz o0IPzAWkPJZpYzrtF1FATMDX+9Xt3CJ3/hRNp1AKyndmLoodwSMbws8Z570cSzGdeRAY W9iw== X-Gm-Message-State: ALoCoQmGUj4l7YxQV5NpJICBB/yUYdK5H54kgZ0ijk/tUESBCq8hV48i3m5vl788Hr7oYd5YVlMp X-Received: by 10.112.198.33 with SMTP id iz1mr2051096lbc.8.1445428250688; Wed, 21 Oct 2015 04:50:50 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.25.90.18 with SMTP id o18ls76611lfb.98.gmail; Wed, 21 Oct 2015 04:50:50 -0700 (PDT) X-Received: by 10.112.155.195 with SMTP id vy3mr5107658lbb.9.1445428250537; Wed, 21 Oct 2015 04:50:50 -0700 (PDT) Received: from mail-lf0-f42.google.com (mail-lf0-f42.google.com. [209.85.215.42]) by mx.google.com with ESMTPS id g67si6053950lfi.77.2015.10.21.04.50.50 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 21 Oct 2015 04:50:50 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.42 as permitted sender) client-ip=209.85.215.42; Received: by lffy185 with SMTP id y185so19642398lff.2 for ; Wed, 21 Oct 2015 04:50:50 -0700 (PDT) X-Received: by 10.25.145.209 with SMTP id t200mr3253352lfd.88.1445428250366; Wed, 21 Oct 2015 04:50:50 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.59.35 with SMTP id w3csp2646288lbq; Wed, 21 Oct 2015 04:50:48 -0700 (PDT) X-Received: by 10.66.219.227 with SMTP id pr3mr10303886pac.33.1445428248277; Wed, 21 Oct 2015 04:50:48 -0700 (PDT) Received: from bombadil.infradead.org (bombadil.infradead.org. [2001:1868:205::9]) by mx.google.com with ESMTPS id tb8si12809052pab.225.2015.10.21.04.50.47 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 21 Oct 2015 04:50:48 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org designates 2001:1868:205::9 as permitted sender) client-ip=2001:1868:205::9; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1Zortq-0004m4-97; Wed, 21 Oct 2015 11:49:46 +0000 Received: from mail-wi0-f179.google.com ([209.85.212.179]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Zorte-0004Xp-Rk for linux-arm-kernel@lists.infradead.org; Wed, 21 Oct 2015 11:49:36 +0000 Received: by wicfv8 with SMTP id fv8so70948343wic.0 for ; Wed, 21 Oct 2015 04:49:14 -0700 (PDT) X-Received: by 10.194.81.169 with SMTP id b9mr10504388wjy.3.1445428154782; Wed, 21 Oct 2015 04:49:14 -0700 (PDT) Received: from localhost.localdomain (host81-129-170-218.range81-129.btcentralplus.com. [81.129.170.218]) by smtp.gmail.com with ESMTPSA id uq5sm9928570wjc.3.2015.10.21.04.49.13 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 21 Oct 2015 04:49:14 -0700 (PDT) From: Lee Jones To: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v4 2/6] remoteproc: debugfs: Add ability to boot remote processor using debugfs Date: Wed, 21 Oct 2015 12:47:03 +0100 Message-Id: <1445428027-26174-3-git-send-email-lee.jones@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1445428027-26174-1-git-send-email-lee.jones@linaro.org> References: <1445428027-26174-1-git-send-email-lee.jones@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20151021_044935_058493_7F5FE42C X-CRM114-Status: GOOD ( 14.56 ) X-Spam-Score: -1.9 (-) X-Spam-Report: SpamAssassin version 3.4.0 on bombadil.infradead.org summary: Content analysis details: (-1.9 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [209.85.212.179 listed in list.dnswl.org] 0.8 RCVD_IN_SORBS_WEB RBL: SORBS: sender is an abusable web server [81.129.170.218 listed in dnsbl.sorbs.net] -0.0 RCVD_IN_MSPIKE_H3 RBL: Good reputation (+3) [209.85.212.179 listed in wl.mailspike.net] -0.0 SPF_PASS SPF: sender matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] -0.0 RCVD_IN_MSPIKE_WL Mailspike good senders X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , Cc: ohad@wizery.com, devicetree@vger.kernel.org, f.fainelli@gmail.com, kernel@stlinux.com, Nathan_Lynch@mentor.com, Lee Jones , ludovic.barre@st.com, maxime.coquelin@st.com MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: lee.jones@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.42 as permitted sender) smtp.mailfrom=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 This functionality is especially useful during the testing phase. When used in conjunction with Mailbox's Test Framework we can trivially conduct end-to-end testing i.e. boot co-processor, send and receive messages to the co-processor, then shut it down again (repeat as required). Signed-off-by: Ludovic Barre Signed-off-by: Lee Jones --- drivers/remoteproc/remoteproc_debugfs.c | 34 +++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/drivers/remoteproc/remoteproc_debugfs.c b/drivers/remoteproc/remoteproc_debugfs.c index 9d30809..8113c18 100644 --- a/drivers/remoteproc/remoteproc_debugfs.c +++ b/drivers/remoteproc/remoteproc_debugfs.c @@ -88,8 +88,42 @@ static ssize_t rproc_state_read(struct file *filp, char __user *userbuf, return simple_read_from_buffer(userbuf, count, ppos, buf, i); } +static ssize_t rproc_state_write(struct file *filp, const char __user *userbuf, + size_t count, loff_t *ppos) +{ + struct rproc *rproc = filp->private_data; + char buf[10]; + int ret; + + if (count > sizeof(buf)) + return count; + + ret = copy_from_user(buf, userbuf, count); + if (ret) + return -EFAULT; + + if (buf[count - 1] == '\n') + buf[count - 1] = '\0'; + + if (!strncmp(buf, "start", count)) { + ret = rproc_boot(rproc); + if (ret) { + dev_err(&rproc->dev, "Boot failed: %d\n", ret); + return ret; + } + } else if (!strncmp(buf, "stop", count)) { + rproc_shutdown(rproc); + } else { + dev_err(&rproc->dev, "Unrecognised option: %s\n", buf); + return -EINVAL; + } + + return count; +} + static const struct file_operations rproc_state_ops = { .read = rproc_state_read, + .write = rproc_state_write, .open = simple_open, .llseek = generic_file_llseek, };