OSDN Git Service

tomoyo/tomoyo-test1.git
5 years agoscsi: zfcp: drop duplicate seq_no from zfcp_fsf_req which is also in QTCB header
Steffen Maier [Thu, 8 Nov 2018 14:44:46 +0000 (15:44 +0100)]
scsi: zfcp: drop duplicate seq_no from zfcp_fsf_req which is also in QTCB header

There is no point for double bookkeeping especially just for tracing.  The
trace can take it from the QTCB which always exists for non-SRB responses
traced with zfcp_dbf_hba_fsf_res().

As a side effect, this removes an alignment hole and reduces the size of
struct zfcp_fsf_req, and thus of each pending request, by 8 bytes.

Before:
$ pahole -C zfcp_fsf_req drivers/s390/scsi/zfcp.ko
...
struct fsf_qtcb *          qtcb;                 /*   144     8 */
u32                        seq_no;               /*   152     4 */
/* XXX 4 bytes hole, try to pack */
void *                     data;                 /*   160     8 */
...
/* size: 296, cachelines: 2, members: 14 */
/* sum members: 288, holes: 2, sum holes: 8 */
/* last cacheline: 40 bytes */
After:
$ pahole -C zfcp_fsf_req drivers/s390/scsi/zfcp.ko
...
struct fsf_qtcb *          qtcb;                 /*   144     8 */
void *                     data;                 /*   152     8 */
...
/* size: 288, cachelines: 2, members: 13 */
        /* sum members: 284, holes: 1, sum holes: 4 */

Signed-off-by: Steffen Maier <maier@linux.ibm.com>
Reviewed-by: Benjamin Block <bblock@linux.ibm.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: zfcp: drop duplicate fsf_command from zfcp_fsf_req which is also in QTCB header
Steffen Maier [Thu, 8 Nov 2018 14:44:45 +0000 (15:44 +0100)]
scsi: zfcp: drop duplicate fsf_command from zfcp_fsf_req which is also in QTCB header

Status read buffers (SRBs, unsolicited notifications) never use a QTCB
[zfcp_fsf_req_create()]. zfcp_fsf_req_send() already uses this to
distinguish SRBs from other FSF request types. We can re-use this method in
zfcp_fsf_req_complete(). Introduce a helper function to make the check for
req->qtcb less magic.

SRBs always are FSF_QTCB_UNSOLICITED_STATUS, so we can hard-code this for
the two trace functions dealing with SRBs.

All other FSF request types have a QTCB and we can get the fsf_command from
there.

zfcp_dbf_hba_fsf_response() and thus zfcp_dbf_hba_fsf_res() are only called
for non-SRB requests so it's safe to dereference the QTCB
[zfcp_fsf_req_complete() returns early on SRB, else calls
zfcp_fsf_protstatus_eval() which calls zfcp_dbf_hba_fsf_response()].  In
zfcp_scsi_forget_cmnd() we guard the QTCB dereference with a preceding NULL
check and rely on boolean shortcut evaluation.

As a side effect, this causes an alignment hole which we can close in
a later patch after having cleaned up all fields of struct zfcp_fsf_req.
Before:
$ pahole -C zfcp_fsf_req drivers/s390/scsi/zfcp.ko
...
u32                        status;               /*   136     4 */
u32                        fsf_command;          /*   140     4 */
struct fsf_qtcb *          qtcb;                 /*   144     8 */
...
After:
$ pahole -C zfcp_fsf_req drivers/s390/scsi/zfcp.ko
...
u32                        status;               /*   136     4 */
/* XXX 4 bytes hole, try to pack */
struct fsf_qtcb *          qtcb;                 /*   144     8 */
...

Signed-off-by: Steffen Maier <maier@linux.ibm.com>
Reviewed-by: Benjamin Block <bblock@linux.ibm.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: zfcp: drop unnecessary forward prototype for struct zfcp_fsf_req
Steffen Maier [Thu, 8 Nov 2018 14:44:44 +0000 (15:44 +0100)]
scsi: zfcp: drop unnecessary forward prototype for struct zfcp_fsf_req

Signed-off-by: Steffen Maier <maier@linux.ibm.com>
Reviewed-by: Benjamin Block <bblock@linux.ibm.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: zfcp: group sort internal structure definitions for proximity
Steffen Maier [Thu, 8 Nov 2018 14:44:43 +0000 (15:44 +0100)]
scsi: zfcp: group sort internal structure definitions for proximity

Have structures just before the structures that use them (without
disrupting sequences of using structures such as zfcp_unit and
zfcp_scsi_dev):

 - zfcp_adapter_mempool embedded in zfcp_adapter,

 - zfcp_latenc... embedded in zfcp_scsi_dev.

Signed-off-by: Steffen Maier <maier@linux.ibm.com>
Reviewed-by: Benjamin Block <bblock@linux.ibm.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: zfcp: namespace prefix for internal latency data structures
Steffen Maier [Thu, 8 Nov 2018 14:44:42 +0000 (15:44 +0100)]
scsi: zfcp: namespace prefix for internal latency data structures

In contrast to struct fsf_qual_latency_info, the ones here are not FSF but
software defined zfcp-internal.

Signed-off-by: Steffen Maier <maier@linux.ibm.com>
Reviewed-by: Benjamin Block <bblock@linux.ibm.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: zfcp: update width in comment for ZFCP_COMMON_FLAGS mask
Steffen Maier [Thu, 8 Nov 2018 14:44:41 +0000 (15:44 +0100)]
scsi: zfcp: update width in comment for ZFCP_COMMON_FLAGS mask

v2.6.10 history commit 4062e12b2ba2 ("[PATCH] s390: zfcp act enhancements")
extended this mask by one nibble with the introduction of
ZFCP_STATUS_COMMON_ACCESS_DENIED == 0x00800000 for ACT (access control
table).

Signed-off-by: Steffen Maier <maier@linux.ibm.com>
Reviewed-by: Benjamin Block <bblock@linux.ibm.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: zfcp: move scsi_eh & non-ERP timeout defines owned by and local to zfcp_fsf.c
Steffen Maier [Thu, 8 Nov 2018 14:44:40 +0000 (15:44 +0100)]
scsi: zfcp: move scsi_eh & non-ERP timeout defines owned by and local to zfcp_fsf.c

Also clarify namespace prefix for the timeout used for FSF requests on
behalf of SCSI error recovery: It is zfcp_fsf_ not zfcp_scsi_.

Signed-off-by: Steffen Maier <maier@linux.ibm.com>
Reviewed-by: Benjamin Block <bblock@linux.ibm.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: zfcp: drop unnecessary forward prototype for struct zfcp_reqlist
Steffen Maier [Thu, 8 Nov 2018 14:44:39 +0000 (15:44 +0100)]
scsi: zfcp: drop unnecessary forward prototype for struct zfcp_reqlist

While struct zfcp_adapter contains a pointer to zfcp_reqlist, the pointer
field does not need to know the structure or even a prototype.

The prototype was introduced with v2.6.34 commit b6bd2fb92a7b ("[SCSI]
zfcp: Move FSF request tracking code to new file").

Signed-off-by: Steffen Maier <maier@linux.ibm.com>
Reviewed-by: Benjamin Block <bblock@linux.ibm.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: zfcp: move SG table helper from aux to fc and make them static
Steffen Maier [Thu, 8 Nov 2018 14:44:38 +0000 (15:44 +0100)]
scsi: zfcp: move SG table helper from aux to fc and make them static

Since commit 663e0890e31c ("[SCSI] zfcp: remove access control tables
interface") these helper functions are only used for auto port scan in
zfcp_fc.c. Also change them to the corresponding namespace prefix.

This is a small cleanup for the miscellaneous catchall compile unit
zfcp_aux.c.

Signed-off-by: Steffen Maier <maier@linux.ibm.com>
Reviewed-by: Benjamin Block <bblock@linux.ibm.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: zfcp: remove unnecessary null pointer check before mempool_destroy
zhong jiang [Thu, 8 Nov 2018 14:44:37 +0000 (15:44 +0100)]
scsi: zfcp: remove unnecessary null pointer check before mempool_destroy

mempool_destroy has taken null pointer check into account. so remove the
redundant check.

Signed-off-by: zhong jiang <zhongjiang@huawei.com>
Acked-by: Benjamin Block <bblock@linux.ibm.com>
[maier@linux.ibm.com: depends on v4.3 4e3ca3e033d1 ("mm/mempool: allow NULL `pool' pointer in mempool_destroy()")]
Signed-off-by: Steffen Maier <maier@linux.ibm.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: libsas: Remove pcidev reference
John Garry [Thu, 15 Nov 2018 10:20:32 +0000 (18:20 +0800)]
scsi: libsas: Remove pcidev reference

Not all host drivers are PCI drivers - like hisi_sas, which supports a
platform driver - so remove reference to "pcidev".

Signed-off-by: John Garry <john.garry@huawei.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: libsas: Drop SAS_DPRINTK() and revise logs levels
John Garry [Thu, 15 Nov 2018 10:20:31 +0000 (18:20 +0800)]
scsi: libsas: Drop SAS_DPRINTK() and revise logs levels

Like sas_printk() did previously, SAS_DPRINTK() offers little value now
that libsas logs already have the "sas" prefix through pr_fmt(fmt). So it
can be dropped.

However, after reviewing some logs in libsas, it is noticed that debug
level is too low in many instances.

So this change drops SAS_DPRINTK() and revises some logs to a more
appropriate level. However many stay at debug level, although some
are significantly promoted.

We add -DDEBUG for compilation so that we keep the debug messages by
default, as before.

All the pre-existing checkpatch errors for spanning messages across
multiple lines are also fixed.

Finally, all other references to printk() [apart from special formatting
in sas_ata.c] are removed and replaced with appropriate pr_xxx().

Suggested-by: Joe Perches <joe@perches.com>
Signed-off-by: John Garry <john.garry@huawei.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: libsas: Drop sas_printk()
John Garry [Thu, 15 Nov 2018 10:20:30 +0000 (18:20 +0800)]
scsi: libsas: Drop sas_printk()

The printk wrapper sas_printk() adds little value now that libsas logs
already have the "sas" prefix through pr_fmt(fmt), so just use pr_notice()
directly.

In addition, strings which span multiple lines are reunited.

Originally-from: Joe Perches <joe@perches.com>
Signed-off-by: John Garry <john.garry@huawei.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: libsas: Use pr_fmt(fmt)
John Garry [Thu, 15 Nov 2018 10:20:29 +0000 (18:20 +0800)]
scsi: libsas: Use pr_fmt(fmt)

In preparation for dropping the libsas printk wrappers, use pr_fmt(fmt)
declaration to add the framework log prefix - "sas".

Suggested-by: Joe Perches <joe@perches.com>
Signed-off-by: John Garry <john.garry@huawei.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: libsas: Delete sas_dump.{c, h}
John Garry [Thu, 15 Nov 2018 10:20:28 +0000 (18:20 +0800)]
scsi: libsas: Delete sas_dump.{c, h}

The code in these files is not longer referenced, so delete them.

Signed-off-by: John Garry <john.garry@huawei.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: hisi_sas: change the time of SAS SSP connection
Xiang Chen [Fri, 9 Nov 2018 14:06:36 +0000 (22:06 +0800)]
scsi: hisi_sas: change the time of SAS SSP connection

Currently the time of SAS SSP connection is 1ms, which means the link
connection will fail if no IO response after this period.

For some disks handling large IO (such as 512k), 1ms is not enough, so
change it to 5ms.

Signed-off-by: Xiang Chen <chenxiang66@hisilicon.com>
Signed-off-by: John Garry <john.garry@huawei.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: hisi_sas: Relocate some codes to avoid an unused check
Xiang Chen [Fri, 9 Nov 2018 14:06:35 +0000 (22:06 +0800)]
scsi: hisi_sas: Relocate some codes to avoid an unused check

In function hisi_sas_task_prep(), we check asd_sas_port, but in function
hisi_sas_task_exec(), we already refer to asd_sas_port by using function
dev_to_hisi_hba() implicitly. So to avoid this possible invalid
dereference, relocate the check to function hisi_sas_task_prep().

Signed-off-by: Xiang Chen <chenxiang66@hisilicon.com>
Signed-off-by: John Garry <john.garry@huawei.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: hisi_sas: Add support for interrupt coalescing for v3 hw
Xiang Chen [Fri, 9 Nov 2018 14:06:34 +0000 (22:06 +0800)]
scsi: hisi_sas: Add support for interrupt coalescing for v3 hw

If INT_COAL_EN is enabled, configure time and count of interrupt
coalescing.  Then if CQ collects count of CQ entries in time, it will
report the interrupt. Or if CQ doesn't collect enough CQ entries in time,
it will report the interrupt at timeout.

As all the registers are not supported to be changed dynamically, we need
to config those register between disable and enable PHYs.

Signed-off-by: Xiang Chen <chenxiang66@hisilicon.com>
Signed-off-by: John Garry <john.garry@huawei.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: hisi_sas: Add support for interrupt converge for v3 hw
Xiang Chen [Fri, 9 Nov 2018 14:06:33 +0000 (22:06 +0800)]
scsi: hisi_sas: Add support for interrupt converge for v3 hw

If CQ_INT_CONVERGE_EN is enabled, the interrupts of all the 16 CQ queues
will be reported by CQ0.

So we need to change the process of CQ tasklet for this situation.

Signed-off-by: Xiang Chen <chenxiang66@hisilicon.com>
Signed-off-by: John Garry <john.garry@huawei.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: hisi_sas: Create separate host attributes per HBA
Xiang Chen [Fri, 9 Nov 2018 14:06:32 +0000 (22:06 +0800)]
scsi: hisi_sas: Create separate host attributes per HBA

Currently all the three HBA (v1/v2/v3 HW) share the same host attributes.

To support each HBA having separate attributes in future, create per-HBA
attributes.

Signed-off-by: Xiang Chen <chenxiang66@hisilicon.com>
Signed-off-by: John Garry <john.garry@huawei.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: wd719x: always use generic DMA API
Christoph Hellwig [Fri, 9 Nov 2018 15:54:06 +0000 (16:54 +0100)]
scsi: wd719x: always use generic DMA API

The wd719x driver currently uses a mix of the legacy PCI DMA and the
generic DMA APIs.  Switch it over to the generic DMA API entirely.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: wd719x: use per-command private data
Christoph Hellwig [Fri, 9 Nov 2018 15:54:05 +0000 (16:54 +0100)]
scsi: wd719x: use per-command private data

Add the SCB onto the scsi command allocation and use dma streaming mappings
for it only when in use.  This avoid possibly calling dma_alloc_coherent
under a lock or even in irq context, while also making the code simpler.

Thanks to Ondrej Zary for testing and various bug fixes.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: wd719x: there should be no active SCBs on removal
Christoph Hellwig [Fri, 9 Nov 2018 15:54:04 +0000 (16:54 +0100)]
scsi: wd719x: there should be no active SCBs on removal

Warn on that case instead of trying to free them which would be fatal in
case we actually had active ones.

[mkp: typos]

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: sym53c8xx: use dma_set_mask
Christoph Hellwig [Thu, 18 Oct 2018 13:10:24 +0000 (15:10 +0200)]
scsi: sym53c8xx: use dma_set_mask

The driver currently uses pci_set_dma_mask despite otherwise using the
generic DMA API.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: stex: use dma_set_mask_and_coherent
Christoph Hellwig [Thu, 18 Oct 2018 13:10:23 +0000 (15:10 +0200)]
scsi: stex: use dma_set_mask_and_coherent

The driver currently uses pci_set_dma_mask despite otherwise using the
generic DMA API.  Switch it over to the better generic DMA API.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: mvumi: use dma_set_mask
Christoph Hellwig [Thu, 18 Oct 2018 13:10:22 +0000 (15:10 +0200)]
scsi: mvumi: use dma_set_mask

The driver currently uses pci_set_dma_mask despite otherwise using the
generic DMA API.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: lpfc: use dma_set_mask_and_coherent
Christoph Hellwig [Thu, 18 Oct 2018 13:10:21 +0000 (15:10 +0200)]
scsi: lpfc: use dma_set_mask_and_coherent

The driver currently uses pci_set_dma_mask despite otherwise using the
generic DMA API.  Switch it over to the better generic DMA API.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: isci: use dma_set_mask_and_coherent
Christoph Hellwig [Thu, 18 Oct 2018 13:10:20 +0000 (15:10 +0200)]
scsi: isci: use dma_set_mask_and_coherent

The driver currently uses pci_set_dma_mask despite otherwise using the
generic DMA API.  Switch it over to the better generic DMA API.

[mkp: s/iscsi/isci/]

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: initio: use dma_set_mask
Christoph Hellwig [Thu, 18 Oct 2018 13:10:19 +0000 (15:10 +0200)]
scsi: initio: use dma_set_mask

The driver currently uses pci_set_dma_mask despite otherwise using the
generic DMA API.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: hptiop: use dma_set_mask
Christoph Hellwig [Thu, 18 Oct 2018 13:10:18 +0000 (15:10 +0200)]
scsi: hptiop: use dma_set_mask

The driver currently uses pci_set_dma_mask despite otherwise using the
generic DMA API.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: hisi_sas: use dma_set_mask_and_coherent
Christoph Hellwig [Thu, 18 Oct 2018 13:10:17 +0000 (15:10 +0200)]
scsi: hisi_sas: use dma_set_mask_and_coherent

The driver currently uses pci_set_dma_mask despite otherwise using the
generic DMA API.  Switch it over to the better generic DMA API.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Acked-by: John Garry <john.garry@huawei.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: esas2r: use dma_set_mask_and_coherent
Christoph Hellwig [Thu, 18 Oct 2018 13:10:16 +0000 (15:10 +0200)]
scsi: esas2r: use dma_set_mask_and_coherent

The driver currently uses pci_set_dma_mask despite otherwise using the
generic DMA API.  Also move the dma_get_required_mask check before actually
setting the dma mask so that we don't end up with inconsistent settings in
corner cases.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: dpt_i2o: use dma_set_mask
Christoph Hellwig [Thu, 18 Oct 2018 13:10:15 +0000 (15:10 +0200)]
scsi: dpt_i2o: use dma_set_mask

The driver currently uses pci_set_dma_mask despite otherwise using the
generic DMA API.  Also move the dma_get_required_mask check before actually
setting the dma mask, so that we don't end up with inconsistent settings in
corner cases.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: bfa: use dma_set_mask_and_coherent
Christoph Hellwig [Thu, 18 Oct 2018 13:10:14 +0000 (15:10 +0200)]
scsi: bfa: use dma_set_mask_and_coherent

The driver currently uses pci_set_dma_mask despite otherwise using the
generic DMA API.  Switch it over to the better generic DMA API helper and
also ensure we set the coherent mask as well in the resume path.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: arcmsr: use dma_set_mask
Christoph Hellwig [Thu, 18 Oct 2018 13:10:13 +0000 (15:10 +0200)]
scsi: arcmsr: use dma_set_mask

The driver currently uses pci_set_dma_mask despite otherwise using the
generic DMA API.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: ufs: Add UFS platform driver for Cadence UFS
Janek Kotas [Thu, 20 Sep 2018 13:08:30 +0000 (13:08 +0000)]
scsi: ufs: Add UFS platform driver for Cadence UFS

This patch adds a device tree platform driver for Cadence UFS Host
Controller.  It can be enabled with SCSI_UFS_CDNS_PLATFORM Kconfig option.

Signed-off-by: Jan Kotas <jank@cadence.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: dt-bindings: ufs: Add bindings for Cadence UFS
Janek Kotas [Thu, 20 Sep 2018 13:08:22 +0000 (13:08 +0000)]
scsi: dt-bindings: ufs: Add bindings for Cadence UFS

This patch adds a DT binding documentation for Cadence UFS Host Controller.

Signed-off-by: Jan Kotas <jank@cadence.com>
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: ufs: set the device reference clock setting
Subhash Jadavani [Tue, 16 Oct 2018 08:59:41 +0000 (14:29 +0530)]
scsi: ufs: set the device reference clock setting

UFS host supplies the reference clock to UFS device and UFS device
specification allows host to provide one of the 4 frequencies (19.2 MHz, 26
MHz, 38.4 MHz, 52 MHz) for reference clock. Host should set the device
reference clock frequency setting in the device based on what frequency it
is supplying to UFS device.

Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org>
Signed-off-by: Can Guo <cang@codeaurora.org>
Signed-off-by: Sayali Lokhande <sayalil@codeaurora.org>
Reviewed-by: Evan Green <evgreen@chromium.org>
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: pmcraid: use generic DMA API
Christoph Hellwig [Thu, 18 Oct 2018 13:05:37 +0000 (15:05 +0200)]
scsi: pmcraid: use generic DMA API

Switch from the legacy PCI DMA API to the generic DMA API.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: pmcraid: don't allocate a dma coherent buffer for sense data
Christoph Hellwig [Thu, 18 Oct 2018 13:05:36 +0000 (15:05 +0200)]
scsi: pmcraid: don't allocate a dma coherent buffer for sense data

We can just dma map the sense buffer passed with the scsi command,
and that gets us out of the nasty business of doing dma coherent
allocations from irq context.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: pmcraid: simplify pmcraid_cancel_all a bit
Christoph Hellwig [Thu, 18 Oct 2018 13:05:35 +0000 (15:05 +0200)]
scsi: pmcraid: simplify pmcraid_cancel_all a bit

No need for a local cmd_done variable, and pass boolean values as bool
type instead of u32.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: qla2xxx: use lower_32_bits and upper_32_bits instead of reinventing them
Christoph Hellwig [Thu, 18 Oct 2018 13:03:37 +0000 (15:03 +0200)]
scsi: qla2xxx: use lower_32_bits and upper_32_bits instead of reinventing them

This also moves the optimization for builds with 32-bit dma_addr_t to
the compiler (where it belongs) instead of opencoding it based on
incorrect assumptions.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: qla1280: properly handle 64-bit DMA
Christoph Hellwig [Thu, 18 Oct 2018 13:03:36 +0000 (15:03 +0200)]
scsi: qla1280: properly handle 64-bit DMA

CONFIG_HIGHMEM is not in fact an indicator for > 32-bit dma addressing
Given that the driver is a bit weird and wants a compile time selection
switch to checking CONFIG_ARCH_DMA_ADDR_T_64BIT instead.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: qla1280: use lower_32_bits and upper_32_bits instead of reinventing them
Christoph Hellwig [Thu, 18 Oct 2018 13:03:35 +0000 (15:03 +0200)]
scsi: qla1280: use lower_32_bits and upper_32_bits instead of reinventing them

This also moves the optimization for builds with 32-bit dma_addr_t to
the compiler (where it belongs) instead of opencoding it.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: ips: properly handle 64-bit DMA
Christoph Hellwig [Thu, 18 Oct 2018 13:03:34 +0000 (15:03 +0200)]
scsi: ips: properly handle 64-bit DMA

CONFIG_HIGHMEM64 is only one (and these days unusual) way to indicate
that > 32-bit dma address are possible.  Replace it with a check of the
dma_addr_t size.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: ips: use lower_32_bits and upper_32_bits instead of reinventing them
Christoph Hellwig [Thu, 18 Oct 2018 13:03:33 +0000 (15:03 +0200)]
scsi: ips: use lower_32_bits and upper_32_bits instead of reinventing them

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: qla4xxx: remvoe unnecessary condition check for mempool_destroy()
Chengguang Xu [Sun, 4 Nov 2018 13:57:50 +0000 (21:57 +0800)]
scsi: qla4xxx: remvoe unnecessary condition check for mempool_destroy()

mempool_destroy() can handle NULL pointer correctly, so there is no
need to check NULL pointer before calling mempool_destroy().

Signed-off-by: Chengguang Xu <cgxu519@gmx.com>
Acked-by: Manish Rangankar <Manish.Rangankar@cavium.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: qla4xxx: remove unnecessary condition check for dma_pool_destroy()
Chengguang Xu [Sun, 4 Nov 2018 13:57:49 +0000 (21:57 +0800)]
scsi: qla4xxx: remove unnecessary condition check for dma_pool_destroy()

dma_pool_destroy() can handle NULL pointer correctly, so there is no
need to check NULL pointer before calling dma_pool_destroy().

Signed-off-by: Chengguang Xu <cgxu519@gmx.com>
Acked-by: Manish Rangankar <Manish.Rangankar@cavium.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: lpfc: update driver version to 12.0.0.8
James Smart [Tue, 23 Oct 2018 20:41:12 +0000 (13:41 -0700)]
scsi: lpfc: update driver version to 12.0.0.8

Update the driver version to 12.0.0.8

Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com>
Signed-off-by: James Smart <jsmart2021@gmail.com>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: lpfc: add Trunking support
James Smart [Tue, 23 Oct 2018 20:41:11 +0000 (13:41 -0700)]
scsi: lpfc: add Trunking support

Add trunking support to the driver. Trunking is found on more recent
asics. In general, trunking appears as a single "port" to the driver
and overall behavior doesn't differ. Link speed is reported as an
aggregate value, while link speed control is done on a per-physical
link basis with all links in the trunk symmetrical. Some commands
returning port information are updated to additionally provide
trunking information. And new ACQEs are generated to report physical
link events relative to the trunk.

This patch contains the following modifications:

- Added link speed settings of 128GB and 256GB.

- Added handling of trunk-related ACQEs, mainly logging and trapping
  of physical link statuses.

- Added additional bsg interface to query trunk state by applications.

- Augment link_state sysfs attribtute to display trunk link status

Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com>
Signed-off-by: James Smart <jsmart2021@gmail.com>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: lpfc: Implement GID_PT on Nameserver query to support faster failover
James Smart [Tue, 23 Oct 2018 20:41:10 +0000 (13:41 -0700)]
scsi: lpfc: Implement GID_PT on Nameserver query to support faster failover

The switches seem to respond faster to GID_PT vs GID_FT NameServer
queries.  Add support for GID_PT to be used over GID_FT to enable
faster storage failover detection. Includes addition of new module
parameter to select between GID_PT and GID_FT (GID_FT is default).

Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com>
Signed-off-by: James Smart <jsmart2021@gmail.com>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: lpfc: Correct loss of fc4 type on remote port address change
James Smart [Tue, 23 Oct 2018 20:41:09 +0000 (13:41 -0700)]
scsi: lpfc: Correct loss of fc4 type on remote port address change

An address change for a remote port cause PRLI for the wrong protocol
to be sent.  The node copy done in the discovery code skipped copying
the fc4 protocols supported as well.

Fix the copy logic for the address change.  Beefed up log messages in
this area as well.

Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com>
Signed-off-by: James Smart <jsmart2021@gmail.com>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: lpfc: Fix odd recovery in duplicate FLOGIs in point-to-point
James Smart [Tue, 23 Oct 2018 20:41:08 +0000 (13:41 -0700)]
scsi: lpfc: Fix odd recovery in duplicate FLOGIs in point-to-point

Testing a point-to-point topology and a case of re-FLOGI without
intervening link bouncing, showed an odd interaction with firmware and
a resulting scenario where the driver no longer probed after accepting
the new FLOGI.

Work around the firmware issue by issuing a link bounce if a FLOGI is
received after the link is already up and FLOGI's accepted.

While debugging the issue, realized that some debug traces should be
clarified to help in the future.

Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com>
Signed-off-by: James Smart <jsmart2021@gmail.com>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: lpfc: Correct LCB RJT handling
James Smart [Tue, 23 Oct 2018 20:41:07 +0000 (13:41 -0700)]
scsi: lpfc: Correct LCB RJT handling

When LCB's are rejected, if beaconing was already in progress, the
Reason Code Explanation was not being set. Should have been set to
command in progress.

Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com>
Signed-off-by: James Smart <jsmart2021@gmail.com>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: lpfc: fcoe: Fix link down issue after 1000+ link bounces
James Smart [Tue, 23 Oct 2018 20:41:06 +0000 (13:41 -0700)]
scsi: lpfc: fcoe: Fix link down issue after 1000+ link bounces

On FCoE adapters, when running link bounce test in a loop, initiator
failed to login with switch switch and required driver reload to
recover. Switch reached a point where all subsequent FLOGIs would be
LS_RJT'd. Further testing showed the condition to be related to not
performing FCF discovery between FLOGI's.

Fix by monitoring FLOGI failures and once a repeated error is seen
repeat FCF discovery.

Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com>
Signed-off-by: James Smart <jsmart2021@gmail.com>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: lpfc: Correct errors accessing fw log
James Smart [Tue, 23 Oct 2018 20:41:05 +0000 (13:41 -0700)]
scsi: lpfc: Correct errors accessing fw log

This patch corrects two issues:

- An oops would occur if reading based on a non-zero offset.  Offset
  calculation was incorrect.

- Updates to ras config (logging level) were ignored if change was
  made while fw logging was enabled. Revise to dynamically update.

Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com>
Signed-off-by: James Smart <jsmart2021@gmail.com>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: lpfc: Reset link or adapter instead of doing infinite nameserver PLOGI retry
James Smart [Tue, 23 Oct 2018 20:41:04 +0000 (13:41 -0700)]
scsi: lpfc: Reset link or adapter instead of doing infinite nameserver PLOGI retry

Currently, PLOGI failures are infinitely delayed/retried.  There have
been some fabric situations where the PLOGI's were to the nameserver
and it stopped responding. The retries would never clear up.  A better
resolution in this situation is to retry a couple of times, then drop
the link and reinit. This brings back connectivity to the nameserver.

Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com>
Signed-off-by: James Smart <jsmart2021@gmail.com>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: lpfc: Fix LOGO/PLOGI handling when triggerd by ABTS Timeout event
James Smart [Tue, 23 Oct 2018 20:41:03 +0000 (13:41 -0700)]
scsi: lpfc: Fix LOGO/PLOGI handling when triggerd by ABTS Timeout event

After a LOGO in response to an ABTS timeout, a PLOGI wasn't issued to
re-establish the login.  An nlp_type check in the LOGO completion
handler failed to restart discovery for NVME targets.  Revised the
nlp_type check for NVME as well as SCSI.

While reviewing the LOGO handling a few other issues were seen and
were addressed:

- Better lock synchronization around ndlp data types

- When the ABTS times out, unregister the RPI before sending the LOGO
  so that all local exchange contexts are cleared and nothing received
  while awaiting LOGO/PLOGI handling will be accepted.

- LOGO handling optimized to:
   Wait only R_A_TOV for a response.
   It doesn't need to be retried on timeout. If there wasn't a
     response, a PLOGI will be sent, thus an implicit logout
     applies as well when the other port sees it.
   If there is a response, any kind of response is considered "good"
     and the XRI quarantined for a exchange qualifier window.

- PLOGI is issued as soon a LOGO state is resolved.

Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com>
Signed-off-by: James Smart <jsmart2021@gmail.com>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: lpfc: Fix lpfc_sli4_read_config return value check
James Smart [Tue, 23 Oct 2018 20:41:02 +0000 (13:41 -0700)]
scsi: lpfc: Fix lpfc_sli4_read_config return value check

An error is an error - but not to the existing return value check.

Revise check to handle any failure, not just EIO.

Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com>
Signed-off-by: James Smart <jsmart2021@gmail.com>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: lpfc: Correct speeds on SFP swap
James Smart [Tue, 23 Oct 2018 20:41:01 +0000 (13:41 -0700)]
scsi: lpfc: Correct speeds on SFP swap

Supported speeds is not updated when SFP is removed or replaced

Supported speed is obtained from lmt field in READ_CONFIG mailbox
response. Driver updates supported speeds only once from PCI probe
path. After that it is never updated. So, supported speeds remains the
same till reboot or driver reload.

When SFP is removed or inserted, driver gets SLI-Port Event ACQE.  If
SFP is removed, lmt wil have value 0. If a different SFP is inserted,
lmt will have value according to its supported speeds.  So, afterr
SLI-Port Event ACQE handling path, send READ_CONFIG mailbox and update
supported speeds. If READ_CONFIG fails, set supported speeds to
unknown and log.

Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com>
Signed-off-by: James Smart <jsmart2021@gmail.com>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: megaraid_sas: Update driver version
Shivasharan S [Wed, 17 Oct 2018 06:37:57 +0000 (23:37 -0700)]
scsi: megaraid_sas: Update driver version

Signed-off-by: Shivasharan S <shivasharan.srikanteshwara@broadcom.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: megaraid_sas: modify max supported lds related print
Shivasharan S [Wed, 17 Oct 2018 06:37:56 +0000 (23:37 -0700)]
scsi: megaraid_sas: modify max supported lds related print

The print related to number of VDs that a particular firmware supports is
misleading in some cases.  Even though supportMaxExtLDs is set, certain
firmware profiles only supports upto 64VDs.

Signed-off-by: Shivasharan S <shivasharan.srikanteshwara@broadcom.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: megaraid_sas: remove unused macro
Shivasharan S [Wed, 17 Oct 2018 06:37:55 +0000 (23:37 -0700)]
scsi: megaraid_sas: remove unused macro

Signed-off-by: Shivasharan S <shivasharan.srikanteshwara@broadcom.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: megaraid_sas: increase timeout for IOC INIT to 180seconds
Shivasharan S [Wed, 17 Oct 2018 06:37:54 +0000 (23:37 -0700)]
scsi: megaraid_sas: increase timeout for IOC INIT to 180seconds

IOC INIT frame needs to be fired with a timeout of 180 seconds.

Signed-off-by: Shivasharan S <shivasharan.srikanteshwara@broadcom.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: megaraid_sas: Remove double endian conversion
Shivasharan S [Wed, 17 Oct 2018 06:37:53 +0000 (23:37 -0700)]
scsi: megaraid_sas: Remove double endian conversion

Signed-off-by: Shivasharan S <shivasharan.srikanteshwara@broadcom.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: megaraid_sas: Re-use max_mfi_cmds to calculate queue sizes
Shivasharan S [Wed, 17 Oct 2018 06:37:52 +0000 (23:37 -0700)]
scsi: megaraid_sas: Re-use max_mfi_cmds to calculate queue sizes

In megasas_init_adapter_fusion(), max_mfi_cmds is being calcuated as
(MEGASAS_FUSION_INTERNAL_CMDS + MEGASAS_FUSION_IOCTL_CMDS).  max_mfi_cmds
can be used in megasas_configure_queue_sizes.

Signed-off-by: Shivasharan S <shivasharan.srikanteshwara@broadcom.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: megaraid_sas: Rename scratch_pad registers
Shivasharan S [Wed, 17 Oct 2018 06:37:51 +0000 (23:37 -0700)]
scsi: megaraid_sas: Rename scratch_pad registers

Rename the scratch pad registers to match firmware headers.  No functional
change.

Signed-off-by: Sumit Saxena <sumit.saxena@broadcom.com>
Signed-off-by: Shivasharan S <shivasharan.srikanteshwara@broadcom.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: megaraid_sas: Remove spin lock for dpc operation
Shivasharan S [Wed, 17 Oct 2018 06:37:50 +0000 (23:37 -0700)]
scsi: megaraid_sas: Remove spin lock for dpc operation

Optimization: No need to hold hba_lock in dpc context for reading atomic
variable.

Signed-off-by: Shivasharan S <shivasharan.srikanteshwara@broadcom.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: megaraid_sas: optimize raid context access in IO path
Shivasharan S [Wed, 17 Oct 2018 06:37:49 +0000 (23:37 -0700)]
scsi: megaraid_sas: optimize raid context access in IO path

No functional change.  Use local variables when accessing raid context in
IO path.  Improves code readability.

Signed-off-by: Shivasharan S <shivasharan.srikanteshwara@broadcom.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: megaraid_sas: Fail init if heartbeat timer fails
Shivasharan S [Wed, 17 Oct 2018 06:37:48 +0000 (23:37 -0700)]
scsi: megaraid_sas: Fail init if heartbeat timer fails

When driver fails to start the heartbeat timer, exit from FW init.

Signed-off-by: Shivasharan S <shivasharan.srikanteshwara@broadcom.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: megaraid_sas: For SRIOV, do not set STOP_ADP bit
Shivasharan S [Wed, 17 Oct 2018 06:37:47 +0000 (23:37 -0700)]
scsi: megaraid_sas: For SRIOV, do not set STOP_ADP bit

For SRIOV based adapters, driver should not set the STOP_ADP bit as part of
kill adapter.

Signed-off-by: Shivasharan S <shivasharan.srikanteshwara@broadcom.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: megaraid_sas: Fix combined reply queue mode detection
Shivasharan S [Wed, 17 Oct 2018 06:37:46 +0000 (23:37 -0700)]
scsi: megaraid_sas: Fix combined reply queue mode detection

For Invader series, if FW supports more than 8 MSI-x vectors, driver needs
to enable combined reply queue mode. For Ventura series, driver enables
combined reply queue mode in case of more than 16 MSI-x vectors.

Signed-off-by: Sumit Saxena <sumit.saxena@broadcom.com>
Signed-off-by: Shivasharan S <shivasharan.srikanteshwara@broadcom.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: megaraid_sas: Fix module parameter description
Shivasharan S [Wed, 17 Oct 2018 06:37:45 +0000 (23:37 -0700)]
scsi: megaraid_sas: Fix module parameter description

Module parameter description for rdpq_enable incorrectly lists the default
as enabled.  Also, provide range of valid values for resetwaittime in the
description.

Signed-off-by: Shivasharan S <shivasharan.srikanteshwara@broadcom.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: megaraid_sas: Fix goto labels in error handling
Shivasharan S [Wed, 17 Oct 2018 06:37:44 +0000 (23:37 -0700)]
scsi: megaraid_sas: Fix goto labels in error handling

During init, if pci_alloc_irq_vectors() fails, the driver has not yet setup
the IRQs. Fix the goto labels and error handling for this case.

Signed-off-by: Shivasharan S <shivasharan.srikanteshwara@broadcom.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: megaraid_sas: Update copyright information
Shivasharan S [Wed, 17 Oct 2018 06:37:43 +0000 (23:37 -0700)]
scsi: megaraid_sas: Update copyright information

Change copyright to Broadcom Inc. Also update any references to Avago with
Broadcom. Update copyright duration wherever required.

Signed-off-by: Shivasharan S <shivasharan.srikanteshwara@broadcom.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: megaraid_sas: Add check for reset adapter bit
Shivasharan S [Wed, 17 Oct 2018 06:37:42 +0000 (23:37 -0700)]
scsi: megaraid_sas: Add check for reset adapter bit

For SAS3 and later controllers, FW sets the reset adapter bit indicating
the driver to perform a controller reset.  Driver needs to check if this
bit is set before doing a reset.  This reduces the driver probe failure
time to 180seconds in case there is a faulty controller connected.

Signed-off-by: Sumit Saxena <sumit.saxena@broadcom.com>
Signed-off-by: Shivasharan S <shivasharan.srikanteshwara@broadcom.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: megaraid_sas: Fix msleep granularity
Shivasharan S [Wed, 17 Oct 2018 06:37:41 +0000 (23:37 -0700)]
scsi: megaraid_sas: Fix msleep granularity

In megasas_transition_to_ready() driver waits 180seconds for controller to
change FW state. Here we are calling msleep(1) in a loop for this.  As
explained in timers-howto.txt, msleep(1) will actually sleep longer than
1ms. If a faulty controller is connected, we will end up waiting for much
more than 180 seconds causing unnecessary delays during load.

Change the granularity of msleep() call from 1ms to 1000ms.

Signed-off-by: Shivasharan S <shivasharan.srikanteshwara@broadcom.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: megaraid_sas: Add support for FW snap dump
Shivasharan S [Wed, 17 Oct 2018 06:37:40 +0000 (23:37 -0700)]
scsi: megaraid_sas: Add support for FW snap dump

Latest firmware adds a mechanism to save firmware logs just before
controller reset on pre-allocated internal controller DRAM. This feature is
called snapdump which will help debugging firmware issues.  This feature
requires extra time and firmware reports these values through new driver
interface. Before initiating an OCR, driver needs to inform FW to save a
snapdump and then wait for a specified time for the snapdump to complete.

Signed-off-by: Sumit Saxena <sumit.saxena@broadcom.com>
Signed-off-by: Shivasharan S <shivasharan.srikanteshwara@broadcom.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: megaraid_sas: Add watchdog thread to detect Firmware fault
Shivasharan S [Wed, 17 Oct 2018 06:37:39 +0000 (23:37 -0700)]
scsi: megaraid_sas: Add watchdog thread to detect Firmware fault

Currently driver checks for Firmware state change from ISR context, and
only when there are interrupts tied with no I/O completions.  We have seen
multiple cases where doorbell interrupts sent by firmware to indicate FW
state change are not processed by driver and it takes long time for driver
to trigger OCR. And if there are no IOs running, since we only check the FW
state as part of ISR code, fault goes undetected by driver and OCR will not
be triggered.

This patch introduces a separate workqueue that runs every one second to
detect Firmware FAULT state and trigger reset immediately.  As an
additional gain, removing PCI reads from ISR to check FW state results in
improved performance as well.

Signed-off-by: Sumit Saxena <sumit.saxena@broadcom.com>
Signed-off-by: Shivasharan S <shivasharan.srikanteshwara@broadcom.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: mpt3sas: Bump driver version to 27.100.00.00
Suganath Prabu [Wed, 31 Oct 2018 13:23:39 +0000 (18:53 +0530)]
scsi: mpt3sas: Bump driver version to 27.100.00.00

Modify driver version to 27.100.00.00 (which is equivalent to PH8 OOB
driver)

Signed-off-by: Suganath Prabu <suganath-prabu.subramani@broadcom.com>
Reviewed-by: Bjorn Helgaas <bhelgaas@google.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: mpt3sas: Fix driver modifying persistent data in Manufacturing page11
Suganath Prabu [Wed, 31 Oct 2018 13:23:38 +0000 (18:53 +0530)]
scsi: mpt3sas: Fix driver modifying persistent data in Manufacturing page11

Currently driver is modifying both current & NVRAM/persistent data in
Manufacturing page11. Driver should change only current copy of
Manufacturing page11. It should not modify the persistent data.

So removed the section of code where driver is modifying the persistent
data of Manufacturing page11.

Signed-off-by: Suganath Prabu <suganath-prabu.subramani@broadcom.com>
Reviewed-by: Bjorn Helgaas <bhelgaas@google.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: mpt3sas: Don't modify EEDPTagMode field setting on SAS3.5 HBA devices
Suganath Prabu [Wed, 31 Oct 2018 13:23:37 +0000 (18:53 +0530)]
scsi: mpt3sas: Don't modify EEDPTagMode field setting on SAS3.5 HBA devices

If EEDPTagMode field in manufacturing page11 is set then unset it. This is
needed to fix a hardware bug only in SAS3/SAS2 cards. So, skipping
EEDPTagMode changes in Manufacturing page11 for SAS 3.5 controllers.

Signed-off-by: Suganath Prabu <suganath-prabu.subramani@broadcom.com>
Reviewed-by: Bjorn Helgaas <bhelgaas@google.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: mpt3sas: Fix Sync cache command failure during driver unload
Suganath Prabu [Wed, 31 Oct 2018 13:23:36 +0000 (18:53 +0530)]
scsi: mpt3sas: Fix Sync cache command failure during driver unload

This is to fix SYNC CACHE and START STOP command failures with
DID_NO_CONNECT during driver unload.

In driver's IO submission patch (i.e. in driver's .queuecommand()) driver
won't allow any SCSI commands to the IOC when ioc->remove_host flag is set
and hence SYNC CACHE commands which are issued to the target drives (where
write cache is enabled) during driver unload time is failed with
DID_NO_CONNECT status.

Now modified the driver to allow SYNC CACHE and START STOP commands to IOC,
even when remove_host flag is set.

Signed-off-by: Suganath Prabu <suganath-prabu.subramani@broadcom.com>
Reviewed-by: Bjorn Helgaas <bhelgaas@google.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: mpt3sas: Call sas_remove_host before removing the target devices
Suganath Prabu [Wed, 31 Oct 2018 13:23:35 +0000 (18:53 +0530)]
scsi: mpt3sas: Call sas_remove_host before removing the target devices

Call sas_remove_host() before removing the target devices in the driver's
.remove() callback function(i.e. during driver unload time).  So that
driver can provide a way to allow SYNC CACHE, START STOP unit commands
etc. (which are issued from SML) to the target drives during driver unload
time.

Once sas_remove_host() is called before removing the target drives then
driver can just clean up the resources allocated for target devices and no
need to call sas_port_delete_phy(), sas_port_delete() API's as these API's
internally called from sas_remove_host().

Signed-off-by: Suganath Prabu <suganath-prabu.subramani@broadcom.com>
Reviewed-by: Bjorn Helgaas <bhelgaas@google.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: mpt3sas: Refactor mpt3sas_wait_for_ioc function
Suganath Prabu [Wed, 31 Oct 2018 13:23:34 +0000 (18:53 +0530)]
scsi: mpt3sas: Refactor mpt3sas_wait_for_ioc function

No functional change. Doing code refactor of function
mpt3sas_wait_for_ioc() for better readability.

Signed-off-by: Suganath Prabu <suganath-prabu.subramani@broadcom.com>
Reviewed-by: Bjorn Helgaas <bhelgaas@google.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: mpt3sas: Separate out mpt3sas_wait_for_ioc
Suganath Prabu [Wed, 31 Oct 2018 13:23:33 +0000 (18:53 +0530)]
scsi: mpt3sas: Separate out mpt3sas_wait_for_ioc

No functional changes. This section of code "wait for IOC to be
operational" is used in many places across the driver.  Factor this code
out into a new mpt3sas_wait_for_ioc().

Signed-off-by: Suganath Prabu <suganath-prabu.subramani@broadcom.com>
Reviewed-by: Bjorn Helgaas <bhelgaas@google.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: mpt3sas: Added new #define variable IOC_OPERATIONAL_WAIT_COUNT
Suganath Prabu [Wed, 31 Oct 2018 13:23:32 +0000 (18:53 +0530)]
scsi: mpt3sas: Added new #define variable IOC_OPERATIONAL_WAIT_COUNT

Added new #define variable IOC_OPERATIONAL_WAIT_COUNT and it replaces hard
coded value '10' in all the places where driver is waiting for the IOC to
become operational.

Signed-off-by: Suganath Prabu <suganath-prabu.subramani@broadcom.com>
Reviewed-by: Bjorn Helgaas <bhelgaas@google.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: mpt3sas: Add support for Aero controllers
Suganath Prabu [Thu, 25 Oct 2018 14:03:41 +0000 (19:33 +0530)]
scsi: mpt3sas: Add support for Aero controllers

Add support for Aero/Sea controllers and add warning for configurable
secure type IOC.

Signed-off-by: Suganath Prabu <suganath-prabu.subramani@broadcom.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: mpt3sas: Update MPI headers to support Aero controllers
Suganath Prabu [Thu, 25 Oct 2018 14:03:40 +0000 (19:33 +0530)]
scsi: mpt3sas: Update MPI headers to support Aero controllers

Updating MPI headers to the latest version 2.6.7 to add support to the
driver to detect the new 3816 and 3916 chip based controllers.  Separate
out firmware image data from mpi2_ioc.h to new file mpi2_image.h

Signed-off-by: Suganath Prabu <suganath-prabu.subramani@broadcom.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoLinux 4.20-rc1 v4.20-rc1
Linus Torvalds [Sun, 4 Nov 2018 23:37:52 +0000 (15:37 -0800)]
Linux 4.20-rc1

5 years agoMerge tag 'tags/upstream-4.20-rc1' of git://git.infradead.org/linux-ubifs
Linus Torvalds [Sun, 4 Nov 2018 22:46:04 +0000 (14:46 -0800)]
Merge tag 'tags/upstream-4.20-rc1' of git://git.infradead.org/linux-ubifs

Pull UBIFS updates from Richard Weinberger:

 - Full filesystem authentication feature, UBIFS is now able to have the
   whole filesystem structure authenticated plus user data encrypted and
   authenticated.

 - Minor cleanups

* tag 'tags/upstream-4.20-rc1' of git://git.infradead.org/linux-ubifs: (26 commits)
  ubifs: Remove unneeded semicolon
  Documentation: ubifs: Add authentication whitepaper
  ubifs: Enable authentication support
  ubifs: Do not update inode size in-place in authenticated mode
  ubifs: Add hashes and HMACs to default filesystem
  ubifs: authentication: Authenticate super block node
  ubifs: Create hash for default LPT
  ubfis: authentication: Authenticate master node
  ubifs: authentication: Authenticate LPT
  ubifs: Authenticate replayed journal
  ubifs: Add auth nodes to garbage collector journal head
  ubifs: Add authentication nodes to journal
  ubifs: authentication: Add hashes to index nodes
  ubifs: Add hashes to the tree node cache
  ubifs: Create functions to embed a HMAC in a node
  ubifs: Add helper functions for authentication support
  ubifs: Add separate functions to init/crc a node
  ubifs: Format changes for authentication support
  ubifs: Store read superblock node
  ubifs: Drop write_node
  ...

5 years agoMerge tag 'nfs-for-4.20-2' of git://git.linux-nfs.org/projects/trondmy/linux-nfs
Linus Torvalds [Sun, 4 Nov 2018 16:20:09 +0000 (08:20 -0800)]
Merge tag 'nfs-for-4.20-2' of git://git.linux-nfs.org/projects/trondmy/linux-nfs

Pull NFS client bugfixes from Trond Myklebust:
 "Highlights include:

  Bugfix:
   - Fix build issues on architectures that don't provide 64-bit cmpxchg

  Cleanups:
   - Fix a spelling mistake"

* tag 'nfs-for-4.20-2' of git://git.linux-nfs.org/projects/trondmy/linux-nfs:
  NFS: fix spelling mistake, EACCESS -> EACCES
  SUNRPC: Use atomic(64)_t for seq_send(64)

5 years agoMerge branch 'timers-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel...
Linus Torvalds [Sun, 4 Nov 2018 16:15:15 +0000 (08:15 -0800)]
Merge branch 'timers-urgent-for-linus' of git://git./linux/kernel/git/tip/tip

Pull more timer updates from Thomas Gleixner:
 "A set of commits for the new C-SKY architecture timers"

* 'timers-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  dt-bindings: timer: gx6605s SOC timer
  clocksource/drivers/c-sky: Add gx6605s SOC system timer
  dt-bindings: timer: C-SKY Multi-processor timer
  clocksource/drivers/c-sky: Add C-SKY SMP timer

5 years agoMerge tag 'ntb-4.20' of git://github.com/jonmason/ntb
Linus Torvalds [Sun, 4 Nov 2018 16:12:44 +0000 (08:12 -0800)]
Merge tag 'ntb-4.20' of git://github.com/jonmason/ntb

Pull NTB updates from Jon Mason:
 "Fairly minor changes and bug fixes:

  NTB IDT thermal changes and hook into hwmon, ntb_netdev clean-up of
  private struct, and a few bug fixes"

* tag 'ntb-4.20' of git://github.com/jonmason/ntb:
  ntb: idt: Alter the driver info comments
  ntb: idt: Discard temperature sensor IRQ handler
  ntb: idt: Add basic hwmon sysfs interface
  ntb: idt: Alter temperature read method
  ntb_netdev: Simplify remove with client device drvdata
  NTB: transport: Try harder to alloc an aligned MW buffer
  ntb: ntb_transport: Mark expected switch fall-throughs
  ntb: idt: Set PCIe bus address to BARLIMITx
  NTB: ntb_hw_idt: replace IS_ERR_OR_NULL with regular NULL checks
  ntb: intel: fix return value for ndev_vec_mask()
  ntb_netdev: fix sleep time mismatch

5 years agoMerge branch 'sched-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel...
Linus Torvalds [Sun, 4 Nov 2018 01:37:09 +0000 (18:37 -0700)]
Merge branch 'sched-urgent-for-linus' of git://git./linux/kernel/git/tip/tip

Pull scheduler fixes from Ingo Molnar:
 "A memory (under-)allocation fix and a comment fix"

* 'sched-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  sched/topology: Fix off by one bug
  sched/rt: Update comment in pick_next_task_rt()

5 years agoMerge branch 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel...
Linus Torvalds [Sun, 4 Nov 2018 01:25:17 +0000 (18:25 -0700)]
Merge branch 'x86-urgent-for-linus' of git://git./linux/kernel/git/tip/tip

Pull x86 fixes from Ingo Molnar:
 "A number of fixes and some late updates:

   - make in_compat_syscall() behavior on x86-32 similar to other
     platforms, this touches a number of generic files but is not
     intended to impact non-x86 platforms.

   - objtool fixes

   - PAT preemption fix

   - paravirt fixes/cleanups

   - cpufeatures updates for new instructions

   - earlyprintk quirk

   - make microcode version in sysfs world-readable (it is already
     world-readable in procfs)

   - minor cleanups and fixes"

* 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  compat: Cleanup in_compat_syscall() callers
  x86/compat: Adjust in_compat_syscall() to generic code under !COMPAT
  objtool: Support GCC 9 cold subfunction naming scheme
  x86/numa_emulation: Fix uniform-split numa emulation
  x86/paravirt: Remove unused _paravirt_ident_32
  x86/mm/pat: Disable preemption around __flush_tlb_all()
  x86/paravirt: Remove GPL from pv_ops export
  x86/traps: Use format string with panic() call
  x86: Clean up 'sizeof x' => 'sizeof(x)'
  x86/cpufeatures: Enumerate MOVDIR64B instruction
  x86/cpufeatures: Enumerate MOVDIRI instruction
  x86/earlyprintk: Add a force option for pciserial device
  objtool: Support per-function rodata sections
  x86/microcode: Make revision and processor flags world-readable

5 years agoMerge branch 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel...
Linus Torvalds [Sun, 4 Nov 2018 01:13:43 +0000 (18:13 -0700)]
Merge branch 'perf-urgent-for-linus' of git://git./linux/kernel/git/tip/tip

Pull perf updates and fixes from Ingo Molnar:
 "These are almost all tooling updates: 'perf top', 'perf trace' and
  'perf script' fixes and updates, an UAPI header sync with the merge
  window versions, license marker updates, much improved Sparc support
  from David Miller, and a number of fixes"

* 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (66 commits)
  perf intel-pt/bts: Calculate cpumode for synthesized samples
  perf intel-pt: Insert callchain context into synthesized callchains
  perf tools: Don't clone maps from parent when synthesizing forks
  perf top: Start display thread earlier
  tools headers uapi: Update linux/if_link.h header copy
  tools headers uapi: Update linux/netlink.h header copy
  tools headers: Sync the various kvm.h header copies
  tools include uapi: Update linux/mmap.h copy
  perf trace beauty: Use the mmap flags table generated from headers
  perf beauty: Wire up the mmap flags table generator to the Makefile
  perf beauty: Add a generator for MAP_ mmap's flag constants
  tools include uapi: Update asound.h copy
  tools arch uapi: Update asm-generic/unistd.h and arm64 unistd.h copies
  tools include uapi: Update linux/fs.h copy
  perf callchain: Honour the ordering of PERF_CONTEXT_{USER,KERNEL,etc}
  perf cs-etm: Correct CPU mode for samples
  perf unwind: Take pgoff into account when reporting elf to libdwfl
  perf top: Do not use overwrite mode by default
  perf top: Allow disabling the overwrite mode
  perf trace: Beautify mount's first pathname arg
  ...

5 years agoMerge branch 'irq-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel...
Linus Torvalds [Sun, 4 Nov 2018 01:12:09 +0000 (18:12 -0700)]
Merge branch 'irq-urgent-for-linus' of git://git./linux/kernel/git/tip/tip

Pull irq fixes from Ingo Molnar:
 "An irqchip driver fix and a memory (over-)allocation fix"

* 'irq-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  irqchip/irq-mvebu-sei: Fix a NULL vs IS_ERR() bug in probe function
  irq/matrix: Fix memory overallocation

5 years agosched/topology: Fix off by one bug
Peter Zijlstra [Fri, 2 Nov 2018 13:22:25 +0000 (14:22 +0100)]
sched/topology: Fix off by one bug

With the addition of the NUMA identity level, we increased @level by
one and will run off the end of the array in the distance sort loop.

Fixed: 051f3ca02e46 ("sched/topology: Introduce NUMA identity node sched domain")
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
5 years agoMerge branch 'core/urgent' into x86/urgent, to pick up objtool fix
Ingo Molnar [Sat, 3 Nov 2018 22:42:16 +0000 (23:42 +0100)]
Merge branch 'core/urgent' into x86/urgent, to pick up objtool fix

Signed-off-by: Ingo Molnar <mingo@kernel.org>