From patchwork Wed Nov 7 15:26:01 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xiang Xiao X-Patchwork-Id: 10672559 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 56850109C for ; Wed, 7 Nov 2018 15:27:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4166D2C590 for ; Wed, 7 Nov 2018 15:27:25 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 32B922C5D5; Wed, 7 Nov 2018 15:27:25 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 226F32C590 for ; Wed, 7 Nov 2018 15:27:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727387AbeKHA6N (ORCPT ); Wed, 7 Nov 2018 19:58:13 -0500 Received: from mail-pl1-f196.google.com ([209.85.214.196]:44031 "EHLO mail-pl1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727203AbeKHA6M (ORCPT ); Wed, 7 Nov 2018 19:58:12 -0500 Received: by mail-pl1-f196.google.com with SMTP id g59-v6so8002576plb.10 for ; Wed, 07 Nov 2018 07:27:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=WnuLn/ct9hs8LUcNz9hG8ozgKWtKDpN3Ly7WjfAt/iE=; b=iGuTM4vifkokGnozZ8RiNyW/EzUH79a7zU19KcaY3w6XWZvhjLZoRS6xV/ZyNjmw1+ ZB4C+UwqtLaacidrwfgIypC7CFIVtO1eScLs3mzafAhgm5SOLI8RxuURapYPsO5LSMUl mXCSTmUddnRkTzAwRurXhd3cqcyhHP+PHkMFbqEdvkXrDFrVS412fvDQ4GpzNxWJQBV+ RYO1BEFKyUvl41dzIaWzeHuMM0vCnGkIzTSKQhYEDLiCvqEV4AgklMn1h/P1HXmCqXic Bv2Z9S3Zg5wpO3VAJVnRCIBbsOCbGFIVpef+y4955VhRPSY7ciDPb1dT4joNpnmsuXQw yPWQ== 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; bh=WnuLn/ct9hs8LUcNz9hG8ozgKWtKDpN3Ly7WjfAt/iE=; b=gv56lsh5uD/IxYCwKozO/hV0yBF+zghXAJEKV0FhtRepqxnY2sLcGMJok+lpxbGIMR pd1wW4wDliNMwjyI8la/62ycrHxEoN4ytOTyjAFrnWJ2pkEB3U76IbZtLIbCBSUz+10J oiM0CagFI6zYCheU80o8tswYNmHjUokvLGBr2vLRmgf4IMnDTmG2ykkp0DR57POoI1ll njQlxnlY7cz/l6rHPLYWGXWJ7IbKBm0qzoDN3AxeyP8UZHCuX6T94Kbbo+K1oD4Sw0tp U3vHEEqKu+N5ktEpHi2JODDxVxNThH4CUC6emTpq1gKvGwNabujXAm2aqGnrYEItLU/P gnIw== X-Gm-Message-State: AGRZ1gJPbDsZEfYFOiva94xksLTOD7lKQVAU29dSRHaBzWVWcIyMy4EY Ds5SRWHDbCmcmI0Vco/83ZSX11GzUOs= X-Google-Smtp-Source: AJdET5fRtXm4dZo+YKQFWG01z6liKGblYK8p+sRLIPVC1B9f+m+LhAaoM2LgSS+JFdNrnW4A85PqTw== X-Received: by 2002:a17:902:e101:: with SMTP id cc1-v6mr661882plb.165.1541604442241; Wed, 07 Nov 2018 07:27:22 -0800 (PST) Received: from localhost.localdomain ([43.224.245.179]) by smtp.gmail.com with ESMTPSA id h62-v6sm1343418pfa.146.2018.11.07.07.27.20 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 07 Nov 2018 07:27:21 -0800 (PST) From: Xiang Xiao X-Google-Original-From: Xiang Xiao To: linux-remoteproc@vger.kernel.org, bjorn.andersson@linaro.org Cc: Xiang Xiao Subject: [PATCH] remoteproc: debug: add crash debugfs node Date: Wed, 7 Nov 2018 23:26:01 +0800 Message-Id: <1541604361-1475-1-git-send-email-xiaoxiang@xiaomi.com> X-Mailer: git-send-email 2.7.4 Sender: linux-remoteproc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-remoteproc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP so we can trigger the crash manully which could: 1.test the crash handling code path more easily 2.update the firmware without reboot kernel Signed-off-by: Xiang Xiao --- drivers/remoteproc/remoteproc_debugfs.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/drivers/remoteproc/remoteproc_debugfs.c b/drivers/remoteproc/remoteproc_debugfs.c index 0808466..fca4b2b 100644 --- a/drivers/remoteproc/remoteproc_debugfs.c +++ b/drivers/remoteproc/remoteproc_debugfs.c @@ -154,6 +154,30 @@ static const struct file_operations rproc_recovery_ops = { .llseek = generic_file_llseek, }; +/* expose the crash trigger via debugfs */ +static ssize_t +rproc_crash_write(struct file *filp, const char __user *user_buf, + size_t count, loff_t *ppos) +{ + struct rproc *rproc = filp->private_data; + unsigned int type; + int ret; + + ret = kstrtouint_from_user(user_buf, count, 0, &type); + if (ret < 0) + return ret; + + rproc_report_crash(rproc, type); + + return count; +} + +static const struct file_operations rproc_crash_ops = { + .write = rproc_crash_write, + .open = simple_open, + .llseek = generic_file_llseek, +}; + /* Expose resource table content via debugfs */ static int rproc_rsc_table_show(struct seq_file *seq, void *p) { @@ -324,6 +348,8 @@ void rproc_create_debug_dir(struct rproc *rproc) rproc, &rproc_name_ops); debugfs_create_file("recovery", 0400, rproc->dbg_dir, rproc, &rproc_recovery_ops); + debugfs_create_file("crash", 0200, rproc->dbg_dir, + rproc, &rproc_crash_ops); debugfs_create_file("resource_table", 0400, rproc->dbg_dir, rproc, &rproc_rsc_table_ops); debugfs_create_file("carveout_memories", 0400, rproc->dbg_dir,