From mboxrd@z Thu Jan 1 00:00:00 1970 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 202C1C3DA59 for ; Mon, 15 Jul 2024 13:39:40 +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=W/i5mxvrqA5rDDoUIqH03eiWTx2gL/d78pdZZ/Qfgds=; b=nPMIK8hNuSnl74D/Y9q98PBwEs WWEcuvXWDygrq7uWabCPYElk1fLQN+2b2LWquxJVx9Wf+ZgTvQiypUylCeVK4mdiBRXrSArzrl0hg vDR1IErHsidAgH8oPgAwcvS1DAJwi26GxBYpLcf+SSTFa7rF32U8/b2LgFY/QJKpLIXxSqt0ksMQr rS77nC6A+7Py3d+4v7iFDnwxKMl6ZA7ThpJ42bsXTXs/oncZDhzM29rUMKNwiAyplZROWm1Rmanoc 6TMnUD05ks8cHJkoKofXdohf3DOwifszmMu0Cn6qUZzb26GAbUg3RN9Rn05ZSM4+l7uk4oArsQoPL i1J4/WIw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sTLvN-00000007F5l-3nd8; Mon, 15 Jul 2024 13:39:29 +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 1sTLuB-00000007Ebt-0yH5 for linux-arm-kernel@lists.infradead.org; Mon, 15 Jul 2024 13:38:16 +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 169E7FEC; Mon, 15 Jul 2024 06:38:38 -0700 (PDT) Received: from thinkcentre-m93p.cambridge.arm.com (thinkcentre-m93p.cambridge.arm.com [10.1.197.43]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id EB8D03F73F; Mon, 15 Jul 2024 06:38:11 -0700 (PDT) From: Luke Parkin To: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, arm-scmi@vger.kernel.org Cc: sudeep.holla@arm.com, cristian.marussi@arm.com, Luke Parkin Subject: [PATCH v3 4/5] firmware: arm_scmi: Create debugfs files for statistics Date: Mon, 15 Jul 2024 14:37:50 +0100 Message-Id: <20240715133751.2877197-5-luke.parkin@arm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240715133751.2877197-1-luke.parkin@arm.com> References: <20240715133751.2877197-1-luke.parkin@arm.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240715_063815_336917_B9447E57 X-CRM114-Status: UNSURE ( 9.65 ) X-CRM114-Notice: Please train this message. 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 Create debugfs files for the statistics in the scmi_debug_stats struct Signed-off-by: Luke Parkin v2->v3 Add extra statistics also added in v3 v1->v2 Only create stats pointer if stats are enabled Move stats debugfs creation into a seperate helper function --- drivers/firmware/arm_scmi/driver.c | 38 ++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/drivers/firmware/arm_scmi/driver.c b/drivers/firmware/arm_scmi/driver.c index b22f104cda36..9378e2d8af4f 100644 --- a/drivers/firmware/arm_scmi/driver.c +++ b/drivers/firmware/arm_scmi/driver.c @@ -2865,6 +2865,41 @@ static int scmi_device_request_notifier(struct notifier_block *nb, return NOTIFY_OK; } +static void scmi_debugfs_stats_setup(struct scmi_info *info, + struct dentry *trans) +{ + struct dentry *stats; + + stats = debugfs_create_dir("stats", trans); + + debugfs_create_atomic_t("sent_ok", 0400, stats, + &info->dbg_stats[SENT_OK]); + debugfs_create_atomic_t("sent_fail", 0400, stats, + &info->dbg_stats[SENT_FAIL]); + debugfs_create_atomic_t("sent_fail_polling_unsupported", 0400, stats, + &info->dbg_stats[SENT_FAIL_POLLING_UNSUPPORTED]); + debugfs_create_atomic_t("sent_fail_channel_not_found", 0400, stats, + &info->dbg_stats[SENT_FAIL_CHANNEL_NOT_FOUND]); + debugfs_create_atomic_t("response_ok", 0400, stats, + &info->dbg_stats[RESPONSE_OK]); + debugfs_create_atomic_t("notif_ok", 0400, stats, + &info->dbg_stats[NOTIF_OK]); + debugfs_create_atomic_t("dlyd_resp_ok", 0400, stats, + &info->dbg_stats[DLYD_RESPONSE_OK]); + debugfs_create_atomic_t("xfers_resp_timeout", 0400, stats, + &info->dbg_stats[XFERS_RESPONSE_TIMEOUT]); + debugfs_create_atomic_t("response_polled_ok", 0400, stats, + &info->dbg_stats[RESPONSE_POLLED_OK]); + debugfs_create_atomic_t("err_msg_unexpected", 0400, stats, + &info->dbg_stats[ERR_MSG_UNEXPECTED]); + debugfs_create_atomic_t("err_msg_invalid", 0400, stats, + &info->dbg_stats[ERR_MSG_INVALID]); + debugfs_create_atomic_t("err_msg_nomem", 0400, stats, + &info->dbg_stats[ERR_MSG_NOMEM]); + debugfs_create_atomic_t("err_protocol", 0400, stats, + &info->dbg_stats[ERR_PROTOCOL]); +} + static void scmi_debugfs_common_cleanup(void *d) { struct scmi_debug_info *dbg = d; @@ -2931,6 +2966,9 @@ static struct scmi_debug_info *scmi_debugfs_common_setup(struct scmi_info *info) debugfs_create_u32("rx_max_msg", 0400, trans, (u32 *)&info->rx_minfo.max_msg); + if (IS_ENABLED(CONFIG_ARM_SCMI_DEBUG_STATISTICS)) + scmi_debugfs_stats_setup(info, trans); + dbg->top_dentry = top_dentry; if (devm_add_action_or_reset(info->dev, -- 2.34.1