]> git.ipfire.org Git - thirdparty/kernel/stable.git/log
thirdparty/kernel/stable.git
4 weeks agoscsi: ufs: core: Disable timestamp functionality if not supported
Bart Van Assche [Tue, 9 Sep 2025 19:06:07 +0000 (12:06 -0700)] 
scsi: ufs: core: Disable timestamp functionality if not supported

Some Kioxia UFS 4 devices do not support the qTimestamp attribute.  Set
the UFS_DEVICE_QUIRK_NO_TIMESTAMP_SUPPORT for these devices such that no
error messages appear in the kernel log about failures to set the
qTimestamp attribute.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Reviewed-by: Avri Altman <avri.altman@sandisk.com>
Tested-by: Nitin Rawat <quic_nitirawa@quicinc.com> # on SM8650-QRD
Reviewed-by: Nitin Rawat <quic_nitirawa@quicinc.com>
Reviewed-by: Peter Wang <peter.wang@mediatek.com>
Reviewed-by: Manivannan Sadhasivam <mani@kernel.org>
Message-ID: <20250909190614.3531435-1-bvanassche@acm.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
4 weeks agoscsi: target: iscsi: fix typos and formatting in lio_target messages
Alok Tiwari [Wed, 10 Sep 2025 19:07:20 +0000 (12:07 -0700)] 
scsi: target: iscsi: fix typos and formatting in lio_target messages

Fix several minor issues in lio_target code and messages:

 - Correct typo "locatel" -> "locate" in error log.

 - Add missing space in pr_debug() message for better readability.

 - Fix comment typo: "contig_item" -> "config_item".

These changes improve code clarity and log readability.

Signed-off-by: Alok Tiwari <alok.a.tiwari@oracle.com>
Reviewed-by: Mike Christie <michael.christie@oracle.com>
Message-ID: <20250910190728.3783157-1-alok.a.tiwari@oracle.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
4 weeks agoscsi: ufs: ufs-qcom: Disable lane clocks during phy hibern8
Palash Kambar [Tue, 9 Sep 2025 05:51:49 +0000 (11:21 +0530)] 
scsi: ufs: ufs-qcom: Disable lane clocks during phy hibern8

Currently, the UFS lane clocks remain enabled even after the link enters
the Hibern8 state and are only disabled during runtime/system
suspend.This patch modifies the behavior to disable the lane clocks
during ufs_qcom_setup_clocks(), which is invoked shortly after the link
enters Hibern8 via gate work.

While hibern8_notify() offers immediate control, toggling clocks on
every transition isn't ideal due to varied contexts like clock scaling.
Since setup_clocks() manages PHY/controller resources and is invoked
soon after Hibern8 entry, it serves as a central and stable point for
clock gating.

Signed-off-by: Palash Kambar <quic_pkambar@quicinc.com>
Reviewed-by: Manivannan Sadhasivam <mani@kernel.org>
Message-ID: <20250909055149.2068737-1-quic_pkambar@quicinc.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
4 weeks agoscsi: ufs: exynos: Correct sync pattern mask timing comment
Alok Tiwari [Sun, 7 Sep 2025 20:27:49 +0000 (13:27 -0700)] 
scsi: ufs: exynos: Correct sync pattern mask timing comment

Fix the comment for SYNC_LEN_G2 in exynos_ufs_config_sync_pattern_mask().
The actual value is 40us, not 44us, matching the configured mask timing.
This change improves code clarity and avoids potential confusion for
readers and maintainers.

No functional changes.

Signed-off-by: Alok Tiwari <alok.a.tiwari@oracle.com>
Reviewed-by: Peter Griffin <peter.griffin@linaro.org>
Message-ID: <20250907202752.3613183-1-alok.a.tiwari@oracle.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 weeks agoscsi: bfa: Remove self-assignment code
Qiang Liu [Thu, 4 Sep 2025 09:35:58 +0000 (17:35 +0800)] 
scsi: bfa: Remove self-assignment code

The variable num_cqs is of type u8 and does not require be16_to_cpu
conversion, so the redundant code is removed.

Signed-off-by: Qiang Liu <liuqiang@kylinos.cn>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 weeks agoMerge patch series "Simplify MCQ resource mapping"
Martin K. Petersen [Wed, 10 Sep 2025 02:53:10 +0000 (22:53 -0400)] 
Merge patch series "Simplify MCQ resource mapping"

Nitin Rawat <nitin.rawat@oss.qualcomm.com> says:

The patch series simplifies the UFS MCQ (Multi Circular Queue)
resource mapping in the Qualcomm UFS host controller driver by
replacing the complex multi-resource approach with a streamlined
single-resource implementation.

The current MCQ implementation uses multiple separate resource
mappings (RES_UFS, RES_MCQ, RES_MCQ_SQD, RES_MCQ_VS) with dynamic
resource allocation, which increases code complexity and potential for
resource mapping errors. This approach also doesn't align with the
device tree binding specification that defines a single 'mcq' memory
region.

Replace the multi-resource mapping with a single "mcq" resource that
encompasses the entire MCQ configuration space. The doorbell registers
(SQD, CQD, SQIS, CQIS) are accessed using predefined offsets relative
to the MCQ base address, providing clearer memory layout organization.

Tested on Qualcomm platforms SM8650 and SM8750 with UFS MCQ enabled.

Changes from v3:
1. Addressed Krzysztof comment to separate device tree and driver
   patch independently in different patch series. This series caters
   driver changes.
2. Addressed Manivannan's change to update commit text and remove
   redundant null check in mcq code.
3. Addressed Manivannan's to Update few offsets as fixed definition
   instead of enum.

Changes from v2:
1. Removed dt-bindings patch as existing binding supports required
   reg-names format.
2. Added patch to refactor MCQ register dump logic for new resource
   mapping.
3. Added patch to remove unused ufshcd_res_info structure from UFS core.
4. Changed reg-names from "ufs_mem" to "std" in device tree patches.
5. Reordered patches with driver changes first, then device tree changes.
6. Updated SM8750 MCQ region size from 0x2000 to 0x15000

Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 weeks agoscsi: ufs: ufs-qcom: Refactor MCQ register dump logic
Nitin Rawat [Wed, 3 Sep 2025 07:48:15 +0000 (13:18 +0530)] 
scsi: ufs: ufs-qcom: Refactor MCQ register dump logic

Refactor MCQ register dump to align with the new resource mapping.  As
part of refactor, below changes are done:

 - Update ufs_qcom_dump_regs() function signature to accept direct
   base address instead of resource ID enum

 - Modify ufs_qcom_dump_mcq_hci_regs() to use hba->mcq_base and
   calculated addresses from MCQ operation info

 - Replace enum ufshcd_res with direct memory-mapped I/O addresses

Additionally remove the ufshcd_res_info structure and associated enum
ufshcd_res definitions from the UFS host controller header.  These were
previously used for MCQ resource mapping but are no longer needed
following recent refactoring to use direct base addresses instead of
multiple separate resource regions.

Signed-off-by: Nitin Rawat <quic_nitirawa@quicinc.com>
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Reviewed-by: Manivannan Sadhasivam <mani@kernel.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 weeks agoscsi: ufs: ufs-qcom: Streamline UFS MCQ resource mapping
Nitin Rawat [Wed, 3 Sep 2025 07:48:14 +0000 (13:18 +0530)] 
scsi: ufs: ufs-qcom: Streamline UFS MCQ resource mapping

The current MCQ resource configuration involves multiple resource
mappings and dynamic resource allocation.

Simplify the resource mapping by directly mapping the single "mcq"
resource from device tree to hba->mcq_base instead of mapping multiple
separate resources (RES_UFS, RES_MCQ, RES_MCQ_SQD, RES_MCQ_VS).

It also uses predefined offsets for MCQ doorbell registers (SQD, CQD,
SQIS, CQIS) relative to the MCQ base,providing clearer memory layout
clarity.

Additionally update vendor-specific register offset UFS_MEM_CQIS_VS
offset from 0x8 to 0x4008 to align with the hardware programming guide.

The new approach assumes the device tree provides a single "mcq"
resource that encompasses the entire MCQ configuration space, making the
driver more maintainable and less prone to resource mapping errors.

The change aligns the driver implementation with the device tree binding
specification, which defines a single 'mcq' memory region rather than
multiple separate regions.

Co-developed-by: Ram Kumar Dwivedi <quic_rdwivedi@quicinc.com>
Signed-off-by: Ram Kumar Dwivedi <quic_rdwivedi@quicinc.com>
Signed-off-by: Nitin Rawat <quic_nitirawa@quicinc.com>
Reviewed-by: Manivannan Sadhasivam <mani@kernel.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 weeks agoMerge patch series "ufs: host: mediatek: Power Management and stability enhancements"
Martin K. Petersen [Wed, 10 Sep 2025 02:46:47 +0000 (22:46 -0400)] 
Merge patch series "ufs: host: mediatek: Power Management and stability enhancements"

Peter Wang <peter.wang@mediatek.com> says:

These patches collectively enhance the UFS host driver's reliability,
power management efficiency, and error recovery mechanisms on MediaTek
platforms. They address critical issues and introduce optimizations
that improve system stability and performance.

Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 weeks agoscsi: ufs: host: mediatek: Fix device power control
Peter Wang [Wed, 3 Sep 2025 02:44:46 +0000 (10:44 +0800)] 
scsi: ufs: host: mediatek: Fix device power control

Adjust the timing of device power control to ensure low power mode (LPM)
is entered only after VCC is turned off. Prevent VCCQ/VCCQ2 from
entering LPM prematurely, ensuring proper power management and device
stability.

Signed-off-by: Peter Wang <peter.wang@mediatek.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 weeks agoscsi: ufs: host: mediatek: Fix unbalanced IRQ enable issue
Peter Wang [Wed, 3 Sep 2025 02:44:45 +0000 (10:44 +0800)] 
scsi: ufs: host: mediatek: Fix unbalanced IRQ enable issue

Resolve the issue of unbalanced IRQ enablement by setting the
'is_mcq_intr_enabled' flag after the first successful IRQ enablement.
Ensure proper tracking of the IRQ state and prevent potential mismatches
in IRQ handling.

Signed-off-by: Peter Wang <peter.wang@mediatek.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 weeks agoscsi: ufs: host: mediatek: Fix adapt issue after PA_Init
Alice Chao [Wed, 3 Sep 2025 02:44:44 +0000 (10:44 +0800)] 
scsi: ufs: host: mediatek: Fix adapt issue after PA_Init

Address the issue where the host does not send adapt to the device after
PA_Init success. Ensure the adapt process is correctly initiated for
devices with IP version MT6899 and above, resolving communication issues
between the host and device.

Signed-off-by: Alice Chao <alice.chao@mediatek.com>
Reviewed-by: Peter Wang <peter.wang@mediatek.com>
Signed-off-by: Peter Wang <peter.wang@mediatek.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 weeks agoscsi: ufs: host: mediatek: Return error directly on idle wait timeout
Sanjeev Y [Wed, 3 Sep 2025 02:44:43 +0000 (10:44 +0800)] 
scsi: ufs: host: mediatek: Return error directly on idle wait timeout

Optimize the recovery flow by returning an error code immediately if a
wait idle timeout occurs, rather than waiting for the link to reach the
up state. Shorten the recovery process and improve error handling
efficiency when idle state transitions fail.

Signed-off-by: Sanjeev Y <sanjeev.y@mediatek.com>
Reviewed-by: Peter Wang <peter.wang@mediatek.com>
Signed-off-by: Peter Wang <peter.wang@mediatek.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 weeks agoscsi: ufs: host: mediatek: Disable auto-hibern8 during power mode changes
Peter Wang [Wed, 3 Sep 2025 02:44:42 +0000 (10:44 +0800)] 
scsi: ufs: host: mediatek: Disable auto-hibern8 during power mode changes

Disable auto-hibern8 during power mode transitions to prevent unintended
entry into auto-hibern8. Restore the original auto-hibern8 timer value
after completing the power mode change to maintain system stability and
prevent potential issues during power state transitions.

Signed-off-by: Peter Wang <peter.wang@mediatek.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 weeks agoscsi: ufs: host: mediatek: Support UFS PHY runtime PM and correct sequence
Peter Wang [Wed, 3 Sep 2025 02:44:41 +0000 (10:44 +0800)] 
scsi: ufs: host: mediatek: Support UFS PHY runtime PM and correct sequence

Add support for UFS PHY runtime power management by probing the PHY
device and enabling its runtime PM. Ensure the correct sequence of
operations during suspend and resume: PHY suspend -> UFS suspend -> UFS
resume -> PHY resume.  Improve power management efficiency and system
stability with this enhancement.

Signed-off-by: Peter Wang <peter.wang@mediatek.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 weeks agoscsi: ufs: host: mediatek: Correct resume flow for LPM and MTCMOS
Alice Chao [Wed, 3 Sep 2025 02:44:40 +0000 (10:44 +0800)] 
scsi: ufs: host: mediatek: Correct resume flow for LPM and MTCMOS

Correct the system resume flow by turning MTCMOS on before setting LPM
to false. During system suspend, set LPM to true and turn MTCMOS
off. Ensure proper power management and system stability with the
updated resume sequence.

Signed-off-by: Alice Chao <alice.chao@mediatek.com>
Signed-off-by: Peter Wang <peter.wang@mediatek.com>
Reviewed-by: Peter Wang <peter.wang@mediatek.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 weeks agoscsi: ufs: host: mediatek: Correct system PM flow
Peter Wang [Wed, 3 Sep 2025 02:44:39 +0000 (10:44 +0800)] 
scsi: ufs: host: mediatek: Correct system PM flow

Refine the system power management (PM) flow by skipping low power mode
(LPM) and MTCMOS settings if runtime PM is already applied. Prevent
redundant operations to ensure a more efficient PM process.

Signed-off-by: Peter Wang <peter.wang@mediatek.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 weeks agoscsi: ufs: host: mediatek: Enhance recovery on resume failure
Peter Wang [Wed, 3 Sep 2025 02:44:38 +0000 (10:44 +0800)] 
scsi: ufs: host: mediatek: Enhance recovery on resume failure

Improve the recovery process for failed resume operations. Log the
device's power status and return 0 if both resume and recovery fail to
prevent I/O hang.

Signed-off-by: Peter Wang <peter.wang@mediatek.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 weeks agoscsi: ufs: host: mediatek: Enhance recovery on hibernation exit failure
Peter Wang [Wed, 3 Sep 2025 02:44:37 +0000 (10:44 +0800)] 
scsi: ufs: host: mediatek: Enhance recovery on hibernation exit failure

Improve the recovery process for hibernation exit failures. Trigger the
error handler and break the suspend operation to ensure effective
recovery from hibernation errors. Activate the error handling mechanism
by ufshcd_force_error_recovery and scheduling the error handler work.

Signed-off-by: Peter Wang <peter.wang@mediatek.com>
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 weeks agoscsi: pm80xx: Avoid -Wflex-array-member-not-at-end warnings
Gustavo A. R. Silva [Mon, 8 Sep 2025 18:42:01 +0000 (20:42 +0200)] 
scsi: pm80xx: Avoid -Wflex-array-member-not-at-end warnings

Comment out unused field 'residual_count' in a couple of structures, and
with this, fix the following -Wflex-array-member-not-at-end warnings:

drivers/scsi/pm8001/pm8001_hwi.h:342:33: warning: structure containing a flexible array member is not at the end of another structure [-Wflex-array-member-not-at-end]
drivers/scsi/pm8001/pm80xx_hwi.h:561:32: warning: structure containing a flexible array member is not at the end of another structure [-Wflex-array-member-not-at-end]

Reviewed-by: Jack Wang <jinpu.wang@ionos.com>
Reviewed-by: John Garry <john.g.garry@oracle.com>
Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 weeks agoscsi: ufs: ufs-qcom: Align programming sequence of Shared ICE for UFS controller v5
Palash Kambar [Mon, 18 Aug 2025 04:09:05 +0000 (09:39 +0530)] 
scsi: ufs: ufs-qcom: Align programming sequence of Shared ICE for UFS controller v5

Disabling the AES core in Shared ICE is not supported during power
collapse for UFS Host Controller v5.0, which may lead to data errors
after Hibern8 exit. To comply with hardware programming guidelines and
avoid this issue, issue a sync reset to ICE upon power collapse exit.

Hence follow below steps to reset the ICE upon exiting power collapse
and align with Hw programming guide.

a. Assert the ICE sync reset by setting both SYNC_RST_SEL and
   SYNC_RST_SW bits in UFS_MEM_ICE_CFG

b. Deassert the reset by clearing SYNC_RST_SW in  UFS_MEM_ICE_CFG

Signed-off-by: Palash Kambar <quic_pkambar@quicinc.com>
Reviewed-by: Manivannan Sadhasivam <mani@kernel.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 weeks agoscsi: scsi_debug: Replace kzalloc() + copy_from_user() with memdup_user_nul()
Thorsten Blum [Fri, 5 Sep 2025 10:31:45 +0000 (12:31 +0200)] 
scsi: scsi_debug: Replace kzalloc() + copy_from_user() with memdup_user_nul()

Replace kzalloc() followed by copy_from_user() with memdup_user_nul() to
improve and simplify sdebug_error_write().

No functional changes intended.

Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 weeks agoscsi: lpfc: Use int type to store negative error codes
Qianfeng Rong [Thu, 4 Sep 2025 13:23:51 +0000 (21:23 +0800)] 
scsi: lpfc: Use int type to store negative error codes

Change the 'ret' variable in lpfc_sli4_issue_wqe() from uint32_t to int,
as it needs to store either negative error codes or zero returned by
lpfc_sli4_wq_put().

Storing the negative error codes in unsigned type, doesn't cause an
issue at runtime but can be confusing.  Additionally, assigning negative
error codes to unsigned type may trigger a GCC warning when the
-Wsign-conversion flag is enabled.

No effect on runtime.

Signed-off-by: Qianfeng Rong <rongqianfeng@vivo.com>
Reviewed-by: Justin Tee <justin.tee@broadcom.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 weeks agoscsi: target: iscsi: Use int type to store negative value
Qianfeng Rong [Tue, 2 Sep 2025 12:50:14 +0000 (20:50 +0800)] 
scsi: target: iscsi: Use int type to store negative value

Change the 'ret' variable in iscsit_tmr_task_reassign() from u64 to int,
as it needs to store either negative value or zero returned by
iscsit_find_cmd_for_recovery().

Storing the negative error codes in unsigned type, or performing equality
comparisons (e.g., ret == -2), doesn't cause an issue at runtime [1] but
can be confusing.  Additionally, assigning negative error codes to
unsigned type may trigger a GCC warning when the -Wsign-conversion flag
is enabled.

No effect on runtime.

Link: https://lore.kernel.org/all/x3wogjf6vgpkisdhg3abzrx7v7zktmdnfmqeih5kosszmagqfs@oh3qxrgzkikf/
Signed-off-by: Qianfeng Rong <rongqianfeng@vivo.com>
Reviewed-by: Mike Christie <michael.christie@oracle.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 weeks agoscsi: ufs: core: Move the tracing enumeration types into a new file
Bart Van Assche [Fri, 29 Aug 2025 15:38:16 +0000 (08:38 -0700)] 
scsi: ufs: core: Move the tracing enumeration types into a new file

The <ufs/ufs.h> header file defines constants and data structures
related to the UFS standard. Move the enumeration types related to
tracing into a new header file because these are not defined in the UFS
standard. An intended side effect of this patch is that the tracing
enumeration types are no longer visible to UFS host drivers.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Link: https://lore.kernel.org/r/20250829153841.2201700-1-bvanassche@acm.org
Reviewed-by: Avri Altman <avri.altman@sandisk.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 weeks agoscsi: qla2xxx: Use secs_to_jiffies() instead of msecs_to_jiffies()
Thorsten Blum [Thu, 28 Aug 2025 16:11:53 +0000 (18:11 +0200)] 
scsi: qla2xxx: Use secs_to_jiffies() instead of msecs_to_jiffies()

Use secs_to_jiffies() instead of msecs_to_jiffies() and avoid scaling
'ratov_j' to milliseconds.

No functional changes intended.

Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
Link: https://lore.kernel.org/r/20250828161153.3676-2-thorsten.blum@linux.dev
Reviewed-by: Himanshu Madhani <hmadhani2024@gmail.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 weeks agoscsi: csiostor: Fix some spelling errors
Xichao Zhao [Wed, 27 Aug 2025 12:16:11 +0000 (20:16 +0800)] 
scsi: csiostor: Fix some spelling errors

Fix spelling errors in some comments.

Signed-off-by: Xichao Zhao <zhao.xichao@vivo.com>
Link: https://lore.kernel.org/r/20250827121611.497547-1-zhao.xichao@vivo.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 weeks agoscsi: fc: Avoid -Wflex-array-member-not-at-end warnings
Gustavo A. R. Silva [Wed, 27 Aug 2025 06:10:53 +0000 (08:10 +0200)] 
scsi: fc: Avoid -Wflex-array-member-not-at-end warnings

-Wflex-array-member-not-at-end has been introduced in GCC-14, and we are
getting ready to enable it, globally.

So, in order to avoid ending up with a flexible-array member in the
middle of multiple other structs, we use the '__struct_group()' helper
to create a new tagged 'struct fc_df_desc_fpin_reg_hdr'.  This structure
groups together all the members of the flexible 'struct
fc_df_desc_fpin_reg' except the flexible array.

As a result, the array is effectively separated from the rest of the
members without modifying the memory layout of the flexible structure.
We then change the type of the middle struct members currently causing
trouble from 'struct fc_df_desc_fpin_reg' to 'struct
fc_df_desc_fpin_reg_hdr'.

We also want to ensure that in case new members need to be added to the
flexible structure, they are always included within the newly created
tagged struct. For this, we use '_Static_assert()'. This ensures that
the memory layout for both the flexible structure and the new tagged
struct is the same after any changes.

This approach avoids having to implement 'struct fc_df_desc_fpin_reg_hdr'
as a completely separate structure, thus preventing having to maintain
two independent but basically identical structures, closing the door
to potential bugs in the future.

The above is also done for flexible structures 'struct fc_els_rdf' and
'struct fc_els_rdf_resp'

So, with these changes, fix the following warnings:
drivers/scsi/lpfc/lpfc_hw4.h:4936:41: warning: structure containing a flexible array member is not at the end of another structure [-Wflex-array-member-not-at-end]
drivers/scsi/lpfc/lpfc_hw4.h:4942:41: warning: structure containing a flexible array member is not at the end of another structure [-Wflex-array-member-not-at-end]
drivers/scsi/lpfc/lpfc_hw4.h:4947:41: warning: structure containing a flexible array member is not at the end of another structure [-Wflex-array-member-not-at-end]

Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
Link: https://lore.kernel.org/r/aK6hbQLyQlvlySf8@kspp
Reviewed-by: Hannes Reinecke <hare@suse.de>
Reviewed-by: Justin Tee <justin.tee@broadcom.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 weeks agoscsi: pm8001: Use int instead of u32 to store error codes
Qianfeng Rong [Tue, 26 Aug 2025 09:32:42 +0000 (17:32 +0800)] 
scsi: pm8001: Use int instead of u32 to store error codes

Use int instead of u32 for 'ret' variable to store negative error codes
returned by PM8001_CHIP_DISP->set_nvmd_req().

Signed-off-by: Qianfeng Rong <rongqianfeng@vivo.com>
Link: https://lore.kernel.org/r/20250826093242.230344-1-rongqianfeng@vivo.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 weeks agoscsi: sd: Make sd_revalidate_disk() return void
Abinash Singh [Mon, 25 Aug 2025 18:39:40 +0000 (00:09 +0530)] 
scsi: sd: Make sd_revalidate_disk() return void

The sd_revalidate_disk() function currently returns 0 for both success
and memory allocation failure. Since none of its callers use the return
value, this return code is both unnecessary and potentially misleading.

Change the return type of sd_revalidate_disk() from int to void
and remove all return value handling. This makes the function
semantics clearer and avoids confusion about unused return codes.

Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Reviewed-by: Damien Le Moal <dlemoal@kernel.org>
Signed-off-by: Abinash Singh <abinashsinghlalotra@gmail.com>
Link: https://lore.kernel.org/r/20250825183940.13211-4-abinashsinghlalotra@gmail.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 weeks agoscsi: sd: Remove redundant printk() after kmalloc() failure
Abinash Singh [Mon, 25 Aug 2025 18:39:39 +0000 (00:09 +0530)] 
scsi: sd: Remove redundant printk() after kmalloc() failure

The SCSI disk driver prints a warning when kmalloc() fails in
sd_revalidate_disk(). This is redundant because the page allocator
already reports failures unless __GFP_NOWARN is used. Keeping the extra
message only adds noise to the kernel log.

Remove the unnecessary sd_printk() call. Control flow is unchanged.

Reviewed-by: Damien Le Moal <dlemoal@kernel.org>
Signed-off-by: Abinash Singh <abinashsinghlalotra@gmail.com>
Link: https://lore.kernel.org/r/20250825183940.13211-3-abinashsinghlalotra@gmail.com
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 weeks agoscsi: sd: Fix build warning in sd_revalidate_disk()
Abinash Singh [Mon, 25 Aug 2025 18:39:38 +0000 (00:09 +0530)] 
scsi: sd: Fix build warning in sd_revalidate_disk()

A build warning was triggered due to excessive stack usage in
sd_revalidate_disk():

drivers/scsi/sd.c: In function â€˜sd_revalidate_disk.isra’:
drivers/scsi/sd.c:3824:1: warning: the frame size of 1160 bytes is larger than 1024 bytes [-Wframe-larger-than=]

This is caused by a large local struct queue_limits (~400B) allocated on
the stack. Replacing it with a heap allocation using kmalloc()
significantly reduces frame usage. Kernel stack is limited (~8 KB), and
allocating large structs on the stack is discouraged.  As the function
already performs heap allocations (e.g. for buffer), this change fits
well.

Fixes: 804e498e0496 ("sd: convert to the atomic queue limits API")
Cc: stable@vger.kernel.org
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Abinash Singh <abinashsinghlalotra@gmail.com>
Link: https://lore.kernel.org/r/20250825183940.13211-2-abinashsinghlalotra@gmail.com
Reviewed-by: Damien Le Moal <dlemoal@kernel.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 weeks agoscsi: ufs: exynos: fsd: Gate ref_clk and put UFS device in reset on suspend
Bharat Uppal [Thu, 21 Aug 2025 05:39:23 +0000 (11:09 +0530)] 
scsi: ufs: exynos: fsd: Gate ref_clk and put UFS device in reset on suspend

On FSD platform, gating the reference clock (ref_clk) and putting the
UFS device in reset by asserting the reset signal during UFS suspend,
improves the power savings and ensures the PHY is fully turned off.

These operations are added as FSD specific suspend hook to avoid
unintended side effects on other SoCs supported by this driver.

Co-developed-by: Nimesh Sati <nimesh.sati@samsung.com>
Signed-off-by: Nimesh Sati <nimesh.sati@samsung.com>
Signed-off-by: Bharat Uppal <bharat.uppal@samsung.com>
Link: https://lore.kernel.org/r/20250821053923.69411-1-bharat.uppal@samsung.com
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
7 weeks agoscsi: pm80xx: Fix race condition caused by static variables
Francisco Gutierrez [Wed, 23 Jul 2025 18:35:43 +0000 (18:35 +0000)] 
scsi: pm80xx: Fix race condition caused by static variables

Eliminate the use of static variables within the log pull implementation
to resolve a race condition and prevent data gaps when pulling logs from
multiple controllers in parallel, ensuring each operation is properly
isolated.

Signed-off-by: Francisco Gutierrez <frankramirez@google.com>
Link: https://lore.kernel.org/r/20250723183543.1443301-1-frankramirez@google.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
7 weeks agoMerge patch series "mpi3mr: bug fixes and minor updates"
Martin K. Petersen [Tue, 26 Aug 2025 01:40:27 +0000 (21:40 -0400)] 
Merge patch series "mpi3mr: bug fixes and minor updates"

Chandrakanth Patil <chandrakanth.patil@broadcom.com> says:

This series contains mpi3mr driver fixes and minor updates.

Link: https://lore.kernel.org/r/20250820084138.228471-1-chandrakanth.patil@broadcom.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
7 weeks agoscsi: mpi3mr: Update driver version to 8.15.0.5.50
Chandrakanth Patil [Wed, 20 Aug 2025 08:41:38 +0000 (14:11 +0530)] 
scsi: mpi3mr: Update driver version to 8.15.0.5.50

Bump driver version to 8.15.0.5.50 to match the latest release.

Signed-off-by: Chandrakanth Patil <chandrakanth.patil@broadcom.com>
Link: https://lore.kernel.org/r/20250820084138.228471-7-chandrakanth.patil@broadcom.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
7 weeks agoscsi: mpi3mr: Fix premature TM timeouts on virtual drives
Chandrakanth Patil [Wed, 20 Aug 2025 08:41:37 +0000 (14:11 +0530)] 
scsi: mpi3mr: Fix premature TM timeouts on virtual drives

Task Management to virtual drives may timeout prematurely when using a
static default timeout.

Read Abort and Reset timeouts from Device Page 0 and apply the maximum
of the firmware value and the default.

This fixes premature TM failures on virtual drives.

Signed-off-by: Chandrakanth Patil <chandrakanth.patil@broadcom.com>
Link: https://lore.kernel.org/r/20250820084138.228471-6-chandrakanth.patil@broadcom.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
7 weeks agoscsi: mpi3mr: Update MPI headers to revision 37
Chandrakanth Patil [Wed, 20 Aug 2025 08:41:36 +0000 (14:11 +0530)] 
scsi: mpi3mr: Update MPI headers to revision 37

Sync MPI header files to revision 37 to match current firmware/spec
definitions.

No functional change.

Signed-off-by: Chandrakanth Patil <chandrakanth.patil@broadcom.com>
Link: https://lore.kernel.org/r/20250820084138.228471-5-chandrakanth.patil@broadcom.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
7 weeks agoscsi: mpi3mr: Fix I/O failures during controller reset
Chandrakanth Patil [Wed, 20 Aug 2025 08:41:35 +0000 (14:11 +0530)] 
scsi: mpi3mr: Fix I/O failures during controller reset

I/Os can race with controller reset and fail.

Block requests at the mid layer when reset starts using
scsi_host_block(), and resume with scsi_host_unblock() after reset
completes.

Signed-off-by: Chandrakanth Patil <chandrakanth.patil@broadcom.com>
Link: https://lore.kernel.org/r/20250820084138.228471-4-chandrakanth.patil@broadcom.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
7 weeks agoscsi: mpi3mr: Fix controller init failure on fault during queue creation
Chandrakanth Patil [Wed, 20 Aug 2025 08:41:34 +0000 (14:11 +0530)] 
scsi: mpi3mr: Fix controller init failure on fault during queue creation

Firmware can enter a transient fault while creating operational queues.
The driver fails the load immediately.

Add a retry loop that checks controller status and history bit after
queue creation. If either indicates a fault, retry init up to a set
limit before failing.

Signed-off-by: Chandrakanth Patil <chandrakanth.patil@broadcom.com>
Link: https://lore.kernel.org/r/20250820084138.228471-3-chandrakanth.patil@broadcom.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
7 weeks agoscsi: mpi3mr: Fix device loss during enclosure reboot due to zero link speed
Chandrakanth Patil [Wed, 20 Aug 2025 08:41:33 +0000 (14:11 +0530)] 
scsi: mpi3mr: Fix device loss during enclosure reboot due to zero link speed

During enclosure reboot or expander reset, firmware may report a link
speed of 0 in "Device Add" events while the link is still coming up.
The driver drops such devices, leaving them missing even after the link
recovers.

Fix this by treating link speed 0 as 1.5 Gbps during device addition so
the device is exposed to the OS. The actual link speed will be updated
later when link-up events arrive.

Signed-off-by: Chandrakanth Patil <chandrakanth.patil@broadcom.com>
Link: https://lore.kernel.org/r/20250820084138.228471-2-chandrakanth.patil@broadcom.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
7 weeks agoscsi: aic94xx: Remove redundant code
Qiang Liu [Tue, 19 Aug 2025 02:30:06 +0000 (10:30 +0800)] 
scsi: aic94xx: Remove redundant code

Assigning ssp_task.retry_count to itself has no effect.

Signed-off-by: Qiang Liu <liuqiang@kylinos.cn>
Link: https://lore.kernel.org/r/20250819023006.15216-1-liuqiangneo@163.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
8 weeks agoscsi: myrs: Fix dma_alloc_coherent() error check
Thomas Fourier [Fri, 25 Jul 2025 08:31:06 +0000 (10:31 +0200)] 
scsi: myrs: Fix dma_alloc_coherent() error check

Check for NULL return value with dma_alloc_coherent(), because DMA
address is not always set by dma_alloc_coherent() on failure.

Fixes: 77266186397c ("scsi: myrs: Add Mylex RAID controller (SCSI interface)")
Signed-off-by: Thomas Fourier <fourier.thomas@gmail.com>
Link: https://lore.kernel.org/r/20250725083112.43975-2-fourier.thomas@gmail.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
8 weeks agoscsi: lpfc: use min() to improve code
Qianfeng Rong [Fri, 15 Aug 2025 12:16:05 +0000 (20:16 +0800)] 
scsi: lpfc: use min() to improve code

Use min_t() to reduce the code in lpfc_sli4_driver_resource_setup() and
lpfc_nvme_prep_io_cmd(), and improve readability.

Signed-off-by: Qianfeng Rong <rongqianfeng@vivo.com>
Link: https://lore.kernel.org/r/20250815121609.384914-4-rongqianfeng@vivo.com
Reviewed-by: Justin Tee <justin.tee@broadcom.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
8 weeks agoscsi: hpsa: use min()/min_t() to improve code
Qianfeng Rong [Fri, 15 Aug 2025 12:16:04 +0000 (20:16 +0800)] 
scsi: hpsa: use min()/min_t() to improve code

Use min()/min_t() to reduce the code in complete_scsi_command() and
hpsa_vpd_page_supported(), and improve readability.

Signed-off-by: Qianfeng Rong <rongqianfeng@vivo.com>
Link: https://lore.kernel.org/r/20250815121609.384914-3-rongqianfeng@vivo.com
Acked-by: Don Brace <don.brace@microchip.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
8 weeks agoscsi: ufs: core: Reduce the size of struct ufshcd_lrb
Bart Van Assche [Tue, 19 Aug 2025 15:43:49 +0000 (08:43 -0700)] 
scsi: ufs: core: Reduce the size of struct ufshcd_lrb

The size of the data structures that are used in the hot path matters
for performance (IOPS). Hence this patch that reduces the size of struct
ufshcd_lrb on 64-bit systems by 16 bytes. The size of this data
structure is reduced from 152 to 136 bytes.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Link: https://lore.kernel.org/r/20250819154356.2256952-1-bvanassche@acm.org
Reviewed-by: Peter Wang <peter.wang@mediatek.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
8 weeks agoscsi: ufs: core: Only collect timestamps if monitoring is enabled
Bart Van Assche [Tue, 19 Aug 2025 15:39:50 +0000 (08:39 -0700)] 
scsi: ufs: core: Only collect timestamps if monitoring is enabled

Every ktime_get() call in the hot path has a measurable impact on IOPS.
Hence, only collect timestamps if the monitoring functionality is
enabled.

See also commit 1d8613a23f3c ("scsi: ufs: core: Introduce HBA
performance monitor sysfs nodes").

Cc: Can Guo <cang@codeaurora.org>
Cc: Bean Huo <beanhuo@micron.com>
Cc: Daejun Park <daejun7.park@samsung.com>
Reviewed-by: Peter Wang <peter.wang@mediatek.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Link: https://lore.kernel.org/r/20250819153958.2255907-1-bvanassche@acm.org
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
8 weeks agoscsi: qla2xxx: Fix memcpy() field-spanning write issue
Gustavo A. R. Silva [Wed, 13 Aug 2025 20:07:44 +0000 (16:07 -0400)] 
scsi: qla2xxx: Fix memcpy() field-spanning write issue

purex_item.iocb is defined as a 64-element u8 array, but 64 is the
minimum size and it can be allocated larger. This makes it a standard
empty flex array.

This was motivated by field-spanning write warnings during FPIN testing:

https://lore.kernel.org/linux-nvme/20250709211919.49100-1-bgurney@redhat.com/

  >  kernel: memcpy: detected field-spanning write (size 60) of single field
  >  "((uint8_t *)fpin_pkt + buffer_copy_offset)"
  >  at drivers/scsi/qla2xxx/qla_isr.c:1221 (size 44)

I removed the outer wrapper from the iocb flex array, so that it can be
linked to 'purex_item.size' with '__counted_by'.

These changes remove the default minimum 64-byte allocation, requiring
further changes.

  In 'struct scsi_qla_host' the embedded 'default_item' is now followed
  by '__default_item_iocb[QLA_DEFAULT_PAYLOAD_SIZE]' to reserve space
  that will be used as 'default_item.iocb'. This is wrapped using the
  'TRAILING_OVERLAP()' macro helper, which effectively creates a union
  between flexible-array member 'default_item.iocb' and
  '__default_item_iocb'.

  Since 'struct pure_item' now contains a flexible-array member, the
  helper must be placed at the end of 'struct scsi_qla_host' to prevent
  a '-Wflex-array-member-not-at-end' warning.

  'qla24xx_alloc_purex_item()' is adjusted to no longer expect the
  default minimum size to be part of 'sizeof(struct purex_item)', the
  entire flexible array size is added to the structure size for
  allocation.

This also slightly changes the layout of the purex_item struct, as
2-bytes of padding are added between 'size' and 'iocb'. The resulting
size is the same, but iocb is shifted 2-bytes (the original 'purex_item'
structure was padded at the end, after the 64-byte defined array size).
I don't think this is a problem.

Tested-by: Bryan Gurney <bgurney@redhat.com>
Co-developed-by: Chris Leech <cleech@redhat.com>
Signed-off-by: Chris Leech <cleech@redhat.com>
Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
Link: https://lore.kernel.org/r/20250813200744.17975-10-bgurney@redhat.com
Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
8 weeks agoscsi: scsi_debug: Use vcalloc() to simplify code
Qianfeng Rong [Wed, 6 Aug 2025 12:46:33 +0000 (20:46 +0800)] 
scsi: scsi_debug: Use vcalloc() to simplify code

Use vcalloc() instead of vmalloc() followed by bitmap_zero() to simplify
the function sdebug_add_store().

Signed-off-by: Qianfeng Rong <rongqianfeng@vivo.com>
Link: https://lore.kernel.org/r/20250806124633.383426-3-rongqianfeng@vivo.com
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
8 weeks agoscsi: ipr: Use vmalloc_array() to simplify code
Qianfeng Rong [Wed, 6 Aug 2025 12:46:32 +0000 (20:46 +0800)] 
scsi: ipr: Use vmalloc_array() to simplify code

Use vmalloc_array() instead of vmalloc() to simplify the function
ipr_alloc_dump().

Signed-off-by: Qianfeng Rong <rongqianfeng@vivo.com>
Link: https://lore.kernel.org/r/20250806124633.383426-2-rongqianfeng@vivo.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
8 weeks agoscsi: hpsa: Fix incorrect comment format
Cryolitia PukNgae [Wed, 6 Aug 2025 03:13:16 +0000 (11:13 +0800)] 
scsi: hpsa: Fix incorrect comment format

Comments should not have a leading plus sign.

Signed-off-by: Cryolitia PukNgae <cryolitia@uniontech.com>
Link: https://lore.kernel.org/r/20250806-scsi_typo-v1-1-ec353a303b31@uniontech.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
8 weeks agoMerge patch series "scsi: pm80xx: Fix expander support"
Martin K. Petersen [Wed, 20 Aug 2025 01:50:44 +0000 (21:50 -0400)] 
Merge patch series "scsi: pm80xx: Fix expander support"

Niklas Cassel <cassel@kernel.org> says:

Hello all,

Some recent patches broke expander support for the pm80xx driver.

The first two patches in this series make sure that expanders work with
the pm80xx driver again.

It also fixes a bug in pm8001_abort_task() that was found through code
review.

There is also some patches that make the pm80xx driver more robust, so it
is less likely that the expander support will break again in the future.

There is also some minor changes to some other libsas drivers to make use
of the new dev_parent_is_expander() helper.

Please test and review.

Kind regards,
Niklas

Link: https://lore.kernel.org/r/20250814173215.1765055-12-cassel@kernel.org
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
8 weeks agoscsi: pm80xx: Use pm80xx_get_local_phy_id() to access phy array
Niklas Cassel [Thu, 14 Aug 2025 17:32:25 +0000 (19:32 +0200)] 
scsi: pm80xx: Use pm80xx_get_local_phy_id() to access phy array

While the current code is perfectly fine (because we verify that the
device is directly attached before using attached_phy to index the
pm8001_ha->phy array), let's use the pm80xx_get_local_phy_id() helper
anyway, to reduce the chance that someone will copy paste this pattern
to other parts of the driver.

Note that in this specific case, we still need to keep the check that
the device is not behind an expander, because we do not want to clear
attached_phy of the expander if a device behind the expander disappears
(as that would disable all the other devices behind the expander).

However, if it is the expander itself that disappears, attached_phy will
be cleared, just like it would for any other directly attached device.

Signed-off-by: Niklas Cassel <cassel@kernel.org>
Link: https://lore.kernel.org/r/20250814173215.1765055-22-cassel@kernel.org
Reviewed-by: Damien Le Moal <dlemoal@kernel.org>
Reviewed-by: Igor Pylypiv <ipylypiv@google.com>
Acked-by: Jack Wang <jinpu.wang@ionos.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
8 weeks agoscsi: pm80xx: Fix pm8001_abort_task() for chip_8006 when using an expander
Niklas Cassel [Thu, 14 Aug 2025 17:32:24 +0000 (19:32 +0200)] 
scsi: pm80xx: Fix pm8001_abort_task() for chip_8006 when using an expander

For a direct attached device, attached_phy contains the local phy id.
For a device behind an expander, attached_phy contains the remote phy
id, not the local phy id.

The pm8001_ha->phy array only contains the phys of the HBA.  It does not
contain the phys of the expander.

Thus, you cannot use attached_phy to index the pm8001_ha->phy array,
without first verifying that the device is directly attached.

Use the pm80xx_get_local_phy_id() helper to make sure that we use the
local phy id to index the array, regardless if the device is directly
attached or not.

Fixes: 869ddbdcae3b ("scsi: pm80xx: corrected SATA abort handling sequence.")
Reviewed-by: Igor Pylypiv <ipylypiv@google.com>
Signed-off-by: Niklas Cassel <cassel@kernel.org>
Link: https://lore.kernel.org/r/20250814173215.1765055-21-cassel@kernel.org
Reviewed-by: Damien Le Moal <dlemoal@kernel.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
8 weeks agoscsi: pm80xx: Add helper function to get the local phy id
Niklas Cassel [Thu, 14 Aug 2025 17:32:23 +0000 (19:32 +0200)] 
scsi: pm80xx: Add helper function to get the local phy id

Avoid duplicated code by adding a helper to get the local phy id.

No functional changes intended.

Signed-off-by: Niklas Cassel <cassel@kernel.org>
Link: https://lore.kernel.org/r/20250814173215.1765055-20-cassel@kernel.org
Reviewed-by: Damien Le Moal <dlemoal@kernel.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
8 weeks agoscsi: pm80xx: Use dev_parent_is_expander() helper
Niklas Cassel [Thu, 14 Aug 2025 17:32:22 +0000 (19:32 +0200)] 
scsi: pm80xx: Use dev_parent_is_expander() helper

Make use of the dev_parent_is_expander() helper.

Signed-off-by: Niklas Cassel <cassel@kernel.org>
Link: https://lore.kernel.org/r/20250814173215.1765055-19-cassel@kernel.org
Reviewed-by: Damien Le Moal <dlemoal@kernel.org>
Reviewed-by: John Garry <john.g.garry@oracle.com>
Reviewed-by: Igor Pylypiv <ipylypiv@google.com>
Acked-by: Jack Wang <jinpu.wang@ionos.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
8 weeks agoscsi: mvsas: Use dev_parent_is_expander() helper
Niklas Cassel [Thu, 14 Aug 2025 17:32:21 +0000 (19:32 +0200)] 
scsi: mvsas: Use dev_parent_is_expander() helper

Make use of the dev_parent_is_expander() helper.

Signed-off-by: Niklas Cassel <cassel@kernel.org>
Link: https://lore.kernel.org/r/20250814173215.1765055-18-cassel@kernel.org
Reviewed-by: Damien Le Moal <dlemoal@kernel.org>
Reviewed-by: John Garry <john.g.garry@oracle.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
8 weeks agoscsi: isci: Use dev_parent_is_expander() helper
Niklas Cassel [Thu, 14 Aug 2025 17:32:20 +0000 (19:32 +0200)] 
scsi: isci: Use dev_parent_is_expander() helper

Make use of the dev_parent_is_expander() helper.

Signed-off-by: Niklas Cassel <cassel@kernel.org>
Link: https://lore.kernel.org/r/20250814173215.1765055-17-cassel@kernel.org
Reviewed-by: Damien Le Moal <dlemoal@kernel.org>
Reviewed-by: John Garry <john.g.garry@oracle.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
8 weeks agoscsi: hisi_sas: Use dev_parent_is_expander() helper
Niklas Cassel [Thu, 14 Aug 2025 17:32:19 +0000 (19:32 +0200)] 
scsi: hisi_sas: Use dev_parent_is_expander() helper

Make use of the dev_parent_is_expander() helper.

Signed-off-by: Niklas Cassel <cassel@kernel.org>
Link: https://lore.kernel.org/r/20250814173215.1765055-16-cassel@kernel.org
Reviewed-by: Damien Le Moal <dlemoal@kernel.org>
Reviewed-by: John Garry <john.g.garry@oracle.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
8 weeks agoscsi: libsas: Add dev_parent_is_expander() helper
Niklas Cassel [Thu, 14 Aug 2025 17:32:18 +0000 (19:32 +0200)] 
scsi: libsas: Add dev_parent_is_expander() helper

Many libsas drivers check if the parent of the device is an expander.
Create a helper that the libsas drivers will use in follow up commits.

Suggested-by: Damien Le Moal <dlemoal@kernel.org>
Signed-off-by: Niklas Cassel <cassel@kernel.org>
Link: https://lore.kernel.org/r/20250814173215.1765055-15-cassel@kernel.org
Reviewed-by: Damien Le Moal <dlemoal@kernel.org>
Reviewed-by: John Garry <john.g.garry@oracle.com>
Reviewed-by: Jason Yan <yanaijie@huawei.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
8 weeks agoscsi: pm80xx: Fix array-index-out-of-of-bounds on rmmod
Niklas Cassel [Thu, 14 Aug 2025 17:32:17 +0000 (19:32 +0200)] 
scsi: pm80xx: Fix array-index-out-of-of-bounds on rmmod

Since commit f7b705c238d1 ("scsi: pm80xx: Set phy_attached to zero when
device is gone") UBSAN reports:

  UBSAN: array-index-out-of-bounds in drivers/scsi/pm8001/pm8001_sas.c:786:17
  index 28 is out of range for type 'pm8001_phy [16]'

on rmmod when using an expander.

For a direct attached device, attached_phy contains the local phy id.
For a device behind an expander, attached_phy contains the remote phy
id, not the local phy id.

I.e. while pm8001_ha will have pm8001_ha->chip->n_phy local phys, for a
device behind an expander, attached_phy can be much larger than
pm8001_ha->chip->n_phy (depending on the amount of phys of the
expander).

E.g. on my system pm8001_ha has 8 phys with phy ids 0-7.  One of the
ports has an expander connected.  The expander has 31 phys with phy ids
0-30.

The pm8001_ha->phy array only contains the phys of the HBA.  It does not
contain the phys of the expander.  Thus, it is wrong to use attached_phy
to index the pm8001_ha->phy array for a device behind an expander.

Thus, we can only clear phy_attached for devices that are directly
attached.

Fixes: f7b705c238d1 ("scsi: pm80xx: Set phy_attached to zero when device is gone")
Reviewed-by: Igor Pylypiv <ipylypiv@google.com>
Signed-off-by: Niklas Cassel <cassel@kernel.org>
Link: https://lore.kernel.org/r/20250814173215.1765055-14-cassel@kernel.org
Reviewed-by: Damien Le Moal <dlemoal@kernel.org>
Tested-by: Damien Le Moal <dlemoal@kernel.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
8 weeks agoscsi: pm80xx: Restore support for expanders
Niklas Cassel [Thu, 14 Aug 2025 17:32:16 +0000 (19:32 +0200)] 
scsi: pm80xx: Restore support for expanders

Commit 0f630c58e31a ("scsi: pm80xx: Do not use libsas port ID") broke
support for expanders. After the commit, devices behind an expander are
no longer detected.

Simply reverting the commit restores support for devices behind an
expander.

Instead of reverting the commit (and reintroducing a helper to get the
port), get the port directly from the lldd_port pointer in struct
asd_sas_port.

Fixes: 0f630c58e31a ("scsi: pm80xx: Do not use libsas port ID")
Suggested-by: Igor Pylypiv <ipylypiv@google.com>
Reviewed-by: Igor Pylypiv <ipylypiv@google.com>
Signed-off-by: Niklas Cassel <cassel@kernel.org>
Link: https://lore.kernel.org/r/20250814173215.1765055-13-cassel@kernel.org
Reviewed-by: Damien Le Moal <dlemoal@kernel.org>
Tested-by: Damien Le Moal <dlemoal@kernel.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
8 weeks agoscsi: ufs: core: Improve IOPS
Bart Van Assche [Wed, 13 Aug 2025 17:10:41 +0000 (10:10 -0700)] 
scsi: ufs: core: Improve IOPS

Measurements have shown that IOPS improve by 2% - 3% on my UFS 4 test
setup every time a ktime_get() call is removed from the UFS driver
command processing path. Hence this patch that modifies
ufshcd_clk_scaling_start_busy() such that ktime_get() is only called if
the returned value will be used.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Link: https://lore.kernel.org/r/20250813171049.3399387-1-bvanassche@acm.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>
2 months agoMerge patch series "ufs: host: mediatek: Provide features and fixes in MediaTek platf...
Martin K. Petersen [Fri, 15 Aug 2025 02:56:02 +0000 (22:56 -0400)] 
Merge patch series "ufs: host: mediatek: Provide features and fixes in MediaTek platforms"

peter.wang@mediatek.com says:

This series fixes some defects and provide features in MediaTek UFS
drivers.

Link: https://lore.kernel.org/r/20250811131423.3444014-1-peter.wang@mediatek.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2 months agoMerge patch series "dt-bindings: ufs: qcom: Split SC7180, SM8650 and similar into...
Martin K. Petersen [Fri, 15 Aug 2025 02:55:21 +0000 (22:55 -0400)] 
Merge patch series "dt-bindings: ufs: qcom: Split SC7180, SM8650 and similar into separate file"

Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> says:

The binding for Qualcomm SoC UFS controllers grew and it will grow
further.  It already includes several conditionals, partially for
difference in handling encryption block (ICE, either as phandle or as
IO address space) but it will further grow for MCQ.

See also: https://lore.kernel.org/r/20250730082229.23475-1-quic_rdwivedi@quicinc.com

The SM8650 is first SoC coming with MCQ, which was missing in the
binding. Document this as well.

Best regards,
Krzysztof

Link: https://lore.kernel.org/r/20250731-dt-bindings-ufs-qcom-v2-0-53bb634bf95a@linaro.org
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2 months agoscsi: ufs: host: mediatek: Fix invalid access in vccqx handling
Alice Chao [Mon, 11 Aug 2025 13:11:26 +0000 (21:11 +0800)] 
scsi: ufs: host: mediatek: Fix invalid access in vccqx handling

Add a NULL check before accessing the 'vccqx' pointer to prevent invalid
memory access. This ensures that the function safely handles cases where
'vccq' and 'vccq2' are not initialized, improving the robustness of the
power management code.

Signed-off-by: Alice Chao <alice.chao@mediatek.com>
Reviewed-by: Peter Wang <peter.wang@mediatek.com>
Signed-off-by: Peter Wang <peter.wang@mediatek.com>
Link: https://lore.kernel.org/r/20250811131423.3444014-11-peter.wang@mediatek.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2 months agoscsi: ufs: host: mediatek: Change reset sequence for improved stability
Peter Wang [Mon, 11 Aug 2025 13:11:25 +0000 (21:11 +0800)] 
scsi: ufs: host: mediatek: Change reset sequence for improved stability

Modify the reset sequence to ensure that the device reset pin is set low
before the host is disabled. This change enhances the stability of the
reset process by ensuring the correct order of operations.

Signed-off-by: Peter Wang <peter.wang@mediatek.com>
Link: https://lore.kernel.org/r/20250811131423.3444014-10-peter.wang@mediatek.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2 months agoscsi: ufs: host: mediatek: Fix UniPro setting for MT6989
Peter Wang [Mon, 11 Aug 2025 13:11:24 +0000 (21:11 +0800)] 
scsi: ufs: host: mediatek: Fix UniPro setting for MT6989

Set the UniPro attribute 0xD09E[4] bit to enable the 1144 functions
specifically for the MT6989 platform. This adjustment ensures proper
functionality and compatibility with the MT6989 hardware.

Signed-off-by: Peter Wang <peter.wang@mediatek.com>
Link: https://lore.kernel.org/r/20250811131423.3444014-9-peter.wang@mediatek.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2 months agoscsi: ufs: host: mediatek: Optimize power mode change handling
Peter Wang [Mon, 11 Aug 2025 13:11:23 +0000 (21:11 +0800)] 
scsi: ufs: host: mediatek: Optimize power mode change handling

Optimize the power mode change process by skipping the adaptation
setting toggle if the requested power mode configuration is already
applied. This enhancement reduces unnecessary operations, improving
efficiency during power mode transitions.

Signed-off-by: Peter Wang <peter.wang@mediatek.com>
Link: https://lore.kernel.org/r/20250811131423.3444014-8-peter.wang@mediatek.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2 months agoscsi: ufs: host: mediatek: Assign power mode userdata before FASTAUTO mode change
Alice Chao [Mon, 11 Aug 2025 13:11:22 +0000 (21:11 +0800)] 
scsi: ufs: host: mediatek: Assign power mode userdata before FASTAUTO mode change

Assign power mode userdata settings before transitioning to FASTAUTO
power mode. This ensures that default timeout values are set for various
parameters, enhancing the reliability and performance of the power mode
change process.

Signed-off-by: Alice Chao <alice.chao@mediatek.com>
Reviewed-by: Peter Wang <peter.wang@mediatek.com>
Signed-off-by: Peter Wang <peter.wang@mediatek.com>
Link: https://lore.kernel.org/r/20250811131423.3444014-7-peter.wang@mediatek.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2 months agoscsi: ufs: host: mediatek: Fix PWM mode switch issue
Peter Wang [Mon, 11 Aug 2025 13:11:21 +0000 (21:11 +0800)] 
scsi: ufs: host: mediatek: Fix PWM mode switch issue

Address a failure in switching to PWM mode by ensuring proper
configuration of power modes and adaptation settings. The changes
include checks for SLOW_MODE and adjustments to the desired working mode
and adaptation configuration based on the device's power mode and
hardware version.

Signed-off-by: Peter Wang <peter.wang@mediatek.com>
Link: https://lore.kernel.org/r/20250811131423.3444014-6-peter.wang@mediatek.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2 months agoscsi: ufs: host: mediatek: Fine-tune clock scaling
Peter Wang [Mon, 11 Aug 2025 13:11:20 +0000 (21:11 +0800)] 
scsi: ufs: host: mediatek: Fine-tune clock scaling

Disable clock scaling for UFS versions below 4.0. Clock scaling is
unnecessary for these versions, and this change ensures that the feature
is only enabled for compatible UFS versions.

Signed-off-by: Peter Wang <peter.wang@mediatek.com>
Link: https://lore.kernel.org/r/20250811131423.3444014-5-peter.wang@mediatek.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2 months agoscsi: ufs: host: mediatek: Add debug information for Auto-Hibern8
Peter Wang [Mon, 11 Aug 2025 13:11:19 +0000 (21:11 +0800)] 
scsi: ufs: host: mediatek: Add debug information for Auto-Hibern8

Enhance the clock gating logic by adding debug information for the
Auto-Hibern8 (AHIT) register.  This additional logging aids in
troubleshooting by providing insights into the AHIT configuration when
the clock is not turned off as expected.

Signed-off-by: Peter Wang <peter.wang@mediatek.com>
Link: https://lore.kernel.org/r/20250811131423.3444014-4-peter.wang@mediatek.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2 months agoscsi: ufs: host: mediatek: Fix auto-hibern8 timer configuration
Peter Wang [Mon, 11 Aug 2025 13:11:18 +0000 (21:11 +0800)] 
scsi: ufs: host: mediatek: Fix auto-hibern8 timer configuration

Move the configuration of the Auto-Hibern8 (AHIT) timer from the
post-link stage to the 'fixup_dev_quirks' function. This change allows
setting the AHIT based on the vendor requirements:

   (a) Samsung: 3.5 ms
   (b) Micron: 2 ms
   (c) Others: 1 ms

Additionally, the clock gating timer is adjusted based on the AHIT
scale, with a maximum setting of 10 ms. This ensures that the clock
gating delay is appropriately configured to match the AHIT settings.

Signed-off-by: Peter Wang <peter.wang@mediatek.com>
Link: https://lore.kernel.org/r/20250811131423.3444014-3-peter.wang@mediatek.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2 months agoscsi: ufs: host: mediatek: Simplify variable usage
Peter Wang [Mon, 11 Aug 2025 13:11:17 +0000 (21:11 +0800)] 
scsi: ufs: host: mediatek: Simplify variable usage

Simplify the code by using 'info->vcc' instead of 'hba->vreg_info.vcc',
as they refer to the same value. This change improves code readability.

Signed-off-by: Peter Wang <peter.wang@mediatek.com>
Link: https://lore.kernel.org/r/20250811131423.3444014-2-peter.wang@mediatek.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2 months agoscsi: ufs: qcom: dt-bindings: Split SM8650 and similar
Krzysztof Kozlowski [Thu, 31 Jul 2025 07:15:54 +0000 (09:15 +0200)] 
scsi: ufs: qcom: dt-bindings: Split SM8650 and similar

The binding for Qualcomm SoC UFS controllers grew and it will grow
further.  Split SM8650 and SM8750 UFS controllers which:

 1. Do not reference ICE as IO address space, but as phandle,

 2. Have same order of clocks.

 3. Have MCQ I/O address space. Document that MCQ address space as
    optional to maintain backwards compatibility and because Linux
    drivers can operate perfectly fine without it (thus without MCQ
    feature).  Linux driver already uses "mcq" as possible name for
    "reg-names" property.

The split allows easier review and maintenance of the binding.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Link: https://lore.kernel.org/r/20250731-dt-bindings-ufs-qcom-v2-3-53bb634bf95a@linaro.org
Reviewed-by: Rob Herring (Arm) <robh@kernel.org>
Acked-by: Manivannan Sadhasivam <mani@kernel.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2 months agoscsi: ufs: qcom: dt-bindings: Split SC7180 and similar
Krzysztof Kozlowski [Thu, 31 Jul 2025 07:15:53 +0000 (09:15 +0200)] 
scsi: ufs: qcom: dt-bindings: Split SC7180 and similar

The binding for Qualcomm SoC UFS controllers grew and it will grow
further.  Split SC7180 and several other devices which:

 1. Do not reference ICE as I/O address space, but as a phandle,

 2. Have same order of clocks (SC7180 has one clock less than SC7280 and
    other variants in split binding).

The split allows easier review and maintenance of the binding.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Link: https://lore.kernel.org/r/20250731-dt-bindings-ufs-qcom-v2-2-53bb634bf95a@linaro.org
Reviewed-by: Rob Herring (Arm) <robh@kernel.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2 months agoscsi: ufs: qcom: dt-bindings: Split common part to qcom,ufs-common.yaml
Krzysztof Kozlowski [Thu, 31 Jul 2025 07:15:52 +0000 (09:15 +0200)] 
scsi: ufs: qcom: dt-bindings: Split common part to qcom,ufs-common.yaml

The binding for Qualcomm SoC UFS controllers grew and it will grow
further.  It already includes several conditionals, partially for
difference in handling encryption block (ICE, either as phandle or as
I/O address space) but it will further grow for MCQ.

Prepare for splitting this one big binding into several ones for common
group of devices by defining common part for all Qualcomm UFS schemas.

This only moves code, no functional impact expected.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Link: https://lore.kernel.org/r/20250731-dt-bindings-ufs-qcom-v2-1-53bb634bf95a@linaro.org
Reviewed-by: Rob Herring (Arm) <robh@kernel.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2 months agoLinux 6.17-rc1 v6.17-rc1
Linus Torvalds [Sun, 10 Aug 2025 16:41:16 +0000 (19:41 +0300)] 
Linux 6.17-rc1

2 months agoMerge tag 'turbostat-2025.09.09' of git://git.kernel.org/pub/scm/linux/kernel/git...
Linus Torvalds [Sun, 10 Aug 2025 06:02:36 +0000 (09:02 +0300)] 
Merge tag 'turbostat-2025.09.09' of git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux

Pull turbostat updates from Len Brown:
 "tools/power turbostat: version 2025.09.09

   - Probe and display L3 Cache topology

   - Add ability to average an added counter (useful for pre-integrated
     "counters", such as Watts)

   - Break the limit of 64 built-in counters

   - Assorted bug fixes and minor feature tweaks"

* tag 'turbostat-2025.09.09' of git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux:
  tools/power turbostat: version 2025.09.09
  tools/power turbostat: Handle non-root legacy-uncore sysfs permissions
  tools/power turbostat: standardize PER_THREAD_PARAMS
  tools/power turbostat: Fix DMR support
  tools/power turbostat: add format "average" for external attributes
  tools/power turbostat: delete GET_PKG()
  tools/power turbostat: probe and display L3 cache topology
  tools/power turbostat: Support more than 64 built-in-counters
  tools/power turbostat.8: Document Totl%C0, Any%C0, GFX%C0, CPUGFX% columns
  tools/power turbostat: Fix bogus SysWatt for forked program
  tools/power turbostat: Handle cap_get_proc() ENOSYS
  tools/power turbostat: Fix build with musl
  tools/power turbostat: verify arguments to params --show and --hide
  tools/power turbostat: regression fix: --show C1E%

2 months agoMerge tag 'smp_urgent_for_v6.17_rc1' of git://git.kernel.org/pub/scm/linux/kernel...
Linus Torvalds [Sun, 10 Aug 2025 05:51:37 +0000 (08:51 +0300)] 
Merge tag 'smp_urgent_for_v6.17_rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

Pull smp fixes from Borislav Petkov:

 - Remove an obsolete comment and fix spelling

* tag 'smp_urgent_for_v6.17_rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  cpu: Remove obsolete comment from takedown_cpu()
  smp: Fix spelling in on_each_cpu_cond_mask()'s doc-comment

2 months agoMerge tag 'irq_urgent_for_v6.17_rc1' of git://git.kernel.org/pub/scm/linux/kernel...
Linus Torvalds [Sun, 10 Aug 2025 05:46:47 +0000 (08:46 +0300)] 
Merge tag 'irq_urgent_for_v6.17_rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

Pull irq fixes from Borislav Petkov:

 - Fix a wrong ioremap size in mvebu-gicp

 - Remove yet another compile-test case for a driver which needs an
   additional dependency

 - Fix a lock inversion scenario in the IRQ unit test suite

 - Remove an impossible flag situation in gic-v5

 - Do not iounmap resources in gic-v5 which are managed by devm

 - Make sure stale, left-over interrupts in mvebu-gicp are cleared on
   driver init

 - Fix a reference counting mishap in msi-lib

 - Fix a dereference-before-null-ptr-check case in the riscv-imsic
   irqchip driver

* tag 'irq_urgent_for_v6.17_rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  irqchip/mvebu-gicp: Use resource_size() for ioremap()
  irqchip: Build IMX_MU_MSI only on ARM
  genirq/test: Resolve irq lock inversion warnings
  irqchip/gic-v5: Remove IRQD_RESEND_WHEN_IN_PROGRESS for ITS IRQs
  irqchip/gic-v5: iwb: Fix iounmap probe failure path
  irqchip/mvebu-gicp: Clear pending interrupts on init
  irqchip/msi-lib: Fix fwnode refcount in msi_lib_irq_domain_select()
  irqchip/riscv-imsic: Don't dereference before NULL pointer check

2 months agoMerge tag 'x86_urgent_for_v6.17_rc1' of git://git.kernel.org/pub/scm/linux/kernel...
Linus Torvalds [Sun, 10 Aug 2025 05:15:32 +0000 (08:15 +0300)] 
Merge tag 'x86_urgent_for_v6.17_rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

Pull x86 fixes from Borislav Petkov:

 - Fix an interrupt vector setup race which leads to a non-functioning
   device

 - Add new Intel CPU models *and* a family: 0x12. Finally. Yippie! :-)

* tag 'x86_urgent_for_v6.17_rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  x86/irq: Plug vector setup race
  x86/cpu: Add new Intel CPU model numbers for Wildcatlake and Novalake

2 months agoMerge tag 'locking_urgent_for_v6.17_rc1' of git://git.kernel.org/pub/scm/linux/kernel...
Linus Torvalds [Sun, 10 Aug 2025 05:11:39 +0000 (08:11 +0300)] 
Merge tag 'locking_urgent_for_v6.17_rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

Pull locking fix from Borislav Petkov:

 - Prevent a futex hash leak due to different mm lifetimes

* tag 'locking_urgent_for_v6.17_rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  futex: Move futex cleanup to __mmdrop()

2 months agotools/power turbostat: version 2025.09.09
Len Brown [Sun, 10 Aug 2025 01:08:26 +0000 (21:08 -0400)] 
tools/power turbostat: version 2025.09.09

Probe and display L3 Cache topology
Add ability to average an added counter
(useful for pre-integrated "counters", such as Watts)
Break the limit of 64 built-in counters.
Assorted bug fixes and minor feature tweaks

Signed-off-by: Len Brown <len.brown@intel.com>
2 months agotools/power turbostat: Handle non-root legacy-uncore sysfs permissions
Len Brown [Sat, 9 Aug 2025 20:31:31 +0000 (16:31 -0400)] 
tools/power turbostat: Handle non-root legacy-uncore sysfs permissions

/sys/devices/system/cpu/intel_uncore_frequency/package_X_die_Y/
may be readable by all, but
/sys/devices/system/cpu/intel_uncore_frequency/package_X_die_Y/current_freq_khz
may be readable only by root.

Non-root turbostat users see complaints in this scenario.

Fail probe of the interface if we can't read current_freq_khz.

Reported-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
Original-patch-by: Zhang Rui <rui.zhang@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
2 months agotools/power turbostat: standardize PER_THREAD_PARAMS
Len Brown [Fri, 8 Aug 2025 23:30:07 +0000 (19:30 -0400)] 
tools/power turbostat: standardize PER_THREAD_PARAMS

use a macro for PER_THREAD_PARAMS to make adding one later more clear.

no functional change

Signed-off-by: Len Brown <len.brown@intel.com>
2 months agotools/power turbostat: Fix DMR support
Zhang Rui [Wed, 11 Jun 2025 06:50:26 +0000 (14:50 +0800)] 
tools/power turbostat: Fix DMR support

Together with the RAPL MSRs, there are more MSRs gone on DMR, including
PLR (Perf Limit Reasons), and IRTL (Package cstate Interrupt Response
Time Limit) MSRs. The configurable TDP info should also be retrieved
from TPMI based Intel Speed Select Technology feature.

Remove the access of these MSRs for DMR. Improve the DMR platform
feature table to make it more readable at the same time.

Fixes: 83075bd59de2 ("tools/power turbostat: Add initial support for DMR")
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
2 months agotools/power turbostat: add format "average" for external attributes
Michael Hebenstreit [Fri, 8 Aug 2025 19:57:53 +0000 (15:57 -0400)] 
tools/power turbostat: add format "average" for external attributes

External atributes with format "raw" are not printed in summary lines
for nodes/packages (or with option -S). The new format "average"
behaves like "raw" but also adds the summary data

Signed-off-by: Michael Hebenstreit <michael.hebenstreit@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
2 months agotools/power turbostat: delete GET_PKG()
Len Brown [Tue, 22 Jul 2025 04:17:04 +0000 (00:17 -0400)] 
tools/power turbostat: delete GET_PKG()

pkg_base[pkg_id] is a simple array of structure pointers,
let the compiler treat it that way.

Signed-off-by: Len Brown <len.brown@intel.com>
2 months agotools/power turbostat: probe and display L3 cache topology
Len Brown [Tue, 15 Jul 2025 03:33:55 +0000 (23:33 -0400)] 
tools/power turbostat: probe and display L3 cache topology

Signed-off-by: Len Brown <len.brown@intel.com>
2 months agotools/power turbostat: Support more than 64 built-in-counters
Len Brown [Sat, 12 Jul 2025 20:16:56 +0000 (16:16 -0400)] 
tools/power turbostat: Support more than 64 built-in-counters

We have out-grown the ability to use a 64-bit memory location
to inventory every possible built-in counter.
Leverage the the CPU_SET(3) macros to break this barrier.

Also, break the Joules & Watts counters into two,
since we can no longer 'or' them together...

Signed-off-by: Len Brown <len.brown@intel.com>
2 months agotools/power turbostat.8: Document Totl%C0, Any%C0, GFX%C0, CPUGFX% columns
Len Brown [Mon, 23 Jun 2025 20:24:25 +0000 (13:24 -0700)] 
tools/power turbostat.8: Document Totl%C0, Any%C0, GFX%C0, CPUGFX% columns

Explain the meaning of the Totl%C0, Any%C0, GFX%C0, CPUGFX% columns.

Signed-off-by: Len Brown <len.brown@intel.com>
2 months agoMerge tag 'tty-6.16-rc1-2' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty
Linus Torvalds [Sat, 9 Aug 2025 15:12:23 +0000 (18:12 +0300)] 
Merge tag 'tty-6.16-rc1-2' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty

Pull TTY fix from Greg KH:
 "Here is a single revert of one of the previous patches that went in
  the last tty/serial merge that is breaking userspace on some platforms
  (specifically powerpc, probably a few others.)

  It accidentially changed the ioctl values of some tty ioctls, which
  breaks xorg.

  The revert has been in linux-next all this week with no reported
  issues"

* tag 'tty-6.16-rc1-2' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty:
  Revert "tty: vt: use _IO() to define ioctl numbers"

2 months agoMerge tag 'efi-next-for-v6.17' of git://git.kernel.org/pub/scm/linux/kernel/git/efi/efi
Linus Torvalds [Sat, 9 Aug 2025 15:10:01 +0000 (18:10 +0300)] 
Merge tag 'efi-next-for-v6.17' of git://git.kernel.org/pub/scm/linux/kernel/git/efi/efi

Pull EFI updates from Ard Biesheuvel:

 - Expose the OVMF firmware debug log via sysfs

 - Lower the default log level for the EFI stub to avoid corrupting any
   splash screens with unimportant diagnostic output

* tag 'efi-next-for-v6.17' of git://git.kernel.org/pub/scm/linux/kernel/git/efi/efi:
  efi: add API doc entry for ovmf_debug_log
  efistub: Lower default log level
  efi: add ovmf debug log driver

2 months agoMerge tag 'bpf-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf
Linus Torvalds [Sat, 9 Aug 2025 06:03:21 +0000 (09:03 +0300)] 
Merge tag 'bpf-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf

Pull bpf fixes from Alexei Starovoitov:

 - Fix memory leak of bpf_scc_info objects (Eduard Zingerman)

 - Fix a regression in the 'perf' tool caused by moving UID filtering to
   BPF (Ilya Leoshkevich)

* tag 'bpf-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf:
  perf bpf-filter: Enable events manually
  libbpf: Add the ability to suppress perf event enablement
  bpf: Fix memory leak of bpf_scc_info objects

2 months agoMerge tag 'block-6.17-20250808' of git://git.kernel.dk/linux
Linus Torvalds [Sat, 9 Aug 2025 05:47:28 +0000 (08:47 +0300)] 
Merge tag 'block-6.17-20250808' of git://git.kernel.dk/linux

Pull more block updates from Jens Axboe:

 - MD pull request via Yu:
      - mddev null-ptr-dereference fix, by Erkun
      - md-cluster fail to remove the faulty disk regression fix, by
        Heming
      - minor cleanup, by Li Nan and Jinchao
      - mdadm lifetime regression fix reported by syzkaller, by Yu Kuai

 - MD pull request via Christoph
      - add support for getting the FDP featuee in fabrics passthru path
        (Nitesh Shetty)
      - add capability to connect to an administrative controller
        (Kamaljit Singh)
      - fix a leak on sgl setup error (Keith Busch)
      - initialize discovery subsys after debugfs is initialized
        (Mohamed Khalfella)
      - fix various comment typos (Bjorn Helgaas)
      - remove unneeded semicolons (Jiapeng Chong)

 - nvmet debugfs ordering issue fix

 - Fix UAF in the tag_set in zloop

 - Ensure sbitmap shallow depth covers entire set

 - Reduce lock roundtrips in io context lookup

 - Move scheduler tags alloc/free out of elevator and freeze lock, to
   fix some lockdep found issues

 - Improve robustness of queue limits checking

 - Fix a regression with IO priorities, if no io context exists

* tag 'block-6.17-20250808' of git://git.kernel.dk/linux: (26 commits)
  lib/sbitmap: make sbitmap_get_shallow() internal
  lib/sbitmap: convert shallow_depth from one word to the whole sbitmap
  nvmet: exit debugfs after discovery subsystem exits
  block, bfq: Reorder struct bfq_iocq_bfqq_data
  md: make rdev_addable usable for rcu mode
  md/raid1: remove struct pool_info and related code
  md/raid1: change r1conf->r1bio_pool to a pointer type
  block: ensure discard_granularity is zero when discard is not supported
  zloop: fix KASAN use-after-free of tag set
  block: Fix default IO priority if there is no IO context
  nvme: fix various comment typos
  nvme-auth: remove unneeded semicolon
  nvme-pci: fix leak on sgl setup error
  nvmet: initialize discovery subsys after debugfs is initialized
  nvme: add capability to connect to an administrative controller
  nvmet: add support for FDP in fabrics passthru path
  md: rename recovery_cp to resync_offset
  md/md-cluster: handle REMOVE message earlier
  md: fix create on open mddev lifetime regression
  block: fix potential deadlock while running nr_hw_queue update
  ...

2 months agoMerge tag 'io_uring-6.17-20250808' of git://git.kernel.dk/linux
Linus Torvalds [Sat, 9 Aug 2025 05:45:08 +0000 (08:45 +0300)] 
Merge tag 'io_uring-6.17-20250808' of git://git.kernel.dk/linux

Pull io_uring fixes from Jens Axboe:

 - Allow vectorized payloads for send/send-zc - like sendmsg, but
   without the hassle of a msghdr.

 - Fix for an integer wrap that should go to stable, spotted by syzbot.
   Nothing alarming here, as you need to be root to hit this.
   Nevertheless, it should get fixed.

   FWIW, kudos to the syzbot crew for having much nicer reproducers now,
   and with nicely annotated source code as well. This is particularly
   useful as syzbot uses the raw interface rather than liburing,
   historically it's been difficult to turn a syzbot reproducer into a
   meaningful test case. With the recent changes, not true anymore!

* tag 'io_uring-6.17-20250808' of git://git.kernel.dk/linux:
  io_uring/memmap: cast nr_pages to size_t before shifting
  io_uring/net: Allow to do vectorized send

2 months agoMerge tag 'spi-fix-v6.17-merge-window' of git://git.kernel.org/pub/scm/linux/kernel...
Linus Torvalds [Sat, 9 Aug 2025 05:43:24 +0000 (08:43 +0300)] 
Merge tag 'spi-fix-v6.17-merge-window' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi

Pull spi fixes from Mark Brown:
 "There's one fix here for an issue with the CS42L43 where we were
  allocating a single property for client devices as just that property
  rather than a terminated array of properties like we are supposed to.

  We also have an update to the MAINTAINERS file for some Renesas
  devices"

* tag 'spi-fix-v6.17-merge-window' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi:
  spi: cs42l43: Property entry should be a null-terminated array
  MAINTAINERS: Add entries for the RZ/V2H(P) RSPI

2 months agoMerge tag 'regulator-fix-v6.17-merge-window' of git://git.kernel.org/pub/scm/linux...
Linus Torvalds [Sat, 9 Aug 2025 05:41:53 +0000 (08:41 +0300)] 
Merge tag 'regulator-fix-v6.17-merge-window' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator

Pull regulator fix from Mark Brown:
 "This fixes an issue with the newly added code for handling large
  voltage changes on regulators which require that individual voltage
  changes cover a limited range, the check for convergence was broken"

* tag 'regulator-fix-v6.17-merge-window' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator:
  regulator: core: correct convergence check in regulator_set_voltage()