Skip to content

Commit 5e9a522

Browse files
Merge branch '6.10/scsi-fixes' into 6.11/scsi-staging
Pull in my fixes branch to resolve an mpi3mr merge conflict reported by sfr. Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2 parents 6cd48c8 + 7a6bbc2 commit 5e9a522

File tree

24 files changed

+273
-75
lines changed

24 files changed

+273
-75
lines changed

Documentation/cdrom/cdrom-standard.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ current *struct* is::
217217
int (*media_changed)(struct cdrom_device_info *, int);
218218
int (*tray_move)(struct cdrom_device_info *, int);
219219
int (*lock_door)(struct cdrom_device_info *, int);
220-
int (*select_speed)(struct cdrom_device_info *, int);
220+
int (*select_speed)(struct cdrom_device_info *, unsigned long);
221221
int (*get_last_session) (struct cdrom_device_info *,
222222
struct cdrom_multisession *);
223223
int (*get_mcn)(struct cdrom_device_info *, struct cdrom_mcn *);
@@ -396,7 +396,7 @@ action need be taken, and the return value should be 0.
396396

397397
::
398398

399-
int select_speed(struct cdrom_device_info *cdi, int speed)
399+
int select_speed(struct cdrom_device_info *cdi, unsigned long speed)
400400

401401
Some CD-ROM drives are capable of changing their head-speed. There
402402
are several reasons for changing the speed of a CD-ROM drive. Badly

drivers/scsi/device_handler/scsi_dh_alua.c

Lines changed: 22 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -414,28 +414,40 @@ static char print_alua_state(unsigned char state)
414414
}
415415
}
416416

417-
static enum scsi_disposition alua_check_sense(struct scsi_device *sdev,
418-
struct scsi_sense_hdr *sense_hdr)
417+
static void alua_handle_state_transition(struct scsi_device *sdev)
419418
{
420419
struct alua_dh_data *h = sdev->handler_data;
421420
struct alua_port_group *pg;
422421

422+
rcu_read_lock();
423+
pg = rcu_dereference(h->pg);
424+
if (pg)
425+
pg->state = SCSI_ACCESS_STATE_TRANSITIONING;
426+
rcu_read_unlock();
427+
alua_check(sdev, false);
428+
}
429+
430+
static enum scsi_disposition alua_check_sense(struct scsi_device *sdev,
431+
struct scsi_sense_hdr *sense_hdr)
432+
{
423433
switch (sense_hdr->sense_key) {
424434
case NOT_READY:
425435
if (sense_hdr->asc == 0x04 && sense_hdr->ascq == 0x0a) {
426436
/*
427437
* LUN Not Accessible - ALUA state transition
428438
*/
429-
rcu_read_lock();
430-
pg = rcu_dereference(h->pg);
431-
if (pg)
432-
pg->state = SCSI_ACCESS_STATE_TRANSITIONING;
433-
rcu_read_unlock();
434-
alua_check(sdev, false);
439+
alua_handle_state_transition(sdev);
435440
return NEEDS_RETRY;
436441
}
437442
break;
438443
case UNIT_ATTENTION:
444+
if (sense_hdr->asc == 0x04 && sense_hdr->ascq == 0x0a) {
445+
/*
446+
* LUN Not Accessible - ALUA state transition
447+
*/
448+
alua_handle_state_transition(sdev);
449+
return NEEDS_RETRY;
450+
}
439451
if (sense_hdr->asc == 0x29 && sense_hdr->ascq == 0x00) {
440452
/*
441453
* Power On, Reset, or Bus Device Reset.
@@ -502,7 +514,8 @@ static int alua_tur(struct scsi_device *sdev)
502514

503515
retval = scsi_test_unit_ready(sdev, ALUA_FAILOVER_TIMEOUT * HZ,
504516
ALUA_FAILOVER_RETRIES, &sense_hdr);
505-
if (sense_hdr.sense_key == NOT_READY &&
517+
if ((sense_hdr.sense_key == NOT_READY ||
518+
sense_hdr.sense_key == UNIT_ATTENTION) &&
506519
sense_hdr.asc == 0x04 && sense_hdr.ascq == 0x0a)
507520
return SCSI_DH_RETRY;
508521
else if (retval)

drivers/scsi/libsas/sas_internal.h

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,20 @@ static inline void sas_fail_probe(struct domain_device *dev, const char *func, i
145145
func, dev->parent ? "exp-attached" :
146146
"direct-attached",
147147
SAS_ADDR(dev->sas_addr), err);
148+
149+
/*
150+
* If the device probe failed, the expander phy attached address
151+
* needs to be reset so that the phy will not be treated as flutter
152+
* in the next revalidation
153+
*/
154+
if (dev->parent && !dev_is_expander(dev->dev_type)) {
155+
struct sas_phy *phy = dev->phy;
156+
struct domain_device *parent = dev->parent;
157+
struct ex_phy *ex_phy = &parent->ex_dev.ex_phy[phy->number];
158+
159+
memset(ex_phy->attached_sas_addr, 0, SAS_ADDR_SIZE);
160+
}
161+
148162
sas_unregister_dev(dev->port, dev);
149163
}
150164

drivers/scsi/mpi3mr/mpi3mr_app.c

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3247,10 +3247,72 @@ persistent_id_show(struct device *dev, struct device_attribute *attr,
32473247
}
32483248
static DEVICE_ATTR_RO(persistent_id);
32493249

3250+
/**
3251+
* sas_ncq_prio_supported_show - Indicate if device supports NCQ priority
3252+
* @dev: pointer to embedded device
3253+
* @attr: sas_ncq_prio_supported attribute descriptor
3254+
* @buf: the buffer returned
3255+
*
3256+
* A sysfs 'read-only' sdev attribute, only works with SATA devices
3257+
*/
3258+
static ssize_t
3259+
sas_ncq_prio_supported_show(struct device *dev,
3260+
struct device_attribute *attr, char *buf)
3261+
{
3262+
struct scsi_device *sdev = to_scsi_device(dev);
3263+
3264+
return sysfs_emit(buf, "%d\n", sas_ata_ncq_prio_supported(sdev));
3265+
}
3266+
static DEVICE_ATTR_RO(sas_ncq_prio_supported);
3267+
3268+
/**
3269+
* sas_ncq_prio_enable_show - send prioritized io commands to device
3270+
* @dev: pointer to embedded device
3271+
* @attr: sas_ncq_prio_enable attribute descriptor
3272+
* @buf: the buffer returned
3273+
*
3274+
* A sysfs 'read/write' sdev attribute, only works with SATA devices
3275+
*/
3276+
static ssize_t
3277+
sas_ncq_prio_enable_show(struct device *dev,
3278+
struct device_attribute *attr, char *buf)
3279+
{
3280+
struct scsi_device *sdev = to_scsi_device(dev);
3281+
struct mpi3mr_sdev_priv_data *sdev_priv_data = sdev->hostdata;
3282+
3283+
if (!sdev_priv_data)
3284+
return 0;
3285+
3286+
return sysfs_emit(buf, "%d\n", sdev_priv_data->ncq_prio_enable);
3287+
}
3288+
3289+
static ssize_t
3290+
sas_ncq_prio_enable_store(struct device *dev,
3291+
struct device_attribute *attr,
3292+
const char *buf, size_t count)
3293+
{
3294+
struct scsi_device *sdev = to_scsi_device(dev);
3295+
struct mpi3mr_sdev_priv_data *sdev_priv_data = sdev->hostdata;
3296+
bool ncq_prio_enable = 0;
3297+
3298+
if (kstrtobool(buf, &ncq_prio_enable))
3299+
return -EINVAL;
3300+
3301+
if (!sas_ata_ncq_prio_supported(sdev))
3302+
return -EINVAL;
3303+
3304+
sdev_priv_data->ncq_prio_enable = ncq_prio_enable;
3305+
3306+
return strlen(buf);
3307+
}
3308+
static DEVICE_ATTR_RW(sas_ncq_prio_enable);
3309+
32503310
static struct attribute *mpi3mr_dev_attrs[] = {
32513311
&dev_attr_sas_address.attr,
32523312
&dev_attr_device_handle.attr,
32533313
&dev_attr_persistent_id.attr,
3314+
&dev_attr_sas_ncq_prio_supported.attr,
3315+
&dev_attr_sas_ncq_prio_enable.attr,
32543316
NULL,
32553317
};
32563318

drivers/scsi/mpi3mr/mpi3mr_transport.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1378,7 +1378,7 @@ static struct mpi3mr_sas_port *mpi3mr_sas_port_add(struct mpi3mr_ioc *mrioc,
13781378
continue;
13791379

13801380
if (i >= sizeof(mr_sas_port->phy_mask) * 8) {
1381-
ioc_warn(mrioc, "skipping port %u, max allowed value is %lu\n",
1381+
ioc_warn(mrioc, "skipping port %u, max allowed value is %zu\n",
13821382
i, sizeof(mr_sas_port->phy_mask) * 8);
13831383
goto out_fail;
13841384
}

drivers/scsi/mpt3sas/mpt3sas_base.c

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8512,6 +8512,12 @@ mpt3sas_base_attach(struct MPT3SAS_ADAPTER *ioc)
85128512
ioc->pd_handles_sz = (ioc->facts.MaxDevHandle / 8);
85138513
if (ioc->facts.MaxDevHandle % 8)
85148514
ioc->pd_handles_sz++;
8515+
/*
8516+
* pd_handles_sz should have, at least, the minimal room for
8517+
* set_bit()/test_bit(), otherwise out-of-memory touch may occur.
8518+
*/
8519+
ioc->pd_handles_sz = ALIGN(ioc->pd_handles_sz, sizeof(unsigned long));
8520+
85158521
ioc->pd_handles = kzalloc(ioc->pd_handles_sz,
85168522
GFP_KERNEL);
85178523
if (!ioc->pd_handles) {
@@ -8529,6 +8535,13 @@ mpt3sas_base_attach(struct MPT3SAS_ADAPTER *ioc)
85298535
ioc->pend_os_device_add_sz = (ioc->facts.MaxDevHandle / 8);
85308536
if (ioc->facts.MaxDevHandle % 8)
85318537
ioc->pend_os_device_add_sz++;
8538+
8539+
/*
8540+
* pend_os_device_add_sz should have, at least, the minimal room for
8541+
* set_bit()/test_bit(), otherwise out-of-memory may occur.
8542+
*/
8543+
ioc->pend_os_device_add_sz = ALIGN(ioc->pend_os_device_add_sz,
8544+
sizeof(unsigned long));
85328545
ioc->pend_os_device_add = kzalloc(ioc->pend_os_device_add_sz,
85338546
GFP_KERNEL);
85348547
if (!ioc->pend_os_device_add) {
@@ -8820,6 +8833,12 @@ _base_check_ioc_facts_changes(struct MPT3SAS_ADAPTER *ioc)
88208833
if (ioc->facts.MaxDevHandle % 8)
88218834
pd_handles_sz++;
88228835

8836+
/*
8837+
* pd_handles should have, at least, the minimal room for
8838+
* set_bit()/test_bit(), otherwise out-of-memory touch may
8839+
* occur.
8840+
*/
8841+
pd_handles_sz = ALIGN(pd_handles_sz, sizeof(unsigned long));
88238842
pd_handles = krealloc(ioc->pd_handles, pd_handles_sz,
88248843
GFP_KERNEL);
88258844
if (!pd_handles) {

drivers/scsi/mpt3sas/mpt3sas_base.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2048,9 +2048,6 @@ void
20482048
mpt3sas_setup_direct_io(struct MPT3SAS_ADAPTER *ioc, struct scsi_cmnd *scmd,
20492049
struct _raid_device *raid_device, Mpi25SCSIIORequest_t *mpi_request);
20502050

2051-
/* NCQ Prio Handling Check */
2052-
bool scsih_ncq_prio_supp(struct scsi_device *sdev);
2053-
20542051
void mpt3sas_setup_debugfs(struct MPT3SAS_ADAPTER *ioc);
20552052
void mpt3sas_destroy_debugfs(struct MPT3SAS_ADAPTER *ioc);
20562053
void mpt3sas_init_debugfs(void);

drivers/scsi/mpt3sas/mpt3sas_ctl.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4088,7 +4088,7 @@ sas_ncq_prio_supported_show(struct device *dev,
40884088
{
40894089
struct scsi_device *sdev = to_scsi_device(dev);
40904090

4091-
return sysfs_emit(buf, "%d\n", scsih_ncq_prio_supp(sdev));
4091+
return sysfs_emit(buf, "%d\n", sas_ata_ncq_prio_supported(sdev));
40924092
}
40934093
static DEVICE_ATTR_RO(sas_ncq_prio_supported);
40944094

@@ -4123,7 +4123,7 @@ sas_ncq_prio_enable_store(struct device *dev,
41234123
if (kstrtobool(buf, &ncq_prio_enable))
41244124
return -EINVAL;
41254125

4126-
if (!scsih_ncq_prio_supp(sdev))
4126+
if (!sas_ata_ncq_prio_supported(sdev))
41274127
return -EINVAL;
41284128

41294129
sas_device_priv_data->ncq_prio_enable = ncq_prio_enable;

drivers/scsi/mpt3sas/mpt3sas_scsih.c

Lines changed: 2 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -302,8 +302,8 @@ struct _scsi_io_transfer {
302302

303303
/**
304304
* _scsih_set_debug_level - global setting of ioc->logging_level.
305-
* @val: ?
306-
* @kp: ?
305+
* @val: value of the parameter to be set
306+
* @kp: pointer to kernel_param structure
307307
*
308308
* Note: The logging levels are defined in mpt3sas_debug.h.
309309
*/
@@ -12571,29 +12571,6 @@ scsih_pci_mmio_enabled(struct pci_dev *pdev)
1257112571
return PCI_ERS_RESULT_RECOVERED;
1257212572
}
1257312573

12574-
/**
12575-
* scsih_ncq_prio_supp - Check for NCQ command priority support
12576-
* @sdev: scsi device struct
12577-
*
12578-
* This is called when a user indicates they would like to enable
12579-
* ncq command priorities. This works only on SATA devices.
12580-
*/
12581-
bool scsih_ncq_prio_supp(struct scsi_device *sdev)
12582-
{
12583-
struct scsi_vpd *vpd;
12584-
bool ncq_prio_supp = false;
12585-
12586-
rcu_read_lock();
12587-
vpd = rcu_dereference(sdev->vpd_pg89);
12588-
if (!vpd || vpd->len < 214)
12589-
goto out;
12590-
12591-
ncq_prio_supp = (vpd->data[213] >> 4) & 1;
12592-
out:
12593-
rcu_read_unlock();
12594-
12595-
return ncq_prio_supp;
12596-
}
1259712574
/*
1259812575
* The pci device ids are defined in mpi/mpi2_cnfg.h.
1259912576
*/

drivers/scsi/qedf/qedf.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -363,6 +363,7 @@ struct qedf_ctx {
363363
#define QEDF_IN_RECOVERY 5
364364
#define QEDF_DBG_STOP_IO 6
365365
#define QEDF_PROBING 8
366+
#define QEDF_STAG_IN_PROGRESS 9
366367
unsigned long flags; /* Miscellaneous state flags */
367368
int fipvlan_retries;
368369
u8 num_queues;

0 commit comments

Comments
 (0)