Commit 5e9a522b authored by Martin K. Petersen's avatar Martin K. Petersen
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: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parents 6cd48c8f 7a6bbc28
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -217,7 +217,7 @@ current *struct* is::
		int (*media_changed)(struct cdrom_device_info *, int);
		int (*tray_move)(struct cdrom_device_info *, int);
		int (*lock_door)(struct cdrom_device_info *, int);
		int (*select_speed)(struct cdrom_device_info *, int);
		int (*select_speed)(struct cdrom_device_info *, unsigned long);
		int (*get_last_session) (struct cdrom_device_info *,
					 struct cdrom_multisession *);
		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.

::

	int select_speed(struct cdrom_device_info *cdi, int speed)
	int select_speed(struct cdrom_device_info *cdi, unsigned long speed)

Some CD-ROM drives are capable of changing their head-speed. There
are several reasons for changing the speed of a CD-ROM drive. Badly
+22 −9
Original line number Diff line number Diff line
@@ -414,28 +414,40 @@ static char print_alua_state(unsigned char state)
	}
}

static enum scsi_disposition alua_check_sense(struct scsi_device *sdev,
					      struct scsi_sense_hdr *sense_hdr)
static void alua_handle_state_transition(struct scsi_device *sdev)
{
	struct alua_dh_data *h = sdev->handler_data;
	struct alua_port_group *pg;

	switch (sense_hdr->sense_key) {
	case NOT_READY:
		if (sense_hdr->asc == 0x04 && sense_hdr->ascq == 0x0a) {
			/*
			 * LUN Not Accessible - ALUA state transition
			 */
	rcu_read_lock();
	pg = rcu_dereference(h->pg);
	if (pg)
		pg->state = SCSI_ACCESS_STATE_TRANSITIONING;
	rcu_read_unlock();
	alua_check(sdev, false);
}

static enum scsi_disposition alua_check_sense(struct scsi_device *sdev,
					      struct scsi_sense_hdr *sense_hdr)
{
	switch (sense_hdr->sense_key) {
	case NOT_READY:
		if (sense_hdr->asc == 0x04 && sense_hdr->ascq == 0x0a) {
			/*
			 * LUN Not Accessible - ALUA state transition
			 */
			alua_handle_state_transition(sdev);
			return NEEDS_RETRY;
		}
		break;
	case UNIT_ATTENTION:
		if (sense_hdr->asc == 0x04 && sense_hdr->ascq == 0x0a) {
			/*
			 * LUN Not Accessible - ALUA state transition
			 */
			alua_handle_state_transition(sdev);
			return NEEDS_RETRY;
		}
		if (sense_hdr->asc == 0x29 && sense_hdr->ascq == 0x00) {
			/*
			 * Power On, Reset, or Bus Device Reset.
@@ -502,7 +514,8 @@ static int alua_tur(struct scsi_device *sdev)

	retval = scsi_test_unit_ready(sdev, ALUA_FAILOVER_TIMEOUT * HZ,
				      ALUA_FAILOVER_RETRIES, &sense_hdr);
	if (sense_hdr.sense_key == NOT_READY &&
	if ((sense_hdr.sense_key == NOT_READY ||
	     sense_hdr.sense_key == UNIT_ATTENTION) &&
	    sense_hdr.asc == 0x04 && sense_hdr.ascq == 0x0a)
		return SCSI_DH_RETRY;
	else if (retval)
+14 −0
Original line number Diff line number Diff line
@@ -145,6 +145,20 @@ static inline void sas_fail_probe(struct domain_device *dev, const char *func, i
		func, dev->parent ? "exp-attached" :
		"direct-attached",
		SAS_ADDR(dev->sas_addr), err);

	/*
	 * If the device probe failed, the expander phy attached address
	 * needs to be reset so that the phy will not be treated as flutter
	 * in the next revalidation
	 */
	if (dev->parent && !dev_is_expander(dev->dev_type)) {
		struct sas_phy *phy = dev->phy;
		struct domain_device *parent = dev->parent;
		struct ex_phy *ex_phy = &parent->ex_dev.ex_phy[phy->number];

		memset(ex_phy->attached_sas_addr, 0, SAS_ADDR_SIZE);
	}

	sas_unregister_dev(dev->port, dev);
}

+62 −0
Original line number Diff line number Diff line
@@ -3247,10 +3247,72 @@ persistent_id_show(struct device *dev, struct device_attribute *attr,
}
static DEVICE_ATTR_RO(persistent_id);

/**
 * sas_ncq_prio_supported_show - Indicate if device supports NCQ priority
 * @dev: pointer to embedded device
 * @attr: sas_ncq_prio_supported attribute descriptor
 * @buf: the buffer returned
 *
 * A sysfs 'read-only' sdev attribute, only works with SATA devices
 */
static ssize_t
sas_ncq_prio_supported_show(struct device *dev,
			    struct device_attribute *attr, char *buf)
{
	struct scsi_device *sdev = to_scsi_device(dev);

	return sysfs_emit(buf, "%d\n", sas_ata_ncq_prio_supported(sdev));
}
static DEVICE_ATTR_RO(sas_ncq_prio_supported);

/**
 * sas_ncq_prio_enable_show - send prioritized io commands to device
 * @dev: pointer to embedded device
 * @attr: sas_ncq_prio_enable attribute descriptor
 * @buf: the buffer returned
 *
 * A sysfs 'read/write' sdev attribute, only works with SATA devices
 */
static ssize_t
sas_ncq_prio_enable_show(struct device *dev,
				 struct device_attribute *attr, char *buf)
{
	struct scsi_device *sdev = to_scsi_device(dev);
	struct mpi3mr_sdev_priv_data *sdev_priv_data =  sdev->hostdata;

	if (!sdev_priv_data)
		return 0;

	return sysfs_emit(buf, "%d\n", sdev_priv_data->ncq_prio_enable);
}

static ssize_t
sas_ncq_prio_enable_store(struct device *dev,
				  struct device_attribute *attr,
				  const char *buf, size_t count)
{
	struct scsi_device *sdev = to_scsi_device(dev);
	struct mpi3mr_sdev_priv_data *sdev_priv_data =  sdev->hostdata;
	bool ncq_prio_enable = 0;

	if (kstrtobool(buf, &ncq_prio_enable))
		return -EINVAL;

	if (!sas_ata_ncq_prio_supported(sdev))
		return -EINVAL;

	sdev_priv_data->ncq_prio_enable = ncq_prio_enable;

	return strlen(buf);
}
static DEVICE_ATTR_RW(sas_ncq_prio_enable);

static struct attribute *mpi3mr_dev_attrs[] = {
	&dev_attr_sas_address.attr,
	&dev_attr_device_handle.attr,
	&dev_attr_persistent_id.attr,
	&dev_attr_sas_ncq_prio_supported.attr,
	&dev_attr_sas_ncq_prio_enable.attr,
	NULL,
};

+1 −1
Original line number Diff line number Diff line
@@ -1378,7 +1378,7 @@ static struct mpi3mr_sas_port *mpi3mr_sas_port_add(struct mpi3mr_ioc *mrioc,
			continue;

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