lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Wed, 25 May 2022 17:58:21 +0530
From:   Shaik Sajida Bhanu <quic_c_sbhanu@...cinc.com>
To:     adrian.hunter@...el.com, ulf.hansson@...aro.org, agross@...nel.org,
        bjorn.andersson@...aro.org, p.zabel@...gutronix.de,
        chris@...ntf.net, venkatg@...eaurora.org, gdjakov@...sol.com,
        quic_asutoshd@...cinc.com
Cc:     linux-arm-msm@...r.kernel.org, linux-mmc@...r.kernel.org,
        linux-kernel@...r.kernel.org, quic_rampraka@...cinc.com,
        quic_pragalla@...cinc.com, quic_sartgarg@...cinc.com,
        quic_nitirawa@...cinc.com, quic_sayalil@...cinc.com,
        Shaik Sajida Bhanu <quic_c_sbhanu@...cinc.com>,
        Liangliang Lu <quic_luliang@...cinc.com>,
        "Bao D . Nguyen" <quic_nguyenb@...cinc.com>
Subject: [PATCH V7 4/4] mmc: debugfs: Add debug fs error state entry for mmc driver

Add debug fs entry error state to query eMMC and SD card errors statistics.
If any errors occurred in eMMC and SD card driver level then
err_state value will be set to 1.

Signed-off-by: Liangliang Lu <quic_luliang@...cinc.com>
Signed-off-by: Sayali Lokhande <quic_sayalil@...cinc.com>
Signed-off-by: Bao D. Nguyen <quic_nguyenb@...cinc.com>
Signed-off-by: Shaik Sajida Bhanu <quic_c_sbhanu@...cinc.com>
Acked-by: Adrian Hunter <adrian.hunter@...el.com>
---
 drivers/mmc/core/debugfs.c | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)

diff --git a/drivers/mmc/core/debugfs.c b/drivers/mmc/core/debugfs.c
index f9fb51f..d8ff66f 100644
--- a/drivers/mmc/core/debugfs.c
+++ b/drivers/mmc/core/debugfs.c
@@ -234,6 +234,27 @@ static int mmc_clock_opt_set(void *data, u64 val)
 DEFINE_SIMPLE_ATTRIBUTE(mmc_clock_fops, mmc_clock_opt_get, mmc_clock_opt_set,
 	"%llu\n");
 
+static int mmc_err_state_get(void *data, u64 *val)
+{
+	struct mmc_host *host = data;
+	int i;
+
+	if (!host)
+		return -EINVAL;
+
+	*val = 0;
+	for (i = 0; i < MMC_ERR_MAX; i++) {
+		if (host->err_stats[i]) {
+			*val = 1;
+			break;
+		}
+	}
+
+	return 0;
+}
+
+DEFINE_DEBUGFS_ATTRIBUTE(mmc_err_state, mmc_err_state_get, NULL, "%llu\n");
+
 static int mmc_err_stats_show(struct seq_file *file, void *data)
 {
 	struct mmc_host *host = (struct mmc_host *)file->private;
@@ -309,6 +330,10 @@ void mmc_add_host_debugfs(struct mmc_host *host)
 			&mmc_clock_fops))
 		goto err_node;
 
+	if (!debugfs_create_file_unsafe("err_state", 0600, root, host,
+			&mmc_err_state))
+		goto err_node;
+
 	if (!debugfs_create_file("err_stats", 0600, root, host,
 			&mmc_err_stats_fops))
 		goto err_node;
-- 
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member 
of Code Aurora Forum, hosted by The Linux Foundation

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ