linux-block.git
2 months agoMerge patch series "Update lpfc to revision 14.4.0.9"
Martin K. Petersen [Tue, 29 Apr 2025 01:38:51 +0000 (21:38 -0400)]
Merge patch series "Update lpfc to revision 14.4.0.9"

Justin Tee <justintee8345@gmail.com> says:

Update lpfc to revision 14.4.0.9

This patch set contains fixes related to handling of WQE commands, PCI
function resets, firmware eratta events, ELS retries, a smatch
use-after-free warning, and the creation of a new VMID information entry.

The patches were cut against Martin's 6.16/scsi-queue tree.

Link: https://lore.kernel.org/r/20250425194806.3585-1-justintee8345@gmail.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2 months agoscsi: lpfc: Copyright updates for 14.4.0.9 patches
Justin Tee [Fri, 25 Apr 2025 19:48:06 +0000 (12:48 -0700)]
scsi: lpfc: Copyright updates for 14.4.0.9 patches

Update copyrights to 2025 for files modified in the 14.4.0.9 patch set.

Signed-off-by: Justin Tee <justin.tee@broadcom.com>
Link: https://lore.kernel.org/r/20250425194806.3585-9-justintee8345@gmail.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2 months agoscsi: lpfc: Update lpfc version to 14.4.0.9
Justin Tee [Fri, 25 Apr 2025 19:48:05 +0000 (12:48 -0700)]
scsi: lpfc: Update lpfc version to 14.4.0.9

Update lpfc version to 14.4.0.9

Signed-off-by: Justin Tee <justin.tee@broadcom.com>
Link: https://lore.kernel.org/r/20250425194806.3585-8-justintee8345@gmail.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2 months agoscsi: lpfc: Create lpfc_vmid_info sysfs entry
Justin Tee [Fri, 25 Apr 2025 19:48:04 +0000 (12:48 -0700)]
scsi: lpfc: Create lpfc_vmid_info sysfs entry

A vmid_info sysfs entry is created as a convenience designed for users to
obtain VMID information without having to log into fabrics for similar
info.

Signed-off-by: Justin Tee <justin.tee@broadcom.com>
Link: https://lore.kernel.org/r/20250425194806.3585-7-justintee8345@gmail.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2 months agoscsi: lpfc: Avoid potential ndlp use-after-free in dev_loss_tmo_callbk
Justin Tee [Fri, 25 Apr 2025 19:48:03 +0000 (12:48 -0700)]
scsi: lpfc: Avoid potential ndlp use-after-free in dev_loss_tmo_callbk

Smatch detected a potential use-after-free of an ndlp oject in
dev_loss_tmo_callbk during driver unload or fatal error handling.

Fix by reordering code to avoid potential use-after-free if initial
nodelist reference has been previously removed.

Fixes: 4281f44ea8bf ("scsi: lpfc: Prevent NDLP reference count underflow in dev_loss_tmo callback")
Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
Closes: https://lore.kernel.org/linux-scsi/41c1d855-9eb5-416f-ac12-8b61929201a3@stanley.mountain/
Signed-off-by: Justin Tee <justin.tee@broadcom.com>
Link: https://lore.kernel.org/r/20250425194806.3585-6-justintee8345@gmail.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2 months agoscsi: lpfc: Prevent failure to reregister with NVMe transport after PRLI retry
Justin Tee [Fri, 25 Apr 2025 19:48:02 +0000 (12:48 -0700)]
scsi: lpfc: Prevent failure to reregister with NVMe transport after PRLI retry

A failure to unregister with the NVMe transport may occur when a PRLI is
retried.

Remove duplicate testing of NLP_NVME_TARGET flag. Add a secondary check
of the registered state based on the nrport information.  Further qualify
the ndlp reference count modification when nvme_fc_register_remoteport()
returns an error.

Signed-off-by: Justin Tee <justin.tee@broadcom.com>
Link: https://lore.kernel.org/r/20250425194806.3585-5-justintee8345@gmail.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2 months agoscsi: lpfc: Restart eratt_poll timer if HBA_SETUP flag still unset
Justin Tee [Fri, 25 Apr 2025 19:48:01 +0000 (12:48 -0700)]
scsi: lpfc: Restart eratt_poll timer if HBA_SETUP flag still unset

Reschedule the eratt_poll timer if the HBA_SETUP flag isn’t set yet.  The
eratt_poll timer should only be cancelled if FC_UNLOADING flag is set or
if lpfc_stop_hba_timers() is called as part of error, reset, or offline
handling.

Signed-off-by: Justin Tee <justin.tee@broadcom.com>
Link: https://lore.kernel.org/r/20250425194806.3585-4-justintee8345@gmail.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2 months agoscsi: lpfc: Notify FC transport of rport disappearance during PCI fcn reset
Justin Tee [Fri, 25 Apr 2025 19:48:00 +0000 (12:48 -0700)]
scsi: lpfc: Notify FC transport of rport disappearance during PCI fcn reset

A PCI function reset implies a temporary disappearance of a fc_rport.
So, call lpfc_scsi_dev_block(), which sets all mapped fc_rports into the
temporary FC_PORTSTATE_BLOCKED state.  Once PCI function reset completes
and link reinitialized, the fc_rport is rediscovered and
FC_PORTSTATE_BLOCKED state is removed.

Signed-off-by: Justin Tee <justin.tee@broadcom.com>
Link: https://lore.kernel.org/r/20250425194806.3585-3-justintee8345@gmail.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2 months agoscsi: lpfc: Fix lpfc_check_sli_ndlp() handling for GEN_REQUEST64 commands
Justin Tee [Fri, 25 Apr 2025 19:47:59 +0000 (12:47 -0700)]
scsi: lpfc: Fix lpfc_check_sli_ndlp() handling for GEN_REQUEST64 commands

In lpfc_check_sli_ndlp(), the get_job_els_rsp64_did remote_id assignment
does not apply for GEN_REQUEST64 commands as it only has meaning for a
ELS_REQUEST64 command.  So, if (iocb->ndlp == ndlp) is false, we could
erroneously return the wrong value.  Fix by replacing the fallthrough
statement with a break statement before the remote_id check.

Signed-off-by: Justin Tee <justin.tee@broadcom.com>
Link: https://lore.kernel.org/r/20250425194806.3585-2-justintee8345@gmail.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2 months agoscsi: qla4xxx: Remove duplicate struct crb_addr_pair
Kees Cook [Sat, 26 Apr 2025 06:20:11 +0000 (23:20 -0700)]
scsi: qla4xxx: Remove duplicate struct crb_addr_pair

In preparation for making the kmalloc family of allocators type aware, we
need to make sure that the returned type from the allocation matches the
type of the variable being assigned. (Before, the allocator would always
return "void *", which can be implicitly cast to any pointer type.)

The assigned type is "struct crb_addr_pair *" and the returned type will
be a _different_ "struct crb_addr_pair *", causing a warning. This really
stumped me for a bit. :) Drop the redundant declaration.

Signed-off-by: Kees Cook <kees@kernel.org>
Link: https://lore.kernel.org/r/20250426062010.work.878-kees@kernel.org
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2 months agoscsi: qla2xxx: Remove duplicate struct crb_addr_pair
Kees Cook [Sat, 26 Apr 2025 06:19:52 +0000 (23:19 -0700)]
scsi: qla2xxx: Remove duplicate struct crb_addr_pair

In preparation for making the kmalloc family of allocators type aware, we
need to make sure that the returned type from the allocation matches the
type of the variable being assigned. (Before, the allocator would always
return "void *", which can be implicitly cast to any pointer type.)

The assigned type is "struct crb_addr_pair *" and the returned type will
be a _different_ "struct crb_addr_pair *", causing a warning. This really
stumped me for a bit. :) Drop the redundant declaration.

Signed-off-by: Kees Cook <kees@kernel.org>
Link: https://lore.kernel.org/r/20250426061951.work.272-kees@kernel.org
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2 months agoscsi: lpfc: Use secs_to_jiffies() instead of msecs_to_jiffies()
Thorsten Blum [Mon, 28 Apr 2025 17:16:26 +0000 (19:16 +0200)]
scsi: lpfc: Use secs_to_jiffies() instead of msecs_to_jiffies()

Use secs_to_jiffies() instead of msecs_to_jiffies() and avoid scaling the
timeouts to milliseconds.

No functional changes intended.

Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
Link: https://lore.kernel.org/r/20250428171625.2499-2-thorsten.blum@linux.dev
Reviewed-by: Justin Tee <justin.tee@broadcom.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2 months agoscsi: dc395x: Remove DEBUG conditional compilation
Oliver Neukum [Mon, 28 Apr 2025 12:43:45 +0000 (14:43 +0200)]
scsi: dc395x: Remove DEBUG conditional compilation

Building dc395x with debugging enabled has been broken for ages.  This
driver needs to be converted to dynamic debugging.  Remove the crud.

Fixes: a862ea31655a ("[SCSI] dc395x: convert to use the data buffer accessors")
Signed-off-by: Oliver Neukum <oneukum@suse.com>
Link: https://lore.kernel.org/r/20250428124345.520137-1-oneukum@suse.com
Reviewed-by: Colin Ian King <colin.i.king@gmail.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2 months agoscsi: ufs: core: Fix WB resize using wrong offset
Huan Tang [Wed, 23 Apr 2025 09:29:17 +0000 (17:29 +0800)]
scsi: ufs: core: Fix WB resize using wrong offset

Commit 500d4b742e0c ("scsi: ufs: core: Add WB buffer resize support")
incorrectly reads the value of offset
DEVICE_DESC_PARAM_EXT_UFS_FEATURE_SUP to determine whether WB resize is
supported.

Fix the issue by reading the value of DEVICE_DESC_PARAM_EXT_WB_SUP to
determine whether the device supports WB resize.

Fixes: 500d4b742e0c ("scsi: ufs: core: Add WB buffer resize support")
Reported-by: Peter Wang <peter.wang@mediatek.com>
Closes: https://lore.kernel.org/all/7ce05b28f5d4b4b4973244310010c1487
Signed-off-by: Huan Tang <tanghuan@vivo.com>
Link: https://lore.kernel.org/r/20250423092917.1031-1-tanghuan@vivo.com
Reviewed-by: Peter Wang <peter.wang@mediatek.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2 months agoMerge branch '6.15/scsi-fixes' into 6.16/scsi-staging
Martin K. Petersen [Tue, 29 Apr 2025 00:56:57 +0000 (20:56 -0400)]
Merge branch '6.15/scsi-fixes' into 6.16/scsi-staging

Pull in fixes from 6.15 and resolve a few conflicts so we can have a
clean base for UFS patches.

Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2 months agoMerge patch series "scsi: qedi deadcoding"
Martin K. Petersen [Tue, 22 Apr 2025 01:52:45 +0000 (21:52 -0400)]
Merge patch series "scsi: qedi deadcoding"

linux@treblig.org says:

Hi,
  A couple of deadcode patches for the qdi driver.

Build tested only.

Dave

Signed-off-by: Dr. David Alan Gilbert <linux@treblig.org>
Link: https://lore.kernel.org/r/20250416002235.299347-1-linux@treblig.org
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2 months agoMerge patch series "scsi: qla2xxx deadcoding"
Martin K. Petersen [Tue, 22 Apr 2025 01:52:15 +0000 (21:52 -0400)]
Merge patch series "scsi: qla2xxx deadcoding"

linux@treblig.org says:

Hi,
  This is a batch of deadcoding on the qla2xxx driver.
Note the last patch removes two unused module
parameters, so I guess if anyone has that in some configs
somewhere that might surprise them.

Other than that, it's all simple function deletion.

Build tested only.

Signed-off-by: Dr. David Alan Gilbert <linux@treblig.org>
Link: https://lore.kernel.org/r/20250415002803.135909-1-linux@treblig.org
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2 months agoMerge patch series "hisi_sas: Misc patches and cleanups"
Martin K. Petersen [Tue, 22 Apr 2025 01:51:51 +0000 (21:51 -0400)]
Merge patch series "hisi_sas: Misc patches and cleanups"

Yihang Li <liyihang9@huawei.com> says:

This series contains some minor bugfix and general tidying:
- Ignore the soft reset result by calling I_T_nexus after the SATA disk
  is soft reset
- General minor tidying

Link: https://lore.kernel.org/r/20250331123349.99591-1-liyihang9@huawei.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2 months agoscsi: qedi: Remove unused qedi_get_proto_itt()
Dr. David Alan Gilbert [Wed, 16 Apr 2025 00:22:35 +0000 (01:22 +0100)]
scsi: qedi: Remove unused qedi_get_proto_itt()

qedi_get_proto_itt() last use was removed in 2021 by commit ed1b86ba0fba
("scsi: qedi: Wake up if cmd_cleanup_req is set")

Remove it.

Signed-off-by: Dr. David Alan Gilbert <linux@treblig.org>
Link: https://lore.kernel.org/r/20250416002235.299347-3-linux@treblig.org
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2 months agoscsi: qedi: Remove unused sysfs functions
Dr. David Alan Gilbert [Wed, 16 Apr 2025 00:22:34 +0000 (01:22 +0100)]
scsi: qedi: Remove unused sysfs functions

qedi_remove_sysfs_attr() and qedi_create_sysfs_attr() were added in 2016
by commit ace7f46ba5fd ("scsi: qedi: Add QLogic FastLinQ offload iSCSI
driver framework.")  but have remained unused.

Remove them.

Signed-off-by: Dr. David Alan Gilbert <linux@treblig.org>
Link: https://lore.kernel.org/r/20250416002235.299347-2-linux@treblig.org
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2 months agoscsi: qla2xxx: Remove unused module parameters
Dr. David Alan Gilbert [Tue, 15 Apr 2025 00:28:03 +0000 (01:28 +0100)]
scsi: qla2xxx: Remove unused module parameters

ql2xetsenable last use was removed in 2020 by commit 37efd51f75f3 ("scsi:
qla2xxx: Use FC generic update firmware options routine for ISP27xx")

ql2xiidmaenable last use was removed in 2017 by commit 726b85487067
("qla2xxx: Add framework for async fabric discovery")

Remove them.

Signed-off-by: Dr. David Alan Gilbert <linux@treblig.org>
Link: https://lore.kernel.org/r/20250415002803.135909-9-linux@treblig.org
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2 months agoscsi: qla2xxx: Remove unused qla2x00_gpsc()
Dr. David Alan Gilbert [Tue, 15 Apr 2025 00:28:02 +0000 (01:28 +0100)]
scsi: qla2xxx: Remove unused qla2x00_gpsc()

qla2x00_gpsc() was added in 2017 as part of commit 726b85487067
("qla2xxx: Add framework for async fabric discovery") but has remained
unused.

Remove it.

Signed-off-by: Dr. David Alan Gilbert <linux@treblig.org>
Link: https://lore.kernel.org/r/20250415002803.135909-8-linux@treblig.org
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2 months agoscsi: qla2xxx: Remove unused ql_log_qp
Dr. David Alan Gilbert [Tue, 15 Apr 2025 00:28:01 +0000 (01:28 +0100)]
scsi: qla2xxx: Remove unused ql_log_qp

ql_log_qp() was added in 2017 as part of commit 22d84726e3b8 ("scsi:
qla2xxx: Add debug logging routine for qpair") but has remained unused.

Remove it. (That patch also added ql_dbg_qp but that is still used so is
left in).

Signed-off-by: Dr. David Alan Gilbert <linux@treblig.org>
Link: https://lore.kernel.org/r/20250415002803.135909-7-linux@treblig.org
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2 months agoscsi: qla2xxx: Remove unused qla82xx_wait_for_state_change()
Dr. David Alan Gilbert [Tue, 15 Apr 2025 00:28:00 +0000 (01:28 +0100)]
scsi: qla2xxx: Remove unused qla82xx_wait_for_state_change()

qla82xx_wait_for_state_change() was added in 2010 as part of commit
579d12b58abb ("[SCSI] qla2xxx: Added support for quiescence mode for
ISP82xx.")  but has remained unused.

Remove it.

Signed-off-by: Dr. David Alan Gilbert <linux@treblig.org>
Link: https://lore.kernel.org/r/20250415002803.135909-6-linux@treblig.org
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2 months agoscsi: qla2xxx: Remove unused qla82xx_pci_region_offset()
Dr. David Alan Gilbert [Tue, 15 Apr 2025 00:27:59 +0000 (01:27 +0100)]
scsi: qla2xxx: Remove unused qla82xx_pci_region_offset()

qla82xx_pci_region_offset() has been unused since the last use was
removed by 2010's commit 3711333dfbee ("[SCSI] qla2xxx: Updates for
ISP82xx.")

Remove it.

Signed-off-by: Dr. David Alan Gilbert <linux@treblig.org>
Link: https://lore.kernel.org/r/20250415002803.135909-5-linux@treblig.org
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2 months agoscsi: qla2xxx: Remove unused qlt_83xx_iospace_config()
Dr. David Alan Gilbert [Tue, 15 Apr 2025 00:27:58 +0000 (01:27 +0100)]
scsi: qla2xxx: Remove unused qlt_83xx_iospace_config()

qlt_83xx_iospace_config() has been unused since the last use was removed
by 2017's commit f54f2cb540b5 ("scsi: qla2xxx: Cleaned up queue
configuration code.")

Remove it.

Signed-off-by: Dr. David Alan Gilbert <linux@treblig.org>
Link: https://lore.kernel.org/r/20250415002803.135909-4-linux@treblig.org
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2 months agoscsi: qla2xxx: Remove unused qlt_fc_port_deleted()
Dr. David Alan Gilbert [Tue, 15 Apr 2025 00:27:57 +0000 (01:27 +0100)]
scsi: qla2xxx: Remove unused qlt_fc_port_deleted()

qlt_fc_port_deleted() has been unused since the last use was removed by
2017's commit 726b85487067 ("qla2xxx: Add framework for async fabric
discovery")

Remove it.

Signed-off-by: Dr. David Alan Gilbert <linux@treblig.org>
Link: https://lore.kernel.org/r/20250415002803.135909-3-linux@treblig.org
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2 months agoscsi: qla2xxx: Remove unused qlt_free_qfull_cmds()
Dr. David Alan Gilbert [Tue, 15 Apr 2025 00:27:56 +0000 (01:27 +0100)]
scsi: qla2xxx: Remove unused qlt_free_qfull_cmds()

qlt_free_qfull_cmds() was added in 2014 as part of commit 33e799775593
("qla2xxx: Add support for QFull throttling and Term Exchange retry") but
has remained unused.

Remove it.

Signed-off-by: Dr. David Alan Gilbert <linux@treblig.org>
Link: https://lore.kernel.org/r/20250415002803.135909-2-linux@treblig.org
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2 months agoscsi: hisi_sas: Wait until error handling is complete
Yihang Li [Mon, 14 Apr 2025 08:08:45 +0000 (16:08 +0800)]
scsi: hisi_sas: Wait until error handling is complete

SATA devices are lost when FLR is performed while the controller and disks
are in suspended state.

This is because the libata layer is called to initialize the SATA device
during controller resume. If FLR is executed at this time, the IDENTIFY
command fails. As a result, the revalidate fails, and the SATA device is
disabled by the libata layer.

Wait until error handling completes.

Signed-off-by: Yihang Li <liyihang9@huawei.com>
Link: https://lore.kernel.org/r/20250414080845.1220997-5-liyihang9@huawei.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2 months agoscsi: hisi_sas: Call I_T_nexus after soft reset for SATA disk
Yihang Li [Mon, 14 Apr 2025 08:08:44 +0000 (16:08 +0800)]
scsi: hisi_sas: Call I_T_nexus after soft reset for SATA disk

In commit 21c7e972475e ("scsi: hisi_sas: Disable SATA disk phy for severe
I_T nexus reset failure"), if the softreset fails upon certain
conditions, the PHY connected to the disk is disabled directly. Manual
recovery is required, which is inconvenient for users in actual use.

In addition, SATA disks do not support simultaneous connection of multiple
hosts. Therefore, when multiple controllers are connected to a SATA disk
at the same time, the controller which is connected later failed to issue
an ATA softreset to the SATA disk. As a result, the PHY associated with
the disk is disabled and cannot be automatically recovered.

Now that, we will not focus on the execution result of softreset. No
matter whether the execution is successful or not, we will directly carry
out I_T_nexus_reset.

Fixes: 21c7e972475e ("scsi: hisi_sas: Disable SATA disk phy for severe I_T nexus reset failure")
Signed-off-by: Yihang Li <liyihang9@huawei.com>
Link: https://lore.kernel.org/r/20250414080845.1220997-4-liyihang9@huawei.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2 months agoscsi: hisi_sas: Coding style cleanup
Yihang Li [Mon, 14 Apr 2025 08:08:43 +0000 (16:08 +0800)]
scsi: hisi_sas: Coding style cleanup

Remove superfluous blank lines and symbols. Add spaces around operators.

Signed-off-by: Yihang Li <liyihang9@huawei.com>
Link: https://lore.kernel.org/r/20250414080845.1220997-3-liyihang9@huawei.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2 months agoscsi: hisi_sas: Use macro instead of magic number
Yihang Li [Mon, 14 Apr 2025 08:08:42 +0000 (16:08 +0800)]
scsi: hisi_sas: Use macro instead of magic number

The hisi_sas driver has a large number of magic numbers which makes for
unfriendly code reading. Use macro definitions instead.

Signed-off-by: Yihang Li <liyihang9@huawei.com>
Link: https://lore.kernel.org/r/20250414080845.1220997-2-liyihang9@huawei.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2 months agoscsi: mpi3mr: Fix typo and grammar
Chelsy Ratnawat [Sat, 19 Apr 2025 22:59:06 +0000 (15:59 -0700)]
scsi: mpi3mr: Fix typo and grammar

Corrected grammar, spelling, and formatting in the kernel-doc comment
for mpi3mr_os_handle_events() to follow kernel-doc style and improve
clarity.

Signed-off-by: Chelsy Ratnawat <chelsyratnawat2001@gmail.com>
Link: https://lore.kernel.org/r/20250419225906.31437-1-chelsyratnawat2001@gmail.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2 months agoscsi: mpi3mr: Add level check to control event logging
Ranjan Kumar [Tue, 15 Apr 2025 10:15:46 +0000 (15:45 +0530)]
scsi: mpi3mr: Add level check to control event logging

Ensure event logs are only generated when the debug logging level
MPI3_DEBUG_EVENT is enabled. This prevents unnecessary logging.

Signed-off-by: Ranjan Kumar <ranjan.kumar@broadcom.com>
Link: https://lore.kernel.org/r/20250415101546.204018-1-ranjan.kumar@broadcom.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2 months agoscsi: scsi_transport_fc: Rename del_timer() in comment
WangYuli [Mon, 14 Apr 2025 04:26:27 +0000 (12:26 +0800)]
scsi: scsi_transport_fc: Rename del_timer() in comment

Commit 8fa7292fee5c ("treewide: Switch/rename to timer_delete[_sync]()")
switched del_timer() to timer_delete(), but did not modify the comment
for fc_remote_port_rolechg(). Fix it.

Cc: James E.J. Bottomley <James.Bottomley@HansenPartnership.com>
Cc: Martin K. Petersen <martin.petersen@oracle.com>
Cc: SCSI SUBSYSTEM <linux-scsi@vger.kernel.org>
Cc: linux-kernel@vger.kernel.org
Signed-off-by: WangYuli <wangyuli@uniontech.com>
Link: https://lore.kernel.org/r/084BD6AB1C4759DA+20250414042629.63019-3-wangyuli@uniontech.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2 months agoscsi: ufs: core: Add NULL check in ufshcd_mcq_compl_pending_transfer()
Chenyuan Yang [Sat, 12 Apr 2025 19:59:09 +0000 (14:59 -0500)]
scsi: ufs: core: Add NULL check in ufshcd_mcq_compl_pending_transfer()

Add a NULL check for the returned hwq pointer by ufshcd_mcq_req_to_hwq().

This is similar to the fix in commit 74736103fb41 ("scsi: ufs: core: Fix
ufshcd_abort_one racing issue").

Signed-off-by: Chenyuan Yang <chenyuan0y@gmail.com>
Link: https://lore.kernel.org/r/20250412195909.315418-1-chenyuan0y@gmail.com
Fixes: ab248643d3d6 ("scsi: ufs: core: Add error handling for MCQ mode")
Reviewed-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>
2 months agoscsi: core: Clear flags for scsi_cmnd that did not complete
Anastasia Kovaleva [Mon, 24 Mar 2025 08:49:33 +0000 (11:49 +0300)]
scsi: core: Clear flags for scsi_cmnd that did not complete

Commands that have not been completed with scsi_done() do not clear the
SCMD_INITIALIZED flag and therefore will not be properly reinitialized.
Thus, the next time the scsi_cmnd structure is used, the command may
fail in scsi_cmd_runtime_exceeded() due to the old jiffies_at_alloc
value:

  kernel: sd 16:0:1:84: [sdts] tag#405 timing out command, waited 720s
  kernel: sd 16:0:1:84: [sdts] tag#405 FAILED Result: hostbyte=DID_OK driverbyte=DRIVER_OK cmd_age=66636s

Clear flags for commands that have not been completed by SCSI.

Fixes: 4abafdc4360d ("block: remove the initialize_rq_fn blk_mq_ops method")
Signed-off-by: Anastasia Kovaleva <a.kovaleva@yadro.com>
Link: https://lore.kernel.org/r/20250324084933.15932-2-a.kovaleva@yadro.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
3 months agoscsi: ufs: Introduce quirk to extend PA_HIBERN8TIME for UFS devices
Manish Pandey [Fri, 11 Apr 2025 12:16:30 +0000 (17:46 +0530)]
scsi: ufs: Introduce quirk to extend PA_HIBERN8TIME for UFS devices

Samsung UFS devices require additional time in hibern8 mode before
exiting, beyond the negotiated handshaking phase between the host and
device.  Introduce a quirk to increase the PA_HIBERN8TIME parameter by
100 Âµs, a value derived from experiments, to ensure a proper hibernation
process.

Signed-off-by: Manish Pandey <quic_mapa@quicinc.com>
Link: https://lore.kernel.org/r/20250411121630.21330-3-quic_mapa@quicinc.com
Reviewed-by: Bean Huo <beanhuo@micron.com>
Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
3 months agoscsi: ufs: qcom: Add quirks for Samsung UFS devices
Manish Pandey [Fri, 11 Apr 2025 12:16:29 +0000 (17:46 +0530)]
scsi: ufs: qcom: Add quirks for Samsung UFS devices

Introduce quirks for Samsung UFS devices to adjust PA TX HSG1 sync
length and TX_HS_EQUALIZER settings on the Qualcomm UFS Host
controller. This ensures proper functionality of Samsung UFS devices
with the Qualcomm UFS Host controller.

Signed-off-by: Manish Pandey <quic_mapa@quicinc.com>
Link: https://lore.kernel.org/r/20250411121630.21330-2-quic_mapa@quicinc.com
Reviewed-by: Bean Huo <beanhuo@micron.com>
Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
3 months agoscsi: target: iscsi: Fix timeout on deleted connection
Dmitry Bogdanov [Tue, 24 Dec 2024 10:17:57 +0000 (13:17 +0300)]
scsi: target: iscsi: Fix timeout on deleted connection

NOPIN response timer may expire on a deleted connection and crash with
such logs:

Did not receive response to NOPIN on CID: 0, failing connection for I_T Nexus (null),i,0x00023d000125,iqn.2017-01.com.iscsi.target,t,0x3d

BUG: Kernel NULL pointer dereference on read at 0x00000000
NIP  strlcpy+0x8/0xb0
LR iscsit_fill_cxn_timeout_err_stats+0x5c/0xc0 [iscsi_target_mod]
Call Trace:
 iscsit_handle_nopin_response_timeout+0xfc/0x120 [iscsi_target_mod]
 call_timer_fn+0x58/0x1f0
 run_timer_softirq+0x740/0x860
 __do_softirq+0x16c/0x420
 irq_exit+0x188/0x1c0
 timer_interrupt+0x184/0x410

That is because nopin response timer may be re-started on nopin timer
expiration.

Stop nopin timer before stopping the nopin response timer to be sure
that no one of them will be re-started.

Signed-off-by: Dmitry Bogdanov <d.bogdanov@yadro.com>
Link: https://lore.kernel.org/r/20241224101757.32300-1-d.bogdanov@yadro.com
Reviewed-by: Maurizio Lombardi <mlombard@redhat.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
3 months agoscsi: target: Remove size arguments when calling strscpy()
Thorsten Blum [Tue, 4 Mar 2025 18:14:00 +0000 (19:14 +0100)]
scsi: target: Remove size arguments when calling strscpy()

The size parameter of strscpy() is optional because strscpy() uses
sizeof() to determine the length of the destination buffer if it is not
provided as an argument. Remove it to simplify the code.

Remove some unnecessary curly braces.

No functional changes intended.

Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
Link: https://lore.kernel.org/r/20250304181400.78325-1-thorsten.blum@linux.dev
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
3 months agoscsi: pm80xx: Add __nonstring annotations for unterminated strings
Kees Cook [Mon, 10 Mar 2025 22:25:54 +0000 (15:25 -0700)]
scsi: pm80xx: Add __nonstring annotations for unterminated strings

When a character array without a terminating NUL character has a static
initializer, GCC 15's -Wunterminated-string-initialization will only
warn if the array lacks the "nonstring" attribute[1]. Mark the arrays
with __nonstring to and correctly identify the char array as "not a C
string" and thereby eliminate the warning.

Link: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117178
Cc: Jack Wang <jinpu.wang@cloud.ionos.com>
Cc: James E.J. Bottomley <James.Bottomley@HansenPartnership.com>
Cc: Martin K. Petersen <martin.petersen@oracle.com>
Cc: linux-scsi@vger.kernel.org
Signed-off-by: Kees Cook <kees@kernel.org>
Link: https://lore.kernel.org/r/20250310222553.work.437-kees@kernel.org
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
3 months agoscsi: mpi3mr: Reset the pending interrupt flag
Ranjan Kumar [Fri, 11 Apr 2025 11:14:19 +0000 (16:44 +0530)]
scsi: mpi3mr: Reset the pending interrupt flag

If an admin interrupt is missed, admin_pend_isr may stay set and trigger
admin reply processing even when no admin I/Os are pending.

Clearing/Resetting it in the admin completion path prevents this.

Fixes: ca41929b2ed5 ("scsi: mpi3mr: Check admin reply queue from Watchdog")
Cc: stable@vger.kernel.org
Co-developed-by: Sathya Prakash <sathya.prakash@broadcom.com>
Signed-off-by: Sathya Prakash <sathya.prakash@broadcom.com>
Signed-off-by: Ranjan Kumar <ranjan.kumar@broadcom.com>
Link: https://lore.kernel.org/r/20250411111419.135485-3-ranjan.kumar@broadcom.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
3 months agoscsi: mpi3mr: Fix pending I/O counter
Ranjan Kumar [Fri, 11 Apr 2025 11:14:18 +0000 (16:44 +0530)]
scsi: mpi3mr: Fix pending I/O counter

Commit 199510e33dea ("scsi: mpi3mr: Update consumer index of reply
queues after every 100 replies") introduced a regression with the
per-reply queue pending I/O counter which was erroneously decremented,
leading to the counter going negative.

Drop the incorrect atomic decrement for the pending I/O counter.

Fixes: 199510e33dea ("scsi: mpi3mr: Update consumer index of reply queues after every 100 replies")
Cc: stable@vger.kernel.org
Co-developed-by: Sathya Prakash <sathya.prakash@broadcom.com>
Signed-off-by: Sathya Prakash <sathya.prakash@broadcom.com>
Signed-off-by: Ranjan Kumar <ranjan.kumar@broadcom.com>
Link: https://lore.kernel.org/r/20250411111419.135485-2-ranjan.kumar@broadcom.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
3 months agoscsi: ufs: core: Add WB buffer resize support
Huan Tang [Fri, 11 Apr 2025 09:29:24 +0000 (17:29 +0800)]
scsi: ufs: core: Add WB buffer resize support

Follow JESD220G, support a WB buffer resize function through sysfs. The
host can obtain resize hint and resize status, and enable the resize
operation. Add three sysfs nodes:

1. wb_resize_enable

2. wb_resize_hint

3. wb_resize_status

The detailed definition of the three nodes can be found in the sysfs
documentation.

Signed-off-by: Huan Tang <tanghuan@vivo.com>
Signed-off-by: Lu Hongfei <luhongfei@vivo.com>
Link: https://lore.kernel.org/r/20250411092924.1116-1-tanghuan@vivo.com
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
3 months agoscsi: ufs: mcq: Add NULL check in ufshcd_mcq_abort()
Chenyuan Yang [Thu, 10 Apr 2025 00:13:20 +0000 (19:13 -0500)]
scsi: ufs: mcq: Add NULL check in ufshcd_mcq_abort()

A race can occur between the MCQ completion path and the abort handler:
once a request completes, __blk_mq_free_request() sets rq->mq_hctx to
NULL, meaning the subsequent ufshcd_mcq_req_to_hwq() call in
ufshcd_mcq_abort() can return a NULL pointer. If this NULL pointer is
dereferenced, the kernel will crash.

Add a NULL check for the returned hwq pointer. If hwq is NULL, log an
error and return FAILED, preventing a potential NULL-pointer
dereference.  As suggested by Bart, the ufshcd_cmd_inflight() check is
removed.

This is similar to the fix in commit 74736103fb41 ("scsi: ufs: core: Fix
ufshcd_abort_one racing issue").

This is found by our static analysis tool KNighter.

Signed-off-by: Chenyuan Yang <chenyuan0y@gmail.com>
Link: https://lore.kernel.org/r/20250410001320.2219341-1-chenyuan0y@gmail.com
Fixes: f1304d442077 ("scsi: ufs: mcq: Added ufshcd_mcq_abort()")
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Reviewed-by: Peter Wang <peter.wang@mediatek.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
3 months agoscsi: lpfc: Use memcpy() for BIOS version
Daniel Wagner [Wed, 9 Apr 2025 11:34:22 +0000 (13:34 +0200)]
scsi: lpfc: Use memcpy() for BIOS version

The strlcat() with FORTIFY support is triggering a panic because it
thinks the target buffer will overflow although the correct target
buffer size is passed in.

Anyway, instead of memset() with 0 followed by a strlcat(), just use
memcpy() and ensure that the resulting buffer is NULL terminated.

BIOSVersion is only used for the lpfc_printf_log() which expects a
properly terminated string.

Signed-off-by: Daniel Wagner <wagi@kernel.org>
Link: https://lore.kernel.org/r/20250409-fix-lpfc-bios-str-v1-1-05dac9e51e13@kernel.org
Reviewed-by: Justin Tee <justin.tee@broadcom.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
3 months agoscsi: elx: sli4: Replace deprecated strncpy() with strscpy()
Thorsten Blum [Tue, 8 Apr 2025 10:28:40 +0000 (12:28 +0200)]
scsi: elx: sli4: Replace deprecated strncpy() with strscpy()

strncpy() is deprecated for NUL-terminated destination buffers; use
strscpy() instead.

Since sli_config_cmd_init() already zeroes out the destination buffers,
the potential NUL-padding by strncpy() is unnecessary. strscpy() copies
only the required characters and guarantees NUL-termination.

And since all three destination buffers have a fixed length, strscpy()
automatically determines their size using sizeof() when the argument is
omitted. This makes any explicit sizeof() calls unnecessary.

The source strings are also NUL-terminated and meet the __must_be_cstr()
requirement of strscpy().

No functional changes intended.

Link: https://github.com/KSPP/linux/issues/90
Cc: linux-hardening@vger.kernel.org
Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
Link: https://lore.kernel.org/r/20250408102843.804083-2-thorsten.blum@linux.dev
Reviewed-by: Kees Cook <kees@kernel.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
3 months agoMerge patch series "ufs: core: cleanup and threaded irq handler"
Martin K. Petersen [Sat, 12 Apr 2025 01:24:34 +0000 (21:24 -0400)]
Merge patch series "ufs: core: cleanup and threaded irq handler"

Neil Armstrong <neil.armstrong@linaro.org> says:

On systems with a large number request slots and unavailable MCQ,
the current design of the interrupt handler can delay handling of
other subsystems interrupts causing display artifacts, GPU stalls
or system firmware requests timeouts.

Example of errors reported on a loaded system:
 [drm:dpu_encoder_frame_done_timeout:2706] [dpu error]enc32 frame done timeout
 msm_dpu ae01000.display-controller: [drm:hangcheck_handler [msm]] *ERROR* 67.5.20.1: hangcheck detected gpu lockup rb 2!
 msm_dpu ae01000.display-controller: [drm:hangcheck_handler [msm]] *ERROR* 67.5.20.1:     completed fence: 74285
 msm_dpu ae01000.display-controller: [drm:hangcheck_handler [msm]] *ERROR* 67.5.20.1:     submitted fence: 74286
 Error sending AMC RPMH requests (-110)

Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org>
Link: https://lore.kernel.org/r/20250407-topic-ufs-use-threaded-irq-v3-0-08bee980f71e@linaro.org
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
3 months agoscsi: ufs: core: Delegate the interrupt service routine to a threaded IRQ handler
Neil Armstrong [Mon, 7 Apr 2025 10:17:05 +0000 (12:17 +0200)]
scsi: ufs: core: Delegate the interrupt service routine to a threaded IRQ handler

On systems with a large number request slots and unavailable MCQ ESI,
the current design of the interrupt handler can delay handling of other
subsystems interrupts causing display artifacts, GPU stalls or system
firmware requests timeouts.

Since the interrupt routine can take quite some time, it's preferable to
move it to a threaded handler and leave the hard interrupt handler wake
up the threaded interrupt routine, the interrupt line would be masked
until the processing is finished in the thread thanks to the
IRQS_ONESHOT flag.

When MCQ & ESI interrupts are enabled the I/O completions are now
directly handled in the "hard" interrupt routine to keep IOPs high since
queues handling is done in separate per-queue interrupt routines.

This fixes all encountered issued when running FIO tests on the Qualcomm
SM8650 platform.

Example of errors reported on a loaded system:
 [drm:dpu_encoder_frame_done_timeout:2706] [dpu error]enc32 frame done timeout
 msm_dpu ae01000.display-controller: [drm:hangcheck_handler [msm]] *ERROR* 67.5.20.1: hangcheck detected gpu lockup rb 2!
 msm_dpu ae01000.display-controller: [drm:hangcheck_handler [msm]] *ERROR* 67.5.20.1:     completed fence: 74285
 msm_dpu ae01000.display-controller: [drm:hangcheck_handler [msm]] *ERROR* 67.5.20.1:     submitted fence: 74286
 Error sending AMC RPMH requests (-110)

Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org>
Link: https://lore.kernel.org/r/20250407-topic-ufs-use-threaded-irq-v3-3-08bee980f71e@linaro.org
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
3 months agoscsi: ufs: core: Track when MCQ ESI is enabled
Neil Armstrong [Mon, 7 Apr 2025 10:17:04 +0000 (12:17 +0200)]
scsi: ufs: core: Track when MCQ ESI is enabled

In preparation of adding a threaded interrupt handler, track when the
MCQ ESI interrupt handlers were installed so we can optimize the MCQ
interrupt handling to avoid walking the threaded handler in the case ESI
handlers are enabled.

Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org>
Link: https://lore.kernel.org/r/20250407-topic-ufs-use-threaded-irq-v3-2-08bee980f71e@linaro.org
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
3 months agoscsi: ufs: core: Drop last_intr_status/ts stats
Neil Armstrong [Mon, 7 Apr 2025 10:17:03 +0000 (12:17 +0200)]
scsi: ufs: core: Drop last_intr_status/ts stats

In order to prepare introduction of a threaded interrupt handler, drop
last_intr_status & last_intr_ts drop the ufs_stats struct, and the
associated debug code.

Suggested-by: Bart Van Assche <bvanassche@acm.org>
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org>
Link: https://lore.kernel.org/r/20250407-topic-ufs-use-threaded-irq-v3-1-08bee980f71e@linaro.org
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
3 months agoMerge patch series "Support for wrapped inline encryption keys on Qualcomm SoCs"
Martin K. Petersen [Sat, 12 Apr 2025 01:16:58 +0000 (21:16 -0400)]
Merge patch series "Support for wrapped inline encryption keys on Qualcomm SoCs"

Eric Biggers <ebiggers@kernel.org> says:

Add support for hardware-wrapped inline encryption keys to the Qualcomm
ICE (Inline Crypto Engine) and UFS (Universal Flash Storage) drivers.

I'd like these patches to be taken through the scsi tree for 6.16.
But the Qualcomm / msm tree would be okay too if that is preferred.

The block layer framework for this feature was merged in 6.15; refer to
the "Hardware-wrapped keys" section of
Documentation/block/inline-encryption.rst.  This patchset wires it up
for the newer Qualcomm SoCs, such as SM8650, which have a HWKM (Hardware
Key Manager) and support the SCM calls needed to easily use it.

Tested on the SM8650 HDK with xfstests, specifically generic/368 and
generic/369, in combination with the required fscrypt patch
https://lore.kernel.org/r/20250404225859.172344-1-ebiggers@kernel.org
which I plan to apply separately.

Link: https://lore.kernel.org/r/20250404231533.174419-1-ebiggers@kernel.org
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
3 months agoscsi: ufs: qcom: Add support for wrapped keys
Eric Biggers [Fri, 4 Apr 2025 23:15:32 +0000 (16:15 -0700)]
scsi: ufs: qcom: Add support for wrapped keys

Wire up the wrapped key support for ufs-qcom by implementing the needed
methods in struct blk_crypto_ll_ops and setting the appropriate flag in
blk_crypto_profile::key_types_supported.

For more information about this feature and how to use it, refer to the
sections about hardware-wrapped keys in
Documentation/block/inline-encryption.rst and
Documentation/filesystems/fscrypt.rst.

Based on patches by Gaurav Kashyap <quic_gaurkash@quicinc.com>.
Reworked to use the custom crypto profile support.

Acked-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Tested-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org> # sm8650
Signed-off-by: Eric Biggers <ebiggers@google.com>
Link: https://lore.kernel.org/r/20250404231533.174419-4-ebiggers@kernel.org
Acked-by: Ulf Hansson <ulf.hansson@linaro.org> # For MMC
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
3 months agoscsi: soc: qcom: ice: Add HWKM support to the ICE driver
Gaurav Kashyap [Fri, 4 Apr 2025 23:15:31 +0000 (16:15 -0700)]
scsi: soc: qcom: ice: Add HWKM support to the ICE driver

Qualcomm's Inline Crypto Engine (ICE) version 3.2 and later includes a
key management hardware block called the Hardware Key Manager (HWKM).
Add support for HWKM to the ICE driver.  HWKM provides hardware-wrapped
key support where the ICE (storage) keys are not exposed to software and
instead are protected in hardware.  Later patches will wire up this
feature to ufs-qcom and sdhci-msm using the support added in this patch.

HWKM and legacy mode are currently mutually exclusive.  The selection of
which mode to use has to be made before the storage driver(s) registers
any inline encryption capable disk(s) with the block layer (i.e.,
generally at boot time) so that the appropriate crypto capabilities can
be advertised to upper layers.  Therefore, make the ICE driver select
HWKM mode when the all of the following are true:

 - The new module parameter qcom_ice.use_wrapped_keys=1 is specified.

 - HWKM is present and is at least v2, i.e. ICE is v3.2.1 or later.

 - The SCM calls needed to fully use HWKM are supported by TrustZone.

[EB: merged related patches; fixed the module parameter to work
     correctly; dropped unnecessary support for HWKM v1; fixed error
     handling; improved log messages, comments, and commit message;
     fixed naming; merged enable and init functions; and other cleanups]

Signed-off-by: Gaurav Kashyap <quic_gaurkash@quicinc.com>
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Co-developed-by: Eric Biggers <ebiggers@google.com>
Signed-off-by: Eric Biggers <ebiggers@google.com>
Link: https://lore.kernel.org/r/20250404231533.174419-3-ebiggers@kernel.org
Acked-by: Ulf Hansson <ulf.hansson@linaro.org> # For MMC
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
3 months agoscsi: soc: qcom: ice: Make qcom_ice_program_key() take struct blk_crypto_key
Eric Biggers [Fri, 4 Apr 2025 23:15:30 +0000 (16:15 -0700)]
scsi: soc: qcom: ice: Make qcom_ice_program_key() take struct blk_crypto_key

qcom_ice_program_key() currently accepts the key as an array of bytes,
algorithm ID, key size enum, and data unit size.  However both callers
have a struct blk_crypto_key which contains all that information.  Thus
they both have similar code that converts the blk_crypto_key into the
form that qcom_ice_program_key() wants.  Once wrapped key support is
added, the key type would need to be added to the arguments too.

Therefore, this patch changes qcom_ice_program_key() to take in all this
information as a struct blk_crypto_key directly.  The calling code is
updated accordingly.  This ends up being much simpler, and it makes the
key type be passed down automatically once wrapped key support is added.

Based on a patch by Gaurav Kashyap <quic_gaurkash@quicinc.com> that
replaced the byte array argument only.  This patch makes the
blk_crypto_key replace other arguments like the algorithm ID too,
ensuring that there remains only one source of truth.

Acked-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Tested-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org> # sm8650
Signed-off-by: Eric Biggers <ebiggers@google.com>
Link: https://lore.kernel.org/r/20250404231533.174419-2-ebiggers@kernel.org
Acked-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
Acked-by: Ulf Hansson <ulf.hansson@linaro.org> # For MMC
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
3 months agoMerge patch series "scsi: scsi_debug: Changes to improve support for device types"
Martin K. Petersen [Fri, 11 Apr 2025 20:21:21 +0000 (16:21 -0400)]
Merge patch series "scsi: scsi_debug: Changes to improve support for device types"

Kai Mäkisara <Kai.Makisara@kolumbus.fi> says:

The patch set includes changes to better support different device types.

The first patch fixes two obvious typos in the existing definitions.

The second patch adds a device type mask to the command definitions (struct
opcode_info_t). This makes possible for different command definitions for
different device types and makes easy to add opcodes specific to certain
device types. The mask is 32 bits wide and the bit positions are derived
from the Peripheral Device Type field returned from INQUIRY and used in
the struct scsi_device.

In addition to the mask, the second patch adds command filtering based on
device type to command queuing and building of the response in Report
Supported Opcodes.

The third patch splits definitions of READ(6), WRITE(6) and PRE-FETCH/READ
POSITION to versions for tapes and for other devices.

The fourth patch changes obtaining device type from sdebug_ptype to
struct scsi_device->type whenever it is set correctly. This improves
support for using different device types in the same debug host.

The patch set applies to 6.15/scsi-staging

Link: https://lore.kernel.org/r/20250310155557.2872-1-Kai.Makisara@kolumbus.fi
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
3 months agoscsi: scsi_debug: Add ERASE for tapes
Kai Mäkisara [Mon, 10 Mar 2025 15:55:57 +0000 (17:55 +0200)]
scsi: scsi_debug: Add ERASE for tapes

The command ERASE(6) for tape devices is added.

Signed-off-by: Kai Mäkisara <Kai.Makisara@kolumbus.fi>
Link: https://lore.kernel.org/r/20250310155557.2872-6-Kai.Makisara@kolumbus.fi
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
3 months agoscsi: scsi_debug: Use scsi_device->type instead os sdebug_ptype where possible
Kai Mäkisara [Mon, 10 Mar 2025 15:55:56 +0000 (17:55 +0200)]
scsi: scsi_debug: Use scsi_device->type instead os sdebug_ptype where possible

Devices of several types can be created for a single host. The module
device type should be used only when the devices are created.

Scsi_scan sets the device type initially to 0xff and sets the correct
type based in Inquiry results. This means that Inquiry must report
sdebug_ptype as long as scsi_device->type is not set (the limit 32
comes from the 5-bit length of the Peripheral Device Type in Inquiry).

Signed-off-by: Kai Mäkisara <Kai.Makisara@kolumbus.fi>
Link: https://lore.kernel.org/r/20250310155557.2872-5-Kai.Makisara@kolumbus.fi
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
3 months agoscsi: scsi_debug: Move some tape-specific commands to separate definitions
Kai Mäkisara [Mon, 10 Mar 2025 15:55:55 +0000 (17:55 +0200)]
scsi: scsi_debug: Move some tape-specific commands to separate definitions

New definitions (struct opcode_info_t) are created for READ(6),
WRITE(6), READ POSITION(10) for tape devices.

Signed-off-by: Kai Mäkisara <Kai.Makisara@kolumbus.fi>
Link: https://lore.kernel.org/r/20250310155557.2872-4-Kai.Makisara@kolumbus.fi
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
3 months agoscsi: scsi_debug: Enable different command definitions for different device types
Kai Mäkisara [Mon, 10 Mar 2025 15:55:54 +0000 (17:55 +0200)]
scsi: scsi_debug: Enable different command definitions for different device types

Add mask field devsel to the struct opcode_info_t to enable different
definitions for different device types. Add checking of device mask to
command queuing and reporting of supported opcodes.

Signed-off-by: Kai Mäkisara <Kai.Makisara@kolumbus.fi>
Link: https://lore.kernel.org/r/20250310155557.2872-3-Kai.Makisara@kolumbus.fi
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
3 months agoscsi: scsi_debug: Fix two typos in command definitions
Kai Mäkisara [Mon, 10 Mar 2025 15:55:53 +0000 (17:55 +0200)]
scsi: scsi_debug: Fix two typos in command definitions

Fix two command definitions:

 - Flags and service action reversed in SEND DIAGNOSTIC

 - ATOMIC WRITE missing opcode

Signed-off-by: Kai Mäkisara <Kai.Makisara@kolumbus.fi>
Link: https://lore.kernel.org/r/20250310155557.2872-2-Kai.Makisara@kolumbus.fi
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
3 months agoMerge branch '6.15/scsi-queue' into 6.15/scsi-fixes
Martin K. Petersen [Wed, 9 Apr 2025 02:04:31 +0000 (22:04 -0400)]
Merge branch '6.15/scsi-queue' into 6.15/scsi-fixes

Pull in remaining fixes from 6.15/scsi-queue.

Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
3 months agoLinux 6.15-rc1 v6.15-rc1
Linus Torvalds [Sun, 6 Apr 2025 20:11:33 +0000 (13:11 -0700)]
Linux 6.15-rc1

3 months agotools/include: make uapi/linux/types.h usable from assembly
Thomas WeiĂźschuh [Wed, 2 Apr 2025 20:21:57 +0000 (21:21 +0100)]
tools/include: make uapi/linux/types.h usable from assembly

The "real" linux/types.h UAPI header gracefully degrades to a NOOP when
included from assembly code.

Mirror this behaviour in the tools/ variant.

Test for __ASSEMBLER__ over __ASSEMBLY__ as the former is provided by the
toolchain automatically.

Reported-by: Mark Brown <broonie@kernel.org>
Closes: https://lore.kernel.org/lkml/af553c62-ca2f-4956-932c-dd6e3a126f58@sirena.org.uk/
Fixes: c9fbaa879508 ("selftests: vDSO: parse_vdso: Use UAPI headers instead of libc headers")
Signed-off-by: Thomas WeiĂźschuh <thomas.weissschuh@linutronix.de>
Link: https://patch.msgid.link/20250321-uapi-consistency-v1-1-439070118dc0@linutronix.de
Signed-off-by: Mark Brown <broonie@kernel.org>
Reviewed-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
3 months agoMerge tag 'turbostat-2025.05.06' of git://git.kernel.org/pub/scm/linux/kernel/git...
Linus Torvalds [Sun, 6 Apr 2025 19:32:43 +0000 (12:32 -0700)]
Merge tag 'turbostat-2025.05.06' of git://git./linux/kernel/git/lenb/linux

Pull turbostat updates from Len Brown:

 - support up to 8192 processors

 - add cpuidle governor debug telemetry, disabled by default

 - update default output to exclude cpuidle invocation counts

 - bug fixes

* tag 'turbostat-2025.05.06' of git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux:
  tools/power turbostat: v2025.05.06
  tools/power turbostat: disable "cpuidle" invocation counters, by default
  tools/power turbostat: re-factor sysfs code
  tools/power turbostat: Restore GFX sysfs fflush() call
  tools/power turbostat: Document GNR UncMHz domain convention
  tools/power turbostat: report CoreThr per measurement interval
  tools/power turbostat: Increase CPU_SUBSET_MAXCPUS to 8192
  tools/power turbostat: Add idle governor statistics reporting
  tools/power turbostat: Fix names matching
  tools/power turbostat: Allow Zero return value for some RAPL registers
  tools/power turbostat: Clustered Uncore MHz counters should honor show/hide options

3 months agoMerge tag 'soundwire-6.15-rc1-fixes' of git://git.kernel.org/pub/scm/linux/kernel...
Linus Torvalds [Sun, 6 Apr 2025 19:04:53 +0000 (12:04 -0700)]
Merge tag 'soundwire-6.15-rc1-fixes' of git://git./linux/kernel/git/vkoul/soundwire

Pull soundwire fix from Vinod Koul:

 - add missing config symbol CONFIG_SND_HDA_EXT_CORE required for asoc
   driver CONFIG_SND_SOF_SOF_HDA_SDW_BPT

* tag 'soundwire-6.15-rc1-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/vkoul/soundwire:
  ASoC: SOF: Intel: Let SND_SOF_SOF_HDA_SDW_BPT select SND_HDA_EXT_CORE

3 months agotools/power turbostat: v2025.05.06
Len Brown [Sun, 6 Apr 2025 18:49:20 +0000 (14:49 -0400)]
tools/power turbostat: v2025.05.06

Support up to 8192 processors
Add cpuidle governor debug telemetry, disabled by default
Update default output to exclude cpuidle invocation counts
Bug fixes

Signed-off-by: Len Brown <len.brown@intel.com>
3 months agotools/power turbostat: disable "cpuidle" invocation counters, by default
Len Brown [Sun, 6 Apr 2025 18:29:57 +0000 (14:29 -0400)]
tools/power turbostat: disable "cpuidle" invocation counters, by default

Create "pct_idle" counter group, the sofware notion of residency
so it can now be singled out, independent of other counter groups.

Create "cpuidle" group, the cpuidle invocation counts.
Disable "cpuidle", by default.

Create "swidle" = "cpuidle" + "pct_idle".
Undocument "sysfs", the old name for "swidle", but keep it working
for backwards compatibilty.

Create "hwidle", all the HW idle counters

Modify "idle", enabled by default
"idle" = "hwidle" + "pct_idle" (and now excludes "cpuidle")

Signed-off-by: Len Brown <len.brown@intel.com>
3 months agoMerge tag 'perf-urgent-2025-04-06' of git://git.kernel.org/pub/scm/linux/kernel/git...
Linus Torvalds [Sun, 6 Apr 2025 17:48:12 +0000 (10:48 -0700)]
Merge tag 'perf-urgent-2025-04-06' of git://git./linux/kernel/git/tip/tip

Pull perf event fix from Ingo Molnar:
 "Fix a perf events time accounting bug"

* tag 'perf-urgent-2025-04-06' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  perf/core: Fix child_total_time_enabled accounting bug at task exit

3 months agoMerge tag 'sched-urgent-2025-04-06' of git://git.kernel.org/pub/scm/linux/kernel...
Linus Torvalds [Sun, 6 Apr 2025 17:44:58 +0000 (10:44 -0700)]
Merge tag 'sched-urgent-2025-04-06' of git://git./linux/kernel/git/tip/tip

Pull scheduler fixes from Ingo Molnar:

 - Fix a nonsensical Kconfig combination

 - Remove an unnecessary rseq-notification

* tag 'sched-urgent-2025-04-06' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  rseq: Eliminate useless task_work on execve
  sched/isolation: Make CONFIG_CPU_ISOLATION depend on CONFIG_SMP

3 months agoDisable SLUB_TINY for build testing
Linus Torvalds [Sun, 6 Apr 2025 17:00:04 +0000 (10:00 -0700)]
Disable SLUB_TINY for build testing

... and don't error out so hard on missing module descriptions.

Before commit 6c6c1fc09de3 ("modpost: require a MODULE_DESCRIPTION()")
we used to warn about missing module descriptions, but only when
building with extra warnigns (ie 'W=1').

After that commit the warning became an unconditional hard error.

And it turns out not all modules have been converted despite the claims
to the contrary.  As reported by Damian Tometzki, the slub KUnit test
didn't have a module description, and apparently nobody ever really
noticed.

The reason nobody noticed seems to be that the slub KUnit tests get
disabled by SLUB_TINY, which also ends up disabling a lot of other code,
both in tests and in slub itself.  And so anybody doing full build tests
didn't actually see this failre.

So let's disable SLUB_TINY for build-only tests, since it clearly ends
up limiting build coverage.  Also turn the missing module descriptions
error back into a warning, but let's keep it around for non-'W=1'
builds.

Reported-by: Damian Tometzki <damian@riscv-rocks.de>
Link: https://lore.kernel.org/all/01070196099fd059-e8463438-7b1b-4ec8-816d-173874be9966-000000@eu-central-1.amazonses.com/
Cc: Masahiro Yamada <masahiroy@kernel.org>
Cc: Jeff Johnson <jeff.johnson@oss.qualcomm.com>
Fixes: 6c6c1fc09de3 ("modpost: require a MODULE_DESCRIPTION()")
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
3 months agotools/power turbostat: re-factor sysfs code
Len Brown [Sun, 6 Apr 2025 16:53:18 +0000 (12:53 -0400)]
tools/power turbostat: re-factor sysfs code

Probe cpuidle "sysfs" residency and counts separately,
since soon we will make one disabled on, and the
other disabled off.

Clarify that some BIC (build-in-counters) are actually "groups".
since we're about to re-name some of those groups.

no functional change.

Signed-off-by: Len Brown <len.brown@intel.com>
3 months agotools/power turbostat: Restore GFX sysfs fflush() call
Zhang Rui [Wed, 19 Mar 2025 00:53:07 +0000 (08:53 +0800)]
tools/power turbostat: Restore GFX sysfs fflush() call

Do fflush() to discard the buffered data, before each read of the
graphics sysfs knobs.

Fixes: ba99a4fc8c24 ("tools/power turbostat: Remove unnecessary fflush() call")
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
3 months agotools/power turbostat: Document GNR UncMHz domain convention
Len Brown [Sun, 6 Apr 2025 16:23:22 +0000 (12:23 -0400)]
tools/power turbostat: Document GNR UncMHz domain convention

Document that on Intel Granite Rapids Systems,
Uncore domains 0-2 are CPU domains, and
uncore domains 3-4 are IO domains.

Signed-off-by: Len Brown <len.brown@intel.com>
3 months agotools/power turbostat: report CoreThr per measurement interval
Len Brown [Sun, 6 Apr 2025 15:18:39 +0000 (11:18 -0400)]
tools/power turbostat: report CoreThr per measurement interval

The CoreThr column displays total thermal throttling events
since boot time.

Change it to report events during the measurement interval.

This is more useful for showing a user the current conditions.
Total events since boot time are still available to the user via
/sys/devices/system/cpu/cpu*/thermal_throttle/*

Document CoreThr on turbostat.8

Fixes: eae97e053fe30 ("turbostat: Support thermal throttle count print")
Reported-by: Arjan van de Ven <arjan@linux.intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
Cc: Chen Yu <yu.c.chen@intel.com>
3 months agotools/power turbostat: Increase CPU_SUBSET_MAXCPUS to 8192
Justin Ernst [Wed, 19 Mar 2025 20:27:31 +0000 (15:27 -0500)]
tools/power turbostat: Increase CPU_SUBSET_MAXCPUS to 8192

On systems with >= 1024 cpus (in my case 1152), turbostat fails with the error output:
"turbostat: /sys/fs/cgroup/cpuset.cpus.effective: cpu str malformat 0-1151"

A similar error appears with the use of turbostat --cpu when the inputted cpu
range contains a cpu number >= 1024:
# turbostat -c 1100-1151
"--cpu 1100-1151" malformed
...

Both errors are caused by parse_cpu_str() reaching its limit of CPU_SUBSET_MAXCPUS.

It's a good idea to limit the maximum cpu number being parsed, but 1024 is too low.
For a small increase in compute and allocated memory, increasing CPU_SUBSET_MAXCPUS
brings support for parsing cpu numbers >= 1024.

Increase CPU_SUBSET_MAXCPUS to 8192, a common setting for CONFIG_NR_CPUS on x86_64.

Signed-off-by: Justin Ernst <justin.ernst@hpe.com>
Signed-off-by: Len Brown <len.brown@intel.com>
3 months agoMerge tag 'timers-cleanups-2025-04-06' of git://git.kernel.org/pub/scm/linux/kernel...
Linus Torvalds [Sun, 6 Apr 2025 15:35:37 +0000 (08:35 -0700)]
Merge tag 'timers-cleanups-2025-04-06' of git://git./linux/kernel/git/tip/tip

Pull timer cleanups from Thomas Gleixner:
 "A set of final cleanups for the timer subsystem:

   - Convert all del_timer[_sync]() instances over to the new
     timer_delete[_sync]() API and remove the legacy wrappers.

     Conversion was done with coccinelle plus some manual fixups as
     coccinelle chokes on scoped_guard().

   - The final cleanup of the hrtimer_init() to hrtimer_setup()
     conversion.

     This has been delayed to the end of the merge window, so that all
     patches which have been merged through other trees are in mainline
     and all new users are catched.

  Doing this right before rc1 ensures that new code which is merged post
  rc1 is not introducing new instances of the original functionality"

* tag 'timers-cleanups-2025-04-06' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  tracing/timers: Rename the hrtimer_init event to hrtimer_setup
  hrtimers: Rename debug_init_on_stack() to debug_setup_on_stack()
  hrtimers: Rename debug_init() to debug_setup()
  hrtimers: Rename __hrtimer_init_sleeper() to __hrtimer_setup_sleeper()
  hrtimers: Remove unnecessary NULL check in hrtimer_start_range_ns()
  hrtimers: Make callback function pointer private
  hrtimers: Merge __hrtimer_init() into __hrtimer_setup()
  hrtimers: Switch to use __htimer_setup()
  hrtimers: Delete hrtimer_init()
  treewide: Convert new and leftover hrtimer_init() users
  treewide: Switch/rename to timer_delete[_sync]()

3 months agoMerge tag 'irq-urgent-2025-04-06' of git://git.kernel.org/pub/scm/linux/kernel/git...
Linus Torvalds [Sun, 6 Apr 2025 15:17:43 +0000 (08:17 -0700)]
Merge tag 'irq-urgent-2025-04-06' of git://git./linux/kernel/git/tip/tip

Pull more irq updates from Thomas Gleixner:
 "A set of updates for the interrupt subsystem:

   - A treewide cleanup for the irq_domain code, which makes the naming
     consistent and gets rid of the original oddity of naming domains
     'host'.

     This is a trivial mechanical change and is done late to ensure that
     all instances have been catched and new code merged post rc1 wont
     reintroduce new instances.

   - A trivial consistency fix in the migration code

     The recent introduction of irq_force_complete_move() in the core
     code, causes a problem for the nostalgia crowd who maintains ia64
     out of tree.

     The code assumes that hierarchical interrupt domains are enabled
     and dereferences irq_data::parent_data unconditionally. That works
     in mainline because both architectures which enable that code have
     hierarchical domains enabled. Though it breaks the ia64 build,
     which enables the functionality, but does not have hierarchical
     domains.

     While it's not really a problem for mainline today, this
     unconditional dereference is inconsistent and trivially fixable by
     using the existing helper function irqd_get_parent_data(), which
     has the appropriate #ifdeffery in place"

* tag 'irq-urgent-2025-04-06' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  genirq/migration: Use irqd_get_parent_data() in irq_force_complete_move()
  irqdomain: Stop using 'host' for domain
  irqdomain: Rename irq_get_default_host() to irq_get_default_domain()
  irqdomain: Rename irq_set_default_host() to irq_set_default_domain()

3 months agoMerge tag 'timers-urgent-2025-04-06' of git://git.kernel.org/pub/scm/linux/kernel...
Linus Torvalds [Sun, 6 Apr 2025 15:13:16 +0000 (08:13 -0700)]
Merge tag 'timers-urgent-2025-04-06' of git://git./linux/kernel/git/tip/tip

Pull timer fix from Thomas Gleixner:
 "A revert to fix a adjtimex() regression:

  The recent change to prevent that time goes backwards for the coarse
  time getters due to immediate multiplier adjustments via adjtimex(),
  changed the way how the timekeeping core treats that.

  That change result in a regression on the adjtimex() side, which is
  user space visible:

   1) The forwarding of the base time moves the update out of the
      original period and establishes a new one. That's changing the
      behaviour of the [PF]LL control, which user space expects to be
      applied periodically.

   2) The clearing of the accumulated NTP error due to #1, changes the
      behaviour as well.

  An attempt to delay the multiplier/frequency update to the next tick
  did not solve the problem as userspace expects that the multiplier or
  frequency updates are in effect, when the syscall returns.

  There is a different solution for the coarse time problem available,
  so revert the offending commit to restore the existing adjtimex()
  behaviour"

* tag 'timers-urgent-2025-04-06' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  Revert "timekeeping: Fix possible inconsistencies in _COARSE clockids"

3 months agoMerge tag 'sh-for-v6.15-tag1' of git://git.kernel.org/pub/scm/linux/kernel/git/glaubi...
Linus Torvalds [Sun, 6 Apr 2025 15:10:45 +0000 (08:10 -0700)]
Merge tag 'sh-for-v6.15-tag1' of git://git./linux/kernel/git/glaubitz/sh-linux

Pull sh updates from John Paul Adrian Glaubitz:
 "One important fix and one small configuration update.

  The first patch by Artur Rojek fixes an issue with the J2 firmware
  loader not being able to find the location of the device tree blob due
  to insufficient alignment of the .bss section which rendered J2 boards
  unbootable.

  The second patch by Johan Korsnes updates the defconfigs on sh to drop
  the CONFIG_NET_CLS_TCINDEX configuration option which became obsolete
  after 8c710f75256b ("net/sched: Retire tcindex classifier").

  Summary:

   - sh: defconfig: Drop obsolete CONFIG_NET_CLS_TCINDEX

   - sh: Align .bss section padding to 8-byte boundary"

* tag 'sh-for-v6.15-tag1' of git://git.kernel.org/pub/scm/linux/kernel/git/glaubitz/sh-linux:
  sh: defconfig: Drop obsolete CONFIG_NET_CLS_TCINDEX
  sh: Align .bss section padding to 8-byte boundary

3 months agoMerge tag 'kbuild-v6.15' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy...
Linus Torvalds [Sat, 5 Apr 2025 22:46:50 +0000 (15:46 -0700)]
Merge tag 'kbuild-v6.15' of git://git./linux/kernel/git/masahiroy/linux-kbuild

Pull Kbuild updates from Masahiro Yamada:

 - Improve performance in gendwarfksyms

 - Remove deprecated EXTRA_*FLAGS and KBUILD_ENABLE_EXTRA_GCC_CHECKS

 - Support CONFIG_HEADERS_INSTALL for ARCH=um

 - Use more relative paths to sources files for better reproducibility

 - Support the loong64 Debian architecture

 - Add Kbuild bash completion

 - Introduce intermediate vmlinux.unstripped for architectures that need
   static relocations to be stripped from the final vmlinux

 - Fix versioning in Debian packages for -rc releases

 - Treat missing MODULE_DESCRIPTION() as an error

 - Convert Nios2 Makefiles to use the generic rule for built-in DTB

 - Add debuginfo support to the RPM package

* tag 'kbuild-v6.15' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild: (40 commits)
  kbuild: rpm-pkg: build a debuginfo RPM
  kconfig: merge_config: use an empty file as initfile
  nios2: migrate to the generic rule for built-in DTB
  rust: kbuild: skip `--remap-path-prefix` for `rustdoc`
  kbuild: pacman-pkg: hardcode module installation path
  kbuild: deb-pkg: don't set KBUILD_BUILD_VERSION unconditionally
  modpost: require a MODULE_DESCRIPTION()
  kbuild: make all file references relative to source root
  x86: drop unnecessary prefix map configuration
  kbuild: deb-pkg: add comment about future removal of KDEB_COMPRESS
  kbuild: Add a help message for "headers"
  kbuild: deb-pkg: remove "version" variable in mkdebian
  kbuild: deb-pkg: fix versioning for -rc releases
  Documentation/kbuild: Fix indentation in modules.rst example
  x86: Get rid of Makefile.postlink
  kbuild: Create intermediate vmlinux build with relocations preserved
  kbuild: Introduce Kconfig symbol for linking vmlinux with relocations
  kbuild: link-vmlinux.sh: Make output file name configurable
  kbuild: do not generate .tmp_vmlinux*.map when CONFIG_VMLINUX_MAP=y
  Revert "kheaders: Ignore silly-rename files"
  ...

3 months agoMerge tag 'drm-next-2025-04-05' of https://gitlab.freedesktop.org/drm/kernel
Linus Torvalds [Sat, 5 Apr 2025 22:35:11 +0000 (15:35 -0700)]
Merge tag 'drm-next-2025-04-05' of https://gitlab.freedesktop.org/drm/kernel

Pull drm fixes from Dave Airlie:
 "Weekly fixes, mostly from the end of last week, this week was very
  quiet, maybe you scared everyone away. It's mostly amdgpu, and xe,
  with some i915, adp and bridge bits, since I think this is overly
  quiet I'd expect rc2 to be a bit more lively.

  bridge:
   - tda998x: Select CONFIG_DRM_KMS_HELPER

  amdgpu:
   - Guard against potential division by 0 in fan code
   - Zero RPM support for SMU 14.0.2
   - Properly handle SI and CIK support being disabled
   - PSR fixes
   - DML2 fixes
   - DP Link training fix
   - Vblank fixes
   - RAS fixes
   - Partitioning fix
   - SDMA fix
   - SMU 13.0.x fixes
   - Rom fetching fix
   - MES fixes
   - Queue reset fix

  xe:
   - Fix NULL pointer dereference on error path
   - Add missing HW workaround for BMG
   - Fix survivability mode not triggering
   - Fix build warning when DRM_FBDEV_EMULATION is not set

  i915:
   - Bounds check for scalers in DSC prefill latency computation
   - Fix build by adding a missing include

  adp:
   - Fix error handling in plane setup"

  # -----BEGIN PGP SIGNATURE-----

* tag 'drm-next-2025-04-05' of https://gitlab.freedesktop.org/drm/kernel: (34 commits)
  drm/i2c: tda998x: select CONFIG_DRM_KMS_HELPER
  drm/amdgpu/gfx12: fix num_mec
  drm/amdgpu/gfx11: fix num_mec
  drm/amd/pm: Add gpu_metrics_v1_8
  drm/amdgpu: Prefer shadow rom when available
  drm/amd/pm: Update smu metrics table for smu_v13_0_6
  drm/amd/pm: Remove host limit metrics support
  Remove unnecessary firmware version check for gc v9_4_2
  drm/amdgpu: stop unmapping MQD for kernel queues v3
  Revert "drm/amdgpu/sdma_v4_4_2: update VM flush implementation for SDMA"
  drm/amdgpu: Parse all deferred errors with UMC aca handle
  drm/amdgpu: Update ta ras block
  drm/amdgpu: Add NPS2 to DPX compatible mode
  drm/amdgpu: Use correct gfx deferred error count
  drm/amd/display: Actually do immediate vblank disable
  drm/amd/display: prevent hang on link training fail
  Revert "drm/amd/display: dml2 soc dscclk use DPM table clk setting"
  drm/amd/display: Increase vblank offdelay for PSR panels
  drm/amd: Handle being compiled without SI or CIK support better
  drm/amd/pm: Add zero RPM enabled OD setting support for SMU14.0.2
  ...

3 months agokbuild: rpm-pkg: build a debuginfo RPM
Uday Shankar [Mon, 31 Mar 2025 22:46:32 +0000 (16:46 -0600)]
kbuild: rpm-pkg: build a debuginfo RPM

The rpm-pkg make target currently suffers from a few issues related to
debuginfo:
1. debuginfo for things built into the kernel (vmlinux) is not available
   in any RPM produced by make rpm-pkg. This makes using tools like
   systemtap against a make rpm-pkg kernel impossible.
2. debug source for the kernel is not available. This means that
   commands like 'disas /s' in gdb, which display source intermixed with
   assembly, can only print file names/line numbers which then must be
   painstakingly resolved to actual source in a separate editor.
3. debuginfo for modules is available, but it remains bundled with the
   .ko files that contain module code, in the main kernel RPM. This is a
   waste of space for users who do not need to debug the kernel (i.e.
   most users).

Address all of these issues by additionally building a debuginfo RPM
when the kernel configuration allows for it, in line with standard
patterns followed by RPM distributors. With these changes:
1. systemtap now works (when these changes are backported to 6.11, since
   systemtap lags a bit behind in compatibility), as verified by the
   following simple test script:

   # stap -e 'probe kernel.function("do_sys_open").call { printf("%s\n", $$parms); }'
   dfd=0xffffffffffffff9c filename=0x7fe18800b160 flags=0x88800 mode=0x0
   ...

2. disas /s works correctly in gdb, with source and disassembly
   interspersed:

   # gdb vmlinux --batch -ex 'disas /s blk_op_str'
   Dump of assembler code for function blk_op_str:
   block/blk-core.c:
   125     {
      0xffffffff814c8740 <+0>:     endbr64

   127
   128             if (op < ARRAY_SIZE(blk_op_name) && blk_op_name[op])
      0xffffffff814c8744 <+4>:     mov    $0xffffffff824a7378,%rax
      0xffffffff814c874b <+11>:    cmp    $0x23,%edi
      0xffffffff814c874e <+14>:    ja     0xffffffff814c8768 <blk_op_str+40>
      0xffffffff814c8750 <+16>:    mov    %edi,%edi

   126             const char *op_str = "UNKNOWN";
      0xffffffff814c8752 <+18>:    mov    $0xffffffff824a7378,%rdx

   127
   128             if (op < ARRAY_SIZE(blk_op_name) && blk_op_name[op])
      0xffffffff814c8759 <+25>:    mov    -0x7dfa0160(,%rdi,8),%rax

   126             const char *op_str = "UNKNOWN";
      0xffffffff814c8761 <+33>:    test   %rax,%rax
      0xffffffff814c8764 <+36>:    cmove  %rdx,%rax

   129                     op_str = blk_op_name[op];
   130
   131             return op_str;
   132     }
      0xffffffff814c8768 <+40>:    jmp    0xffffffff81d01360 <__x86_return_thunk>
   End of assembler dump.

3. The size of the main kernel package goes down substantially,
   especially if many modules are built (quite typical). Here is a
   comparison of installed size of the kernel package (configured with
   allmodconfig, dwarf4 debuginfo, and module compression turned off)
   before and after this patch:

   # rpm -qi kernel-6.13* | grep -E '^(Version|Size)'
   Version     : 6.13.0postpatch+
   Size        : 1382874089
   Version     : 6.13.0prepatch+
   Size        : 17870795887

   This is a ~92% size reduction.

Note that a debuginfo package can only be produced if the following
configs are set:
- CONFIG_DEBUG_INFO=y
- CONFIG_MODULE_COMPRESS=n
- CONFIG_DEBUG_INFO_SPLIT=n

The first of these is obvious - we can't produce debuginfo if the build
does not generate it. The second two requirements can in principle be
removed, but doing so is difficult with the current approach, which uses
a generic rpmbuild script find-debuginfo.sh that processes all packaged
executables. If we want to remove those requirements the best path
forward is likely to add some debuginfo extraction/installation logic to
the modules_install target (controllable by flags). That way, it's
easier to operate on modules before they're compressed, and the logic
can be reused by all packaging targets.

Signed-off-by: Uday Shankar <ushankar@purestorage.com>
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
3 months agokconfig: merge_config: use an empty file as initfile
Daniel Gomez [Fri, 28 Mar 2025 14:28:37 +0000 (14:28 +0000)]
kconfig: merge_config: use an empty file as initfile

The scripts/kconfig/merge_config.sh script requires an existing
$INITFILE (or the $1 argument) as a base file for merging Kconfig
fragments. However, an empty $INITFILE can serve as an initial starting
point, later referenced by the KCONFIG_ALLCONFIG Makefile variable
if -m is not used. This variable can point to any configuration file
containing preset config symbols (the merged output) as stated in
Documentation/kbuild/kconfig.rst. When -m is used $INITFILE will
contain just the merge output requiring the user to run make (i.e.
KCONFIG_ALLCONFIG=<$INITFILE> make <allnoconfig/alldefconfig> or make
olddefconfig).

Instead of failing when `$INITFILE` is missing, create an empty file and
use it as the starting point for merges.

Signed-off-by: Daniel Gomez <da.gomez@samsung.com>
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
3 months agonios2: migrate to the generic rule for built-in DTB
Masahiro Yamada [Sun, 22 Dec 2024 00:30:53 +0000 (09:30 +0900)]
nios2: migrate to the generic rule for built-in DTB

Commit 654102df2ac2 ("kbuild: add generic support for built-in boot
DTBs") introduced generic support for built-in DTBs.

Select GENERIC_BUILTIN_DTB when built-in DTB support is enabled.

To keep consistency across architectures, this commit also renames
CONFIG_NIOS2_DTB_SOURCE_BOOL to CONFIG_BUILTIN_DTB, and
CONFIG_NIOS2_DTB_SOURCE to CONFIG_BUILTIN_DTB_NAME.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
3 months agosh: defconfig: Drop obsolete CONFIG_NET_CLS_TCINDEX
Johan Korsnes [Sun, 23 Mar 2025 19:13:30 +0000 (20:13 +0100)]
sh: defconfig: Drop obsolete CONFIG_NET_CLS_TCINDEX

This option was removed from Kconfig in 8c710f75256b ("net/sched:
Retire tcindex classifier") but from the defconfigs.

Fixes: 8c710f75256b ("net/sched: Retire tcindex classifier")
Signed-off-by: Johan Korsnes <johan.korsnes@gmail.com>
Cc: Yoshinori Sato <ysato@users.sourceforge.jp>
Cc: Rich Felker <dalias@libc.org>
Cc: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Reviewed-by: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
Signed-off-by: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
3 months agosh: Align .bss section padding to 8-byte boundary
Artur Rojek [Sun, 16 Feb 2025 17:55:44 +0000 (18:55 +0100)]
sh: Align .bss section padding to 8-byte boundary

J2-based devices expect to find a device tree blob at the end of the
.bss section. As of a77725a9a3c5 ("scripts/dtc: Update to upstream
version v1.6.1-19-g0a3a9d3449c8"), libfdt enforces 8-byte alignment
for the DTB, causing J2 devices to fail early in sh_fdt_init().

As the J2 loader firmware calculates the DTB location based on the kernel
image .bss section size rather than the __bss_stop symbol offset, the
required alignment can't be enforced with BSS_SECTION(0, PAGE_SIZE, 8).

To fix this, inline a modified version of the above macro which grows
.bss by the required size. While this change affects all existing SH
boards, it should be benign on platforms which don't need this alignment.

Signed-off-by: Artur Rojek <contact@artur-rojek.eu>
Reviewed-by: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
Tested-by: Rob Landley <rob@landley.net>
Signed-off-by: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
3 months agoMerge tag 'input-for-v6.15-rc0' of git://git.kernel.org/pub/scm/linux/kernel/git...
Linus Torvalds [Sat, 5 Apr 2025 16:20:39 +0000 (09:20 -0700)]
Merge tag 'input-for-v6.15-rc0' of git://git./linux/kernel/git/dtor/input

Pull input updates from Dmitry Torokhov:

 - a brand new driver for touchpads and touchbars in newer Apple devices

 - support for Berlin-A series in goodix-berlin touchscreen driver

 - improvements to matrix_keypad driver to better handle GPIOs toggling

 - assorted small cleanups in other input drivers

* tag 'input-for-v6.15-rc0' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input:
  Input: goodix_berlin - add support for Berlin-A series
  dt-bindings: input: goodix,gt9916: Document gt9897 compatible
  dt-bindings: input: matrix_keypad - add wakeup-source property
  dt-bindings: input: matrix_keypad - add missing property
  Input: pm8941-pwrkey - fix dev_dbg() output in pm8941_pwrkey_irq()
  Input: synaptics - hide unused smbus_pnp_ids[] array
  Input: apple_z2 - fix potential confusion in Kconfig
  Input: matrix_keypad - use fsleep for delays after activating columns
  Input: matrix_keypad - add settle time after enabling all columns
  dt-bindings: input: matrix_keypad: add settle time after enabling all columns
  dt-bindings: input: matrix_keypad: convert to YAML
  dt-bindings: input: Correct indentation and style in DTS example
  MAINTAINERS: Add entries for Apple Z2 touchscreen driver
  Input: apple_z2 - add a driver for Apple Z2 touchscreens
  dt-bindings: input: touchscreen: Add Z2 controller
  Input: Switch to use hrtimer_setup()
  Input: drop vb2_ops_wait_prepare/finish

3 months agotracing/timers: Rename the hrtimer_init event to hrtimer_setup
Nam Cao [Wed, 5 Feb 2025 10:55:21 +0000 (11:55 +0100)]
tracing/timers: Rename the hrtimer_init event to hrtimer_setup

The function hrtimer_init() doesn't exist anymore. It was replaced by
hrtimer_setup().

Thus, rename the hrtimer_init trace event to hrtimer_setup to keep it
consistent.

Signed-off-by: Nam Cao <namcao@linutronix.de>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Link: https://lore.kernel.org/all/cba84c3d853c5258aa3a262363a6eac08e2c7afc.1738746927.git.namcao@linutronix.de
3 months agohrtimers: Rename debug_init_on_stack() to debug_setup_on_stack()
Nam Cao [Wed, 5 Feb 2025 10:55:20 +0000 (11:55 +0100)]
hrtimers: Rename debug_init_on_stack() to debug_setup_on_stack()

All the hrtimer_init*() functions have been renamed to hrtimer_setup*().
Rename debug_init_on_stack() to debug_setup_on_stack() as well, to keep the
names consistent.

Signed-off-by: Nam Cao <namcao@linutronix.de>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Link: https://lore.kernel.org/all/073cf6162779a2f5b12624677d4c49ee7eccc1ed.1738746927.git.namcao@linutronix.de
3 months agohrtimers: Rename debug_init() to debug_setup()
Nam Cao [Wed, 5 Feb 2025 10:55:19 +0000 (11:55 +0100)]
hrtimers: Rename debug_init() to debug_setup()

All the hrtimer_init*() functions have been renamed to hrtimer_setup*().
Rename debug_init() to debug_setup() as well, to keep the names consistent.

Signed-off-by: Nam Cao <namcao@linutronix.de>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Link: https://lore.kernel.org/all/4b730c1f79648b16a1c5413f928fdc2e138dfc43.1738746927.git.namcao@linutronix.de
3 months agohrtimers: Rename __hrtimer_init_sleeper() to __hrtimer_setup_sleeper()
Nam Cao [Wed, 5 Feb 2025 10:55:18 +0000 (11:55 +0100)]
hrtimers: Rename __hrtimer_init_sleeper() to __hrtimer_setup_sleeper()

All the hrtimer_init*() functions have been renamed to hrtimer_setup*().
Rename __hrtimer_init_sleeper() to __hrtimer_setup_sleeper() as well, to
keep the names consistent.

Signed-off-by: Nam Cao <namcao@linutronix.de>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Link: https://lore.kernel.org/all/807694aedad9353421c4a7347629a30c5c31026f.1738746927.git.namcao@linutronix.de
3 months agohrtimers: Remove unnecessary NULL check in hrtimer_start_range_ns()
Nam Cao [Wed, 5 Feb 2025 10:55:17 +0000 (11:55 +0100)]
hrtimers: Remove unnecessary NULL check in hrtimer_start_range_ns()

The struct hrtimer::function field can only be changed using
hrtimer_setup*() or hrtimer_update_function(), and both already null-check
'function'. Therefore, null-checking 'function' in hrtimer_start_range_ns()
is not necessary.

Signed-off-by: Nam Cao <namcao@linutronix.de>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Link: https://lore.kernel.org/all/4661c571ee87980c340ccc318fc1a473c0c8f6bc.1738746927.git.namcao@linutronix.de
3 months agohrtimers: Make callback function pointer private
Nam Cao [Wed, 5 Feb 2025 10:55:16 +0000 (11:55 +0100)]
hrtimers: Make callback function pointer private

Make the struct hrtimer::function field private, to prevent users from
changing this field in an unsafe way. hrtimer_update_function() should be
used if the callback function needs to be changed.

Signed-off-by: Nam Cao <namcao@linutronix.de>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Link: https://lore.kernel.org/all/7d0e6e0c5c59a64a9bea940051aac05d750bc0c2.1738746927.git.namcao@linutronix.de
3 months agohrtimers: Merge __hrtimer_init() into __hrtimer_setup()
Nam Cao [Wed, 5 Feb 2025 10:55:12 +0000 (11:55 +0100)]
hrtimers: Merge __hrtimer_init() into __hrtimer_setup()

__hrtimer_init() is only called by __hrtimer_setup(). Simplify by merging
__hrtimer_init() into __hrtimer_setup().

Signed-off-by: Nam Cao <namcao@linutronix.de>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Link: https://lore.kernel.org/all/8a0a847a35f711f66b2d05b57255aa44e7e61279.1738746927.git.namcao@linutronix.de
3 months agohrtimers: Switch to use __htimer_setup()
Nam Cao [Wed, 5 Feb 2025 10:55:11 +0000 (11:55 +0100)]
hrtimers: Switch to use __htimer_setup()

__hrtimer_init_sleeper() calls __hrtimer_init() and also sets up the
callback function. But there is already __hrtimer_setup() which does both
actions.

Switch to use __hrtimer_setup() to simplify the code.

Signed-off-by: Nam Cao <namcao@linutronix.de>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Link: https://lore.kernel.org/all/d9a45a51b6a8aa0045310d63f73753bf6b33f385.1738746927.git.namcao@linutronix.de
3 months agohrtimers: Delete hrtimer_init()
Nam Cao [Wed, 5 Feb 2025 10:55:10 +0000 (11:55 +0100)]
hrtimers: Delete hrtimer_init()

hrtimer_init() is now unused. Delete it.

Signed-off-by: Nam Cao <namcao@linutronix.de>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Link: https://lore.kernel.org/all/003722f60c7a2a4f8d4ed24fb741aa313b7e5136.1738746927.git.namcao@linutronix.de
3 months agotreewide: Convert new and leftover hrtimer_init() users
Thomas Gleixner [Fri, 4 Apr 2025 17:31:15 +0000 (19:31 +0200)]
treewide: Convert new and leftover hrtimer_init() users

hrtimer_setup() takes the callback function pointer as argument and
initializes the timer completely.

Replace hrtimer_init() and the open coded initialization of
hrtimer::function with the new setup mechanism.

Coccinelle scripted cleanup.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
3 months agotreewide: Switch/rename to timer_delete[_sync]()
Thomas Gleixner [Sat, 5 Apr 2025 08:17:26 +0000 (10:17 +0200)]
treewide: Switch/rename to timer_delete[_sync]()

timer_delete[_sync]() replaces del_timer[_sync](). Convert the whole tree
over and remove the historical wrapper inlines.

Conversion was done with coccinelle plus manual fixups where necessary.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Ingo Molnar <mingo@kernel.org>