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-next>] [day] [month] [year] [list]
Message-Id: <20250929105801.428105-1-hy50.seo@samsung.com>
Date: Mon, 29 Sep 2025 19:58:00 +0900
From: HOYOUNG SEO <hy50.seo@...sung.com>
To: linux-scsi@...r.kernel.org, linux-kernel@...r.kernel.org,
	alim.akhtar@...sung.com, avri.altman@....com, jejb@...ux.ibm.com,
	martin.petersen@...cle.com, beanhuo@...ron.com, bvanassche@....org,
	kwangwon.min@...sung.com, kwmad.kim@...sung.com, cpgs@...sung.com,
	h10.kim@...sung.com
Cc: "hy50.seo" <hy50.seo@...sung.com>
Subject: [PATCH v1] scsi: ufs: core: Introduce quirk to check UTP error

From: "hy50.seo" <hy50.seo@...sung.com>

If the UTP error occurs alone, the UFS is not recovered.
It does not check for error and only generates io timeout or OCS error.
This is because UTP error is not defined in error handler.
To fixed this, add UFS qurik about UTP error and this quirk is enable,
UFS reset is performed when a UTP error occurs.

sd 0:0:0:0: [sda] tag#38 UNKNOWN(0x2003) Result: hostbyte=0x07
driverbyte=DRIVER_OK cmd_age=0s
sd 0:0:0:0: [sda] tag#38 CDB: opcode=0x28 28 00 00 51 24 e2 00 00 08 00
I/O error, dev sda, sector 42542864 op 0x0:(READ) flags 0x80700 phys_seg
8 prio class 2
OCS error from controller = 9 for tag 39
pa_err[1] = 0x80000010 at 2667224756 us
pa_err: total cnt=2
dl_err[0] = 0x80000002 at 2667148060 us
dl_err[1] = 0x80002000 at 2667282844 us
No record of nl_err
No record of tl_err
No record of dme_err
No record of auto_hibern8_err
fatal_err[0] = 0x804 at 2667282836 us

---------------------------------------------------
		REGISTER
---------------------------------------------------
                           NAME	      OFFSET	         VALUE
                    STD HCI SFR	  0xfffffff0	           0x0
                           AHIT	        0x18	         0x814
               INTERRUPT STATUS	        0x20	        0x1000
               INTERRUPT ENABLE	        0x24	       0x70ef5

Change-Id: I25156081c52a23dfe1223c18abcce9e9c6fe3868
Signed-off-by: hy50.seo <hy50.seo@...sung.com>
---
 drivers/ufs/core/ufshcd.c | 11 +++++++++++
 include/ufs/ufshcd.h      |  6 ++++++
 include/ufs/ufshci.h      |  3 ++-
 3 files changed, 19 insertions(+), 1 deletion(-)

diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c
index cfc149f8238e..0421178000c1 100644
--- a/drivers/ufs/core/ufshcd.c
+++ b/drivers/ufs/core/ufshcd.c
@@ -6735,6 +6735,14 @@ static void ufshcd_err_handler(struct work_struct *work)
 		goto do_reset;
 	}
 
+	if ((hba->dev_quirks & UFSHCD_QUIRK_UTP_ERROR) && (hba->errors & UTP_ERROR)) {
+		ufshcd_print_host_state(hba);
+		ufshcd_print_evt_hist(hba);
+
+		needs_reset = true;
+		goto do_reset;
+	}
+
 	/*
 	 * If LINERESET was caught, UFS might have been put to PWM mode,
 	 * check if power mode restore is needed.
@@ -6941,6 +6949,9 @@ static irqreturn_t ufshcd_check_errors(struct ufs_hba *hba, u32 intr_status)
 		queue_eh_work = true;
 	}
 
+	if ((hba->quirks & UFSHCD_QUIRK_UTP_ERROR) && (hba->errors & UTP_ERROR))
+		queue_eh_work = true;
+
 	if (hba->errors & UIC_ERROR) {
 		hba->uic_error = 0;
 		retval = ufshcd_update_uic_error(hba);
diff --git a/include/ufs/ufshcd.h b/include/ufs/ufshcd.h
index ea0021f067c9..3ac6ac5fc7fb 100644
--- a/include/ufs/ufshcd.h
+++ b/include/ufs/ufshcd.h
@@ -688,6 +688,12 @@ enum ufshcd_quirks {
 	 * single doorbell mode.
 	 */
 	UFSHCD_QUIRK_BROKEN_LSDBS_CAP			= 1 << 25,
+
+	/*
+	 * This quirk indicated that report the error when UTP error occurs.
+	 * Enable this quirk will the error handler allows the ufs to be reocvery.
+	 */
+	UFSHCD_QUIRK_UTP_ERROR				= 1 << 26,
 };
 
 enum ufshcd_caps {
diff --git a/include/ufs/ufshci.h b/include/ufs/ufshci.h
index 612500a7088f..79a052a50f91 100644
--- a/include/ufs/ufshci.h
+++ b/include/ufs/ufshci.h
@@ -180,6 +180,7 @@ static inline u32 ufshci_version(u32 major, u32 minor)
 #define UTP_TASK_REQ_COMPL			0x200
 #define UIC_COMMAND_COMPL			0x400
 #define DEVICE_FATAL_ERROR			0x800
+#define UTP_ERROR				0x1000
 #define CONTROLLER_FATAL_ERROR			0x10000
 #define SYSTEM_BUS_FATAL_ERROR			0x20000
 #define CRYPTO_ENGINE_FATAL_ERROR		0x40000
@@ -193,7 +194,7 @@ static inline u32 ufshci_version(u32 major, u32 minor)
 
 #define UFSHCD_UIC_MASK		(UIC_COMMAND_COMPL | UFSHCD_UIC_PWR_MASK)
 
-#define UFSHCD_ERROR_MASK	(UIC_ERROR | INT_FATAL_ERRORS)
+#define UFSHCD_ERROR_MASK	(UIC_ERROR | INT_FATAL_ERRORS | UTP_ERROR)
 
 #define INT_FATAL_ERRORS	(DEVICE_FATAL_ERROR |\
 				CONTROLLER_FATAL_ERROR |\
-- 
2.26.0


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ