From patchwork Mon Aug 5 13:10:12 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sudeep Holla X-Patchwork-Id: 13753617 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 3CE49C3DA4A for ; Mon, 5 Aug 2024 13:13:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=2EnKSg2gOy1Bbkdt/e0d+mUMqb6SMc3HQkdZZTWtfas=; b=xIIxY1wLf3/pTvL9SpT6RnQqFG pshOuvdR5P3LjqZ8VQRFufjoerB5nMGVYZltIjeYCQLwJYQEcK6v7PssInC6P3COhguNfAxGKM0nE Y2s5JrujIfIWHSfv7yMUI69Mv1FShJQ+BcZgBHPzmEC3ubmS5GTcIqzZ/nl6WtQzWo+wLReMj+cYP uNt93Zm+LBK52SLqaZJoHkOFdXtLreLV2/quzsTMdTnZlrLF5uCbxJEH4kXgM/sv0k9fNuP3Qk94c hwDmUi6zBIKXbSWcd2bR2uGVTeMgogWxaxQ3fymzI14RD34hFUujR8OzpH4PSpF4fSVMetL9hoq0L J2kfFaWg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1saxWh-0000000Fuaa-1FMU; Mon, 05 Aug 2024 13:13:27 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1saxTm-0000000FthX-3HS8 for linux-arm-kernel@lists.infradead.org; Mon, 05 Aug 2024 13:10:28 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id C24D1143D; Mon, 5 Aug 2024 06:10:51 -0700 (PDT) Received: from usa.arm.com (e103737-lin.cambridge.arm.com [10.1.197.49]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id DC4AD3F5A1; Mon, 5 Aug 2024 06:10:24 -0700 (PDT) From: Sudeep Holla To: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, arm-scmi@vger.kernel.org Cc: Sudeep Holla , Cristian Marussi , Luke Parkin Subject: [PATCH v5 5/5] firmware: arm_scmi: Add support to reset the debug metrics Date: Mon, 5 Aug 2024 14:10:12 +0100 Message-ID: <20240805131013.587016-6-sudeep.holla@arm.com> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20240805131013.587016-1-sudeep.holla@arm.com> References: <20240805131013.587016-1-sudeep.holla@arm.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240805_061026_983501_EEA5E33A X-CRM114-Status: GOOD ( 12.01 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Luke Parkin It is sometimes useful to reset all these SCMI communication debug metrics especially when we are interested in analysing these metrics during a particular workload or for a fixed time duration. Let us add the capability to reset all these metrics as once so that they can be counted during the period of interest. Signed-off-by: Luke Parkin Reviewed-by: Cristian Marussi Signed-off-by: Sudeep Holla --- drivers/firmware/arm_scmi/driver.c | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/drivers/firmware/arm_scmi/driver.c b/drivers/firmware/arm_scmi/driver.c index ade32a67ab63..ca910079d718 100644 --- a/drivers/firmware/arm_scmi/driver.c +++ b/drivers/firmware/arm_scmi/driver.c @@ -2864,6 +2864,24 @@ static const char * const dbg_counter_strs[] = { "err_protocol", }; +static ssize_t reset_all_on_write(struct file *filp, const char __user *buf, + size_t count, loff_t *ppos) +{ + struct scmi_debug_info *dbg = filp->private_data; + + for (int i = 0; i < SCMI_DEBUG_COUNTERS_LAST; i++) + atomic_set(&dbg->counters[i], 0); + + return count; +} + +static const struct file_operations fops_reset_counts = { + .owner = THIS_MODULE, + .open = simple_open, + .llseek = no_llseek, + .write = reset_all_on_write, +}; + static void scmi_debugfs_counters_setup(struct scmi_debug_info *dbg, struct dentry *trans) { @@ -2873,8 +2891,10 @@ static void scmi_debugfs_counters_setup(struct scmi_debug_info *dbg, counters = debugfs_create_dir("counters", trans); for (idx = 0; idx < SCMI_DEBUG_COUNTERS_LAST; idx++) - debugfs_create_atomic_t(dbg_counter_strs[idx], 0400, counters, + debugfs_create_atomic_t(dbg_counter_strs[idx], 0600, counters, &dbg->counters[idx]); + + debugfs_create_file("reset", 0200, counters, dbg, &fops_reset_counts); } static void scmi_debugfs_common_cleanup(void *d)