Linux ARM-MSM sub-architecture
 help / color / mirror / Atom feed
From: Adrian Hunter <adrian.hunter@intel.com>
To: Shaik Sajida Bhanu <quic_c_sbhanu@quicinc.com>,
	asutoshd@quicinc.com, ulf.hansson@linaro.org, agross@kernel.org,
	bjorn.andersson@linaro.org, linux-mmc@vger.kernel.org,
	linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: quic_vbadigan@quicinc.com, quic_rampraka@quicinc.com,
	quic_pragalla@quicinc.com, quic_sartgarg@quicinc.com,
	quic_nitirawa@quicinc.com, quic_sayalil@quicinc.com,
	"Bao D . Nguyen" <quic_nguyenb@quicinc.com>
Subject: Re: [PATCH V4 3/7] mmc: debugfs: Add debug fs entry for mmc driver
Date: Tue, 8 Mar 2022 11:49:30 +0200	[thread overview]
Message-ID: <29a1a50c-bb65-25a4-b09e-7a869490231e@intel.com> (raw)
In-Reply-To: <1646226227-32429-4-git-send-email-quic_c_sbhanu@quicinc.com>

On 2.3.2022 15.03, Shaik Sajida Bhanu wrote:
> Add debug fs entry to query eMMC and SD card errors statistics
> 
> Signed-off-by: Liangliang Lu <quic_luliang@quicinc.com>
> Signed-off-by: Sayali Lokhande <quic_sayalil@quicinc.com>
> Signed-off-by: Bao D. Nguyen <quic_nguyenb@quicinc.com>
> Signed-off-by: Shaik Sajida Bhanu <quic_c_sbhanu@quicinc.com>
> ---
>  drivers/mmc/core/debugfs.c | 60 ++++++++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 60 insertions(+)
> 
> diff --git a/drivers/mmc/core/debugfs.c b/drivers/mmc/core/debugfs.c
> index 3fdbc80..db0988c 100644
> --- a/drivers/mmc/core/debugfs.c
> +++ b/drivers/mmc/core/debugfs.c
> @@ -223,6 +223,63 @@ static int mmc_clock_opt_set(void *data, u64 val)
>  DEFINE_DEBUGFS_ATTRIBUTE(mmc_clock_fops, mmc_clock_opt_get, mmc_clock_opt_set,
>  	"%llu\n");
>  
> +static int mmc_err_stats_show(struct seq_file *file, void *data)
> +{
> +	struct mmc_host *host = (struct mmc_host *)file->private;
> +	const char *desc[MMC_ERR_MAX] = {
> +		[MMC_ERR_CMD_TIMEOUT] = "Command Timeout Occurred",
> +		[MMC_ERR_CMD_CRC] = "Command CRC Errors Occurred",
> +		[MMC_ERR_DAT_TIMEOUT] = "Data Timeout Occurred",
> +		[MMC_ERR_DAT_CRC] = "Data CRC Errors Occurred",
> +		[MMC_ERR_AUTO_CMD] = "Auto-Cmd Error Occurred",
> +		[MMC_ERR_ADMA] = "ADMA Error Occurred",
> +		[MMC_ERR_TUNING] = "Tuning Error Occurred",
> +		[MMC_ERR_CMDQ_RED] = "CMDQ RED Errors",
> +		[MMC_ERR_CMDQ_GCE] = "CMDQ GCE Errors",
> +		[MMC_ERR_CMDQ_ICCE] = "CMDQ ICCE Errors",
> +		[MMC_ERR_REQ_TIMEOUT] = "Request Timedout",
> +		[MMC_ERR_CMDQ_REQ_TIMEOUT] = "CMDQ Request Timedout",
> +		[MMC_ERR_ICE_CFG] = "ICE Config Errors",
> +	};
> +	int i;
> +
> +	if (!host)
> +		return -EINVAL;

Do not need to check host here

> +
> +	for (i = 0; i < MMC_ERR_MAX; i++) {
> +		if (desc[i])
> +			seq_printf(file, "# %s:\t %d\n",
> +					desc[i], host->err_stats[i]);
> +	}
> +
> +	return 0;
> +}
> +
> +static int mmc_err_stats_open(struct inode *inode, struct file *file)
> +{
> +	return single_open(file, mmc_err_stats_show, inode->i_private);
> +}
> +
> +static ssize_t mmc_err_stats_write(struct file *filp, const char __user *ubuf,
> +				   size_t cnt, loff_t *ppos)
> +{
> +	struct mmc_host *host = filp->f_mapping->host->i_private;
> +
> +	if (!host)
> +		return -EINVAL;

Do not need to check host here

> +
> +	pr_debug("%s: Resetting MMC error statistics\n", __func__);
> +	memset(host->err_stats, 0, sizeof(host->err_stats));
> +
> +	return cnt;
> +}
> +
> +static const struct file_operations mmc_err_stats_fops = {
> +	.open	= mmc_err_stats_open,
> +	.read	= seq_read,
> +	.write	= mmc_err_stats_write,
> +};
> +
>  void mmc_add_host_debugfs(struct mmc_host *host)
>  {
>  	struct dentry *root;
> @@ -236,6 +293,9 @@ void mmc_add_host_debugfs(struct mmc_host *host)
>  	debugfs_create_file_unsafe("clock", S_IRUSR | S_IWUSR, root, host,
>  				   &mmc_clock_fops);
>  
> +	debugfs_create_file("err_stats", 0600, root, host,
> +		&mmc_err_stats_fops);
> +
>  #ifdef CONFIG_FAIL_MMC_REQUEST
>  	if (fail_request)
>  		setup_fault_attr(&fail_default_attr, fail_request);


  reply	other threads:[~2022-03-08  9:49 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-02 13:03 [PATCH V4 0/7] mmc: add error statistics for eMMC and SD card Shaik Sajida Bhanu
2022-03-02 13:03 ` [PATCH V4 1/7] mmc: core: Capture eMMC and SD card errors Shaik Sajida Bhanu
2022-03-08  9:44   ` Adrian Hunter
2022-03-12 17:59     ` Sajida Bhanu (Temp) (QUIC)
2022-03-02 13:03 ` [PATCH V4 2/7] mmc: sdhci: " Shaik Sajida Bhanu
2022-03-08  9:36   ` Adrian Hunter
2022-03-12 17:48     ` Sajida Bhanu (Temp) (QUIC)
2022-03-02 13:03 ` [PATCH V4 3/7] mmc: debugfs: Add debug fs entry for mmc driver Shaik Sajida Bhanu
2022-03-08  9:49   ` Adrian Hunter [this message]
2022-03-12 18:05     ` Sajida Bhanu (Temp) (QUIC)
2022-03-02 13:03 ` [PATCH V4 4/7] mmc: debugfs: Add debug fs error state " Shaik Sajida Bhanu
2022-03-02 13:03 ` [PATCH V4 5/7] mmc: core: Set error state " Shaik Sajida Bhanu
2022-03-02 13:03 ` [PATCH V4 6/7] mmc: sdhci: " Shaik Sajida Bhanu
2022-03-08 10:06   ` Adrian Hunter
2022-03-12 18:15     ` Sajida Bhanu (Temp) (QUIC)
2022-03-16  5:58       ` Adrian Hunter
2022-03-17  4:49         ` Sajida Bhanu (Temp) (QUIC)
2022-03-02 13:03 ` [PATCH V4 7/7] mmc: cqhci: Capture eMMC and SD card errors Shaik Sajida Bhanu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=29a1a50c-bb65-25a4-b09e-7a869490231e@intel.com \
    --to=adrian.hunter@intel.com \
    --cc=agross@kernel.org \
    --cc=asutoshd@quicinc.com \
    --cc=bjorn.andersson@linaro.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mmc@vger.kernel.org \
    --cc=quic_c_sbhanu@quicinc.com \
    --cc=quic_nguyenb@quicinc.com \
    --cc=quic_nitirawa@quicinc.com \
    --cc=quic_pragalla@quicinc.com \
    --cc=quic_rampraka@quicinc.com \
    --cc=quic_sartgarg@quicinc.com \
    --cc=quic_sayalil@quicinc.com \
    --cc=quic_vbadigan@quicinc.com \
    --cc=ulf.hansson@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox