<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel/linux.git/drivers/ufs, branch v6.18.48</title>
<subtitle>Linux kernel stable tree (mirror)</subtitle>
<id>https://git.radix-linux.su/kernel/linux.git/atom?h=v6.18.48</id>
<link rel='self' href='https://git.radix-linux.su/kernel/linux.git/atom?h=v6.18.48'/>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/'/>
<updated>2026-08-09T18:25:08+00:00</updated>
<entry>
<title>scsi: ufs: core: Revert "Delegate the interrupt service routine to a threaded IRQ handler"</title>
<updated>2026-08-09T18:25:08+00:00</updated>
<author>
<name>Bart Van Assche</name>
<email>bvanassche@acm.org</email>
</author>
<published>2026-07-15T17:12:28+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=ff333def314762b94e0933be7e84947d876f20bf'/>
<id>urn:sha1:ff333def314762b94e0933be7e84947d876f20bf</id>
<content type='text'>
[ Upstream commit 8a309036f557d3ff4efb2beea5132ba91172d934 ]

There have been multiple reports of performance regressions caused by
commit 3c7ac40d7322 ("scsi: ufs: core: Delegate the interrupt service
routine to a threaded IRQ handler"). Hence this revert.

This patch reverts most of the following commits:

 * 3c7ac40d7322 ("scsi: ufs: core: Delegate the interrupt service
   routine to a threaded IRQ handler")

 * 6475cfb81fc4 ("scsi: ufs: core: Avoid IRQ thread wakeup during active
   UIC command")

This patch preserves the following commits:

 * 034d319c8899 ("scsi: ufs: core: Fix interrupt handling for MCQ Mode")

 * eabcac808ca3 ("scsi: ufs: core: Fix IRQ lock inversion for the SCSI
   host lock")

Cc: Neil Armstrong &lt;neil.armstrong@linaro.org&gt;
Cc: 孙魁 (Kui Sun) &lt;kui.sun@unisoc.com&gt;
Cc: André Draszik &lt;andre.draszik@linaro.org&gt;
Cc: Gregory CLEMENT &lt;gregory.clement@bootlin.com&gt;
Cc: Sebastian Andrzej Siewior &lt;bigeasy@linutronix.de&gt;
Fixes: 3c7ac40d7322 ("scsi: ufs: core: Delegate the interrupt service routine to a threaded IRQ handler")
Signed-off-by: Bart Van Assche &lt;bvanassche@acm.org&gt;
Reviewed-by: Sebastian Andrzej Siewior &lt;bigeasy@linutronix.de&gt;
Tested-by: André Draszik &lt;andre.draszik@linaro.org&gt; # on Pixel 6
Reviewed-by: André Draszik &lt;andre.draszik@linaro.org&gt;
Link: https://patch.msgid.link/b70eb60a01f971bed68c42c5b555929db5f835df.1784135511.git.bvanassche@acm.org
Signed-off-by: Martin K. Petersen &lt;martin.petersen@oracle.com&gt;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
</entry>
<entry>
<title>scsi: ufs: core: Avoid IRQ thread wakeup during active UIC command</title>
<updated>2026-08-09T18:25:07+00:00</updated>
<author>
<name>Peter Wang</name>
<email>peter.wang@mediatek.com</email>
</author>
<published>2026-03-06T05:43:02+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=c249cfe1d8df2e9c1de5c25b75245ea0c683e65a'/>
<id>urn:sha1:c249cfe1d8df2e9c1de5c25b75245ea0c683e65a</id>
<content type='text'>
[ Upstream commit 6475cfb81fc4f6175b6d15d1c205a5168dc10b46 ]

Only return IRQ_WAKE_THREAD when MCQ and ESI are not enabled and no UIC
command is active. The default UIC command timeout is 500ms, Using threaded
IRQs during an active UIC command increases the risk of timeout due to
possible preemption by other system IRQs.

Signed-off-by: Peter Wang &lt;peter.wang@mediatek.com&gt;
Reviewed-by: Bart Van Assche &lt;bvanassche@acm.org&gt;
Link: https://patch.msgid.link/20260306054419.3816557-1-peter.wang@mediatek.com
Signed-off-by: Martin K. Petersen &lt;martin.petersen@oracle.com&gt;
Stable-dep-of: 8a309036f557 ("scsi: ufs: core: Revert "Delegate the interrupt service routine to a threaded IRQ handler"")
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
</entry>
<entry>
<title>scsi: ufs: core: Cancel RTC work in active-active suspend</title>
<updated>2026-08-09T18:25:07+00:00</updated>
<author>
<name>Guangshuo Li</name>
<email>lgs201920130244@gmail.com</email>
</author>
<published>2026-07-14T17:27:26+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=e504204489993d334675685d2d4c2f70da68d7dd'/>
<id>urn:sha1:e504204489993d334675685d2d4c2f70da68d7dd</id>
<content type='text'>
[ Upstream commit f71b4a30983b846b4075bf544e835121e70e6a43 ]

UFS RTC support schedules ufs_rtc_update_work to periodically update the
device RTC. The work can issue query commands and access the UFS host
controller.

A previous change moved the RTC work cancellation before the PRE_CHANGE
vendor suspend callback to close a race in the common suspend path.
However, the active-active path jumps directly to vops_suspend after
flushing exception handling work and therefore bypasses the
cancellation.

If the RTC work runs while the vendor suspend callback is gating or
otherwise changing hardware state, it can access the controller during
suspend and trigger an SError.

Cancel the RTC work before entering the vendor suspend callback in the
active-active path. Since this path now cancels the work, move the RTC
work scheduling outside the device and link state restoration block in
the resume path. This restarts RTC updates after an active-active
suspend and resume cycle.

Fixes: b0bd84c39289 ("scsi: ufs: core: Fix SError in ufshcd_rtc_work() during UFS suspend")
Signed-off-by: Guangshuo Li &lt;lgs201920130244@gmail.com&gt;
Reviewed-by: Peter Wang &lt;peter.wang@mediatek.com&gt;
Reviewed-by: Bean Huo &lt;beanhuo@micron.com&gt;
Reviewed-by: Bart Van Assche &lt;bvanassche@acm.org&gt;
Link: https://patch.msgid.link/20260714172726.1736967-1-lgs201920130244@gmail.com
Signed-off-by: Martin K. Petersen &lt;martin.petersen@oracle.com&gt;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
</entry>
<entry>
<title>ufs: core: tracing: Do not dereference pointers in TP_printk()</title>
<updated>2026-07-24T14:17:06+00:00</updated>
<author>
<name>Steven Rostedt</name>
<email>rostedt@goodmis.org</email>
</author>
<published>2026-06-30T22:54:12+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=e497fef9ad7e913f52de6f97e818f56915e96164'/>
<id>urn:sha1:e497fef9ad7e913f52de6f97e818f56915e96164</id>
<content type='text'>
commit 535fcf4b8a261fbb8cc4f91e4597343c135a90f2 upstream.

The trace events in drivers/ufs/core/ufs_trace.h were converted to take a
pointer to the hba structure as an argument for the tracepoint and then in
TP_printk() the printing of the dev_name from the ring buffer was
converted to using the dev dereferenced pointer from the hba saved
pointer.

This is not allowed as the TP_printk() is executed at the time the trace
event is read from /sys/kernel/tracing/trace file. That can happen
literally, seconds, minutes, hours, weeks, days, or even months later!
There is no guarantee that the hba pointer will still exist by the time it
is dereferenced when the "trace" file is read.

Instead, save the device name from the hba pointer at the time the
tracepoint is called and place it into the ring buffer event. Then the
TP_printk() can read the name directly from the ring buffer and remove the
possibility that it will read a freed pointer and crash the kernel.

This was detected when testing the trace event code that looks for
TP_printk() parameters doing illegal derferences[1]

[1] https://lore.kernel.org/all/20260630184836.74d477b6@gandalf.local.home/

Cc: stable@vger.kernel.org
Link: https://patch.msgid.link/20260630185412.283c26c5@gandalf.local.home
Fixes: 583e518e71003 ("scsi: ufs: core: Add hba parameter to trace events")
Reviewed-by: Peter Wang &lt;peter.wang@mediatek.com&gt;
Reviewed-by: Bart Van Assche &lt;bvanassche@acm.org&gt;
Signed-off-by: Steven Rostedt &lt;rostedt@goodmis.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>scsi: ufs: Fix wrong value printed in unexpected UPIU response case</title>
<updated>2026-07-24T14:15:58+00:00</updated>
<author>
<name>Chanwoo Lee</name>
<email>cw9316.lee@samsung.com</email>
</author>
<published>2026-05-27T09:21:34+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=d81370c6c4f5f134590d9788eb01d59738574e80'/>
<id>urn:sha1:d81370c6c4f5f134590d9788eb01d59738574e80</id>
<content type='text'>
[ Upstream commit 2483ae0a56231a915c706411421c6c002a2bf83e ]

In ufshcd_transfer_rsp_status(), the default case of the inner switch
statement prints the UPIU response code when an unexpected response is
received. However, the code was printing 'result' variable which is
always 0 at that point, making the error message useless for debugging.

Fix this by printing the actual UPIU response code returned by
ufshcd_get_req_rsp().

Fixes: 08108d31129a ("scsi: ufs: Improve type safety")
Signed-off-by: Chanwoo Lee &lt;cw9316.lee@samsung.com&gt;
Reviewed-by: Bart Van Assche &lt;bvanassche@acm.org&gt;
Link: https://patch.msgid.link/20260527092134.275887-1-cw9316.lee@samsung.com
Signed-off-by: Martin K. Petersen &lt;martin.petersen@oracle.com&gt;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
</entry>
<entry>
<title>scsi: ufs: core: Fix SError in ufshcd_rtc_work() during UFS suspend</title>
<updated>2026-03-19T15:08:31+00:00</updated>
<author>
<name>Wang Shuaiwei</name>
<email>wangshuaiwei1@xiaomi.com</email>
</author>
<published>2026-03-07T03:51:28+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=b17211b512cbf0e07de27e1932428ee6c20df910'/>
<id>urn:sha1:b17211b512cbf0e07de27e1932428ee6c20df910</id>
<content type='text'>
[ Upstream commit b0bd84c39289ef6a6c3827dd52c875659291970a ]

In __ufshcd_wl_suspend(), cancel_delayed_work_sync() is called to cancel
the UFS RTC work, but it is placed after ufshcd_vops_suspend(hba, pm_op,
POST_CHANGE). This creates a race condition where ufshcd_rtc_work() can
still be running while ufshcd_vops_suspend() is executing. When
UFSHCD_CAP_CLK_GATING is not supported, the condition
!hba-&gt;clk_gating.active_reqs is always true, causing ufshcd_update_rtc()
to be executed. Since ufshcd_vops_suspend() typically performs clock
gating operations, executing ufshcd_update_rtc() at that moment triggers
an SError. The kernel panic trace is as follows:

Kernel panic - not syncing: Asynchronous SError Interrupt
Call trace:
 dump_backtrace+0xec/0x128
 show_stack+0x18/0x28
 dump_stack_lvl+0x40/0xa0
 dump_stack+0x18/0x24
 panic+0x148/0x374
 nmi_panic+0x3c/0x8c
 arm64_serror_panic+0x64/0x8c
 do_serror+0xc4/0xc8
 el1h_64_error_handler+0x34/0x4c
 el1h_64_error+0x68/0x6c
 el1_interrupt+0x20/0x58
 el1h_64_irq_handler+0x18/0x24
 el1h_64_irq+0x68/0x6c
 ktime_get+0xc4/0x12c
 ufshcd_mcq_sq_stop+0x4c/0xec
 ufshcd_mcq_sq_cleanup+0x64/0x1dc
 ufshcd_clear_cmd+0x38/0x134
 ufshcd_issue_dev_cmd+0x298/0x4d0
 ufshcd_exec_dev_cmd+0x1a4/0x1c4
 ufshcd_query_attr+0xbc/0x19c
 ufshcd_rtc_work+0x10c/0x1c8
 process_scheduled_works+0x1c4/0x45c
 worker_thread+0x32c/0x3e8
 kthread+0x120/0x1d8
 ret_from_fork+0x10/0x20

Fix this by moving cancel_delayed_work_sync() before the call to
ufshcd_vops_suspend(hba, pm_op, PRE_CHANGE), ensuring the UFS RTC work is
fully completed or cancelled at that point.

Cc: Bean Huo &lt;beanhuo@iokpp.de&gt;
Fixes: 6bf999e0eb41 ("scsi: ufs: core: Add UFS RTC support")
Reviewed-by: Bart Van Assche &lt;bvanassche@acm.org&gt;
Signed-off-by: Wang Shuaiwei &lt;wangshuaiwei1@xiaomi.com&gt;
Link: https://patch.msgid.link/20260307035128.3419687-1-wangshuaiwei1@xiaomi.com
Signed-off-by: Martin K. Petersen &lt;martin.petersen@oracle.com&gt;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
</entry>
<entry>
<title>scsi: ufs: core: Fix shift out of bounds when MAXQ=32</title>
<updated>2026-03-19T15:08:10+00:00</updated>
<author>
<name>wangshuaiwei</name>
<email>wangshuaiwei1@xiaomi.com</email>
</author>
<published>2026-02-24T06:32:28+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=5faf0ce7d784a36e5199014770fa3a17c9e63cdd'/>
<id>urn:sha1:5faf0ce7d784a36e5199014770fa3a17c9e63cdd</id>
<content type='text'>
[ Upstream commit 2f38fd99c0004676d835ae96ac4f3b54edc02c82 ]

According to JESD223F, the maximum number of queues (MAXQ) is 32. When MCQ
is enabled and ESI is disabled, nr_hw_queues=32 causes a shift overflow
problem.

Fix this by using 64-bit intermediate values to handle the nr_hw_queues=32
case safely.

Signed-off-by: wangshuaiwei &lt;wangshuaiwei1@xiaomi.com&gt;
Reviewed-by: Bart Van Assche &lt;bvanassche@acm.org&gt;
Link: https://patch.msgid.link/20260224063228.50112-1-wangshuaiwei1@xiaomi.com
Signed-off-by: Martin K. Petersen &lt;martin.petersen@oracle.com&gt;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
</entry>
<entry>
<title>scsi: ufs: core: Fix possible NULL pointer dereference in ufshcd_add_command_trace()</title>
<updated>2026-03-19T15:08:10+00:00</updated>
<author>
<name>Peter Wang</name>
<email>peter.wang@mediatek.com</email>
</author>
<published>2026-02-23T06:56:09+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=f4f590c6c9df7453bbda2ef9170b1b09e42a124c'/>
<id>urn:sha1:f4f590c6c9df7453bbda2ef9170b1b09e42a124c</id>
<content type='text'>
[ Upstream commit 30df81f2228d65bddf492db3929d9fcaffd38fc5 ]

The kernel log indicates a crash in ufshcd_add_command_trace, due to a NULL
pointer dereference when accessing hwq-&gt;id.  This can happen if
ufshcd_mcq_req_to_hwq() returns NULL.

This patch adds a NULL check for hwq before accessing its id field to
prevent a kernel crash.

Kernel log excerpt:
[&lt;ffffffd5d192dc4c&gt;] notify_die+0x4c/0x8c
[&lt;ffffffd5d1814e58&gt;] __die+0x60/0xb0
[&lt;ffffffd5d1814d64&gt;] die+0x4c/0xe0
[&lt;ffffffd5d181575c&gt;] die_kernel_fault+0x74/0x88
[&lt;ffffffd5d1864db4&gt;] __do_kernel_fault+0x314/0x318
[&lt;ffffffd5d2a3cdf8&gt;] do_page_fault+0xa4/0x5f8
[&lt;ffffffd5d2a3cd34&gt;] do_translation_fault+0x34/0x54
[&lt;ffffffd5d1864524&gt;] do_mem_abort+0x50/0xa8
[&lt;ffffffd5d2a297dc&gt;] el1_abort+0x3c/0x64
[&lt;ffffffd5d2a29718&gt;] el1h_64_sync_handler+0x44/0xcc
[&lt;ffffffd5d181133c&gt;] el1h_64_sync+0x80/0x88
[&lt;ffffffd5d255c1dc&gt;] ufshcd_add_command_trace+0x23c/0x320
[&lt;ffffffd5d255bad8&gt;] ufshcd_compl_one_cqe+0xa4/0x404
[&lt;ffffffd5d2572968&gt;] ufshcd_mcq_poll_cqe_lock+0xac/0x104
[&lt;ffffffd5d11c7460&gt;] ufs_mtk_mcq_intr+0x54/0x74 [ufs_mediatek_mod]
[&lt;ffffffd5d19ab92c&gt;] __handle_irq_event_percpu+0xc8/0x348
[&lt;ffffffd5d19abca8&gt;] handle_irq_event+0x3c/0xa8
[&lt;ffffffd5d19b1f0c&gt;] handle_fasteoi_irq+0xf8/0x294
[&lt;ffffffd5d19aa778&gt;] generic_handle_domain_irq+0x54/0x80
[&lt;ffffffd5d18102bc&gt;] gic_handle_irq+0x1d4/0x330
[&lt;ffffffd5d1838210&gt;] call_on_irq_stack+0x44/0x68
[&lt;ffffffd5d183af30&gt;] do_interrupt_handler+0x78/0xd8
[&lt;ffffffd5d2a29c00&gt;] el1_interrupt+0x48/0xa8
[&lt;ffffffd5d2a29ba8&gt;] el1h_64_irq_handler+0x14/0x24
[&lt;ffffffd5d18113c4&gt;] el1h_64_irq+0x80/0x88
[&lt;ffffffd5d2527fb4&gt;] arch_local_irq_enable+0x4/0x1c
[&lt;ffffffd5d25282e4&gt;] cpuidle_enter+0x34/0x54
[&lt;ffffffd5d195a678&gt;] do_idle+0x1dc/0x2f8
[&lt;ffffffd5d195a7c4&gt;] cpu_startup_entry+0x30/0x3c
[&lt;ffffffd5d18155c4&gt;] secondary_start_kernel+0x134/0x1ac
[&lt;ffffffd5d18640bc&gt;] __secondary_switched+0xc4/0xcc

Signed-off-by: Peter Wang &lt;peter.wang@mediatek.com&gt;
Reviewed-by: Bart Van Assche &lt;bvanassche@acm.org&gt;
Link: https://patch.msgid.link/20260223065657.2432447-1-peter.wang@mediatek.com
Signed-off-by: Martin K. Petersen &lt;martin.petersen@oracle.com&gt;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
</entry>
<entry>
<title>scsi: ufs: core: Reset urgent_bkops_lvl to allow runtime PM power mode</title>
<updated>2026-03-19T15:08:09+00:00</updated>
<author>
<name>Won Jung</name>
<email>wone.jung@samsung.com</email>
</author>
<published>2026-02-11T06:01:05+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=22e54d67b2f57c47e0b9a172e3a09f5a5f347616'/>
<id>urn:sha1:22e54d67b2f57c47e0b9a172e3a09f5a5f347616</id>
<content type='text'>
[ Upstream commit 5b313760059c9df7d60aba7832279bcb81b4aec0 ]

Ensures that UFS Runtime PM can achieve power saving after System PM
suspend by resetting hba-&gt;urgent_bkops_lvl. Also modify the
ufshcd_bkops_exception_event_handler to avoid setting urgent_bkops_lvl when
status is 0, which helps maintain optimal power management.

On UFS devices supporting UFSHCD_CAP_AUTO_BKOPS_SUSPEND, a BKOPS exception
event can lead to a situation where UFS Runtime PM can't enter low-power
mode states even after the BKOPS exception has been resolved.

BKOPS exception with bkops status 0 occurs, the driver logs:

 "ufshcd_bkops_exception_event_handler: device raised urgent BKOPS exception for bkops status 0"

When a BKOPS exception occurs, ufshcd_bkops_exception_event_handler() reads
the BKOPS status and sets hba-&gt;urgent_bkops_lvl to BKOPS_STATUS_NO_OP(0).
This allows the device to perform Runtime PM without changing the UFS power
mode.  (__ufshcd_wl_suspend(hba, UFS_RUNTIME_PM))

During system PM suspend, ufshcd_disable_auto_bkops() is called, disabling
auto bkops. After UFS System PM Resume, when runtime PM attempts to suspend
again, ufshcd_urgent_bkops() is invoked. Since hba-&gt;urgent_bkops_lvl
remains at BKOPS_STATUS_NO_OP(0), ufshcd_enable_auto_bkops() is triggered.

However, in ufshcd_bkops_ctrl(), the driver compares the current BKOPS
status with hba-&gt;urgent_bkops_lvl, and only enables auto bkops if
curr_status &gt;= hba-&gt;urgent_bkops_lvl.  Since both values are 0, the
condition is met

As a result, __ufshcd_wl_suspend(hba, UFS_RUNTIME_PM) skips power mode
transitions and remains in an active state, preventing power saving even
though no urgent BKOPS condition exists.

Signed-off-by: Won Jung &lt;wone.jung@samsung.com&gt;
Reviewed-by: Peter Wang &lt;peter.wang@mediatek.com&gt;
Link: https://patch.msgid.link/1891546521.01770806581968.JavaMail.epsvc@epcpadp2new
Signed-off-by: Martin K. Petersen &lt;martin.petersen@oracle.com&gt;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
</entry>
<entry>
<title>scsi: ufs: core: Move link recovery for hibern8 exit failure to wl_resume</title>
<updated>2026-03-12T11:09:15+00:00</updated>
<author>
<name>Peter Wang</name>
<email>peter.wang@mediatek.com</email>
</author>
<published>2026-02-23T10:37:57+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=bbc104dcfc59b649843a204957527f6e8c4c49da'/>
<id>urn:sha1:bbc104dcfc59b649843a204957527f6e8c4c49da</id>
<content type='text'>
[ Upstream commit 62c015373e1cdb1cdca824bd2dbce2dac0819467 ]

Move the link recovery trigger from ufshcd_uic_pwr_ctrl() to
__ufshcd_wl_resume(). Ensure link recovery is only attempted when hibern8
exit fails during resume, not during hibern8 enter in suspend. Improve
error handling and prevent unnecessary link recovery attempts.

Fixes: 35dabf4503b9 ("scsi: ufs: core: Use link recovery when h8 exit fails during runtime resume")
Signed-off-by: Peter Wang &lt;peter.wang@mediatek.com&gt;
Reviewed-by: Bart Van Assche &lt;bvanassche@acm.org&gt;
Link: https://patch.msgid.link/20260223103906.2533654-1-peter.wang@mediatek.com
Signed-off-by: Martin K. Petersen &lt;martin.petersen@oracle.com&gt;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
</entry>
</feed>
