mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Bao D. Nguyen" <quic_nguyenb@quicinc.com>
To: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Cc: <quic_cang@quicinc.com>, <quic_nitirawa@quicinc.com>,
	<bvanassche@acm.org>, <avri.altman@wdc.com>,
	<peter.wang@mediatek.com>, <minwoo.im@samsung.com>,
	<adrian.hunter@intel.com>, <martin.petersen@oracle.com>,
	<linux-scsi@vger.kernel.org>,
	Alim Akhtar <alim.akhtar@samsung.com>,
	"James E.J. Bottomley" <James.Bottomley@HansenPartnership.com>,
	Bean Huo <beanhuo@micron.com>,
	"Ziqi Chen" <quic_ziqichen@quicinc.com>,
	Keoseong Park <keosung.park@samsung.com>,
	Gwendal Grignou <gwendal@chromium.org>,
	Al Viro <viro@zeniv.linux.org.uk>,
	Eric Biggers <ebiggers@google.com>,
	open list <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v1 1/1] scsi: ufs: core: add device level exception support
Date: Thu, 13 Mar 2025 14:09:32 -0700	[thread overview]
Message-ID: <f45667a0-d629-a150-2b9f-db11f03a9833@quicinc.com> (raw)
In-Reply-To: <20250313172826.xzqkrx5rzuqpvz7j@thinkpad>

On 3/13/2025 10:28 AM, Manivannan Sadhasivam wrote:
>> +
>> +What:		/sys/bus/platform/drivers/ufshcd/*/device_lvl_exception
>> +What:		/sys/bus/platform/devices/*.ufs/device_lvl_exception
>> +Date:		March 2025
>> +Contact:	Bao D. Nguyen <quic_nguyenb@quicinc.com>
>> +Description:
>> +		The device_lvl_exception is a counter indicating the number
>> +		of times the device level exceptions have occurred since the
>> +		last time this variable is reset. Read the device_lvl_exception_id
>> +		sysfs node to know more information about the exception.
>> +		The file is read only.
> 
> No. This attribute is RW and the write of 0 will reset the counter. Please
> change it here and also in commit message.
> 
> Also document the spec version requirement for these attributes.
> 
Thank you Mani. I will make corrections.

>> +
>> +What:		/sys/bus/platform/drivers/ufshcd/*/device_lvl_exception_id
>> +What:		/sys/bus/platform/devices/*.ufs/device_lvl_exception_id
>> +Date:		March 2025
>> +Contact:	Bao D. Nguyen <quic_nguyenb@quicinc.com>
>> +Description:
>> +		Reading the device_lvl_exception_id returns the device JEDEC
>> +		standard's qDeviceLevelExceptionID attribute. The definition of the
>> +		qDeviceLevelExceptionID is the ufs device vendor specific design.
>> +		Refer to the device manufacturer datasheet for more information
>> +		on the meaning of the qDeviceLevelExceptionID attribute value.
>> +		The file is read only.
>> diff --git a/drivers/ufs/core/ufs-sysfs.c b/drivers/ufs/core/ufs-sysfs.c
>> index 90b5ab6..0248288a 100644
>> --- a/drivers/ufs/core/ufs-sysfs.c
>> +++ b/drivers/ufs/core/ufs-sysfs.c
>> @@ -466,6 +466,56 @@ static ssize_t critical_health_show(struct device *dev,
>>   	return sysfs_emit(buf, "%d\n", hba->critical_health_count);
>>   }
>>   
> 
> [...]
> 
>> +int ufshcd_read_device_lvl_exception_id(struct ufs_hba *hba, u64 *exception_id)
>> +{
>> +	struct utp_upiu_query_response_v4_0 *upiu_resp;
>> +	struct ufs_query_req *request = NULL;
>> +	struct ufs_query_res *response = NULL;
>> +	int err;
>> +
>> +	if (hba->dev_info.wspecversion < 0x410)
>> +		return -EOPNOTSUPP;
>> +
>> +	ufshcd_hold(hba);
>> +	mutex_lock(&hba->dev_cmd.lock);
>> +
>> +	ufshcd_init_query(hba, &request, &response,
>> +			  UPIU_QUERY_OPCODE_READ_ATTR,
>> +			  QUERY_ATTR_IDN_DEV_LVL_EXCEPTION_ID, 0, 0);
>> +
>> +	request->query_func = UPIU_QUERY_FUNC_STANDARD_READ_REQUEST;
>> +
>> +	err = ufshcd_exec_dev_cmd(hba, DEV_CMD_TYPE_QUERY, QUERY_REQ_TIMEOUT);
>> +
>> +	if (err) {
>> +		dev_err(hba->dev, "%s: failed to read device level exception %d\n",
>> +			__func__, err);
>> +		goto out;
>> +	}
>> +
>> +	upiu_resp = (struct utp_upiu_query_response_v4_0 *)response;
>> +	*exception_id = get_unaligned_be64(&upiu_resp->value);
>> +
>> +out:
>> +	mutex_unlock(&hba->dev_cmd.lock);
>> +	ufshcd_release(hba);
>> +
>> +	return err;
>> +}
>> +EXPORT_SYMBOL_GPL(ufshcd_read_device_lvl_exception_id);
> 
> There is no need to export this function.
>
I will make the correction.

> - Mani
> 


  reply	other threads:[~2025-03-13 21:10 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-06 17:31 Bao D. Nguyen
2025-03-13 17:28 ` Manivannan Sadhasivam
2025-03-13 21:09   ` Bao D. Nguyen [this message]
2025-03-13 18:14 ` Bart Van Assche
2025-03-13 21:36   ` Bao D. Nguyen
2025-03-14  7:09     ` Avri Altman

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=f45667a0-d629-a150-2b9f-db11f03a9833@quicinc.com \
    --to=quic_nguyenb@quicinc.com \
    --cc=James.Bottomley@HansenPartnership.com \
    --cc=adrian.hunter@intel.com \
    --cc=alim.akhtar@samsung.com \
    --cc=avri.altman@wdc.com \
    --cc=beanhuo@micron.com \
    --cc=bvanassche@acm.org \
    --cc=ebiggers@google.com \
    --cc=gwendal@chromium.org \
    --cc=keosung.park@samsung.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=manivannan.sadhasivam@linaro.org \
    --cc=martin.petersen@oracle.com \
    --cc=minwoo.im@samsung.com \
    --cc=peter.wang@mediatek.com \
    --cc=quic_cang@quicinc.com \
    --cc=quic_nitirawa@quicinc.com \
    --cc=quic_ziqichen@quicinc.com \
    --cc=viro@zeniv.linux.org.uk \
    /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

all inboxes | Powered by JetHome®