aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2018-04-26 00:13:40 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2018-04-26 00:13:40 -0400
commit3442097b765c3e89fe3afe755054e6683b140f6d (patch)
tree87d74de00f967c95610877b564ddb6e908e9405b
parent8fba70b0850a0163f1018a122200ec11b854135c (diff)
parent8e1ceafe50ec4d1bcfae154dd70e7cb6946a6177 (diff)
Merge tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi
Pull SCSI fixes from James Bottomley: "Eight bug fixes, one spelling update and one tracepoint addition. The most serious is probably the mptsas write same fix because it means anyone using these controllers sees errors when modern filesystems try to issue discards" * tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi: scsi: target: fix crash with iscsi target and dvd scsi: sd_zbc: Avoid that resetting a zone fails sporadically scsi: sd: Defer spinning up drive while SANITIZE is in progress scsi: megaraid_sas: Do not log an error if FW successfully initializes. scsi: ufs: add trace event for ufs upiu scsi: core: remove reference to scsi_show_extd_sense() scsi: mptsas: Disable WRITE SAME scsi: fnic: fix spelling mistake in fnic stats "Abord" -> "Abort" scsi: scsi_debug: IMMED related delay adjustments scsi: iscsi: respond to netlink with unicast when appropriate
-rw-r--r--drivers/message/fusion/mptsas.c1
-rw-r--r--drivers/scsi/fnic/fnic_trace.c2
-rw-r--r--drivers/scsi/megaraid/megaraid_sas_fusion.c6
-rw-r--r--drivers/scsi/scsi_debug.c33
-rw-r--r--drivers/scsi/scsi_transport_iscsi.c29
-rw-r--r--drivers/scsi/sd.c2
-rw-r--r--drivers/scsi/sd_zbc.c140
-rw-r--r--drivers/scsi/ufs/ufshcd.c40
-rw-r--r--drivers/target/target_core_pscsi.c2
-rw-r--r--include/linux/blkdev.h5
-rw-r--r--include/scsi/scsi_dbg.h2
-rw-r--r--include/trace/events/ufs.h27
12 files changed, 205 insertions, 84 deletions
diff --git a/drivers/message/fusion/mptsas.c b/drivers/message/fusion/mptsas.c
index 231f3a1e27bf..86503f60468f 100644
--- a/drivers/message/fusion/mptsas.c
+++ b/drivers/message/fusion/mptsas.c
@@ -1994,6 +1994,7 @@ static struct scsi_host_template mptsas_driver_template = {
1994 .cmd_per_lun = 7, 1994 .cmd_per_lun = 7,
1995 .use_clustering = ENABLE_CLUSTERING, 1995 .use_clustering = ENABLE_CLUSTERING,
1996 .shost_attrs = mptscsih_host_attrs, 1996 .shost_attrs = mptscsih_host_attrs,
1997 .no_write_same = 1,
1997}; 1998};
1998 1999
1999static int mptsas_get_linkerrors(struct sas_phy *phy) 2000static int mptsas_get_linkerrors(struct sas_phy *phy)
diff --git a/drivers/scsi/fnic/fnic_trace.c b/drivers/scsi/fnic/fnic_trace.c
index abddde11982b..98597b59c12a 100644
--- a/drivers/scsi/fnic/fnic_trace.c
+++ b/drivers/scsi/fnic/fnic_trace.c
@@ -296,7 +296,7 @@ int fnic_get_stats_data(struct stats_debug_info *debug,
296 "Number of Abort FW Timeouts: %lld\n" 296 "Number of Abort FW Timeouts: %lld\n"
297 "Number of Abort IO NOT Found: %lld\n" 297 "Number of Abort IO NOT Found: %lld\n"
298 298
299 "Abord issued times: \n" 299 "Abort issued times: \n"
300 " < 6 sec : %lld\n" 300 " < 6 sec : %lld\n"
301 " 6 sec - 20 sec : %lld\n" 301 " 6 sec - 20 sec : %lld\n"
302 " 20 sec - 30 sec : %lld\n" 302 " 20 sec - 30 sec : %lld\n"
diff --git a/drivers/scsi/megaraid/megaraid_sas_fusion.c b/drivers/scsi/megaraid/megaraid_sas_fusion.c
index ce97cde3b41c..f4d988dd1e9d 100644
--- a/drivers/scsi/megaraid/megaraid_sas_fusion.c
+++ b/drivers/scsi/megaraid/megaraid_sas_fusion.c
@@ -1124,12 +1124,12 @@ megasas_ioc_init_fusion(struct megasas_instance *instance)
1124 goto fail_fw_init; 1124 goto fail_fw_init;
1125 } 1125 }
1126 1126
1127 ret = 0; 1127 return 0;
1128 1128
1129fail_fw_init: 1129fail_fw_init:
1130 dev_err(&instance->pdev->dev, 1130 dev_err(&instance->pdev->dev,
1131 "Init cmd return status %s for SCSI host %d\n", 1131 "Init cmd return status FAILED for SCSI host %d\n",
1132 ret ? "FAILED" : "SUCCESS", instance->host->host_no); 1132 instance->host->host_no);
1133 1133
1134 return ret; 1134 return ret;
1135} 1135}
diff --git a/drivers/scsi/scsi_debug.c b/drivers/scsi/scsi_debug.c
index 9ef5e3b810f6..656c98e116a9 100644
--- a/drivers/scsi/scsi_debug.c
+++ b/drivers/scsi/scsi_debug.c
@@ -234,11 +234,13 @@ static const char *sdebug_version_date = "20180128";
234#define F_INV_OP 0x200 234#define F_INV_OP 0x200
235#define F_FAKE_RW 0x400 235#define F_FAKE_RW 0x400
236#define F_M_ACCESS 0x800 /* media access */ 236#define F_M_ACCESS 0x800 /* media access */
237#define F_LONG_DELAY 0x1000 237#define F_SSU_DELAY 0x1000
238#define F_SYNC_DELAY 0x2000
238 239
239#define FF_RESPOND (F_RL_WLUN_OK | F_SKIP_UA | F_DELAY_OVERR) 240#define FF_RESPOND (F_RL_WLUN_OK | F_SKIP_UA | F_DELAY_OVERR)
240#define FF_MEDIA_IO (F_M_ACCESS | F_FAKE_RW) 241#define FF_MEDIA_IO (F_M_ACCESS | F_FAKE_RW)
241#define FF_SA (F_SA_HIGH | F_SA_LOW) 242#define FF_SA (F_SA_HIGH | F_SA_LOW)
243#define F_LONG_DELAY (F_SSU_DELAY | F_SYNC_DELAY)
242 244
243#define SDEBUG_MAX_PARTS 4 245#define SDEBUG_MAX_PARTS 4
244 246
@@ -510,7 +512,7 @@ static const struct opcode_info_t release_iarr[] = {
510}; 512};
511 513
512static const struct opcode_info_t sync_cache_iarr[] = { 514static const struct opcode_info_t sync_cache_iarr[] = {
513 {0, 0x91, 0, F_LONG_DELAY | F_M_ACCESS, resp_sync_cache, NULL, 515 {0, 0x91, 0, F_SYNC_DELAY | F_M_ACCESS, resp_sync_cache, NULL,
514 {16, 0x6, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 516 {16, 0x6, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
515 0xff, 0xff, 0xff, 0xff, 0x3f, 0xc7} }, /* SYNC_CACHE (16) */ 517 0xff, 0xff, 0xff, 0xff, 0x3f, 0xc7} }, /* SYNC_CACHE (16) */
516}; 518};
@@ -553,7 +555,7 @@ static const struct opcode_info_t opcode_info_arr[SDEB_I_LAST_ELEMENT + 1] = {
553 resp_write_dt0, write_iarr, /* WRITE(16) */ 555 resp_write_dt0, write_iarr, /* WRITE(16) */
554 {16, 0xfa, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 556 {16, 0xfa, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
555 0xff, 0xff, 0xff, 0xff, 0xff, 0xc7} }, 557 0xff, 0xff, 0xff, 0xff, 0xff, 0xc7} },
556 {0, 0x1b, 0, F_LONG_DELAY, resp_start_stop, NULL,/* START STOP UNIT */ 558 {0, 0x1b, 0, F_SSU_DELAY, resp_start_stop, NULL,/* START STOP UNIT */
557 {6, 0x1, 0, 0xf, 0xf7, 0xc7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} }, 559 {6, 0x1, 0, 0xf, 0xf7, 0xc7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} },
558 {ARRAY_SIZE(sa_in_16_iarr), 0x9e, 0x10, F_SA_LOW | F_D_IN, 560 {ARRAY_SIZE(sa_in_16_iarr), 0x9e, 0x10, F_SA_LOW | F_D_IN,
559 resp_readcap16, sa_in_16_iarr, /* SA_IN(16), READ CAPACITY(16) */ 561 resp_readcap16, sa_in_16_iarr, /* SA_IN(16), READ CAPACITY(16) */
@@ -606,7 +608,7 @@ static const struct opcode_info_t opcode_info_arr[SDEB_I_LAST_ELEMENT + 1] = {
606 resp_write_same_10, write_same_iarr, /* WRITE SAME(10) */ 608 resp_write_same_10, write_same_iarr, /* WRITE SAME(10) */
607 {10, 0xff, 0xff, 0xff, 0xff, 0xff, 0x3f, 0xff, 0xff, 0xc7, 0, 609 {10, 0xff, 0xff, 0xff, 0xff, 0xff, 0x3f, 0xff, 0xff, 0xc7, 0,
608 0, 0, 0, 0, 0} }, 610 0, 0, 0, 0, 0} },
609 {ARRAY_SIZE(sync_cache_iarr), 0x35, 0, F_LONG_DELAY | F_M_ACCESS, 611 {ARRAY_SIZE(sync_cache_iarr), 0x35, 0, F_SYNC_DELAY | F_M_ACCESS,
610 resp_sync_cache, sync_cache_iarr, 612 resp_sync_cache, sync_cache_iarr,
611 {10, 0x7, 0xff, 0xff, 0xff, 0xff, 0x3f, 0xff, 0xff, 0xc7, 0, 0, 613 {10, 0x7, 0xff, 0xff, 0xff, 0xff, 0x3f, 0xff, 0xff, 0xc7, 0, 0,
612 0, 0, 0, 0} }, /* SYNC_CACHE (10) */ 614 0, 0, 0, 0} }, /* SYNC_CACHE (10) */
@@ -667,6 +669,7 @@ static bool sdebug_strict = DEF_STRICT;
667static bool sdebug_any_injecting_opt; 669static bool sdebug_any_injecting_opt;
668static bool sdebug_verbose; 670static bool sdebug_verbose;
669static bool have_dif_prot; 671static bool have_dif_prot;
672static bool write_since_sync;
670static bool sdebug_statistics = DEF_STATISTICS; 673static bool sdebug_statistics = DEF_STATISTICS;
671 674
672static unsigned int sdebug_store_sectors; 675static unsigned int sdebug_store_sectors;
@@ -1607,6 +1610,7 @@ static int resp_start_stop(struct scsi_cmnd *scp,
1607{ 1610{
1608 unsigned char *cmd = scp->cmnd; 1611 unsigned char *cmd = scp->cmnd;
1609 int power_cond, stop; 1612 int power_cond, stop;
1613 bool changing;
1610 1614
1611 power_cond = (cmd[4] & 0xf0) >> 4; 1615 power_cond = (cmd[4] & 0xf0) >> 4;
1612 if (power_cond) { 1616 if (power_cond) {
@@ -1614,8 +1618,12 @@ static int resp_start_stop(struct scsi_cmnd *scp,
1614 return check_condition_result; 1618 return check_condition_result;
1615 } 1619 }
1616 stop = !(cmd[4] & 1); 1620 stop = !(cmd[4] & 1);
1621 changing = atomic_read(&devip->stopped) == !stop;
1617 atomic_xchg(&devip->stopped, stop); 1622 atomic_xchg(&devip->stopped, stop);
1618 return (cmd[1] & 0x1) ? SDEG_RES_IMMED_MASK : 0; /* check IMMED bit */ 1623 if (!changing || cmd[1] & 0x1) /* state unchanged or IMMED set */
1624 return SDEG_RES_IMMED_MASK;
1625 else
1626 return 0;
1619} 1627}
1620 1628
1621static sector_t get_sdebug_capacity(void) 1629static sector_t get_sdebug_capacity(void)
@@ -2473,6 +2481,7 @@ static int do_device_access(struct scsi_cmnd *scmd, u32 sg_skip, u64 lba,
2473 if (do_write) { 2481 if (do_write) {
2474 sdb = scsi_out(scmd); 2482 sdb = scsi_out(scmd);
2475 dir = DMA_TO_DEVICE; 2483 dir = DMA_TO_DEVICE;
2484 write_since_sync = true;
2476 } else { 2485 } else {
2477 sdb = scsi_in(scmd); 2486 sdb = scsi_in(scmd);
2478 dir = DMA_FROM_DEVICE; 2487 dir = DMA_FROM_DEVICE;
@@ -3583,6 +3592,7 @@ static int resp_get_lba_status(struct scsi_cmnd *scp,
3583static int resp_sync_cache(struct scsi_cmnd *scp, 3592static int resp_sync_cache(struct scsi_cmnd *scp,
3584 struct sdebug_dev_info *devip) 3593 struct sdebug_dev_info *devip)
3585{ 3594{
3595 int res = 0;
3586 u64 lba; 3596 u64 lba;
3587 u32 num_blocks; 3597 u32 num_blocks;
3588 u8 *cmd = scp->cmnd; 3598 u8 *cmd = scp->cmnd;
@@ -3598,7 +3608,11 @@ static int resp_sync_cache(struct scsi_cmnd *scp,
3598 mk_sense_buffer(scp, ILLEGAL_REQUEST, LBA_OUT_OF_RANGE, 0); 3608 mk_sense_buffer(scp, ILLEGAL_REQUEST, LBA_OUT_OF_RANGE, 0);
3599 return check_condition_result; 3609 return check_condition_result;
3600 } 3610 }
3601 return (cmd[1] & 0x2) ? SDEG_RES_IMMED_MASK : 0; /* check IMMED bit */ 3611 if (!write_since_sync || cmd[1] & 0x2)
3612 res = SDEG_RES_IMMED_MASK;
3613 else /* delay if write_since_sync and IMMED clear */
3614 write_since_sync = false;
3615 return res;
3602} 3616}
3603 3617
3604#define RL_BUCKET_ELEMS 8 3618#define RL_BUCKET_ELEMS 8
@@ -5777,13 +5791,14 @@ fini:
5777 return schedule_resp(scp, devip, errsts, pfp, 0, 0); 5791 return schedule_resp(scp, devip, errsts, pfp, 0, 0);
5778 else if ((sdebug_jdelay || sdebug_ndelay) && (flags & F_LONG_DELAY)) { 5792 else if ((sdebug_jdelay || sdebug_ndelay) && (flags & F_LONG_DELAY)) {
5779 /* 5793 /*
5780 * If any delay is active, want F_LONG_DELAY to be at least 1 5794 * If any delay is active, for F_SSU_DELAY want at least 1
5781 * second and if sdebug_jdelay>0 want a long delay of that 5795 * second and if sdebug_jdelay>0 want a long delay of that
5782 * many seconds. 5796 * many seconds; for F_SYNC_DELAY want 1/20 of that.
5783 */ 5797 */
5784 int jdelay = (sdebug_jdelay < 2) ? 1 : sdebug_jdelay; 5798 int jdelay = (sdebug_jdelay < 2) ? 1 : sdebug_jdelay;
5799 int denom = (flags & F_SYNC_DELAY) ? 20 : 1;
5785 5800
5786 jdelay = mult_frac(USER_HZ * jdelay, HZ, USER_HZ); 5801 jdelay = mult_frac(USER_HZ * jdelay, HZ, denom * USER_HZ);
5787 return schedule_resp(scp, devip, errsts, pfp, jdelay, 0); 5802 return schedule_resp(scp, devip, errsts, pfp, jdelay, 0);
5788 } else 5803 } else
5789 return schedule_resp(scp, devip, errsts, pfp, sdebug_jdelay, 5804 return schedule_resp(scp, devip, errsts, pfp, sdebug_jdelay,
diff --git a/drivers/scsi/scsi_transport_iscsi.c b/drivers/scsi/scsi_transport_iscsi.c
index f4b52b44b966..65f6c94f2e9b 100644
--- a/drivers/scsi/scsi_transport_iscsi.c
+++ b/drivers/scsi/scsi_transport_iscsi.c
@@ -2322,6 +2322,12 @@ iscsi_multicast_skb(struct sk_buff *skb, uint32_t group, gfp_t gfp)
2322 return nlmsg_multicast(nls, skb, 0, group, gfp); 2322 return nlmsg_multicast(nls, skb, 0, group, gfp);
2323} 2323}
2324 2324
2325static int
2326iscsi_unicast_skb(struct sk_buff *skb, u32 portid)
2327{
2328 return nlmsg_unicast(nls, skb, portid);
2329}
2330
2325int iscsi_recv_pdu(struct iscsi_cls_conn *conn, struct iscsi_hdr *hdr, 2331int iscsi_recv_pdu(struct iscsi_cls_conn *conn, struct iscsi_hdr *hdr,
2326 char *data, uint32_t data_size) 2332 char *data, uint32_t data_size)
2327{ 2333{
@@ -2524,14 +2530,11 @@ void iscsi_ping_comp_event(uint32_t host_no, struct iscsi_transport *transport,
2524EXPORT_SYMBOL_GPL(iscsi_ping_comp_event); 2530EXPORT_SYMBOL_GPL(iscsi_ping_comp_event);
2525 2531
2526static int 2532static int
2527iscsi_if_send_reply(uint32_t group, int seq, int type, int done, int multi, 2533iscsi_if_send_reply(u32 portid, int type, void *payload, int size)
2528 void *payload, int size)
2529{ 2534{
2530 struct sk_buff *skb; 2535 struct sk_buff *skb;
2531 struct nlmsghdr *nlh; 2536 struct nlmsghdr *nlh;
2532 int len = nlmsg_total_size(size); 2537 int len = nlmsg_total_size(size);
2533 int flags = multi ? NLM_F_MULTI : 0;
2534 int t = done ? NLMSG_DONE : type;
2535 2538
2536 skb = alloc_skb(len, GFP_ATOMIC); 2539 skb = alloc_skb(len, GFP_ATOMIC);
2537 if (!skb) { 2540 if (!skb) {
@@ -2539,10 +2542,9 @@ iscsi_if_send_reply(uint32_t group, int seq, int type, int done, int multi,
2539 return -ENOMEM; 2542 return -ENOMEM;
2540 } 2543 }
2541 2544
2542 nlh = __nlmsg_put(skb, 0, 0, t, (len - sizeof(*nlh)), 0); 2545 nlh = __nlmsg_put(skb, 0, 0, type, (len - sizeof(*nlh)), 0);
2543 nlh->nlmsg_flags = flags;
2544 memcpy(nlmsg_data(nlh), payload, size); 2546 memcpy(nlmsg_data(nlh), payload, size);
2545 return iscsi_multicast_skb(skb, group, GFP_ATOMIC); 2547 return iscsi_unicast_skb(skb, portid);
2546} 2548}
2547 2549
2548static int 2550static int
@@ -3470,6 +3472,7 @@ static int
3470iscsi_if_recv_msg(struct sk_buff *skb, struct nlmsghdr *nlh, uint32_t *group) 3472iscsi_if_recv_msg(struct sk_buff *skb, struct nlmsghdr *nlh, uint32_t *group)
3471{ 3473{
3472 int err = 0; 3474 int err = 0;
3475 u32 portid;
3473 struct iscsi_uevent *ev = nlmsg_data(nlh); 3476 struct iscsi_uevent *ev = nlmsg_data(nlh);
3474 struct iscsi_transport *transport = NULL; 3477 struct iscsi_transport *transport = NULL;
3475 struct iscsi_internal *priv; 3478 struct iscsi_internal *priv;
@@ -3490,10 +3493,12 @@ iscsi_if_recv_msg(struct sk_buff *skb, struct nlmsghdr *nlh, uint32_t *group)
3490 if (!try_module_get(transport->owner)) 3493 if (!try_module_get(transport->owner))
3491 return -EINVAL; 3494 return -EINVAL;
3492 3495
3496 portid = NETLINK_CB(skb).portid;
3497
3493 switch (nlh->nlmsg_type) { 3498 switch (nlh->nlmsg_type) {
3494 case ISCSI_UEVENT_CREATE_SESSION: 3499 case ISCSI_UEVENT_CREATE_SESSION:
3495 err = iscsi_if_create_session(priv, ep, ev, 3500 err = iscsi_if_create_session(priv, ep, ev,
3496 NETLINK_CB(skb).portid, 3501 portid,
3497 ev->u.c_session.initial_cmdsn, 3502 ev->u.c_session.initial_cmdsn,
3498 ev->u.c_session.cmds_max, 3503 ev->u.c_session.cmds_max,
3499 ev->u.c_session.queue_depth); 3504 ev->u.c_session.queue_depth);
@@ -3506,7 +3511,7 @@ iscsi_if_recv_msg(struct sk_buff *skb, struct nlmsghdr *nlh, uint32_t *group)
3506 } 3511 }
3507 3512
3508 err = iscsi_if_create_session(priv, ep, ev, 3513 err = iscsi_if_create_session(priv, ep, ev,
3509 NETLINK_CB(skb).portid, 3514 portid,
3510 ev->u.c_bound_session.initial_cmdsn, 3515 ev->u.c_bound_session.initial_cmdsn,
3511 ev->u.c_bound_session.cmds_max, 3516 ev->u.c_bound_session.cmds_max,
3512 ev->u.c_bound_session.queue_depth); 3517 ev->u.c_bound_session.queue_depth);
@@ -3664,6 +3669,8 @@ iscsi_if_recv_msg(struct sk_buff *skb, struct nlmsghdr *nlh, uint32_t *group)
3664static void 3669static void
3665iscsi_if_rx(struct sk_buff *skb) 3670iscsi_if_rx(struct sk_buff *skb)
3666{ 3671{
3672 u32 portid = NETLINK_CB(skb).portid;
3673
3667 mutex_lock(&rx_queue_mutex); 3674 mutex_lock(&rx_queue_mutex);
3668 while (skb->len >= NLMSG_HDRLEN) { 3675 while (skb->len >= NLMSG_HDRLEN) {
3669 int err; 3676 int err;
@@ -3699,8 +3706,8 @@ iscsi_if_rx(struct sk_buff *skb)
3699 break; 3706 break;
3700 if (ev->type == ISCSI_UEVENT_GET_CHAP && !err) 3707 if (ev->type == ISCSI_UEVENT_GET_CHAP && !err)
3701 break; 3708 break;
3702 err = iscsi_if_send_reply(group, nlh->nlmsg_seq, 3709 err = iscsi_if_send_reply(portid, nlh->nlmsg_type,
3703 nlh->nlmsg_type, 0, 0, ev, sizeof(*ev)); 3710 ev, sizeof(*ev));
3704 } while (err < 0 && err != -ECONNREFUSED && err != -ESRCH); 3711 } while (err < 0 && err != -ECONNREFUSED && err != -ESRCH);
3705 skb_pull(skb, rlen); 3712 skb_pull(skb, rlen);
3706 } 3713 }
diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
index a6201e696ab9..9421d9877730 100644
--- a/drivers/scsi/sd.c
+++ b/drivers/scsi/sd.c
@@ -2121,6 +2121,8 @@ sd_spinup_disk(struct scsi_disk *sdkp)
2121 break; /* standby */ 2121 break; /* standby */
2122 if (sshdr.asc == 4 && sshdr.ascq == 0xc) 2122 if (sshdr.asc == 4 && sshdr.ascq == 0xc)
2123 break; /* unavailable */ 2123 break; /* unavailable */
2124 if (sshdr.asc == 4 && sshdr.ascq == 0x1b)
2125 break; /* sanitize in progress */
2124 /* 2126 /*
2125 * Issue command to spin up drive when not ready 2127 * Issue command to spin up drive when not ready
2126 */ 2128 */
diff --git a/drivers/scsi/sd_zbc.c b/drivers/scsi/sd_zbc.c
index 41df75eea57b..210407cd2341 100644
--- a/drivers/scsi/sd_zbc.c
+++ b/drivers/scsi/sd_zbc.c
@@ -400,8 +400,10 @@ static int sd_zbc_check_capacity(struct scsi_disk *sdkp, unsigned char *buf)
400 * 400 *
401 * Check that all zones of the device are equal. The last zone can however 401 * Check that all zones of the device are equal. The last zone can however
402 * be smaller. The zone size must also be a power of two number of LBAs. 402 * be smaller. The zone size must also be a power of two number of LBAs.
403 *
404 * Returns the zone size in bytes upon success or an error code upon failure.
403 */ 405 */
404static int sd_zbc_check_zone_size(struct scsi_disk *sdkp) 406static s64 sd_zbc_check_zone_size(struct scsi_disk *sdkp)
405{ 407{
406 u64 zone_blocks = 0; 408 u64 zone_blocks = 0;
407 sector_t block = 0; 409 sector_t block = 0;
@@ -412,8 +414,6 @@ static int sd_zbc_check_zone_size(struct scsi_disk *sdkp)
412 int ret; 414 int ret;
413 u8 same; 415 u8 same;
414 416
415 sdkp->zone_blocks = 0;
416
417 /* Get a buffer */ 417 /* Get a buffer */
418 buf = kmalloc(SD_ZBC_BUF_SIZE, GFP_KERNEL); 418 buf = kmalloc(SD_ZBC_BUF_SIZE, GFP_KERNEL);
419 if (!buf) 419 if (!buf)
@@ -445,16 +445,17 @@ static int sd_zbc_check_zone_size(struct scsi_disk *sdkp)
445 445
446 /* Parse zone descriptors */ 446 /* Parse zone descriptors */
447 while (rec < buf + buf_len) { 447 while (rec < buf + buf_len) {
448 zone_blocks = get_unaligned_be64(&rec[8]); 448 u64 this_zone_blocks = get_unaligned_be64(&rec[8]);
449 if (sdkp->zone_blocks == 0) { 449
450 sdkp->zone_blocks = zone_blocks; 450 if (zone_blocks == 0) {
451 } else if (zone_blocks != sdkp->zone_blocks && 451 zone_blocks = this_zone_blocks;
452 (block + zone_blocks < sdkp->capacity 452 } else if (this_zone_blocks != zone_blocks &&
453 || zone_blocks > sdkp->zone_blocks)) { 453 (block + this_zone_blocks < sdkp->capacity
454 zone_blocks = 0; 454 || this_zone_blocks > zone_blocks)) {
455 this_zone_blocks = 0;
455 goto out; 456 goto out;
456 } 457 }
457 block += zone_blocks; 458 block += this_zone_blocks;
458 rec += 64; 459 rec += 64;
459 } 460 }
460 461
@@ -467,8 +468,6 @@ static int sd_zbc_check_zone_size(struct scsi_disk *sdkp)
467 468
468 } while (block < sdkp->capacity); 469 } while (block < sdkp->capacity);
469 470
470 zone_blocks = sdkp->zone_blocks;
471
472out: 471out:
473 if (!zone_blocks) { 472 if (!zone_blocks) {
474 if (sdkp->first_scan) 473 if (sdkp->first_scan)
@@ -488,8 +487,7 @@ out:
488 "Zone size too large\n"); 487 "Zone size too large\n");
489 ret = -ENODEV; 488 ret = -ENODEV;
490 } else { 489 } else {
491 sdkp->zone_blocks = zone_blocks; 490 ret = zone_blocks;
492 sdkp->zone_shift = ilog2(zone_blocks);
493 } 491 }
494 492
495out_free: 493out_free:
@@ -500,15 +498,14 @@ out_free:
500 498
501/** 499/**
502 * sd_zbc_alloc_zone_bitmap - Allocate a zone bitmap (one bit per zone). 500 * sd_zbc_alloc_zone_bitmap - Allocate a zone bitmap (one bit per zone).
503 * @sdkp: The disk of the bitmap 501 * @nr_zones: Number of zones to allocate space for.
502 * @numa_node: NUMA node to allocate the memory from.
504 */ 503 */
505static inline unsigned long *sd_zbc_alloc_zone_bitmap(struct scsi_disk *sdkp) 504static inline unsigned long *
505sd_zbc_alloc_zone_bitmap(u32 nr_zones, int numa_node)
506{ 506{
507 struct request_queue *q = sdkp->disk->queue; 507 return kzalloc_node(BITS_TO_LONGS(nr_zones) * sizeof(unsigned long),
508 508 GFP_KERNEL, numa_node);
509 return kzalloc_node(BITS_TO_LONGS(sdkp->nr_zones)
510 * sizeof(unsigned long),
511 GFP_KERNEL, q->node);
512} 509}
513 510
514/** 511/**
@@ -516,6 +513,7 @@ static inline unsigned long *sd_zbc_alloc_zone_bitmap(struct scsi_disk *sdkp)
516 * @sdkp: disk used 513 * @sdkp: disk used
517 * @buf: report reply buffer 514 * @buf: report reply buffer
518 * @buflen: length of @buf 515 * @buflen: length of @buf
516 * @zone_shift: logarithm base 2 of the number of blocks in a zone
519 * @seq_zones_bitmap: bitmap of sequential zones to set 517 * @seq_zones_bitmap: bitmap of sequential zones to set
520 * 518 *
521 * Parse reported zone descriptors in @buf to identify sequential zones and 519 * Parse reported zone descriptors in @buf to identify sequential zones and
@@ -525,7 +523,7 @@ static inline unsigned long *sd_zbc_alloc_zone_bitmap(struct scsi_disk *sdkp)
525 * Return the LBA after the last zone reported. 523 * Return the LBA after the last zone reported.
526 */ 524 */
527static sector_t sd_zbc_get_seq_zones(struct scsi_disk *sdkp, unsigned char *buf, 525static sector_t sd_zbc_get_seq_zones(struct scsi_disk *sdkp, unsigned char *buf,
528 unsigned int buflen, 526 unsigned int buflen, u32 zone_shift,
529 unsigned long *seq_zones_bitmap) 527 unsigned long *seq_zones_bitmap)
530{ 528{
531 sector_t lba, next_lba = sdkp->capacity; 529 sector_t lba, next_lba = sdkp->capacity;
@@ -544,7 +542,7 @@ static sector_t sd_zbc_get_seq_zones(struct scsi_disk *sdkp, unsigned char *buf,
544 if (type != ZBC_ZONE_TYPE_CONV && 542 if (type != ZBC_ZONE_TYPE_CONV &&
545 cond != ZBC_ZONE_COND_READONLY && 543 cond != ZBC_ZONE_COND_READONLY &&
546 cond != ZBC_ZONE_COND_OFFLINE) 544 cond != ZBC_ZONE_COND_OFFLINE)
547 set_bit(lba >> sdkp->zone_shift, seq_zones_bitmap); 545 set_bit(lba >> zone_shift, seq_zones_bitmap);
548 next_lba = lba + get_unaligned_be64(&rec[8]); 546 next_lba = lba + get_unaligned_be64(&rec[8]);
549 rec += 64; 547 rec += 64;
550 } 548 }
@@ -553,12 +551,16 @@ static sector_t sd_zbc_get_seq_zones(struct scsi_disk *sdkp, unsigned char *buf,
553} 551}
554 552
555/** 553/**
556 * sd_zbc_setup_seq_zones_bitmap - Initialize the disk seq zone bitmap. 554 * sd_zbc_setup_seq_zones_bitmap - Initialize a seq zone bitmap.
557 * @sdkp: target disk 555 * @sdkp: target disk
556 * @zone_shift: logarithm base 2 of the number of blocks in a zone
557 * @nr_zones: number of zones to set up a seq zone bitmap for
558 * 558 *
559 * Allocate a zone bitmap and initialize it by identifying sequential zones. 559 * Allocate a zone bitmap and initialize it by identifying sequential zones.
560 */ 560 */
561static int sd_zbc_setup_seq_zones_bitmap(struct scsi_disk *sdkp) 561static unsigned long *
562sd_zbc_setup_seq_zones_bitmap(struct scsi_disk *sdkp, u32 zone_shift,
563 u32 nr_zones)
562{ 564{
563 struct request_queue *q = sdkp->disk->queue; 565 struct request_queue *q = sdkp->disk->queue;
564 unsigned long *seq_zones_bitmap; 566 unsigned long *seq_zones_bitmap;
@@ -566,9 +568,9 @@ static int sd_zbc_setup_seq_zones_bitmap(struct scsi_disk *sdkp)
566 unsigned char *buf; 568 unsigned char *buf;
567 int ret = -ENOMEM; 569 int ret = -ENOMEM;
568 570
569 seq_zones_bitmap = sd_zbc_alloc_zone_bitmap(sdkp); 571 seq_zones_bitmap = sd_zbc_alloc_zone_bitmap(nr_zones, q->node);
570 if (!seq_zones_bitmap) 572 if (!seq_zones_bitmap)
571 return -ENOMEM; 573 return ERR_PTR(-ENOMEM);
572 574
573 buf = kmalloc(SD_ZBC_BUF_SIZE, GFP_KERNEL); 575 buf = kmalloc(SD_ZBC_BUF_SIZE, GFP_KERNEL);
574 if (!buf) 576 if (!buf)
@@ -579,7 +581,7 @@ static int sd_zbc_setup_seq_zones_bitmap(struct scsi_disk *sdkp)
579 if (ret) 581 if (ret)
580 goto out; 582 goto out;
581 lba = sd_zbc_get_seq_zones(sdkp, buf, SD_ZBC_BUF_SIZE, 583 lba = sd_zbc_get_seq_zones(sdkp, buf, SD_ZBC_BUF_SIZE,
582 seq_zones_bitmap); 584 zone_shift, seq_zones_bitmap);
583 } 585 }
584 586
585 if (lba != sdkp->capacity) { 587 if (lba != sdkp->capacity) {
@@ -591,12 +593,9 @@ out:
591 kfree(buf); 593 kfree(buf);
592 if (ret) { 594 if (ret) {
593 kfree(seq_zones_bitmap); 595 kfree(seq_zones_bitmap);
594 return ret; 596 return ERR_PTR(ret);
595 } 597 }
596 598 return seq_zones_bitmap;
597 q->seq_zones_bitmap = seq_zones_bitmap;
598
599 return 0;
600} 599}
601 600
602static void sd_zbc_cleanup(struct scsi_disk *sdkp) 601static void sd_zbc_cleanup(struct scsi_disk *sdkp)
@@ -612,44 +611,64 @@ static void sd_zbc_cleanup(struct scsi_disk *sdkp)
612 q->nr_zones = 0; 611 q->nr_zones = 0;
613} 612}
614 613
615static int sd_zbc_setup(struct scsi_disk *sdkp) 614static int sd_zbc_setup(struct scsi_disk *sdkp, u32 zone_blocks)
616{ 615{
617 struct request_queue *q = sdkp->disk->queue; 616 struct request_queue *q = sdkp->disk->queue;
617 u32 zone_shift = ilog2(zone_blocks);
618 u32 nr_zones;
618 int ret; 619 int ret;
619 620
620 /* READ16/WRITE16 is mandatory for ZBC disks */
621 sdkp->device->use_16_for_rw = 1;
622 sdkp->device->use_10_for_rw = 0;
623
624 /* chunk_sectors indicates the zone size */ 621 /* chunk_sectors indicates the zone size */
625 blk_queue_chunk_sectors(sdkp->disk->queue, 622 blk_queue_chunk_sectors(q,
626 logical_to_sectors(sdkp->device, sdkp->zone_blocks)); 623 logical_to_sectors(sdkp->device, zone_blocks));
627 sdkp->nr_zones = 624 nr_zones = round_up(sdkp->capacity, zone_blocks) >> zone_shift;
628 round_up(sdkp->capacity, sdkp->zone_blocks) >> sdkp->zone_shift;
629 625
630 /* 626 /*
631 * Initialize the device request queue information if the number 627 * Initialize the device request queue information if the number
632 * of zones changed. 628 * of zones changed.
633 */ 629 */
634 if (sdkp->nr_zones != q->nr_zones) { 630 if (nr_zones != sdkp->nr_zones || nr_zones != q->nr_zones) {
635 631 unsigned long *seq_zones_wlock = NULL, *seq_zones_bitmap = NULL;
636 sd_zbc_cleanup(sdkp); 632 size_t zone_bitmap_size;
637 633
638 q->nr_zones = sdkp->nr_zones; 634 if (nr_zones) {
639 if (sdkp->nr_zones) { 635 seq_zones_wlock = sd_zbc_alloc_zone_bitmap(nr_zones,
640 q->seq_zones_wlock = sd_zbc_alloc_zone_bitmap(sdkp); 636 q->node);
641 if (!q->seq_zones_wlock) { 637 if (!seq_zones_wlock) {
642 ret = -ENOMEM; 638 ret = -ENOMEM;
643 goto err; 639 goto err;
644 } 640 }
645 641
646 ret = sd_zbc_setup_seq_zones_bitmap(sdkp); 642 seq_zones_bitmap = sd_zbc_setup_seq_zones_bitmap(sdkp,
647 if (ret) { 643 zone_shift, nr_zones);
648 sd_zbc_cleanup(sdkp); 644 if (IS_ERR(seq_zones_bitmap)) {
645 ret = PTR_ERR(seq_zones_bitmap);
646 kfree(seq_zones_wlock);
649 goto err; 647 goto err;
650 } 648 }
651 } 649 }
652 650 zone_bitmap_size = BITS_TO_LONGS(nr_zones) *
651 sizeof(unsigned long);
652 blk_mq_freeze_queue(q);
653 if (q->nr_zones != nr_zones) {
654 /* READ16/WRITE16 is mandatory for ZBC disks */
655 sdkp->device->use_16_for_rw = 1;
656 sdkp->device->use_10_for_rw = 0;
657
658 sdkp->zone_blocks = zone_blocks;
659 sdkp->zone_shift = zone_shift;
660 sdkp->nr_zones = nr_zones;
661 q->nr_zones = nr_zones;
662 swap(q->seq_zones_wlock, seq_zones_wlock);
663 swap(q->seq_zones_bitmap, seq_zones_bitmap);
664 } else if (memcmp(q->seq_zones_bitmap, seq_zones_bitmap,
665 zone_bitmap_size) != 0) {
666 memcpy(q->seq_zones_bitmap, seq_zones_bitmap,
667 zone_bitmap_size);
668 }
669 blk_mq_unfreeze_queue(q);
670 kfree(seq_zones_wlock);
671 kfree(seq_zones_bitmap);
653 } 672 }
654 673
655 return 0; 674 return 0;
@@ -661,6 +680,7 @@ err:
661 680
662int sd_zbc_read_zones(struct scsi_disk *sdkp, unsigned char *buf) 681int sd_zbc_read_zones(struct scsi_disk *sdkp, unsigned char *buf)
663{ 682{
683 int64_t zone_blocks;
664 int ret; 684 int ret;
665 685
666 if (!sd_is_zoned(sdkp)) 686 if (!sd_is_zoned(sdkp))
@@ -697,12 +717,16 @@ int sd_zbc_read_zones(struct scsi_disk *sdkp, unsigned char *buf)
697 * Check zone size: only devices with a constant zone size (except 717 * Check zone size: only devices with a constant zone size (except
698 * an eventual last runt zone) that is a power of 2 are supported. 718 * an eventual last runt zone) that is a power of 2 are supported.
699 */ 719 */
700 ret = sd_zbc_check_zone_size(sdkp); 720 zone_blocks = sd_zbc_check_zone_size(sdkp);
701 if (ret) 721 ret = -EFBIG;
722 if (zone_blocks != (u32)zone_blocks)
723 goto err;
724 ret = zone_blocks;
725 if (ret < 0)
702 goto err; 726 goto err;
703 727
704 /* The drive satisfies the kernel restrictions: set it up */ 728 /* The drive satisfies the kernel restrictions: set it up */
705 ret = sd_zbc_setup(sdkp); 729 ret = sd_zbc_setup(sdkp, zone_blocks);
706 if (ret) 730 if (ret)
707 goto err; 731 goto err;
708 732
diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
index c5b1bf1cadcb..00e79057f870 100644
--- a/drivers/scsi/ufs/ufshcd.c
+++ b/drivers/scsi/ufs/ufshcd.c
@@ -276,6 +276,35 @@ static inline void ufshcd_remove_non_printable(char *val)
276 *val = ' '; 276 *val = ' ';
277} 277}
278 278
279static void ufshcd_add_cmd_upiu_trace(struct ufs_hba *hba, unsigned int tag,
280 const char *str)
281{
282 struct utp_upiu_req *rq = hba->lrb[tag].ucd_req_ptr;
283
284 trace_ufshcd_upiu(dev_name(hba->dev), str, &rq->header, &rq->sc.cdb);
285}
286
287static void ufshcd_add_query_upiu_trace(struct ufs_hba *hba, unsigned int tag,
288 const char *str)
289{
290 struct utp_upiu_req *rq = hba->lrb[tag].ucd_req_ptr;
291
292 trace_ufshcd_upiu(dev_name(hba->dev), str, &rq->header, &rq->qr);
293}
294
295static void ufshcd_add_tm_upiu_trace(struct ufs_hba *hba, unsigned int tag,
296 const char *str)
297{
298 struct utp_task_req_desc *descp;
299 struct utp_upiu_task_req *task_req;
300 int off = (int)tag - hba->nutrs;
301
302 descp = &hba->utmrdl_base_addr[off];
303 task_req = (struct utp_upiu_task_req *)descp->task_req_upiu;
304 trace_ufshcd_upiu(dev_name(hba->dev), str, &task_req->header,
305 &task_req->input_param1);
306}
307
279static void ufshcd_add_command_trace(struct ufs_hba *hba, 308static void ufshcd_add_command_trace(struct ufs_hba *hba,
280 unsigned int tag, const char *str) 309 unsigned int tag, const char *str)
281{ 310{
@@ -285,6 +314,9 @@ static void ufshcd_add_command_trace(struct ufs_hba *hba,
285 struct ufshcd_lrb *lrbp; 314 struct ufshcd_lrb *lrbp;
286 int transfer_len = -1; 315 int transfer_len = -1;
287 316
317 /* trace UPIU also */
318 ufshcd_add_cmd_upiu_trace(hba, tag, str);
319
288 if (!trace_ufshcd_command_enabled()) 320 if (!trace_ufshcd_command_enabled())
289 return; 321 return;
290 322
@@ -2550,6 +2582,7 @@ static int ufshcd_exec_dev_cmd(struct ufs_hba *hba,
2550 2582
2551 hba->dev_cmd.complete = &wait; 2583 hba->dev_cmd.complete = &wait;
2552 2584
2585 ufshcd_add_query_upiu_trace(hba, tag, "query_send");
2553 /* Make sure descriptors are ready before ringing the doorbell */ 2586 /* Make sure descriptors are ready before ringing the doorbell */
2554 wmb(); 2587 wmb();
2555 spin_lock_irqsave(hba->host->host_lock, flags); 2588 spin_lock_irqsave(hba->host->host_lock, flags);
@@ -2559,6 +2592,9 @@ static int ufshcd_exec_dev_cmd(struct ufs_hba *hba,
2559 2592
2560 err = ufshcd_wait_for_dev_cmd(hba, lrbp, timeout); 2593 err = ufshcd_wait_for_dev_cmd(hba, lrbp, timeout);
2561 2594
2595 ufshcd_add_query_upiu_trace(hba, tag,
2596 err ? "query_complete_err" : "query_complete");
2597
2562out_put_tag: 2598out_put_tag:
2563 ufshcd_put_dev_cmd_tag(hba, tag); 2599 ufshcd_put_dev_cmd_tag(hba, tag);
2564 wake_up(&hba->dev_cmd.tag_wq); 2600 wake_up(&hba->dev_cmd.tag_wq);
@@ -5443,11 +5479,14 @@ static int ufshcd_issue_tm_cmd(struct ufs_hba *hba, int lun_id, int task_id,
5443 5479
5444 spin_unlock_irqrestore(host->host_lock, flags); 5480 spin_unlock_irqrestore(host->host_lock, flags);
5445 5481
5482 ufshcd_add_tm_upiu_trace(hba, task_tag, "tm_send");
5483
5446 /* wait until the task management command is completed */ 5484 /* wait until the task management command is completed */
5447 err = wait_event_timeout(hba->tm_wq, 5485 err = wait_event_timeout(hba->tm_wq,
5448 test_bit(free_slot, &hba->tm_condition), 5486 test_bit(free_slot, &hba->tm_condition),
5449 msecs_to_jiffies(TM_CMD_TIMEOUT)); 5487 msecs_to_jiffies(TM_CMD_TIMEOUT));
5450 if (!err) { 5488 if (!err) {
5489 ufshcd_add_tm_upiu_trace(hba, task_tag, "tm_complete_err");
5451 dev_err(hba->dev, "%s: task management cmd 0x%.2x timed-out\n", 5490 dev_err(hba->dev, "%s: task management cmd 0x%.2x timed-out\n",
5452 __func__, tm_function); 5491 __func__, tm_function);
5453 if (ufshcd_clear_tm_cmd(hba, free_slot)) 5492 if (ufshcd_clear_tm_cmd(hba, free_slot))
@@ -5456,6 +5495,7 @@ static int ufshcd_issue_tm_cmd(struct ufs_hba *hba, int lun_id, int task_id,
5456 err = -ETIMEDOUT; 5495 err = -ETIMEDOUT;
5457 } else { 5496 } else {
5458 err = ufshcd_task_req_compl(hba, free_slot, tm_response); 5497 err = ufshcd_task_req_compl(hba, free_slot, tm_response);
5498 ufshcd_add_tm_upiu_trace(hba, task_tag, "tm_complete");
5459 } 5499 }
5460 5500
5461 clear_bit(free_slot, &hba->tm_condition); 5501 clear_bit(free_slot, &hba->tm_condition);
diff --git a/drivers/target/target_core_pscsi.c b/drivers/target/target_core_pscsi.c
index 0d99b242e82e..6cb933ecc084 100644
--- a/drivers/target/target_core_pscsi.c
+++ b/drivers/target/target_core_pscsi.c
@@ -890,6 +890,7 @@ pscsi_map_sg(struct se_cmd *cmd, struct scatterlist *sgl, u32 sgl_nents,
890 bytes = min(bytes, data_len); 890 bytes = min(bytes, data_len);
891 891
892 if (!bio) { 892 if (!bio) {
893new_bio:
893 nr_vecs = min_t(int, BIO_MAX_PAGES, nr_pages); 894 nr_vecs = min_t(int, BIO_MAX_PAGES, nr_pages);
894 nr_pages -= nr_vecs; 895 nr_pages -= nr_vecs;
895 /* 896 /*
@@ -931,6 +932,7 @@ pscsi_map_sg(struct se_cmd *cmd, struct scatterlist *sgl, u32 sgl_nents,
931 * be allocated with pscsi_get_bio() above. 932 * be allocated with pscsi_get_bio() above.
932 */ 933 */
933 bio = NULL; 934 bio = NULL;
935 goto new_bio;
934 } 936 }
935 937
936 data_len -= bytes; 938 data_len -= bytes;
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index c362aadfe036..5c4eee043191 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -605,6 +605,11 @@ struct request_queue {
605 * initialized by the low level device driver (e.g. scsi/sd.c). 605 * initialized by the low level device driver (e.g. scsi/sd.c).
606 * Stacking drivers (device mappers) may or may not initialize 606 * Stacking drivers (device mappers) may or may not initialize
607 * these fields. 607 * these fields.
608 *
609 * Reads of this information must be protected with blk_queue_enter() /
610 * blk_queue_exit(). Modifying this information is only allowed while
611 * no requests are being processed. See also blk_mq_freeze_queue() and
612 * blk_mq_unfreeze_queue().
608 */ 613 */
609 unsigned int nr_zones; 614 unsigned int nr_zones;
610 unsigned long *seq_zones_bitmap; 615 unsigned long *seq_zones_bitmap;
diff --git a/include/scsi/scsi_dbg.h b/include/scsi/scsi_dbg.h
index 04e0679767f6..e03bd9d41fa8 100644
--- a/include/scsi/scsi_dbg.h
+++ b/include/scsi/scsi_dbg.h
@@ -11,8 +11,6 @@ struct scsi_sense_hdr;
11extern void scsi_print_command(struct scsi_cmnd *); 11extern void scsi_print_command(struct scsi_cmnd *);
12extern size_t __scsi_format_command(char *, size_t, 12extern size_t __scsi_format_command(char *, size_t,
13 const unsigned char *, size_t); 13 const unsigned char *, size_t);
14extern void scsi_show_extd_sense(const struct scsi_device *, const char *,
15 unsigned char, unsigned char);
16extern void scsi_print_sense_hdr(const struct scsi_device *, const char *, 14extern void scsi_print_sense_hdr(const struct scsi_device *, const char *,
17 const struct scsi_sense_hdr *); 15 const struct scsi_sense_hdr *);
18extern void scsi_print_sense(const struct scsi_cmnd *); 16extern void scsi_print_sense(const struct scsi_cmnd *);
diff --git a/include/trace/events/ufs.h b/include/trace/events/ufs.h
index bf6f82673492..f8260e5c79ad 100644
--- a/include/trace/events/ufs.h
+++ b/include/trace/events/ufs.h
@@ -257,6 +257,33 @@ TRACE_EVENT(ufshcd_command,
257 ) 257 )
258); 258);
259 259
260TRACE_EVENT(ufshcd_upiu,
261 TP_PROTO(const char *dev_name, const char *str, void *hdr, void *tsf),
262
263 TP_ARGS(dev_name, str, hdr, tsf),
264
265 TP_STRUCT__entry(
266 __string(dev_name, dev_name)
267 __string(str, str)
268 __array(unsigned char, hdr, 12)
269 __array(unsigned char, tsf, 16)
270 ),
271
272 TP_fast_assign(
273 __assign_str(dev_name, dev_name);
274 __assign_str(str, str);
275 memcpy(__entry->hdr, hdr, sizeof(__entry->hdr));
276 memcpy(__entry->tsf, tsf, sizeof(__entry->tsf));
277 ),
278
279 TP_printk(
280 "%s: %s: HDR:%s, CDB:%s",
281 __get_str(str), __get_str(dev_name),
282 __print_hex(__entry->hdr, sizeof(__entry->hdr)),
283 __print_hex(__entry->tsf, sizeof(__entry->tsf))
284 )
285);
286
260#endif /* if !defined(_TRACE_UFS_H) || defined(TRACE_HEADER_MULTI_READ) */ 287#endif /* if !defined(_TRACE_UFS_H) || defined(TRACE_HEADER_MULTI_READ) */
261 288
262/* This part must be outside protection */ 289/* This part must be outside protection */