<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel/linux.git/drivers/ufs/core, branch v6.19.11</title>
<subtitle>Linux kernel stable tree (mirror)</subtitle>
<id>https://git.radix-linux.su/kernel/linux.git/atom?h=v6.19.11</id>
<link rel='self' href='https://git.radix-linux.su/kernel/linux.git/atom?h=v6.19.11'/>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/'/>
<updated>2026-03-19T15:15:09+00:00</updated>
<entry>
<title>scsi: ufs: core: Fix SError in ufshcd_rtc_work() during UFS suspend</title>
<updated>2026-03-19T15:15:09+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=c387a8f1d3713f6b0415ece8485042d0f134b91a'/>
<id>urn:sha1:c387a8f1d3713f6b0415ece8485042d0f134b91a</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:14:47+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=353a1e2b5afe2b17f9dcae6e6a7847a9b689f759'/>
<id>urn:sha1:353a1e2b5afe2b17f9dcae6e6a7847a9b689f759</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:14:47+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=93b9e7ee9e93629db80bbc9dab8a874215b89ccf'/>
<id>urn:sha1:93b9e7ee9e93629db80bbc9dab8a874215b89ccf</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:14:46+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=10e37df2ad41bb388beb14f750ae33a98dc6a675'/>
<id>urn:sha1:10e37df2ad41bb388beb14f750ae33a98dc6a675</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: Fix RPMB region size detection for UFS 2.2</title>
<updated>2026-03-12T11:09:38+00:00</updated>
<author>
<name>Alexey Charkov</name>
<email>alchark@flipper.net</email>
</author>
<published>2026-02-09T15:17:34+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=7504e88cb202b3a8784aa201a400a6ccf2f61bbb'/>
<id>urn:sha1:7504e88cb202b3a8784aa201a400a6ccf2f61bbb</id>
<content type='text'>
commit 2e6b5cd6a4b37a95b78cf8c39a979b58c915c8ed upstream.

Older UFS spec devices (2.2 and earlier) do not expose per-region RPMB
sizes, as only one RPMB region is supported. In such cases, the size of the
single RPMB region can be deduced from the Logical Block Count and Logical
Block Size fields in the RPMB Unit Descriptor.

Add a fallback mechanism to calculate the RPMB region size from these
fields if the device implements an older spec, so that the RPMB driver can
work with such devices - otherwise it silently skips the whole RPMB.

        Section 14.1.4.6 (RPMB Unit Descriptor)

Link: https://www.jedec.org/system/files/docs/JESD220C-2_2.pdf
Cc: stable@vger.kernel.org
Fixes: b06b8c421485 ("scsi: ufs: core: Add OP-TEE based RPMB driver for UFS devices")
Reviewed-by: Bean Huo &lt;beanhuo@micron.com&gt;
Signed-off-by: Alexey Charkov &lt;alchark@flipper.net&gt;
Link: https://patch.msgid.link/20260209-ufs-rpmb-v3-1-b1804e71bd38@flipper.net
Signed-off-by: Martin K. Petersen &lt;martin.petersen@oracle.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.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:17+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=2d92384bd6e785440d6eca1339edd5b146775be5'/>
<id>urn:sha1:2d92384bd6e785440d6eca1339edd5b146775be5</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>
<entry>
<title>scsi: ufs: core: Flush exception handling work when RPM level is zero</title>
<updated>2026-03-04T12:21:32+00:00</updated>
<author>
<name>Thomas Yen</name>
<email>thomasyen@google.com</email>
</author>
<published>2026-01-29T16:51:51+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=ab71c146c135f9af1614ef0fc29a0a3b84f1a373'/>
<id>urn:sha1:ab71c146c135f9af1614ef0fc29a0a3b84f1a373</id>
<content type='text'>
[ Upstream commit f8ef441811ec413717f188f63d99182f30f0f08e ]

Ensure that the exception event handling work is explicitly flushed during
suspend when the runtime power management level is set to UFS_PM_LVL_0.

When the RPM level is zero, the device power mode and link state both
remain active. Previously, the UFS core driver bypassed flushing exception
event handling jobs in this configuration. This created a race condition
where the driver could attempt to access the host controller to handle an
exception after the system had already entered a deep power-down state,
resulting in a system crash.

Explicitly flush this work and disable auto BKOPs before the suspend
callback proceeds. This guarantees that pending exception tasks complete
and prevents illegal hardware access during the power-down sequence.

Fixes: 57d104c153d3 ("ufs: add UFS power management support")
Signed-off-by: Thomas Yen &lt;thomasyen@google.com&gt;
Cc: Stable Tree &lt;stable@vger.kernel.org&gt;
Reviewed-by: Peter Wang &lt;peter.wang@mediatek.com&gt;
Reviewed-by: Bart Van Assche &lt;bvanassche@acm.org&gt;
Link: https://patch.msgid.link/20260129165156.956601-1-thomasyen@google.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: Configure MCQ after link startup</title>
<updated>2026-01-04T20:17:53+00:00</updated>
<author>
<name>Bart Van Assche</name>
<email>bvanassche@acm.org</email>
</author>
<published>2025-12-18T23:07:37+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=ee229e7c256ab5d7b277abf8d48a732c10571750'/>
<id>urn:sha1:ee229e7c256ab5d7b277abf8d48a732c10571750</id>
<content type='text'>
Commit f46b9a595fa9 ("scsi: ufs: core: Allocate the SCSI host earlier")
did not only cause scsi_add_host() to be called earlier. It also swapped
the order of link startup and enabling and configuring MCQ mode. Before
that commit, the call chains for link startup and enabling MCQ were as
follows:

ufshcd_init()
  ufshcd_link_startup()
  ufshcd_add_scsi_host()
    ufshcd_mcq_enable()

Apparently this change causes link startup to fail. Fix this by configuring
MCQ after link startup has completed.

Reported-by: Nitin Rawat &lt;nitin.rawat@oss.qualcomm.com&gt;
Fixes: f46b9a595fa9 ("scsi: ufs: core: Allocate the SCSI host earlier")
Signed-off-by: Bart Van Assche &lt;bvanassche@acm.org&gt;
Reviewed-by: Peter Wang &lt;peter.wang@mediatek.com&gt;
Link: https://patch.msgid.link/20251218230741.2661049-1-bvanassche@acm.org
Signed-off-by: Martin K. Petersen &lt;martin.petersen@oracle.com&gt;
</content>
</entry>
<entry>
<title>scsi: ufs: core: Add ufshcd_update_evt_hist() for UFS suspend error</title>
<updated>2025-12-17T03:24:36+00:00</updated>
<author>
<name>Seunghwan Baek</name>
<email>sh8267.baek@samsung.com</email>
</author>
<published>2025-12-10T06:38:54+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=c9f36f04a8a2725172cdf2b5e32363e4addcb14c'/>
<id>urn:sha1:c9f36f04a8a2725172cdf2b5e32363e4addcb14c</id>
<content type='text'>
If UFS resume fails, the event history is updated in ufshcd_resume(), but
there is no code anywhere to record UFS suspend. Therefore, add code to
record UFS suspend error event history.

Fixes: dd11376b9f1b ("scsi: ufs: Split the drivers/scsi/ufs directory")
Cc: stable@vger.kernel.org
Signed-off-by: Seunghwan Baek &lt;sh8267.baek@samsung.com&gt;
Reviewed-by: Peter Wang &lt;peter.wang@mediatek.com&gt;
Link: https://patch.msgid.link/20251210063854.1483899-2-sh8267.baek@samsung.com
Signed-off-by: Martin K. Petersen &lt;martin.petersen@oracle.com&gt;
</content>
</entry>
<entry>
<title>scsi: ufs: core: Fix a deadlock in the frequency scaling code</title>
<updated>2025-12-09T02:58:28+00:00</updated>
<author>
<name>Bart Van Assche</name>
<email>bvanassche@acm.org</email>
</author>
<published>2025-12-04T18:15:43+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=d2875b812b141d0c449541976d92c8d89b94ec72'/>
<id>urn:sha1:d2875b812b141d0c449541976d92c8d89b94ec72</id>
<content type='text'>
Commit 08b12cda6c44 ("scsi: ufs: core: Switch to scsi_get_internal_cmd()")
accidentally introduced a deadlock in the frequency scaling code.
ufshcd_clock_scaling_unprepare() may submit a device management command
while SCSI command processing is blocked. The deadlock was introduced by
using the SCSI core for submitting device management commands
(scsi_get_internal_cmd() + blk_execute_rq()). Fix this deadlock by calling
blk_mq_unquiesce_tagset() before any device management commands are
submitted by ufshcd_clock_scaling_unprepare().

Fixes: 08b12cda6c44 ("scsi: ufs: core: Switch to scsi_get_internal_cmd()")
Reported-by: Manivannan Sadhasivam &lt;mani@kernel.org&gt;
Reported-by: Roger Shimizu &lt;rosh@debian.org&gt;
Closes: https://lore.kernel.org/linux-scsi/ehorjaflathzab5oekx2nae2zss5vi2r36yqkqsfjb2fgsifz2@yk3us5g3igow/
Tested-by: Roger Shimizu &lt;rosh@debian.org&gt;
Cc: Nitin Rawat &lt;nitin.rawat@oss.qualcomm.com&gt;
Signed-off-by: Bart Van Assche &lt;bvanassche@acm.org&gt;
Reviewed-by: Peter Wang &lt;peter.wang@mediatek.com&gt;
Reviewed-by: Nitin Rawat &lt;nitin.rawat@oss.qualcomm.com&gt;
Tested-by: Alexey Klimov &lt;alexey.klimov@linaro.org&gt; # RB5 board
Link: https://patch.msgid.link/20251204181548.1006696-1-bvanassche@acm.org
Signed-off-by: Martin K. Petersen &lt;martin.petersen@oracle.com&gt;
</content>
</entry>
</feed>
