summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorAvri Altman <avri.altman@wdc.com>2025-02-11 09:58:13 +0300
committerMartin K. Petersen <martin.petersen@oracle.com>2025-02-13 06:17:18 +0300
commitedfaf868f3ae65099b41ec28724cb5241eeb9edf (patch)
tree0a5c9b21c6cc1bb78125608a7ebd3c2700230c61 /include
parent92186c1455a2d3563dcea58a6f4729d518b5be50 (diff)
downloadlinux-edfaf868f3ae65099b41ec28724cb5241eeb9edf.tar.xz
scsi: ufs: core: Critical health condition
Martin hi, The UFS4.1 standard, released on January 8, 2025, added a new exception event: HEALTH_CRITICAL, which notifies the host of a device's critical health condition. This notification implies that the device is approaching the end of its lifetime based on the amount of performed program/erase cycles. Once an EOL (End-of-Life) exception event is received, we increment a designated member, which is exposed via a sysfs entry. This new entry, will report the number of times a critical health event has been reported by a UFS device. To handle this new sysfs entry, userspace applications can use select(), poll(), or epoll() to monitor changes in the critical_health attribute. The kernel will call sysfs_notify() to signal changes, allowing the userspace application to detect and respond to these changes efficiently. The host can gain further insight into the specific issue by reading one of the following attributes: bPreEOLInfo, bDeviceLifeTimeEstA, bDeviceLifeTimeEstB, bWriteBoosterBufferLifeTimeEst, and bRPMBLifeTimeEst. All those are available for reading via the driver's sysfs entries or through an applicable utility. It is up to userspace to read these attributes if needed. Signed-off-by: Avri Altman <avri.altman@wdc.com> Link: https://lore.kernel.org/r/20250211065813.58091-1-avri.altman@wdc.com Reviewed-by: Bart Van Assche <bvanassche@acm.org> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Diffstat (limited to 'include')
-rw-r--r--include/ufs/ufs.h1
-rw-r--r--include/ufs/ufshcd.h3
2 files changed, 4 insertions, 0 deletions
diff --git a/include/ufs/ufs.h b/include/ufs/ufs.h
index 89672ad8c3bb..d335bff1a310 100644
--- a/include/ufs/ufs.h
+++ b/include/ufs/ufs.h
@@ -419,6 +419,7 @@ enum {
MASK_EE_TOO_LOW_TEMP = BIT(4),
MASK_EE_WRITEBOOSTER_EVENT = BIT(5),
MASK_EE_PERFORMANCE_THROTTLING = BIT(6),
+ MASK_EE_HEALTH_CRITICAL = BIT(9),
};
#define MASK_EE_URGENT_TEMP (MASK_EE_TOO_HIGH_TEMP | MASK_EE_TOO_LOW_TEMP)
diff --git a/include/ufs/ufshcd.h b/include/ufs/ufshcd.h
index 650ff238cd74..5efa570de4c1 100644
--- a/include/ufs/ufshcd.h
+++ b/include/ufs/ufshcd.h
@@ -962,6 +962,7 @@ enum ufshcd_mcq_opr {
* @ufs_rtc_update_work: A work for UFS RTC periodic update
* @pm_qos_req: PM QoS request handle
* @pm_qos_enabled: flag to check if pm qos is enabled
+ * @critical_health_count: count of critical health exceptions
*/
struct ufs_hba {
void __iomem *mmio_base;
@@ -1130,6 +1131,8 @@ struct ufs_hba {
struct delayed_work ufs_rtc_update_work;
struct pm_qos_request pm_qos_req;
bool pm_qos_enabled;
+
+ int critical_health_count;
};
/**