linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH V2 0/8] pm80xx: Driver updates
@ 2015-08-11  9:36 Viswas.G
  2015-08-11  9:36 ` [PATCH V2 1/8] pm80xx: Updated link rate Viswas.G
                   ` (7 more replies)
  0 siblings, 8 replies; 13+ messages in thread
From: Viswas.G @ 2015-08-11  9:36 UTC (permalink / raw)
  To: linux-scsi
  Cc: Jack Wang, JBottomley, Tomas Henzl, Suresh.Thiagarajan, Viswas.G,
	Hannes Reinecke

From: Viswas G <Viswas.G@pmcs.com>

This patch set contains bug fixes for pm80xx driver.
Please consider these patches for next kernel release.

Changes From V1:
Corrected device state changes in I_T_Nexus_Reset.


Viswas G (8):
  pm80xx: Updated link rate
  pm80xx: Corrected device state changes in I_T_Nexus_Reset.
  pm80xx: Update For Thermal Page Code
  pm80xx: Fix for Incorrect DMA Unmapping of SG List
  pm80xx: Remove unnecessary phy disconnect while link error
  pm80xx: Add PORT RECOVERY TIMEOUT support
  pm80xx: Handling Invalid SSP Response frame
  pm80xx: Bump pm80xx driver version to 0.1.38

 drivers/scsi/pm8001/pm8001_defs.h |    1 +
 drivers/scsi/pm8001/pm8001_hwi.c  |    4 +
 drivers/scsi/pm8001/pm8001_sas.c  |   19 +++++--
 drivers/scsi/pm8001/pm8001_sas.h  |   12 +++-
 drivers/scsi/pm8001/pm80xx_hwi.c  |  111 +++++++++++++++++++++++++++----------
 drivers/scsi/pm8001/pm80xx_hwi.h  |    5 +-
 6 files changed, 114 insertions(+), 38 deletions(-)


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [PATCH V2 1/8] pm80xx: Updated link rate
  2015-08-11  9:36 [PATCH V2 0/8] pm80xx: Driver updates Viswas.G
@ 2015-08-11  9:36 ` Viswas.G
  2015-08-11  9:36 ` [PATCH V2 2/8] pm80xx: Corrected device state changes in I_T_Nexus_Reset Viswas.G
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 13+ messages in thread
From: Viswas.G @ 2015-08-11  9:36 UTC (permalink / raw)
  To: linux-scsi
  Cc: Jack Wang, JBottomley, Tomas Henzl, Suresh.Thiagarajan, Viswas.G,
	Hannes Reinecke

From: Viswas G <Viswas.G@pmcs.com>

Updated 12G linkrate to libsas.

Changes from V1:
None

Signed-off-by: Viswas G <Viswas.G@pmcs.com>

Reviewed-by: Suresh Thiagarajan <Suresh.Thiagarajan@pmcs.com>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Reviewed-by: Jack Wang <jinpu.wang@profitbricks.com>
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
---
 drivers/scsi/pm8001/pm8001_defs.h |    1 +
 drivers/scsi/pm8001/pm8001_hwi.c  |    4 ++++
 2 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/drivers/scsi/pm8001/pm8001_defs.h b/drivers/scsi/pm8001/pm8001_defs.h
index 74a4bb9..d4d20cc 100644
--- a/drivers/scsi/pm8001/pm8001_defs.h
+++ b/drivers/scsi/pm8001/pm8001_defs.h
@@ -56,6 +56,7 @@ enum phy_speed {
 	PHY_SPEED_15 = 0x01,
 	PHY_SPEED_30 = 0x02,
 	PHY_SPEED_60 = 0x04,
+	PHY_SPEED_120 = 0x08,
 };
 
 enum data_direction {
diff --git a/drivers/scsi/pm8001/pm8001_hwi.c b/drivers/scsi/pm8001/pm8001_hwi.c
index 96dcc09..39306b1 100644
--- a/drivers/scsi/pm8001/pm8001_hwi.c
+++ b/drivers/scsi/pm8001/pm8001_hwi.c
@@ -3263,6 +3263,10 @@ void pm8001_get_lrate_mode(struct pm8001_phy *phy, u8 link_rate)
 	struct sas_phy *sas_phy = phy->sas_phy.phy;
 
 	switch (link_rate) {
+	case PHY_SPEED_120:
+		phy->sas_phy.linkrate = SAS_LINK_RATE_12_0_GBPS;
+		phy->sas_phy.phy->negotiated_linkrate = SAS_LINK_RATE_12_0_GBPS;
+		break;
 	case PHY_SPEED_60:
 		phy->sas_phy.linkrate = SAS_LINK_RATE_6_0_GBPS;
 		phy->sas_phy.phy->negotiated_linkrate = SAS_LINK_RATE_6_0_GBPS;
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH V2 2/8] pm80xx: Corrected device state changes in I_T_Nexus_Reset.
  2015-08-11  9:36 [PATCH V2 0/8] pm80xx: Driver updates Viswas.G
  2015-08-11  9:36 ` [PATCH V2 1/8] pm80xx: Updated link rate Viswas.G
@ 2015-08-11  9:36 ` Viswas.G
  2015-08-13 12:43   ` Jinpu Wang
  2015-08-20 14:51   ` Tomas Henzl
  2015-08-11  9:36 ` [PATCH V2 3/8] pm80xx: Update For Thermal Page Code Viswas.G
                   ` (5 subsequent siblings)
  7 siblings, 2 replies; 13+ messages in thread
From: Viswas.G @ 2015-08-11  9:36 UTC (permalink / raw)
  To: linux-scsi
  Cc: Jack Wang, JBottomley, Tomas Henzl, Suresh.Thiagarajan, Viswas.G,
	Hannes Reinecke

From: Viswas G <Viswas.G@pmcs.com>

In Nexus reset the device state request are not needed.

Changes from V1:
Device state change request has been removed as the firmware
will handle it during internal cleanup. Also updated the
proper return value in case of failures.

Signed-off-by: Viswas G <Viswas.G@pmcs.com>

Reviewed-by: Suresh Thiagarajan <Suresh.Thiagarajan@pmcs.com>
---
 drivers/scsi/pm8001/pm8001_sas.c |   18 +++++++++++++-----
 drivers/scsi/pm8001/pm8001_sas.h |    8 ++++++++
 2 files changed, 21 insertions(+), 5 deletions(-)

diff --git a/drivers/scsi/pm8001/pm8001_sas.c b/drivers/scsi/pm8001/pm8001_sas.c
index b93f289..48f4627 100644
--- a/drivers/scsi/pm8001/pm8001_sas.c
+++ b/drivers/scsi/pm8001/pm8001_sas.c
@@ -975,19 +975,27 @@ int pm8001_I_T_nexus_reset(struct domain_device *dev)
 	phy = sas_get_local_phy(dev);
 
 	if (dev_is_sata(dev)) {
-		DECLARE_COMPLETION_ONSTACK(completion_setstate);
 		if (scsi_is_sas_phy_local(phy)) {
 			rc = 0;
 			goto out;
 		}
 		rc = sas_phy_reset(phy, 1);
+		if (rc) {
+			PM8001_EH_DBG(pm8001_ha,
+			pm8001_printk("phy reset failed for device %x\n"
+			"with rc %d\n", pm8001_dev->device_id, rc));
+			rc = TMF_RESP_FUNC_FAILED;
+			goto out;
+		}
 		msleep(2000);
 		rc = pm8001_exec_internal_task_abort(pm8001_ha, pm8001_dev ,
 			dev, 1, 0);
-		pm8001_dev->setds_completion = &completion_setstate;
-		rc = PM8001_CHIP_DISP->set_dev_state_req(pm8001_ha,
-			pm8001_dev, 0x01);
-		wait_for_completion(&completion_setstate);
+		if (rc) {
+			PM8001_EH_DBG(pm8001_ha,
+			pm8001_printk("task abort failed %x\n"
+			"with rc %d\n", pm8001_dev->device_id, rc));
+			rc = TMF_RESP_FUNC_FAILED;
+		}
 	} else {
 		rc = sas_phy_reset(phy, 1);
 		msleep(2000);
diff --git a/drivers/scsi/pm8001/pm8001_sas.h b/drivers/scsi/pm8001/pm8001_sas.h
index 8dd8b78..c9736cc 100644
--- a/drivers/scsi/pm8001/pm8001_sas.h
+++ b/drivers/scsi/pm8001/pm8001_sas.h
@@ -569,6 +569,14 @@ struct pm8001_fw_image_header {
 #define	NCQ_READ_LOG_FLAG			0x80000000
 #define	NCQ_ABORT_ALL_FLAG			0x40000000
 #define	NCQ_2ND_RLE_FLAG			0x20000000
+
+/* Device states */
+#define DS_OPERATIONAL				0x01
+#define DS_PORT_IN_RESET			0x02
+#define DS_IN_RECOVERY				0x03
+#define DS_IN_ERROR				0x04
+#define DS_NON_OPERATIONAL			0x07
+
 /**
  * brief param structure for firmware flash update.
  */
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH V2 3/8] pm80xx: Update For Thermal Page Code
  2015-08-11  9:36 [PATCH V2 0/8] pm80xx: Driver updates Viswas.G
  2015-08-11  9:36 ` [PATCH V2 1/8] pm80xx: Updated link rate Viswas.G
  2015-08-11  9:36 ` [PATCH V2 2/8] pm80xx: Corrected device state changes in I_T_Nexus_Reset Viswas.G
@ 2015-08-11  9:36 ` Viswas.G
  2015-08-11  9:36 ` [PATCH V2 4/8] pm80xx: Fix for Incorrect DMA Unmapping of SG List Viswas.G
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 13+ messages in thread
From: Viswas.G @ 2015-08-11  9:36 UTC (permalink / raw)
  To: linux-scsi
  Cc: Jack Wang, JBottomley, Tomas Henzl, Suresh.Thiagarajan, Viswas.G,
	Hannes Reinecke

From: Viswas G <Viswas.G@pmcs.com>

Thermal page code has been changed to 7 for the 12G controllers.

Changes From V1:
None

Signed-off-by: Viswas G <Viswas.G@pmcs.com>

Reviewed-by: Suresh Thiagarajan <Suresh.Thiagarajan@pmcs.com>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Reviewed-by: Jack Wang <jinpu.wang@profitbricks.com>
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
---
 drivers/scsi/pm8001/pm80xx_hwi.c |    9 ++++++++-
 drivers/scsi/pm8001/pm80xx_hwi.h |    3 ++-
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/pm8001/pm80xx_hwi.c b/drivers/scsi/pm8001/pm80xx_hwi.c
index 05cce46..dced9f7 100644
--- a/drivers/scsi/pm8001/pm80xx_hwi.c
+++ b/drivers/scsi/pm8001/pm80xx_hwi.c
@@ -843,6 +843,7 @@ pm80xx_set_thermal_config(struct pm8001_hba_info *pm8001_ha)
 	int rc;
 	u32 tag;
 	u32 opc = OPC_INB_SET_CONTROLLER_CONFIG;
+	u32 page_code;
 
 	memset(&payload, 0, sizeof(struct set_ctrl_cfg_req));
 	rc = pm8001_tag_alloc(pm8001_ha, &tag);
@@ -851,8 +852,14 @@ pm80xx_set_thermal_config(struct pm8001_hba_info *pm8001_ha)
 
 	circularQ = &pm8001_ha->inbnd_q_tbl[0];
 	payload.tag = cpu_to_le32(tag);
+
+	if (IS_SPCV_12G(pm8001_ha->pdev))
+		page_code = THERMAL_PAGE_CODE_7H;
+	else
+		page_code = THERMAL_PAGE_CODE_8H;
+
 	payload.cfg_pg[0] = (THERMAL_LOG_ENABLE << 9) |
-			(THERMAL_ENABLE << 8) | THERMAL_OP_CODE;
+				(THERMAL_ENABLE << 8) | page_code;
 	payload.cfg_pg[1] = (LTEMPHIL << 24) | (RTEMPHIL << 8);
 
 	rc = pm8001_mpi_build_cmd(pm8001_ha, circularQ, opc, &payload, 0);
diff --git a/drivers/scsi/pm8001/pm80xx_hwi.h b/drivers/scsi/pm8001/pm80xx_hwi.h
index 9970a38..a083cc6 100644
--- a/drivers/scsi/pm8001/pm80xx_hwi.h
+++ b/drivers/scsi/pm8001/pm80xx_hwi.h
@@ -177,7 +177,8 @@
 /* Thermal related */
 #define	THERMAL_ENABLE			0x1
 #define	THERMAL_LOG_ENABLE		0x1
-#define THERMAL_OP_CODE			0x6
+#define THERMAL_PAGE_CODE_7H		0x6
+#define THERMAL_PAGE_CODE_8H		0x7
 #define LTEMPHIL			 70
 #define RTEMPHIL			100
 
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH V2 4/8] pm80xx: Fix for Incorrect DMA Unmapping of SG List
  2015-08-11  9:36 [PATCH V2 0/8] pm80xx: Driver updates Viswas.G
                   ` (2 preceding siblings ...)
  2015-08-11  9:36 ` [PATCH V2 3/8] pm80xx: Update For Thermal Page Code Viswas.G
@ 2015-08-11  9:36 ` Viswas.G
  2015-08-11  9:36 ` [PATCH V2 5/8] pm80xx: Remove unnecessary phy disconnect while link error Viswas.G
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 13+ messages in thread
From: Viswas.G @ 2015-08-11  9:36 UTC (permalink / raw)
  To: linux-scsi
  Cc: Jack Wang, JBottomley, Tomas Henzl, Suresh.Thiagarajan, Viswas.G,
	Hannes Reinecke

From: Viswas G <Viswas.G@pmcs.com>

In pm8001_ccb_task_free(), the dma unmapping is done based on
ccb->n_elem value. This should be initialized to zero in the
task_abort(). Otherwise, pm8001_ccb_task_free() will try for
dma_unmap_sg() which is invalid for task abort and can lead to
kernel crash.

Changes From V1:
None

Signed-off-by: Viswas G <Viswas.G@pmcs.com>

Reviewed-by: Suresh Thiagarajan <Suresh.Thiagarajan@pmcs.com>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Reviewed-by: Jack Wang <jinpu.wang@profitbricks.com>
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
---
 drivers/scsi/pm8001/pm8001_sas.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/drivers/scsi/pm8001/pm8001_sas.c b/drivers/scsi/pm8001/pm8001_sas.c
index 48f4627..949198c 100644
--- a/drivers/scsi/pm8001/pm8001_sas.c
+++ b/drivers/scsi/pm8001/pm8001_sas.c
@@ -790,6 +790,7 @@ pm8001_exec_internal_task_abort(struct pm8001_hba_info *pm8001_ha,
 		ccb->device = pm8001_dev;
 		ccb->ccb_tag = ccb_tag;
 		ccb->task = task;
+		ccb->n_elem = 0;
 
 		res = PM8001_CHIP_DISP->task_abort(pm8001_ha,
 			pm8001_dev, flag, task_tag, ccb_tag);
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH V2 5/8] pm80xx: Remove unnecessary phy disconnect while link error
  2015-08-11  9:36 [PATCH V2 0/8] pm80xx: Driver updates Viswas.G
                   ` (3 preceding siblings ...)
  2015-08-11  9:36 ` [PATCH V2 4/8] pm80xx: Fix for Incorrect DMA Unmapping of SG List Viswas.G
@ 2015-08-11  9:36 ` Viswas.G
  2015-08-11  9:36 ` [PATCH V2 6/8] pm80xx: Add PORT RECOVERY TIMEOUT support Viswas.G
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 13+ messages in thread
From: Viswas.G @ 2015-08-11  9:36 UTC (permalink / raw)
  To: linux-scsi
  Cc: Jack Wang, JBottomley, Tomas Henzl, Suresh.Thiagarajan, Viswas.G,
	Hannes Reinecke

From: Viswas G <Viswas.G@pmcs.com>

If the link error happens, we don't need to disconnect the phy,
which will remove the drive. Instead acknowledging the controller
and logging the error will be enough.

Changes From V1:
None

Signed-off-by: Viswas G <Viswas.G@pmcs.com>

Reviewed-by: Suresh Thiagarajan <Suresh.Thiagarajan@pmcs.com>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Reviewed-by: Jack Wang <jinpu.wang@profitbricks.com>
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
---
 drivers/scsi/pm8001/pm80xx_hwi.c |   12 ------------
 1 files changed, 0 insertions(+), 12 deletions(-)

diff --git a/drivers/scsi/pm8001/pm80xx_hwi.c b/drivers/scsi/pm8001/pm80xx_hwi.c
index dced9f7..3d8b4ae 100644
--- a/drivers/scsi/pm8001/pm80xx_hwi.c
+++ b/drivers/scsi/pm8001/pm80xx_hwi.c
@@ -3176,9 +3176,6 @@ static int mpi_hw_event(struct pm8001_hba_info *pm8001_ha, void *piomb)
 			pm8001_printk("HW_EVENT_LINK_ERR_INVALID_DWORD\n"));
 		pm80xx_hw_event_ack_req(pm8001_ha, 0,
 			HW_EVENT_LINK_ERR_INVALID_DWORD, port_id, phy_id, 0, 0);
-		sas_phy_disconnected(sas_phy);
-		phy->phy_attached = 0;
-		sas_ha->notify_port_event(sas_phy, PORTE_LINK_RESET_ERR);
 		break;
 	case HW_EVENT_LINK_ERR_DISPARITY_ERROR:
 		PM8001_MSG_DBG(pm8001_ha,
@@ -3186,9 +3183,6 @@ static int mpi_hw_event(struct pm8001_hba_info *pm8001_ha, void *piomb)
 		pm80xx_hw_event_ack_req(pm8001_ha, 0,
 			HW_EVENT_LINK_ERR_DISPARITY_ERROR,
 			port_id, phy_id, 0, 0);
-		sas_phy_disconnected(sas_phy);
-		phy->phy_attached = 0;
-		sas_ha->notify_port_event(sas_phy, PORTE_LINK_RESET_ERR);
 		break;
 	case HW_EVENT_LINK_ERR_CODE_VIOLATION:
 		PM8001_MSG_DBG(pm8001_ha,
@@ -3196,9 +3190,6 @@ static int mpi_hw_event(struct pm8001_hba_info *pm8001_ha, void *piomb)
 		pm80xx_hw_event_ack_req(pm8001_ha, 0,
 			HW_EVENT_LINK_ERR_CODE_VIOLATION,
 			port_id, phy_id, 0, 0);
-		sas_phy_disconnected(sas_phy);
-		phy->phy_attached = 0;
-		sas_ha->notify_port_event(sas_phy, PORTE_LINK_RESET_ERR);
 		break;
 	case HW_EVENT_LINK_ERR_LOSS_OF_DWORD_SYNCH:
 		PM8001_MSG_DBG(pm8001_ha, pm8001_printk(
@@ -3206,9 +3197,6 @@ static int mpi_hw_event(struct pm8001_hba_info *pm8001_ha, void *piomb)
 		pm80xx_hw_event_ack_req(pm8001_ha, 0,
 			HW_EVENT_LINK_ERR_LOSS_OF_DWORD_SYNCH,
 			port_id, phy_id, 0, 0);
-		sas_phy_disconnected(sas_phy);
-		phy->phy_attached = 0;
-		sas_ha->notify_port_event(sas_phy, PORTE_LINK_RESET_ERR);
 		break;
 	case HW_EVENT_MALFUNCTION:
 		PM8001_MSG_DBG(pm8001_ha,
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH V2 6/8] pm80xx: Add PORT RECOVERY TIMEOUT support
  2015-08-11  9:36 [PATCH V2 0/8] pm80xx: Driver updates Viswas.G
                   ` (4 preceding siblings ...)
  2015-08-11  9:36 ` [PATCH V2 5/8] pm80xx: Remove unnecessary phy disconnect while link error Viswas.G
@ 2015-08-11  9:36 ` Viswas.G
  2015-08-11  9:36 ` [PATCH V2 7/8] pm80xx: Handling Invalid SSP Response frame Viswas.G
  2015-08-11  9:36 ` [PATCH V2 8/8] pm80xx: Bump pm80xx driver version to 0.1.38 Viswas.G
  7 siblings, 0 replies; 13+ messages in thread
From: Viswas.G @ 2015-08-11  9:36 UTC (permalink / raw)
  To: linux-scsi
  Cc: Jack Wang, JBottomley, Tomas Henzl, Suresh.Thiagarajan, Viswas.G,
	Hannes Reinecke

From: Viswas G <Viswas.G@pmcs.com>

PORT RECOVERY TIMEOUT is the maximum time between the controller's
detection of the PHY down until the receipt of the ID_Frame (from the
same remote SAS port). If the time expires before the ID_FRAME is
received, the port is considered INVALID and can be removed. The
IOP_EVENT_PORT_RECOVERY_TIMER_TMO event is reported following the
IOP_EVENT_ PHY_DOWN event when the PHY/port does not recover after
Port Recovery Time.

Changes From V1:
None

Signed-off-by: Viswas G <Viswas.G@pmcs.com>

Reviewed-by: Suresh Thiagarajan <Suresh.Thiagarajan@pmcs.com>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Reviewed-by: Jack Wang <jinpu.wang@profitbricks.com>
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
---
 drivers/scsi/pm8001/pm8001_sas.h |    2 +-
 drivers/scsi/pm8001/pm80xx_hwi.c |   83 ++++++++++++++++++++++++++++++-------
 2 files changed, 68 insertions(+), 17 deletions(-)

diff --git a/drivers/scsi/pm8001/pm8001_sas.h b/drivers/scsi/pm8001/pm8001_sas.h
index c9736cc..2788026 100644
--- a/drivers/scsi/pm8001/pm8001_sas.h
+++ b/drivers/scsi/pm8001/pm8001_sas.h
@@ -241,7 +241,7 @@ struct pm8001_chip_info {
 struct pm8001_port {
 	struct asd_sas_port	sas_port;
 	u8			port_attached;
-	u8			wide_port_phymap;
+	u16			wide_port_phymap;
 	u8			port_state;
 	struct list_head	list;
 };
diff --git a/drivers/scsi/pm8001/pm80xx_hwi.c b/drivers/scsi/pm8001/pm80xx_hwi.c
index 3d8b4ae..8817ce6 100644
--- a/drivers/scsi/pm8001/pm80xx_hwi.c
+++ b/drivers/scsi/pm8001/pm80xx_hwi.c
@@ -309,6 +309,9 @@ static void read_main_config_table(struct pm8001_hba_info *pm8001_ha)
 		pm8001_mr32(address, MAIN_INT_VECTOR_TABLE_OFFSET);
 	pm8001_ha->main_cfg_tbl.pm80xx_tbl.phy_attr_table_offset =
 		pm8001_mr32(address, MAIN_SAS_PHY_ATTR_TABLE_OFFSET);
+	/* read port recover and reset timeout */
+	pm8001_ha->main_cfg_tbl.pm80xx_tbl.port_recovery_timer =
+		pm8001_mr32(address, MAIN_PORT_RECOVERY_TIMER);
 }
 
 /**
@@ -585,6 +588,12 @@ static void update_main_config_table(struct pm8001_hba_info *pm8001_ha)
 		pm8001_ha->main_cfg_tbl.pm80xx_tbl.port_recovery_timer);
 	pm8001_mw32(address, MAIN_INT_REASSERTION_DELAY,
 		pm8001_ha->main_cfg_tbl.pm80xx_tbl.interrupt_reassertion_delay);
+
+	pm8001_ha->main_cfg_tbl.pm80xx_tbl.port_recovery_timer &= 0xffff0000;
+	pm8001_ha->main_cfg_tbl.pm80xx_tbl.port_recovery_timer |=
+							PORT_RECOVERY_TIMEOUT;
+	pm8001_mw32(address, MAIN_PORT_RECOVERY_TIMER,
+			pm8001_ha->main_cfg_tbl.pm80xx_tbl.port_recovery_timer);
 }
 
 /**
@@ -2836,6 +2845,32 @@ static void pm80xx_hw_event_ack_req(struct pm8001_hba_info *pm8001_ha,
 static int pm80xx_chip_phy_ctl_req(struct pm8001_hba_info *pm8001_ha,
 	u32 phyId, u32 phy_op);
 
+static void hw_event_port_recover(struct pm8001_hba_info *pm8001_ha,
+					void *piomb)
+{
+	struct hw_event_resp *pPayload = (struct hw_event_resp *)(piomb + 4);
+	u32 phyid_npip_portstate = le32_to_cpu(pPayload->phyid_npip_portstate);
+	u8 phy_id = (u8)((phyid_npip_portstate & 0xFF0000) >> 16);
+	u32 lr_status_evt_portid =
+		le32_to_cpu(pPayload->lr_status_evt_portid);
+	u8 deviceType = pPayload->sas_identify.dev_type;
+	u8 link_rate = (u8)((lr_status_evt_portid & 0xF0000000) >> 28);
+	struct pm8001_phy *phy = &pm8001_ha->phy[phy_id];
+	u8 port_id = (u8)(lr_status_evt_portid & 0x000000FF);
+	struct pm8001_port *port = &pm8001_ha->port[port_id];
+
+	if (deviceType == SAS_END_DEVICE) {
+		pm80xx_chip_phy_ctl_req(pm8001_ha, phy_id,
+					PHY_NOTIFY_ENABLE_SPINUP);
+	}
+
+	port->wide_port_phymap |= (1U << phy_id);
+	pm8001_get_lrate_mode(phy, link_rate);
+	phy->sas_phy.oob_mode = SAS_OOB_MODE;
+	phy->phy_state = PHY_STATE_LINK_UP_SPCV;
+	phy->phy_attached = 1;
+}
+
 /**
  * hw_event_sas_phy_up -FW tells me a SAS phy up event.
  * @pm8001_ha: our hba card information
@@ -2863,6 +2898,7 @@ hw_event_sas_phy_up(struct pm8001_hba_info *pm8001_ha, void *piomb)
 	unsigned long flags;
 	u8 deviceType = pPayload->sas_identify.dev_type;
 	port->port_state = portstate;
+	port->wide_port_phymap |= (1U << phy_id);
 	phy->phy_state = PHY_STATE_LINK_UP_SPCV;
 	PM8001_MSG_DBG(pm8001_ha, pm8001_printk(
 		"portid:%d; phyid:%d; linkrate:%d; "
@@ -2988,7 +3024,6 @@ hw_event_phy_down(struct pm8001_hba_info *pm8001_ha, void *piomb)
 	struct pm8001_port *port = &pm8001_ha->port[port_id];
 	struct pm8001_phy *phy = &pm8001_ha->phy[phy_id];
 	port->port_state = portstate;
-	phy->phy_type = 0;
 	phy->identify.device_type = 0;
 	phy->phy_attached = 0;
 	memset(&phy->dev_sas_addr, 0, SAS_ADDR_SIZE);
@@ -3000,9 +3035,13 @@ hw_event_phy_down(struct pm8001_hba_info *pm8001_ha, void *piomb)
 			pm8001_printk(" PortInvalid portID %d\n", port_id));
 		PM8001_MSG_DBG(pm8001_ha,
 			pm8001_printk(" Last phy Down and port invalid\n"));
-		port->port_attached = 0;
-		pm80xx_hw_event_ack_req(pm8001_ha, 0, HW_EVENT_PHY_DOWN,
-			port_id, phy_id, 0, 0);
+		if (phy->phy_type & PORT_TYPE_SATA) {
+			phy->phy_type = 0;
+			port->port_attached = 0;
+			pm80xx_hw_event_ack_req(pm8001_ha, 0, HW_EVENT_PHY_DOWN,
+					port_id, phy_id, 0, 0);
+		}
+		sas_phy_disconnected(&phy->sas_phy);
 		break;
 	case PORT_IN_RESET:
 		PM8001_MSG_DBG(pm8001_ha,
@@ -3010,22 +3049,26 @@ hw_event_phy_down(struct pm8001_hba_info *pm8001_ha, void *piomb)
 		break;
 	case PORT_NOT_ESTABLISHED:
 		PM8001_MSG_DBG(pm8001_ha,
-			pm8001_printk(" phy Down and PORT_NOT_ESTABLISHED\n"));
+			pm8001_printk(" Phy Down and PORT_NOT_ESTABLISHED\n"));
 		port->port_attached = 0;
 		break;
 	case PORT_LOSTCOMM:
 		PM8001_MSG_DBG(pm8001_ha,
-			pm8001_printk(" phy Down and PORT_LOSTCOMM\n"));
+			pm8001_printk(" Phy Down and PORT_LOSTCOMM\n"));
 		PM8001_MSG_DBG(pm8001_ha,
 			pm8001_printk(" Last phy Down and port invalid\n"));
-		port->port_attached = 0;
-		pm80xx_hw_event_ack_req(pm8001_ha, 0, HW_EVENT_PHY_DOWN,
-			port_id, phy_id, 0, 0);
+		if (phy->phy_type & PORT_TYPE_SATA) {
+			port->port_attached = 0;
+			phy->phy_type = 0;
+			pm80xx_hw_event_ack_req(pm8001_ha, 0, HW_EVENT_PHY_DOWN,
+					port_id, phy_id, 0, 0);
+		}
+		sas_phy_disconnected(&phy->sas_phy);
 		break;
 	default:
 		port->port_attached = 0;
 		PM8001_MSG_DBG(pm8001_ha,
-			pm8001_printk(" phy Down and(default) = 0x%x\n",
+			pm8001_printk(" Phy Down and(default) = 0x%x\n",
 			portstate));
 		break;
 
@@ -3091,7 +3134,7 @@ static int mpi_thermal_hw_event(struct pm8001_hba_info *pm8001_ha, void *piomb)
  */
 static int mpi_hw_event(struct pm8001_hba_info *pm8001_ha, void *piomb)
 {
-	unsigned long flags;
+	unsigned long flags, i;
 	struct hw_event_resp *pPayload =
 		(struct hw_event_resp *)(piomb + 4);
 	u32 lr_status_evt_portid =
@@ -3104,9 +3147,9 @@ static int mpi_hw_event(struct pm8001_hba_info *pm8001_ha, void *piomb)
 		(u16)((lr_status_evt_portid & 0x00FFFF00) >> 8);
 	u8 status =
 		(u8)((lr_status_evt_portid & 0x0F000000) >> 24);
-
 	struct sas_ha_struct *sas_ha = pm8001_ha->sas;
 	struct pm8001_phy *phy = &pm8001_ha->phy[phy_id];
+	struct pm8001_port *port = &pm8001_ha->port[port_id];
 	struct asd_sas_phy *sas_phy = sas_ha->sas_phy[phy_id];
 	PM8001_MSG_DBG(pm8001_ha,
 		pm8001_printk("portid:%d phyid:%d event:0x%x status:0x%x\n",
@@ -3132,7 +3175,9 @@ static int mpi_hw_event(struct pm8001_hba_info *pm8001_ha, void *piomb)
 	case HW_EVENT_PHY_DOWN:
 		PM8001_MSG_DBG(pm8001_ha,
 			pm8001_printk("HW_EVENT_PHY_DOWN\n"));
-		sas_ha->notify_phy_event(&phy->sas_phy, PHYE_LOSS_OF_SIGNAL);
+		if (phy->phy_type & PORT_TYPE_SATA)
+			sas_ha->notify_phy_event(&phy->sas_phy,
+				PHYE_LOSS_OF_SIGNAL);
 		phy->phy_attached = 0;
 		phy->phy_state = 0;
 		hw_event_phy_down(pm8001_ha, piomb);
@@ -3252,13 +3297,19 @@ static int mpi_hw_event(struct pm8001_hba_info *pm8001_ha, void *piomb)
 		pm80xx_hw_event_ack_req(pm8001_ha, 0,
 			HW_EVENT_PORT_RECOVERY_TIMER_TMO,
 			port_id, phy_id, 0, 0);
-		sas_phy_disconnected(sas_phy);
-		phy->phy_attached = 0;
-		sas_ha->notify_port_event(sas_phy, PORTE_LINK_RESET_ERR);
+		for (i = 0; i < pm8001_ha->chip->n_phy; i++) {
+			if (port->wide_port_phymap & (1 << i)) {
+				phy = &pm8001_ha->phy[i];
+				sas_ha->notify_phy_event(&phy->sas_phy,
+						PHYE_LOSS_OF_SIGNAL);
+				port->wide_port_phymap &= ~(1 << i);
+			}
+		}
 		break;
 	case HW_EVENT_PORT_RECOVER:
 		PM8001_MSG_DBG(pm8001_ha,
 			pm8001_printk("HW_EVENT_PORT_RECOVER\n"));
+		hw_event_port_recover(pm8001_ha, piomb);
 		break;
 	case HW_EVENT_PORT_RESET_COMPLETE:
 		PM8001_MSG_DBG(pm8001_ha,
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH V2 7/8] pm80xx: Handling Invalid SSP Response frame
  2015-08-11  9:36 [PATCH V2 0/8] pm80xx: Driver updates Viswas.G
                   ` (5 preceding siblings ...)
  2015-08-11  9:36 ` [PATCH V2 6/8] pm80xx: Add PORT RECOVERY TIMEOUT support Viswas.G
@ 2015-08-11  9:36 ` Viswas.G
  2015-08-11  9:36 ` [PATCH V2 8/8] pm80xx: Bump pm80xx driver version to 0.1.38 Viswas.G
  7 siblings, 0 replies; 13+ messages in thread
From: Viswas.G @ 2015-08-11  9:36 UTC (permalink / raw)
  To: linux-scsi
  Cc: Jack Wang, JBottomley, Tomas Henzl, Suresh.Thiagarajan, Viswas.G,
	Hannes Reinecke

From: Viswas G <Viswas.G@pmcs.com>

The request has to be retried incase if the length of the SSP
Response IU is invalid.

Changes From V1:
None

Signed-off-by: Viswas G <Viswas.G@pmcs.com>

Reviewed-by: Suresh Thiagarajan <Suresh.Thiagarajan@pmcs.com>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Reviewed-by: Jack Wang <jinpu.wang@profitbricks.com>
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
---
 drivers/scsi/pm8001/pm80xx_hwi.c |    7 +++++++
 drivers/scsi/pm8001/pm80xx_hwi.h |    2 +-
 2 files changed, 8 insertions(+), 1 deletions(-)

diff --git a/drivers/scsi/pm8001/pm80xx_hwi.c b/drivers/scsi/pm8001/pm80xx_hwi.c
index 8817ce6..0e1628f 100644
--- a/drivers/scsi/pm8001/pm80xx_hwi.c
+++ b/drivers/scsi/pm8001/pm80xx_hwi.c
@@ -1609,6 +1609,13 @@ mpi_ssp_completion(struct pm8001_hba_info *pm8001_ha , void *piomb)
 		ts->stat = SAS_OPEN_REJECT;
 		ts->open_rej_reason = SAS_OREJ_RSVD_RETRY;
 		break;
+	case IO_XFER_ERROR_INVALID_SSP_RSP_FRAME:
+		PM8001_IO_DBG(pm8001_ha,
+			pm8001_printk("IO_XFER_ERROR_INVALID_SSP_RSP_FRAME\n"));
+		ts->resp = SAS_TASK_COMPLETE;
+		ts->stat = SAS_OPEN_REJECT;
+		ts->open_rej_reason = SAS_OREJ_RSVD_RETRY;
+		break;
 	case IO_OPEN_CNX_ERROR_PROTOCOL_NOT_SUPPORTED:
 		PM8001_IO_DBG(pm8001_ha,
 		pm8001_printk("IO_OPEN_CNX_ERROR_PROTOCOL_NOT_SUPPORTED\n"));
diff --git a/drivers/scsi/pm8001/pm80xx_hwi.h b/drivers/scsi/pm8001/pm80xx_hwi.h
index a083cc6..7a443ba 100644
--- a/drivers/scsi/pm8001/pm80xx_hwi.h
+++ b/drivers/scsi/pm8001/pm80xx_hwi.h
@@ -1175,7 +1175,7 @@ typedef struct SASProtocolTimerConfig SASProtocolTimerConfig_t;
 #define IO_XFER_ERROR_INTERNAL_CRC_ERROR	0x54
 #define MPI_IO_RQE_BUSY_FULL			0x55
 #define IO_XFER_ERR_EOB_DATA_OVERRUN		0x56
-#define IO_XFR_ERROR_INVALID_SSP_RSP_FRAME	0x57
+#define IO_XFER_ERROR_INVALID_SSP_RSP_FRAME	0x57
 #define IO_OPEN_CNX_ERROR_OPEN_PREEMPTED	0x58
 
 #define MPI_ERR_IO_RESOURCE_UNAVAILABLE		0x1004
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH V2 8/8] pm80xx: Bump pm80xx driver version to 0.1.38
  2015-08-11  9:36 [PATCH V2 0/8] pm80xx: Driver updates Viswas.G
                   ` (6 preceding siblings ...)
  2015-08-11  9:36 ` [PATCH V2 7/8] pm80xx: Handling Invalid SSP Response frame Viswas.G
@ 2015-08-11  9:36 ` Viswas.G
  7 siblings, 0 replies; 13+ messages in thread
From: Viswas.G @ 2015-08-11  9:36 UTC (permalink / raw)
  To: linux-scsi
  Cc: Jack Wang, JBottomley, Tomas Henzl, Suresh.Thiagarajan, Viswas.G,
	Hannes Reinecke

From: Viswas G <Viswas.G@pmcs.com>

Bump pm80xx driver version to 0.1.38.

Changes From V1:
None

Signed-off-by: Viswas G <Viswas.G@pmcs.com>

Reviewed-by: Suresh Thiagarajan <Suresh.Thiagarajan@pmcs.com>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Reviewed-by: Jack Wang <jinpu.wang@profitbricks.com>
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
---
 drivers/scsi/pm8001/pm8001_sas.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/scsi/pm8001/pm8001_sas.h b/drivers/scsi/pm8001/pm8001_sas.h
index 2788026..e2e97db 100644
--- a/drivers/scsi/pm8001/pm8001_sas.h
+++ b/drivers/scsi/pm8001/pm8001_sas.h
@@ -58,7 +58,7 @@
 #include "pm8001_defs.h"
 
 #define DRV_NAME		"pm80xx"
-#define DRV_VERSION		"0.1.37"
+#define DRV_VERSION		"0.1.38"
 #define PM8001_FAIL_LOGGING	0x01 /* Error message logging */
 #define PM8001_INIT_LOGGING	0x02 /* driver init logging */
 #define PM8001_DISC_LOGGING	0x04 /* discovery layer logging */
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* Re: [PATCH V2 2/8] pm80xx: Corrected device state changes in I_T_Nexus_Reset.
  2015-08-11  9:36 ` [PATCH V2 2/8] pm80xx: Corrected device state changes in I_T_Nexus_Reset Viswas.G
@ 2015-08-13 12:43   ` Jinpu Wang
  2015-08-14  7:15     ` Viswas G
  2015-08-20 14:51   ` Tomas Henzl
  1 sibling, 1 reply; 13+ messages in thread
From: Jinpu Wang @ 2015-08-13 12:43 UTC (permalink / raw)
  To: Viswas G
  Cc: linux-scsi, JBottomley, Tomas Henzl, Suresh Thiagarajan,
	Hannes Reinecke

Hi

On Tue, Aug 11, 2015 at 11:36 AM,  <Viswas.G@pmcs.com> wrote:
> From: Viswas G <Viswas.G@pmcs.com>
>
> In Nexus reset the device state request are not needed.
>
> Changes from V1:
> Device state change request has been removed as the firmware
> will handle it during internal cleanup. Also updated the
> proper return value in case of failures.

If above is true, should we remove the device state change command
support at all?

Other than that, please feel free to add:
Acked-by: Jack Wang <jinpu.wang@profitbricks.com>

Thanks
Jack


>
> Signed-off-by: Viswas G <Viswas.G@pmcs.com>
>
> Reviewed-by: Suresh Thiagarajan <Suresh.Thiagarajan@pmcs.com>
> ---
>  drivers/scsi/pm8001/pm8001_sas.c |   18 +++++++++++++-----
>  drivers/scsi/pm8001/pm8001_sas.h |    8 ++++++++
>  2 files changed, 21 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/scsi/pm8001/pm8001_sas.c b/drivers/scsi/pm8001/pm8001_sas.c
> index b93f289..48f4627 100644
> --- a/drivers/scsi/pm8001/pm8001_sas.c
> +++ b/drivers/scsi/pm8001/pm8001_sas.c
> @@ -975,19 +975,27 @@ int pm8001_I_T_nexus_reset(struct domain_device *dev)
>         phy = sas_get_local_phy(dev);
>
>         if (dev_is_sata(dev)) {
> -               DECLARE_COMPLETION_ONSTACK(completion_setstate);
>                 if (scsi_is_sas_phy_local(phy)) {
>                         rc = 0;
>                         goto out;
>                 }
>                 rc = sas_phy_reset(phy, 1);
> +               if (rc) {
> +                       PM8001_EH_DBG(pm8001_ha,
> +                       pm8001_printk("phy reset failed for device %x\n"
> +                       "with rc %d\n", pm8001_dev->device_id, rc));
> +                       rc = TMF_RESP_FUNC_FAILED;
> +                       goto out;
> +               }
>                 msleep(2000);
>                 rc = pm8001_exec_internal_task_abort(pm8001_ha, pm8001_dev ,
>                         dev, 1, 0);
> -               pm8001_dev->setds_completion = &completion_setstate;
> -               rc = PM8001_CHIP_DISP->set_dev_state_req(pm8001_ha,
> -                       pm8001_dev, 0x01);
> -               wait_for_completion(&completion_setstate);
> +               if (rc) {
> +                       PM8001_EH_DBG(pm8001_ha,
> +                       pm8001_printk("task abort failed %x\n"
> +                       "with rc %d\n", pm8001_dev->device_id, rc));
> +                       rc = TMF_RESP_FUNC_FAILED;
> +               }
>         } else {
>                 rc = sas_phy_reset(phy, 1);
>                 msleep(2000);
> diff --git a/drivers/scsi/pm8001/pm8001_sas.h b/drivers/scsi/pm8001/pm8001_sas.h
> index 8dd8b78..c9736cc 100644
> --- a/drivers/scsi/pm8001/pm8001_sas.h
> +++ b/drivers/scsi/pm8001/pm8001_sas.h
> @@ -569,6 +569,14 @@ struct pm8001_fw_image_header {
>  #define        NCQ_READ_LOG_FLAG                       0x80000000
>  #define        NCQ_ABORT_ALL_FLAG                      0x40000000
>  #define        NCQ_2ND_RLE_FLAG                        0x20000000
> +
> +/* Device states */
> +#define DS_OPERATIONAL                         0x01
> +#define DS_PORT_IN_RESET                       0x02
> +#define DS_IN_RECOVERY                         0x03
> +#define DS_IN_ERROR                            0x04
> +#define DS_NON_OPERATIONAL                     0x07
> +
>  /**
>   * brief param structure for firmware flash update.
>   */
> --
> 1.7.1
>



-- 
Mit freundlichen Grüßen,
Best Regards,

Jack Wang

Linux Kernel Developer Storage
ProfitBricks GmbH  The IaaS-Company.

ProfitBricks GmbH
Greifswalder Str. 207
D - 10405 Berlin
Tel: +49 30 5770083-42
Fax: +49 30 5770085-98
Email: jinpu.wang@profitbricks.com
URL: http://www.profitbricks.de

Sitz der Gesellschaft: Berlin.
Registergericht: Amtsgericht Charlottenburg, HRB 125506 B.
Geschäftsführer: Andreas Gauger, Achim Weiss.
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 13+ messages in thread

* RE: [PATCH V2 2/8] pm80xx: Corrected device state changes in I_T_Nexus_Reset.
  2015-08-13 12:43   ` Jinpu Wang
@ 2015-08-14  7:15     ` Viswas G
  2015-08-17  7:52       ` Jinpu Wang
  0 siblings, 1 reply; 13+ messages in thread
From: Viswas G @ 2015-08-14  7:15 UTC (permalink / raw)
  To: Jinpu Wang
  Cc: linux-scsi@vger.kernel.org, JBottomley@parallels.com, Tomas Henzl,
	Suresh Thiagarajan, Hannes Reinecke

On Thu, Aug 13, 2015 at 6:13 PM, Jinpu Wang <jinpu.wang@profitbricks.com> wrote:
> Hi
>
> On Tue, Aug 11, 2015 at 11:36 AM,  <Viswas.G@pmcs.com> wrote:
>> From: Viswas G <Viswas.G@pmcs.com>
>>
>> In Nexus reset the device state request are not needed.
>>
>> Changes from V1:
>> Device state change request has been removed as the firmware
>> will handle it during internal cleanup. Also updated the
>> proper return value in case of failures.
>
> If above is true, should we remove the device state change command
> support at all?
>

We can't remove the state change command as it is required for 
some task management command such as ABORT_TASK.

> Other than that, please feel free to add:
> Acked-by: Jack Wang <jinpu.wang@profitbricks.com>
>
> Thanks
> Jack
>
>
>>
>> Signed-off-by: Viswas G <Viswas.G@pmcs.com>
>>
>> Reviewed-by: Suresh Thiagarajan <Suresh.Thiagarajan@pmcs.com>
>> ---
>>  drivers/scsi/pm8001/pm8001_sas.c |   18 +++++++++++++-----
>>  drivers/scsi/pm8001/pm8001_sas.h |    8 ++++++++
>>  2 files changed, 21 insertions(+), 5 deletions(-)
>>
>> diff --git a/drivers/scsi/pm8001/pm8001_sas.c b/drivers/scsi/pm8001/pm8001_sas.c
>> index b93f289..48f4627 100644
>> --- a/drivers/scsi/pm8001/pm8001_sas.c
>> +++ b/drivers/scsi/pm8001/pm8001_sas.c
>> @@ -975,19 +975,27 @@ int pm8001_I_T_nexus_reset(struct domain_device *dev)
>>         phy = sas_get_local_phy(dev);
>>
>>         if (dev_is_sata(dev)) {
>> -               DECLARE_COMPLETION_ONSTACK(completion_setstate);
>>                 if (scsi_is_sas_phy_local(phy)) {
>>                         rc = 0;
>>                         goto out;
>>                 }
>>                 rc = sas_phy_reset(phy, 1);
>> +               if (rc) {
>> +                       PM8001_EH_DBG(pm8001_ha,
>> +                       pm8001_printk("phy reset failed for device %x\n"
>> +                       "with rc %d\n", pm8001_dev->device_id, rc));
>> +                       rc = TMF_RESP_FUNC_FAILED;
>> +                       goto out;
>> +               }
>>                 msleep(2000);
>>                 rc = pm8001_exec_internal_task_abort(pm8001_ha, pm8001_dev ,
>>                         dev, 1, 0);
>> -               pm8001_dev->setds_completion = &completion_setstate;
>> -               rc = PM8001_CHIP_DISP->set_dev_state_req(pm8001_ha,
>> -                       pm8001_dev, 0x01);
>> -               wait_for_completion(&completion_setstate);
>> +               if (rc) {
>> +                       PM8001_EH_DBG(pm8001_ha,
>> +                       pm8001_printk("task abort failed %x\n"
>> +                       "with rc %d\n", pm8001_dev->device_id, rc));
>> +                       rc = TMF_RESP_FUNC_FAILED;
>> +               }
>>         } else {
>>                 rc = sas_phy_reset(phy, 1);
>>                 msleep(2000);
>> diff --git a/drivers/scsi/pm8001/pm8001_sas.h b/drivers/scsi/pm8001/pm8001_sas.h
>> index 8dd8b78..c9736cc 100644
>> --- a/drivers/scsi/pm8001/pm8001_sas.h
>> +++ b/drivers/scsi/pm8001/pm8001_sas.h
>> @@ -569,6 +569,14 @@ struct pm8001_fw_image_header {
>>  #define        NCQ_READ_LOG_FLAG                       0x80000000
>>  #define        NCQ_ABORT_ALL_FLAG                      0x40000000
>>  #define        NCQ_2ND_RLE_FLAG                        0x20000000
>> +
>> +/* Device states */
>> +#define DS_OPERATIONAL                         0x01
>> +#define DS_PORT_IN_RESET                       0x02
>> +#define DS_IN_RECOVERY                         0x03
>> +#define DS_IN_ERROR                            0x04
>> +#define DS_NON_OPERATIONAL                     0x07
>> +
>>  /**
>>   * brief param structure for firmware flash update.
>>   */
>> --
>> 1.7.1
>>
>
>
>
> --
> Mit freundlichen Grüßen,
> Best Regards,
>
> Jack Wang
>
> Linux Kernel Developer Storage
> ProfitBricks GmbH  The IaaS-Company.
>
> ProfitBricks GmbH
> Greifswalder Str. 207
> D - 10405 Berlin
> Tel: +49 30 5770083-42
> Fax: +49 30 5770085-98
> Email: jinpu.wang@profitbricks.com
> URL: http://www.profitbricks.de
>
> Sitz der Gesellschaft: Berlin.
> Registergericht: Amtsgericht Charlottenburg, HRB 125506 B.
> Geschäftsführer: Andreas Gauger, Achim Weiss.
> --
> To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH V2 2/8] pm80xx: Corrected device state changes in I_T_Nexus_Reset.
  2015-08-14  7:15     ` Viswas G
@ 2015-08-17  7:52       ` Jinpu Wang
  0 siblings, 0 replies; 13+ messages in thread
From: Jinpu Wang @ 2015-08-17  7:52 UTC (permalink / raw)
  To: Viswas G
  Cc: linux-scsi@vger.kernel.org, JBottomley@parallels.com, Tomas Henzl,
	Suresh Thiagarajan, Hannes Reinecke

On Fri, Aug 14, 2015 at 9:15 AM, Viswas G <Viswas.G@pmcs.com> wrote:
> On Thu, Aug 13, 2015 at 6:13 PM, Jinpu Wang <jinpu.wang@profitbricks.com> wrote:
>> Hi
>>
>> On Tue, Aug 11, 2015 at 11:36 AM,  <Viswas.G@pmcs.com> wrote:
>>> From: Viswas G <Viswas.G@pmcs.com>
>>>
>>> In Nexus reset the device state request are not needed.
>>>
>>> Changes from V1:
>>> Device state change request has been removed as the firmware
>>> will handle it during internal cleanup. Also updated the
>>> proper return value in case of failures.
>>
>> If above is true, should we remove the device state change command
>> support at all?
>>
>
> We can't remove the state change command as it is required for
> some task management command such as ABORT_TASK.
>

Ok, thanks

-- 
Mit freundlichen Grüßen,
Best Regards,

Jack Wang

Linux Kernel Developer Storage
ProfitBricks GmbH  The IaaS-Company.

ProfitBricks GmbH
Greifswalder Str. 207
D - 10405 Berlin
Tel: +49 30 5770083-42
Fax: +49 30 5770085-98
Email: jinpu.wang@profitbricks.com
URL: http://www.profitbricks.de

Sitz der Gesellschaft: Berlin.
Registergericht: Amtsgericht Charlottenburg, HRB 125506 B.
Geschäftsführer: Andreas Gauger, Achim Weiss.
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH V2 2/8] pm80xx: Corrected device state changes in I_T_Nexus_Reset.
  2015-08-11  9:36 ` [PATCH V2 2/8] pm80xx: Corrected device state changes in I_T_Nexus_Reset Viswas.G
  2015-08-13 12:43   ` Jinpu Wang
@ 2015-08-20 14:51   ` Tomas Henzl
  1 sibling, 0 replies; 13+ messages in thread
From: Tomas Henzl @ 2015-08-20 14:51 UTC (permalink / raw)
  To: Viswas.G, linux-scsi
  Cc: Jack Wang, JBottomley, Suresh.Thiagarajan, Hannes Reinecke

On 11.8.2015 11:36, Viswas.G@pmcs.com wrote:
> From: Viswas G <Viswas.G@pmcs.com>
> 
> In Nexus reset the device state request are not needed.
> 
> Changes from V1:
> Device state change request has been removed as the firmware
> will handle it during internal cleanup. Also updated the
> proper return value in case of failures.
> 
> Signed-off-by: Viswas G <Viswas.G@pmcs.com>
> 
> Reviewed-by: Suresh Thiagarajan <Suresh.Thiagarajan@pmcs.com>
Reviewed-by: Tomas Henzl <thenzl@redhat.com>

Tomas

> ---
>  drivers/scsi/pm8001/pm8001_sas.c |   18 +++++++++++++-----
>  drivers/scsi/pm8001/pm8001_sas.h |    8 ++++++++
>  2 files changed, 21 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/scsi/pm8001/pm8001_sas.c b/drivers/scsi/pm8001/pm8001_sas.c
> index b93f289..48f4627 100644
> --- a/drivers/scsi/pm8001/pm8001_sas.c
> +++ b/drivers/scsi/pm8001/pm8001_sas.c
> @@ -975,19 +975,27 @@ int pm8001_I_T_nexus_reset(struct domain_device *dev)
>  	phy = sas_get_local_phy(dev);
>  
>  	if (dev_is_sata(dev)) {
> -		DECLARE_COMPLETION_ONSTACK(completion_setstate);
>  		if (scsi_is_sas_phy_local(phy)) {
>  			rc = 0;
>  			goto out;
>  		}
>  		rc = sas_phy_reset(phy, 1);
> +		if (rc) {
> +			PM8001_EH_DBG(pm8001_ha,
> +			pm8001_printk("phy reset failed for device %x\n"
> +			"with rc %d\n", pm8001_dev->device_id, rc));
> +			rc = TMF_RESP_FUNC_FAILED;
> +			goto out;
> +		}
>  		msleep(2000);
>  		rc = pm8001_exec_internal_task_abort(pm8001_ha, pm8001_dev ,
>  			dev, 1, 0);
> -		pm8001_dev->setds_completion = &completion_setstate;
> -		rc = PM8001_CHIP_DISP->set_dev_state_req(pm8001_ha,
> -			pm8001_dev, 0x01);
> -		wait_for_completion(&completion_setstate);
> +		if (rc) {
> +			PM8001_EH_DBG(pm8001_ha,
> +			pm8001_printk("task abort failed %x\n"
> +			"with rc %d\n", pm8001_dev->device_id, rc));
> +			rc = TMF_RESP_FUNC_FAILED;
> +		}
>  	} else {
>  		rc = sas_phy_reset(phy, 1);
>  		msleep(2000);
> diff --git a/drivers/scsi/pm8001/pm8001_sas.h b/drivers/scsi/pm8001/pm8001_sas.h
> index 8dd8b78..c9736cc 100644
> --- a/drivers/scsi/pm8001/pm8001_sas.h
> +++ b/drivers/scsi/pm8001/pm8001_sas.h
> @@ -569,6 +569,14 @@ struct pm8001_fw_image_header {
>  #define	NCQ_READ_LOG_FLAG			0x80000000
>  #define	NCQ_ABORT_ALL_FLAG			0x40000000
>  #define	NCQ_2ND_RLE_FLAG			0x20000000
> +
> +/* Device states */
> +#define DS_OPERATIONAL				0x01
> +#define DS_PORT_IN_RESET			0x02
> +#define DS_IN_RECOVERY				0x03
> +#define DS_IN_ERROR				0x04
> +#define DS_NON_OPERATIONAL			0x07
> +
>  /**
>   * brief param structure for firmware flash update.
>   */
> 


^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2015-08-20 14:51 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-08-11  9:36 [PATCH V2 0/8] pm80xx: Driver updates Viswas.G
2015-08-11  9:36 ` [PATCH V2 1/8] pm80xx: Updated link rate Viswas.G
2015-08-11  9:36 ` [PATCH V2 2/8] pm80xx: Corrected device state changes in I_T_Nexus_Reset Viswas.G
2015-08-13 12:43   ` Jinpu Wang
2015-08-14  7:15     ` Viswas G
2015-08-17  7:52       ` Jinpu Wang
2015-08-20 14:51   ` Tomas Henzl
2015-08-11  9:36 ` [PATCH V2 3/8] pm80xx: Update For Thermal Page Code Viswas.G
2015-08-11  9:36 ` [PATCH V2 4/8] pm80xx: Fix for Incorrect DMA Unmapping of SG List Viswas.G
2015-08-11  9:36 ` [PATCH V2 5/8] pm80xx: Remove unnecessary phy disconnect while link error Viswas.G
2015-08-11  9:36 ` [PATCH V2 6/8] pm80xx: Add PORT RECOVERY TIMEOUT support Viswas.G
2015-08-11  9:36 ` [PATCH V2 7/8] pm80xx: Handling Invalid SSP Response frame Viswas.G
2015-08-11  9:36 ` [PATCH V2 8/8] pm80xx: Bump pm80xx driver version to 0.1.38 Viswas.G

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).