[PATCH] scsi_prep_fn() check for empty queue
This fix: end_request: I/O error, dev sdc, sector 976576 rport-0:0-3: blocked FC remote port time out: removing target and saving binding BUG: unable to handle kernel NULL pointer dereference at 0400 IP: [812f0cc2] scsi_prep_state_check+0xe/0x99 [812f1f9d] scsi_setup_blk_pc_cmnd+0x1b/0x115 [812f20c0] scsi_prep_fn+0x29/0x3b [8121cfb9] blk_peek_request+0xe1/0x1b3 [812f1400] scsi_request_fn+0x3a/0x4d2 [8121d916] __generic_unplug_device+0x32/0x36 [81220f4b] blk_execute_rq_nowait+0x77/0x9e [81221018] blk_execute_rq+0xa6/0xde [8144f24b] ? printk+0x41/0x46 [a00a21c5] ? get_rdac_req+0x81/0xe8 [scsi_dh_rdac] [a00a273a] send_mode_select+0x29f/0x489 [scsi_dh_rdac] [810c5d9b] ? probe_workqueue_execution+0xb1/0xce [81071e38] worker_thread+0x1a9/0x237 [a00a249b] ? send_mode_select+0x0/0x489 [scsi_dh_rdac] [8107651b] ? autoremove_wake_function+0x0/0x39 [81071c8f] ? worker_thread+0x0/0x237 [81076222] kthread+0x7f/0x87 [81012d2a] child_rip+0xa/0x20 [810761a3] ? kthread+0x0/0x87 [81012d20] ? child_rip+0x0/0x20 Signed-off-by: Maxim Uvarov maxim.uva...@oracle.com --- drivers/scsi/scsi_lib.c |3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c index 86d5220..8e89ed9 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c @@ -1295,6 +1295,9 @@ int scsi_prep_fn(struct request_queue *q, struct request *req) struct scsi_device *sdev = q-queuedata; int ret = BLKPREP_KILL; + if (!sdev) + return ret; + if (req-cmd_type == REQ_TYPE_BLOCK_PC) ret = scsi_setup_blk_pc_cmnd(sdev, req); return scsi_prep_return(q, req, ret); -- 1.7.9.5 -- To unsubscribe from this list: send the line unsubscribe linux-scsi in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] scsi_prep_fn() check for empty queue
On 06/26/13 11:02, Maxim Uvarov wrote: This fix: end_request: I/O error, dev sdc, sector 976576 rport-0:0-3: blocked FC remote port time out: removing target and saving binding BUG: unable to handle kernel NULL pointer dereference at 0400 IP: [812f0cc2] scsi_prep_state_check+0xe/0x99 [812f1f9d] scsi_setup_blk_pc_cmnd+0x1b/0x115 [812f20c0] scsi_prep_fn+0x29/0x3b [8121cfb9] blk_peek_request+0xe1/0x1b3 [812f1400] scsi_request_fn+0x3a/0x4d2 [8121d916] __generic_unplug_device+0x32/0x36 [81220f4b] blk_execute_rq_nowait+0x77/0x9e [81221018] blk_execute_rq+0xa6/0xde [8144f24b] ? printk+0x41/0x46 [a00a21c5] ? get_rdac_req+0x81/0xe8 [scsi_dh_rdac] [a00a273a] send_mode_select+0x29f/0x489 [scsi_dh_rdac] [810c5d9b] ? probe_workqueue_execution+0xb1/0xce [81071e38] worker_thread+0x1a9/0x237 [a00a249b] ? send_mode_select+0x0/0x489 [scsi_dh_rdac] [8107651b] ? autoremove_wake_function+0x0/0x39 [81071c8f] ? worker_thread+0x0/0x237 [81076222] kthread+0x7f/0x87 [81012d2a] child_rip+0xa/0x20 [810761a3] ? kthread+0x0/0x87 [81012d20] ? child_rip+0x0/0x20 Signed-off-by: Maxim Uvarov maxim.uva...@oracle.com --- drivers/scsi/scsi_lib.c |3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c index 86d5220..8e89ed9 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c @@ -1295,6 +1295,9 @@ int scsi_prep_fn(struct request_queue *q, struct request *req) struct scsi_device *sdev = q-queuedata; int ret = BLKPREP_KILL; + if (!sdev) + return ret; + if (req-cmd_type == REQ_TYPE_BLOCK_PC) ret = scsi_setup_blk_pc_cmnd(sdev, req); return scsi_prep_return(q, req, ret); Sorry but this patch does not look like a proper fix to me. What you probably need is a scsi_device_get() call in scsi_dh_rdac.c somewhere before the queue_work(kmpath_rdacd, ctlr-ms_work) call and a scsi_device_put() call once send_mode_select() has finished using the sdev. Bart. -- To unsubscribe from this list: send the line unsubscribe linux-scsi in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 8/9] scsi/pm8001: use pdev-pm_cap instead of pci_find_capability(..,PCI_CAP_ID_PM)
On 06/18/2013 10:23 AM, Yijing Wang wrote: Pci core has been saved pm cap register offset by pdev-pm_cap in pci_pm_init() in init path. So we can use pdev-pm_cap instead of using pci_find_capability(pdev, PCI_CAP_ID_PM) for better performance and simplified code. I think Lindar already replied to you, and tested it on hardware. So you can add her: Acked-by or Tested-by Regards, Jack Signed-off-by: Yijing Wang wangyij...@huawei.com Cc: xjtu...@gmail.com Cc: lindar_...@usish.com Cc: James E.J. Bottomley jbottom...@parallels.com Cc: linux-scsi@vger.kernel.org Cc: linux-ker...@vger.kernel.org --- drivers/scsi/pm8001/pm8001_init.c |7 +++ 1 files changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/scsi/pm8001/pm8001_init.c b/drivers/scsi/pm8001/pm8001_init.c index e4b9bc7..3861aa1 100644 --- a/drivers/scsi/pm8001/pm8001_init.c +++ b/drivers/scsi/pm8001/pm8001_init.c @@ -912,14 +912,13 @@ static int pm8001_pci_suspend(struct pci_dev *pdev, pm_message_t state) { struct sas_ha_struct *sha = pci_get_drvdata(pdev); struct pm8001_hba_info *pm8001_ha; - int i , pos; + int i; u32 device_state; pm8001_ha = sha-lldd_ha; flush_workqueue(pm8001_wq); scsi_block_requests(pm8001_ha-shost); - pos = pci_find_capability(pdev, PCI_CAP_ID_PM); - if (pos == 0) { - printk(KERN_ERR PCI PM not supported\n); + if (!pdev-pm_cap) { + dev_err(pdev-dev, PCI PM not supported\n); return -ENODEV; } PM8001_CHIP_DISP-interrupt_disable(pm8001_ha, 0xFF); -- To unsubscribe from this list: send the line unsubscribe linux-scsi in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 8/9] scsi/pm8001: use pdev-pm_cap instead of pci_find_capability(..,PCI_CAP_ID_PM)
On 2013/6/26 17:33, Jack Wang wrote: On 06/18/2013 10:23 AM, Yijing Wang wrote: Pci core has been saved pm cap register offset by pdev-pm_cap in pci_pm_init() in init path. So we can use pdev-pm_cap instead of using pci_find_capability(pdev, PCI_CAP_ID_PM) for better performance and simplified code. I think Lindar already replied to you, and tested it on hardware. I didn't receive the reply, I will check my email client, maybe I lose some emails. Jack, Lindar thank you very much. So you can add her: Acked-by or Tested-by ok, I will add them. Regards, Jack Signed-off-by: Yijing Wang wangyij...@huawei.com Cc: xjtu...@gmail.com Cc: lindar_...@usish.com Cc: James E.J. Bottomley jbottom...@parallels.com Cc: linux-scsi@vger.kernel.org Cc: linux-ker...@vger.kernel.org --- drivers/scsi/pm8001/pm8001_init.c |7 +++ 1 files changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/scsi/pm8001/pm8001_init.c b/drivers/scsi/pm8001/pm8001_init.c index e4b9bc7..3861aa1 100644 --- a/drivers/scsi/pm8001/pm8001_init.c +++ b/drivers/scsi/pm8001/pm8001_init.c @@ -912,14 +912,13 @@ static int pm8001_pci_suspend(struct pci_dev *pdev, pm_message_t state) { struct sas_ha_struct *sha = pci_get_drvdata(pdev); struct pm8001_hba_info *pm8001_ha; -int i , pos; +int i; u32 device_state; pm8001_ha = sha-lldd_ha; flush_workqueue(pm8001_wq); scsi_block_requests(pm8001_ha-shost); -pos = pci_find_capability(pdev, PCI_CAP_ID_PM); -if (pos == 0) { -printk(KERN_ERR PCI PM not supported\n); +if (!pdev-pm_cap) { +dev_err(pdev-dev, PCI PM not supported\n); return -ENODEV; } PM8001_CHIP_DISP-interrupt_disable(pm8001_ha, 0xFF); . -- Thanks! Yijing -- To unsubscribe from this list: send the line unsubscribe linux-scsi in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH V1 2/4] libiscsi: Exporting new attrs for iscsi session and connection in sysfs
From: Adheer Chandravanshi adheer.chandravan...@qlogic.com Signed-off-by: Adheer Chandravanshi adheer.chandravan...@qlogic.com Signed-off-by: Vikas Chaudhary vikas.chaudh...@qlogic.com --- drivers/scsi/libiscsi.c | 98 + include/scsi/libiscsi.h | 32 2 files changed, 130 insertions(+) diff --git a/drivers/scsi/libiscsi.c b/drivers/scsi/libiscsi.c index 5de9469..12aca69 100644 --- a/drivers/scsi/libiscsi.c +++ b/drivers/scsi/libiscsi.c @@ -2809,6 +2809,8 @@ void iscsi_session_teardown(struct iscsi_cls_session *cls_session) kfree(session-targetalias); kfree(session-initiatorname); kfree(session-ifacename); + kfree(session-portal_type); + kfree(session-discovery_parent_type); iscsi_destroy_session(cls_session); iscsi_host_dec_session_cnt(shost); @@ -3248,6 +3250,11 @@ int iscsi_set_param(struct iscsi_cls_conn *cls_conn, return iscsi_switch_str_param(session-ifacename, buf); case ISCSI_PARAM_INITIATOR_NAME: return iscsi_switch_str_param(session-initiatorname, buf); + case ISCSI_PARAM_PORTAL_TYPE: + return iscsi_switch_str_param(session-portal_type, buf); + case ISCSI_PARAM_DISCOVERY_PARENT_TYPE: + return iscsi_switch_str_param(session-discovery_parent_type, + buf); default: return -ENOSYS; } @@ -3326,6 +,52 @@ int iscsi_session_get_param(struct iscsi_cls_session *cls_session, case ISCSI_PARAM_INITIATOR_NAME: len = sprintf(buf, %s\n, session-initiatorname); break; + case ISCSI_PARAM_AUTO_SND_TGT_DISABLE: + len = sprintf(buf, %u\n, session-auto_snd_tgt_disable); + break; + case ISCSI_PARAM_DISCOVERY_SESS: + len = sprintf(buf, %u\n, session-discovery_sess); + break; + case ISCSI_PARAM_PORTAL_TYPE: + len = sprintf(buf, %s\n, session-portal_type); + break; + case ISCSI_PARAM_CHAP_AUTH_EN: + len = sprintf(buf, %u\n, session-chap_auth_en); + break; + case ISCSI_PARAM_DISCOVERY_LOGOUT_EN: + len = sprintf(buf, %u\n, session-discovery_logout_en); + break; + case ISCSI_PARAM_BIDI_CHAP_EN: + len = sprintf(buf, %u\n, session-bidi_chap_en); + break; + case ISCSI_PARAM_DISCOVERY_AUTH_OPTIONAL: + len = sprintf(buf, %u\n, session-discovery_auth_optional); + break; + case ISCSI_PARAM_DEF_TIME2WAIT: + len = sprintf(buf, %d\n, session-time2wait); + break; + case ISCSI_PARAM_DEF_TIME2RETAIN: + len = sprintf(buf, %d\n, session-time2retain); + break; + case ISCSI_PARAM_TSID: + len = sprintf(buf, %u\n, session-tsid); + break; + case ISCSI_PARAM_ISID: + len = sprintf(buf, %02x%02x%02x%02x%02x%02x\n, + session-isid[0], session-isid[1], + session-isid[2], session-isid[3], + session-isid[4], session-isid[5]); + break; + case ISCSI_PARAM_DISCOVERY_PARENT_IDX: + len = sprintf(buf, %u\n, session-discovery_parent_idx); + break; + case ISCSI_PARAM_DISCOVERY_PARENT_TYPE: + if (session-discovery_parent_type) + len = sprintf(buf, %s\n, + session-discovery_parent_type); + else + len = sprintf(buf, \n); + break; default: return -ENOSYS; } @@ -3415,6 +3468,51 @@ int iscsi_conn_get_param(struct iscsi_cls_conn *cls_conn, case ISCSI_PARAM_PERSISTENT_ADDRESS: len = sprintf(buf, %s\n, conn-persistent_address); break; + case ISCSI_PARAM_STATSN: + len = sprintf(buf, %u\n, conn-statsn); + break; + case ISCSI_PARAM_MAX_SEGMENT_SIZE: + len = sprintf(buf, %u\n, conn-max_segment_size); + break; + case ISCSI_PARAM_KEEPALIVE_TMO: + len = sprintf(buf, %u\n, conn-keepalive_tmo); + break; + case ISCSI_PARAM_LOCAL_PORT: + len = sprintf(buf, %u\n, conn-local_port); + break; + case ISCSI_PARAM_TCP_TIMESTAMP_STAT: + len = sprintf(buf, %u\n, conn-tcp_timestamp_stat); + break; + case ISCSI_PARAM_TCP_NAGLE_DISABLE: + len = sprintf(buf, %u\n, conn-tcp_nagle_disable); + break; + case ISCSI_PARAM_TCP_WSF_DISABLE: + len = sprintf(buf, %u\n, conn-tcp_wsf_disable); + break; + case ISCSI_PARAM_TCP_TIMER_SCALE: + len =
[PATCH V1 3/4] qla4xxx: Exporting new attrs for iscsi session and connection in sysfs
From: Adheer Chandravanshi adheer.chandravan...@qlogic.com Signed-off-by: Adheer Chandravanshi adheer.chandravan...@qlogic.com Signed-off-by: Vikas Chaudhary vikas.chaudh...@qlogic.com --- drivers/scsi/qla4xxx/ql4_os.c | 203 ++ 1 file changed, 146 insertions(+), 57 deletions(-) diff --git a/drivers/scsi/qla4xxx/ql4_os.c b/drivers/scsi/qla4xxx/ql4_os.c index 4d231c1..84d9361 100644 --- a/drivers/scsi/qla4xxx/ql4_os.c +++ b/drivers/scsi/qla4xxx/ql4_os.c @@ -378,6 +378,44 @@ static umode_t qla4_attr_is_visible(int param_type, int param) case ISCSI_PARAM_PASSWORD: case ISCSI_PARAM_USERNAME_IN: case ISCSI_PARAM_PASSWORD_IN: + case ISCSI_PARAM_AUTO_SND_TGT_DISABLE: + case ISCSI_PARAM_DISCOVERY_SESS: + case ISCSI_PARAM_PORTAL_TYPE: + case ISCSI_PARAM_CHAP_AUTH_EN: + case ISCSI_PARAM_DISCOVERY_LOGOUT_EN: + case ISCSI_PARAM_BIDI_CHAP_EN: + case ISCSI_PARAM_DISCOVERY_AUTH_OPTIONAL: + case ISCSI_PARAM_DEF_TIME2WAIT: + case ISCSI_PARAM_DEF_TIME2RETAIN: + case ISCSI_PARAM_HDRDGST_EN: + case ISCSI_PARAM_DATADGST_EN: + case ISCSI_PARAM_INITIAL_R2T_EN: + case ISCSI_PARAM_IMM_DATA_EN: + case ISCSI_PARAM_PDU_INORDER_EN: + case ISCSI_PARAM_DATASEQ_INORDER_EN: + case ISCSI_PARAM_MAX_SEGMENT_SIZE: + case ISCSI_PARAM_TCP_TIMESTAMP_STAT: + case ISCSI_PARAM_TCP_WSF_DISABLE: + case ISCSI_PARAM_TCP_NAGLE_DISABLE: + case ISCSI_PARAM_TCP_TIMER_SCALE: + case ISCSI_PARAM_TCP_TIMESTAMP_EN: + case ISCSI_PARAM_TCP_XMIT_WSF: + case ISCSI_PARAM_TCP_RECV_WSF: + case ISCSI_PARAM_IP_FRAGMENT_DISABLE: + case ISCSI_PARAM_IPV4_TOS: + case ISCSI_PARAM_IPV6_TC: + case ISCSI_PARAM_IPV6_FLOW_LABEL: + case ISCSI_PARAM_IS_FW_ASSIGNED_IPV6: + case ISCSI_PARAM_KEEPALIVE_TMO: + case ISCSI_PARAM_LOCAL_PORT: + case ISCSI_PARAM_ISID: + case ISCSI_PARAM_TSID: + case ISCSI_PARAM_DEF_TASKMGMT_TMO: + case ISCSI_PARAM_ERL: + case ISCSI_PARAM_STATSN: + case ISCSI_PARAM_EXP_STATSN: + case ISCSI_PARAM_DISCOVERY_PARENT_IDX: + case ISCSI_PARAM_DISCOVERY_PARENT_TYPE: return S_IRUGO; default: return 0; @@ -2257,6 +2295,101 @@ static int qla4xxx_copy_to_fwddb_param(struct iscsi_bus_flash_session *sess, return rc; } +static void qla4xxx_copy_to_sess_conn_params(struct iscsi_conn *conn, +struct iscsi_session *sess, +struct dev_db_entry *fw_ddb_entry) +{ + unsigned long options = 0; + uint16_t ddb_link; + uint16_t disc_parent; + + options = le16_to_cpu(fw_ddb_entry-options); + conn-is_fw_assigned_ipv6 = test_bit(OPT_IS_FW_ASSIGNED_IPV6, options); + sess-auto_snd_tgt_disable = test_bit(OPT_AUTO_SENDTGTS_DISABLE, + options); + sess-discovery_sess = test_bit(OPT_DISC_SESSION, options); + + options = le16_to_cpu(fw_ddb_entry-iscsi_options); + conn-hdrdgst_en = test_bit(ISCSIOPT_HEADER_DIGEST_EN, options); + conn-datadgst_en = test_bit(ISCSIOPT_DATA_DIGEST_EN, options); + sess-imm_data_en = test_bit(ISCSIOPT_IMMEDIATE_DATA_EN, options); + sess-initial_r2t_en = test_bit(ISCSIOPT_INITIAL_R2T_EN, options); + sess-dataseq_inorder_en = test_bit(ISCSIOPT_DATA_SEQ_IN_ORDER, + options); + sess-pdu_inorder_en = test_bit(ISCSIOPT_DATA_PDU_IN_ORDER, options); + sess-chap_auth_en = test_bit(ISCSIOPT_CHAP_AUTH_EN, options); + sess-discovery_logout_en = test_bit(ISCSIOPT_DISCOVERY_LOGOUT_EN, +options); + sess-bidi_chap_en = test_bit(ISCSIOPT_BIDI_CHAP_EN, options); + sess-discovery_auth_optional = + test_bit(ISCSIOPT_DISCOVERY_AUTH_OPTIONAL, options); + if (test_bit(ISCSIOPT_ERL1, options)) + sess-erl |= BIT_1; + if (test_bit(ISCSIOPT_ERL0, options)) + sess-erl |= BIT_0; + + options = le16_to_cpu(fw_ddb_entry-tcp_options); + conn-tcp_timestamp_stat = test_bit(TCPOPT_TIMESTAMP_STAT, options); + conn-tcp_nagle_disable = test_bit(TCPOPT_NAGLE_DISABLE, options); + conn-tcp_wsf_disable = test_bit(TCPOPT_WSF_DISABLE, options); + if (test_bit(TCPOPT_TIMER_SCALE3, options)) + conn-tcp_timer_scale |= BIT_3; + if (test_bit(TCPOPT_TIMER_SCALE2, options)) +
Re: [PATCH 0/8] qla4xxx: Updates for scsi misc branch
-Original Message- From: Vikas vikas.chaudh...@qlogic.com Date: Thursday 9 May 2013 3:32 PM To: jbottom...@parallels.com jbottom...@parallels.com, Mike Christie micha...@cs.wisc.edu Cc: scsi linux-scsi@vger.kernel.org, Admin vikas.chaudh...@qlogic.com, Lalit Chandivade lalit.chandiv...@qlogic.com, Ravi Anand ravi.an...@qlogic.com Subject: [PATCH 0/8] qla4xxx: Updates for scsi misc branch From: Vikas Chaudhary vikas.chaudh...@qlogic.com James, Following patches are to display additional iSCSI connection and session parameters to sysfs as well allow setting and display of additional Network parameter for iSCSI interface. Please apply these patches to the scsi tree misc branch at your earliest convenience. Adheer Chandravanshi (3): scsi_transport_iscsi: Exporting new attrs for iscsi session and connection in sysfs libiscsi: Exporting new attrs for iscsi session and connection in sysfs qla4xxx: Exporting new attrs for iscsi session and connection in sysfs Harish Zunjarrao (3): iscsi_transport: Remove net param enum numbers iscsi_transport: Additional parameters for net settings qla4xxx: Additional parameters for net settings Manish Rangankar (1): qla4xxx: Add support to allow flashnode multi-session login. Vikas Chaudhary (1): qla4xxx: Update driver version to 5.03.00-k10 We are holding on Network parameter configuration patches for now and have resubmitted session and connection additional parameters patches to the list in this patch set :- http://marc.info/?l=linux-scsim=137225028529586w=2 attachment: winmail.dat
RE: [PATCH V3 0/5] Drivers: scsi: storvsc
-Original Message- From: KY Srinivasan Sent: Monday, June 17, 2013 9:32 AM To: gre...@linuxfoundation.org; linux-ker...@vger.kernel.org; de...@linuxdriverproject.org; oher...@suse.com; jbottom...@parallels.com; h...@infradead.org; linux-scsi@vger.kernel.org Subject: RE: [PATCH V3 0/5] Drivers: scsi: storvsc -Original Message- From: KY Srinivasan Sent: Tuesday, June 11, 2013 9:02 AM To: KY Srinivasan; gre...@linuxfoundation.org; linux-ker...@vger.kernel.org; de...@linuxdriverproject.org; oher...@suse.com; jbottom...@parallels.com; h...@infradead.org; linux-scsi@vger.kernel.org Subject: RE: [PATCH V3 0/5] Drivers: scsi: storvsc -Original Message- From: K. Y. Srinivasan [mailto:k...@microsoft.com] Sent: Tuesday, June 04, 2013 3:05 PM To: gre...@linuxfoundation.org; linux-ker...@vger.kernel.org; de...@linuxdriverproject.org; oher...@suse.com; jbottom...@parallels.com; h...@infradead.org; linux-scsi@vger.kernel.org Cc: KY Srinivasan Subject: [PATCH V3 0/5] Drivers: scsi: storvsc This set adds multi-channel support as well synthetic Fibre Channel support to storvsc. The multi-channel support depends on infrastructure in the VMBUS driver. Greg has already checked in the relevant patches to VMBUS. I had posted an earlier version of this patch-set that included the VMBUS related changes. I have since separated the VMBUS chages and these have already been checked in. In this version, based on comments from James, the timeout is no longer a module parameter. James, I think I have addressed all the comments that you had; if not, please let me know. Ping. James, Let me know if I should re-send the patches. Thanks, K. Y -- To unsubscribe from this list: send the line unsubscribe linux-scsi in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 1/1] bfa: Fixes for 0-terminated strncpy and possible null pointer dereference
On Wed, 2013-05-15 at 21:41 +0200, Jakob Normark wrote: This patch fixes two cppcheck errors in drivers/scsi/bfa/bfad_im.c Signed-off-by: Jakob Normark jakobnorm...@gmail.com --- drivers/scsi/bfa/bfad_im.c |9 ++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/scsi/bfa/bfad_im.c b/drivers/scsi/bfa/bfad_im.c index 5864f98..9489c56 100644 --- a/drivers/scsi/bfa/bfad_im.c +++ b/drivers/scsi/bfa/bfad_im.c @@ -944,13 +944,15 @@ static int bfad_im_slave_alloc(struct scsi_device *sdev) { struct fc_rport *rport = starget_to_rport(scsi_target(sdev)); - struct bfad_itnim_data_s *itnim_data = - (struct bfad_itnim_data_s *) rport-dd_data; - struct bfa_s *bfa = itnim_data-itnim-bfa_itnim-bfa; + struct bfad_itnim_data_s *itnim_data; + struct bfa_s *bfa; if (!rport || fc_remote_port_chkready(rport)) return -ENXIO; + itnim_data = (struct bfad_itnim_data_s *) rport-dd_data; + bfa = itnim_data-itnim-bfa_itnim-bfa; + if (bfa_get_lun_mask_status(bfa) == BFA_LUNMASK_ENABLED) { /* * We should not mask LUN 0 - since this will translate @@ -1037,6 +1039,7 @@ bfad_fc_host_init(struct bfad_im_port_s *im_port) strncpy(symname, bfad-bfa_fcs.fabric.bport.port_cfg.sym_name.symname, BFA_SYMNAME_MAXLEN); + symname[BFA_SYMNAME_MAXLEN - 1] = '\0'; This isn't correct, it's effectively a handrolled version of strlcpy. The correct fix is to replace strncpy with strlcpy. I fixed it up in the patch version. James -- To unsubscribe from this list: send the line unsubscribe linux-scsi in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 0/4] qla4xxx: Updates for scsi misc branch
On 06/26/2013 07:11 AM, vikas.chaudh...@qlogic.com wrote: From: Vikas Chaudhary vikas.chaudh...@qlogic.com James, Following patches are to display additional iSCSI connection and session parameters in sysfs. Please apply these patches to the scsi tree misc branch at your earliest convenience. Adheer Chandravanshi (3): scsi_transport_iscsi: Exporting new attrs for iscsi session and connection in sysfs libiscsi: Exporting new attrs for iscsi session and connection in sysfs qla4xxx: Exporting new attrs for iscsi session and connection in sysfs Vikas Chaudhary (1): qla4xxx: Update driver version to 5.03.00-k10 Looks ok. Reviewed-by: Mike Christie micha...@cs.wisc.edu -- To unsubscribe from this list: send the line unsubscribe linux-scsi in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] cxgb4i: add support for t5 adapter
On 05/29/2013 07:13 PM, k...@chelsio.com wrote: [PATCH] cxgb4i: add support for T5 adapter From: Karen Xie k...@chelsio.com Adds support for Chelsio T5 adapter. Signed-off-by: Karen Xie k...@chelsio.com Sorry for the late reply on this. I thought it got merged already. Patch looks ok. Reviewed-by: Mike Christie micha...@cs.wisc.edu -- To unsubscribe from this list: send the line unsubscribe linux-scsi in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 05/10] scsi: ufs: Fix the response UPIU length setting
From: Sujit Reddy Thumma sthu...@codeaurora.org The response UPIU length should be in DWORD and not in bytes. Signed-off-by: Maya Erez me...@codeaurora.org Signed-off-by: Sujit Reddy Thumma sthu...@codeaurora.org Signed-off-by: Santosh Y santos...@gmail.com diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c index 48a7645..2230f14 100644 --- a/drivers/scsi/ufs/ufshcd.c +++ b/drivers/scsi/ufs/ufshcd.c @@ -802,7 +802,7 @@ static void ufshcd_host_memory_configure(struct ufs_hba *hba) utrdlp[i].prd_table_offset = cpu_to_le16((prdt_offset 2)); utrdlp[i].response_upiu_length = - cpu_to_le16(ALIGNED_UPIU_SIZE); + cpu_to_le16(ALIGNED_UPIU_SIZE 2); hba-lrb[i].utr_descriptor_ptr = (utrdlp + i); hba-lrb[i].ucd_cmd_ptr = -- 1.8.3.1 -- To unsubscribe from this list: send the line unsubscribe linux-scsi in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 02/10] scsi: ufs: amend interrupt configuration
From: Seungwon Jeon tgih@samsung.com It makes interrupt setting more flexible especially for disabling. And wrong bit mask is fixed for ver 1.0. [17:16] is added for mask. Signed-off-by: Seungwon Jeon tgih@samsung.com Tested-by: Maya Erez me...@codeaurora.org Signed-off-by: Santosh Y santos...@gmail.com diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c index 871c2f0..1f1e085 100644 --- a/drivers/scsi/ufs/ufshcd.c +++ b/drivers/scsi/ufs/ufshcd.c @@ -35,6 +35,10 @@ #include ufshcd.h +#define UFSHCD_ENABLE_INTRS(UTP_TRANSFER_REQ_COMPL |\ +UTP_TASK_REQ_COMPL |\ +UFSHCD_ERROR_MASK) + enum { UFSHCD_MAX_CHANNEL = 0, UFSHCD_MAX_ID = 1, @@ -64,6 +68,20 @@ enum { }; /** + * ufshcd_get_intr_mask - Get the interrupt bit mask + * @hba - Pointer to adapter instance + * + * Returns interrupt bit mask per version + */ +static inline u32 ufshcd_get_intr_mask(struct ufs_hba *hba) +{ + if (hba-ufs_version == UFSHCI_VERSION_10) + return INTERRUPT_MASK_ALL_VER_10; + else + return INTERRUPT_MASK_ALL_VER_11; +} + +/** * ufshcd_get_ufs_version - Get the UFS version supported by the HBA * @hba - Pointer to adapter instance * @@ -389,25 +407,45 @@ static int ufshcd_map_sg(struct ufshcd_lrb *lrbp) } /** - * ufshcd_int_config - enable/disable interrupts + * ufshcd_enable_intr - enable interrupts * @hba: per adapter instance - * @option: interrupt option + * @intrs: interrupt bits */ -static void ufshcd_int_config(struct ufs_hba *hba, u32 option) +static void ufshcd_enable_intr(struct ufs_hba *hba, u32 intrs) { - switch (option) { - case UFSHCD_INT_ENABLE: - ufshcd_writel(hba, hba-int_enable_mask, REG_INTERRUPT_ENABLE); - break; - case UFSHCD_INT_DISABLE: - if (hba-ufs_version == UFSHCI_VERSION_10) - ufshcd_writel(hba, INTERRUPT_DISABLE_MASK_10, - REG_INTERRUPT_ENABLE); - else - ufshcd_writel(hba, INTERRUPT_DISABLE_MASK_11, - REG_INTERRUPT_ENABLE); - break; + u32 set = ufshcd_readl(hba, REG_INTERRUPT_ENABLE); + + if (hba-ufs_version == UFSHCI_VERSION_10) { + u32 rw; + rw = set INTERRUPT_MASK_RW_VER_10; + set = rw | ((set ^ intrs) intrs); + } else { + set |= intrs; + } + + ufshcd_writel(hba, set, REG_INTERRUPT_ENABLE); +} + +/** + * ufshcd_disable_intr - disable interrupts + * @hba: per adapter instance + * @intrs: interrupt bits + */ +static void ufshcd_disable_intr(struct ufs_hba *hba, u32 intrs) +{ + u32 set = ufshcd_readl(hba, REG_INTERRUPT_ENABLE); + + if (hba-ufs_version == UFSHCI_VERSION_10) { + u32 rw; + rw = (set INTERRUPT_MASK_RW_VER_10) + ~(intrs INTERRUPT_MASK_RW_VER_10); + set = rw | ((set intrs) ~INTERRUPT_MASK_RW_VER_10); + + } else { + set = ~intrs; } + + ufshcd_writel(hba, set, REG_INTERRUPT_ENABLE); } /** @@ -709,8 +747,7 @@ static int ufshcd_dme_link_startup(struct ufs_hba *hba) uic_cmd-argument3 = 0; /* enable UIC related interrupts */ - hba-int_enable_mask |= UIC_COMMAND_COMPL; - ufshcd_int_config(hba, UFSHCD_INT_ENABLE); + ufshcd_enable_intr(hba, UIC_COMMAND_COMPL); /* sending UIC commands to controller */ ufshcd_send_uic_command(hba, uic_cmd); @@ -757,13 +794,7 @@ static int ufshcd_make_hba_operational(struct ufs_hba *hba) } /* Enable required interrupts */ - hba-int_enable_mask |= (UTP_TRANSFER_REQ_COMPL | -UIC_ERROR | -UTP_TASK_REQ_COMPL | -DEVICE_FATAL_ERROR | -CONTROLLER_FATAL_ERROR | -SYSTEM_BUS_FATAL_ERROR); - ufshcd_int_config(hba, UFSHCD_INT_ENABLE); + ufshcd_enable_intr(hba, UFSHCD_ENABLE_INTRS); /* Configure interrupt aggregation */ ufshcd_config_int_aggr(hba, INT_AGGR_CONFIG); @@ -1570,7 +1601,7 @@ static void ufshcd_hba_free(struct ufs_hba *hba) void ufshcd_remove(struct ufs_hba *hba) { /* disable interrupts */ - ufshcd_int_config(hba, UFSHCD_INT_DISABLE); + ufshcd_disable_intr(hba, hba-intr_mask); ufshcd_hba_stop(hba); ufshcd_hba_free(hba); @@ -1628,6 +1659,9 @@ int ufshcd_init(struct device *dev, struct ufs_hba **hba_handle, /* Get UFS version supported by the controller */ hba-ufs_version = ufshcd_get_ufs_version(hba); + /* Get Interrupt bit mask per version */ + hba-intr_mask = ufshcd_get_intr_mask(hba); + /* Allocate memory for host memory space */ err =
[PATCH 04/10] scsi: ufs: rework link start-up process
From: Seungwon Jeon tgih@samsung.com Link start-up requires long time with multiphase handshakes between UFS host and device. This affects driver's probe time. This patch let link start-up run asynchronously. Link start-up will be executed at the end of prove separately. Along with this change, the following is worked. Defined completion time of uic command to avoid a permanent wait. Added mutex to guarantee of uic command at a time. Adapted some sequence of controller initialization after link statup according to HCI standard. Signed-off-by: Seungwon Jeon tgih@samsung.com Signed-off-by: Sujit Reddy Thumma sthu...@codeaurora.org Tested-by: Maya Erez me...@codeaurora.org Signed-off-by: Santosh Y santos...@gmail.com diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c index 2e02483..48a7645 100644 --- a/drivers/scsi/ufs/ufshcd.c +++ b/drivers/scsi/ufs/ufshcd.c @@ -33,11 +33,15 @@ * this program. */ +#include linux/async.h + #include ufshcd.h #define UFSHCD_ENABLE_INTRS(UTP_TRANSFER_REQ_COMPL |\ UTP_TASK_REQ_COMPL |\ UFSHCD_ERROR_MASK) +/* UIC command timeout, unit: ms */ +#define UIC_CMD_TIMEOUT500 enum { UFSHCD_MAX_CHANNEL = 0, @@ -349,24 +353,122 @@ static inline void ufshcd_hba_capabilities(struct ufs_hba *hba) } /** - * ufshcd_send_uic_command - Send UIC commands to unipro layers + * ufshcd_ready_for_uic_cmd - Check if controller is ready + *to accept UIC commands * @hba: per adapter instance - * @uic_command: UIC command + * Return true on success, else false + */ +static inline bool ufshcd_ready_for_uic_cmd(struct ufs_hba *hba) +{ + if (ufshcd_readl(hba, REG_CONTROLLER_STATUS) UIC_COMMAND_READY) + return true; + else + return false; +} + +/** + * ufshcd_dispatch_uic_cmd - Dispatch UIC commands to unipro layers + * @hba: per adapter instance + * @uic_cmd: UIC command + * + * Mutex must be held. */ static inline void -ufshcd_send_uic_command(struct ufs_hba *hba, struct uic_command *uic_cmnd) +ufshcd_dispatch_uic_cmd(struct ufs_hba *hba, struct uic_command *uic_cmd) { + WARN_ON(hba-active_uic_cmd); + + hba-active_uic_cmd = uic_cmd; + /* Write Args */ - ufshcd_writel(hba, uic_cmnd-argument1, REG_UIC_COMMAND_ARG_1); - ufshcd_writel(hba, uic_cmnd-argument2, REG_UIC_COMMAND_ARG_2); - ufshcd_writel(hba, uic_cmnd-argument3, REG_UIC_COMMAND_ARG_3); + ufshcd_writel(hba, uic_cmd-argument1, REG_UIC_COMMAND_ARG_1); + ufshcd_writel(hba, uic_cmd-argument2, REG_UIC_COMMAND_ARG_2); + ufshcd_writel(hba, uic_cmd-argument3, REG_UIC_COMMAND_ARG_3); /* Write UIC Cmd */ - ufshcd_writel(hba, uic_cmnd-command COMMAND_OPCODE_MASK, + ufshcd_writel(hba, uic_cmd-command COMMAND_OPCODE_MASK, REG_UIC_COMMAND); } /** + * ufshcd_wait_for_uic_cmd - Wait complectioin of UIC command + * @hba: per adapter instance + * @uic_command: UIC command + * + * Must be called with mutex held. + * Returns 0 only if success. + */ +static int +ufshcd_wait_for_uic_cmd(struct ufs_hba *hba, struct uic_command *uic_cmd) +{ + int ret; + unsigned long flags; + + if (wait_for_completion_timeout(uic_cmd-done, + msecs_to_jiffies(UIC_CMD_TIMEOUT))) + ret = uic_cmd-argument2 MASK_UIC_COMMAND_RESULT; + else + ret = -ETIMEDOUT; + + spin_lock_irqsave(hba-host-host_lock, flags); + hba-active_uic_cmd = NULL; + spin_unlock_irqrestore(hba-host-host_lock, flags); + + return ret; +} + +/** + * __ufshcd_send_uic_cmd - Send UIC commands and retrieve the result + * @hba: per adapter instance + * @uic_cmd: UIC command + * + * Identical to ufshcd_send_uic_cmd() expect mutex. Must be called + * with mutex held. + * Returns 0 only if success. + */ +static int +__ufshcd_send_uic_cmd(struct ufs_hba *hba, struct uic_command *uic_cmd) +{ + int ret; + unsigned long flags; + + if (!ufshcd_ready_for_uic_cmd(hba)) { + dev_err(hba-dev, + Controller not ready to accept UIC commands\n); + return -EIO; + } + + init_completion(uic_cmd-done); + + spin_lock_irqsave(hba-host-host_lock, flags); + ufshcd_dispatch_uic_cmd(hba, uic_cmd); + spin_unlock_irqrestore(hba-host-host_lock, flags); + + ret = ufshcd_wait_for_uic_cmd(hba, uic_cmd); + + return ret; +} + +/** + * ufshcd_send_uic_cmd - Send UIC commands and retrieve the result + * @hba: per adapter instance + * @uic_cmd: UIC command + * + * Returns 0 only if success. + */ +static int +ufshcd_send_uic_cmd(struct ufs_hba *hba, struct uic_command *uic_cmd) +{ + int ret; + + mutex_lock(hba-uic_cmd_mutex); + ret = __ufshcd_send_uic_cmd(hba, uic_cmd); + mutex_unlock(hba-uic_cmd_mutex); + +
[PATCH 01/10] scsi: ufs: wrap the i/o access operations
From: Seungwon Jeon tgih@samsung.com Simplify operations with hiding mmio_base. Signed-off-by: Seungwon Jeon tgih@samsung.com Tested-by: Maya Erez me...@codeaurora.org Signed-off-by: Santosh Y santos...@gmail.com diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c index c32a478..871c2f0 100644 --- a/drivers/scsi/ufs/ufshcd.c +++ b/drivers/scsi/ufs/ufshcd.c @@ -71,7 +71,7 @@ enum { */ static inline u32 ufshcd_get_ufs_version(struct ufs_hba *hba) { - return readl(hba-mmio_base + REG_UFS_VERSION); + return ufshcd_readl(hba, REG_UFS_VERSION); } /** @@ -130,8 +130,7 @@ static inline int ufshcd_get_tm_free_slot(struct ufs_hba *hba) */ static inline void ufshcd_utrl_clear(struct ufs_hba *hba, u32 pos) { - writel(~(1 pos), - (hba-mmio_base + REG_UTP_TRANSFER_REQ_LIST_CLEAR)); + ufshcd_writel(hba, ~(1 pos), REG_UTP_TRANSFER_REQ_LIST_CLEAR); } /** @@ -165,7 +164,7 @@ static inline int ufshcd_get_lists_status(u32 reg) */ static inline int ufshcd_get_uic_cmd_result(struct ufs_hba *hba) { - return readl(hba-mmio_base + REG_UIC_COMMAND_ARG_2) + return ufshcd_readl(hba, REG_UIC_COMMAND_ARG_2) MASK_UIC_COMMAND_RESULT; } @@ -243,18 +242,15 @@ ufshcd_config_int_aggr(struct ufs_hba *hba, int option) { switch (option) { case INT_AGGR_RESET: - writel((INT_AGGR_ENABLE | - INT_AGGR_COUNTER_AND_TIMER_RESET), - (hba-mmio_base + -REG_UTP_TRANSFER_REQ_INT_AGG_CONTROL)); + ufshcd_writel(hba, INT_AGGR_ENABLE | + INT_AGGR_COUNTER_AND_TIMER_RESET, + REG_UTP_TRANSFER_REQ_INT_AGG_CONTROL); break; case INT_AGGR_CONFIG: - writel((INT_AGGR_ENABLE | - INT_AGGR_PARAM_WRITE | - INT_AGGR_COUNTER_THRESHOLD_VALUE | - INT_AGGR_TIMEOUT_VALUE), - (hba-mmio_base + -REG_UTP_TRANSFER_REQ_INT_AGG_CONTROL)); + ufshcd_writel(hba, INT_AGGR_ENABLE | INT_AGGR_PARAM_WRITE | + INT_AGGR_COUNTER_THRESHOLD_VALUE | + INT_AGGR_TIMEOUT_VALUE, + REG_UTP_TRANSFER_REQ_INT_AGG_CONTROL); break; } } @@ -267,12 +263,10 @@ ufshcd_config_int_aggr(struct ufs_hba *hba, int option) */ static void ufshcd_enable_run_stop_reg(struct ufs_hba *hba) { - writel(UTP_TASK_REQ_LIST_RUN_STOP_BIT, - (hba-mmio_base + - REG_UTP_TASK_REQ_LIST_RUN_STOP)); - writel(UTP_TRANSFER_REQ_LIST_RUN_STOP_BIT, - (hba-mmio_base + - REG_UTP_TRANSFER_REQ_LIST_RUN_STOP)); + ufshcd_writel(hba, UTP_TASK_REQ_LIST_RUN_STOP_BIT, + REG_UTP_TASK_REQ_LIST_RUN_STOP); + ufshcd_writel(hba, UTP_TRANSFER_REQ_LIST_RUN_STOP_BIT, + REG_UTP_TRANSFER_REQ_LIST_RUN_STOP); } /** @@ -281,7 +275,7 @@ static void ufshcd_enable_run_stop_reg(struct ufs_hba *hba) */ static inline void ufshcd_hba_start(struct ufs_hba *hba) { - writel(CONTROLLER_ENABLE , (hba-mmio_base + REG_CONTROLLER_ENABLE)); + ufshcd_writel(hba, CONTROLLER_ENABLE, REG_CONTROLLER_ENABLE); } /** @@ -292,7 +286,7 @@ static inline void ufshcd_hba_start(struct ufs_hba *hba) */ static inline int ufshcd_is_hba_active(struct ufs_hba *hba) { - return (readl(hba-mmio_base + REG_CONTROLLER_ENABLE) 0x1) ? 0 : 1; + return (ufshcd_readl(hba, REG_CONTROLLER_ENABLE) 0x1) ? 0 : 1; } /** @@ -304,8 +298,7 @@ static inline void ufshcd_send_command(struct ufs_hba *hba, unsigned int task_tag) { __set_bit(task_tag, hba-outstanding_reqs); - writel((1 task_tag), - (hba-mmio_base + REG_UTP_TRANSFER_REQ_DOOR_BELL)); + ufshcd_writel(hba, 1 task_tag, REG_UTP_TRANSFER_REQ_DOOR_BELL); } /** @@ -329,8 +322,7 @@ static inline void ufshcd_copy_sense_data(struct ufshcd_lrb *lrbp) */ static inline void ufshcd_hba_capabilities(struct ufs_hba *hba) { - hba-capabilities = - readl(hba-mmio_base + REG_CONTROLLER_CAPABILITIES); + hba-capabilities = ufshcd_readl(hba, REG_CONTROLLER_CAPABILITIES); /* nutrs and nutmrs are 0 based values */ hba-nutrs = (hba-capabilities MASK_TRANSFER_REQUESTS_SLOTS) + 1; @@ -347,16 +339,13 @@ static inline void ufshcd_send_uic_command(struct ufs_hba *hba, struct uic_command *uic_cmnd) { /* Write Args */ - writel(uic_cmnd-argument1, - (hba-mmio_base + REG_UIC_COMMAND_ARG_1)); - writel(uic_cmnd-argument2, - (hba-mmio_base + REG_UIC_COMMAND_ARG_2)); - writel(uic_cmnd-argument3, - (hba-mmio_base + REG_UIC_COMMAND_ARG_3)); + ufshcd_writel(hba, uic_cmnd-argument1, REG_UIC_COMMAND_ARG_1); +
[PATCH 00/10] scsi: ufs: link start-up rework and other fixes
Hi James, Please merge the following patches to 'misc' branch. Thanks, Santosh Akinobu Mita (4): ufshcd-pltfrm: add missing empty slot in ufs_of_match[] ufs: fix register address in UIC error interrupt handling ufshcd-pltfrm: remove unnecessary dma_set_coherent_mask() call ufs: fix DMA mask setting Seungwon Jeon (5): scsi: ufs: wrap the i/o access operations scsi: ufs: amend interrupt configuration scsi: ufs: remove version check before IS reg clear scsi: ufs: rework link start-up process scsi: ufs: use devres functions for ufshcd Sujit Reddy Thumma (1): scsi: ufs: Fix the response UPIU length setting drivers/scsi/ufs/ufshcd-pci.c| 27 --- drivers/scsi/ufs/ufshcd-pltfrm.c | 75 ++ drivers/scsi/ufs/ufshcd.c| 484 +-- drivers/scsi/ufs/ufshcd.h| 21 +- drivers/scsi/ufs/ufshci.h| 5 +- 5 files changed, 351 insertions(+), 261 deletions(-) -- 1.8.3.1 -- To unsubscribe from this list: send the line unsubscribe linux-scsi in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 07/10] ufshcd-pltfrm: add missing empty slot in ufs_of_match[]
From: Akinobu Mita m...@fixstars.com of_match_table member in struct device_driver must be terminated by empty slot as a sentinel. Signed-off-by: Akinobu Mita m...@fixstars.com Cc: Vinayak Holikatti vinholika...@gmail.com Cc: James E.J. Bottomley jbottom...@parallels.com Cc: linux-scsi@vger.kernel.org Signed-off-by: Santosh Y santos...@gmail.com diff --git a/drivers/scsi/ufs/ufshcd-pltfrm.c b/drivers/scsi/ufs/ufshcd-pltfrm.c index 0e48827..6829a16 100644 --- a/drivers/scsi/ufs/ufshcd-pltfrm.c +++ b/drivers/scsi/ufs/ufshcd-pltfrm.c @@ -157,6 +157,7 @@ static int ufshcd_pltfrm_remove(struct platform_device *pdev) static const struct of_device_id ufs_of_match[] = { { .compatible = jedec,ufs-1.1}, + {}, }; static const struct dev_pm_ops ufshcd_dev_pm_ops = { -- 1.8.3.1 -- To unsubscribe from this list: send the line unsubscribe linux-scsi in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 03/10] scsi: ufs: remove version check before IS reg clear
From: Seungwon Jeon tgih@samsung.com There is no need to check the version to clear the interrupt status. And the order is changed prior to actual handling. Signed-off-by: Seungwon Jeon tgih@samsung.com Tested-by: Maya Erez me...@codeaurora.org Signed-off-by: Santosh Y santos...@gmail.com diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c index 1f1e085..2e02483 100644 --- a/drivers/scsi/ufs/ufshcd.c +++ b/drivers/scsi/ufs/ufshcd.c @@ -1324,11 +1324,8 @@ static irqreturn_t ufshcd_intr(int irq, void *__hba) intr_status = ufshcd_readl(hba, REG_INTERRUPT_STATUS); if (intr_status) { + ufshcd_writel(hba, intr_status, REG_INTERRUPT_STATUS); ufshcd_sl_intr(hba, intr_status); - - /* If UFSHCI 1.0 then clear interrupt status register */ - if (hba-ufs_version == UFSHCI_VERSION_10) - ufshcd_writel(hba, intr_status, REG_INTERRUPT_STATUS); retval = IRQ_HANDLED; } spin_unlock(hba-host-host_lock); -- 1.8.3.1 -- To unsubscribe from this list: send the line unsubscribe linux-scsi in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 06/10] scsi: ufs: use devres functions for ufshcd
From: Seungwon Jeon tgih@samsung.com This patch replaces normal calls for resource allocation with devm_*() derivative functions. It makes resource freeing simpler. Signed-off-by: Seungwon Jeon tgih@samsung.com Signed-off-by: Santosh Y santos...@gmail.com diff --git a/drivers/scsi/ufs/ufshcd-pci.c b/drivers/scsi/ufs/ufshcd-pci.c index 5cb1d75..48be39a 100644 --- a/drivers/scsi/ufs/ufshcd-pci.c +++ b/drivers/scsi/ufs/ufshcd-pci.c @@ -92,7 +92,6 @@ static void ufshcd_pci_remove(struct pci_dev *pdev) struct ufs_hba *hba = pci_get_drvdata(pdev); disable_irq(pdev-irq); - free_irq(pdev-irq, hba); ufshcd_remove(hba); pci_release_regions(pdev); pci_set_drvdata(pdev, NULL); diff --git a/drivers/scsi/ufs/ufshcd-pltfrm.c b/drivers/scsi/ufs/ufshcd-pltfrm.c index 3db2ee1..0e48827 100644 --- a/drivers/scsi/ufs/ufshcd-pltfrm.c +++ b/drivers/scsi/ufs/ufshcd-pltfrm.c @@ -33,9 +33,10 @@ * this program. */ -#include ufshcd.h #include linux/platform_device.h +#include ufshcd.h + #ifdef CONFIG_PM /** * ufshcd_pltfrm_suspend - suspend power management function @@ -97,62 +98,45 @@ static int ufshcd_pltfrm_probe(struct platform_device *pdev) struct ufs_hba *hba; void __iomem *mmio_base; struct resource *mem_res; - struct resource *irq_res; - resource_size_t mem_size; - int err; + int irq, err; struct device *dev = pdev-dev; mem_res = platform_get_resource(pdev, IORESOURCE_MEM, 0); if (!mem_res) { - dev_err(pdev-dev, - Memory resource not available\n); + dev_err(dev, Memory resource not available\n); err = -ENODEV; - goto out_error; + goto out; } - mem_size = resource_size(mem_res); - if (!request_mem_region(mem_res-start, mem_size, ufshcd)) { - dev_err(pdev-dev, - Cannot reserve the memory resource\n); - err = -EBUSY; - goto out_error; + mmio_base = devm_ioremap_resource(dev, mem_res); + if (IS_ERR(mmio_base)) { + dev_err(dev, memory map failed\n); + err = PTR_ERR(mmio_base); + goto out; } - mmio_base = ioremap_nocache(mem_res-start, mem_size); - if (!mmio_base) { - dev_err(pdev-dev, memory map failed\n); - err = -ENOMEM; - goto out_release_regions; - } - - irq_res = platform_get_resource(pdev, IORESOURCE_IRQ, 0); - if (!irq_res) { - dev_err(pdev-dev, IRQ resource not available\n); + irq = platform_get_irq(pdev, 0); + if (irq 0) { + dev_err(dev, IRQ resource not available\n); err = -ENODEV; - goto out_iounmap; + goto out; } err = dma_set_coherent_mask(dev, dev-coherent_dma_mask); if (err) { - dev_err(pdev-dev, set dma mask failed\n); - goto out_iounmap; + dev_err(dev, set dma mask failed\n); + goto out; } - err = ufshcd_init(pdev-dev, hba, mmio_base, irq_res-start); + err = ufshcd_init(dev, hba, mmio_base, irq); if (err) { - dev_err(pdev-dev, Intialization failed\n); - goto out_iounmap; + dev_err(dev, Intialization failed\n); + goto out; } platform_set_drvdata(pdev, hba); - return 0; - -out_iounmap: - iounmap(mmio_base); -out_release_regions: - release_mem_region(mem_res-start, mem_size); -out_error: +out: return err; } @@ -164,26 +148,10 @@ out_error: */ static int ufshcd_pltfrm_remove(struct platform_device *pdev) { - struct resource *mem_res; - resource_size_t mem_size; struct ufs_hba *hba = platform_get_drvdata(pdev); disable_irq(hba-irq); - - /* Some buggy controllers raise interrupt after -* the resources are removed. So first we unregister the -* irq handler and then the resources used by driver -*/ - - free_irq(hba-irq, hba); ufshcd_remove(hba); - mem_res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - if (!mem_res) - dev_err(pdev-dev, ufshcd: Memory resource not available\n); - else { - mem_size = resource_size(mem_res); - release_mem_region(mem_res-start, mem_size); - } return 0; } diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c index 2230f14..255f5be 100644 --- a/drivers/scsi/ufs/ufshcd.c +++ b/drivers/scsi/ufs/ufshcd.c @@ -1789,7 +1789,7 @@ int ufshcd_init(struct device *dev, struct ufs_hba **hba_handle, mutex_init(hba-uic_cmd_mutex); /* IRQ registration */ - err = request_irq(irq, ufshcd_intr, IRQF_SHARED, UFSHCD, hba); + err = devm_request_irq(dev, irq,
[PATCH 08/10] ufs: fix register address in UIC error interrupt handling
From: Akinobu Mita m...@fixstars.com In UIC error interrupt handling, it checks if UIC data link layer error code indicates PA_INIT_ERROR in order to determine whether a fatal error handling is needed or not. But the code tries to read UIC data link layer error code from wrong REG_UIC_ERROR_CODE_PHY_ADAPTER_LAYER, it should be REG_UIC_ERROR_CODE_DATA_LINK_LAYER. Signed-off-by: Akinobu Mita m...@fixstars.com Cc: Vinayak Holikatti vinholika...@gmail.com Cc: James E.J. Bottomley jbottom...@parallels.com Cc: linux-scsi@vger.kernel.org Signed-off-by: Santosh Y santos...@gmail.com diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c index 255f5be..19618c6 100644 --- a/drivers/scsi/ufs/ufshcd.c +++ b/drivers/scsi/ufs/ufshcd.c @@ -1349,7 +1349,7 @@ static void ufshcd_err_handler(struct ufs_hba *hba) goto fatal_eh; if (hba-errors UIC_ERROR) { - reg = ufshcd_readl(hba, REG_UIC_ERROR_CODE_PHY_ADAPTER_LAYER); + reg = ufshcd_readl(hba, REG_UIC_ERROR_CODE_DATA_LINK_LAYER); if (reg UIC_DATA_LINK_LAYER_ERROR_PA_INIT) goto fatal_eh; } -- 1.8.3.1 -- To unsubscribe from this list: send the line unsubscribe linux-scsi in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 09/10] ufshcd-pltfrm: remove unnecessary dma_set_coherent_mask() call
From: Akinobu Mita m...@fixstars.com Changing the device coherent dma mask to the value that currently set has no effect. Signed-off-by: Akinobu Mita m...@fixstars.com Cc: Vinayak Holikatti vinholika...@gmail.com Cc: James E.J. Bottomley jbottom...@parallels.com Cc: linux-scsi@vger.kernel.org Signed-off-by: Santosh Y santos...@gmail.com diff --git a/drivers/scsi/ufs/ufshcd-pltfrm.c b/drivers/scsi/ufs/ufshcd-pltfrm.c index 6829a16..c42db40 100644 --- a/drivers/scsi/ufs/ufshcd-pltfrm.c +++ b/drivers/scsi/ufs/ufshcd-pltfrm.c @@ -122,12 +122,6 @@ static int ufshcd_pltfrm_probe(struct platform_device *pdev) goto out; } - err = dma_set_coherent_mask(dev, dev-coherent_dma_mask); - if (err) { - dev_err(dev, set dma mask failed\n); - goto out; - } - err = ufshcd_init(dev, hba, mmio_base, irq); if (err) { dev_err(dev, Intialization failed\n); -- 1.8.3.1 -- To unsubscribe from this list: send the line unsubscribe linux-scsi in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 10/10] ufs: fix DMA mask setting
From: Akinobu Mita m...@fixstars.com If the controller doesn't support 64-bit addressing mode, it must not set the DMA mask to 64-bit. But it's unconditionally trying to set to 64-bit without checking 64-bit addressing support in the controller capabilities. It was correctly checked before commit 3b1d05807a9a68c6d0580e9248247a774a4d3be6 ([SCSI] ufs: Segregate PCI Specific Code), this aims to restore the correct behaviour. To achieve this in a generic way, firstly we should push down the DMA mask setting routine ufshcd_set_dma_mask() from PCI glue driver to core driver in order to do it for both PCI glue driver and Platform glue driver. Secondly, we should change pci_ DMA mapping API to dma_ DMA mapping API because core driver is independent of glue drivers. Lastly, we need to relax dma_set_mask(dev, DMA_BIT_MASK(32)) error check for platform devices on ARM, which do not have a valid dma_mask pointer. Signed-off-by: Akinobu Mita m...@fixstars.com Cc: Vinayak Holikatti vinholika...@gmail.com Cc: James E.J. Bottomley jbottom...@parallels.com Cc: linux-scsi@vger.kernel.org Signed-off-by: Santosh Y santos...@gmail.com diff --git a/drivers/scsi/ufs/ufshcd-pci.c b/drivers/scsi/ufs/ufshcd-pci.c index 48be39a..64d36eb 100644 --- a/drivers/scsi/ufs/ufshcd-pci.c +++ b/drivers/scsi/ufs/ufshcd-pci.c @@ -100,26 +100,6 @@ static void ufshcd_pci_remove(struct pci_dev *pdev) } /** - * ufshcd_set_dma_mask - Set dma mask based on the controller - * addressing capability - * @pdev: PCI device structure - * - * Returns 0 for success, non-zero for failure - */ -static int ufshcd_set_dma_mask(struct pci_dev *pdev) -{ - int err; - - if (!pci_set_dma_mask(pdev, DMA_BIT_MASK(64)) -!pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(64))) - return 0; - err = pci_set_dma_mask(pdev, DMA_BIT_MASK(32)); - if (!err) - err = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32)); - return err; -} - -/** * ufshcd_pci_probe - probe routine of the driver * @pdev: pointer to PCI device handle * @id: PCI device id @@ -155,12 +135,6 @@ ufshcd_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id) goto out_release_regions; } - err = ufshcd_set_dma_mask(pdev); - if (err) { - dev_err(pdev-dev, set dma mask failed\n); - goto out_iounmap; - } - err = ufshcd_init(pdev-dev, hba, mmio_base, pdev-irq); if (err) { dev_err(pdev-dev, Initialization failed\n); diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c index 19618c6..431ddb2 100644 --- a/drivers/scsi/ufs/ufshcd.c +++ b/drivers/scsi/ufs/ufshcd.c @@ -1711,6 +1711,25 @@ void ufshcd_remove(struct ufs_hba *hba) EXPORT_SYMBOL_GPL(ufshcd_remove); /** + * ufshcd_set_dma_mask - Set dma mask based on the controller + * addressing capability + * @hba: per adapter instance + * + * Returns 0 for success, non-zero for failure + */ +static int ufshcd_set_dma_mask(struct ufs_hba *hba) +{ + if (hba-capabilities MASK_64_ADDRESSING_SUPPORT) { + if (!dma_set_mask(hba-dev, DMA_BIT_MASK(64)) + !dma_set_coherent_mask(hba-dev, DMA_BIT_MASK(64))) + return 0; + } + dma_set_mask(hba-dev, DMA_BIT_MASK(32)); + + return dma_set_coherent_mask(hba-dev, DMA_BIT_MASK(32)); +} + +/** * ufshcd_init - Driver initialization routine * @dev: pointer to device handle * @hba_handle: driver private handle @@ -1761,6 +1780,12 @@ int ufshcd_init(struct device *dev, struct ufs_hba **hba_handle, /* Get Interrupt bit mask per version */ hba-intr_mask = ufshcd_get_intr_mask(hba); + err = ufshcd_set_dma_mask(hba); + if (err) { + dev_err(hba-dev, set dma mask failed\n); + goto out_disable; + } + /* Allocate memory for host memory space */ err = ufshcd_memory_alloc(hba); if (err) { -- 1.8.3.1 -- To unsubscribe from this list: send the line unsubscribe linux-scsi in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 01/10] scsi: ufs: wrap the i/o access operations
From: Seungwon Jeon tgih@samsung.com Simplify operations with hiding mmio_base. Signed-off-by: Seungwon Jeon tgih@samsung.com Tested-by: Maya Erez me...@codeaurora.org Signed-off-by: Santosh Y santos...@gmail.com diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c index c32a478..871c2f0 100644 --- a/drivers/scsi/ufs/ufshcd.c +++ b/drivers/scsi/ufs/ufshcd.c @@ -71,7 +71,7 @@ enum { */ static inline u32 ufshcd_get_ufs_version(struct ufs_hba *hba) { - return readl(hba-mmio_base + REG_UFS_VERSION); + return ufshcd_readl(hba, REG_UFS_VERSION); } /** @@ -130,8 +130,7 @@ static inline int ufshcd_get_tm_free_slot(struct ufs_hba *hba) */ static inline void ufshcd_utrl_clear(struct ufs_hba *hba, u32 pos) { - writel(~(1 pos), - (hba-mmio_base + REG_UTP_TRANSFER_REQ_LIST_CLEAR)); + ufshcd_writel(hba, ~(1 pos), REG_UTP_TRANSFER_REQ_LIST_CLEAR); } /** @@ -165,7 +164,7 @@ static inline int ufshcd_get_lists_status(u32 reg) */ static inline int ufshcd_get_uic_cmd_result(struct ufs_hba *hba) { - return readl(hba-mmio_base + REG_UIC_COMMAND_ARG_2) + return ufshcd_readl(hba, REG_UIC_COMMAND_ARG_2) MASK_UIC_COMMAND_RESULT; } @@ -243,18 +242,15 @@ ufshcd_config_int_aggr(struct ufs_hba *hba, int option) { switch (option) { case INT_AGGR_RESET: - writel((INT_AGGR_ENABLE | - INT_AGGR_COUNTER_AND_TIMER_RESET), - (hba-mmio_base + -REG_UTP_TRANSFER_REQ_INT_AGG_CONTROL)); + ufshcd_writel(hba, INT_AGGR_ENABLE | + INT_AGGR_COUNTER_AND_TIMER_RESET, + REG_UTP_TRANSFER_REQ_INT_AGG_CONTROL); break; case INT_AGGR_CONFIG: - writel((INT_AGGR_ENABLE | - INT_AGGR_PARAM_WRITE | - INT_AGGR_COUNTER_THRESHOLD_VALUE | - INT_AGGR_TIMEOUT_VALUE), - (hba-mmio_base + -REG_UTP_TRANSFER_REQ_INT_AGG_CONTROL)); + ufshcd_writel(hba, INT_AGGR_ENABLE | INT_AGGR_PARAM_WRITE | + INT_AGGR_COUNTER_THRESHOLD_VALUE | + INT_AGGR_TIMEOUT_VALUE, + REG_UTP_TRANSFER_REQ_INT_AGG_CONTROL); break; } } @@ -267,12 +263,10 @@ ufshcd_config_int_aggr(struct ufs_hba *hba, int option) */ static void ufshcd_enable_run_stop_reg(struct ufs_hba *hba) { - writel(UTP_TASK_REQ_LIST_RUN_STOP_BIT, - (hba-mmio_base + - REG_UTP_TASK_REQ_LIST_RUN_STOP)); - writel(UTP_TRANSFER_REQ_LIST_RUN_STOP_BIT, - (hba-mmio_base + - REG_UTP_TRANSFER_REQ_LIST_RUN_STOP)); + ufshcd_writel(hba, UTP_TASK_REQ_LIST_RUN_STOP_BIT, + REG_UTP_TASK_REQ_LIST_RUN_STOP); + ufshcd_writel(hba, UTP_TRANSFER_REQ_LIST_RUN_STOP_BIT, + REG_UTP_TRANSFER_REQ_LIST_RUN_STOP); } /** @@ -281,7 +275,7 @@ static void ufshcd_enable_run_stop_reg(struct ufs_hba *hba) */ static inline void ufshcd_hba_start(struct ufs_hba *hba) { - writel(CONTROLLER_ENABLE , (hba-mmio_base + REG_CONTROLLER_ENABLE)); + ufshcd_writel(hba, CONTROLLER_ENABLE, REG_CONTROLLER_ENABLE); } /** @@ -292,7 +286,7 @@ static inline void ufshcd_hba_start(struct ufs_hba *hba) */ static inline int ufshcd_is_hba_active(struct ufs_hba *hba) { - return (readl(hba-mmio_base + REG_CONTROLLER_ENABLE) 0x1) ? 0 : 1; + return (ufshcd_readl(hba, REG_CONTROLLER_ENABLE) 0x1) ? 0 : 1; } /** @@ -304,8 +298,7 @@ static inline void ufshcd_send_command(struct ufs_hba *hba, unsigned int task_tag) { __set_bit(task_tag, hba-outstanding_reqs); - writel((1 task_tag), - (hba-mmio_base + REG_UTP_TRANSFER_REQ_DOOR_BELL)); + ufshcd_writel(hba, 1 task_tag, REG_UTP_TRANSFER_REQ_DOOR_BELL); } /** @@ -329,8 +322,7 @@ static inline void ufshcd_copy_sense_data(struct ufshcd_lrb *lrbp) */ static inline void ufshcd_hba_capabilities(struct ufs_hba *hba) { - hba-capabilities = - readl(hba-mmio_base + REG_CONTROLLER_CAPABILITIES); + hba-capabilities = ufshcd_readl(hba, REG_CONTROLLER_CAPABILITIES); /* nutrs and nutmrs are 0 based values */ hba-nutrs = (hba-capabilities MASK_TRANSFER_REQUESTS_SLOTS) + 1; @@ -347,16 +339,13 @@ static inline void ufshcd_send_uic_command(struct ufs_hba *hba, struct uic_command *uic_cmnd) { /* Write Args */ - writel(uic_cmnd-argument1, - (hba-mmio_base + REG_UIC_COMMAND_ARG_1)); - writel(uic_cmnd-argument2, - (hba-mmio_base + REG_UIC_COMMAND_ARG_2)); - writel(uic_cmnd-argument3, - (hba-mmio_base + REG_UIC_COMMAND_ARG_3)); + ufshcd_writel(hba, uic_cmnd-argument1, REG_UIC_COMMAND_ARG_1); +
[PATCH 04/10] scsi: ufs: rework link start-up process
From: Seungwon Jeon tgih@samsung.com Link start-up requires long time with multiphase handshakes between UFS host and device. This affects driver's probe time. This patch let link start-up run asynchronously. Link start-up will be executed at the end of prove separately. Along with this change, the following is worked. Defined completion time of uic command to avoid a permanent wait. Added mutex to guarantee of uic command at a time. Adapted some sequence of controller initialization after link statup according to HCI standard. Signed-off-by: Seungwon Jeon tgih@samsung.com Signed-off-by: Sujit Reddy Thumma sthu...@codeaurora.org Tested-by: Maya Erez me...@codeaurora.org Signed-off-by: Santosh Y santos...@gmail.com diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c index 2e02483..48a7645 100644 --- a/drivers/scsi/ufs/ufshcd.c +++ b/drivers/scsi/ufs/ufshcd.c @@ -33,11 +33,15 @@ * this program. */ +#include linux/async.h + #include ufshcd.h #define UFSHCD_ENABLE_INTRS(UTP_TRANSFER_REQ_COMPL |\ UTP_TASK_REQ_COMPL |\ UFSHCD_ERROR_MASK) +/* UIC command timeout, unit: ms */ +#define UIC_CMD_TIMEOUT500 enum { UFSHCD_MAX_CHANNEL = 0, @@ -349,24 +353,122 @@ static inline void ufshcd_hba_capabilities(struct ufs_hba *hba) } /** - * ufshcd_send_uic_command - Send UIC commands to unipro layers + * ufshcd_ready_for_uic_cmd - Check if controller is ready + *to accept UIC commands * @hba: per adapter instance - * @uic_command: UIC command + * Return true on success, else false + */ +static inline bool ufshcd_ready_for_uic_cmd(struct ufs_hba *hba) +{ + if (ufshcd_readl(hba, REG_CONTROLLER_STATUS) UIC_COMMAND_READY) + return true; + else + return false; +} + +/** + * ufshcd_dispatch_uic_cmd - Dispatch UIC commands to unipro layers + * @hba: per adapter instance + * @uic_cmd: UIC command + * + * Mutex must be held. */ static inline void -ufshcd_send_uic_command(struct ufs_hba *hba, struct uic_command *uic_cmnd) +ufshcd_dispatch_uic_cmd(struct ufs_hba *hba, struct uic_command *uic_cmd) { + WARN_ON(hba-active_uic_cmd); + + hba-active_uic_cmd = uic_cmd; + /* Write Args */ - ufshcd_writel(hba, uic_cmnd-argument1, REG_UIC_COMMAND_ARG_1); - ufshcd_writel(hba, uic_cmnd-argument2, REG_UIC_COMMAND_ARG_2); - ufshcd_writel(hba, uic_cmnd-argument3, REG_UIC_COMMAND_ARG_3); + ufshcd_writel(hba, uic_cmd-argument1, REG_UIC_COMMAND_ARG_1); + ufshcd_writel(hba, uic_cmd-argument2, REG_UIC_COMMAND_ARG_2); + ufshcd_writel(hba, uic_cmd-argument3, REG_UIC_COMMAND_ARG_3); /* Write UIC Cmd */ - ufshcd_writel(hba, uic_cmnd-command COMMAND_OPCODE_MASK, + ufshcd_writel(hba, uic_cmd-command COMMAND_OPCODE_MASK, REG_UIC_COMMAND); } /** + * ufshcd_wait_for_uic_cmd - Wait complectioin of UIC command + * @hba: per adapter instance + * @uic_command: UIC command + * + * Must be called with mutex held. + * Returns 0 only if success. + */ +static int +ufshcd_wait_for_uic_cmd(struct ufs_hba *hba, struct uic_command *uic_cmd) +{ + int ret; + unsigned long flags; + + if (wait_for_completion_timeout(uic_cmd-done, + msecs_to_jiffies(UIC_CMD_TIMEOUT))) + ret = uic_cmd-argument2 MASK_UIC_COMMAND_RESULT; + else + ret = -ETIMEDOUT; + + spin_lock_irqsave(hba-host-host_lock, flags); + hba-active_uic_cmd = NULL; + spin_unlock_irqrestore(hba-host-host_lock, flags); + + return ret; +} + +/** + * __ufshcd_send_uic_cmd - Send UIC commands and retrieve the result + * @hba: per adapter instance + * @uic_cmd: UIC command + * + * Identical to ufshcd_send_uic_cmd() expect mutex. Must be called + * with mutex held. + * Returns 0 only if success. + */ +static int +__ufshcd_send_uic_cmd(struct ufs_hba *hba, struct uic_command *uic_cmd) +{ + int ret; + unsigned long flags; + + if (!ufshcd_ready_for_uic_cmd(hba)) { + dev_err(hba-dev, + Controller not ready to accept UIC commands\n); + return -EIO; + } + + init_completion(uic_cmd-done); + + spin_lock_irqsave(hba-host-host_lock, flags); + ufshcd_dispatch_uic_cmd(hba, uic_cmd); + spin_unlock_irqrestore(hba-host-host_lock, flags); + + ret = ufshcd_wait_for_uic_cmd(hba, uic_cmd); + + return ret; +} + +/** + * ufshcd_send_uic_cmd - Send UIC commands and retrieve the result + * @hba: per adapter instance + * @uic_cmd: UIC command + * + * Returns 0 only if success. + */ +static int +ufshcd_send_uic_cmd(struct ufs_hba *hba, struct uic_command *uic_cmd) +{ + int ret; + + mutex_lock(hba-uic_cmd_mutex); + ret = __ufshcd_send_uic_cmd(hba, uic_cmd); + mutex_unlock(hba-uic_cmd_mutex); + +
[PATCH 06/10] scsi: ufs: use devres functions for ufshcd
From: Seungwon Jeon tgih@samsung.com This patch replaces normal calls for resource allocation with devm_*() derivative functions. It makes resource freeing simpler. Signed-off-by: Seungwon Jeon tgih@samsung.com Signed-off-by: Santosh Y santos...@gmail.com diff --git a/drivers/scsi/ufs/ufshcd-pci.c b/drivers/scsi/ufs/ufshcd-pci.c index 5cb1d75..48be39a 100644 --- a/drivers/scsi/ufs/ufshcd-pci.c +++ b/drivers/scsi/ufs/ufshcd-pci.c @@ -92,7 +92,6 @@ static void ufshcd_pci_remove(struct pci_dev *pdev) struct ufs_hba *hba = pci_get_drvdata(pdev); disable_irq(pdev-irq); - free_irq(pdev-irq, hba); ufshcd_remove(hba); pci_release_regions(pdev); pci_set_drvdata(pdev, NULL); diff --git a/drivers/scsi/ufs/ufshcd-pltfrm.c b/drivers/scsi/ufs/ufshcd-pltfrm.c index 3db2ee1..0e48827 100644 --- a/drivers/scsi/ufs/ufshcd-pltfrm.c +++ b/drivers/scsi/ufs/ufshcd-pltfrm.c @@ -33,9 +33,10 @@ * this program. */ -#include ufshcd.h #include linux/platform_device.h +#include ufshcd.h + #ifdef CONFIG_PM /** * ufshcd_pltfrm_suspend - suspend power management function @@ -97,62 +98,45 @@ static int ufshcd_pltfrm_probe(struct platform_device *pdev) struct ufs_hba *hba; void __iomem *mmio_base; struct resource *mem_res; - struct resource *irq_res; - resource_size_t mem_size; - int err; + int irq, err; struct device *dev = pdev-dev; mem_res = platform_get_resource(pdev, IORESOURCE_MEM, 0); if (!mem_res) { - dev_err(pdev-dev, - Memory resource not available\n); + dev_err(dev, Memory resource not available\n); err = -ENODEV; - goto out_error; + goto out; } - mem_size = resource_size(mem_res); - if (!request_mem_region(mem_res-start, mem_size, ufshcd)) { - dev_err(pdev-dev, - Cannot reserve the memory resource\n); - err = -EBUSY; - goto out_error; + mmio_base = devm_ioremap_resource(dev, mem_res); + if (IS_ERR(mmio_base)) { + dev_err(dev, memory map failed\n); + err = PTR_ERR(mmio_base); + goto out; } - mmio_base = ioremap_nocache(mem_res-start, mem_size); - if (!mmio_base) { - dev_err(pdev-dev, memory map failed\n); - err = -ENOMEM; - goto out_release_regions; - } - - irq_res = platform_get_resource(pdev, IORESOURCE_IRQ, 0); - if (!irq_res) { - dev_err(pdev-dev, IRQ resource not available\n); + irq = platform_get_irq(pdev, 0); + if (irq 0) { + dev_err(dev, IRQ resource not available\n); err = -ENODEV; - goto out_iounmap; + goto out; } err = dma_set_coherent_mask(dev, dev-coherent_dma_mask); if (err) { - dev_err(pdev-dev, set dma mask failed\n); - goto out_iounmap; + dev_err(dev, set dma mask failed\n); + goto out; } - err = ufshcd_init(pdev-dev, hba, mmio_base, irq_res-start); + err = ufshcd_init(dev, hba, mmio_base, irq); if (err) { - dev_err(pdev-dev, Intialization failed\n); - goto out_iounmap; + dev_err(dev, Intialization failed\n); + goto out; } platform_set_drvdata(pdev, hba); - return 0; - -out_iounmap: - iounmap(mmio_base); -out_release_regions: - release_mem_region(mem_res-start, mem_size); -out_error: +out: return err; } @@ -164,26 +148,10 @@ out_error: */ static int ufshcd_pltfrm_remove(struct platform_device *pdev) { - struct resource *mem_res; - resource_size_t mem_size; struct ufs_hba *hba = platform_get_drvdata(pdev); disable_irq(hba-irq); - - /* Some buggy controllers raise interrupt after -* the resources are removed. So first we unregister the -* irq handler and then the resources used by driver -*/ - - free_irq(hba-irq, hba); ufshcd_remove(hba); - mem_res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - if (!mem_res) - dev_err(pdev-dev, ufshcd: Memory resource not available\n); - else { - mem_size = resource_size(mem_res); - release_mem_region(mem_res-start, mem_size); - } return 0; } diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c index 2230f14..255f5be 100644 --- a/drivers/scsi/ufs/ufshcd.c +++ b/drivers/scsi/ufs/ufshcd.c @@ -1789,7 +1789,7 @@ int ufshcd_init(struct device *dev, struct ufs_hba **hba_handle, mutex_init(hba-uic_cmd_mutex); /* IRQ registration */ - err = request_irq(irq, ufshcd_intr, IRQF_SHARED, UFSHCD, hba); + err = devm_request_irq(dev, irq,
[PATCH 09/10] ufshcd-pltfrm: remove unnecessary dma_set_coherent_mask() call
From: Akinobu Mita m...@fixstars.com Changing the device coherent dma mask to the value that currently set has no effect. Signed-off-by: Akinobu Mita m...@fixstars.com Cc: Vinayak Holikatti vinholika...@gmail.com Cc: James E.J. Bottomley jbottom...@parallels.com Cc: linux-scsi@vger.kernel.org Signed-off-by: Santosh Y santos...@gmail.com diff --git a/drivers/scsi/ufs/ufshcd-pltfrm.c b/drivers/scsi/ufs/ufshcd-pltfrm.c index 6829a16..c42db40 100644 --- a/drivers/scsi/ufs/ufshcd-pltfrm.c +++ b/drivers/scsi/ufs/ufshcd-pltfrm.c @@ -122,12 +122,6 @@ static int ufshcd_pltfrm_probe(struct platform_device *pdev) goto out; } - err = dma_set_coherent_mask(dev, dev-coherent_dma_mask); - if (err) { - dev_err(dev, set dma mask failed\n); - goto out; - } - err = ufshcd_init(dev, hba, mmio_base, irq); if (err) { dev_err(dev, Intialization failed\n); -- 1.8.3.1 -- To unsubscribe from this list: send the line unsubscribe linux-scsi in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 1/2] scsi: ufs: Add support for host assisted background operations
On Thu, Jun 13, 2013 at 7:50 PM, Sujit Reddy Thumma sthu...@codeaurora.org wrote: Background operations in the UFS device can be disabled by the host to reduce the response latency of transfer requests. Add support for enabling/disabling the background operations during runtime suspend/resume of the device. If the device is in critical need of BKOPS it will raise an URGENT_BKOPS exception which should be handled by the host to make sure the device performs as expected. During bootup, the BKOPS is enabled in the device by default. The disable of BKOPS is supported only when the driver supports runtime suspend/resume operations as the runtime PM framework provides a way to determine the device idleness and hence BKOPS can be managed effectively. During runtime resume the BKOPS is disabled to reduce latency and during runtime suspend the BKOPS is enabled to allow device to carry out idle time BKOPS. In some cases where the BKOPS is disabled during runtime resume and due to continuous data transfers the runtime suspend is not triggered, the BKOPS is enabled when the device raises a level-2 exception (outstanding operations - performance impact). Change-Id: I8853c528af3bec2adaf49923d21cabca32b99142 Signed-off-by: Sujit Reddy Thumma sthu...@codeaurora.org --- drivers/scsi/ufs/ufs.h| 25 +++- drivers/scsi/ufs/ufshcd.c | 343 + drivers/scsi/ufs/ufshcd.h | 10 ++ 3 files changed, 377 insertions(+), 1 deletions(-) diff --git a/drivers/scsi/ufs/ufs.h b/drivers/scsi/ufs/ufs.h index 5484c59..24e589c 100644 --- a/drivers/scsi/ufs/ufs.h +++ b/drivers/scsi/ufs/ufs.h @@ -107,7 +107,29 @@ enum { /* Flag idn for Query Requests*/ enum flag_idn { - QUERY_FLAG_IDN_FDEVICEINIT = 0x01, + QUERY_FLAG_IDN_FDEVICEINIT = 0x01, + QUERY_FLAG_IDN_BKOPS_EN = 0x04, +}; + +/* Attribute idn for Query requests */ +enum attr_idn { + QUERY_ATTR_IDN_BKOPS_STATUS = 0x05, + QUERY_ATTR_IDN_EE_CONTROL = 0x0D, + QUERY_ATTR_IDN_EE_STATUS= 0x0E, +}; + +/* Exception event mask values */ +enum { + MASK_EE_STATUS = 0x, + MASK_EE_URGENT_BKOPS= (1 2), +}; + +/* Background operation status */ +enum { + BKOPS_STATUS_NO_OP = 0x0, + BKOPS_STATUS_NON_CRITICAL= 0x1, + BKOPS_STATUS_PERF_IMPACT = 0x2, + BKOPS_STATUS_CRITICAL= 0x3, }; /* UTP QUERY Transaction Specific Fields OpCode */ @@ -156,6 +178,7 @@ enum { MASK_TASK_RESPONSE = 0xFF00, MASK_RSP_UPIU_RESULT= 0x, MASK_QUERY_DATA_SEG_LEN = 0x, + MASK_RSP_EXCEPTION_EVENT = 0x1, }; /* Task management service response */ diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c index 6693ee9..aa1f11e 100644 --- a/drivers/scsi/ufs/ufshcd.c +++ b/drivers/scsi/ufs/ufshcd.c @@ -298,6 +298,21 @@ ufshcd_get_rsp_upiu_result(struct utp_upiu_rsp *ucd_rsp_ptr) } /** + * ufshcd_is_exception_event - Check if the device raised an exception event + * @ucd_rsp_ptr: pointer to response UPIU + * + * The function checks if the device raised and exception event indicated in + * the Device Information field of response UPIU. + * + * Returns true if exception is raised, false otherwise. + */ +static inline bool ufshcd_is_exception_event(struct utp_upiu_rsp *ucd_rsp_ptr) +{ + return be32_to_cpu(ucd_rsp_ptr-header.dword_2) + MASK_RSP_EXCEPTION_EVENT ? true : false; +} + +/** * ufshcd_config_int_aggr - Configure interrupt aggregation values. * Currently there is no use case where we want to configure * interrupt aggregation dynamically. So to configure interrupt @@ -1137,6 +1152,92 @@ out_no_mem: } /** + * ufshcd_query_attr - Helper function for composing attribute requests + * hba: per-adapter instance + * opcode: attribute opcode + * idn: attribute idn to access + * index: index field + * selector: selector field + * attr_val: the attribute value after the query request completes + * + * Returns 0 for success, non-zero in case of failure +*/ +int ufshcd_query_attr(struct ufs_hba *hba, enum query_opcode opcode, + enum attr_idn idn, u8 index, u8 selector, u32 *attr_val) +{ + struct ufs_query_req *query; + struct ufs_query_res *response; + int err = -ENOMEM; + + query = kzalloc(sizeof(struct ufs_query_req), GFP_KERNEL); + if (!query) { + dev_err(hba-dev, + %s: Failed allocating ufs_query_req instance\n, + __func__); + goto out_no_mem; + } + + response = kzalloc(sizeof(struct ufs_query_res), GFP_KERNEL); + if (!response) { + dev_err(hba-dev, + %s: Failed allocating ufs_query_res instance\n,
[PATCH 1/1] scsi/megaraid: minor cut and paste error fixed.
This looks like a cut and paste typo to me. Both of the megasas_read_fw_status_reg_* functions involved are identical though, so there was no bad behaviour. I changed it for consistency and clarity. Signed-off-by: James Georgas soulpa...@gmail.com --- drivers/scsi/megaraid/megaraid_sas_base.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c b/drivers/scsi/megaraid/megaraid_sas_base.c index 3a9ddae..87591cd 100644 --- a/drivers/scsi/megaraid/megaraid_sas_base.c +++ b/drivers/scsi/megaraid/megaraid_sas_base.c @@ -583,7 +583,7 @@ megasas_clear_intr_skinny(struct megasas_register_set __iomem *regs) /* * Check if it is our interrupt */ - if ((megasas_read_fw_status_reg_gen2(regs) MFI_STATE_MASK) == + if ((megasas_read_fw_status_reg_skinny(regs) MFI_STATE_MASK) == MFI_STATE_FAULT) { mfiStatus = MFI_INTR_FLAG_FIRMWARE_STATE_CHANGE; } else -- 1.8.1.5 -- To unsubscribe from this list: send the line unsubscribe linux-scsi in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[Bug 60191] New: Bad flush cache
https://bugzilla.kernel.org/show_bug.cgi?id=60191 Summary: Bad flush cache Product: IO/Storage Version: 2.5 Kernel Version: 3.8.13 Platform: All OS/Version: Linux Tree: Mainline Status: NEW Severity: normal Priority: P1 Component: SCSI AssignedTo: linux-scsi@vger.kernel.org ReportedBy: mustela...@yahoo.es Regression: No Hello to all, I'm Toni and it's my first Kernel bug. I hope help to detect problems on kernels (I'm not developer but yes detector ;)) Ok, and now start. When I dump image into SD card with IO operations apparently ok, and it continue past 100% (cache flushing) I can see that the writing is not 100% busy time on the output device. The IO monitor show this. For example, I can show: 100% 1 second, 0% 1 second, 100% 2 seconds, 0% 0,5 seconds... AND, in some situations, the umount on FAT32 on USB drives sometimes not really umount well, but this is other war. Cheers! -- Configure bugmail: https://bugzilla.kernel.org/userprefs.cgi?tab=email --- You are receiving this mail because: --- You are the assignee for the bug. -- To unsubscribe from this list: send the line unsubscribe linux-scsi in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 9/9] vhost/scsi: Convert to se_cmd-cmd_kref TARGET_SCF_ACK_KREF usage
On Fri, Jun 07, 2013 at 09:34:24PM +, Nicholas A. Bellinger wrote: From: Nicholas Bellinger n...@linux-iscsi.org This patch coverts vhost/scsi to se_cmd-cmd_kref TARGET_SCF_ACK_KREF usage, instead of assuming that vhost_scsi_free_cmd() is always called before TCM processing is completed in the response fast path. This includes adding vhost_scsi_check_stop_free() - target_put_sess_cmd() to perform the second se_cmd-cmd_kref put, and moving vhost_scsi_free_cmd() resource release into tcm_vhost_release_cmd() that is invoked once the last se_cmd-cmd_kref put occurs. Cc: Christoph Hellwig h...@lst.de Cc: Roland Dreier rol...@kernel.org Cc: Kent Overstreet koverstr...@google.com Cc: Asias He as...@redhat.com Cc: Michael S. Tsirkin m...@redhat.com Cc: Or Gerlitz ogerl...@mellanox.com Cc: Moussa Ba mouss...@micron.com Signed-off-by: Nicholas Bellinger n...@linux-iscsi.org Acked-by: Asias He as...@redhat.com --- drivers/vhost/scsi.c | 31 +++ 1 files changed, 19 insertions(+), 12 deletions(-) diff --git a/drivers/vhost/scsi.c b/drivers/vhost/scsi.c index aacf71e..1e5e820 100644 --- a/drivers/vhost/scsi.c +++ b/drivers/vhost/scsi.c @@ -446,7 +446,19 @@ static u32 tcm_vhost_tpg_get_inst_index(struct se_portal_group *se_tpg) static void tcm_vhost_release_cmd(struct se_cmd *se_cmd) { - return; + struct tcm_vhost_cmd *tv_cmd = container_of(se_cmd, + struct tcm_vhost_cmd, tvc_se_cmd); + + if (tv_cmd-tvc_sgl_count) { + u32 i; + for (i = 0; i tv_cmd-tvc_sgl_count; i++) + put_page(sg_page(tv_cmd-tvc_sgl[i])); + + kfree(tv_cmd-tvc_sgl); +} + + tcm_vhost_put_inflight(tv_cmd-inflight); + kfree(tv_cmd); } static int tcm_vhost_shutdown_session(struct se_session *se_sess) @@ -559,17 +571,11 @@ static void vhost_scsi_free_cmd(struct tcm_vhost_cmd *tv_cmd) /* TODO locking against target/backend threads? */ transport_generic_free_cmd(se_cmd, 0); - if (tv_cmd-tvc_sgl_count) { - u32 i; - for (i = 0; i tv_cmd-tvc_sgl_count; i++) - put_page(sg_page(tv_cmd-tvc_sgl[i])); - - kfree(tv_cmd-tvc_sgl); - } - - tcm_vhost_put_inflight(tv_cmd-inflight); +} - kfree(tv_cmd); +static int vhost_scsi_check_stop_free(struct se_cmd *se_cmd) +{ + return target_put_sess_cmd(se_cmd-se_sess, se_cmd); } static void tcm_vhost_do_evt_work(struct vhost_scsi *vs, @@ -847,7 +853,7 @@ static void tcm_vhost_submission_work(struct work_struct *work) tv_cmd-tvc_cdb, tv_cmd-tvc_sense_buf[0], tv_cmd-tvc_lun, tv_cmd-tvc_exp_data_len, tv_cmd-tvc_task_attr, tv_cmd-tvc_data_direction, - 0, sg_ptr, tv_cmd-tvc_sgl_count, + TARGET_SCF_ACK_KREF, sg_ptr, tv_cmd-tvc_sgl_count, sg_bidi_ptr, sg_no_bidi); if (rc 0) { transport_send_check_condition_and_sense(se_cmd, @@ -2008,6 +2014,7 @@ static struct target_core_fabric_ops tcm_vhost_ops = { .tpg_release_fabric_acl = tcm_vhost_release_fabric_acl, .tpg_get_inst_index = tcm_vhost_tpg_get_inst_index, .release_cmd= tcm_vhost_release_cmd, + .check_stop_free= vhost_scsi_check_stop_free, .shutdown_session = tcm_vhost_shutdown_session, .close_session = tcm_vhost_close_session, .sess_get_index = tcm_vhost_sess_get_index, -- 1.7.2.5 -- Asias -- To unsubscribe from this list: send the line unsubscribe linux-scsi in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 3/5] Drivers: scsi: storvsc: Implement multi-channel support
On Tue, 2013-06-04 at 12:05 -0700, K. Y. Srinivasan wrote: Implement multi-channel support for the storage devices. This doesn't compile: CC [M] drivers/scsi/storvsc_drv.o drivers/scsi/storvsc_drv.c: In function ‘handle_sc_creation’: drivers/scsi/storvsc_drv.c:763:35: error: ‘struct vmbus_channel’ has no member named ‘primary_channel’ drivers/scsi/storvsc_drv.c: In function ‘handle_multichannel_storage’: drivers/scsi/storvsc_drv.c:805:2: error: implicit declaration of function ‘vmbus_set_sc_create_callback’ [-Werror=implicit-function-declaration] drivers/scsi/storvsc_drv.c:812:2: error: implicit declaration of function ‘vmbus_are_subchannels_present’ [-Werror=implicit-function-declaration] drivers/scsi/storvsc_drv.c: In function ‘storvsc_on_channel_callback’: drivers/scsi/storvsc_drv.c:1223:13: error: ‘struct vmbus_channel’ has no member named ‘primary_channel’ drivers/scsi/storvsc_drv.c:1224:19: error: ‘struct vmbus_channel’ has no member named ‘primary_channel’ drivers/scsi/storvsc_drv.c: In function ‘storvsc_do_io’: drivers/scsi/storvsc_drv.c:1341:2: error: implicit declaration of function ‘vmbus_get_outgoing_channel’ [-Werror=implicit-function-declaration] drivers/scsi/storvsc_drv.c:1341:19: warning: assignment makes pointer from integer without a cast [enabled by default] cc1: some warnings being treated as errors make[2]: *** [drivers/scsi/storvsc_drv.o] Error 1 I assume this is a cross tree dependency? What's the relevant branch I need? James N�r��yb�X��ǧv�^�){.n�+{{ay�ʇڙ�,j��f���h���z��w��� ���j:+v���w�j�mzZ+�ݢj��!�i
Re: [PATCH V3 0/5] Drivers: scsi: storvsc
On Wed, 2013-06-26 at 12:58 +, KY Srinivasan wrote: -Original Message- From: KY Srinivasan Sent: Monday, June 17, 2013 9:32 AM To: gre...@linuxfoundation.org; linux-ker...@vger.kernel.org; de...@linuxdriverproject.org; oher...@suse.com; jbottom...@parallels.com; h...@infradead.org; linux-scsi@vger.kernel.org Subject: RE: [PATCH V3 0/5] Drivers: scsi: storvsc -Original Message- From: KY Srinivasan Sent: Tuesday, June 11, 2013 9:02 AM To: KY Srinivasan; gre...@linuxfoundation.org; linux-ker...@vger.kernel.org; de...@linuxdriverproject.org; oher...@suse.com; jbottom...@parallels.com; h...@infradead.org; linux-scsi@vger.kernel.org Subject: RE: [PATCH V3 0/5] Drivers: scsi: storvsc -Original Message- From: K. Y. Srinivasan [mailto:k...@microsoft.com] Sent: Tuesday, June 04, 2013 3:05 PM To: gre...@linuxfoundation.org; linux-ker...@vger.kernel.org; de...@linuxdriverproject.org; oher...@suse.com; jbottom...@parallels.com; h...@infradead.org; linux-scsi@vger.kernel.org Cc: KY Srinivasan Subject: [PATCH V3 0/5] Drivers: scsi: storvsc This set adds multi-channel support as well synthetic Fibre Channel support to storvsc. The multi-channel support depends on infrastructure in the VMBUS driver. Greg has already checked in the relevant patches to VMBUS. I had posted an earlier version of this patch-set that included the VMBUS related changes. I have since separated the VMBUS chages and these have already been checked in. In this version, based on comments from James, the timeout is no longer a module parameter. James, I think I have addressed all the comments that you had; if not, please let me know. Ping. James, Let me know if I should re-send the patches. Just FYI, my workflow involves using imap flags to tag stuff for actions and then using a set of date sorted evolution search folders to translate the flags into work queues. The search folders are by flag and thread, so a side effect of the way evolution does date ordering is that it's ordered by the most recent last, so the date it takes for thread ordering is the most recent email in the thread. Originally, I thought of this as an annyoing evolution bug because I wanted the folder ordered by date of the patch submission. However, later I came to appreciate that it meant currently actively discussed patches moved down in my workqueue automatically, so now I quite like it as a feature. It does mean, however, that the net effect of sending very frequent pings about a patch set is to cause that patch set to move down in my work queue and, unfortunately, even coming from a domain that habitually breaks threading doesn't save you because evolution helpfully has a set of heuristic rules to rethread outlook breakage. James -- To unsubscribe from this list: send the line unsubscribe linux-scsi in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v2 06/10] scsi: ufs: use devres functions for ufshcd
This patch replaces normal calls for resource allocation with devm_*() derivative functions. It makes resource freeing simpler. Signed-off-by: Seungwon Jeon tgih@samsung.com Signed-off-by: Santosh Y santos...@gmail.com --- Change in v2: [NOTE: There are no conflicts with the following series(07~10)] - Remove iounmap which is remained. - Apply devres to ufshcd_memory_alloc[dmam_alloc_coherent, devm_kzalloc] Accordingly, 'free' related functions are removed. drivers/scsi/ufs/ufshcd-pci.c|1 - drivers/scsi/ufs/ufshcd-pltfrm.c | 72 +--- drivers/scsi/ufs/ufshcd.c| 86 - 3 files changed, 39 insertions(+), 120 deletions(-) diff --git a/drivers/scsi/ufs/ufshcd-pci.c b/drivers/scsi/ufs/ufshcd-pci.c index 5cb1d75..48be39a 100644 --- a/drivers/scsi/ufs/ufshcd-pci.c +++ b/drivers/scsi/ufs/ufshcd-pci.c @@ -92,7 +92,6 @@ static void ufshcd_pci_remove(struct pci_dev *pdev) struct ufs_hba *hba = pci_get_drvdata(pdev); disable_irq(pdev-irq); - free_irq(pdev-irq, hba); ufshcd_remove(hba); pci_release_regions(pdev); pci_set_drvdata(pdev, NULL); diff --git a/drivers/scsi/ufs/ufshcd-pltfrm.c b/drivers/scsi/ufs/ufshcd-pltfrm.c index 3db2ee1..0e48827 100644 --- a/drivers/scsi/ufs/ufshcd-pltfrm.c +++ b/drivers/scsi/ufs/ufshcd-pltfrm.c @@ -33,9 +33,10 @@ * this program. */ -#include ufshcd.h #include linux/platform_device.h +#include ufshcd.h + #ifdef CONFIG_PM /** * ufshcd_pltfrm_suspend - suspend power management function @@ -97,62 +98,45 @@ static int ufshcd_pltfrm_probe(struct platform_device *pdev) struct ufs_hba *hba; void __iomem *mmio_base; struct resource *mem_res; - struct resource *irq_res; - resource_size_t mem_size; - int err; + int irq, err; struct device *dev = pdev-dev; mem_res = platform_get_resource(pdev, IORESOURCE_MEM, 0); if (!mem_res) { - dev_err(pdev-dev, - Memory resource not available\n); + dev_err(dev, Memory resource not available\n); err = -ENODEV; - goto out_error; + goto out; } - mem_size = resource_size(mem_res); - if (!request_mem_region(mem_res-start, mem_size, ufshcd)) { - dev_err(pdev-dev, - Cannot reserve the memory resource\n); - err = -EBUSY; - goto out_error; + mmio_base = devm_ioremap_resource(dev, mem_res); + if (IS_ERR(mmio_base)) { + dev_err(dev, memory map failed\n); + err = PTR_ERR(mmio_base); + goto out; } - mmio_base = ioremap_nocache(mem_res-start, mem_size); - if (!mmio_base) { - dev_err(pdev-dev, memory map failed\n); - err = -ENOMEM; - goto out_release_regions; - } - - irq_res = platform_get_resource(pdev, IORESOURCE_IRQ, 0); - if (!irq_res) { - dev_err(pdev-dev, IRQ resource not available\n); + irq = platform_get_irq(pdev, 0); + if (irq 0) { + dev_err(dev, IRQ resource not available\n); err = -ENODEV; - goto out_iounmap; + goto out; } err = dma_set_coherent_mask(dev, dev-coherent_dma_mask); if (err) { - dev_err(pdev-dev, set dma mask failed\n); - goto out_iounmap; + dev_err(dev, set dma mask failed\n); + goto out; } - err = ufshcd_init(pdev-dev, hba, mmio_base, irq_res-start); + err = ufshcd_init(dev, hba, mmio_base, irq); if (err) { - dev_err(pdev-dev, Intialization failed\n); - goto out_iounmap; + dev_err(dev, Intialization failed\n); + goto out; } platform_set_drvdata(pdev, hba); - return 0; - -out_iounmap: - iounmap(mmio_base); -out_release_regions: - release_mem_region(mem_res-start, mem_size); -out_error: +out: return err; } @@ -164,26 +148,10 @@ out_error: */ static int ufshcd_pltfrm_remove(struct platform_device *pdev) { - struct resource *mem_res; - resource_size_t mem_size; struct ufs_hba *hba = platform_get_drvdata(pdev); disable_irq(hba-irq); - - /* Some buggy controllers raise interrupt after -* the resources are removed. So first we unregister the -* irq handler and then the resources used by driver -*/ - - free_irq(hba-irq, hba); ufshcd_remove(hba); - mem_res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - if (!mem_res) - dev_err(pdev-dev, ufshcd: Memory resource not available\n); - else { - mem_size = resource_size(mem_res); - release_mem_region(mem_res-start,