Kai Mäkisara [Tue, 11 Mar 2025 11:25:14 +0000 (13:25 +0200)]
scsi: st: Fix array overflow in st_setup()
Change the array size to follow parms size instead of a fixed value.
Reported-by: Chenyuan Yang <chenyuan0y@gmail.com> Closes: https://lore.kernel.org/linux-scsi/CALGdzuoubbra4xKOJcsyThdk5Y1BrAmZs==wbqjbkAgmKS39Aw@mail.gmail.com/ Signed-off-by: Kai Mäkisara <Kai.Makisara@kolumbus.fi> Link: https://lore.kernel.org/r/20250311112516.5548-2-Kai.Makisara@kolumbus.fi Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Guixin Liu [Thu, 13 Mar 2025 01:47:27 +0000 (09:47 +0800)]
scsi: target: tcm_loop: Fix wrong abort tag
When the tcm_loop_nr_hw_queues is set to a value greater than 1, the
tags of requests in the block layer are no longer unique. This may lead
to erroneous aborting of commands with the same tag. The issue can be
resolved by using blk_mq_unique_tag to generate globally unique
identifiers by combining the hardware queue index and per-queue tags.
Ewan D. Milne [Mon, 17 Mar 2025 16:37:31 +0000 (12:37 -0400)]
scsi: lpfc: Restore clearing of NLP_UNREG_INP in ndlp->nlp_flag
Commit 32566a6f1ae5 ("scsi: lpfc: Remove NLP_RELEASE_RPI flag from nodelist
structure") introduced a regression with SLI-3 adapters (e.g. LPe12000 8Gb)
where a Link Down / Link Up such as caused by disabling an host FC switch
port would result in the devices remaining in the transport-offline state
and multipath reporting them as failed. This problem was not seen with
newer SLI-4 adapters.
The problem was caused by portions of the patch which removed the functions
__lpfc_sli_rpi_release() and lpfc_sli_rpi_release() and all their callers.
This was presumably because with the removal of the NLP_RELEASE_RPI flag
there was no need to free the rpi.
However, __lpfc_sli_rpi_release() and lpfc_sli_rpi_release() which calls it
reset the NLP_UNREG_INP flag. And, lpfc_sli_def_mbox_cmpl() has a path
where __lpfc_sli_rpi_release() was called in a particular case where
NLP_UNREG_INP was not otherwise cleared because of other conditions.
Restoring the else clause of this conditional and simply clearing the
NLP_UNREG_INP flag appears to resolve the problem with SLI-3 adapters. It
should be noted that the code path in question is not specific to SLI-3,
but there are other SLI-4 code paths which may have masked the issue.
Fixes: 32566a6f1ae5 ("scsi: lpfc: Remove NLP_RELEASE_RPI flag from nodelist structure") Cc: stable@vger.kernel.org Tested-by: Marco Patalano <mpatalan@redhat.com> Signed-off-by: Ewan D. Milne <emilne@redhat.com> Link: https://lore.kernel.org/r/20250317163731.356873-1-emilne@redhat.com Reviewed-by: Justin Tee <justin.tee@broadcom.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Xingui Yang [Thu, 20 Feb 2025 09:00:11 +0000 (17:00 +0800)]
scsi: hisi_sas: Fixed failure to issue vendor specific commands
At present, we determine the protocol through the cmd type, but other cmd
types, such as vendor-specific commands, default to the PIO protocol. This
strategy often causes the execution of different vendor-specific commands
to fail. In fact, for these commands, a better way is to use the protocol
configured by the command's tf to determine its protocol.
Fixes: 6f2ff1a1311e ("hisi_sas: add v2 path to send ATA command") Signed-off-by: Xingui Yang <yangxingui@huawei.com> Link: https://lore.kernel.org/r/20250220090011.313848-1-liyihang9@huawei.com Reviewed-by: Yihang Li <liyihang9@huawei.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Chaohai Chen [Wed, 26 Feb 2025 06:58:02 +0000 (14:58 +0800)]
scsi: core: Use a switch statement when attaching VPD pages
The original code used if statements to update discovered VPD pages when
found. This had the side-effect of not breaking the loop when a page was
found.
Initialization of the UFS controller on R-Car S4-8 ES1.0 requires only
static values. However, other UFS controller variants (R-Car S4-8 ES 1.2)
require dynamic values, like those obtained from E-FUSE, and downloading
firmware.
Hence this patch series refactors the initialization code to prepare for
this, and adds support for the UFS controller on R-Car S4-8 ES1.2.
The accompanying DTS change is available at [1].
This has been tested on:
- Renesas Spider with R-Car S4-8 ES1.0 (broken before/after),
- Renesas S4 Starter Kit with R-Car S4-8 ES1.2 (works after).
Thanks for your comments!
[1] "[PATCH] arm64: dts: renesas: r8a779f4: Add UFS tuning parameters in
E-FUSE"
https://lore.kernel.org/3e4fca228eb049d54a1ae520104558505dbdf803.1741179629.git.geert+renesas@glider.be
[2] "[PATCH v2 0/5] scsi: ufs: renesas: Refactor code for other UFS
controller"
https://lore.kernel.org/20240709023550.1750333-1-yoshihiro.shimoda.uh@renesas.com
[3] "[PATCH 0/5] scsi: ufs: renesas: Refactor code for other UFS
controller"
https://lore.kernel.org/20240708120931.1703956-1-yoshihiro.shimoda.uh@renesas.com
Yoshihiro Shimoda [Wed, 5 Mar 2025 13:34:15 +0000 (14:34 +0100)]
scsi: ufs: renesas: Add initialization code for R-Car S4-8 ES1.2
Add initialization code for R-Car S4-8 ES1.2 to improve transfer stability.
Using the new code requires downloading firmware and reading calibration
data from E-FUSE. If either fails, the driver falls back to the old
initialization code.
Yoshihiro Shimoda [Wed, 5 Mar 2025 13:34:12 +0000 (14:34 +0100)]
scsi: ufs: renesas: Remove register control helper function
After refactoring the code, ufs_renesas_reg_control() is no longer needed,
because all operations are simple and can be called directly. Remove the
ufs_renesas_reg_control() helper function, and call udelay() directly.
Yoshihiro Shimoda [Wed, 5 Mar 2025 13:34:11 +0000 (14:34 +0100)]
scsi: ufs: renesas: Add register read to remove save/set/restore
Add support for returning read register values from
ufs_renesas_reg_control(), so ufs_renesas_set_phy() can use the existing
ufs_renesas_write_phy() helper. Remove the now unused code to save to,
set, and restore from a static array inside ufs_renesas_reg_control().
Yoshihiro Shimoda [Wed, 5 Mar 2025 13:34:10 +0000 (14:34 +0100)]
scsi: ufs: renesas: Replace init data by init code
Since initialization of the UFS controller on R-Car S4-8 ES1.0 requires
only static values, the driver uses initialization data stored in the const
ufs_param[] array. However, other UFS controller variants (R-Car S4-8
ES1.2) require dynamic values, like those obtained from E-FUSE. Refactor
the initialization code to prepare for this.
Geert Uytterhoeven [Wed, 5 Mar 2025 13:34:09 +0000 (14:34 +0100)]
scsi: ufs: dt-bindings: renesas,ufs: Add calibration data
On R-Car S4-8 ES1.2, the E-FUSE block contains PLL and AFE tuning
parameters for the Universal Flash Storage controller. Document the
related NVMEM properties, and update the example.
Chandrakanth Patil [Tue, 4 Mar 2025 19:14:53 +0000 (00:44 +0530)]
scsi: mpi3mr: Task Abort EH Support
Add Task Abort support to handle SCSI command timeouts, ensuring recovery
and cleanup of timed-out commands. This completes the error handling
framework for mpi3mr driver, which already includes device reset, target
reset, bus reset, and host reset.
Roman Kisel [Tue, 4 Mar 2025 00:09:40 +0000 (16:09 -0800)]
scsi: storvsc: Don't report the host packet status as the hv status
The log statement reports the packet status code as the hv status code
which causes confusion when debugging as "hv" might refer to a hypervisor,
and sometimes to the host part of the Hyper-V virtualization stack.
Fix the name of the datum being logged to clearly indicate the component
reporting the error. Also log it in hexadecimal everywhere for consistency.
Signed-off-by: Roman Kisel <romank@linux.microsoft.com> Link: https://lore.kernel.org/r/20250304000940.9557-2-romank@linux.microsoft.com Reviewed-by: Easwar Hariharan <eahariha@linux.microsoft.com> Reviewed-by: Michael Kelley <mhklinux@outlook.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Remove unnecessary debug print from fdls_schedule_oxid_free_retry_work. As
suggested by Dan, this information is already present in stack traces, and
the kernel is not expected to fail small allocations.
Suggested-by: Dan Carpenter <dan.carpenter@linaro.org> Fixes: a63e78eb2b0f ("scsi: fnic: Add support for fabric based solicited requests and responses") Reviewed-by: Sesidhar Baddela <sebaddel@cisco.com> Reviewed-by: Arulprabhu Ponnusamy <arulponn@cisco.com> Reviewed-by: Gian Carlo Boffa <gcboffa@cisco.com> Reviewed-by: Arun Easi <aeasi@cisco.com> Signed-off-by: Karan Tilak Kumar <kartilak@cisco.com> Link: https://lore.kernel.org/r/20250225214909.4853-1-kartilak@cisco.com Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Thorsten Blum [Sun, 2 Mar 2025 22:56:41 +0000 (23:56 +0100)]
scsi: target: Replace deprecated strncpy() with strscpy()
strncpy() is deprecated for NUL-terminated destination buffers; use
strscpy() instead. The destination buffer db_root is only used with "%s"
format strings and must therefore be NUL-terminated, but not NUL-padded.
Use scnprintf() because snprintf() could return a value >= DB_ROOT_LEN
and lead to an out-of-bounds access. This doesn't happen because count
is explicitly checked against DB_ROOT_LEN before. However, scnprintf()
always returns the number of characters actually written to the string
buffer, which is always within the bounds of db_root_stage, and should
be preferred over snprintf().
The size parameter of strscpy() is optional and since DB_ROOT_LEN is the
size of the destination buffer, it can be removed. Remove it to simplify
the code.
Damien Le Moal [Fri, 28 Feb 2025 03:17:51 +0000 (12:17 +0900)]
scsi: scsi_error: Add comments to scsi_check_sense()
Add a comment block describing the COMPLETED case with ASC/ASCQ 0x55/0xA
to mention that it relates to command duration limits very special
policy 0xD command completion.
Dan Carpenter [Fri, 28 Feb 2025 09:37:28 +0000 (12:37 +0300)]
scsi: mpt3sas: Fix buffer overflow in mpt3sas_send_mctp_passthru_req()
The "sz" argument in mpt3sas_check_cmd_timeout() is the number of u32, not
the number of bytes. We dump that many u32 values to dmesg. Passing the
number of bytes will lead to a read overflow. Divide by 4 to get the
correct value.
Easwar Hariharan [Tue, 25 Feb 2025 20:17:16 +0000 (20:17 +0000)]
scsi: lpfc: Convert timeouts to secs_to_jiffies()
Commit b35108a51cf7 ("jiffies: Define secs_to_jiffies()") introduced
secs_to_jiffies(). As the value here is a multiple of 1000, use
secs_to_jiffies() instead of msecs_to_jiffies() to avoid the multiplication
This is converted using scripts/coccinelle/misc/secs_to_jiffies.cocci with
the following Coccinelle rules:
Arnd Bergmann [Tue, 25 Feb 2025 09:56:47 +0000 (10:56 +0100)]
scsi: scsi_debug: Fix uninitialized variable use
It appears that a typo has made it into the newly added code
drivers/scsi/scsi_debug.c:3035:3: error: variable 'len' is uninitialized when used here [-Werror,-Wuninitialized]
3035 | len += resp_compression_m_pg(ap, pcontrol, target, devip->tape_dce);
| ^~~
Replace the '+=' with the intended '=' here.
Fixes: 568354b24c7d ("scsi: scsi_debug: Add compression mode page for tapes") Acked-by: Kai Mäkisara <kai.makisara@kolumbus.fi> Signed-off-by: Arnd Bergmann <arnd@arndb.de> Link: https://lore.kernel.org/r/20250225095651.2636811-1-arnd@kernel.org Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Bart Van Assche [Mon, 24 Feb 2025 11:55:17 +0000 (11:55 +0000)]
scsi: scsi_debug: Do not sleep in atomic sections
Function stop_qc_helper() is called while the debug_scsi_cmd lock is held,
and from here we may call cancel_work_sync(), which may sleep.
Sleeping in atomic sections is not allowed.
Hence change the cancel_work_sync() call into a cancel_work() call.
However now it is not possible to know if the work callback is running when
we return. This is relevant for eh_abort_handler handling, as the semantics
of that callback are that success means that we do not keep a reference to
the scsi_cmnd - now this is not possible. So return FAIL when we are unsure
if the callback still running.
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
jpg: return FAILED from scsi_debug_abort() when possible callback running Signed-off-by: John Garry <john.g.garry@oracle.com> Link: https://lore.kernel.org/r/20250224115517.495899-5-john.g.garry@oracle.com Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Bart Van Assche [Mon, 24 Feb 2025 11:55:16 +0000 (11:55 +0000)]
scsi: scsi_debug: Simplify command handling
Simplify command handling by moving struct sdebug_defer into the private
SCSI command data instead of allocating it separately. The only functional
change is that aborting a SCSI command now fails and is retried at a later
time if the completion handler can't be cancelled.
See also commit 1107c7b24ee3 ("scsi: scsi_debug: Dynamically allocate
sdebug_queued_cmd").
Bart Van Assche [Mon, 24 Feb 2025 11:55:15 +0000 (11:55 +0000)]
scsi: scsi_debug: Remove a reference to in_use_bm
Commit f1437cd1e535 ("scsi: scsi_debug: Drop sdebug_queue") removed the
'in_use_bm' struct member. Hence remove a reference to that struct member
from the procfs host info file.
Fixes: f1437cd1e535 ("scsi: scsi_debug: Drop sdebug_queue") Signed-off-by: Bart Van Assche <bvanassche@acm.org> Signed-off-by: John Garry <john.g.garry@oracle.com> Link: https://lore.kernel.org/r/20250224115517.495899-3-john.g.garry@oracle.com Reviewed-by: John Garry <john.g.garry@oracle.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
It was originally intended for supporting checking for atomic writes
overlapping with ongoing reads and writes, but that support never got
added.
SBC-4 r22 section 4.29.3.2 "Performing operations during an atomic write
operation" describes two methods of handling overlapping atomic writes.
Currently the only method supported is for the ongoing read or write to
complete.
Ranjan Kumar [Thu, 20 Feb 2025 14:25:27 +0000 (19:55 +0530)]
scsi: mpi3mr: Check admin reply queue from Watchdog
Admin reply processing can be called from multiple contexts. The driver
uses an atomic flag for synchronization among multiple threads/context for
draining the admin replies.
Upon entering the admin processing routine, the driver will set the atomic
flag and start reply processing. When exiting the routine, the driver
resets the flag. However, there is a race condition when one thread (Thread
1) has processed replies and is about to reset the flag but in the meantime
few more replies are posted and another thread (Thread 2) is called to
process replies. Since the synchronization flag is still set, Thread 2 will
return without processing replies and those new replies will not be
flushed.
Make the watchdog thread monitor cases where admin ISR/poll call returns
due to another thread processing admin replies. If such an instance is
found, make driver call admin ISR to drain replies (if any).
Co-developed-by: Sumit Saxena <sumit.saxena@broadcom.com> Signed-off-by: Sumit Saxena <sumit.saxena@broadcom.com> Signed-off-by: Ranjan Kumar <ranjan.kumar@broadcom.com> Link: https://lore.kernel.org/r/20250220142528.20837-4-ranjan.kumar@broadcom.com Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Martin K. Petersen [Tue, 25 Feb 2025 00:24:54 +0000 (19:24 -0500)]
Merge patch series "scsi: scsi_debug: Add more tape support"
Kai Mäkisara <Kai.Makisara@kolumbus.fi> says:
Currently, the scsi_debug driver can create tape devices and the st
driver attaches to those. Nothing much can be done with the tape devices
because scsi_debug does not have support for the tape-specific commands
and features. These patches add some more tape support to the scsi_debug
driver. The end result is simulated drives with a tape having one or two
partitions (one partition is created initially).
The tape is implemented as fixed number (10 000) of 8-byte units.
The first four bytes of a unit contain the type of the unit (data
block, filemark or end-of-data mark). If the units is a data block,
the first four bytes also contain the block length and the remaining
four bytes the first bytes of written data. This allows the user
to use tags to see that the read block is what it was supposed to be.
The following SCSI operations are added or modified:
FORMAT MEDIUM
- added
LOCATE
- added
MODE SELECT
- modified to allow use without page(s) (just header and block descriptor)
- store density and block size
- partition page added
MODE SENSE
- modified to allow use without page(s) (just header and block descriptor)
- set density and block size
- partition page added
READ BLOCK LIMITS
- added
READ POSITION
- added
READ
- added tape support for READ (6)
REWIND
- modified to set the tape position
SPACE
- added
START STOP (LOAD)
- modified to return New Medium Unit Attention if tape loaded (not
according to the standard, but enables testing this UA)
WRITE
- added tape support for WRITE (6)
WRITE FILEMARKS
- added
Martin K. Petersen [Tue, 25 Feb 2025 00:24:14 +0000 (19:24 -0500)]
Merge patch series "Initial support for RK3576 UFS controller"
Shawn Lin <shawn.lin@rock-chips.com> says:
This patchset adds initial UFS controller supprt for RK3576 SoC.
Patch 1 is the dt-bindings. Patch 2-4 deal with rpm and spm support
in advanced suggested by Ulf. Patch 5 exports two new APIs for host
driver. Patch 6 and 7 are the host driver and dtsi support.
Ulf Hansson [Mon, 24 Feb 2025 12:05:29 +0000 (13:05 +0100)]
pmdomain: rockchip: Fix build error
To resolve the build error with undefined reference to
`arm_smccc_1_1_get_conduit', let's add a build dependency to
HAVE_ARM_SMCCC_DISCOVERY.
Reported-by: Stephen Rothwell <sfr@canb.auug.org.au> Fixes: 61eeb9678789 ("pmdomain: rockchip: Check if SMC could be handled by TA") Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Kai Mäkisara [Thu, 13 Feb 2025 09:26:36 +0000 (11:26 +0200)]
scsi: scsi_debug: Add support for partitioning the tape
This patch adds support for MEDIUM PARTITION PAGE in MODE SELECT and the
FORMAT MEDIUM command for tapes. After these additions, the virtual tape
can be partitioned containing either one or two partitions. The POFM flag
in the mode page is set, meaning that the FORMAT MEDIUM command must be
used to create the partitioning defined in the mode page.
Signed-off-by: Kai Mäkisara <Kai.Makisara@kolumbus.fi> Link: https://lore.kernel.org/r/20250213092636.2510-8-Kai.Makisara@kolumbus.fi Reviewed-by: John Meneghini <jmeneghi@redhat.com> Tested-by: John Meneghini <jmeneghi@redhat.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Kai Mäkisara [Thu, 13 Feb 2025 09:26:35 +0000 (11:26 +0200)]
scsi: scsi_debug: Reset tape setting at device reset
Set tape block size, density and compression to default values when the
device is reset (either directly or via target, bus or host reset).
Signed-off-by: Kai Mäkisara <Kai.Makisara@kolumbus.fi> Link: https://lore.kernel.org/r/20250213092636.2510-7-Kai.Makisara@kolumbus.fi Reviewed-by: John Meneghini <jmeneghi@redhat.com> Tested-by: John Meneghini <jmeneghi@redhat.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Kai Mäkisara [Thu, 13 Feb 2025 09:26:34 +0000 (11:26 +0200)]
scsi: scsi_debug: Add compression mode page for tapes
Add support for compression mode page. The compression status
is saved and returned. No UA is generated.
Signed-off-by: Kai Mäkisara <Kai.Makisara@kolumbus.fi> Link: https://lore.kernel.org/r/20250213092636.2510-6-Kai.Makisara@kolumbus.fi Reviewed-by: John Meneghini <jmeneghi@redhat.com> Tested-by: John Meneghini <jmeneghi@redhat.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Kai Mäkisara [Thu, 13 Feb 2025 09:26:33 +0000 (11:26 +0200)]
scsi: scsi_debug: Add read support and update locate for tapes
Support for the READ (6) and SPACE (6) commands for tapes based on the
previous write patch is added. The LOCATE (10) command is updated to use
the written data.
Signed-off-by: Kai Mäkisara <Kai.Makisara@kolumbus.fi> Link: https://lore.kernel.org/r/20250213092636.2510-5-Kai.Makisara@kolumbus.fi Reviewed-by: John Meneghini <jmeneghi@redhat.com> Tested-by: John Meneghini <jmeneghi@redhat.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Kai Mäkisara [Thu, 13 Feb 2025 09:26:32 +0000 (11:26 +0200)]
scsi: scsi_debug: Add write support with block lengths and 4 bytes of data
The tape is implemented as fixed number (10 000) of 8-byte units. The
first four bytes of a unit contains the type of the unit (data block,
filemark or end-of-data mark). If the units is a data block, the first four
bytes contain the block length and the remaining four bytes the first bytes
of written data. This allows the user to use tags to see that the read
block is what it was supposed to be.
The tape can contain two partitions. Initially it is formatted as one
partition consisting of all 10 000 units.
This patch adds the WRITE(6) command for tapes and the WRITE FILEMARKS (6)
command. The REWIND command is updated.
Signed-off-by: Kai Mäkisara <Kai.Makisara@kolumbus.fi> Link: https://lore.kernel.org/r/20250213092636.2510-4-Kai.Makisara@kolumbus.fi Reviewed-by: John Meneghini <jmeneghi@redhat.com> Tested-by: John Meneghini <jmeneghi@redhat.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
- Make LOAD send New Media UA (not correct by the standard, but makes
possible to test also this UA)
Signed-off-by: Kai Mäkisara <Kai.Makisara@kolumbus.fi> Link: https://lore.kernel.org/r/20250213092636.2510-3-Kai.Makisara@kolumbus.fi Reviewed-by: John Meneghini <jmeneghi@redhat.com> Tested-by: John Meneghini <jmeneghi@redhat.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Kai Mäkisara [Thu, 13 Feb 2025 09:26:30 +0000 (11:26 +0200)]
scsi: scsi_debug: First fixes for tapes
Patch includes the following:
- Enable MODE SENSE/SELECT without actual page (to read/write only the
Block Descriptor)
- Store the density code and block size in the Block Descriptor (only
short version for tapes)
- Fix REWIND not to use the wrong page filling function
Signed-off-by: Kai Mäkisara <Kai.Makisara@kolumbus.fi> Link: https://lore.kernel.org/r/20250213092636.2510-2-Kai.Makisara@kolumbus.fi Reviewed-by: John Meneghini <jmeneghi@redhat.com> Tested-by: John Meneghini <jmeneghi@redhat.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Martin K. Petersen [Fri, 21 Feb 2025 03:11:11 +0000 (22:11 -0500)]
Merge patch series "Support Multi-frequency scale for UFS"
Ziqi Chen <quic_ziqichen@quicinc.com> says:
With OPP V2 enabled, devfreq can scale clocks amongst multiple frequency
plans. However, the gear speed is only toggled between min and max during
clock scaling. Enable multi-level gear scaling by mapping clock frequencies
to gear speeds, so that when devfreq scales clock frequencies we can put
the UFS link at the appropraite gear speeds accordingly.
This series has been tested on below platforms -
sm8550 mtp + UFS3.1
SM8650 MTP + UFS3.1
SM8750 MTP + UFS4.0
Tested-by: Neil Armstrong <neil.armstrong@linaro.org> # on SM8550-QRD Tested-by: Neil Armstrong <neil.armstrong@linaro.org> # on SM8550-HDK Tested-by: Neil Armstrong <neil.armstrong@linaro.org> # on SM8650-HDK Link: https://lore.kernel.org/r/20250213080008.2984807-1-quic_ziqichen@quicinc.com Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Can Guo [Thu, 13 Feb 2025 08:00:07 +0000 (16:00 +0800)]
scsi: ufs: core: Toggle Write Booster during clock scaling base on gear speed
During clock scaling, Write Booster is toggled on or off based on whether
the clock is scaled up or down. However, with OPP V2 powered multi-level
gear scaling, the gear can be scaled amongst multiple gear speeds, e.g., it
may scale down from G5 to G4, or from G4 to G2. To provide flexibilities,
add a new field for clock scaling such that during clock scaling Write
Booster can be enabled or disabled based on gear speeds but not based on
scaling up or down.
Signed-off-by: Can Guo <quic_cang@quicinc.com> Co-developed-by: Ziqi Chen <quic_ziqichen@quicinc.com> Signed-off-by: Ziqi Chen <quic_ziqichen@quicinc.com> Link: https://lore.kernel.org/r/20250213080008.2984807-8-quic_ziqichen@quicinc.com Reviewed-by: Bean Huo <beanhuo@micron.com> Tested-by: Neil Armstrong <neil.armstrong@linaro.org> Reviewed-by: Peter Wang <peter.wang@mediatek.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Ziqi Chen [Thu, 13 Feb 2025 08:00:06 +0000 (16:00 +0800)]
scsi: ufs: core: Check if scaling up is required when disable clkscale
When disabling clkscale via the clkscale_enable sysfs entry, UFS driver
shall perform scaling up once regardless. Check if scaling up is required
or not first to avoid repetitive work.
Signed-off-by: Ziqi Chen <quic_ziqichen@quicinc.com> Co-developed-by: Can Guo <quic_cang@quicinc.com> Signed-off-by: Can Guo <quic_cang@quicinc.com> Link: https://lore.kernel.org/r/20250213080008.2984807-7-quic_ziqichen@quicinc.com Reviewed-by: Bart Van Assche <bvanassche@acm.org> Tested-by: Neil Armstrong <neil.armstrong@linaro.org> Reviewed-by: Bean Huo <beanhuo@micron.com> Reviewed-by: Peter Wang <peter.wang@mediatek.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Can Guo [Thu, 13 Feb 2025 08:00:05 +0000 (16:00 +0800)]
scsi: ufs: core: Enable multi-level gear scaling
With OPP V2 enabled, devfreq can scale clocks amongst multiple frequency
plans. However, the gear speed is only toggled between min and max during
clock scaling. Enable multi-level gear scaling by mapping clock frequencies
to gear speeds, so that when devfreq scales clock frequencies we can put
the UFS link at the appropriate gear speeds accordingly.
Signed-off-by: Can Guo <quic_cang@quicinc.com> Co-developed-by: Ziqi Chen <quic_ziqichen@quicinc.com> Signed-off-by: Ziqi Chen <quic_ziqichen@quicinc.com> Link: https://lore.kernel.org/r/20250213080008.2984807-6-quic_ziqichen@quicinc.com Reviewed-by: Bean Huo <beanhuo@micron.com> Reviewed-by: Bart Van Assche <bvanassche@acm.org> Tested-by: Neil Armstrong <neil.armstrong@linaro.org> Reviewed-by: Peter Wang <peter.wang@mediatek.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Can Guo [Thu, 13 Feb 2025 08:00:04 +0000 (16:00 +0800)]
scsi: ufs: qcom: Implement the freq_to_gear_speed() vop
Implement the freq_to_gear_speed() vop to map the unipro core clock
frequency to the corresponding maximum supported gear speed.
Signed-off-by: Can Guo <quic_cang@quicinc.com> Co-developed-by: Ziqi Chen <quic_ziqichen@quicinc.com> Signed-off-by: Ziqi Chen <quic_ziqichen@quicinc.com> Link: https://lore.kernel.org/r/20250213080008.2984807-5-quic_ziqichen@quicinc.com Reviewed-by: Bean Huo <beanhuo@micron.com> Tested-by: Neil Armstrong <neil.armstrong@linaro.org> Reviewed-by: Peter Wang <peter.wang@mediatek.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Can Guo [Thu, 13 Feb 2025 08:00:03 +0000 (16:00 +0800)]
scsi: ufs: core: Add a vop to map clock frequency to gear speed
Add a vop to map UFS host controller clock frequencies to the corresponding
maximum supported UFS high speed gear speeds. During clock scaling, we can
map the target clock frequency, demanded by devfreq, to the maximum
supported gear speed, so that devfreq can scale the gear to the highest
gear speed supported at the target clock frequency, instead of just scaling
up/down the gear between the min and max gear speeds.
Co-developed-by: Ziqi Chen <quic_ziqichen@quicinc.com> Signed-off-by: Ziqi Chen <quic_ziqichen@quicinc.com> Signed-off-by: Can Guo <quic_cang@quicinc.com> Link: https://lore.kernel.org/r/20250213080008.2984807-4-quic_ziqichen@quicinc.com Reviewed-by: Bean Huo <beanhuo@micron.com> Reviewed-by: Bart Van Assche <bvanassche@acm.org> Tested-by: Neil Armstrong <neil.armstrong@linaro.org> Reviewed-by: Peter Wang <peter.wang@mediatek.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Can Guo [Thu, 13 Feb 2025 08:00:02 +0000 (16:00 +0800)]
scsi: ufs: qcom: Pass target_freq to clk scale pre and post change
Instead of only two frequencies, if OPP V2 is used, the UFS devfreq clock
scaling may scale the clock among multiple frequencies. In the case of
scaling up, the devfreq may decide to scale the clock to an intermediate
freq based on load, but the clock scale up pre change operation uses
settings for the max clock freq unconditionally. Fix it by passing the
target_freq to clock scale up pre change so that the correct settings for
the target_freq can be used.
In the case of scaling down, the clock scale down post change operation is
doing fine, because it reads the actual clock rate to tell freq, but to
keep symmetry with clock scale up pre change operation, just use the
target_freq instead of reading clock rate.
Signed-off-by: Can Guo <quic_cang@quicinc.com> Co-developed-by: Ziqi Chen <quic_ziqichen@quicinc.com> Signed-off-by: Ziqi Chen <quic_ziqichen@quicinc.com> Link: https://lore.kernel.org/r/20250213080008.2984807-3-quic_ziqichen@quicinc.com Reviewed-by: Bean Huo <beanhuo@micron.com> Tested-by: Neil Armstrong <neil.armstrong@linaro.org> Reviewed-by: Peter Wang <peter.wang@mediatek.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Can Guo [Thu, 13 Feb 2025 08:00:01 +0000 (16:00 +0800)]
scsi: ufs: core: Pass target_freq to clk_scale_notify() vop
Instead of only two frequencies, if OPP V2 is used, the UFS devfreq clock
scaling may scale the clock among multiple frequencies, so just passing
up/down to vop clk_scale_notify() is not enough to cover the intermediate
clock freqs between the min and max freqs. Hence pass the target_freq,
which will be used in successive commits, to clk_scale_notify() to allow
the vop to perform corresponding configurations with regard to the clock
freqs.
Signed-off-by: Can Guo <quic_cang@quicinc.com> Co-developed-by: Ziqi Chen <quic_ziqichen@quicinc.com> Signed-off-by: Ziqi Chen <quic_ziqichen@quicinc.com> Link: https://lore.kernel.org/r/20250213080008.2984807-2-quic_ziqichen@quicinc.com Reviewed-by: Bean Huo <beanhuo@micron.com> Reviewed-by: Bart Van Assche <bvanassche@acm.org> Tested-by: Neil Armstrong <neil.armstrong@linaro.org> Reviewed-by: Peter Wang <peter.wang@mediatek.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Martin K. Petersen [Fri, 21 Feb 2025 02:47:48 +0000 (21:47 -0500)]
Merge patch series "mpt3sas driver udpates"
Shivasharan S <shivasharan.srikanteshwara@broadcom.com> says:
This patch series adds support for the MCTP passthrough function over
the MPI interface for management commands. Also fix issue related to
task management handling during IOCTL timeout.
Shivasharan S [Thu, 13 Feb 2025 01:26:55 +0000 (17:26 -0800)]
scsi: mpt3sas: Send a diag reset if target reset fails
When an IOCTL times out and driver issues a target reset, if firmware
fails the task management elevate the recovery by issuing a diag reset to
controller.
Shivasharan S [Thu, 13 Feb 2025 01:26:53 +0000 (17:26 -0800)]
scsi: mpt3sas: Add support for MCTP Passthrough commands
The MPI specification defines support for sending MCTP management commands
as a passthrough function to the IOC. Add support for driver to discover
the IOC capability to support MCTP passthrough function. Driver will
support applications and kernel modules to send MPT commands containing the
MCTP passthrough request to firmware through an MPI request.
Bao D. Nguyen [Wed, 19 Feb 2025 17:16:06 +0000 (09:16 -0800)]
scsi: ufs: qcom: Remove dead code in ufs_qcom_cfg_timers()
Since 'commit 104cd58d9af8 ("scsi: ufs: qcom: Remove support for host
controllers older than v2.0")', some of the parameters passed into the
ufs_qcom_cfg_timers() function have become dead code. Clean up
ufs_qcom_cfg_timers() function to improve the readability.
Shawn Lin [Wed, 19 Feb 2025 00:58:09 +0000 (08:58 +0800)]
pmdomain: rockchip: Check if SMC could be handled by TA
Non-existent trusted-firmware could lead to SMC calls into some unset
location, that breaks the system. Let's check that it's supported before
executing the SMC.
Reported-by: Steven Price <steven.price@arm.com> Suggested-by: Heiko Stuebner <heiko@sntech.de> Fixes: 58ebba35ddab ("pmdomain: rockchip: Add smc call to inform firmware") Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com> Reviewed-by: Heiko Stuebner <heiko@sntech.de> Tested-by: Steven Price <steven.price@arm.com> Link: https://lore.kernel.org/r/1739926689-151827-1-git-send-email-shawn.lin@rock-chips.com Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Bart Van Assche [Mon, 10 Feb 2025 20:39:36 +0000 (12:39 -0800)]
scsi: mpt3sas: Fix a locking bug in an error path
Call mutex_unlock(&ioc->hostdiag_unlock_mutex) once from error paths
instead of twice.
This patch fixes the following Clang -Wthread-safety errors:
drivers/scsi/mpt3sas/mpt3sas_base.c:8085:2: error: mutex 'ioc->hostdiag_unlock_mutex' is not held on every path through here [-Werror,-Wthread-safety-analysis]
8085 | pci_cfg_access_unlock(ioc->pdev);
| ^
drivers/scsi/mpt3sas/mpt3sas_base.c:8019:2: note: mutex acquired here
8019 | mutex_lock(&ioc->hostdiag_unlock_mutex);
| ^
./include/linux/mutex.h:171:26: note: expanded from macro 'mutex_lock'
171 | #define mutex_lock(lock) mutex_lock_nested(lock, 0)
| ^
drivers/scsi/mpt3sas/mpt3sas_base.c:8085:2: error: mutex 'ioc->hostdiag_unlock_mutex' is not held on every path through here [-Werror,-Wthread-safety-analysis]
8085 | pci_cfg_access_unlock(ioc->pdev);
| ^
drivers/scsi/mpt3sas/mpt3sas_base.c:8019:2: note: mutex acquired here
8019 | mutex_lock(&ioc->hostdiag_unlock_mutex);
| ^
./include/linux/mutex.h:171:26: note: expanded from macro 'mutex_lock'
171 | #define mutex_lock(lock) mutex_lock_nested(lock, 0)
| ^
drivers/scsi/mpt3sas/mpt3sas_base.c:8087:2: error: releasing mutex 'ioc->hostdiag_unlock_mutex' that was not held [-Werror,-Wthread-safety-analysis]
8087 | mutex_unlock(&ioc->hostdiag_unlock_mutex);
| ^
Cc: Ranjan Kumar <ranjan.kumar@broadcom.com> Fixes: c0767560b012 ("scsi: mpt3sas: Reload SBR without rebooting HBA") Signed-off-by: Bart Van Assche <bvanassche@acm.org> Link: https://lore.kernel.org/r/20250210203936.2946494-3-bvanassche@acm.org Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Bart Van Assche [Mon, 10 Feb 2025 20:39:35 +0000 (12:39 -0800)]
scsi: mpi3mr: Fix locking in an error path
Make all error paths unlock rioc->bsg_cmds.mutex.
This patch fixes the following Clang -Wthread-safety errors:
drivers/scsi/mpi3mr/mpi3mr_app.c:2835:1: error: mutex 'mrioc->bsg_cmds.mutex' is not held on every path through here [-Werror,-Wthread-safety-analysis]
2835 | }
| ^
drivers/scsi/mpi3mr/mpi3mr_app.c:2332:6: note: mutex acquired here
2332 | if (mutex_lock_interruptible(&mrioc->bsg_cmds.mutex))
| ^
./include/linux/mutex.h:172:40: note: expanded from macro 'mutex_lock_interruptible'
172 | #define mutex_lock_interruptible(lock) mutex_lock_interruptible_nested(lock, 0)
| ^
Cc: Sathya Prakash <sathya.prakash@broadcom.com> Fixes: fb231d7deffb ("scsi: mpi3mr: Support for preallocation of SGL BSG data buffers part-2") Signed-off-by: Bart Van Assche <bvanassche@acm.org> Link: https://lore.kernel.org/r/20250210203936.2946494-2-bvanassche@acm.org Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Thorsten Blum [Thu, 13 Feb 2025 11:40:48 +0000 (12:40 +0100)]
scsi: hpsa: Replace deprecated strncpy() with strscpy_pad()
strncpy() is deprecated for NUL-terminated destination buffers. Replace
memset() and strncpy() with strscpy_pad() to copy the version string and
fill the remaining bytes in the destination buffer with NUL bytes. This
avoids zeroing the memory before copying the string.
Thorsten Blum [Fri, 14 Feb 2025 11:43:02 +0000 (12:43 +0100)]
scsi: hpsa: Remove deprecated and unnecessary strncpy()
While replacing strncpy() with strscpy(), Bart Van Assche pointed out
that the code occurs inside sysfs write callbacks, which already uses
NUL-terminated strings. This allows the string to be passed directly to
sscanf() without requiring a temporary copy.
Remove the deprecated and unnecessary strncpy() and the corresponding
local variables, and pass the buffer buf directly to sscanf().
Replace sscanf() with kstrtoint() to silence checkpatch warnings.
Compile-tested only.
Link: https://github.com/KSPP/linux/issues/90 Cc: linux-hardening@vger.kernel.org Cc: Kees Cook <kees@kernel.org> Cc: David Laight <david.laight.linux@gmail.com> Suggested-by: Bart Van Assche <bvanassche@acm.org> Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev> Link: https://lore.kernel.org/r/20250214114302.86001-2-thorsten.blum@linux.dev Reviewed-by: Bart Van Assche <bvanassche@acm.org> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Peter Wang [Fri, 14 Feb 2025 08:29:36 +0000 (16:29 +0800)]
scsi: ufs: core: Add hba parameter to trace events
Include the ufs_hba structure as a parameter in various trace events to
provide more context and improve debugging capabilities. Also remove
dev_name which can replace by dev_name(hba->dev).
For some usecases a consumer driver requires its device to remain power-on
from the PM domain perspective during runtime. Using dev PM qos along with
the genpd governors, doesn't work for this case as would potentially
prevent the device from being runtime suspended too.
To support these usecases, let's introduce dev_pm_genpd_rpm_always_on() to
allow consumers drivers to dynamically control the behaviour in genpd for a
device that is attached to it.
Shawn Lin [Wed, 5 Feb 2025 06:15:51 +0000 (14:15 +0800)]
soc: rockchip: add header for suspend mode SIP interface
Add ROCKCHIP_SIP_SUSPEND_MODE to pass down parameters to Trusted Firmware
in order to decide suspend mode. Currently only add ROCKCHIP_SLEEP_PD_CONFIG
which teaches firmware to power down controllers or not.
Additionally, while the names of the symbolic constants RESERVE_10 and
RELEASE_10 include the command length, the command length is not included
in the RESERVE and RELEASE names. Address both issues by renaming the
RESERVE and RELEASE constants into RESERVE_6 and RELEASE_6 respectively.
Reviewed-by: Christoph Hellwig <hch@lst.de> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Bart Van Assche <bvanassche@acm.org> Link: https://lore.kernel.org/r/20250210205031.2970833-1-bvanassche@acm.org Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Avri Altman [Tue, 11 Feb 2025 06:58:13 +0000 (08:58 +0200)]
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.
Eric Biggers [Fri, 7 Feb 2025 04:17:24 +0000 (20:17 -0800)]
scsi: iscsi_tcp: Switch to using the crc32c library
Now that the crc32c() library function directly takes advantage of
architecture-specific optimizations, it is unnecessary to go through the
crypto API. Just use crc32c(). This is much simpler, and it improves
performance due to eliminating the crypto API overhead.
Fixes: 30158dc9bbc9 ("mpt3sas: Never block the Enclosure device") Cc: Tomas Henzl <thenzl@redhat.com> Signed-off-by: Paul Menzel <pmenzel@molgen.mpg.de> Link: https://lore.kernel.org/r/20250131171640.30721-1-pmenzel@molgen.mpg.de Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Linus Torvalds [Sun, 9 Feb 2025 18:05:32 +0000 (10:05 -0800)]
Merge tag 'kbuild-fixes-v6.14' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild
Pull Kbuild fixes from Masahiro Yamada:
- Suppress false-positive -Wformat-{overflow,truncation}-non-kprintf
warnings regardless of the W= option
- Avoid CONFIG_TRIM_UNUSED_KSYMS dropping symbols passed to symbol_get()
- Fix a build regression of the Debian linux-headers package
* tag 'kbuild-fixes-v6.14' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild:
kbuild: install-extmod-build: add missing quotation marks for CC variable
kbuild: fix misspelling in scripts/Makefile.lib
kbuild: keep symbols for symbol_get() even with CONFIG_TRIM_UNUSED_KSYMS
scripts/Makefile.extrawarn: Do not show clang's non-kprintf warnings at W=1
Linus Torvalds [Sun, 9 Feb 2025 17:47:06 +0000 (09:47 -0800)]
Merge tag 'pm-6.14-rc2-2' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm
Pull power management fix from Rafael Wysocki:
"Fix a recently introduced kernel crash due to a NULL pointer
dereference during system-wide suspend (Rafael Wysocki)"
* tag 'pm-6.14-rc2-2' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm:
PM: sleep: core: Restrict power.set_active propagation
Linus Torvalds [Sun, 9 Feb 2025 17:41:38 +0000 (09:41 -0800)]
Merge tag 'for-linus' of git://git.kernel.org/pub/scm/virt/kvm/kvm
Pull kvm fixes from Paolo Bonzini:
"ARM:
- Correctly clean the BSS to the PoC before allowing EL2 to access it
on nVHE/hVHE/protected configurations
- Propagate ownership of debug registers in protected mode after the
rework that landed in 6.14-rc1
- Stop pretending that we can run the protected mode without a GICv3
being present on the host
- Fix a use-after-free situation that can occur if a vcpu fails to
initialise the NV shadow S2 MMU contexts
- Always evaluate the need to arm a background timer for fully
emulated guest timers
- Fix the emulation of EL1 timers in the absence of FEAT_ECV
- Correctly handle the EL2 virtual timer, specially when HCR_EL2.E2H==0
s390:
- move some of the guest page table (gmap) logic into KVM itself,
inching towards the final goal of completely removing gmap from the
non-kvm memory management code.
As an initial set of cleanups, move some code from mm/gmap into kvm
and start using __kvm_faultin_pfn() to fault-in pages as needed;
but especially stop abusing page->index and page->lru to aid in the
pgdesc conversion.
x86:
- Add missing check in the fix to defer starting the huge page
recovery vhost_task
- SRSO_USER_KERNEL_NO does not need SYNTHESIZED_F"
* tag 'for-linus' of git://git.kernel.org/pub/scm/virt/kvm/kvm: (31 commits)
KVM: x86/mmu: Ensure NX huge page recovery thread is alive before waking
KVM: remove kvm_arch_post_init_vm
KVM: selftests: Fix spelling mistake "initally" -> "initially"
kvm: x86: SRSO_USER_KERNEL_NO is not synthesized
KVM: arm64: timer: Don't adjust the EL2 virtual timer offset
KVM: arm64: timer: Correctly handle EL1 timer emulation when !FEAT_ECV
KVM: arm64: timer: Always evaluate the need for a soft timer
KVM: arm64: Fix nested S2 MMU structures reallocation
KVM: arm64: Fail protected mode init if no vgic hardware is present
KVM: arm64: Flush/sync debug state in protected mode
KVM: s390: selftests: Streamline uc_skey test to issue iske after sske
KVM: s390: remove the last user of page->index
KVM: s390: move PGSTE softbits
KVM: s390: remove useless page->index usage
KVM: s390: move gmap_shadow_pgt_lookup() into kvm
KVM: s390: stop using lists to keep track of used dat tables
KVM: s390: stop using page->index for non-shadow gmaps
KVM: s390: move some gmap shadowing functions away from mm/gmap.c
KVM: s390: get rid of gmap_translate()
KVM: s390: get rid of gmap_fault()
...
Commit 3775fc538f53 ("PM: sleep: core: Synchronize runtime PM status of
parents and children") exposed an issue related to simple_pm_bus_pm_ops
that uses pm_runtime_force_suspend() and pm_runtime_force_resume() as
bus type PM callbacks for the noirq phases of system-wide suspend and
resume.
The problem is that pm_runtime_force_suspend() does not distinguish
runtime-suspended devices from devices for which runtime PM has never
been enabled, so if it sees a device with runtime PM status set to
RPM_ACTIVE, it will assume that runtime PM is enabled for that device
and so it will attempt to suspend it with the help of its runtime PM
callbacks which may not be ready for that. As it turns out, this
causes simple_pm_bus_runtime_suspend() to crash due to a NULL pointer
dereference.
Another problem related to the above commit and simple_pm_bus_pm_ops is
that setting runtime PM status of a device handled by the latter to
RPM_ACTIVE will actually prevent it from being resumed because
pm_runtime_force_resume() only resumes devices with runtime PM status
set to RPM_SUSPENDED.
To mitigate these issues, do not allow power.set_active to propagate
beyond the parent of the device with DPM_FLAG_SMART_SUSPEND set that
will need to be resumed, which should be a sufficient stop-gap for the
time being, but they will need to be properly addressed in the future
because in general during system-wide resume it is necessary to resume
all devices in a dependency chain in which at least one device is going
to be resumed.
Fixes: 3775fc538f53 ("PM: sleep: core: Synchronize runtime PM status of parents and children") Closes: https://lore.kernel.org/linux-pm/1c2433d4-7e0f-4395-b841-b8eac7c25651@nvidia.com/ Reported-by: Jon Hunter <jonathanh@nvidia.com> Tested-by: Johan Hovold <johan+linaro@kernel.org> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Link: https://patch.msgid.link/6137505.lOV4Wx5bFT@rjwysocki.net