Skip to content

Commit 6ed92e5

Browse files
committed
Merge tag 'scsi-misc' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi
Pull SCSI updates from James Bottomley: "Updates to the usual drivers (ufs, megaraid_sas, lpfc, target, ibmvfc, scsi_debug) plus the usual assorted minor fixes and updates. The major change this time around is a prep patch for rethreading of the driver reset handler API not to take a scsi_cmd structure which starts to reduce various drivers' dependence on scsi_cmd in error handling" * tag 'scsi-misc' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi: (132 commits) scsi: ufs: core: Leave space for '\0' in utf8 desc string scsi: ufs: core: Conversion to bool not necessary scsi: ufs: core: Fix race between force complete and ISR scsi: megaraid: Fix up debug message in megaraid_abort_and_reset() scsi: aic79xx: Fix up NULL command in ahd_done() scsi: message: fusion: Initialize return value in mptfc_bus_reset() scsi: mpt3sas: Fix loop logic scsi: snic: Remove useless code in snic_dr_clean_pending_req() scsi: core: Add comment to target_destroy in scsi_host_template scsi: core: Clean up scsi_dev_queue_ready() scsi: pmcraid: Add missing scsi_device_put() in pmcraid_eh_target_reset_handler() scsi: target: core: Fix kernel-doc comment scsi: pmcraid: Fix kernel-doc comment scsi: core: Handle depopulation and restoration in progress scsi: ufs: core: Add support for parsing OPP scsi: ufs: core: Add OPP support for scaling clocks and regulators scsi: ufs: dt-bindings: common: Add OPP table scsi: scsi_debug: Add param to control sdev's allow_restart scsi: scsi_debug: Add debugfs interface to fail target reset scsi: scsi_debug: Add new error injection type: Reset LUN failed ...
2 parents 90a300d + a75a16c commit 6ed92e5

File tree

103 files changed

+2747
-1362
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

103 files changed

+2747
-1362
lines changed

Documentation/devicetree/bindings/ufs/ufs-common.yaml

Lines changed: 32 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,25 @@ properties:
2020
items:
2121
- description: Minimum frequency for given clock in Hz
2222
- description: Maximum frequency for given clock in Hz
23+
deprecated: true
2324
description: |
25+
Preferred is operating-points-v2.
26+
2427
Array of <min max> operating frequencies in Hz stored in the same order
25-
as the clocks property. If this property is not defined or a value in the
26-
array is "0" then it is assumed that the frequency is set by the parent
27-
clock or a fixed rate clock source.
28+
as the clocks property. If either this property or operating-points-v2 is
29+
not defined or a value in the array is "0" then it is assumed that the
30+
frequency is set by the parent clock or a fixed rate clock source.
31+
32+
operating-points-v2:
33+
description:
34+
Preferred over freq-table-hz.
35+
If present, each OPP must contain array of frequencies stored in the same
36+
order for each clock. If clock frequency in the array is "0" then it is
37+
assumed that the frequency is set by the parent clock or a fixed rate
38+
clock source.
39+
40+
opp-table:
41+
type: object
2842

2943
interrupts:
3044
maxItems: 1
@@ -75,8 +89,23 @@ properties:
7589

7690
dependencies:
7791
freq-table-hz: [ clocks ]
92+
operating-points-v2: [ clocks, clock-names ]
7893

7994
required:
8095
- interrupts
8196

97+
allOf:
98+
- if:
99+
required:
100+
- freq-table-hz
101+
then:
102+
properties:
103+
operating-points-v2: false
104+
- if:
105+
required:
106+
- operating-points-v2
107+
then:
108+
properties:
109+
freq-table-hz: false
110+
82111
additionalProperties: true

MAINTAINERS

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11221,7 +11221,6 @@ M: Sagi Grimberg <sagi@grimberg.me>
1122111221
L: linux-rdma@vger.kernel.org
1122211222
L: target-devel@vger.kernel.org
1122311223
S: Supported
11224-
W: http://www.linux-iscsi.org
1122511224
T: git git://git.kernel.org/pub/scm/linux/kernel/git/nab/target-pending.git master
1122611225
F: drivers/infiniband/ulp/isert
1122711226

@@ -13623,6 +13622,7 @@ MEGARAID SCSI/SAS DRIVERS
1362313622
M: Kashyap Desai <kashyap.desai@broadcom.com>
1362413623
M: Sumit Saxena <sumit.saxena@broadcom.com>
1362513624
M: Shivasharan S <shivasharan.srikanteshwara@broadcom.com>
13625+
M: Chandrakanth patil <chandrakanth.patil@broadcom.com>
1362613626
L: megaraidlinux.pdl@broadcom.com
1362713627
L: linux-scsi@vger.kernel.org
1362813628
S: Maintained
@@ -19275,7 +19275,6 @@ M: "Martin K. Petersen" <martin.petersen@oracle.com>
1927519275
L: linux-scsi@vger.kernel.org
1927619276
L: target-devel@vger.kernel.org
1927719277
S: Supported
19278-
W: http://www.linux-iscsi.org
1927919278
Q: https://patchwork.kernel.org/project/target-devel/list/
1928019279
T: git git://git.kernel.org/pub/scm/linux/kernel/git/mkp/scsi.git
1928119280
F: Documentation/target/

drivers/infiniband/ulp/srpt/ib_srpt.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3867,6 +3867,9 @@ static const struct target_core_fabric_ops srpt_template = {
38673867
.tfc_discovery_attrs = srpt_da_attrs,
38683868
.tfc_wwn_attrs = srpt_wwn_attrs,
38693869
.tfc_tpg_attrib_attrs = srpt_tpg_attrib_attrs,
3870+
3871+
.default_submit_type = TARGET_DIRECT_SUBMIT,
3872+
.direct_submit_supp = 1,
38703873
};
38713874

38723875
/**

drivers/message/fusion/mptctl.c

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1328,8 +1328,8 @@ mptctl_getiocinfo (MPT_ADAPTER *ioc, unsigned long arg, unsigned int data_size)
13281328

13291329
/* Set the Version Strings.
13301330
*/
1331-
strncpy (karg->driverVersion, MPT_LINUX_PACKAGE_NAME, MPT_IOCTL_VERSION_LENGTH);
1332-
karg->driverVersion[MPT_IOCTL_VERSION_LENGTH-1]='\0';
1331+
strscpy_pad(karg->driverVersion, MPT_LINUX_PACKAGE_NAME,
1332+
sizeof(karg->driverVersion));
13331333

13341334
karg->busChangeEvent = 0;
13351335
karg->hostId = ioc->pfacts[port].PortSCSIID;
@@ -1493,10 +1493,8 @@ mptctl_readtest (MPT_ADAPTER *ioc, unsigned long arg)
14931493
#else
14941494
karg.chip_type = ioc->pcidev->device;
14951495
#endif
1496-
strncpy (karg.name, ioc->name, MPT_MAX_NAME);
1497-
karg.name[MPT_MAX_NAME-1]='\0';
1498-
strncpy (karg.product, ioc->prod_name, MPT_PRODUCT_LENGTH);
1499-
karg.product[MPT_PRODUCT_LENGTH-1]='\0';
1496+
strscpy_pad(karg.name, ioc->name, sizeof(karg.name));
1497+
strscpy_pad(karg.product, ioc->prod_name, sizeof(karg.product));
15001498

15011499
/* Copy the data from kernel memory to user memory
15021500
*/
@@ -2394,7 +2392,7 @@ mptctl_hp_hostinfo(MPT_ADAPTER *ioc, unsigned long arg, unsigned int data_size)
23942392
cfg.dir = 0; /* read */
23952393
cfg.timeout = 10;
23962394

2397-
strncpy(karg.serial_number, " ", 24);
2395+
strscpy_pad(karg.serial_number, " ", sizeof(karg.serial_number));
23982396
if (mpt_config(ioc, &cfg) == 0) {
23992397
if (cfg.cfghdr.hdr->PageLength > 0) {
24002398
/* Issue the second config page request */
@@ -2408,8 +2406,9 @@ mptctl_hp_hostinfo(MPT_ADAPTER *ioc, unsigned long arg, unsigned int data_size)
24082406
if (mpt_config(ioc, &cfg) == 0) {
24092407
ManufacturingPage0_t *pdata = (ManufacturingPage0_t *) pbuf;
24102408
if (strlen(pdata->BoardTracerNumber) > 1) {
2411-
strscpy(karg.serial_number,
2412-
pdata->BoardTracerNumber, 24);
2409+
strscpy_pad(karg.serial_number,
2410+
pdata->BoardTracerNumber,
2411+
sizeof(karg.serial_number));
24132412
}
24142413
}
24152414
dma_free_coherent(&ioc->pcidev->dev,
@@ -2456,7 +2455,7 @@ mptctl_hp_hostinfo(MPT_ADAPTER *ioc, unsigned long arg, unsigned int data_size)
24562455
}
24572456
}
24582457

2459-
/*
2458+
/*
24602459
* Gather ISTWI(Industry Standard Two Wire Interface) Data
24612460
*/
24622461
if ((mf = mpt_get_msg_frame(mptctl_id, ioc)) == NULL) {

drivers/message/fusion/mptfc.c

Lines changed: 65 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -183,73 +183,109 @@ static struct fc_function_template mptfc_transport_functions = {
183183
};
184184

185185
static int
186-
mptfc_block_error_handler(struct scsi_cmnd *SCpnt,
187-
int (*func)(struct scsi_cmnd *SCpnt),
188-
const char *caller)
186+
mptfc_block_error_handler(struct fc_rport *rport)
189187
{
190188
MPT_SCSI_HOST *hd;
191-
struct scsi_device *sdev = SCpnt->device;
192-
struct Scsi_Host *shost = sdev->host;
193-
struct fc_rport *rport = starget_to_rport(scsi_target(sdev));
189+
struct Scsi_Host *shost = rport_to_shost(rport);
194190
unsigned long flags;
195191
int ready;
196-
MPT_ADAPTER *ioc;
192+
MPT_ADAPTER *ioc;
197193
int loops = 40; /* seconds */
198194

199-
hd = shost_priv(SCpnt->device->host);
195+
hd = shost_priv(shost);
200196
ioc = hd->ioc;
201197
spin_lock_irqsave(shost->host_lock, flags);
202198
while ((ready = fc_remote_port_chkready(rport) >> 16) == DID_IMM_RETRY
203199
|| (loops > 0 && ioc->active == 0)) {
204200
spin_unlock_irqrestore(shost->host_lock, flags);
205201
dfcprintk (ioc, printk(MYIOC_s_DEBUG_FMT
206-
"mptfc_block_error_handler.%d: %d:%llu, port status is "
207-
"%x, active flag %d, deferring %s recovery.\n",
202+
"mptfc_block_error_handler.%d: %s, port status is "
203+
"%x, active flag %d, deferring recovery.\n",
208204
ioc->name, ioc->sh->host_no,
209-
SCpnt->device->id, SCpnt->device->lun,
210-
ready, ioc->active, caller));
205+
dev_name(&rport->dev), ready, ioc->active));
211206
msleep(1000);
212207
spin_lock_irqsave(shost->host_lock, flags);
213208
loops --;
214209
}
215210
spin_unlock_irqrestore(shost->host_lock, flags);
216211

217-
if (ready == DID_NO_CONNECT || !SCpnt->device->hostdata
218-
|| ioc->active == 0) {
212+
if (ready == DID_NO_CONNECT || ioc->active == 0) {
219213
dfcprintk (ioc, printk(MYIOC_s_DEBUG_FMT
220-
"%s.%d: %d:%llu, failing recovery, "
221-
"port state %x, active %d, vdevice %p.\n", caller,
214+
"mpt_block_error_handler.%d: %s, failing recovery, "
215+
"port state %x, active %d.\n",
222216
ioc->name, ioc->sh->host_no,
223-
SCpnt->device->id, SCpnt->device->lun, ready,
224-
ioc->active, SCpnt->device->hostdata));
217+
dev_name(&rport->dev), ready, ioc->active));
225218
return FAILED;
226219
}
227-
dfcprintk (ioc, printk(MYIOC_s_DEBUG_FMT
228-
"%s.%d: %d:%llu, executing recovery.\n", caller,
229-
ioc->name, ioc->sh->host_no,
230-
SCpnt->device->id, SCpnt->device->lun));
231-
return (*func)(SCpnt);
220+
return SUCCESS;
232221
}
233222

234223
static int
235224
mptfc_abort(struct scsi_cmnd *SCpnt)
236225
{
237-
return
238-
mptfc_block_error_handler(SCpnt, mptscsih_abort, __func__);
226+
struct Scsi_Host *shost = SCpnt->device->host;
227+
struct fc_rport *rport = starget_to_rport(scsi_target(SCpnt->device));
228+
MPT_SCSI_HOST __maybe_unused *hd = shost_priv(shost);
229+
int rtn;
230+
231+
rtn = mptfc_block_error_handler(rport);
232+
if (rtn == SUCCESS) {
233+
dfcprintk (hd->ioc, printk(MYIOC_s_DEBUG_FMT
234+
"%s.%d: %d:%llu, executing recovery.\n", __func__,
235+
hd->ioc->name, shost->host_no,
236+
SCpnt->device->id, SCpnt->device->lun));
237+
rtn = mptscsih_abort(SCpnt);
238+
}
239+
return rtn;
239240
}
240241

241242
static int
242243
mptfc_dev_reset(struct scsi_cmnd *SCpnt)
243244
{
244-
return
245-
mptfc_block_error_handler(SCpnt, mptscsih_dev_reset, __func__);
245+
struct Scsi_Host *shost = SCpnt->device->host;
246+
struct fc_rport *rport = starget_to_rport(scsi_target(SCpnt->device));
247+
MPT_SCSI_HOST __maybe_unused *hd = shost_priv(shost);
248+
int rtn;
249+
250+
rtn = mptfc_block_error_handler(rport);
251+
if (rtn == SUCCESS) {
252+
dfcprintk (hd->ioc, printk(MYIOC_s_DEBUG_FMT
253+
"%s.%d: %d:%llu, executing recovery.\n", __func__,
254+
hd->ioc->name, shost->host_no,
255+
SCpnt->device->id, SCpnt->device->lun));
256+
rtn = mptscsih_dev_reset(SCpnt);
257+
}
258+
return rtn;
246259
}
247260

248261
static int
249262
mptfc_bus_reset(struct scsi_cmnd *SCpnt)
250263
{
251-
return
252-
mptfc_block_error_handler(SCpnt, mptscsih_bus_reset, __func__);
264+
struct Scsi_Host *shost = SCpnt->device->host;
265+
MPT_SCSI_HOST __maybe_unused *hd = shost_priv(shost);
266+
int channel = SCpnt->device->channel;
267+
struct mptfc_rport_info *ri;
268+
int rtn = FAILED;
269+
270+
list_for_each_entry(ri, &hd->ioc->fc_rports, list) {
271+
if (ri->flags & MPT_RPORT_INFO_FLAGS_REGISTERED) {
272+
VirtTarget *vtarget = ri->starget->hostdata;
273+
274+
if (!vtarget || vtarget->channel != channel)
275+
continue;
276+
rtn = fc_block_rport(ri->rport);
277+
if (rtn != 0)
278+
break;
279+
}
280+
}
281+
if (rtn == 0) {
282+
dfcprintk (hd->ioc, printk(MYIOC_s_DEBUG_FMT
283+
"%s.%d: %d:%llu, executing recovery.\n", __func__,
284+
hd->ioc->name, shost->host_no,
285+
SCpnt->device->id, SCpnt->device->lun));
286+
rtn = mptscsih_bus_reset(SCpnt);
287+
}
288+
return rtn;
253289
}
254290

255291
static void

drivers/message/fusion/mptsas.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2964,17 +2964,17 @@ mptsas_exp_repmanufacture_info(MPT_ADAPTER *ioc,
29642964
goto out_free;
29652965

29662966
manufacture_reply = data_out + sizeof(struct rep_manu_request);
2967-
strncpy(edev->vendor_id, manufacture_reply->vendor_id,
2968-
SAS_EXPANDER_VENDOR_ID_LEN);
2969-
strncpy(edev->product_id, manufacture_reply->product_id,
2970-
SAS_EXPANDER_PRODUCT_ID_LEN);
2971-
strncpy(edev->product_rev, manufacture_reply->product_rev,
2972-
SAS_EXPANDER_PRODUCT_REV_LEN);
2967+
strscpy(edev->vendor_id, manufacture_reply->vendor_id,
2968+
sizeof(edev->vendor_id));
2969+
strscpy(edev->product_id, manufacture_reply->product_id,
2970+
sizeof(edev->product_id));
2971+
strscpy(edev->product_rev, manufacture_reply->product_rev,
2972+
sizeof(edev->product_rev));
29732973
edev->level = manufacture_reply->sas_format;
29742974
if (manufacture_reply->sas_format) {
2975-
strncpy(edev->component_vendor_id,
2975+
strscpy(edev->component_vendor_id,
29762976
manufacture_reply->component_vendor_id,
2977-
SAS_EXPANDER_COMPONENT_VENDOR_ID_LEN);
2977+
sizeof(edev->component_vendor_id));
29782978
tmp = (u8 *)&manufacture_reply->component_id;
29792979
edev->component_id = tmp[0] << 8 | tmp[1];
29802980
edev->component_revision_id =

drivers/message/fusion/mptscsih.c

Lines changed: 54 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1793,7 +1793,7 @@ mptscsih_abort(struct scsi_cmnd * SCpnt)
17931793

17941794
/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
17951795
/**
1796-
* mptscsih_dev_reset - Perform a SCSI TARGET_RESET! new_eh variant
1796+
* mptscsih_dev_reset - Perform a SCSI LOGICAL_UNIT_RESET!
17971797
* @SCpnt: Pointer to scsi_cmnd structure, IO which reset is due to
17981798
*
17991799
* (linux scsi_host_template.eh_dev_reset_handler routine)
@@ -1808,6 +1808,58 @@ mptscsih_dev_reset(struct scsi_cmnd * SCpnt)
18081808
VirtDevice *vdevice;
18091809
MPT_ADAPTER *ioc;
18101810

1811+
/* If we can't locate our host adapter structure, return FAILED status.
1812+
*/
1813+
if ((hd = shost_priv(SCpnt->device->host)) == NULL){
1814+
printk(KERN_ERR MYNAM ": lun reset: "
1815+
"Can't locate host! (sc=%p)\n", SCpnt);
1816+
return FAILED;
1817+
}
1818+
1819+
ioc = hd->ioc;
1820+
printk(MYIOC_s_INFO_FMT "attempting lun reset! (sc=%p)\n",
1821+
ioc->name, SCpnt);
1822+
scsi_print_command(SCpnt);
1823+
1824+
vdevice = SCpnt->device->hostdata;
1825+
if (!vdevice || !vdevice->vtarget) {
1826+
retval = 0;
1827+
goto out;
1828+
}
1829+
1830+
retval = mptscsih_IssueTaskMgmt(hd,
1831+
MPI_SCSITASKMGMT_TASKTYPE_LOGICAL_UNIT_RESET,
1832+
vdevice->vtarget->channel,
1833+
vdevice->vtarget->id, vdevice->lun, 0,
1834+
mptscsih_get_tm_timeout(ioc));
1835+
1836+
out:
1837+
printk (MYIOC_s_INFO_FMT "lun reset: %s (sc=%p)\n",
1838+
ioc->name, ((retval == 0) ? "SUCCESS" : "FAILED" ), SCpnt);
1839+
1840+
if (retval == 0)
1841+
return SUCCESS;
1842+
else
1843+
return FAILED;
1844+
}
1845+
1846+
/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
1847+
/**
1848+
* mptscsih_target_reset - Perform a SCSI TARGET_RESET!
1849+
* @SCpnt: Pointer to scsi_cmnd structure, IO which reset is due to
1850+
*
1851+
* (linux scsi_host_template.eh_target_reset_handler routine)
1852+
*
1853+
* Returns SUCCESS or FAILED.
1854+
**/
1855+
int
1856+
mptscsih_target_reset(struct scsi_cmnd * SCpnt)
1857+
{
1858+
MPT_SCSI_HOST *hd;
1859+
int retval;
1860+
VirtDevice *vdevice;
1861+
MPT_ADAPTER *ioc;
1862+
18111863
/* If we can't locate our host adapter structure, return FAILED status.
18121864
*/
18131865
if ((hd = shost_priv(SCpnt->device->host)) == NULL){
@@ -3256,6 +3308,7 @@ EXPORT_SYMBOL(mptscsih_slave_destroy);
32563308
EXPORT_SYMBOL(mptscsih_slave_configure);
32573309
EXPORT_SYMBOL(mptscsih_abort);
32583310
EXPORT_SYMBOL(mptscsih_dev_reset);
3311+
EXPORT_SYMBOL(mptscsih_target_reset);
32593312
EXPORT_SYMBOL(mptscsih_bus_reset);
32603313
EXPORT_SYMBOL(mptscsih_host_reset);
32613314
EXPORT_SYMBOL(mptscsih_bios_param);

drivers/message/fusion/mptscsih.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ extern void mptscsih_slave_destroy(struct scsi_device *device);
120120
extern int mptscsih_slave_configure(struct scsi_device *device);
121121
extern int mptscsih_abort(struct scsi_cmnd * SCpnt);
122122
extern int mptscsih_dev_reset(struct scsi_cmnd * SCpnt);
123+
extern int mptscsih_target_reset(struct scsi_cmnd * SCpnt);
123124
extern int mptscsih_bus_reset(struct scsi_cmnd * SCpnt);
124125
extern int mptscsih_host_reset(struct scsi_cmnd *SCpnt);
125126
extern int mptscsih_bios_param(struct scsi_device * sdev, struct block_device *bdev, sector_t capacity, int geom[]);

0 commit comments

Comments
 (0)