Skip to content

Commit a1af6f1

Browse files
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>
2 parents 0af2f6b + 1b4902f commit a1af6f1

File tree

18 files changed

+299
-67
lines changed

18 files changed

+299
-67
lines changed

Documentation/ABI/testing/sysfs-driver-ufs

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1604,3 +1604,35 @@ Description:
16041604
prevent the UFS from frequently performing clock gating/ungating.
16051605

16061606
The attribute is read/write.
1607+
1608+
What: /sys/bus/platform/drivers/ufshcd/*/device_lvl_exception_count
1609+
What: /sys/bus/platform/devices/*.ufs/device_lvl_exception_count
1610+
Date: March 2025
1611+
Contact: Bao D. Nguyen <quic_nguyenb@quicinc.com>
1612+
Description:
1613+
This attribute is applicable to ufs devices compliant to the
1614+
JEDEC specifications version 4.1 or later. The
1615+
device_lvl_exception_count is a counter indicating the number of
1616+
times the device level exceptions have occurred since the last
1617+
time this variable is reset. Writing a 0 value to this
1618+
attribute will reset the device_lvl_exception_count. If the
1619+
device_lvl_exception_count reads a positive value, the user
1620+
application should read the device_lvl_exception_id attribute to
1621+
know more information about the exception.
1622+
1623+
The attribute is read/write.
1624+
1625+
What: /sys/bus/platform/drivers/ufshcd/*/device_lvl_exception_id
1626+
What: /sys/bus/platform/devices/*.ufs/device_lvl_exception_id
1627+
Date: March 2025
1628+
Contact: Bao D. Nguyen <quic_nguyenb@quicinc.com>
1629+
Description:
1630+
Reading the device_lvl_exception_id returns the
1631+
qDeviceLevelExceptionID attribute of the ufs device JEDEC
1632+
specification version 4.1. The definition of the
1633+
qDeviceLevelExceptionID is the ufs device vendor specific
1634+
implementation. Refer to the device manufacturer datasheet for
1635+
more information on the meaning of the qDeviceLevelExceptionID
1636+
attribute value.
1637+
1638+
The attribute is read only.

drivers/scsi/hisi_sas/hisi_sas_main.c

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -935,8 +935,28 @@ static void hisi_sas_phyup_work_common(struct work_struct *work,
935935
container_of(work, typeof(*phy), works[event]);
936936
struct hisi_hba *hisi_hba = phy->hisi_hba;
937937
struct asd_sas_phy *sas_phy = &phy->sas_phy;
938+
struct asd_sas_port *sas_port = sas_phy->port;
939+
struct hisi_sas_port *port = phy->port;
940+
struct device *dev = hisi_hba->dev;
941+
struct domain_device *port_dev;
938942
int phy_no = sas_phy->id;
939943

944+
if (!test_bit(HISI_SAS_RESETTING_BIT, &hisi_hba->flags) &&
945+
sas_port && port && (port->id != phy->port_id)) {
946+
dev_info(dev, "phy%d's hw port id changed from %d to %llu\n",
947+
phy_no, port->id, phy->port_id);
948+
port_dev = sas_port->port_dev;
949+
if (port_dev && !dev_is_expander(port_dev->dev_type)) {
950+
/*
951+
* Set the device state to gone to block
952+
* sending IO to the device.
953+
*/
954+
set_bit(SAS_DEV_GONE, &port_dev->state);
955+
hisi_sas_notify_phy_event(phy, HISI_PHYE_LINK_RESET);
956+
return;
957+
}
958+
}
959+
940960
phy->wait_phyup_cnt = 0;
941961
if (phy->identify.target_port_protocols == SAS_PROTOCOL_SSP)
942962
hisi_hba->hw->sl_notify_ssp(hisi_hba, phy_no);

drivers/scsi/hisi_sas/hisi_sas_v2_hw.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2501,17 +2501,22 @@ static void prep_ata_v2_hw(struct hisi_hba *hisi_hba,
25012501
struct hisi_sas_port *port = to_hisi_sas_port(sas_port);
25022502
struct sas_ata_task *ata_task = &task->ata_task;
25032503
struct sas_tmf_task *tmf = slot->tmf;
2504+
int phy_id;
25042505
u8 *buf_cmd;
25052506
int has_data = 0, hdr_tag = 0;
25062507
u32 dw0, dw1 = 0, dw2 = 0;
25072508

25082509
/* create header */
25092510
/* dw0 */
25102511
dw0 = port->id << CMD_HDR_PORT_OFF;
2511-
if (parent_dev && dev_is_expander(parent_dev->dev_type))
2512+
if (parent_dev && dev_is_expander(parent_dev->dev_type)) {
25122513
dw0 |= 3 << CMD_HDR_CMD_OFF;
2513-
else
2514+
} else {
2515+
phy_id = device->phy->identify.phy_identifier;
2516+
dw0 |= (1U << phy_id) << CMD_HDR_PHY_ID_OFF;
2517+
dw0 |= CMD_HDR_FORCE_PHY_MSK;
25142518
dw0 |= 4 << CMD_HDR_CMD_OFF;
2519+
}
25152520

25162521
if (tmf && ata_task->force_phy) {
25172522
dw0 |= CMD_HDR_FORCE_PHY_MSK;

drivers/scsi/hisi_sas/hisi_sas_v3_hw.c

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -359,6 +359,10 @@
359359
#define CMD_HDR_RESP_REPORT_MSK (0x1 << CMD_HDR_RESP_REPORT_OFF)
360360
#define CMD_HDR_TLR_CTRL_OFF 6
361361
#define CMD_HDR_TLR_CTRL_MSK (0x3 << CMD_HDR_TLR_CTRL_OFF)
362+
#define CMD_HDR_PHY_ID_OFF 8
363+
#define CMD_HDR_PHY_ID_MSK (0x1ff << CMD_HDR_PHY_ID_OFF)
364+
#define CMD_HDR_FORCE_PHY_OFF 17
365+
#define CMD_HDR_FORCE_PHY_MSK (0x1U << CMD_HDR_FORCE_PHY_OFF)
362366
#define CMD_HDR_PORT_OFF 18
363367
#define CMD_HDR_PORT_MSK (0xf << CMD_HDR_PORT_OFF)
364368
#define CMD_HDR_PRIORITY_OFF 27
@@ -1429,15 +1433,21 @@ static void prep_ata_v3_hw(struct hisi_hba *hisi_hba,
14291433
struct hisi_sas_cmd_hdr *hdr = slot->cmd_hdr;
14301434
struct asd_sas_port *sas_port = device->port;
14311435
struct hisi_sas_port *port = to_hisi_sas_port(sas_port);
1436+
int phy_id;
14321437
u8 *buf_cmd;
14331438
int has_data = 0, hdr_tag = 0;
14341439
u32 dw1 = 0, dw2 = 0;
14351440

14361441
hdr->dw0 = cpu_to_le32(port->id << CMD_HDR_PORT_OFF);
1437-
if (parent_dev && dev_is_expander(parent_dev->dev_type))
1442+
if (parent_dev && dev_is_expander(parent_dev->dev_type)) {
14381443
hdr->dw0 |= cpu_to_le32(3 << CMD_HDR_CMD_OFF);
1439-
else
1444+
} else {
1445+
phy_id = device->phy->identify.phy_identifier;
1446+
hdr->dw0 |= cpu_to_le32((1U << phy_id)
1447+
<< CMD_HDR_PHY_ID_OFF);
1448+
hdr->dw0 |= CMD_HDR_FORCE_PHY_MSK;
14401449
hdr->dw0 |= cpu_to_le32(4U << CMD_HDR_CMD_OFF);
1450+
}
14411451

14421452
switch (task->data_dir) {
14431453
case DMA_TO_DEVICE:

drivers/scsi/megaraid/megaraid_sas.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@
2323
/*
2424
* MegaRAID SAS Driver meta data
2525
*/
26-
#define MEGASAS_VERSION "07.727.03.00-rc1"
27-
#define MEGASAS_RELDATE "Oct 03, 2023"
26+
#define MEGASAS_VERSION "07.734.00.00-rc1"
27+
#define MEGASAS_RELDATE "Apr 03, 2025"
2828

2929
#define MEGASAS_MSIX_NAME_LEN 32
3030

drivers/scsi/megaraid/megaraid_sas_base.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2103,6 +2103,9 @@ static int megasas_sdev_configure(struct scsi_device *sdev,
21032103
/* This sdev property may change post OCR */
21042104
megasas_set_dynamic_target_properties(sdev, lim, is_target_prop);
21052105

2106+
if (!MEGASAS_IS_LOGICAL(sdev))
2107+
sdev->no_vpd_size = 1;
2108+
21062109
mutex_unlock(&instance->reset_mutex);
21072110

21082111
return 0;
@@ -3662,8 +3665,10 @@ megasas_complete_cmd(struct megasas_instance *instance, struct megasas_cmd *cmd,
36623665

36633666
case MFI_STAT_SCSI_IO_FAILED:
36643667
case MFI_STAT_LD_INIT_IN_PROGRESS:
3665-
cmd->scmd->result =
3666-
(DID_ERROR << 16) | hdr->scsi_status;
3668+
if (hdr->scsi_status == 0xf0)
3669+
cmd->scmd->result = (DID_ERROR << 16) | SAM_STAT_CHECK_CONDITION;
3670+
else
3671+
cmd->scmd->result = (DID_ERROR << 16) | hdr->scsi_status;
36673672
break;
36683673

36693674
case MFI_STAT_SCSI_DONE_WITH_ERROR:

drivers/scsi/megaraid/megaraid_sas_fusion.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2043,7 +2043,10 @@ map_cmd_status(struct fusion_context *fusion,
20432043

20442044
case MFI_STAT_SCSI_IO_FAILED:
20452045
case MFI_STAT_LD_INIT_IN_PROGRESS:
2046-
scmd->result = (DID_ERROR << 16) | ext_status;
2046+
if (ext_status == 0xf0)
2047+
scmd->result = (DID_ERROR << 16) | SAM_STAT_CHECK_CONDITION;
2048+
else
2049+
scmd->result = (DID_ERROR << 16) | ext_status;
20472050
break;
20482051

20492052
case MFI_STAT_SCSI_DONE_WITH_ERROR:

drivers/scsi/pm8001/pm8001_sas.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -766,6 +766,7 @@ static void pm8001_dev_gone_notify(struct domain_device *dev)
766766
spin_lock_irqsave(&pm8001_ha->lock, flags);
767767
}
768768
PM8001_CHIP_DISP->dereg_dev_req(pm8001_ha, device_id);
769+
pm8001_ha->phy[pm8001_dev->attached_phy].phy_attached = 0;
769770
pm8001_free_dev(pm8001_dev);
770771
} else {
771772
pm8001_dbg(pm8001_ha, DISC, "Found dev has gone.\n");

drivers/scsi/scsi_transport_iscsi.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3182,11 +3182,14 @@ iscsi_set_host_param(struct iscsi_transport *transport,
31823182
}
31833183

31843184
/* see similar check in iscsi_if_set_param() */
3185-
if (strlen(data) > ev->u.set_host_param.len)
3186-
return -EINVAL;
3185+
if (strlen(data) > ev->u.set_host_param.len) {
3186+
err = -EINVAL;
3187+
goto out;
3188+
}
31873189

31883190
err = transport->set_host_param(shost, ev->u.set_host_param.param,
31893191
data, ev->u.set_host_param.len);
3192+
out:
31903193
scsi_host_put(shost);
31913194
return err;
31923195
}

drivers/scsi/scsi_transport_srp.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -388,7 +388,7 @@ static void srp_reconnect_work(struct work_struct *work)
388388
"reconnect attempt %d failed (%d)\n",
389389
++rport->failed_reconnects, res);
390390
delay = rport->reconnect_delay *
391-
min(100, max(1, rport->failed_reconnects - 10));
391+
clamp(rport->failed_reconnects - 10, 1, 100);
392392
if (delay > 0)
393393
queue_delayed_work(system_long_wq,
394394
&rport->reconnect_work, delay * HZ);

0 commit comments

Comments
 (0)