SCSI misc on 20190709
This is mostly update of the usual drivers: qla2xxx, hpsa, lpfc, ufs,
mpt3sas, ibmvscsi, megaraid_sas, bnx2fc and hisi_sas as well as the
removal of the osst driver (I heard from Willem privately that he
would like the driver removed because all his test hardware has
failed). Plus number of minor changes, spelling fixes and other
trivia.
Signed-off-by: James E.J. Bottomley <jejb@linux.ibm.com>
-----BEGIN PGP SIGNATURE-----
iJwEABMIAEQWIQTnYEDbdso9F2cI+arnQslM7pishQUCXSTl4yYcamFtZXMuYm90
dG9tbGV5QGhhbnNlbnBhcnRuZXJzaGlwLmNvbQAKCRDnQslM7pishdcxAQDCJVbd
fPUX76/V1ldupunF97+3DTharxxbst+VnkOnCwD8D4c0KFFFOI9+F36cnMGCPegE
fjy17dQLvsJ4GsidHy8=
=aS5B
-----END PGP SIGNATURE-----
Merge tag 'scsi-misc' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi
Pull SCSI updates from James Bottomley:
"This is mostly update of the usual drivers: qla2xxx, hpsa, lpfc, ufs,
mpt3sas, ibmvscsi, megaraid_sas, bnx2fc and hisi_sas as well as the
removal of the osst driver (I heard from Willem privately that he
would like the driver removed because all his test hardware has
failed). Plus number of minor changes, spelling fixes and other
trivia.
The big merge conflict this time around is the SPDX licence tags.
Following discussion on linux-next, we believe our version to be more
accurate than the one in the tree, so the resolution is to take our
version for all the SPDX conflicts"
Note on the SPDX license tag conversion conflicts: the SCSI tree had
done its own SPDX conversion, which in some cases conflicted with the
treewide ones done by Thomas & co.
In almost all cases, the conflicts were purely syntactic: the SCSI tree
used the old-style SPDX tags ("GPL-2.0" and "GPL-2.0+") while the
treewide conversion had used the new-style ones ("GPL-2.0-only" and
"GPL-2.0-or-later").
In these cases I picked the new-style one.
In a few cases, the SPDX conversion was actually different, though. As
explained by James above, and in more detail in a pre-pull-request
thread:
"The other problem is actually substantive: In the libsas code Luben
Tuikov originally specified gpl 2.0 only by dint of stating:
* This file is licensed under GPLv2.
In all the libsas files, but then muddied the water by quoting GPLv2
verbatim (which includes the or later than language). So for these
files Christoph did the conversion to v2 only SPDX tags and Thomas
converted to v2 or later tags"
So in those cases, where the spdx tag substantially mattered, I took the
SCSI tree conversion of it, but then also took the opportunity to turn
the old-style "GPL-2.0" into a new-style "GPL-2.0-only" tag.
Similarly, when there were whitespace differences or other differences
to the comments around the copyright notices, I took the version from
the SCSI tree as being the more specific conversion.
Finally, in the spdx conversions that had no conflicts (because the
treewide ones hadn't been done for those files), I just took the SCSI
tree version as-is, even if it was old-style. The old-style conversions
are perfectly valid, even if the "-only" and "-or-later" versions are
perhaps more descriptive.
* tag 'scsi-misc' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi: (185 commits)
scsi: qla2xxx: move IO flush to the front of NVME rport unregistration
scsi: qla2xxx: Fix NVME cmd and LS cmd timeout race condition
scsi: qla2xxx: on session delete, return nvme cmd
scsi: qla2xxx: Fix kernel crash after disconnecting NVMe devices
scsi: megaraid_sas: Update driver version to 07.710.06.00-rc1
scsi: megaraid_sas: Introduce various Aero performance modes
scsi: megaraid_sas: Use high IOPS queues based on IO workload
scsi: megaraid_sas: Set affinity for high IOPS reply queues
scsi: megaraid_sas: Enable coalescing for high IOPS queues
scsi: megaraid_sas: Add support for High IOPS queues
scsi: megaraid_sas: Add support for MPI toolbox commands
scsi: megaraid_sas: Offload Aero RAID5/6 division calculations to driver
scsi: megaraid_sas: RAID1 PCI bandwidth limit algorithm is applicable for only Ventura
scsi: megaraid_sas: megaraid_sas: Add check for count returned by HOST_DEVICE_LIST DCMD
scsi: megaraid_sas: Handle sequence JBOD map failure at driver level
scsi: megaraid_sas: Don't send FPIO to RL Bypass queue
scsi: megaraid_sas: In probe context, retry IOC INIT once if firmware is in fault
scsi: megaraid_sas: Release Mutex lock before OCR in case of DCMD timeout
scsi: megaraid_sas: Call disable_irq from process IRQ poll
scsi: megaraid_sas: Remove few debug counters from IO path
...
2019-07-12 01:14:01 +03:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0-only */
|
2006-08-29 18:22:51 +04:00
|
|
|
/*
|
|
|
|
* Serial Attached SCSI (SAS) class internal header file
|
|
|
|
*
|
|
|
|
* Copyright (C) 2005 Adaptec, Inc. All rights reserved.
|
|
|
|
* Copyright (C) 2005 Luben Tuikov <luben_tuikov@adaptec.com>
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _SAS_INTERNAL_H_
|
|
|
|
#define _SAS_INTERNAL_H_
|
|
|
|
|
|
|
|
#include <scsi/scsi.h>
|
|
|
|
#include <scsi/scsi_host.h>
|
|
|
|
#include <scsi/scsi_transport_sas.h>
|
|
|
|
#include <scsi/libsas.h>
|
2012-01-29 05:24:40 +04:00
|
|
|
#include <scsi/sas_ata.h>
|
2006-08-29 18:22:51 +04:00
|
|
|
|
2018-11-15 13:20:29 +03:00
|
|
|
#ifdef pr_fmt
|
|
|
|
#undef pr_fmt
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#define SAS_FMT "sas: "
|
|
|
|
|
|
|
|
#define pr_fmt(fmt) SAS_FMT fmt
|
|
|
|
|
2007-01-30 12:18:58 +03:00
|
|
|
#define TO_SAS_TASK(_scsi_cmd) ((void *)(_scsi_cmd)->host_scribble)
|
|
|
|
#define ASSIGN_SAS_TASK(_sc, _t) do { (_sc)->host_scribble = (void *) _t; } while (0)
|
|
|
|
|
2011-12-20 13:03:48 +04:00
|
|
|
struct sas_phy_data {
|
|
|
|
/* let reset be performed in sas_queue_work() context */
|
|
|
|
struct sas_phy *phy;
|
|
|
|
struct mutex event_lock;
|
|
|
|
int hard_reset;
|
|
|
|
int reset_result;
|
2012-03-09 23:00:06 +04:00
|
|
|
struct sas_work reset_work;
|
2011-12-04 12:06:57 +04:00
|
|
|
int enable;
|
|
|
|
int enable_result;
|
2012-03-09 23:00:06 +04:00
|
|
|
struct sas_work enable_work;
|
2011-12-20 13:03:48 +04:00
|
|
|
};
|
|
|
|
|
2006-08-29 18:22:51 +04:00
|
|
|
void sas_scsi_recover_host(struct Scsi_Host *shost);
|
|
|
|
|
|
|
|
int sas_show_class(enum sas_class class, char *buf);
|
2007-11-05 22:51:17 +03:00
|
|
|
int sas_show_proto(enum sas_protocol proto, char *buf);
|
2006-09-07 02:36:13 +04:00
|
|
|
int sas_show_linkrate(enum sas_linkrate linkrate, char *buf);
|
2006-08-29 18:22:51 +04:00
|
|
|
int sas_show_oob_mode(enum sas_oob_mode oob_mode, char *buf);
|
|
|
|
|
|
|
|
int sas_register_phys(struct sas_ha_struct *sas_ha);
|
|
|
|
void sas_unregister_phys(struct sas_ha_struct *sas_ha);
|
|
|
|
|
2021-01-18 13:09:48 +03:00
|
|
|
struct asd_sas_event *sas_alloc_event(struct asd_sas_phy *phy, gfp_t gfp_flags);
|
2017-12-08 12:42:04 +03:00
|
|
|
void sas_free_event(struct asd_sas_event *event);
|
|
|
|
|
2006-08-29 18:22:51 +04:00
|
|
|
int sas_register_ports(struct sas_ha_struct *sas_ha);
|
|
|
|
void sas_unregister_ports(struct sas_ha_struct *sas_ha);
|
|
|
|
|
2011-11-18 05:59:51 +04:00
|
|
|
void sas_disable_revalidation(struct sas_ha_struct *ha);
|
|
|
|
void sas_enable_revalidation(struct sas_ha_struct *ha);
|
2012-01-12 23:47:24 +04:00
|
|
|
void __sas_drain_work(struct sas_ha_struct *ha);
|
2006-08-29 18:22:51 +04:00
|
|
|
|
2011-05-25 00:17:53 +04:00
|
|
|
void sas_deform_port(struct asd_sas_phy *phy, int gone);
|
2006-08-29 18:22:51 +04:00
|
|
|
|
2006-11-22 17:57:56 +03:00
|
|
|
void sas_porte_bytes_dmaed(struct work_struct *work);
|
|
|
|
void sas_porte_broadcast_rcvd(struct work_struct *work);
|
|
|
|
void sas_porte_link_reset_err(struct work_struct *work);
|
|
|
|
void sas_porte_timer_event(struct work_struct *work);
|
|
|
|
void sas_porte_hard_reset(struct work_struct *work);
|
2017-06-14 14:52:43 +03:00
|
|
|
int sas_queue_work(struct sas_ha_struct *ha, struct sas_work *sw);
|
2006-08-29 18:22:51 +04:00
|
|
|
|
|
|
|
int sas_notify_lldd_dev_found(struct domain_device *);
|
|
|
|
void sas_notify_lldd_dev_gone(struct domain_device *);
|
|
|
|
|
2017-08-25 18:37:41 +03:00
|
|
|
void sas_smp_handler(struct bsg_job *job, struct Scsi_Host *shost,
|
|
|
|
struct sas_rphy *rphy);
|
2006-08-29 18:22:51 +04:00
|
|
|
int sas_smp_phy_control(struct domain_device *dev, int phy_id,
|
2006-09-07 04:28:07 +04:00
|
|
|
enum phy_func phy_func, struct sas_phy_linkrates *);
|
2006-08-29 18:22:51 +04:00
|
|
|
int sas_smp_get_phy_events(struct sas_phy *phy);
|
|
|
|
|
2021-01-18 13:09:48 +03:00
|
|
|
int sas_notify_phy_event(struct asd_sas_phy *phy, enum phy_event event,
|
|
|
|
gfp_t flags);
|
2011-12-22 09:33:17 +04:00
|
|
|
void sas_device_set_phy(struct domain_device *dev, struct sas_port *port);
|
2006-08-29 18:22:51 +04:00
|
|
|
struct domain_device *sas_find_dev_by_rphy(struct sas_rphy *rphy);
|
2011-12-03 04:07:01 +04:00
|
|
|
struct domain_device *sas_ex_to_ata(struct domain_device *ex_dev, int phy_id);
|
2012-01-13 05:57:35 +04:00
|
|
|
int sas_ex_phy_discover(struct domain_device *dev, int single);
|
|
|
|
int sas_get_report_phy_sata(struct domain_device *dev, int phy_id,
|
|
|
|
struct smp_resp *rps_resp);
|
2012-01-12 01:13:44 +04:00
|
|
|
int sas_try_ata_reset(struct asd_sas_phy *phy);
|
2006-11-22 17:57:56 +03:00
|
|
|
void sas_hae_reset(struct work_struct *work);
|
2006-08-29 18:22:51 +04:00
|
|
|
|
2011-11-18 05:59:47 +04:00
|
|
|
void sas_free_device(struct kref *kref);
|
2017-12-08 12:42:09 +03:00
|
|
|
void sas_destruct_devices(struct asd_sas_port *port);
|
2011-11-18 05:59:47 +04:00
|
|
|
|
2017-12-08 12:42:04 +03:00
|
|
|
extern const work_func_t sas_phy_event_fns[PHY_NUM_EVENTS];
|
|
|
|
extern const work_func_t sas_port_event_fns[PORT_NUM_EVENTS];
|
|
|
|
|
2007-12-29 01:35:17 +03:00
|
|
|
#ifdef CONFIG_SCSI_SAS_HOST_SMP
|
2017-08-25 18:37:41 +03:00
|
|
|
extern void sas_smp_host_handler(struct bsg_job *job, struct Scsi_Host *shost);
|
2007-12-29 01:35:17 +03:00
|
|
|
#else
|
2017-08-25 18:37:41 +03:00
|
|
|
static inline void sas_smp_host_handler(struct bsg_job *job,
|
|
|
|
struct Scsi_Host *shost)
|
2007-12-29 01:35:17 +03:00
|
|
|
{
|
|
|
|
shost_printk(KERN_ERR, shost,
|
|
|
|
"Cannot send SMP to a sas host (not enabled in CONFIG)\n");
|
2017-08-25 18:37:41 +03:00
|
|
|
bsg_job_done(job, -EINVAL, 0);
|
2007-12-29 01:35:17 +03:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2012-01-19 08:47:01 +04:00
|
|
|
static inline void sas_fail_probe(struct domain_device *dev, const char *func, int err)
|
|
|
|
{
|
2019-12-19 15:35:57 +03:00
|
|
|
pr_warn("%s: for %s device %016llx returned %d\n",
|
2018-11-15 13:20:31 +03:00
|
|
|
func, dev->parent ? "exp-attached" :
|
|
|
|
"direct-attached",
|
|
|
|
SAS_ADDR(dev->sas_addr), err);
|
2024-06-19 12:17:42 +03:00
|
|
|
|
|
|
|
/*
|
|
|
|
* 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);
|
|
|
|
}
|
|
|
|
|
2012-01-19 08:47:01 +04:00
|
|
|
sas_unregister_dev(dev->port, dev);
|
|
|
|
}
|
|
|
|
|
2006-08-29 18:22:51 +04:00
|
|
|
static inline void sas_fill_in_rphy(struct domain_device *dev,
|
|
|
|
struct sas_rphy *rphy)
|
|
|
|
{
|
|
|
|
rphy->identify.sas_address = SAS_ADDR(dev->sas_addr);
|
|
|
|
rphy->identify.initiator_port_protocols = dev->iproto;
|
|
|
|
rphy->identify.target_port_protocols = dev->tproto;
|
|
|
|
switch (dev->dev_type) {
|
2013-05-08 01:44:06 +04:00
|
|
|
case SAS_SATA_DEV:
|
2006-08-29 18:22:51 +04:00
|
|
|
/* FIXME: need sata device type */
|
2013-05-08 01:44:06 +04:00
|
|
|
case SAS_END_DEVICE:
|
|
|
|
case SAS_SATA_PENDING:
|
2006-08-29 18:22:51 +04:00
|
|
|
rphy->identify.device_type = SAS_END_DEVICE;
|
|
|
|
break;
|
2013-05-08 01:44:06 +04:00
|
|
|
case SAS_EDGE_EXPANDER_DEVICE:
|
2006-08-29 18:22:51 +04:00
|
|
|
rphy->identify.device_type = SAS_EDGE_EXPANDER_DEVICE;
|
|
|
|
break;
|
2013-05-08 01:44:06 +04:00
|
|
|
case SAS_FANOUT_EXPANDER_DEVICE:
|
2006-08-29 18:22:51 +04:00
|
|
|
rphy->identify.device_type = SAS_FANOUT_EXPANDER_DEVICE;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
rphy->identify.device_type = SAS_PHY_UNUSED;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-01-29 05:24:40 +04:00
|
|
|
static inline void sas_phy_set_target(struct asd_sas_phy *p, struct domain_device *dev)
|
|
|
|
{
|
|
|
|
struct sas_phy *phy = p->phy;
|
|
|
|
|
|
|
|
if (dev) {
|
|
|
|
if (dev_is_sata(dev))
|
|
|
|
phy->identify.device_type = SAS_END_DEVICE;
|
|
|
|
else
|
|
|
|
phy->identify.device_type = dev->dev_type;
|
|
|
|
phy->identify.target_port_protocols = dev->tproto;
|
|
|
|
} else {
|
|
|
|
phy->identify.device_type = SAS_PHY_UNUSED;
|
|
|
|
phy->identify.target_port_protocols = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-08-29 18:22:51 +04:00
|
|
|
static inline void sas_add_parent_port(struct domain_device *dev, int phy_id)
|
|
|
|
{
|
|
|
|
struct expander_device *ex = &dev->ex_dev;
|
|
|
|
struct ex_phy *ex_phy = &ex->ex_phy[phy_id];
|
|
|
|
|
|
|
|
if (!ex->parent_port) {
|
|
|
|
ex->parent_port = sas_port_alloc(&dev->rphy->dev, phy_id);
|
|
|
|
/* FIXME: error handling */
|
|
|
|
BUG_ON(!ex->parent_port);
|
|
|
|
BUG_ON(sas_port_add(ex->parent_port));
|
|
|
|
sas_port_mark_backlink(ex->parent_port);
|
|
|
|
}
|
|
|
|
sas_port_add_phy(ex->parent_port, ex_phy->phy);
|
|
|
|
}
|
|
|
|
|
2011-11-18 05:59:47 +04:00
|
|
|
static inline struct domain_device *sas_alloc_device(void)
|
|
|
|
{
|
|
|
|
struct domain_device *dev = kzalloc(sizeof(*dev), GFP_KERNEL);
|
|
|
|
|
|
|
|
if (dev) {
|
|
|
|
INIT_LIST_HEAD(&dev->siblings);
|
|
|
|
INIT_LIST_HEAD(&dev->dev_list_node);
|
2011-11-18 05:59:51 +04:00
|
|
|
INIT_LIST_HEAD(&dev->disco_list_node);
|
2011-11-18 05:59:47 +04:00
|
|
|
kref_init(&dev->kref);
|
2011-11-28 23:29:20 +04:00
|
|
|
spin_lock_init(&dev->done_lock);
|
2011-11-18 05:59:47 +04:00
|
|
|
}
|
|
|
|
return dev;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void sas_put_device(struct domain_device *dev)
|
|
|
|
{
|
|
|
|
kref_put(&dev->kref, sas_free_device);
|
|
|
|
}
|
|
|
|
|
2006-08-29 18:22:51 +04:00
|
|
|
#endif /* _SAS_INTERNAL_H_ */
|