Skip to content

Commit ef5f68c

Browse files
committed
Merge tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi
Pull SCSI fixes from James Bottomley: "Twenty fixes all in drivers except the one zone storage revalidation fix to sd. The megaraid_sas fixes are more on the level of a driver update (enabling crash dump and increasing lun number) but I thought you could let this slide on -rc1 and the next most extensive update is a load of fixes to mpi3mr" * tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi: scsi: sd: Fix wrong zone_write_granularity value during revalidate scsi: storvsc: Handle BlockSize change in Hyper-V VHD/VHDX file scsi: megaraid_sas: Driver version update to 07.725.01.00-rc1 scsi: megaraid_sas: Add crash dump mode capability bit in MFI capabilities scsi: megaraid_sas: Update max supported LD IDs to 240 scsi: mpi3mr: Bad drive in topology results kernel crash scsi: mpi3mr: NVMe command size greater than 8K fails scsi: mpi3mr: Return proper values for failures in firmware init path scsi: mpi3mr: Wait for diagnostic save during controller init scsi: mpi3mr: Driver unload crashes host when enhanced logging is enabled scsi: mpi3mr: ioctl timeout when disabling/enabling interrupt scsi: lpfc: Avoid usage of list iterator variable after loop scsi: lpfc: Check kzalloc() in lpfc_sli4_cgn_params_read() scsi: ufs: mcq: qcom: Clean the return path of ufs_qcom_mcq_config_resource() scsi: ufs: mcq: qcom: Fix passing zero to PTR_ERR scsi: ufs: ufs-qcom: Remove impossible check scsi: ufs: core: Add soft dependency on governor_simpleondemand scsi: hisi_sas: Check devm_add_action() return value scsi: qla2xxx: Add option to disable FC2 Target support scsi: target: iscsi: Fix an error message in iscsi_check_key()
2 parents 40f879b + 288b327 commit ef5f68c

20 files changed

+117
-50
lines changed

drivers/scsi/hisi_sas/hisi_sas_v3_hw.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2495,8 +2495,7 @@ static int interrupt_preinit_v3_hw(struct hisi_hba *hisi_hba)
24952495
hisi_hba->cq_nvecs = vectors - BASE_VECTORS_V3_HW;
24962496
shost->nr_hw_queues = hisi_hba->cq_nvecs;
24972497

2498-
devm_add_action(&pdev->dev, hisi_sas_v3_free_vectors, pdev);
2499-
return 0;
2498+
return devm_add_action(&pdev->dev, hisi_sas_v3_free_vectors, pdev);
25002499
}
25012500

25022501
static int interrupt_init_v3_hw(struct hisi_hba *hisi_hba)

drivers/scsi/lpfc/lpfc_init.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7291,6 +7291,8 @@ lpfc_sli4_cgn_params_read(struct lpfc_hba *phba)
72917291
/* Find out if the FW has a new set of congestion parameters. */
72927292
len = sizeof(struct lpfc_cgn_param);
72937293
pdata = kzalloc(len, GFP_KERNEL);
7294+
if (!pdata)
7295+
return -ENOMEM;
72947296
ret = lpfc_read_object(phba, (char *)LPFC_PORT_CFG_NAME,
72957297
pdata, len);
72967298

drivers/scsi/lpfc/lpfc_sli.c

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21899,20 +21899,20 @@ lpfc_get_io_buf_from_private_pool(struct lpfc_hba *phba,
2189921899
static struct lpfc_io_buf *
2190021900
lpfc_get_io_buf_from_expedite_pool(struct lpfc_hba *phba)
2190121901
{
21902-
struct lpfc_io_buf *lpfc_ncmd;
21902+
struct lpfc_io_buf *lpfc_ncmd = NULL, *iter;
2190321903
struct lpfc_io_buf *lpfc_ncmd_next;
2190421904
unsigned long iflag;
2190521905
struct lpfc_epd_pool *epd_pool;
2190621906

2190721907
epd_pool = &phba->epd_pool;
21908-
lpfc_ncmd = NULL;
2190921908

2191021909
spin_lock_irqsave(&epd_pool->lock, iflag);
2191121910
if (epd_pool->count > 0) {
21912-
list_for_each_entry_safe(lpfc_ncmd, lpfc_ncmd_next,
21911+
list_for_each_entry_safe(iter, lpfc_ncmd_next,
2191321912
&epd_pool->list, list) {
21914-
list_del(&lpfc_ncmd->list);
21913+
list_del(&iter->list);
2191521914
epd_pool->count--;
21915+
lpfc_ncmd = iter;
2191621916
break;
2191721917
}
2191821918
}
@@ -22109,10 +22109,6 @@ lpfc_read_object(struct lpfc_hba *phba, char *rdobject, uint32_t *datap,
2210922109
struct lpfc_dmabuf *pcmd;
2211022110
u32 rd_object_name[LPFC_MBX_OBJECT_NAME_LEN_DW] = {0};
2211122111

22112-
/* sanity check on queue memory */
22113-
if (!datap)
22114-
return -ENODEV;
22115-
2211622112
mbox = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL);
2211722113
if (!mbox)
2211822114
return -ENOMEM;

drivers/scsi/megaraid/megaraid_sas.h

Lines changed: 8 additions & 4 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.719.03.00-rc1"
27-
#define MEGASAS_RELDATE "Sep 29, 2021"
26+
#define MEGASAS_VERSION "07.725.01.00-rc1"
27+
#define MEGASAS_RELDATE "Mar 2, 2023"
2828

2929
#define MEGASAS_MSIX_NAME_LEN 32
3030

@@ -1519,6 +1519,8 @@ struct megasas_ctrl_info {
15191519
#define MEGASAS_MAX_LD_IDS (MEGASAS_MAX_LD_CHANNELS * \
15201520
MEGASAS_MAX_DEV_PER_CHANNEL)
15211521

1522+
#define MEGASAS_MAX_SUPPORTED_LD_IDS 240
1523+
15221524
#define MEGASAS_MAX_SECTORS (2*1024)
15231525
#define MEGASAS_MAX_SECTORS_IEEE (2*128)
15241526
#define MEGASAS_DBG_LVL 1
@@ -1758,7 +1760,8 @@ union megasas_sgl_frame {
17581760
typedef union _MFI_CAPABILITIES {
17591761
struct {
17601762
#if defined(__BIG_ENDIAN_BITFIELD)
1761-
u32 reserved:16;
1763+
u32 reserved:15;
1764+
u32 support_memdump:1;
17621765
u32 support_fw_exposed_dev_list:1;
17631766
u32 support_nvme_passthru:1;
17641767
u32 support_64bit_mode:1;
@@ -1792,7 +1795,8 @@ typedef union _MFI_CAPABILITIES {
17921795
u32 support_64bit_mode:1;
17931796
u32 support_nvme_passthru:1;
17941797
u32 support_fw_exposed_dev_list:1;
1795-
u32 reserved:16;
1798+
u32 support_memdump:1;
1799+
u32 reserved:15;
17961800
#endif
17971801
} mfi_capabilities;
17981802
__le32 reg;

drivers/scsi/megaraid/megaraid_sas_fp.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -358,7 +358,7 @@ u8 MR_ValidateMapInfo(struct megasas_instance *instance, u64 map_id)
358358
ld = MR_TargetIdToLdGet(i, drv_map);
359359

360360
/* For non existing VDs, iterate to next VD*/
361-
if (ld >= (MAX_LOGICAL_DRIVES_EXT - 1))
361+
if (ld >= MEGASAS_MAX_SUPPORTED_LD_IDS)
362362
continue;
363363

364364
raid = MR_LdRaidGet(ld, drv_map);

drivers/scsi/megaraid/megaraid_sas_fusion.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1201,6 +1201,9 @@ megasas_ioc_init_fusion(struct megasas_instance *instance)
12011201
drv_ops->mfi_capabilities.support_nvme_passthru = 1;
12021202
drv_ops->mfi_capabilities.support_fw_exposed_dev_list = 1;
12031203

1204+
if (reset_devices)
1205+
drv_ops->mfi_capabilities.support_memdump = 1;
1206+
12041207
if (instance->consistent_mask_64bit)
12051208
drv_ops->mfi_capabilities.support_64bit_mode = 1;
12061209

drivers/scsi/mpi3mr/mpi3mr.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -902,6 +902,7 @@ struct scmd_priv {
902902
* @admin_reply_ephase:Admin reply queue expected phase
903903
* @admin_reply_base: Admin reply queue base virtual address
904904
* @admin_reply_dma: Admin reply queue base dma address
905+
* @admin_reply_q_in_use: Queue is handled by poll/ISR
905906
* @ready_timeout: Controller ready timeout
906907
* @intr_info: Interrupt cookie pointer
907908
* @intr_info_count: Number of interrupt cookies
@@ -1055,6 +1056,7 @@ struct mpi3mr_ioc {
10551056
u8 admin_reply_ephase;
10561057
void *admin_reply_base;
10571058
dma_addr_t admin_reply_dma;
1059+
atomic_t admin_reply_q_in_use;
10581060

10591061
u32 ready_timeout;
10601062

@@ -1390,4 +1392,5 @@ void mpi3mr_add_event_wait_for_device_refresh(struct mpi3mr_ioc *mrioc);
13901392
void mpi3mr_flush_drv_cmds(struct mpi3mr_ioc *mrioc);
13911393
void mpi3mr_flush_cmds_for_unrecovered_controller(struct mpi3mr_ioc *mrioc);
13921394
void mpi3mr_free_enclosure_list(struct mpi3mr_ioc *mrioc);
1395+
int mpi3mr_process_admin_reply_q(struct mpi3mr_ioc *mrioc);
13931396
#endif /*MPI3MR_H_INCLUDED*/

drivers/scsi/mpi3mr/mpi3mr_app.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -886,7 +886,7 @@ static int mpi3mr_build_nvme_prp(struct mpi3mr_ioc *mrioc,
886886
* each time through the loop.
887887
*/
888888
*prp_entry = cpu_to_le64(dma_addr);
889-
if (*prp1_entry & sgemod_mask) {
889+
if (*prp_entry & sgemod_mask) {
890890
dprint_bsg_err(mrioc,
891891
"%s: PRP address collides with SGE modifier\n",
892892
__func__);
@@ -895,7 +895,7 @@ static int mpi3mr_build_nvme_prp(struct mpi3mr_ioc *mrioc,
895895
*prp_entry &= ~sgemod_mask;
896896
*prp_entry |= sgemod_val;
897897
prp_entry++;
898-
prp_entry_dma++;
898+
prp_entry_dma += prp_size;
899899
}
900900

901901
/*

drivers/scsi/mpi3mr/mpi3mr_fw.c

Lines changed: 37 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -415,20 +415,25 @@ static void mpi3mr_process_admin_reply_desc(struct mpi3mr_ioc *mrioc,
415415
le64_to_cpu(scsi_reply->sense_data_buffer_address));
416416
}
417417

418-
static int mpi3mr_process_admin_reply_q(struct mpi3mr_ioc *mrioc)
418+
int mpi3mr_process_admin_reply_q(struct mpi3mr_ioc *mrioc)
419419
{
420420
u32 exp_phase = mrioc->admin_reply_ephase;
421421
u32 admin_reply_ci = mrioc->admin_reply_ci;
422422
u32 num_admin_replies = 0;
423423
u64 reply_dma = 0;
424424
struct mpi3_default_reply_descriptor *reply_desc;
425425

426+
if (!atomic_add_unless(&mrioc->admin_reply_q_in_use, 1, 1))
427+
return 0;
428+
426429
reply_desc = (struct mpi3_default_reply_descriptor *)mrioc->admin_reply_base +
427430
admin_reply_ci;
428431

429432
if ((le16_to_cpu(reply_desc->reply_flags) &
430-
MPI3_REPLY_DESCRIPT_FLAGS_PHASE_MASK) != exp_phase)
433+
MPI3_REPLY_DESCRIPT_FLAGS_PHASE_MASK) != exp_phase) {
434+
atomic_dec(&mrioc->admin_reply_q_in_use);
431435
return 0;
436+
}
432437

433438
do {
434439
if (mrioc->unrecoverable)
@@ -454,6 +459,7 @@ static int mpi3mr_process_admin_reply_q(struct mpi3mr_ioc *mrioc)
454459
writel(admin_reply_ci, &mrioc->sysif_regs->admin_reply_queue_ci);
455460
mrioc->admin_reply_ci = admin_reply_ci;
456461
mrioc->admin_reply_ephase = exp_phase;
462+
atomic_dec(&mrioc->admin_reply_q_in_use);
457463

458464
return num_admin_replies;
459465
}
@@ -1192,7 +1198,7 @@ mpi3mr_revalidate_factsdata(struct mpi3mr_ioc *mrioc)
11921198
*/
11931199
static int mpi3mr_bring_ioc_ready(struct mpi3mr_ioc *mrioc)
11941200
{
1195-
u32 ioc_config, ioc_status, timeout;
1201+
u32 ioc_config, ioc_status, timeout, host_diagnostic;
11961202
int retval = 0;
11971203
enum mpi3mr_iocstate ioc_state;
11981204
u64 base_info;
@@ -1246,6 +1252,23 @@ static int mpi3mr_bring_ioc_ready(struct mpi3mr_ioc *mrioc)
12461252
retval, mpi3mr_iocstate_name(ioc_state));
12471253
}
12481254
if (ioc_state != MRIOC_STATE_RESET) {
1255+
if (ioc_state == MRIOC_STATE_FAULT) {
1256+
timeout = MPI3_SYSIF_DIAG_SAVE_TIMEOUT * 10;
1257+
mpi3mr_print_fault_info(mrioc);
1258+
do {
1259+
host_diagnostic =
1260+
readl(&mrioc->sysif_regs->host_diagnostic);
1261+
if (!(host_diagnostic &
1262+
MPI3_SYSIF_HOST_DIAG_SAVE_IN_PROGRESS))
1263+
break;
1264+
if (!pci_device_is_present(mrioc->pdev)) {
1265+
mrioc->unrecoverable = 1;
1266+
ioc_err(mrioc, "controller is not present at the bringup\n");
1267+
goto out_device_not_present;
1268+
}
1269+
msleep(100);
1270+
} while (--timeout);
1271+
}
12491272
mpi3mr_print_fault_info(mrioc);
12501273
ioc_info(mrioc, "issuing soft reset to bring to reset state\n");
12511274
retval = mpi3mr_issue_reset(mrioc,
@@ -2605,6 +2628,7 @@ static int mpi3mr_setup_admin_qpair(struct mpi3mr_ioc *mrioc)
26052628
mrioc->admin_reply_ci = 0;
26062629
mrioc->admin_reply_ephase = 1;
26072630
mrioc->admin_reply_base = NULL;
2631+
atomic_set(&mrioc->admin_reply_q_in_use, 0);
26082632

26092633
if (!mrioc->admin_req_base) {
26102634
mrioc->admin_req_base = dma_alloc_coherent(&mrioc->pdev->dev,
@@ -3816,8 +3840,10 @@ int mpi3mr_init_ioc(struct mpi3mr_ioc *mrioc)
38163840
dprint_init(mrioc, "allocating config page buffers\n");
38173841
mrioc->cfg_page = dma_alloc_coherent(&mrioc->pdev->dev,
38183842
MPI3MR_DEFAULT_CFG_PAGE_SZ, &mrioc->cfg_page_dma, GFP_KERNEL);
3819-
if (!mrioc->cfg_page)
3843+
if (!mrioc->cfg_page) {
3844+
retval = -1;
38203845
goto out_failed_noretry;
3846+
}
38213847

38223848
mrioc->cfg_page_sz = MPI3MR_DEFAULT_CFG_PAGE_SZ;
38233849

@@ -3879,8 +3905,10 @@ int mpi3mr_init_ioc(struct mpi3mr_ioc *mrioc)
38793905
dprint_init(mrioc, "allocating memory for throttle groups\n");
38803906
sz = sizeof(struct mpi3mr_throttle_group_info);
38813907
mrioc->throttle_groups = kcalloc(mrioc->num_io_throttle_group, sz, GFP_KERNEL);
3882-
if (!mrioc->throttle_groups)
3908+
if (!mrioc->throttle_groups) {
3909+
retval = -1;
38833910
goto out_failed_noretry;
3911+
}
38843912
}
38853913

38863914
retval = mpi3mr_enable_events(mrioc);
@@ -3900,6 +3928,7 @@ int mpi3mr_init_ioc(struct mpi3mr_ioc *mrioc)
39003928
mpi3mr_memset_buffers(mrioc);
39013929
goto retry_init;
39023930
}
3931+
retval = -1;
39033932
out_failed_noretry:
39043933
ioc_err(mrioc, "controller initialization failed\n");
39053934
mpi3mr_issue_reset(mrioc, MPI3_SYSIF_HOST_DIAG_RESET_ACTION_DIAG_FAULT,
@@ -4012,6 +4041,7 @@ int mpi3mr_reinit_ioc(struct mpi3mr_ioc *mrioc, u8 is_resume)
40124041
ioc_err(mrioc,
40134042
"cannot create minimum number of operational queues expected:%d created:%d\n",
40144043
mrioc->shost->nr_hw_queues, mrioc->num_op_reply_q);
4044+
retval = -1;
40154045
goto out_failed_noretry;
40164046
}
40174047

@@ -4078,6 +4108,7 @@ int mpi3mr_reinit_ioc(struct mpi3mr_ioc *mrioc, u8 is_resume)
40784108
mpi3mr_memset_buffers(mrioc);
40794109
goto retry_init;
40804110
}
4111+
retval = -1;
40814112
out_failed_noretry:
40824113
ioc_err(mrioc, "controller %s is failed\n",
40834114
(is_resume)?"resume":"re-initialization");
@@ -4155,6 +4186,7 @@ void mpi3mr_memset_buffers(struct mpi3mr_ioc *mrioc)
41554186
memset(mrioc->admin_req_base, 0, mrioc->admin_req_q_sz);
41564187
if (mrioc->admin_reply_base)
41574188
memset(mrioc->admin_reply_base, 0, mrioc->admin_reply_q_sz);
4189+
atomic_set(&mrioc->admin_reply_q_in_use, 0);
41584190

41594191
if (mrioc->init_cmds.reply) {
41604192
memset(mrioc->init_cmds.reply, 0, sizeof(*mrioc->init_cmds.reply));

drivers/scsi/mpi3mr/mpi3mr_os.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3720,6 +3720,7 @@ int mpi3mr_issue_tm(struct mpi3mr_ioc *mrioc, u8 tm_type,
37203720
mpi3mr_poll_pend_io_completions(mrioc);
37213721
mpi3mr_ioc_enable_intr(mrioc);
37223722
mpi3mr_poll_pend_io_completions(mrioc);
3723+
mpi3mr_process_admin_reply_q(mrioc);
37233724
}
37243725
switch (tm_type) {
37253726
case MPI3_SCSITASKMGMT_TASKTYPE_TARGET_RESET:

0 commit comments

Comments
 (0)