]> www.infradead.org Git - users/jedix/linux-maple.git/commit
scsi: ufs: core: Critical health condition
authorAvri Altman <avri.altman@wdc.com>
Tue, 11 Feb 2025 06:58:13 +0000 (08:58 +0200)
committerMartin K. Petersen <martin.petersen@oracle.com>
Thu, 13 Feb 2025 03:17:18 +0000 (22:17 -0500)
commitedfaf868f3ae65099b41ec28724cb5241eeb9edf
tree0a5c9b21c6cc1bb78125608a7ebd3c2700230c61
parent92186c1455a2d3563dcea58a6f4729d518b5be50
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>
Documentation/ABI/testing/sysfs-driver-ufs
drivers/ufs/core/ufs-sysfs.c
drivers/ufs/core/ufshcd.c
include/ufs/ufs.h
include/ufs/ufshcd.h